mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-20 02:42:56 +00:00
fixed: Polyobject-based line portals may not cache their angle as it may change at any time.
This commit is contained in:
parent
4e148f00e6
commit
da05dfa72e
2 changed files with 28 additions and 7 deletions
|
@ -272,14 +272,31 @@ static line_t *FindDestination(line_t *src, int tag)
|
||||||
|
|
||||||
static void SetRotation(FLinePortal *port)
|
static void SetRotation(FLinePortal *port)
|
||||||
{
|
{
|
||||||
if (port != NULL && port->mDestination != NULL)
|
if (port != nullptr && port->mDestination != nullptr)
|
||||||
{
|
{
|
||||||
line_t *dst = port->mDestination;
|
if (port->mType != PORTT_LINKED)
|
||||||
line_t *line = port->mOrigin;
|
{
|
||||||
DAngle angle = dst->Delta().Angle() - line->Delta().Angle() + 180.;
|
line_t *dst = port->mDestination;
|
||||||
port->mSinRot = sindeg(angle.Degrees); // Here precision matters so use the slower but more precise versions.
|
line_t *line = port->mOrigin;
|
||||||
port->mCosRot = cosdeg(angle.Degrees);
|
DAngle angle = dst->Delta().Angle() - line->Delta().Angle() + 180.;
|
||||||
port->mAngleDiff = angle;
|
port->mSinRot = sindeg(angle.Degrees); // Here precision matters so use the slower but more precise versions.
|
||||||
|
port->mCosRot = cosdeg(angle.Degrees);
|
||||||
|
port->mAngleDiff = angle;
|
||||||
|
if ((line->sidedef[0]->Flags & WALLF_POLYOBJ) || (dst->sidedef[0]->Flags & WALLF_POLYOBJ))
|
||||||
|
{
|
||||||
|
port->mFlags |= PORTF_POLYOBJ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
port->mFlags &= PORTF_POLYOBJ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Linked portals have no angular difference.
|
||||||
|
port->mSinRot = port->mCosRot = 0.;
|
||||||
|
port->mAngleDiff = 0.;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,6 +610,7 @@ void P_TranslatePortalXY(line_t* src, double& x, double& y)
|
||||||
if (!src) return;
|
if (!src) return;
|
||||||
FLinePortal *port = src->getPortal();
|
FLinePortal *port = src->getPortal();
|
||||||
if (!port) return;
|
if (!port) return;
|
||||||
|
if (port->mFlags & PORTF_POLYOBJ) SetRotation(port); // update the angle for polyportals.
|
||||||
|
|
||||||
// offsets from line
|
// offsets from line
|
||||||
double nposx = x - src->v1->fX();
|
double nposx = x - src->v1->fX();
|
||||||
|
@ -620,6 +638,7 @@ void P_TranslatePortalVXVY(line_t* src, double &velx, double &vely)
|
||||||
if (!src) return;
|
if (!src) return;
|
||||||
FLinePortal *port = src->getPortal();
|
FLinePortal *port = src->getPortal();
|
||||||
if (!port) return;
|
if (!port) return;
|
||||||
|
if (port->mFlags & PORTF_POLYOBJ) SetRotation(port); // update the angle for polyportals.
|
||||||
|
|
||||||
double orig_velx = velx;
|
double orig_velx = velx;
|
||||||
double orig_vely = vely;
|
double orig_vely = vely;
|
||||||
|
@ -638,6 +657,7 @@ void P_TranslatePortalAngle(line_t* src, DAngle& angle)
|
||||||
if (!src) return;
|
if (!src) return;
|
||||||
FLinePortal *port = src->getPortal();
|
FLinePortal *port = src->getPortal();
|
||||||
if (!port) return;
|
if (!port) return;
|
||||||
|
if (port->mFlags & PORTF_POLYOBJ) SetRotation(port); // update the angle for polyportals.
|
||||||
angle = (angle + port->mAngleDiff).Normalized360();
|
angle = (angle + port->mAngleDiff).Normalized360();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,7 @@ enum
|
||||||
PORTF_PASSABLE = 2,
|
PORTF_PASSABLE = 2,
|
||||||
PORTF_SOUNDTRAVERSE = 4,
|
PORTF_SOUNDTRAVERSE = 4,
|
||||||
PORTF_INTERACTIVE = 8,
|
PORTF_INTERACTIVE = 8,
|
||||||
|
PORTF_POLYOBJ = 16,
|
||||||
|
|
||||||
PORTF_TYPETELEPORT = PORTF_VISIBLE | PORTF_PASSABLE | PORTF_SOUNDTRAVERSE,
|
PORTF_TYPETELEPORT = PORTF_VISIBLE | PORTF_PASSABLE | PORTF_SOUNDTRAVERSE,
|
||||||
PORTF_TYPEINTERACTIVE = PORTF_VISIBLE | PORTF_PASSABLE | PORTF_SOUNDTRAVERSE | PORTF_INTERACTIVE,
|
PORTF_TYPEINTERACTIVE = PORTF_VISIBLE | PORTF_PASSABLE | PORTF_SOUNDTRAVERSE | PORTF_INTERACTIVE,
|
||||||
|
|
Loading…
Reference in a new issue