Better rewrite for addons draw adjustment

This commit is contained in:
mazmazz 2018-12-17 10:58:12 -05:00
parent 6dbe930997
commit b958f00f17

View file

@ -4189,19 +4189,14 @@ static void M_DrawAddons(void)
if (m > (ssize_t)sizedirmenu) if (m > (ssize_t)sizedirmenu)
m = sizedirmenu; m = sizedirmenu;
// then top... // then compute top and adjust bottom if needed!
i = m - (2*numaddonsshown + 1); if (m < (2*numaddonsshown + 1))
// then adjust!
if (i < 0)
{ {
// This line was originally (m -= i), but GCC very helpfully gives us m = min(sizedirmenu, 2*numaddonsshown + 1);
// a Wstrict-overflow warning during optimization.
// i will always be negative here, so let's just add what would have been a double negative!
if ((m += labs(i)) > (ssize_t)sizedirmenu)
m = sizedirmenu;
i = 0; i = 0;
} }
else
i = m - (2*numaddonsshown + 1);
if (i != 0) if (i != 0)
V_DrawString(19, y+4 - (skullAnimCounter/5), highlightflags, "\x1A"); V_DrawString(19, y+4 - (skullAnimCounter/5), highlightflags, "\x1A");