mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Fixing a bug which could be caused by tapping up/down on the character select at high speeds by ensuring that o is never negative instead of assuming the one circumstance it may have been negative under.
This commit is contained in:
parent
ac2ff5e386
commit
cfcd25f2cd
1 changed files with 12 additions and 7 deletions
19
src/m_menu.c
19
src/m_menu.c
|
@ -4856,22 +4856,27 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
char_scroll = itemOn*128*FRACUNIT; // just be exact now.
|
||||
|
||||
o = ((char_scroll / FRACUNIT) + 16);
|
||||
if (lastdirection)
|
||||
o += 128; // This one-directional hack is to prevent visual glitches when going from the (currentMenu->numitems)nd character to the 1st character.
|
||||
i = (o / 128);
|
||||
o = (o % 128);
|
||||
|
||||
// subtract 1 from i to counteract the +128 from the prior hack, if we made it happen
|
||||
if (lastdirection)
|
||||
if (o < 0) // This hack is to prevent visual glitches when looping from the last character to the 1st character.
|
||||
{
|
||||
o += 128;
|
||||
|
||||
i = (o / 128);
|
||||
o = (o % 128);
|
||||
|
||||
j = i;
|
||||
do
|
||||
do // subtract 1 from i to counteract the +128 from the prior hack
|
||||
{
|
||||
i--;
|
||||
if (i < 0)
|
||||
i = (currentMenu->numitems - 1);
|
||||
} while (i != j && PlayerMenu[i].status & IT_DISABLED);
|
||||
}
|
||||
else // Regular circumstances
|
||||
{
|
||||
i = (o / 128);
|
||||
o = (o % 128);
|
||||
}
|
||||
|
||||
// Get prev character...
|
||||
prev = i;
|
||||
|
|
Loading…
Reference in a new issue