Skip to content

Commit

Permalink
Don't use map.extrarow for menu animations
Browse files Browse the repository at this point in the history
This fixes all the headaches about map.extrarow having to be the correct
value and which way it should be and whatnot. The latest headache was
the detection that prevent user-initiated menu animations while an
animation was already happening being tripped because
graphics.menuoffset would be 230 (due to closing the menu while being in
a room without a room name), but then going to a room with a room name
would check for 240 instead, and 230 is less than 240. (The numbers are
the wrong way round because I got the ternaries the wrong way round, but
even if the numbers are the correct way round, the bug would still
happen, but it would just be reversed.)

So instead, I've just made it 240 for both. This doesn't change the
duration of the menu animation (because the animation moves in
increments of 25, and 230 / 25 == 240 / 25 under integer division). It
might change the animation slightly, but it was already inconsistent
anyway because map.extrarow was always set to be 1 in custom levels, and
I legitimately would not be able to tell the difference without
recording the animations and nitpicking it frame-by-frame.

Fixes #841.
  • Loading branch information
InfoTeddy committed Sep 4, 2021
1 parent 70d3c99 commit b667e44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion desktop_version/src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6896,7 +6896,7 @@ void Game::mapmenuchange(const int newgamestate, const bool user_initiated)
{
if (user_initiated
&& graphics.menuoffset > 0
&& graphics.menuoffset < (map.extrarow ? 230 : 240))
&& graphics.menuoffset < 240)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion desktop_version/src/RenderFixed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void maprenderfixed(void)
|| !script.running)
{
graphics.menuoffset += 25;
int threshold = map.extrarow ? 230 : 240;
int threshold = 240;
if (graphics.menuoffset >= threshold)
{
graphics.menuoffset = threshold;
Expand Down

0 comments on commit b667e44

Please sign in to comment.