- fixed a few incorrect uses of AngleTo function.

- added portal offsetting to all AproxDistance, AngleTo and Vec*To members of AActor.
- optimized displacement retrieval so that the most common case with no offset retrieves a constant null-vector which can be optimized away fully by the compiler.
- early out in P_GetOffsetPosition if there's no portal lines nearby, so that the common case can skip the traverser completely even on maps with line portals.
This commit is contained in:
Christoph Oelckers 2016-02-25 16:50:03 +01:00
commit eafd2519b4
10 changed files with 90 additions and 68 deletions

View file

@ -786,7 +786,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
if (flags & WARPF_WARPINTERPOLATION)
{
// This just translates the movement but doesn't change the vector
fixedvec3 displacedold = old + Displacements(oldpgroup, caller->Sector->PortalGroup);
fixedvec3 displacedold = old + Displacements.getOffset(oldpgroup, caller->Sector->PortalGroup);
caller->PrevX += caller->X() - displacedold.x;
caller->PrevY += caller->Y() - displacedold.y;
caller->PrevZ += caller->Z() - displacedold.z;
@ -795,8 +795,8 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
else if (flags & WARPF_COPYINTERPOLATION)
{
// Map both positions of the reference actor to the current portal group
fixedvec3 displacedold = old + Displacements(reference->PrevPortalGroup, caller->Sector->PortalGroup);
fixedvec3 displacedref = old + Displacements(reference->Sector->PortalGroup, caller->Sector->PortalGroup);
fixedvec3 displacedold = old + Displacements.getOffset(reference->PrevPortalGroup, caller->Sector->PortalGroup);
fixedvec3 displacedref = old + Displacements.getOffset(reference->Sector->PortalGroup, caller->Sector->PortalGroup);
caller->PrevX = caller->X() + displacedold.x - displacedref.x;
caller->PrevY = caller->Y() + displacedold.y - displacedref.y;
caller->PrevZ = caller->Z() + displacedold.z - displacedref.z;