From b069c2cb3e39494909eab2c869ac015ac136639c Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 5 Mar 2025 10:37:10 +0100 Subject: [PATCH] tiny d_main cleanup --- src/d_clisrv.c | 2 +- src/d_main.c | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ec338a6e6..e2a07a233 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -6284,8 +6284,8 @@ static void Local_Maketic(INT32 realtics) // game responder calls HU_Responder, AM_Responder, F_Responder, // and G_MapEventsToControls if (!dedicated) rendergametic = gametic; - // translate inputs (keyboard/mouse/joystick) into game controls + // translate inputs (keyboard/mouse/joystick) into game controls for (i = 0; i <= splitscreen; i++) { CreateNewLocalCMD(i, realtics); diff --git a/src/d_main.c b/src/d_main.c index 96d1867cd..9c13ce18f 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -356,6 +356,7 @@ static boolean D_Display(void) // save the current screen if about to wipe wipe = (gamestate != wipegamestate); + if (wipe) { // set for all later @@ -745,11 +746,9 @@ void D_SRB2Loop(void) precise_t enterprecise = I_GetPreciseTime(); precise_t finishprecise = enterprecise; - { - // Casting the return value of a function is bad practice (apparently) - double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision())); - capbudget = (precise_t) budget; - } + // Casting the return value of a function is bad practice (apparently) + double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision())); + capbudget = (precise_t) budget; boolean ranwipe = false; @@ -795,7 +794,7 @@ void D_SRB2Loop(void) // process tics (but maybe not if realtic == 0) TryRunTics(realtics); - if (lastdraw || singletics || gametic > rendergametic) + if (lastdraw || singletics || (gametic > rendergametic)) { rendergametic = gametic; rendertimeout = entertic + TICRATE/17; @@ -809,7 +808,7 @@ void D_SRB2Loop(void) { // Evaluate the chase cam once for every local realtic // This might actually be better suited inside G_Ticker or TryRunTics - for (tic_t chasecamtics = 0; chasecamtics < realtics; chasecamtics++) + for (tic_t chasecamtics = 0; (chasecamtics < realtics); chasecamtics++) { P_RunChaseCameras(); } @@ -840,7 +839,7 @@ void D_SRB2Loop(void) rendertimefrac = FRACUNIT; } - if (!hu_stopped) + if ((deltatics < 1.0) && !hu_stopped) { rendertimefrac_unpaused = g_time.timefrac; } @@ -895,7 +894,7 @@ void D_SRB2Loop(void) // // Wipes run an inner loop and artificially increase // the measured time. - if (!ranwipe && frameskip < 3 && deltatics > 1.0) + if (!ranwipe && (frameskip < 3) && (deltatics > 1.0)) { frameskip++; } @@ -911,7 +910,7 @@ void D_SRB2Loop(void) // in the case of "match refresh rate" + vsync, don't sleep at all const boolean vsync_with_match_refresh = cv_vidwait.value && cv_fpscap.value == 0; - if (elapsed > 0 && (INT64)capbudget > elapsed && !vsync_with_match_refresh) + if ((elapsed > 0) && ((INT64)capbudget > elapsed) && !vsync_with_match_refresh) { I_SleepDuration(capbudget - (finishprecise - enterprecise)); } @@ -986,10 +985,6 @@ void D_StartTitle(void) S_ResetKeepAndSpecialMus(); // just in case F_StartTitleScreen(); - - // Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade - /*if (rendermode != render_none) - V_SetPaletteLump("PLAYPAL");*/ } // @@ -2087,7 +2082,7 @@ void D_SRB2Main(void) } #ifdef HAVE_DISCORDRPC - if (! dedicated) + if (!dedicated) { DRPC_Init(); }