mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Fix "+1 Rank!" possibly overlapping with time trial time in CJK font
If this text on the time trial results screen would overlap with the time value, all rank labels will be displayed on the header line instead ("TIME TAKEN:" etc). This works because the overlap with the time most likely only happens with CJK fonts (where the time will be very wide because of the font size) while strings like "TIME TAKEN" take up very little space due to only needing 4 characters or so for the same information.
This commit is contained in:
parent
e82e1ee236
commit
6fd0b19175
1 changed files with 12 additions and 3 deletions
|
@ -1356,12 +1356,21 @@ static void menurender(void)
|
||||||
|
|
||||||
std::string tempstring = game.resulttimestring() + loc::gettext(" / ") + game.timetstring(game.timetrialresultpar) + loc::gettext(".99");
|
std::string tempstring = game.resulttimestring() + loc::gettext(" / ") + game.timetstring(game.timetrialresultpar) + loc::gettext(".99");
|
||||||
|
|
||||||
|
uint32_t plus1_flags = PR_RIGHT | PR_CJK_LOW;
|
||||||
|
int plus1_offset = 0;
|
||||||
|
if (font::len(0, tempstring.c_str()) + font::len(0, loc::gettext("+1 Rank!")) > (292-49))
|
||||||
|
{
|
||||||
|
// Time and "+1 Rank!" don't fit together, so put it next to titles instead
|
||||||
|
plus1_flags = PR_RIGHT | PR_CJK_HIGH;
|
||||||
|
plus1_offset = -10;
|
||||||
|
}
|
||||||
|
|
||||||
graphics.drawspritesetcol(22, 80-15, 50, 22);
|
graphics.drawspritesetcol(22, 80-15, 50, 22);
|
||||||
font::print(PR_CJK_HIGH, 49, 80-15, loc::gettext("TIME TAKEN:"), 255, 255, 255);
|
font::print(PR_CJK_HIGH, 49, 80-15, loc::gettext("TIME TAKEN:"), 255, 255, 255);
|
||||||
font::print(PR_CJK_LOW, 49, 90-15, tempstring, tr, tg, tb);
|
font::print(PR_CJK_LOW, 49, 90-15, tempstring, tr, tg, tb);
|
||||||
if (game.timetrialresulttime <= game.timetrialresultpar)
|
if (game.timetrialresulttime <= game.timetrialresultpar)
|
||||||
{
|
{
|
||||||
font::print(PR_RIGHT | PR_CJK_LOW, 292, 90-15, loc::gettext("+1 Rank!"), 255, 255, 255);
|
font::print(plus1_flags, 292, 90-15+plus1_offset, loc::gettext("+1 Rank!"), 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
tempstring = help.String(game.timetrialresultdeaths);
|
tempstring = help.String(game.timetrialresultdeaths);
|
||||||
|
@ -1370,7 +1379,7 @@ static void menurender(void)
|
||||||
font::print(PR_CJK_LOW, 49, 90+20, tempstring, tr, tg, tb);
|
font::print(PR_CJK_LOW, 49, 90+20, tempstring, tr, tg, tb);
|
||||||
if (game.timetrialresultdeaths == 0)
|
if (game.timetrialresultdeaths == 0)
|
||||||
{
|
{
|
||||||
font::print(PR_RIGHT | PR_CJK_LOW, 292, 90+20, loc::gettext("+1 Rank!"), 255, 255, 255);
|
font::print(plus1_flags, 292, 90+20+plus1_offset, loc::gettext("+1 Rank!"), 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
char buffer[SCREEN_WIDTH_CHARS + 1];
|
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||||
|
@ -1385,7 +1394,7 @@ static void menurender(void)
|
||||||
font::print(PR_CJK_LOW, 49, 90+55, buffer, tr, tg, tb);
|
font::print(PR_CJK_LOW, 49, 90+55, buffer, tr, tg, tb);
|
||||||
if (game.timetrialresulttrinkets >= game.timetrialresultshinytarget)
|
if (game.timetrialresulttrinkets >= game.timetrialresultshinytarget)
|
||||||
{
|
{
|
||||||
font::print(PR_RIGHT | PR_CJK_LOW, 292, 90+55, loc::gettext("+1 Rank!"), 255, 255, 255);
|
font::print(plus1_flags, 292, 90+55+plus1_offset, loc::gettext("+1 Rank!"), 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* rank = "";
|
const char* rank = "";
|
||||||
|
|
Loading…
Reference in a new issue