From b3e953c8c34689c82d1ea589b1e9c34a2217dce1 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 14 Jul 2019 14:21:32 +0100 Subject: [PATCH] Correct some extant fuckups. --- src/hardware/hw_light.c | 2 +- src/p_tick.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 2456be311..a52d72869 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -1170,7 +1170,7 @@ void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch) if (!(p_lspr->type & DYNLIGHT_SPR)) return; if ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value) - return; + return; LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x); LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(spr->mobj->z)+FIXED_TO_FLOAT(spr->mobj->height>>1)+p_lspr->light_yoffset; diff --git a/src/p_tick.c b/src/p_tick.c index 1d248d2ae..a0f6edef9 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -230,13 +230,19 @@ void P_RemoveThinkerDelayed(thinker_t *thinker) { thinker_t *next; #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 +#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) return; +#endif /* Remove from main thinker list */ next = thinker->next;