From aca48d69cdc7d305ede3237a62e7d6ba44cfda39 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 16 Aug 2025 16:26:39 +0200 Subject: [PATCH] style fixes --- src/d_main.c | 2 +- src/g_game.c | 4 ++-- src/m_random.c | 2 +- src/p_setup.c | 50 +++++++++++++++++++++++++------------------------- src/p_tick.c | 5 +++-- 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index add5b6f5a..f191a546c 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -933,7 +933,6 @@ void D_SRB2Loop(void) Discord_RunCallbacks(); } #endif - // Fully completed frame made. finishprecise = I_GetPreciseTime(); @@ -971,6 +970,7 @@ void D_SRB2Loop(void) I_SleepDuration(capbudget - elapsed); } } + // Capture the time once more to get the real delta time. finishprecise = I_GetPreciseTime(); deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision(); diff --git a/src/g_game.c b/src/g_game.c index 79b5bbdfa..21749d374 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1795,11 +1795,11 @@ void G_Ticker(boolean run) { for (i = 0; i < MAXPLAYERS; i++) // read/write demo and check turbo cheat { - cmd = &players[i].cmd; - if (!playeringame[i]) continue; + cmd = &players[i].cmd; + //@TODO all this throwdir stuff shouldn't be here! But it stays for now to maintain 1.0.4 compat... // Remove for 1.1! diff --git a/src/m_random.c b/src/m_random.c index cb8367b43..7b588bb6f 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -96,7 +96,7 @@ ATTRINLINE static fixed_t FUNCINLINE __internal_prng__(void) randomseed ^= randomseed >> 13; randomseed ^= randomseed >> 11; randomseed ^= randomseed << 21; - return ( (randomseed*36548569) >> 4) & (FRACUNIT-1); + return ((randomseed*36548569) >> 4) & (FRACUNIT-1); } /** Provides a random fixed point number. Distribution is uniform. diff --git a/src/p_setup.c b/src/p_setup.c index 05af8bfcb..51eb3a61b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1747,33 +1747,33 @@ static void P_CreateBlockMap(void) // Now we simply iterate block-by-block until we reach the end block. for (curblockx = bxstart; curblockx <= bxend; curblockx++) - for (curblocky = bystart; curblocky <= byend; curblocky++) - { - size_t b = curblocky * bmapwidth + curblockx; - - if (b >= tot) - continue; - - if (!straight && !(LineInBlock((fixed_t)x, (fixed_t)y, (fixed_t)v2x, (fixed_t)v2y, (fixed_t)(curblockx << MAPBTOFRAC), (fixed_t)(curblocky << MAPBTOFRAC)))) - continue; - - // Increase size of allocated list if necessary - if (bmap[b].n >= bmap[b].nalloc) + for (curblocky = bystart; curblocky <= byend; curblocky++) { - // Graue 02-29-2004: make code more readable, don't realloc a null pointer - // (because it crashes for me, and because the comp.lang.c FAQ says so) - if (bmap[b].nalloc == 0) - bmap[b].nalloc = 8; - else - bmap[b].nalloc *= 2; - bmap[b].list = Z_Realloc(bmap[b].list, bmap[b].nalloc * sizeof (*bmap->list), PU_CACHE, &bmap[b].list); - if (!bmap[b].list) - I_Error("Out of Memory in P_CreateBlockMap"); - } + size_t b = curblocky * bmapwidth + curblockx; - // Add linedef to end of list - bmap[b].list[bmap[b].n++] = (INT32)i; - } + if (b >= tot) + continue; + + if (!straight && !(LineInBlock((fixed_t)x, (fixed_t)y, (fixed_t)v2x, (fixed_t)v2y, (fixed_t)(curblockx << MAPBTOFRAC), (fixed_t)(curblocky << MAPBTOFRAC)))) + continue; + + // Increase size of allocated list if necessary + if (bmap[b].n >= bmap[b].nalloc) + { + // Graue 02-29-2004: make code more readable, don't realloc a null pointer + // (because it crashes for me, and because the comp.lang.c FAQ says so) + if (bmap[b].nalloc == 0) + bmap[b].nalloc = 8; + else + bmap[b].nalloc *= 2; + bmap[b].list = Z_Realloc(bmap[b].list, bmap[b].nalloc * sizeof (*bmap->list), PU_CACHE, &bmap[b].list); + if (!bmap[b].list) + I_Error("Out of Memory in P_CreateBlockMap"); + } + + // Add linedef to end of list + bmap[b].list[bmap[b].n++] = (INT32)i; + } } // Compute the total size of the blockmap. diff --git a/src/p_tick.c b/src/p_tick.c index 09912de59..76379f5a0 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -635,7 +635,8 @@ static inline void P_ResetSpriteStuff(void) mo = (mobj_t *)th; - if (!mo || (mo->sprite == SPR_NULL) || (mo->flags2 & MF2_DONTDRAW) || (mo->type == MT_SHADOW)) + if (!mo || (mo->sprite == SPR_NULL) + || (mo->flags2 & MF2_DONTDRAW) || (mo->type == MT_SHADOW)) continue; mo->spritexscale = mo->realxscale; @@ -712,9 +713,9 @@ void P_Ticker(boolean run) if (playeringame[i]) G_WriteDemoTiccmd(&players[i].cmd, i); } + if (demo.playback) { - #ifdef DEMO_COMPAT_100 if (demo.version == 0x0001) {