Codechange: Define a ZOOM_LVL for minimum text effect visibility.

This commit is contained in:
Peter Nelson 2024-04-04 20:27:11 +01:00 committed by Peter Nelson
parent 197fb00d31
commit 7c322ebcf1
2 changed files with 6 additions and 5 deletions

View File

@ -102,10 +102,10 @@ IntervalTimer<TimerWindow> move_all_text_effects_interval = {std::chrono::millis
continue;
}
te.MarkDirty(ZOOM_LVL_OUT_8X);
te.MarkDirty(ZOOM_LVL_TEXT_EFFECT);
te.duration -= count;
te.top -= count * ZOOM_LVL_BASE;
te.MarkDirty(ZOOM_LVL_OUT_8X);
te.MarkDirty(ZOOM_LVL_TEXT_EFFECT);
}
}};
@ -118,13 +118,13 @@ void InitTextEffects()
void DrawTextEffects(DrawPixelInfo *dpi)
{
/* Don't draw the text effects when zoomed out a lot */
if (dpi->zoom > ZOOM_LVL_OUT_8X) return;
if (dpi->zoom > ZOOM_LVL_TEXT_EFFECT) return;
if (IsTransparencySet(TO_TEXT)) return;
for (TextEffect &te : _text_effects) {
if (te.string_id == INVALID_STRING_ID) continue;
if (te.mode == TE_RISING || _settings_client.gui.loading_indicators) {
CopyInDParam(te.params);
ViewportAddString(dpi, ZOOM_LVL_OUT_8X, &te, te.string_id, te.string_id - 1, STR_NULL);
ViewportAddString(dpi, ZOOM_LVL_TEXT_EFFECT, &te, te.string_id, te.string_id - 1, STR_NULL);
}
}
}

View File

@ -38,7 +38,8 @@ enum ZoomLevel : uint8_t {
ZOOM_LVL_ROADVEH = ZOOM_LVL_OUT_4X, ///< Default zoom level for the road vehicle view.
ZOOM_LVL_WORLD_SCREENSHOT = ZOOM_LVL_OUT_4X, ///< Default zoom level for the world screen shot.
ZOOM_LVL_DETAIL = ZOOM_LVL_OUT_8X, ///< All zoomlevels below or equal to this, will result in details on the screen, like road-work, ...
ZOOM_LVL_DETAIL = ZOOM_LVL_OUT_8X, ///< All zoom levels below or equal to this will result in details on the screen, like road-work, ...
ZOOM_LVL_TEXT_EFFECT = ZOOM_LVL_OUT_8X, ///< All zoom levels above this will not show text effects.
ZOOM_LVL_MIN = ZOOM_LVL_NORMAL, ///< Minimum zoom level.
ZOOM_LVL_MAX = ZOOM_LVL_OUT_32X, ///< Maximum zoom level.