|
|
@ -21,8 +21,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
/** Container for all information about a text effect */
|
|
|
|
/** Container for all information about a text effect */
|
|
|
|
struct TextEffect : public ViewportSign {
|
|
|
|
struct TextEffect : public ViewportSign {
|
|
|
|
uint64 params_1; ///< DParam parameter
|
|
|
|
std::vector<StringParameterBackup> params; ///< Backup of string parameters
|
|
|
|
uint64 params_2; ///< second DParam parameter
|
|
|
|
|
|
|
|
StringID string_id; ///< String to draw for the text effect, if INVALID_STRING_ID then it's not valid
|
|
|
|
StringID string_id; ///< String to draw for the text effect, if INVALID_STRING_ID then it's not valid
|
|
|
|
uint8 duration; ///< How long the text effect should stay, in ticks (applies only when mode == TE_RISING)
|
|
|
|
uint8 duration; ///< How long the text effect should stay, in ticks (applies only when mode == TE_RISING)
|
|
|
|
TextEffectMode mode; ///< Type of text effect
|
|
|
|
TextEffectMode mode; ///< Type of text effect
|
|
|
@ -54,8 +53,7 @@ TextEffectID AddTextEffect(StringID msg, int center, int y, uint8 duration, Text
|
|
|
|
/* Start defining this object */
|
|
|
|
/* Start defining this object */
|
|
|
|
te.string_id = msg;
|
|
|
|
te.string_id = msg;
|
|
|
|
te.duration = duration;
|
|
|
|
te.duration = duration;
|
|
|
|
te.params_1 = GetDParam(0);
|
|
|
|
CopyOutDParam(te.params, 2);
|
|
|
|
te.params_2 = GetDParam(1);
|
|
|
|
|
|
|
|
te.mode = mode;
|
|
|
|
te.mode = mode;
|
|
|
|
|
|
|
|
|
|
|
|
/* Make sure we only dirty the new area */
|
|
|
|
/* Make sure we only dirty the new area */
|
|
|
@ -69,10 +67,9 @@ void UpdateTextEffect(TextEffectID te_id, StringID msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Update details */
|
|
|
|
/* Update details */
|
|
|
|
TextEffect *te = _text_effects.data() + te_id;
|
|
|
|
TextEffect *te = _text_effects.data() + te_id;
|
|
|
|
if (msg == te->string_id && GetDParam(0) == te->params_1) return;
|
|
|
|
if (msg == te->string_id && !HaveDParamChanged(te->params)) return;
|
|
|
|
te->string_id = msg;
|
|
|
|
te->string_id = msg;
|
|
|
|
te->params_1 = GetDParam(0);
|
|
|
|
CopyOutDParam(te->params, 2);
|
|
|
|
te->params_2 = GetDParam(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
te->UpdatePosition(te->center, te->top, te->string_id, te->string_id - 1);
|
|
|
|
te->UpdatePosition(te->center, te->top, te->string_id, te->string_id - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -81,8 +78,7 @@ void UpdateAllTextEffectVirtCoords()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (auto &te : _text_effects) {
|
|
|
|
for (auto &te : _text_effects) {
|
|
|
|
if (te.string_id == INVALID_STRING_ID) continue;
|
|
|
|
if (te.string_id == INVALID_STRING_ID) continue;
|
|
|
|
SetDParam(0, te.params_1);
|
|
|
|
CopyInDParam(te.params);
|
|
|
|
SetDParam(1, te.params_2);
|
|
|
|
|
|
|
|
te.UpdatePosition(te.center, te.top, te.string_id, te.string_id - 1);
|
|
|
|
te.UpdatePosition(te.center, te.top, te.string_id, te.string_id - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -126,8 +122,7 @@ void DrawTextEffects(DrawPixelInfo *dpi)
|
|
|
|
for (TextEffect &te : _text_effects) {
|
|
|
|
for (TextEffect &te : _text_effects) {
|
|
|
|
if (te.string_id == INVALID_STRING_ID) continue;
|
|
|
|
if (te.string_id == INVALID_STRING_ID) continue;
|
|
|
|
if (te.mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
|
|
|
|
if (te.mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
|
|
|
|
SetDParam(0, te.params_1);
|
|
|
|
CopyInDParam(te.params);
|
|
|
|
SetDParam(1, te.params_2);
|
|
|
|
|
|
|
|
ViewportAddString(dpi, ZOOM_LVL_OUT_8X, &te, te.string_id, te.string_id - 1, STR_NULL);
|
|
|
|
ViewportAddString(dpi, ZOOM_LVL_OUT_8X, &te, te.string_id, te.string_id - 1, STR_NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|