1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Fix clash between timer and return editor text

The "[Press {button} to return to editor]" and the "TIME:" text
overlapped, which resulted in an ugly clash.

To fix this, make the return editor text take priority over the timer
text. This involves a minor refactor to first calculate whether or not
we should draw the return editor text before we check if we should draw
the timer text.
This commit is contained in:
Misa 2024-01-06 15:45:40 -08:00
parent f4bdea7d6d
commit 44fb76ba90

View file

@ -2205,12 +2205,23 @@ void gamerender(void)
} }
} }
int return_editor_alpha = 0;
bool draw_return_editor_text = false;
if (map.custommode && !map.custommodeforreal && !game.advancetext)
{
return_editor_alpha = graphics.lerp(
ed.old_return_message_timer, ed.return_message_timer
);
draw_return_editor_text = return_editor_alpha > 100;
}
if (graphics.fademode == FADE_NONE if (graphics.fademode == FADE_NONE
&& !game.intimetrial && !game.intimetrial
&& !game.isingamecompletescreen() && !game.isingamecompletescreen()
&& (!game.swnmode || game.swngame != SWN_SUPERGRAVITRON) && (!game.swnmode || game.swngame != SWN_SUPERGRAVITRON)
&& game.showingametimer && game.showingametimer
&& !roomname_translator::enabled) && !roomname_translator::enabled
&& !draw_return_editor_text)
{ {
const char* tempstring = loc::gettext("TIME:"); const char* tempstring = loc::gettext("TIME:");
int label_len = font::len(0, tempstring); int label_len = font::len(0, tempstring);
@ -2252,21 +2263,20 @@ void gamerender(void)
} }
} }
if(map.custommode && !map.custommodeforreal && !game.advancetext){ if (draw_return_editor_text)
//Return to level editor {
int alpha = graphics.lerp(ed.old_return_message_timer, ed.return_message_timer); char buffer[SCREEN_WIDTH_CHARS + 1];
vformat_buf(
if (alpha > 100) buffer, sizeof(buffer),
{ loc::gettext("[Press {button} to return to editor]"),
char buffer[SCREEN_WIDTH_CHARS + 1]; "button:but",
vformat_buf( vformat_button(ActionSet_InGame, Action_InGame_Map)
buffer, sizeof(buffer), );
loc::gettext("[Press {button} to return to editor]"), font::print(
"button:but", PR_BRIGHTNESS(return_editor_alpha) | PR_BOR,
vformat_button(ActionSet_InGame, Action_InGame_Map) 5, 5, buffer,
); 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2)
font::print(PR_BRIGHTNESS(alpha) | PR_BOR, 5, 5, buffer, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2)); );
}
} }
graphics.cutscenebars(); graphics.cutscenebars();