equal
deleted
inserted
replaced
254 |
254 |
255 _chatmessage_visible = true; |
255 _chatmessage_visible = true; |
256 _chatmessage_dirty = false; |
256 _chatmessage_dirty = false; |
257 } |
257 } |
258 |
258 |
259 /** Text Effects */ |
259 /* Text Effects */ |
|
260 /** |
|
261 * Mark the area of the text effect as dirty. |
|
262 * |
|
263 * This function marks the area of a text effect as dirty for repaint. |
|
264 * |
|
265 * @param te The TextEffect to mark the area dirty |
|
266 * @ingroup dirty |
|
267 */ |
260 static void MarkTextEffectAreaDirty(TextEffect *te) |
268 static void MarkTextEffectAreaDirty(TextEffect *te) |
261 { |
269 { |
|
270 /* Width and height of the text effect are doubled, so they are correct in both zoom out levels 1x and 2x. */ |
262 MarkAllViewportsDirty( |
271 MarkAllViewportsDirty( |
263 te->x, |
272 te->x, |
264 te->y - 1, |
273 te->y - 1, |
265 (te->right - te->x)*2 + te->x + 1, |
274 (te->right - te->x)*2 + te->x + 1, |
266 (te->bottom - (te->y - 1)) * 2 + (te->y - 1) + 1 |
275 (te->bottom - (te->y - 1)) * 2 + (te->y - 1) + 1 |
318 /* Update details */ |
327 /* Update details */ |
319 te = &_text_effect_list[te_id]; |
328 te = &_text_effect_list[te_id]; |
320 te->string_id = msg; |
329 te->string_id = msg; |
321 te->params_1 = GetDParam(0); |
330 te->params_1 = GetDParam(0); |
322 te->params_2 = GetDParam(4); |
331 te->params_2 = GetDParam(4); |
|
332 |
|
333 /* Update width of text effect */ |
|
334 char buffer[100]; |
|
335 GetString(buffer, msg, lastof(buffer)); |
|
336 int w = GetStringBoundingBox(buffer).width; |
|
337 |
|
338 /* Only allow to make it broader, so it completely covers the old text. That avoids remnants of the old text. */ |
|
339 int right_new = te->x + w; |
|
340 if (te->right < right_new) te->right = right_new; |
323 |
341 |
324 MarkTextEffectAreaDirty(te); |
342 MarkTextEffectAreaDirty(te); |
325 } |
343 } |
326 |
344 |
327 void RemoveTextEffect(TextEffectID te_id) |
345 void RemoveTextEffect(TextEffectID te_id) |