From 2742467f9e11f1f50d69bc5169d41b816c4c7feb Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 21 May 2022 12:32:40 -0500 Subject: [PATCH] Tweaks for kart v1 MR comments --- src/i_time.c | 8 +++++++- src/m_menu.c | 14 +++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/i_time.c b/src/i_time.c index c86973f6e..c1cc9dfd4 100644 --- a/src/i_time.c +++ b/src/i_time.c @@ -30,6 +30,12 @@ static precise_t enterprecise, oldenterprecise; static fixed_t entertic, oldentertics; static double tictimer; +// A little more than the minimum sleep duration on Windows. +// May be incorrect for other platforms, but we don't currently have a way to +// query the scheduler granularity. SDL will do what's needed to make this as +// low as possible though. +#define MIN_SLEEP_DURATION_MS 2.1 + tic_t I_GetTime(void) { return g_time.time; @@ -90,7 +96,7 @@ void I_SleepDuration(precise_t duration) precise_t dest; { - double gran = round(((double)(precision / 1000) * sleepvalue * 2.1)); + double gran = round(((double)(precision / 1000) * sleepvalue * MIN_SLEEP_DURATION_MS)); delaygranularity = (UINT64)gran; } diff --git a/src/m_menu.c b/src/m_menu.c index 2a857874c..8255e5f35 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -9145,8 +9145,7 @@ Update the maxplayers label... static fixed_t cursorframe = 0; cursorframe += renderdeltatics / 4; - if (cursorframe > 7 * FRACUNIT) - cursorframe -= 7 * FRACUNIT; + for (; cursorframe > 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {} V_DrawFixedPatch(x<> FRACBITS) + 1), PU_CACHE), NULL); } @@ -9537,8 +9536,7 @@ static void M_DrawSetupMultiPlayerMenu(void) UINT8 *colmap; cursorframe += renderdeltatics / 4; - if (cursorframe > 7 * FRACUNIT) - cursorframe -= 7 * FRACUNIT; + for (; cursorframe > 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {} cursor = W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_CACHE); @@ -9579,9 +9577,11 @@ static void M_DrawSetupMultiPlayerMenu(void) st = multi_state->nextstate; if (st != S_NULL) multi_state = &states[st]; - multi_tics = multi_state->tics; - if (multi_tics == -1) - multi_tics = 15; + + if (multi_state->tics <= -1) + multi_tics += 15*FRACUNIT; + else + multi_tics += multi_state->tics * FRACUNIT; } // skin 0 is default player sprite