// LordHavoc: gross hack to make floating items still work
int suspendedinairflag;
+
+ // cached position to avoid redundant SV_CheckWaterTransition calls on monsters
+ qboolean waterposition_forceupdate; // force an update on this entity (set by SV_PushMove code for moving water entities)
+ vec3_t waterposition_origin; // updates whenever this changes
+
// used by PushMove to keep track of where objects were before they were
// moved, in case they need to be moved back
vec3_t moved_from;
|| check->fields.server->movetype == MOVETYPE_FAKEPUSH)
continue;
+ // tell any MOVETYPE_STEP entity that it may need to check for water transitions
+ check->priv.server->waterposition_forceupdate = true;
+
// if the entity is standing on the pusher, it will definitely be moved
// if the entity is not standing on the pusher, but is in the pusher's
// final position, move it
SV_CheckVelocity(ent);
SV_FlyMove(ent, sv.frametime, NULL, SV_GenericHitSuperContentsMask(ent));
SV_LinkEdict(ent, true);
+ ent->priv.server->waterposition_forceupdate = true;
}
}
else
// just hit ground
if (hitsound && (int)ent->fields.server->flags & FL_ONGROUND && sv_sound_land.string)
SV_StartSound(ent, 0, sv_sound_land.string, 255, 1);
+ ent->priv.server->waterposition_forceupdate = true;
}
}
// regular thinking
- SV_RunThink(ent);
+ if (!SV_RunThink(ent))
+ return;
- SV_CheckWaterTransition(ent);
+ if (ent->priv.server->waterposition_forceupdate || !VectorCompare(ent->fields.server->origin, ent->priv.server->waterposition_origin))
+ {
+ ent->priv.server->waterposition_forceupdate = false;
+ VectorCopy(ent->fields.server->origin, ent->priv.server->waterposition_origin);
+ SV_CheckWaterTransition(ent);
+ }
}
//============================================================================