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
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.
|
char_scroll = itemOn*128*FRACUNIT; // just be exact now.
|
||||||
|
|
||||||
o = ((char_scroll / FRACUNIT) + 16);
|
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 (o < 0) // This hack is to prevent visual glitches when looping from the last character to the 1st character.
|
||||||
if (lastdirection)
|
|
||||||
{
|
{
|
||||||
|
o += 128;
|
||||||
|
|
||||||
|
i = (o / 128);
|
||||||
|
o = (o % 128);
|
||||||
|
|
||||||
j = i;
|
j = i;
|
||||||
do
|
do // subtract 1 from i to counteract the +128 from the prior hack
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
i = (currentMenu->numitems - 1);
|
i = (currentMenu->numitems - 1);
|
||||||
} while (i != j && PlayerMenu[i].status & IT_DISABLED);
|
} while (i != j && PlayerMenu[i].status & IT_DISABLED);
|
||||||
}
|
}
|
||||||
|
else // Regular circumstances
|
||||||
|
{
|
||||||
|
i = (o / 128);
|
||||||
|
o = (o % 128);
|
||||||
|
}
|
||||||
|
|
||||||
// Get prev character...
|
// Get prev character...
|
||||||
prev = i;
|
prev = i;
|
||||||
|
|
Loading…
Reference in a new issue