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
This commit is contained in:
Alug committed 2025-09-29 20:14:36 +02:00
1 parent c7d78fe948
commit 202e24c69c
1 file changed
+3 -7
+3 -7
View File
@@ -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;