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:
toasterbabe 2016-07-19 01:03:40 +01:00
parent ac2ff5e386
commit cfcd25f2cd

View file

@ -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;