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);
|
bool IsHostile (AActor *other);
|
||||||
|
|
||||||
inline bool IsNoClip2() const;
|
inline bool IsNoClip2() const;
|
||||||
void CheckPortalTransition();
|
void CheckPortalTransition(bool islinked);
|
||||||
|
|
||||||
// What species am I?
|
// What species am I?
|
||||||
virtual FName GetSpecies();
|
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];
|
AActor *port = Sector->SkyBoxes[sector_t::ceiling];
|
||||||
if (Z() > port->threshold)
|
if (Z() > port->threshold)
|
||||||
{
|
{
|
||||||
fixedvec3 oldpos = Pos();
|
fixedvec3 oldpos = Pos();
|
||||||
UnlinkFromWorld();
|
if (islinked && !moved) UnlinkFromWorld();
|
||||||
SetXYZ(PosRelative(port->Sector));
|
SetXYZ(PosRelative(port->Sector));
|
||||||
PrevX += X() - oldpos.x;
|
PrevX += X() - oldpos.x;
|
||||||
PrevY += Y() - oldpos.y;
|
PrevY += Y() - oldpos.y;
|
||||||
PrevZ += Z() - oldpos.z;
|
PrevZ += Z() - oldpos.z;
|
||||||
LinkToWorld();
|
Sector = P_PointInSector(X(), Y());
|
||||||
if (player) Printf("Transitioned upwards to sector %d\n", Sector->sectornum);
|
moved = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else break;
|
||||||
}
|
}
|
||||||
if (!Sector->PortalBlocksMovement(sector_t::floor))
|
if (!moved)
|
||||||
{
|
{
|
||||||
AActor *port = Sector->SkyBoxes[sector_t::floor];
|
while (!Sector->PortalBlocksMovement(sector_t::floor))
|
||||||
if (Z() < port->threshold && floorz < port->threshold)
|
|
||||||
{
|
{
|
||||||
fixedvec3 oldpos = Pos();
|
AActor *port = Sector->SkyBoxes[sector_t::floor];
|
||||||
UnlinkFromWorld();
|
if (Z() < port->threshold && floorz < port->threshold)
|
||||||
SetXYZ(PosRelative(port->Sector));
|
{
|
||||||
PrevX += X() - oldpos.x;
|
fixedvec3 oldpos = Pos();
|
||||||
PrevY += Y() - oldpos.y;
|
if (islinked && !moved) UnlinkFromWorld();
|
||||||
PrevZ += Z() - oldpos.z;
|
SetXYZ(PosRelative(port->Sector));
|
||||||
LinkToWorld();
|
PrevX += X() - oldpos.x;
|
||||||
if (player) Printf("Transitioned downwards to sector %d\n", Sector->sectornum);
|
PrevY += Y() - oldpos.y;
|
||||||
return;
|
PrevZ += Z() - oldpos.z;
|
||||||
|
Sector = P_PointInSector(X(), Y());
|
||||||
|
moved = true;
|
||||||
|
}
|
||||||
|
else break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (islinked && moved) LinkToWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -3392,7 +3397,7 @@ void AActor::Tick ()
|
||||||
UnlinkFromWorld ();
|
UnlinkFromWorld ();
|
||||||
flags |= MF_NOBLOCKMAP;
|
flags |= MF_NOBLOCKMAP;
|
||||||
SetXYZ(Vec3Offset(velx, vely, velz));
|
SetXYZ(Vec3Offset(velx, vely, velz));
|
||||||
CheckPortalTransition();
|
CheckPortalTransition(false);
|
||||||
SetMovement(velx, vely, velz);
|
SetMovement(velx, vely, velz);
|
||||||
LinkToWorld ();
|
LinkToWorld ();
|
||||||
}
|
}
|
||||||
|
@ -3860,7 +3865,7 @@ void AActor::Tick ()
|
||||||
Crash();
|
Crash();
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckPortalTransition();
|
CheckPortalTransition(true);
|
||||||
|
|
||||||
UpdateWaterLevel (oldz);
|
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.
|
// Due to interpolation this is not necessarily the same as the sector the camera is in.
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
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];
|
AActor *point = viewsector->SkyBoxes[sector_t::ceiling];
|
||||||
if (viewz > point->threshold)
|
if (viewz > point->threshold)
|
||||||
|
@ -648,16 +649,23 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
||||||
viewx += point->scaleX;
|
viewx += point->scaleX;
|
||||||
viewy += point->scaleY;
|
viewy += point->scaleY;
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||||
|
moved = true;
|
||||||
}
|
}
|
||||||
|
else break;
|
||||||
}
|
}
|
||||||
if (!viewsector->PortalBlocksMovement(sector_t::floor))
|
if (!moved)
|
||||||
{
|
{
|
||||||
AActor *point = viewsector->SkyBoxes[sector_t::floor];
|
while (!viewsector->PortalBlocksMovement(sector_t::floor))
|
||||||
if (viewz < point->threshold)
|
|
||||||
{
|
{
|
||||||
viewx += point->scaleX;
|
AActor *point = viewsector->SkyBoxes[sector_t::floor];
|
||||||
viewy += point->scaleY;
|
if (viewz < point->threshold)
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
{
|
||||||
|
viewx += point->scaleX;
|
||||||
|
viewy += point->scaleY;
|
||||||
|
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||||
|
moved = true;
|
||||||
|
}
|
||||||
|
else break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue