mirror of https://github.com/OpenTTD/OpenTTD
(svn r6254) if () cascade -> switch ()
parent
85bd6c05de
commit
b427ce4e20
51
texteff.c
51
texteff.c
|
@ -286,35 +286,32 @@ void InitTextEffects(void)
|
||||||
|
|
||||||
void DrawTextEffects(DrawPixelInfo *dpi)
|
void DrawTextEffects(DrawPixelInfo *dpi)
|
||||||
{
|
{
|
||||||
TextEffect *te;
|
const TextEffect* te;
|
||||||
|
|
||||||
if (dpi->zoom < 1) {
|
switch (dpi->zoom) {
|
||||||
for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
|
case 0:
|
||||||
if (te->string_id == INVALID_STRING_ID)
|
for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
|
||||||
continue;
|
if (te->string_id != INVALID_STRING_ID &&
|
||||||
|
dpi->left <= te->right &&
|
||||||
/* intersection? */
|
dpi->top <= te->bottom &&
|
||||||
if (dpi->left > te->right ||
|
dpi->left + dpi->width > te->x &&
|
||||||
dpi->top > te->bottom ||
|
dpi->top + dpi->height > te->y) {
|
||||||
dpi->left + dpi->width <= te->x ||
|
AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2, 0);
|
||||||
dpi->top + dpi->height <= te->y)
|
}
|
||||||
continue;
|
}
|
||||||
AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2, 0);
|
break;
|
||||||
}
|
|
||||||
} else if (dpi->zoom == 1) {
|
|
||||||
for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
|
|
||||||
if (te->string_id == INVALID_STRING_ID)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* intersection? */
|
|
||||||
if (dpi->left > te->right*2 - te->x ||
|
|
||||||
dpi->top > te->bottom*2 - te->y ||
|
|
||||||
(dpi->left + dpi->width) <= te->x ||
|
|
||||||
(dpi->top + dpi->height) <= te->y)
|
|
||||||
continue;
|
|
||||||
AddStringToDraw(te->x, te->y, (StringID)(te->string_id-1), te->params_1, te->params_2, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
|
||||||
|
if (te->string_id != INVALID_STRING_ID &&
|
||||||
|
dpi->left <= te->right * 2 - te->x &&
|
||||||
|
dpi->top <= te->bottom * 2 - te->y &&
|
||||||
|
dpi->left + dpi->width > te->x &&
|
||||||
|
dpi->top + dpi->height > te->y) {
|
||||||
|
AddStringToDraw(te->x, te->y, (StringID)(te->string_id-1), te->params_1, te->params_2, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue