mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-10 19:09:45 +01: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:
parent
a22a872886
commit
45c7292096
2 changed files with 8 additions and 28 deletions
|
@ -43,27 +43,15 @@ 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;
|
||||
graphics.menuoffset = threshold;
|
||||
//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;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (graphics.menuoffset > 0)
|
||||
{
|
||||
graphics.menuoffset -= 25;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue