From 202e24c69cdb4c06639ea33da358833cf9d868b3 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 29 Sep 2025 14:13:15 +0200 Subject: [PATCH] fix precip not propely accounting for moving fofs (again) was fixed a while ago, then i broke it again due to performance concerns now we only update this twice a seconds, and its only for the currently rendered precipmobjs lets see how it performs --- src/p_mobj.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 1e554c53f..c16d5ce4c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3551,7 +3551,7 @@ animonly: } } -static void P_CalculatePrecipFloor(precipmobj_t *mobj, boolean spawn) +static void P_CalculatePrecipFloor(precipmobj_t *mobj) { // recalculate floorz each time const sector_t *sec; @@ -3561,10 +3561,6 @@ static void P_CalculatePrecipFloor(precipmobj_t *mobj, boolean spawn) else return; - // no need to recalc anything if not moved - if (!spawn && !sec->moved) - return; - mobj->floorz = P_GetSectorFloorZAt(sec, mobj->x, mobj->y); if (sec->ffloors) @@ -3657,7 +3653,7 @@ boolean P_PrecipThinker(precipmobj_t *mobj) // only recalc this twice a second (doubt anyone will notice this lulul) if ((leveltime % 17) == 0) - P_CalculatePrecipFloor(mobj, false); + P_CalculatePrecipFloor(mobj); // adjust height if ((mobj->z += mobj->momz) <= mobj->floorz) @@ -10043,7 +10039,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype mobj->thinker.function = (actionf_p1)P_NullPrecipThinker; P_AddPrecipThinker(&mobj->thinker); - P_CalculatePrecipFloor(mobj, true); + P_CalculatePrecipFloor(mobj); if (mobj->floorz != starting_floorz) mobj->precipflags |= PCF_FOF;