1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-16 09:38:29 +02:00

Simplify menu-off rendering/logic code

Since "if (graphics.resumegamemode)" and "if (menuoffset > 0)" both do
the same thing, they've been combined with an "or" conjunction.

As well, the map.extrarow check in maplogic() has been refactored to use
a variable instead of duplicating the entire code block. Not that it
matters anyway, because the difference between 240 and 230 is only 10
pixels, far short of the 25 pixel increment that bringing the menu up
and down uses, and both 240 and 230 integer-divided by 25 have the same
non-remainder value of 9.
This commit is contained in:
Misa 2020-04-28 20:31:29 -07:00 committed by Ethan Lee
parent a22a872886
commit 45c7292096
2 changed files with 8 additions and 28 deletions

View File

@ -43,25 +43,13 @@ void maplogic()
if (graphics.resumegamemode)
{
graphics.menuoffset += 25;
if (map.extrarow)
int threshold = map.extrarow ? 230 : 240;
if (graphics.menuoffset >= threshold)
{
if (graphics.menuoffset >= 230)
{
graphics.menuoffset = 230;
//go back to gamemode!
game.mapheld = true;
game.gamestate = GAMEMODE;
}
}
else
{
if (graphics.menuoffset >= 240)
{
graphics.menuoffset = 240;
//go back to gamemode!
game.mapheld = true;
game.gamestate = GAMEMODE;
}
graphics.menuoffset = threshold;
//go back to gamemode!
game.mapheld = true;
game.gamestate = GAMEMODE;
}
}
else if (graphics.menuoffset > 0)

View File

@ -2455,11 +2455,7 @@ void maprender()
graphics.drawfade();
}
if (graphics.resumegamemode)
{
graphics.menuoffrender();
}
else if (graphics.menuoffset > 0)
if (graphics.resumegamemode || graphics.menuoffset > 0)
{
graphics.menuoffrender();
}
@ -2595,11 +2591,7 @@ void teleporterrender()
}
if (graphics.resumegamemode)
{
graphics.menuoffrender();
}
else if (graphics.menuoffset > 0)
if (graphics.resumegamemode || graphics.menuoffset > 0)
{
graphics.menuoffrender();
}