(svn r6254) if () cascade -> switch ()

This commit is contained in:
tron 2006-08-31 07:13:36 +00:00
parent 85bd6c05de
commit b427ce4e20
1 changed files with 24 additions and 27 deletions

View File

@ -286,35 +286,32 @@ void InitTextEffects(void)
void DrawTextEffects(DrawPixelInfo *dpi)
{
TextEffect *te;
const TextEffect* te;
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 ||
dpi->top > te->bottom ||
dpi->left + dpi->width <= te->x ||
dpi->top + dpi->height <= te->y)
continue;
AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2, 0);
}
} 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);
}
switch (dpi->zoom) {
case 0:
for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
if (te->string_id != INVALID_STRING_ID &&
dpi->left <= te->right &&
dpi->top <= te->bottom &&
dpi->left + dpi->width > te->x &&
dpi->top + dpi->height > te->y) {
AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2, 0);
}
}
break;
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;
}
}