- started refactoring ZatPoint calls which need to be portal aware.

To summarize, anything that just works with map geometry doesn't need to bother, as does the renderer. (i.e. nearly all r_* files, p_floor.cpp, p_ceiling.cpp et.al)
But all calls that are somehow related to actor positions need to be made aware of potential portal transitions:

 * added FloorAtPoint, CeilingAtPoint and PlaneAtPoint methods to sector_t, which can be used to calculate a plane's height with relation to a given actor, even if that actor is on the other side of a portal.
 * added HighestCeilingAt and LowestFloorAt methods which traverse all ceiling/floor portals until they find an impassable plane.
This commit is contained in:
Christoph Oelckers 2016-02-16 16:40:53 +01:00
commit 1b88052bba
11 changed files with 228 additions and 40 deletions

View file

@ -427,7 +427,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
self->floorz = sec->floorplane.ZatPoint(_x, _y);
self->ceilingz = sec->ceilingplane.ZatPoint(_x, _y);
self->SetZ(self->floorz);
P_FindFloorCeiling(self, FFCF_ONLYSPAWNPOS);
P_FindFloorCeiling(self, FFCF_ONLYSPAWNPOS | FFCF_NOPORTALS); // no pprtal checks here so that things get spawned in this sector.
if (self->flags & MF_SPAWNCEILING)
{
@ -451,6 +451,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
self->SetZ(self->SpawnPoint[2] + self->floorz);
}
// Redo floor/ceiling check, in case of 3D floors
// we need to get the actual floor and ceiling heights including portals here
self->floorz = sec->LowestFloorAt(self, &self->floorsector);
self->ceilingz = sec->HighestCeilingAt(self, &self->ceilingsector);
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
if (self->Z() < self->floorz)
{ // Do not reappear under the floor, even if that's where we were for the