From abba2a9eac194fb0a49aa593d246c465d5ff586c Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 13:09:03 +0200 Subject: [PATCH 01/10] fix cv_set being called for allowsaturnjoin before its registered --- src/d_netcmd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ebbf91736..3b53dd8c4 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -752,6 +752,11 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_killingdead); // d_clisrv +#ifndef NONET +#ifdef SATURNJOIN + CV_RegisterVar(&cv_allownewsaturnplayer); // need to register it before cv_maxplayers && cv_allownewplayer +#endif +#endif CV_RegisterVar(&cv_maxplayers); CV_RegisterVar(&cv_resynchattempts); #ifdef SATURNPAK @@ -765,9 +770,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_httpsource); #ifndef NONET CV_RegisterVar(&cv_allownewplayer); -#ifdef SATURNJOIN - CV_RegisterVar(&cv_allownewsaturnplayer); -#endif + CV_RegisterVar(&cv_joinrefusemessage); CV_RegisterVar(&cv_chatlogsize); #ifdef VANILLAJOINNEXTROUND From 0b515939ad4719d3f55cbfc42ecb181cc35c8695 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 13:10:07 +0200 Subject: [PATCH 02/10] we have a global to check if config was loaded --- src/d_main.c | 6 ++++-- src/m_misc.c | 7 +------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index ad65138e8..44511b87d 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -147,7 +147,7 @@ INT32 eventhead, eventtail; boolean dedicated = false; -boolean loaded_config = false; +boolean loaded_config = false; // true once config.cfg loaded AND executed // // D_PostEvent @@ -1881,7 +1881,9 @@ void D_SRB2Main(void) savedata.lives = 0; // flag this as not-used - loaded_config = true; // so pallettechange doesent get called 500 times at startup lol + // make sure I_Quit() will write back the correct config + // (do not write back the config if it crash before) + loaded_config = true; // so palettechange doesent get called 500 times at startup lol //------------------------------------------------ COMMAND LINE PARAMS diff --git a/src/m_misc.c b/src/m_misc.c index ca4b745ed..ff9892464 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -443,7 +443,6 @@ char configfile[MAX_WADPATH]; // ========================================================================== // CONFIGURATION // ========================================================================== -static boolean gameconfig_loaded = false; // true once config.cfg loaded AND executed /** Saves a player's config, possibly to a particular file. * @@ -548,10 +547,6 @@ void M_FirstLoadConfig(void) // don't filter anymore vars and don't let this convsvar be changed COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION)); CV_ToggleExecVersion(false); - - // make sure I_Quit() will write back the correct config - // (do not write back the config if it crash before) - gameconfig_loaded = true; } /** Saves the game configuration. @@ -565,7 +560,7 @@ void M_SaveConfig(const char *filename) char backupfile[MAX_WADPATH+4]; // make sure not to write back the config until it's been correctly loaded - if (!gameconfig_loaded) + if (!loaded_config) return; // Create backup of the config file From 0ceeac4726cf799ea7f4f645adb7527bd8b63ab8 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 13:23:11 +0200 Subject: [PATCH 03/10] nooo PARANOIA dont set our thinker next to NULL --- src/p_tick.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/p_tick.c b/src/p_tick.c index 8fbdf8b6a..91f40c623 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -243,13 +243,19 @@ static thinker_t *currentthinker; void P_RemoveThinkerDelayed(thinker_t *thinker) { #ifdef PARANOIA - if (thinker->next) - thinker->next = NULL; - else if (thinker->references) // Usually gets cleared up in one frame; what's going on here, then? - CONS_Printf("Number of potentially faulty references: %d\n", thinker->references); -#endif - if (thinker->references) +#define BEENAROUNDBIT (0x40000000) // has to be sufficiently high that it's unlikely to happen in regular gameplay. If you change this, pay attention to the bit pattern of INT32_MIN. + if (thinker->references & ~BEENAROUNDBIT) + { + if (thinker->references & BEENAROUNDBIT) // Usually gets cleared up in one frame; what's going on here, then? + CONS_Printf("Number of potentially faulty references: %d\n", (thinker->references & ~BEENAROUNDBIT)); + thinker->references |= BEENAROUNDBIT; return; + } +#undef BEENAROUNDBIT +#else + if (thinker->references != 0) + return; +#endif /* Remove from main thinker list */ thinker_t *next = thinker->next; From cd7177682ab8696e6c4fdf72d0c8175f0e1c4b2d Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 13:43:55 +0200 Subject: [PATCH 04/10] fix P_RemoveSavegameMobj triggering assert in P_UnlinkThinker --- src/p_mobj.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index a743f05fc..66d4493ca 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10163,8 +10163,10 @@ void P_FreePrecipMobj(precipmobj_t *mobj) // Clearing out stuff for savegames void P_RemoveSavegameMobj(mobj_t *mobj) { + thinker_t *th = (thinker_t*)mobj; + // unlink from sector and block lists - if (((thinker_t *)mobj)->function.acp1 == (actionf_p1)P_NullPrecipThinker) + if (th->function.acp1 == (actionf_p1)P_NullPrecipThinker) { P_UnsetPrecipThingPosition((precipmobj_t *)mobj); } @@ -10185,9 +10187,13 @@ void P_RemoveSavegameMobj(mobj_t *mobj) S_StopSound(mobj); R_RemoveMobjInterpolator(mobj); + // just set its reference count to 0 to not trigger the assert in P_UnlinkThinker + if (th->references != 0) + th->references = 0; + // free block // Here we use the same code as R_RemoveThinkerDelayed, but without reference counting (we're removing everything so it shouldn't matter) and without touching currentthinker since we aren't in P_RunThinkers - P_UnlinkThinker((thinker_t*)mobj); + P_UnlinkThinker(th); } static CV_PossibleValue_t respawnitemtime_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}}; From 55704f2ba2a9ff6ca31b911a5154c0a72dabe1ff Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 16:02:41 +0200 Subject: [PATCH 05/10] port RRs improved paranoia thinker/mobj prints https://git.srb2.org/KartKrew/RingRacers/-/commit/509a023329ea1cd583c500a3287c488e5ee3e3a6 https://git.srb2.org/KartKrew/RingRacers/-/commit/17aaf178d587970a3a845aa6c2f3807077996a77 --- src/d_think.h | 6 +++ src/p_mobj.c | 8 ++++ src/p_polyobj.c | 3 ++ src/p_tick.c | 123 ++++++++++++++++++++++++++++++++++++++++++------ src/p_tick.h | 14 +++++- 5 files changed, 139 insertions(+), 15 deletions(-) diff --git a/src/d_think.h b/src/d_think.h index 6b8ee113a..8177f464d 100644 --- a/src/d_think.h +++ b/src/d_think.h @@ -17,6 +17,8 @@ #ifndef __D_THINK__ #define __D_THINK__ +#include "doomdef.h" + #ifdef __GNUG__ #pragma interface #endif @@ -50,6 +52,10 @@ typedef struct thinker_s // this one using pointers. Used for garbage collection. INT32 references; boolean cachable; +#ifdef PARANOIA + INT32 debug_mobjtype; + tic_t debug_time; +#endif } thinker_t; #endif diff --git a/src/p_mobj.c b/src/p_mobj.c index 66d4493ca..fb34b335d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10132,6 +10132,10 @@ void P_RemoveMobj(mobj_t *mobj) { // Add thinker just to delay removing it until refrences are gone. mobj->flags &= ~MF_NOTHINK; P_AddThinker((thinker_t *)mobj); +#ifdef PARANOIA + // Saved to avoid being scrambled like below... + mobj->thinker.debug_mobjtype = mobj->type; +#endif #ifdef SCRAMBLE_REMOVED // Invalidate mobj_t data to cause crashes if accessed! memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t)); @@ -10141,6 +10145,10 @@ void P_RemoveMobj(mobj_t *mobj) } else { +#ifdef PARANOIA + // Saved to avoid being scrambled like below... + mobj->thinker.debug_mobjtype = mobj->type; +#endif #ifdef SCRAMBLE_REMOVED // Invalidate mobj_t data to cause crashes if accessed! memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t)); diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 61c08a05d..629595068 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -156,6 +156,9 @@ FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th) th->references = 0; th->cachable = false; // not initialising this made the mobjcache die thx! +#ifdef PARANOIA + th->debug_mobjtype = MT_NULL; +#endif } static void FreeSideLists(void) diff --git a/src/p_tick.c b/src/p_tick.c index 91f40c623..986708767 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -11,6 +11,10 @@ /// \file p_tick.c /// \brief Archiving: SaveGame I/O, Thinker, Ticker +#ifdef PARANOIA +#include "dehacked.h" // MOBJTYPE_LIST +#endif + #include "doomstat.h" #include "g_game.h" #include "g_input.h" @@ -204,6 +208,9 @@ void P_AddThinker(thinker_t *thinker) thinker->references = 0; // killough 11/98: init reference counter to 0 thinker->cachable = (thinker->function.acp1 == (actionf_p1)P_MobjThinker); +#ifdef PARANOIA + thinker->debug_mobjtype = MT_NULL; +#endif } // @@ -220,8 +227,48 @@ void P_AddPrecipThinker(thinker_t *thinker) thinker->references = 0; // killough 11/98: init reference counter to 0 thinker->cachable = false; +#ifdef PARANOIA + thinker->debug_mobjtype = MT_NULL; +#endif } +#ifdef PARANOIA +static const char *MobjTypeName(const mobj_t *mobj) +{ + actionf_p1 p1 = mobj->thinker.function.acp1; + + if (p1 == (actionf_p1)P_MobjThinker) + { + return MOBJTYPE_LIST[mobj->type]; + } + else if (p1 == (actionf_p1)P_RemoveThinkerDelayed) + { + if (mobj->thinker.debug_mobjtype != MT_NULL) + { + return MOBJTYPE_LIST[mobj->thinker.debug_mobjtype]; + } + } + + return ""; +} + +static const char *MobjThinkerName(const mobj_t *mobj) +{ + actionf_p1 p1 = mobj->thinker.function.acp1; + + if (p1 == (actionf_p1)P_MobjThinker) + { + return "P_MobjThinker"; + } + else if (p1 == (actionf_p1)P_RemoveThinkerDelayed) + { + return "P_RemoveThinkerDelayed"; + } + + return ""; +} +#endif + // // killough 11/98: // @@ -242,20 +289,35 @@ static thinker_t *currentthinker; // void P_RemoveThinkerDelayed(thinker_t *thinker) { -#ifdef PARANOIA -#define BEENAROUNDBIT (0x40000000) // has to be sufficiently high that it's unlikely to happen in regular gameplay. If you change this, pay attention to the bit pattern of INT32_MIN. - if (thinker->references & ~BEENAROUNDBIT) + if (thinker->references != 0) { - if (thinker->references & BEENAROUNDBIT) // Usually gets cleared up in one frame; what's going on here, then? - CONS_Printf("Number of potentially faulty references: %d\n", (thinker->references & ~BEENAROUNDBIT)); - thinker->references |= BEENAROUNDBIT; +#ifdef PARANOIA + // Removed mobjs can be the target of another mobj. In + // that case, the other mobj will manage its reference + // to the removed mobj in P_MobjThinker. However, if + // the removed mobj is removed after the other object + // thinks, the reference management is delayed by one + // tic (or two?) + const UINT8 delay = 2; + + if (thinker->debug_time > leveltime) + { + thinker->debug_time = leveltime + delay + 1; // do not print errors again + } + else if ((thinker->debug_time + delay) <= leveltime) + { + CONS_Printf( + "PARANOIA/P_RemoveThinkerDelayed: %p %s references=%d\n", + (void*)thinker, + MobjTypeName((mobj_t*)thinker), + thinker->references + ); + + thinker->debug_time = leveltime + delay + 1; // do not print this error again + } +#endif return; } -#undef BEENAROUNDBIT -#else - if (thinker->references != 0) - return; -#endif /* Remove from main thinker list */ thinker_t *next = thinker->next; @@ -333,12 +395,45 @@ void P_RemoveThinker(thinker_t *thinker) * references, and delay removal until the count is 0. */ -mobj_t *P_SetTarget(mobj_t **mop, mobj_t *targ) +mobj_t *P_SetTarget2(mobj_t **mop, mobj_t *targ +#ifdef PARANOIA + , const char *source_file, int source_line +#endif +) { - if (*mop) // If there was a target already, decrease its refcount + if (*mop) // If there was a target already, decrease its refcount + { (*mop)->thinker.references--; - if ((*mop = targ) != NULL) // Set new target and if non-NULL, increase its counter + +#ifdef PARANOIA + if ((*mop)->thinker.references < 0) + { + CONS_Printf( + "PARANOIA/P_SetTarget: %p %s %s references=%d, references go negative! (%s:%d)\n", + (void*)*mop, + MobjTypeName(*mop), + MobjThinkerName(*mop), + (*mop)->thinker.references, + source_file, + source_line + ); + } + + (*mop)->thinker.debug_time = leveltime; +#endif + } + + if (targ != NULL) // Set new target and if non-NULL, increase its counter + { targ->thinker.references++; + +#ifdef PARANOIA + targ->thinker.debug_time = leveltime; +#endif + } + + *mop = targ; + return targ; } diff --git a/src/p_tick.h b/src/p_tick.h index 11b5889ed..a903be0fd 100644 --- a/src/p_tick.h +++ b/src/p_tick.h @@ -14,6 +14,8 @@ #ifndef __P_TICK__ #define __P_TICK__ +#include "doomdef.h" + #ifdef __GNUG__ #pragma interface #endif @@ -29,6 +31,16 @@ void P_Ticker(boolean run); void P_PreTicker(INT32 frames); void P_DoTeamscrambling(void); void P_RemoveThinkerDelayed(thinker_t *thinker); -mobj_t *P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98 +mobj_t *P_SetTarget2(mobj_t **mo, mobj_t *target +#ifdef PARANOIA +, const char *source_file, int source_line +#endif +); + +#ifdef PARANOIA +#define P_SetTarget(...) P_SetTarget2(__VA_ARGS__, __FILE__, __LINE__) +#else +#define P_SetTarget P_SetTarget2 +#endif #endif From ede95c8ec40cfd7c0dcb75a44d3f5c954088cee7 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 16:04:53 +0200 Subject: [PATCH 06/10] use P_UnlinkThinker idk why it still was like this in here lel --- src/p_tick.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/p_tick.c b/src/p_tick.c index 986708767..212c2f1e6 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -319,25 +319,16 @@ void P_RemoveThinkerDelayed(thinker_t *thinker) return; } - /* Remove from main thinker list */ - thinker_t *next = thinker->next; + R_DestroyLevelInterpolators(thinker); + /* Note that currentthinker is guaranteed to point to us, * and since we're freeing our memory, we had better change that. So * point it to thinker->prev, so the iterator will correctly move on to * thinker->prev->next = thinker->next */ - (next->prev = currentthinker = thinker->prev)->next = next; - R_DestroyLevelInterpolators(thinker); + currentthinker = thinker->prev; - if (thinker->cachable == true) - { - // put cachable thinkers in the mobj cache, so we can avoid allocations - ((mobj_t *)thinker)->hnext = mobjcache; - mobjcache = (mobj_t *)thinker; - } - else - { - Z_Free(thinker); - } + /* Remove from main thinker list */ + P_UnlinkThinker(thinker); } // From def40280285d8b2ff3fdbd94b9b36010be9f3458 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 11:39:54 +0200 Subject: [PATCH 07/10] add P_DivlineCrossedFast to take more advantage of P_DivlineSideFast --- src/p_sight.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/p_sight.c b/src/p_sight.c index 5dfc796b8..b02ffd786 100644 --- a/src/p_sight.c +++ b/src/p_sight.c @@ -34,6 +34,7 @@ typedef struct { static INT32 sightcounts[2]; typedef INT32 (*divlinefunc)(fixed_t x, fixed_t y, const divline_t *node); +typedef INT32 (*divlinecrossfunc)(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, const divline_t *node); // // P_DivlineSide @@ -67,6 +68,11 @@ static inline INT32 P_DivlineCrossed(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t return (P_DivlineSide(x1, y1, node) == P_DivlineSide(x2, y2, node)); } +static inline INT32 P_DivlineCrossedFast(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, const divline_t *node) +{ + return (P_DivlineSideFast(x1, y1, node) == P_DivlineSideFast(x2, y2, node)); +} + static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los) { size_t i; @@ -130,7 +136,7 @@ static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los) // // Returns true if strace crosses the given subsector successfully. // -static boolean P_CrossSubsector(size_t num, register los_t *los) +static boolean P_CrossSubsector(size_t num, register los_t *los, boolean fast) { seg_t *seg; INT32 count; @@ -159,6 +165,8 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) } } + const divlinecrossfunc divlinecrossFunc = fast ? P_DivlineCrossedFast : P_DivlineCrossed; + for (count = subsectors[num].numlines; --count >= 0; seg++) // check lines { line_t *line = seg->linedef; @@ -187,14 +195,14 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) v2 = line->v2; // line isn't crossed? - if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace)) + if (divlinecrossFunc(v1->x, v1->y, v2->x, v2->y, &los->strace)) continue; divl.dx = v2->x - (divl.x = v1->x); divl.dy = v2->y - (divl.y = v1->y); // line isn't crossed? - if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl)) + if (divlinecrossFunc(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl)) continue; // stop because it is not two sided anyway @@ -326,7 +334,7 @@ static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los, boolean fast) } } - return P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los); + return P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los, fast); } // From 9d1b8ba736922f69f6df16c3b549e3b5f8dba428 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 16:14:33 +0200 Subject: [PATCH 08/10] move saturn menu stuff around --- src/m_menu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 72c28857c..bcd406e4c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2452,17 +2452,17 @@ static menuitem_t OP_SaturnHudMenu[] = {IT_STRING | IT_CVAR, NULL, "Show Names on Minimap", &cv_showminimapnames, 135}, {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 140}, - {IT_STRING | IT_CVAR, NULL, "Spin Minimap Icons", &cv_spinoutroll, 150}, - {IT_STRING | IT_CVAR, NULL, "Player Angle Dot", &cv_showminimapangle, 160}, + {IT_STRING | IT_CVAR, NULL, "Spin Minimap Icons", &cv_spinoutroll, 145}, + {IT_STRING | IT_CVAR, NULL, "Player Angle Dot", &cv_showminimapangle, 150}, - {IT_STRING | IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 170}, + {IT_STRING | IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 160}, - {IT_STRING | IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 180}, + {IT_STRING | IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 170}, - {IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 190}, - {IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 195}, + {IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 180}, + {IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 185}, - {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 205}, + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 195}, }; static const char* OP_SaturnHudTooltips[] = From 1d15f89433c4cb485b7894373bb97fb7d8db9da8 Mon Sep 17 00:00:00 2001 From: Indev Date: Wed, 23 Apr 2025 19:09:02 +0300 Subject: [PATCH 09/10] Remove I_Assert in GetItemId in lua_hudlib_drawlist.c It is legal for lua_getpc to be null (thanks GenericHeroGuy for investigating!) --- src/lua_hudlib_drawlist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lua_hudlib_drawlist.c b/src/lua_hudlib_drawlist.c index 98a4890b1..a9c9d93b7 100644 --- a/src/lua_hudlib_drawlist.c +++ b/src/lua_hudlib_drawlist.c @@ -337,7 +337,6 @@ static UINT64 GetItemId(void) #else // he who controls the JIT controls the API const void *p = lua_getpc(gL, 1); - I_Assert(p != NULL); UINT64 id = (uintptr_t)p; #endif // leave bits 0 and 1 free for the string mode From 1bb52b9c2d270f243bda280915406645ca59b207 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Apr 2025 19:54:17 +0200 Subject: [PATCH 10/10] check ceiling first in encore flat precaching no clue why but this fixes the sides of the road on ORR not being encore remapped --- src/hardware/hw_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 5ba8655b8..f3b4ae84f 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -553,7 +553,7 @@ static void HWR_PrecacheLevelFlats(void) // gotta check sector floor and ceiling for (j = 0; j < 2; j++) { - const boolean ceiling = (j == 1); + const boolean ceiling = (j == 0); INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic; levelflat = levelflats[pic];