From 1d4c4cef9eef188f4a1b4ca4e44a223e78e30080 Mon Sep 17 00:00:00 2001 From: GenericHeroGuy Date: Sat, 11 Oct 2025 13:41:12 +0200 Subject: [PATCH] Reset spechit count after moving, not before Doesn't fix any Lua stack overflows, but at least it doesn't segfault --- src/p_map.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index a15c6e7ce..8e79f8fe3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -105,8 +105,6 @@ static boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) boolean startingonground = P_IsObjectOnGround(thing); sector_t *oldsector = thing->subsector->sector; - numspechit = 0U; - // the move is ok, // so link the thing into its new position P_UnsetThingPosition(thing); @@ -2521,9 +2519,6 @@ increment_move fixed_t thingtop; g_tm.floatok = false; - // reset this to 0 at the start of each trymove call as it's only used here - numspechitint = 0U; - // This makes sure that there are no freezes from computing extremely small movements. // Originally was MAXRADIUS/2, but that causes some inconsistencies for small players. radius = max(radius, mapobjectscale); @@ -2830,6 +2825,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, Try } } + numspechitint = 0U; + if (result != NULL) { result->success = true; @@ -2938,10 +2935,6 @@ void P_HitSpecialLines(mobj_t *thing, fixed_t x, fixed_t y, fixed_t momx, fixed_ I_Error("Previously-removed Thing of type %u crashes P_CheckPosition!", thing->type); #endif - // reset special lines - numspechitint = 0U; - numspechit = 0U; - // trace along the three leading corners if (momx > 0) { @@ -2985,6 +2978,9 @@ void P_HitSpecialLines(mobj_t *thing, fixed_t x, fixed_t y, fixed_t momx, fixed_ P_CrossSpecialLine(ld, oldside, thing); } } + + // reset special lines + numspechitint = numspechit = 0U; } //