Пример #1
0
/* Text Effects */
TextEffectID AddTextEffect(StringID msg, int center, int y, uint8 duration, TextEffectMode mode)
{
	if (_game_mode == GM_MENU) return INVALID_TE_ID;

	TextEffectID i;
	for (i = 0; i < _text_effects.Length(); i++) {
		if (_text_effects[i].string_id == INVALID_STRING_ID) break;
	}
	if (i == _text_effects.Length()) _text_effects.Append();

	TextEffect *te = _text_effects.Get(i);

	/* Start defining this object */
	te->string_id = msg;
	te->duration = duration;
	te->params_1 = GetDParam(0);
	te->params_2 = GetDParam(1);
	te->mode = mode;

	/* Make sure we only dirty the new area */
	te->width_normal = 0;
	te->UpdatePosition(center, y, msg);

	return i;
}
Пример #2
0
void UpdateTextEffect(TextEffectID te_id, StringID msg)
{
	/* Update details */
	TextEffect *te = _text_effects.Get(te_id);
	if (msg == te->string_id && GetDParam(0) == te->params_1) return;
	te->string_id = msg;
	te->params_1 = GetDParam(0);

	te->UpdatePosition(te->center, te->top, msg);
}