From b958f00f1781efddedc0de55dc29509198a8fe98 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 17 Dec 2018 10:58:12 -0500 Subject: [PATCH] Better rewrite for addons draw adjustment --- src/m_menu.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index c3977798..e6938571 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4189,19 +4189,14 @@ static void M_DrawAddons(void) if (m > (ssize_t)sizedirmenu) m = sizedirmenu; - // then top... - i = m - (2*numaddonsshown + 1); - - // then adjust! - if (i < 0) + // then compute top and adjust bottom if needed! + if (m < (2*numaddonsshown + 1)) { - // This line was originally (m -= i), but GCC very helpfully gives us - // 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; + m = min(sizedirmenu, 2*numaddonsshown + 1); i = 0; } + else + i = m - (2*numaddonsshown + 1); if (i != 0) V_DrawString(19, y+4 - (skullAnimCounter/5), highlightflags, "\x1A");