mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- removed debug output from portal transition code.
- handle the case where a portal transition crosses more than a single boundary in one move.
This commit is contained in:
parent
326907f6ab
commit
b01e0fa06e
3 changed files with 41 additions and 28 deletions
|
@ -742,7 +742,7 @@ public:
|
|||
bool IsHostile (AActor *other);
|
||||
|
||||
inline bool IsNoClip2() const;
|
||||
void CheckPortalTransition();
|
||||
void CheckPortalTransition(bool islinked);
|
||||
|
||||
// What species am I?
|
||||
virtual FName GetSpecies();
|
||||
|
|
|
@ -3289,40 +3289,45 @@ void AActor::SetRoll(angle_t r, bool interpolate)
|
|||
}
|
||||
|
||||
|
||||
void AActor::CheckPortalTransition()
|
||||
void AActor::CheckPortalTransition(bool islinked)
|
||||
{
|
||||
if (!Sector->PortalBlocksMovement(sector_t::ceiling))
|
||||
bool moved = false;
|
||||
while (!Sector->PortalBlocksMovement(sector_t::ceiling))
|
||||
{
|
||||
AActor *port = Sector->SkyBoxes[sector_t::ceiling];
|
||||
if (Z() > port->threshold)
|
||||
{
|
||||
fixedvec3 oldpos = Pos();
|
||||
UnlinkFromWorld();
|
||||
if (islinked && !moved) UnlinkFromWorld();
|
||||
SetXYZ(PosRelative(port->Sector));
|
||||
PrevX += X() - oldpos.x;
|
||||
PrevY += Y() - oldpos.y;
|
||||
PrevZ += Z() - oldpos.z;
|
||||
LinkToWorld();
|
||||
if (player) Printf("Transitioned upwards to sector %d\n", Sector->sectornum);
|
||||
return;
|
||||
Sector = P_PointInSector(X(), Y());
|
||||
moved = true;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (!Sector->PortalBlocksMovement(sector_t::floor))
|
||||
if (!moved)
|
||||
{
|
||||
while (!Sector->PortalBlocksMovement(sector_t::floor))
|
||||
{
|
||||
AActor *port = Sector->SkyBoxes[sector_t::floor];
|
||||
if (Z() < port->threshold && floorz < port->threshold)
|
||||
{
|
||||
fixedvec3 oldpos = Pos();
|
||||
UnlinkFromWorld();
|
||||
if (islinked && !moved) UnlinkFromWorld();
|
||||
SetXYZ(PosRelative(port->Sector));
|
||||
PrevX += X() - oldpos.x;
|
||||
PrevY += Y() - oldpos.y;
|
||||
PrevZ += Z() - oldpos.z;
|
||||
LinkToWorld();
|
||||
if (player) Printf("Transitioned downwards to sector %d\n", Sector->sectornum);
|
||||
return;
|
||||
Sector = P_PointInSector(X(), Y());
|
||||
moved = true;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
if (islinked && moved) LinkToWorld();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3392,7 +3397,7 @@ void AActor::Tick ()
|
|||
UnlinkFromWorld ();
|
||||
flags |= MF_NOBLOCKMAP;
|
||||
SetXYZ(Vec3Offset(velx, vely, velz));
|
||||
CheckPortalTransition();
|
||||
CheckPortalTransition(false);
|
||||
SetMovement(velx, vely, velz);
|
||||
LinkToWorld ();
|
||||
}
|
||||
|
@ -3860,7 +3865,7 @@ void AActor::Tick ()
|
|||
Crash();
|
||||
}
|
||||
|
||||
CheckPortalTransition();
|
||||
CheckPortalTransition(true);
|
||||
|
||||
UpdateWaterLevel (oldz);
|
||||
|
||||
|
|
|
@ -640,7 +640,8 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
|||
|
||||
// Due to interpolation this is not necessarily the same as the sector the camera is in.
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
if (!viewsector->PortalBlocksMovement(sector_t::ceiling))
|
||||
bool moved = false;
|
||||
while (!viewsector->PortalBlocksMovement(sector_t::ceiling))
|
||||
{
|
||||
AActor *point = viewsector->SkyBoxes[sector_t::ceiling];
|
||||
if (viewz > point->threshold)
|
||||
|
@ -648,9 +649,13 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
|||
viewx += point->scaleX;
|
||||
viewy += point->scaleY;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
moved = true;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (!viewsector->PortalBlocksMovement(sector_t::floor))
|
||||
if (!moved)
|
||||
{
|
||||
while (!viewsector->PortalBlocksMovement(sector_t::floor))
|
||||
{
|
||||
AActor *point = viewsector->SkyBoxes[sector_t::floor];
|
||||
if (viewz < point->threshold)
|
||||
|
@ -658,6 +663,9 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
|||
viewx += point->scaleX;
|
||||
viewy += point->scaleY;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
moved = true;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue