mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- floatified P_TryMove and the sliding and bouncing code.
This commit is contained in:
parent
1877eca2ab
commit
26ff2f73d7
10 changed files with 262 additions and 284 deletions
|
@ -280,25 +280,16 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, bool actorsonly = false
|
||||||
inline bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, bool actorsonly = false);
|
inline bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, bool actorsonly = false);
|
||||||
AActor *P_CheckOnmobj (AActor *thing);
|
AActor *P_CheckOnmobj (AActor *thing);
|
||||||
void P_FakeZMovement (AActor *mo);
|
void P_FakeZMovement (AActor *mo);
|
||||||
bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false);
|
bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false);
|
||||||
bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane_t * onfloor = NULL);
|
bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL);
|
||||||
|
/*
|
||||||
inline bool P_TryMove(AActor* thing, double x, double y, int dropoff, const secplane_t * onfloor = NULL)
|
inline bool P_TryMove(AActor* thing, double x, double y, int dropoff, const secplane_t * onfloor = NULL)
|
||||||
{
|
{
|
||||||
return P_TryMove(thing, FLOAT2FIXED(x), FLOAT2FIXED(y), dropoff, onfloor);
|
return P_TryMove(thing, FLOAT2FIXED(x), FLOAT2FIXED(y), dropoff, onfloor);
|
||||||
}
|
}
|
||||||
inline bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL)
|
*/
|
||||||
{
|
|
||||||
return P_TryMove(thing, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), dropoff, onfloor);
|
bool P_CheckMove(AActor *thing, const DVector2 &pos);
|
||||||
}
|
|
||||||
inline bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false)
|
|
||||||
{
|
|
||||||
return P_TryMove(thing, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), dropoff, onfloor, tm, missileCheck);
|
|
||||||
}
|
|
||||||
bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y);
|
|
||||||
inline bool P_CheckMove(AActor *thing, double x, double y)
|
|
||||||
{
|
|
||||||
return P_CheckMove(thing, FLOAT2FIXED(x), FLOAT2FIXED(y));
|
|
||||||
}
|
|
||||||
void P_ApplyTorque(AActor *mo);
|
void P_ApplyTorque(AActor *mo);
|
||||||
|
|
||||||
bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters
|
bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters
|
||||||
|
@ -313,7 +304,7 @@ inline bool P_TeleportMove(AActor* thing, const fixedvec3 &pos, bool telefrag, b
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_PlayerStartStomp (AActor *actor, bool mononly=false); // [RH] Stomp on things for a newly spawned player
|
void P_PlayerStartStomp (AActor *actor, bool mononly=false); // [RH] Stomp on things for a newly spawned player
|
||||||
void P_SlideMove (AActor* mo, fixed_t tryx, fixed_t tryy, int numsteps);
|
void P_SlideMove (AActor* mo, const DVector2 &pos, int numsteps);
|
||||||
bool P_BounceWall (AActor *mo);
|
bool P_BounceWall (AActor *mo);
|
||||||
bool P_BounceActor (AActor *mo, AActor *BlockingMobj, bool ontop);
|
bool P_BounceActor (AActor *mo, AActor *BlockingMobj, bool ontop);
|
||||||
bool P_CheckSight (AActor *t1, AActor *t2, int flags=0);
|
bool P_CheckSight (AActor *t1, AActor *t2, int flags=0);
|
||||||
|
@ -455,6 +446,13 @@ bool Check_Sides(AActor *, int, int); // phares
|
||||||
|
|
||||||
// [RH]
|
// [RH]
|
||||||
const secplane_t * P_CheckSlopeWalk (AActor *actor, fixed_t &xmove, fixed_t &ymove);
|
const secplane_t * P_CheckSlopeWalk (AActor *actor, fixed_t &xmove, fixed_t &ymove);
|
||||||
|
inline const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
|
||||||
|
{
|
||||||
|
fixedvec2 mov = { FLOAT2FIXED(move.X), FLOAT2FIXED(move.Y) };
|
||||||
|
const secplane_t *ret = P_CheckSlopeWalk(actor, mov.x, mov.y);
|
||||||
|
move = { FIXED2DBL(mov.x), FIXED2DBL(mov.y) };
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_SETUP
|
// P_SETUP
|
||||||
|
|
397
src/p_map.cpp
397
src/p_map.cpp
|
@ -1481,7 +1481,7 @@ MOVEMENT CLIPPING
|
||||||
//
|
//
|
||||||
// out:
|
// out:
|
||||||
// newsubsec
|
// newsubsec
|
||||||
// _f_floorz()
|
// floorz
|
||||||
// ceilingz
|
// ceilingz
|
||||||
// tmdropoffz = the lowest point contacted (monsters won't move to a dropoff)
|
// tmdropoffz = the lowest point contacted (monsters won't move to a dropoff)
|
||||||
// speciallines[]
|
// speciallines[]
|
||||||
|
@ -1703,14 +1703,14 @@ bool P_TestMobjLocation(AActor *mobj)
|
||||||
|
|
||||||
AActor *P_CheckOnmobj(AActor *thing)
|
AActor *P_CheckOnmobj(AActor *thing)
|
||||||
{
|
{
|
||||||
fixed_t oldz;
|
double oldz;
|
||||||
bool good;
|
bool good;
|
||||||
AActor *onmobj;
|
AActor *onmobj;
|
||||||
|
|
||||||
oldz = thing->_f_Z();
|
oldz = thing->Z();
|
||||||
P_FakeZMovement(thing);
|
P_FakeZMovement(thing);
|
||||||
good = P_TestMobjZ(thing, false, &onmobj);
|
good = P_TestMobjZ(thing, false, &onmobj);
|
||||||
thing->_f_SetZ(oldz);
|
thing->SetZ(oldz);
|
||||||
|
|
||||||
return good ? NULL : onmobj;
|
return good ? NULL : onmobj;
|
||||||
}
|
}
|
||||||
|
@ -1738,8 +1738,8 @@ bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
|
||||||
{
|
{
|
||||||
AActor *thing = cres.thing;
|
AActor *thing = cres.thing;
|
||||||
|
|
||||||
fixed_t blockdist = thing->_f_radius() + actor->_f_radius();
|
double blockdist = thing->radius + actor->radius;
|
||||||
if (abs(thing->_f_X() - cres.position.x) >= blockdist || abs(thing->_f_Y() - cres.position.y) >= blockdist)
|
if (fabs(thing->X() - cres.Position.X) >= blockdist || fabs(thing->Y() - cres.Position.Y) >= blockdist)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1784,7 +1784,7 @@ bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
|
||||||
{ // under thing
|
{ // under thing
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!quick && onmobj != NULL && thing->_f_Top() < onmobj->_f_Top())
|
else if (!quick && onmobj != NULL && thing->Top() < onmobj->Top())
|
||||||
{ // something higher is in the way
|
{ // something higher is in the way
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1808,22 +1808,22 @@ void P_FakeZMovement(AActor *mo)
|
||||||
//
|
//
|
||||||
// adjust height
|
// adjust height
|
||||||
//
|
//
|
||||||
mo->_f_AddZ(mo->_f_velz());
|
mo->AddZ(mo->Vel.Z);
|
||||||
if ((mo->flags&MF_FLOAT) && mo->target)
|
if ((mo->flags&MF_FLOAT) && mo->target)
|
||||||
{ // float down towards target if too close
|
{ // float down towards target if too close
|
||||||
if (!(mo->flags & MF_SKULLFLY) && !(mo->flags & MF_INFLOAT))
|
if (!(mo->flags & MF_SKULLFLY) && !(mo->flags & MF_INFLOAT))
|
||||||
{
|
{
|
||||||
fixed_t dist = mo->AproxDistance(mo->target);
|
double dist = mo->Distance2D(mo->target);
|
||||||
fixed_t delta = (mo->target->_f_Z() + (mo->_f_height() >> 1)) - mo->_f_Z();
|
double delta = mo->target->Center() - mo->Z();
|
||||||
if (delta < 0 && dist < -(delta * 3))
|
if (delta < 0 && dist < -(delta * 3))
|
||||||
mo->_f_AddZ(-mo->_f_floatspeed());
|
mo->AddZ(-mo->FloatSpeed);
|
||||||
else if (delta > 0 && dist < (delta * 3))
|
else if (delta > 0 && dist < (delta * 3))
|
||||||
mo->_f_AddZ(mo->_f_floatspeed());
|
mo->AddZ(mo->FloatSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mo->player && mo->flags&MF_NOGRAVITY && (mo->Z() > mo->floorz) && !mo->IsNoClip2())
|
if (mo->player && mo->flags&MF_NOGRAVITY && (mo->Z() > mo->floorz) && !mo->IsNoClip2())
|
||||||
{
|
{
|
||||||
mo->_f_AddZ(finesine[(FINEANGLES / 80 * level.maptime)&FINEMASK] / 8);
|
mo->AddZ(DAngle(4.5 * level.maptime).Sin());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1906,28 +1906,26 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 *
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
bool P_TryMove(AActor *thing, const DVector2 &pos,
|
||||||
int dropoff, // killough 3/15/98: allow dropoff as option
|
int dropoff, // killough 3/15/98: allow dropoff as option
|
||||||
const secplane_t *onfloor, // [RH] Let P_TryMove keep the thing on the floor
|
const secplane_t *onfloor, // [RH] Let P_TryMove keep the thing on the floor
|
||||||
FCheckPosition &tm,
|
FCheckPosition &tm,
|
||||||
bool missileCheck) // [GZ] Fired missiles ignore the drop-off test
|
bool missileCheck) // [GZ] Fired missiles ignore the drop-off test
|
||||||
{
|
{
|
||||||
fixedvec3 oldpos;
|
|
||||||
sector_t *oldsector;
|
sector_t *oldsector;
|
||||||
fixed_t oldz;
|
double oldz;
|
||||||
int side;
|
int side;
|
||||||
int oldside;
|
int oldside;
|
||||||
sector_t* oldsec = thing->Sector; // [RH] for sector actions
|
sector_t* oldsec = thing->Sector; // [RH] for sector actions
|
||||||
sector_t* newsec;
|
sector_t* newsec;
|
||||||
|
|
||||||
tm.floatok = false;
|
tm.floatok = false;
|
||||||
oldz = thing->_f_Z();
|
oldz = thing->Z();
|
||||||
if (onfloor)
|
if (onfloor)
|
||||||
{
|
{
|
||||||
thing->_f_SetZ(onfloor->ZatPoint(x, y));
|
thing->SetZ(onfloor->ZatPoint(pos));
|
||||||
}
|
}
|
||||||
thing->flags6 |= MF6_INTRYMOVE;
|
thing->flags6 |= MF6_INTRYMOVE;
|
||||||
DVector2 pos = { FIXED2DBL(x), FIXED2DBL(y) };
|
|
||||||
if (!P_CheckPosition(thing, pos, tm))
|
if (!P_CheckPosition(thing, pos, tm))
|
||||||
{
|
{
|
||||||
AActor *BlockingMobj = thing->BlockingMobj;
|
AActor *BlockingMobj = thing->BlockingMobj;
|
||||||
|
@ -1943,7 +1941,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
goto pushline;
|
goto pushline;
|
||||||
}
|
}
|
||||||
else if (BlockingMobj->Top() - thing->Z() > thing->MaxStepHeight
|
else if (BlockingMobj->Top() - thing->Z() > thing->MaxStepHeight
|
||||||
|| (BlockingMobj->Sector->ceilingplane._f_ZatPointF(x, y) - (BlockingMobj->Top()) < thing->Height)
|
|| (BlockingMobj->Sector->ceilingplane.ZatPoint(pos) - (BlockingMobj->Top()) < thing->Height)
|
||||||
|| (tm.ceilingz - (BlockingMobj->Top()) < thing->Height))
|
|| (tm.ceilingz - (BlockingMobj->Top()) < thing->Height))
|
||||||
{
|
{
|
||||||
goto pushline;
|
goto pushline;
|
||||||
|
@ -1951,7 +1949,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
}
|
}
|
||||||
if (!(tm.thing->flags2 & MF2_PASSMOBJ) || (i_compatflags & COMPATF_NO_PASSMOBJ))
|
if (!(tm.thing->flags2 & MF2_PASSMOBJ) || (i_compatflags & COMPATF_NO_PASSMOBJ))
|
||||||
{
|
{
|
||||||
thing->_f_SetZ(oldz);
|
thing->SetZ(oldz);
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2078,7 +2076,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
!(thing->flags2 & MF2_BLASTED) && !missileCheck)
|
!(thing->flags2 & MF2_BLASTED) && !missileCheck)
|
||||||
{ // Can't move over a dropoff unless it's been blasted
|
{ // Can't move over a dropoff unless it's been blasted
|
||||||
// [GZ] Or missile-spawned
|
// [GZ] Or missile-spawned
|
||||||
thing->_f_SetZ(oldz);
|
thing->SetZ(oldz);
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2099,7 +2097,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
&& (tm.floorpic != thing->floorpic
|
&& (tm.floorpic != thing->floorpic
|
||||||
|| tm.floorz - thing->Z() != 0))
|
|| tm.floorz - thing->Z() != 0))
|
||||||
{ // must stay within a sector of a certain floor type
|
{ // must stay within a sector of a certain floor type
|
||||||
thing->_f_SetZ(oldz);
|
thing->SetZ(oldz);
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2113,7 +2111,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
thing->player->Bot->prev = thing->player->Bot->dest;
|
thing->player->Bot->prev = thing->player->Bot->dest;
|
||||||
thing->player->Bot->dest = NULL;
|
thing->player->Bot->dest = NULL;
|
||||||
thing->Vel.X = thing->Vel.Y = 0;
|
thing->Vel.X = thing->Vel.Y = 0;
|
||||||
thing->_f_SetZ(oldz);
|
thing->SetZ(oldz);
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2129,7 +2127,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
|
|
||||||
if (oldsec->heightsec)
|
if (oldsec->heightsec)
|
||||||
{
|
{
|
||||||
fixed_t eyez = oldz + viewheight;
|
double eyez = oldz + FIXED2DBL(viewheight);
|
||||||
|
|
||||||
oldAboveFakeFloor = eyez > oldsec->heightsec->floorplane.ZatPoint(thing);
|
oldAboveFakeFloor = eyez > oldsec->heightsec->floorplane.ZatPoint(thing);
|
||||||
oldAboveFakeCeiling = eyez > oldsec->heightsec->ceilingplane.ZatPoint(thing);
|
oldAboveFakeCeiling = eyez > oldsec->heightsec->ceilingplane.ZatPoint(thing);
|
||||||
|
@ -2151,7 +2149,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
fixed_t bestfrac = FIXED_MAX;
|
double bestfrac = 1.1;
|
||||||
spechit_t besthit;
|
spechit_t besthit;
|
||||||
int besthitnum;
|
int besthitnum;
|
||||||
// find the portal nearest to the crossing actor
|
// find the portal nearest to the crossing actor
|
||||||
|
@ -2169,7 +2167,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
{
|
{
|
||||||
divline_t dl2 = { ld->v1->fX(), ld->v1->fY(), ld->Delta().X, ld->Delta().Y };
|
divline_t dl2 = { ld->v1->fX(), ld->v1->fY(), ld->Delta().X, ld->Delta().Y };
|
||||||
divline_t dl1 = { spec.Oldrefpos.X, spec.Oldrefpos.Y, spec.Refpos.X - spec.Oldrefpos.X, spec.Refpos.Y - spec.Oldrefpos.Y };
|
divline_t dl1 = { spec.Oldrefpos.X, spec.Oldrefpos.Y, spec.Refpos.X - spec.Oldrefpos.X, spec.Refpos.Y - spec.Oldrefpos.Y };
|
||||||
fixed_t frac = FLOAT2FIXED(P_InterceptVector(&dl1, &dl2));
|
double frac = P_InterceptVector(&dl1, &dl2);
|
||||||
if (frac < bestfrac)
|
if (frac < bestfrac)
|
||||||
{
|
{
|
||||||
besthit = spec;
|
besthit = spec;
|
||||||
|
@ -2179,7 +2177,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bestfrac < FIXED_MAX)
|
if (bestfrac < 1.1)
|
||||||
{
|
{
|
||||||
portalhit.Delete(besthitnum);
|
portalhit.Delete(besthitnum);
|
||||||
line_t *ld = besthit.line;
|
line_t *ld = besthit.line;
|
||||||
|
@ -2187,9 +2185,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
if (port->mType == PORTT_LINKED)
|
if (port->mType == PORTT_LINKED)
|
||||||
{
|
{
|
||||||
thing->UnlinkFromWorld();
|
thing->UnlinkFromWorld();
|
||||||
thing->SetXY(tm._f_X() + port->mXDisplacement, tm._f_Y() + port->mYDisplacement);
|
thing->SetXY(tm.pos + port->mDisplacement);
|
||||||
thing->Prev.X += FIXED2DBL(port->mXDisplacement);
|
thing->Prev += port->mDisplacement;
|
||||||
thing->Prev.Y += FIXED2DBL(port->mYDisplacement);
|
|
||||||
thing->LinkToWorld();
|
thing->LinkToWorld();
|
||||||
P_FindFloorCeiling(thing);
|
P_FindFloorCeiling(thing);
|
||||||
portalcrossed = true;
|
portalcrossed = true;
|
||||||
|
@ -2223,22 +2220,20 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
// so that the renderer can properly calculate an interpolated position along the movement path.
|
// so that the renderer can properly calculate an interpolated position along the movement path.
|
||||||
if (thing == players[consoleplayer].camera)
|
if (thing == players[consoleplayer].camera)
|
||||||
{
|
{
|
||||||
//divline_t dl1 = { besthit.Oldrefpos.X,besthit.Oldrefpos.Y, besthit.Refpos.X - besthit.Oldrefpos.Y, besthit.Refpos.Y - besthit.Oldrefpos.Y };
|
divline_t dl1 = { besthit.Oldrefpos.X,besthit.Oldrefpos.Y, besthit.Refpos.X - besthit.Oldrefpos.Y, besthit.Refpos.Y - besthit.Oldrefpos.Y };
|
||||||
//DVector3 hit = { dl1.x + dl1.dx * bestfrac, dl1.y + dl1.dy * bestfrac, 0.,0. };
|
DVector3a hit = { {dl1.x + dl1.dx * bestfrac, dl1.y + dl1.dy * bestfrac, 0.},0. };
|
||||||
fdivline_t dl1 = { FLOAT2FIXED(besthit.Oldrefpos.X),FLOAT2FIXED(besthit.Oldrefpos.Y), FLOAT2FIXED(besthit.Refpos.X - besthit.Oldrefpos.Y), FLOAT2FIXED(besthit.Refpos.Y - besthit.Oldrefpos.Y) };
|
|
||||||
fixedvec3a hit = { dl1.x + FixedMul(dl1.dx, bestfrac), dl1.y + FixedMul(dl1.dy, bestfrac), 0, 0. };
|
|
||||||
|
|
||||||
R_AddInterpolationPoint(hit);
|
R_AddInterpolationPoint(hit);
|
||||||
if (port->mType == PORTT_LINKED)
|
if (port->mType == PORTT_LINKED)
|
||||||
{
|
{
|
||||||
hit.x += port->mXDisplacement;
|
hit.pos.X += port->mDisplacement.X;
|
||||||
hit.y += port->mYDisplacement;
|
hit.pos.Y += port->mDisplacement.Y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
P_TranslatePortalXY(ld, hit.x, hit.y);
|
P_TranslatePortalXY(ld, hit.pos.X, hit.pos.Y);
|
||||||
P_TranslatePortalZ(ld, hit.z);
|
P_TranslatePortalZ(ld, hit.pos.Z);
|
||||||
players[consoleplayer].viewz += FIXED2DBL(hit.z); // needs to be done here because otherwise the renderer will not catch the change.
|
players[consoleplayer].viewz += hit.pos.Z; // needs to be done here because otherwise the renderer will not catch the change.
|
||||||
P_TranslatePortalAngle(ld, hit.angle);
|
P_TranslatePortalAngle(ld, hit.angle);
|
||||||
}
|
}
|
||||||
R_AddInterpolationPoint(hit);
|
R_AddInterpolationPoint(hit);
|
||||||
|
@ -2258,7 +2253,6 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
// the move is ok, so link the thing into its new position
|
// the move is ok, so link the thing into its new position
|
||||||
thing->UnlinkFromWorld();
|
thing->UnlinkFromWorld();
|
||||||
|
|
||||||
oldpos = thing->_f_Pos();
|
|
||||||
oldsector = thing->Sector;
|
oldsector = thing->Sector;
|
||||||
thing->floorz = tm.floorz;
|
thing->floorz = tm.floorz;
|
||||||
thing->ceilingz= tm.ceilingz;
|
thing->ceilingz= tm.ceilingz;
|
||||||
|
@ -2268,7 +2262,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
thing->floorsector = tm.floorsector;
|
thing->floorsector = tm.floorsector;
|
||||||
thing->ceilingpic = tm.ceilingpic;
|
thing->ceilingpic = tm.ceilingpic;
|
||||||
thing->ceilingsector = tm.ceilingsector;
|
thing->ceilingsector = tm.ceilingsector;
|
||||||
thing->SetXY(x, y);
|
thing->SetXY(pos);
|
||||||
|
|
||||||
thing->LinkToWorld();
|
thing->LinkToWorld();
|
||||||
}
|
}
|
||||||
|
@ -2339,8 +2333,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
if (newsec->heightsec && oldsec->heightsec && newsec->SecActTarget)
|
if (newsec->heightsec && oldsec->heightsec && newsec->SecActTarget)
|
||||||
{
|
{
|
||||||
const sector_t *hs = newsec->heightsec;
|
const sector_t *hs = newsec->heightsec;
|
||||||
fixed_t eyez = thing->_f_Z() + viewheight;
|
double eyez = thing->Z() + FIXED2DBL(viewheight);
|
||||||
fixed_t fakez = hs->floorplane.ZatPoint(x, y);
|
double fakez = hs->floorplane.ZatPoint(pos);
|
||||||
|
|
||||||
if (!oldAboveFakeFloor && eyez > fakez)
|
if (!oldAboveFakeFloor && eyez > fakez)
|
||||||
{ // View went above fake floor
|
{ // View went above fake floor
|
||||||
|
@ -2353,7 +2347,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
|
|
||||||
if (!(hs->MoreFlags & SECF_FAKEFLOORONLY))
|
if (!(hs->MoreFlags & SECF_FAKEFLOORONLY))
|
||||||
{
|
{
|
||||||
fakez = hs->ceilingplane.ZatPoint(x, y);
|
fakez = hs->ceilingplane.ZatPoint(pos);
|
||||||
if (!oldAboveFakeCeiling && eyez > fakez)
|
if (!oldAboveFakeCeiling && eyez > fakez)
|
||||||
{ // View went above fake ceiling
|
{ // View went above fake ceiling
|
||||||
newsec->SecActTarget->TriggerAction(thing, SECSPAC_EyesAboveC);
|
newsec->SecActTarget->TriggerAction(thing, SECSPAC_EyesAboveC);
|
||||||
|
@ -2379,7 +2373,7 @@ pushline:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
thing->_f_SetZ(oldz);
|
thing->SetZ(oldz);
|
||||||
if (!(thing->flags&(MF_TELEPORT | MF_NOCLIP)))
|
if (!(thing->flags&(MF_TELEPORT | MF_NOCLIP)))
|
||||||
{
|
{
|
||||||
int numSpecHitTemp;
|
int numSpecHitTemp;
|
||||||
|
@ -2400,12 +2394,12 @@ pushline:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
bool P_TryMove(AActor *thing, const DVector2 &pos,
|
||||||
int dropoff, // killough 3/15/98: allow dropoff as option
|
int dropoff, // killough 3/15/98: allow dropoff as option
|
||||||
const secplane_t *onfloor) // [RH] Let P_TryMove keep the thing on the floor
|
const secplane_t *onfloor) // [RH] Let P_TryMove keep the thing on the floor
|
||||||
{
|
{
|
||||||
FCheckPosition tm;
|
FCheckPosition tm;
|
||||||
return P_TryMove(thing, x, y, dropoff, onfloor, tm);
|
return P_TryMove(thing, pos, dropoff, onfloor, tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2417,12 +2411,11 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
|
bool P_CheckMove(AActor *thing, const DVector2 &pos)
|
||||||
{
|
{
|
||||||
FCheckPosition tm;
|
FCheckPosition tm;
|
||||||
fixed_t newz = thing->_f_Z();
|
double newz = thing->Z();
|
||||||
|
|
||||||
DVector2 pos = { FIXED2DBL(x), FIXED2DBL(y) };
|
|
||||||
if (!P_CheckPosition(thing, pos, tm))
|
if (!P_CheckPosition(thing, pos, tm))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -2430,11 +2423,11 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
|
||||||
|
|
||||||
if (thing->flags3 & MF3_FLOORHUGGER)
|
if (thing->flags3 & MF3_FLOORHUGGER)
|
||||||
{
|
{
|
||||||
newz = tm._f_floorz();
|
newz = tm.floorz;
|
||||||
}
|
}
|
||||||
else if (thing->flags3 & MF3_CEILINGHUGGER)
|
else if (thing->flags3 & MF3_CEILINGHUGGER)
|
||||||
{
|
{
|
||||||
newz = tm._f_ceilingz() - thing->_f_height();
|
newz = tm.ceilingz - thing->Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(thing->flags & MF_NOCLIP))
|
if (!(thing->flags & MF_NOCLIP))
|
||||||
|
@ -2458,20 +2451,20 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
|
||||||
}
|
}
|
||||||
if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER))
|
if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER))
|
||||||
{
|
{
|
||||||
if (tm._f_floorz() - newz > thing->_f_MaxStepHeight())
|
if (tm.floorz - newz > thing->MaxStepHeight)
|
||||||
{ // too big a step up
|
{ // too big a step up
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm._f_floorz() > newz)
|
else if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm.floorz > newz)
|
||||||
{ // [RH] Don't let normal missiles climb steps
|
{ // [RH] Don't let normal missiles climb steps
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (newz < tm._f_floorz())
|
else if (newz < tm.floorz)
|
||||||
{ // [RH] Check to make sure there's nothing in the way for the step up
|
{ // [RH] Check to make sure there's nothing in the way for the step up
|
||||||
fixed_t savedz = thing->_f_Z();
|
double savedz = thing->Z();
|
||||||
thing->_f_SetZ(newz = tm._f_floorz());
|
thing->SetZ(newz = tm.floorz);
|
||||||
bool good = P_TestMobjZ(thing);
|
bool good = P_TestMobjZ(thing);
|
||||||
thing->_f_SetZ(savedz);
|
thing->SetZ(savedz);
|
||||||
if (!good)
|
if (!good)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -2481,7 +2474,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
|
||||||
|
|
||||||
if (thing->flags2 & MF2_CANTLEAVEFLOORPIC
|
if (thing->flags2 & MF2_CANTLEAVEFLOORPIC
|
||||||
&& (tm.floorpic != thing->floorpic
|
&& (tm.floorpic != thing->floorpic
|
||||||
|| tm._f_floorz() - newz != 0))
|
|| tm.floorz - newz != 0))
|
||||||
{ // must stay within a sector of a certain floor type
|
{ // must stay within a sector of a certain floor type
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2501,23 +2494,22 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
|
||||||
|
|
||||||
struct FSlide
|
struct FSlide
|
||||||
{
|
{
|
||||||
fixed_t bestslidefrac;
|
double bestSlidefrac;
|
||||||
fixed_t secondslidefrac;
|
double secondSlidefrac;
|
||||||
|
|
||||||
line_t* bestslideline;
|
line_t* bestslideline;
|
||||||
line_t* secondslideline;
|
line_t* secondslideline;
|
||||||
|
|
||||||
AActor* slidemo;
|
AActor* slidemo;
|
||||||
|
|
||||||
fixed_t tmxmove;
|
DVector2 tmmove;
|
||||||
fixed_t tmymove;
|
|
||||||
|
|
||||||
void HitSlideLine(line_t *ld);
|
void HitSlideLine(line_t *ld);
|
||||||
void SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy);
|
void SlideTraverse(const DVector2 &start, const DVector2 &end);
|
||||||
void SlideMove(AActor *mo, fixed_t tryx, fixed_t tryy, int numsteps);
|
void SlideMove(AActor *mo, DVector2 tryp, int numsteps);
|
||||||
|
|
||||||
// The bouncing code uses the same data structure
|
// The bouncing code uses the same data structure
|
||||||
bool BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy);
|
bool BounceTraverse(const DVector2 &start, const DVector2 &end);
|
||||||
bool BounceWall(AActor *mo);
|
bool BounceWall(AActor *mo);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2534,11 +2526,11 @@ void FSlide::HitSlideLine(line_t* ld)
|
||||||
{
|
{
|
||||||
int side;
|
int side;
|
||||||
|
|
||||||
angle_t lineangle;
|
DAngle lineangle;
|
||||||
angle_t moveangle;
|
DAngle moveangle;
|
||||||
angle_t deltaangle;
|
DAngle deltaangle;
|
||||||
|
|
||||||
fixed_t movelen;
|
double movelen;
|
||||||
bool icyfloor; // is floor icy? // phares
|
bool icyfloor; // is floor icy? // phares
|
||||||
// |
|
// |
|
||||||
// Under icy conditions, if the angle of approach to the wall // V
|
// Under icy conditions, if the angle of approach to the wall // V
|
||||||
|
@ -2550,121 +2542,108 @@ void FSlide::HitSlideLine(line_t* ld)
|
||||||
|
|
||||||
// killough 10/98: only bounce if hit hard (prevents wobbling)
|
// killough 10/98: only bounce if hit hard (prevents wobbling)
|
||||||
icyfloor =
|
icyfloor =
|
||||||
(P_AproxDistance(tmxmove, tmymove) > 4 * FRACUNIT) &&
|
tmmove.LengthSquared() > 4*4 &&
|
||||||
var_friction && // killough 8/28/98: calc friction on demand
|
var_friction && // killough 8/28/98: calc friction on demand
|
||||||
slidemo->Z() <= slidemo->floorz &&
|
slidemo->Z() <= slidemo->floorz &&
|
||||||
P_GetFriction(slidemo, NULL) > ORIG_FRICTION;
|
P_GetFriction(slidemo, NULL) > ORIG_FRICTION;
|
||||||
|
|
||||||
if (ld->dx == 0)
|
if (ld->Delta().X == 0)
|
||||||
{ // ST_VERTICAL
|
{ // ST_VERTICAL
|
||||||
if (icyfloor && (abs(tmxmove) > abs(tmymove)))
|
if (icyfloor && (fabs(tmmove.X) > fabs(tmmove.Y)))
|
||||||
{
|
{
|
||||||
tmxmove = -tmxmove / 2; // absorb half the velocity
|
tmmove.X = -tmmove.X / 2;
|
||||||
tmymove /= 2;
|
tmmove.Y /= 2; // absorb half the velocity
|
||||||
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
|
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
|
||||||
{
|
{
|
||||||
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff!// ^
|
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff!// ^
|
||||||
}
|
}
|
||||||
} // |
|
} // |
|
||||||
else // phares
|
else // phares
|
||||||
tmxmove = 0; // no more movement in the X direction
|
tmmove.X = 0; // no more movement in the X direction
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ld->dy == 0)
|
if (ld->Delta().Y == 0)
|
||||||
{ // ST_HORIZONTAL
|
{ // ST_HORIZONTAL
|
||||||
if (icyfloor && (abs(tmymove) > abs(tmxmove)))
|
if (icyfloor && (fabs(tmmove.Y) > fabs(tmmove.X)))
|
||||||
{
|
{
|
||||||
tmxmove /= 2; // absorb half the velocity
|
tmmove.X /= 2; // absorb half the velocity
|
||||||
tmymove = -tmymove / 2;
|
tmmove.Y = -tmmove.Y / 2;
|
||||||
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
|
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
|
||||||
{
|
{
|
||||||
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff!
|
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmymove = 0; // no more movement in the Y direction
|
tmmove.Y = 0; // no more movement in the Y direction
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The wall is angled. Bounce if the angle of approach is // phares
|
// The wall is angled. Bounce if the angle of approach is // phares
|
||||||
// less than 45 degrees. // phares
|
// less than 45 degrees. // phares
|
||||||
|
|
||||||
fixedvec3 pos = slidemo->_f_PosRelative(ld);
|
DVector3 pos = slidemo->PosRelative(ld);
|
||||||
side = P_PointOnLineSide(pos.x, pos.y, ld);
|
side = P_PointOnLineSide(pos, ld);
|
||||||
|
|
||||||
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
|
lineangle = ld->Delta().Angle();
|
||||||
|
|
||||||
if (side == 1)
|
if (side == 1)
|
||||||
lineangle += ANG180;
|
lineangle += 180.;
|
||||||
|
|
||||||
moveangle = R_PointToAngle2(0, 0, tmxmove, tmymove);
|
moveangle = tmmove.Angle();
|
||||||
|
|
||||||
moveangle += 10; // prevents sudden path reversal due to // phares
|
// prevents sudden path reversal due to rounding error | // phares
|
||||||
// rounding error // |
|
moveangle += 3600/65536.*65536.; // Boom added 10 to the angle_t here.
|
||||||
deltaangle = moveangle - lineangle; // V
|
|
||||||
movelen = P_AproxDistance(tmxmove, tmymove);
|
deltaangle = ::deltaangle(lineangle, moveangle); // V
|
||||||
if (icyfloor && (deltaangle > ANG45) && (deltaangle < ANG90 + ANG45))
|
movelen = tmmove.Length();
|
||||||
|
if (icyfloor && (deltaangle > 45) && (deltaangle < 135))
|
||||||
{
|
{
|
||||||
moveangle = lineangle - deltaangle;
|
moveangle = ::deltaangle(deltaangle, lineangle);
|
||||||
movelen /= 2; // absorb
|
movelen /= 2; // absorb
|
||||||
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
|
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
|
||||||
{
|
{
|
||||||
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff!
|
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff!
|
||||||
}
|
}
|
||||||
moveangle >>= ANGLETOFINESHIFT;
|
tmmove = moveangle.ToVector(movelen);
|
||||||
tmxmove = FixedMul(movelen, finecosine[moveangle]);
|
|
||||||
tmymove = FixedMul(movelen, finesine[moveangle]);
|
|
||||||
} // ^
|
|
||||||
else // |
|
|
||||||
{ // phares
|
|
||||||
// Doom's original algorithm here does not work well due to imprecisions of the sine table.
|
|
||||||
// However, keep it active if the wallrunning compatibility flag is on
|
|
||||||
if (i_compatflags & COMPATF_WALLRUN)
|
|
||||||
{
|
|
||||||
fixed_t newlen;
|
|
||||||
|
|
||||||
if (deltaangle > ANG180)
|
|
||||||
deltaangle += ANG180;
|
|
||||||
// I_Error ("SlideLine: ang>ANG180");
|
|
||||||
|
|
||||||
lineangle >>= ANGLETOFINESHIFT;
|
|
||||||
deltaangle >>= ANGLETOFINESHIFT;
|
|
||||||
|
|
||||||
newlen = FixedMul(movelen, finecosine[deltaangle]);
|
|
||||||
|
|
||||||
tmxmove = FixedMul(newlen, finecosine[lineangle]);
|
|
||||||
tmymove = FixedMul(newlen, finesine[lineangle]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fdivline_t dll, dlv;
|
// The compatibility option that used to be here had to be removed because
|
||||||
fixed_t inter1, inter2, inter3;
|
// with floating point math it was no longer possible to reproduce.
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// with full precision this should work now. Needs some testing
|
||||||
|
if (deltaangle < 0) deltaangle += 180.;
|
||||||
|
tmmove = lineangle.ToVector(movelen * deltaangle.Cos());
|
||||||
|
#else
|
||||||
|
divline_t dll, dlv;
|
||||||
|
double inter1, inter2, inter3;
|
||||||
|
|
||||||
P_MakeDivline(ld, &dll);
|
P_MakeDivline(ld, &dll);
|
||||||
|
|
||||||
dlv.x = pos.x;
|
dlv.x = pos.X;
|
||||||
dlv.y = pos.y;
|
dlv.y = pos.Y;
|
||||||
dlv.dx = dll.dy;
|
dlv.dx = dll.dy;
|
||||||
dlv.dy = -dll.dx;
|
dlv.dy = -dll.dx;
|
||||||
|
|
||||||
inter1 = P_InterceptVector(&dll, &dlv);
|
inter1 = P_InterceptVector(&dll, &dlv);
|
||||||
|
|
||||||
dlv.dx = tmxmove;
|
dlv.dx = tmmove.X;
|
||||||
dlv.dy = tmymove;
|
dlv.dy = tmmove.Y;
|
||||||
inter2 = P_InterceptVector(&dll, &dlv);
|
inter2 = P_InterceptVector(&dll, &dlv);
|
||||||
inter3 = P_InterceptVector(&dlv, &dll);
|
inter3 = P_InterceptVector(&dlv, &dll);
|
||||||
|
|
||||||
if (inter3 != 0)
|
if (inter3 != 0)
|
||||||
{
|
{
|
||||||
tmxmove = Scale(inter2 - inter1, dll.dx, inter3);
|
tmmove.X = (inter2 - inter1) * dll.dx / inter3;
|
||||||
tmymove = Scale(inter2 - inter1, dll.dy, inter3);
|
tmmove.Y = (inter2 - inter1) * dll.dy / inter3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmxmove = tmymove = 0;
|
tmmove.Zero();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} // phares
|
} // phares
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2675,10 +2654,10 @@ void FSlide::HitSlideLine(line_t* ld)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy)
|
void FSlide::SlideTraverse(const DVector2 &start, const DVector2 &end)
|
||||||
{
|
{
|
||||||
FLineOpening open;
|
FLineOpening open;
|
||||||
FPathTraverse it(startx, starty, endx, endy, PT_ADDLINES);
|
FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_ADDLINES);
|
||||||
intercept_t *in;
|
intercept_t *in;
|
||||||
|
|
||||||
while ((in = it.Next()))
|
while ((in = it.Next()))
|
||||||
|
@ -2696,8 +2675,8 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t
|
||||||
|
|
||||||
if (!(li->flags & ML_TWOSIDED) || !li->backsector)
|
if (!(li->flags & ML_TWOSIDED) || !li->backsector)
|
||||||
{
|
{
|
||||||
fixedvec3 pos = slidemo->_f_PosRelative(li);
|
DVector3 pos = slidemo->PosRelative(li);
|
||||||
if (P_PointOnLineSide(pos.x, pos.y, li))
|
if (P_PointOnLineSide(pos, li))
|
||||||
{
|
{
|
||||||
// don't hit the back side
|
// don't hit the back side
|
||||||
continue;
|
continue;
|
||||||
|
@ -2719,7 +2698,7 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t
|
||||||
}
|
}
|
||||||
|
|
||||||
// set openrange, opentop, openbottom
|
// set openrange, opentop, openbottom
|
||||||
P_LineOpening(open, slidemo, li, it._f_InterceptPoint(in));
|
P_LineOpening(open, slidemo, li, it.InterceptPoint(in));
|
||||||
|
|
||||||
if (open.range < slidemo->Height)
|
if (open.range < slidemo->Height)
|
||||||
goto isblocking; // doesn't fit
|
goto isblocking; // doesn't fit
|
||||||
|
@ -2749,11 +2728,11 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t
|
||||||
// the line does block movement,
|
// the line does block movement,
|
||||||
// see if it is closer than best so far
|
// see if it is closer than best so far
|
||||||
isblocking:
|
isblocking:
|
||||||
if (in->frac < bestslidefrac)
|
if (in->Frac < bestSlidefrac)
|
||||||
{
|
{
|
||||||
secondslidefrac = bestslidefrac;
|
secondSlidefrac = bestSlidefrac;
|
||||||
secondslideline = bestslideline;
|
secondslideline = bestslideline;
|
||||||
bestslidefrac = in->frac;
|
bestSlidefrac = in->Frac;
|
||||||
bestslideline = li;
|
bestslideline = li;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2775,12 +2754,12 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void FSlide::SlideMove(AActor *mo, fixed_t tryx, fixed_t tryy, int numsteps)
|
void FSlide::SlideMove(AActor *mo, DVector2 tryp, int numsteps)
|
||||||
{
|
{
|
||||||
fixed_t leadx, leady;
|
DVector2 lead;
|
||||||
fixed_t trailx, traily;
|
DVector2 trail;
|
||||||
fixed_t newx, newy;
|
DVector2 newpos;
|
||||||
fixed_t xmove, ymove;
|
DVector2 move;
|
||||||
const secplane_t * walkplane;
|
const secplane_t * walkplane;
|
||||||
int hitcount;
|
int hitcount;
|
||||||
|
|
||||||
|
@ -2795,84 +2774,81 @@ retry:
|
||||||
goto stairstep; // don't loop forever
|
goto stairstep; // don't loop forever
|
||||||
|
|
||||||
// trace along the three leading corners
|
// trace along the three leading corners
|
||||||
if (tryx > 0)
|
if (tryp.X > 0)
|
||||||
{
|
{
|
||||||
leadx = mo->_f_X() + mo->_f_radius();
|
lead.X = mo->X() + mo->radius;
|
||||||
trailx = mo->_f_X() - mo->_f_radius();
|
trail.X = mo->X() - mo->radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leadx = mo->_f_X() - mo->_f_radius();
|
lead.X = mo->X() - mo->radius;
|
||||||
trailx = mo->_f_X() + mo->_f_radius();
|
trail.X = mo->X() + mo->radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tryy > 0)
|
if (tryp.Y > 0)
|
||||||
{
|
{
|
||||||
leady = mo->_f_Y() + mo->_f_radius();
|
lead.Y = mo->Y() + mo->radius;
|
||||||
traily = mo->_f_Y() - mo->_f_radius();
|
trail.Y = mo->Y() - mo->radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leady = mo->_f_Y() - mo->_f_radius();
|
lead.Y = mo->Y() - mo->radius;
|
||||||
traily = mo->_f_Y() + mo->_f_radius();
|
trail.Y = mo->Y() + mo->radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
bestslidefrac = FRACUNIT + 1;
|
bestSlidefrac = 1.01;
|
||||||
|
|
||||||
SlideTraverse(leadx, leady, leadx + tryx, leady + tryy);
|
SlideTraverse(lead, lead + tryp);
|
||||||
SlideTraverse(trailx, leady, trailx + tryx, leady + tryy);
|
SlideTraverse(DVector2(trail.X, lead.Y), tryp + DVector2(trail.X, lead.Y));
|
||||||
SlideTraverse(leadx, traily, leadx + tryx, traily + tryy);
|
SlideTraverse(DVector2(lead.X, trail.Y), tryp + DVector2(lead.X, trail.Y));
|
||||||
|
|
||||||
// move up to the wall
|
// move up to the wall
|
||||||
if (bestslidefrac == FRACUNIT + 1)
|
if (bestSlidefrac > 1)
|
||||||
{
|
{
|
||||||
// the move must have hit the middle, so stairstep
|
// the move must have hit the middle, so stairstep
|
||||||
stairstep:
|
stairstep:
|
||||||
// killough 3/15/98: Allow objects to drop off ledges
|
// killough 3/15/98: Allow objects to drop off ledges
|
||||||
xmove = 0, ymove = tryy;
|
move = { 0, tryp.Y };
|
||||||
walkplane = P_CheckSlopeWalk(mo, xmove, ymove);
|
walkplane = P_CheckSlopeWalk(mo, move);
|
||||||
if (!P_TryMove(mo, mo->_f_X() + xmove, mo->_f_Y() + ymove, true, walkplane))
|
if (!P_TryMove(mo, mo->Pos() + move, true, walkplane))
|
||||||
{
|
{
|
||||||
xmove = tryx, ymove = 0;
|
move = { tryp.X, 0 };
|
||||||
walkplane = P_CheckSlopeWalk(mo, xmove, ymove);
|
walkplane = P_CheckSlopeWalk(mo, move);
|
||||||
P_TryMove(mo, mo->_f_X() + xmove, mo->_f_Y() + ymove, true, walkplane);
|
P_TryMove(mo, mo->Pos() + move, true, walkplane);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fudge a bit to make sure it doesn't hit
|
// fudge a bit to make sure it doesn't hit
|
||||||
bestslidefrac -= FRACUNIT / 32;
|
bestSlidefrac -= FRACUNIT / 32;
|
||||||
if (bestslidefrac > 0)
|
if (bestSlidefrac > 0)
|
||||||
{
|
{
|
||||||
newx = FixedMul(tryx, bestslidefrac);
|
newpos = tryp * bestSlidefrac;
|
||||||
newy = FixedMul(tryy, bestslidefrac);
|
|
||||||
|
|
||||||
// [BL] We need to abandon this function if we end up going through a teleporter
|
// [BL] We need to abandon this function if we end up going through a teleporter
|
||||||
const fixed_t startvelx = mo->_f_velx();
|
const DVector2 startvel = mo->Vel.XY();
|
||||||
const fixed_t startvely = mo->_f_vely();
|
|
||||||
|
|
||||||
// killough 3/15/98: Allow objects to drop off ledges
|
// killough 3/15/98: Allow objects to drop off ledges
|
||||||
if (!P_TryMove(mo, mo->_f_X() + newx, mo->_f_Y() + newy, true))
|
if (!P_TryMove(mo, mo->Pos() + newpos, true))
|
||||||
goto stairstep;
|
goto stairstep;
|
||||||
|
|
||||||
if (mo->_f_velx() != startvelx || mo->_f_vely() != startvely)
|
if (mo->Vel.XY() != startvel)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now continue along the wall.
|
// Now continue along the wall.
|
||||||
bestslidefrac = FRACUNIT - (bestslidefrac + FRACUNIT / 32); // remainder
|
bestSlidefrac = 1. - (bestSlidefrac + 1. / 32); // remainder
|
||||||
if (bestslidefrac > FRACUNIT)
|
if (bestSlidefrac > 1)
|
||||||
bestslidefrac = FRACUNIT;
|
bestSlidefrac = 1;
|
||||||
else if (bestslidefrac <= 0)
|
else if (bestSlidefrac <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tryx = tmxmove = FixedMul(tryx, bestslidefrac);
|
tryp = tmmove = tryp*bestSlidefrac;
|
||||||
tryy = tmymove = FixedMul(tryy, bestslidefrac);
|
|
||||||
|
|
||||||
HitSlideLine(bestslideline); // clip the moves
|
HitSlideLine(bestslideline); // clip the moves
|
||||||
|
|
||||||
mo->Vel.X = FIXED2DBL(tmxmove * numsteps);
|
mo->Vel.X = tmmove.X * numsteps;
|
||||||
mo->Vel.Y = FIXED2DBL(tmymove * numsteps);
|
mo->Vel.Y = tmmove.Y * numsteps;
|
||||||
|
|
||||||
// killough 10/98: affect the bobbing the same way (but not voodoo dolls)
|
// killough 10/98: affect the bobbing the same way (but not voodoo dolls)
|
||||||
if (mo->player && mo->player->mo == mo)
|
if (mo->player && mo->player->mo == mo)
|
||||||
|
@ -2883,19 +2859,19 @@ retry:
|
||||||
mo->player->Vel.Y = mo->Vel.Y;
|
mo->player->Vel.Y = mo->Vel.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
walkplane = P_CheckSlopeWalk(mo, tmxmove, tmymove);
|
walkplane = P_CheckSlopeWalk(mo, tmmove);
|
||||||
|
|
||||||
// killough 3/15/98: Allow objects to drop off ledges
|
// killough 3/15/98: Allow objects to drop off ledges
|
||||||
if (!P_TryMove(mo, mo->_f_X() + tmxmove, mo->_f_Y() + tmymove, true, walkplane))
|
if (!P_TryMove(mo, mo->Pos() + tmmove, true, walkplane))
|
||||||
{
|
{
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_SlideMove(AActor *mo, fixed_t tryx, fixed_t tryy, int numsteps)
|
void P_SlideMove(AActor *mo, const DVector2 &pos, int numsteps)
|
||||||
{
|
{
|
||||||
FSlide slide;
|
FSlide slide;
|
||||||
slide.SlideMove(mo, tryx, tryy, numsteps);
|
slide.SlideMove(mo, pos, numsteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -3044,10 +3020,10 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
|
||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
bool FSlide::BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy)
|
bool FSlide::BounceTraverse(const DVector2 &start, const DVector2 &end)
|
||||||
{
|
{
|
||||||
FLineOpening open;
|
FLineOpening open;
|
||||||
FPathTraverse it(startx, starty, endx, endy, PT_ADDLINES);
|
FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_ADDLINES);
|
||||||
intercept_t *in;
|
intercept_t *in;
|
||||||
|
|
||||||
while ((in = it.Next()))
|
while ((in = it.Next()))
|
||||||
|
@ -3089,11 +3065,11 @@ bool FSlide::BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_
|
||||||
|
|
||||||
// the line does block movement, see if it is closer than best so far
|
// the line does block movement, see if it is closer than best so far
|
||||||
bounceblocking:
|
bounceblocking:
|
||||||
if (in->frac < bestslidefrac)
|
if (in->Frac < bestSlidefrac)
|
||||||
{
|
{
|
||||||
secondslidefrac = bestslidefrac;
|
secondSlidefrac = bestSlidefrac;
|
||||||
secondslideline = bestslideline;
|
secondslideline = bestslideline;
|
||||||
bestslidefrac = in->frac;
|
bestSlidefrac = in->Frac;
|
||||||
bestslideline = li;
|
bestslideline = li;
|
||||||
}
|
}
|
||||||
return false; // stop
|
return false; // stop
|
||||||
|
@ -3109,10 +3085,10 @@ bool FSlide::BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_
|
||||||
|
|
||||||
bool FSlide::BounceWall(AActor *mo)
|
bool FSlide::BounceWall(AActor *mo)
|
||||||
{
|
{
|
||||||
fixed_t leadx, leady;
|
DVector2 lead;
|
||||||
int side;
|
int side;
|
||||||
angle_t lineangle, moveangle, deltaangle;
|
DAngle lineangle, moveangle, deltaangle;
|
||||||
fixed_t movelen;
|
double movelen;
|
||||||
line_t *line;
|
line_t *line;
|
||||||
|
|
||||||
if (!(mo->BounceFlags & BOUNCE_Walls))
|
if (!(mo->BounceFlags & BOUNCE_Walls))
|
||||||
|
@ -3126,23 +3102,23 @@ bool FSlide::BounceWall(AActor *mo)
|
||||||
//
|
//
|
||||||
if (mo->Vel.X > 0)
|
if (mo->Vel.X > 0)
|
||||||
{
|
{
|
||||||
leadx = mo->_f_X() + mo->_f_radius();
|
lead.X = mo->X() + mo->radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leadx = mo->_f_X() - mo->_f_radius();
|
lead.X = mo->X() - mo->radius;
|
||||||
}
|
}
|
||||||
if (mo->Vel.Y > 0)
|
if (mo->Vel.Y > 0)
|
||||||
{
|
{
|
||||||
leady = mo->_f_Y() + mo->_f_radius();
|
lead.Y = mo->Y() + mo->radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leady = mo->_f_Y() - mo->_f_radius();
|
lead.Y = mo->Y() - mo->radius;
|
||||||
}
|
}
|
||||||
bestslidefrac = FRACUNIT + 1;
|
bestSlidefrac = 1.01;
|
||||||
bestslideline = mo->BlockingLine;
|
bestslideline = mo->BlockingLine;
|
||||||
if (BounceTraverse(leadx, leady, leadx + mo->_f_velx(), leady + mo->_f_vely()) && mo->BlockingLine == NULL)
|
if (BounceTraverse(lead, lead+mo->Vel.XY()) && mo->BlockingLine == NULL)
|
||||||
{ // Could not find a wall, so bounce off the floor/ceiling instead.
|
{ // Could not find a wall, so bounce off the floor/ceiling instead.
|
||||||
double floordist = mo->Z() - mo->floorz;
|
double floordist = mo->Z() - mo->floorz;
|
||||||
double ceildist = mo->ceilingz - mo->Z();
|
double ceildist = mo->ceilingz - mo->Z();
|
||||||
|
@ -3176,36 +3152,33 @@ bool FSlide::BounceWall(AActor *mo)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
side = P_PointOnLineSide(mo->_f_X(), mo->_f_Y(), line);
|
side = P_PointOnLineSide(mo->Pos(), line);
|
||||||
lineangle = R_PointToAngle2(0, 0, line->dx, line->dy);
|
lineangle = line->Delta().Angle();
|
||||||
if (side == 1)
|
if (side == 1)
|
||||||
{
|
{
|
||||||
lineangle += ANG180;
|
lineangle += 180;
|
||||||
}
|
}
|
||||||
moveangle = R_PointToAngle2(0, 0, mo->_f_velx(), mo->_f_vely());
|
moveangle = mo->Vel.Angle();
|
||||||
deltaangle = (2 * lineangle) - moveangle;
|
deltaangle = (lineangle * 2) - moveangle;
|
||||||
mo->Angles.Yaw = ANGLE2DBL(deltaangle);
|
mo->Angles.Yaw = deltaangle;
|
||||||
|
|
||||||
deltaangle >>= ANGLETOFINESHIFT;
|
movelen = mo->Vel.XY().Length() * mo->wallbouncefactor;
|
||||||
|
|
||||||
movelen = fixed_t(g_sqrt(double(mo->_f_velx())*mo->_f_velx() + double(mo->_f_vely())*mo->_f_vely()));
|
FBoundingBox box(mo->X(), mo->Y(), mo->radius);
|
||||||
movelen = fixed_t(movelen * mo->wallbouncefactor);
|
|
||||||
|
|
||||||
FBoundingBox box(mo->_f_X(), mo->_f_Y(), mo->_f_radius());
|
|
||||||
if (box.BoxOnLineSide(line) == -1)
|
if (box.BoxOnLineSide(line) == -1)
|
||||||
{
|
{
|
||||||
fixedvec3 pos = mo->Vec3Offset(
|
DVector2 ofs = deltaangle.ToVector(mo->radius);
|
||||||
FixedMul(mo->_f_radius(), finecosine[deltaangle]),
|
DVector3 pos = mo->Vec3Offset(ofs.X, ofs.Y, 0.);
|
||||||
FixedMul(mo->_f_radius(), finesine[deltaangle]), 0);
|
|
||||||
mo->SetOrigin(pos, true);
|
mo->SetOrigin(pos, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (movelen < FRACUNIT)
|
if (movelen < 1)
|
||||||
{
|
{
|
||||||
movelen = 2 * FRACUNIT;
|
movelen = 2;
|
||||||
}
|
}
|
||||||
mo->Vel.X = FIXED2DBL(FixedMul(movelen, finecosine[deltaangle]));
|
DVector2 vel = deltaangle.ToVector(movelen);
|
||||||
mo->Vel.Y = FIXED2DBL(FixedMul(movelen, finesine[deltaangle]));
|
mo->Vel.X = vel.X;
|
||||||
|
mo->Vel.Y = vel.Y;
|
||||||
if (mo->BounceFlags & BOUNCE_UseBounceState)
|
if (mo->BounceFlags & BOUNCE_UseBounceState)
|
||||||
{
|
{
|
||||||
FState *bouncestate = mo->FindState(NAME_Bounce, NAME_Wall);
|
FState *bouncestate = mo->FindState(NAME_Bounce, NAME_Wall);
|
||||||
|
|
|
@ -122,6 +122,14 @@ inline void P_MakeDivline (const line_t *li, fdivline_t *dl)
|
||||||
dl->dy = li->dy;
|
dl->dy = li->dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void P_MakeDivline(const line_t *li, divline_t *dl)
|
||||||
|
{
|
||||||
|
dl->x = li->v1->fX();
|
||||||
|
dl->y = li->v1->fY();
|
||||||
|
dl->dx = li->Delta().X;
|
||||||
|
dl->dy = li->Delta().Y;
|
||||||
|
}
|
||||||
|
|
||||||
struct FLineOpening
|
struct FLineOpening
|
||||||
{
|
{
|
||||||
double top;
|
double top;
|
||||||
|
@ -143,7 +151,7 @@ static const double LINEOPEN_MIN = -FLT_MAX;
|
||||||
static const double LINEOPEN_MAX = FLT_MAX;
|
static const double LINEOPEN_MAX = FLT_MAX;
|
||||||
|
|
||||||
void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector2 *ref = NULL, int flags = 0);
|
void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector2 *ref = NULL, int flags = 0);
|
||||||
inline void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector3 *ref = NULL, int flags = 0)
|
inline void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector3 *ref, int flags = 0)
|
||||||
{
|
{
|
||||||
P_LineOpening(open, thing, linedef, xy, reinterpret_cast<const DVector2*>(ref), flags);
|
P_LineOpening(open, thing, linedef, xy, reinterpret_cast<const DVector2*>(ref), flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1939,7 +1939,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
// killough 3/15/98: Allow objects to drop off
|
// killough 3/15/98: Allow objects to drop off
|
||||||
fixed_t startvelx = mo->_f_velx(), startvely = mo->_f_vely();
|
fixed_t startvelx = mo->_f_velx(), startvely = mo->_f_vely();
|
||||||
|
|
||||||
if (!P_TryMove (mo, ptryx, ptryy, true, walkplane, tm))
|
if (!P_TryMove (mo, DVector2(FIXED2DBL(ptryx), FIXED2DBL(ptryy)), true, walkplane, tm))
|
||||||
{
|
{
|
||||||
// blocked move
|
// blocked move
|
||||||
AActor *BlockingMobj = mo->BlockingMobj;
|
AActor *BlockingMobj = mo->BlockingMobj;
|
||||||
|
@ -1972,11 +1972,11 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
// If the move is done a second time (because it was too fast for one move), it
|
// If the move is done a second time (because it was too fast for one move), it
|
||||||
// is still clipped against the wall at its full speed, so you effectively
|
// is still clipped against the wall at its full speed, so you effectively
|
||||||
// execute two moves in one tic.
|
// execute two moves in one tic.
|
||||||
P_SlideMove (mo, mo->_f_velx(), mo->_f_vely(), 1);
|
P_SlideMove (mo, mo->Vel, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
P_SlideMove (mo, onestepx, onestepy, totalsteps);
|
P_SlideMove (mo, DVector2(FIXED2DBL(onestepx), FIXED2DBL(onestepy)), totalsteps);
|
||||||
}
|
}
|
||||||
if ((mo->_f_velx() | mo->_f_vely()) == 0)
|
if ((mo->_f_velx() | mo->_f_vely()) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2006,7 +2006,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
fixed_t tx, ty;
|
fixed_t tx, ty;
|
||||||
tx = 0, ty = onestepy;
|
tx = 0, ty = onestepy;
|
||||||
walkplane = P_CheckSlopeWalk (mo, tx, ty);
|
walkplane = P_CheckSlopeWalk (mo, tx, ty);
|
||||||
if (P_TryMove (mo, mo->_f_X() + tx, mo->_f_Y() + ty, true, walkplane, tm))
|
if (P_TryMove (mo, mo->Pos() + DVector2(FIXED2DBL(tx), FIXED2DBL(ty)), true, walkplane, tm))
|
||||||
{
|
{
|
||||||
mo->Vel.X = 0;
|
mo->Vel.X = 0;
|
||||||
}
|
}
|
||||||
|
@ -2014,7 +2014,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
{
|
{
|
||||||
tx = onestepx, ty = 0;
|
tx = onestepx, ty = 0;
|
||||||
walkplane = P_CheckSlopeWalk (mo, tx, ty);
|
walkplane = P_CheckSlopeWalk (mo, tx, ty);
|
||||||
if (P_TryMove (mo, mo->_f_X() + tx, mo->_f_Y() + ty, true, walkplane, tm))
|
if (P_TryMove (mo, mo->Pos() + DVector2(FIXED2DBL(tx), FIXED2DBL(ty)), true, walkplane, tm))
|
||||||
{
|
{
|
||||||
mo->Vel.Y = 0;
|
mo->Vel.Y = 0;
|
||||||
}
|
}
|
||||||
|
@ -5744,7 +5744,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
|
||||||
bool MBFGrenade = (!(th->flags & MF_MISSILE) || (th->BounceFlags & BOUNCE_MBF));
|
bool MBFGrenade = (!(th->flags & MF_MISSILE) || (th->BounceFlags & BOUNCE_MBF));
|
||||||
|
|
||||||
// killough 3/15/98: no dropoff (really = don't care for missiles)
|
// killough 3/15/98: no dropoff (really = don't care for missiles)
|
||||||
if (!(P_TryMove (th, th->_f_X(), th->_f_Y(), false, NULL, tm, true)))
|
if (!(P_TryMove (th, th->Pos(), false, NULL, tm, true)))
|
||||||
{
|
{
|
||||||
// [RH] Don't explode ripping missiles that spawn inside something
|
// [RH] Don't explode ripping missiles that spawn inside something
|
||||||
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
|
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
|
||||||
|
|
|
@ -899,8 +899,8 @@ void FPolyObj::ThrustMobj (AActor *actor, side_t *side)
|
||||||
|
|
||||||
if (crush)
|
if (crush)
|
||||||
{
|
{
|
||||||
fixedvec2 pos = actor->Vec2Offset(FLOAT2FIXED(thrust.X), FLOAT2FIXED(thrust.Y));
|
DVector2 pos = actor->Vec2Offset(thrust.X, thrust.Y);
|
||||||
if (bHurtOnTouch || !P_CheckMove (actor, pos.x, pos.y))
|
if (bHurtOnTouch || !P_CheckMove (actor, pos))
|
||||||
{
|
{
|
||||||
int newdam = P_DamageMobj (actor, NULL, NULL, crush, NAME_Crush);
|
int newdam = P_DamageMobj (actor, NULL, NULL, crush, NAME_Crush);
|
||||||
P_TraceBleed (newdam > 0 ? newdam : crush, actor);
|
P_TraceBleed (newdam > 0 ? newdam : crush, actor);
|
||||||
|
|
|
@ -205,8 +205,7 @@ FArchive &operator<< (FArchive &arc, FLinePortal &port)
|
||||||
{
|
{
|
||||||
arc << port.mOrigin
|
arc << port.mOrigin
|
||||||
<< port.mDestination
|
<< port.mDestination
|
||||||
<< port.mXDisplacement
|
<< port.mDisplacement
|
||||||
<< port.mYDisplacement
|
|
||||||
<< port.mType
|
<< port.mType
|
||||||
<< port.mFlags
|
<< port.mFlags
|
||||||
<< port.mDefFlags
|
<< port.mDefFlags
|
||||||
|
@ -385,8 +384,8 @@ void P_UpdatePortal(FLinePortal *port)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
port->mXDisplacement = port->mDestination->v2->x - port->mOrigin->v1->x;
|
port->mDisplacement.X = port->mDestination->v2->fX() - port->mOrigin->v1->fX();
|
||||||
port->mYDisplacement = port->mDestination->v2->y - port->mOrigin->v1->y;
|
port->mDisplacement.Y = port->mDestination->v2->fY() - port->mOrigin->v1->fY();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -721,10 +720,10 @@ fixedvec2 P_GetOffsetPosition(fixed_t x, fixed_t y, fixed_t dx, fixed_t dy)
|
||||||
if (port->mType == PORTT_LINKED)
|
if (port->mType == PORTT_LINKED)
|
||||||
{
|
{
|
||||||
// optimized handling for linked portals where we only need to add an offset.
|
// optimized handling for linked portals where we only need to add an offset.
|
||||||
hit.x += port->mXDisplacement;
|
hit.x += FLOAT2FIXED(port->mDisplacement.X);
|
||||||
hit.y += port->mYDisplacement;
|
hit.y += FLOAT2FIXED(port->mDisplacement.Y);
|
||||||
dest.x += port->mXDisplacement;
|
dest.x += FLOAT2FIXED(port->mDisplacement.X);
|
||||||
dest.y += port->mYDisplacement;
|
dest.y += FLOAT2FIXED(port->mDisplacement.Y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -851,13 +850,13 @@ static void AddDisplacementForPortal(FLinePortal *portal)
|
||||||
FDisplacement & disp = Displacements(thisgroup, othergroup);
|
FDisplacement & disp = Displacements(thisgroup, othergroup);
|
||||||
if (!disp.isSet)
|
if (!disp.isSet)
|
||||||
{
|
{
|
||||||
disp.pos.x = portal->mXDisplacement;
|
disp.pos.x = FLOAT2FIXED(portal->mDisplacement.X);
|
||||||
disp.pos.y = portal->mYDisplacement;
|
disp.pos.y = FLOAT2FIXED(portal->mDisplacement.Y);
|
||||||
disp.isSet = true;
|
disp.isSet = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (disp.pos.x != portal->mXDisplacement || disp.pos.y != portal->mYDisplacement)
|
if (disp.pos.x != FLOAT2FIXED(portal->mDisplacement.X) || disp.pos.y != FLOAT2FIXED(portal->mDisplacement.Y))
|
||||||
{
|
{
|
||||||
Printf("Portal between lines %d and %d has displacement mismatch\n", int(portal->mOrigin - lines), int(portal->mDestination - lines));
|
Printf("Portal between lines %d and %d has displacement mismatch\n", int(portal->mOrigin - lines), int(portal->mDestination - lines));
|
||||||
portal->mType = linePortals[portal->mDestination->portalindex].mType = PORTT_TELEPORT;
|
portal->mType = linePortals[portal->mDestination->portalindex].mType = PORTT_TELEPORT;
|
||||||
|
|
|
@ -185,8 +185,7 @@ struct FLinePortal
|
||||||
{
|
{
|
||||||
line_t *mOrigin;
|
line_t *mOrigin;
|
||||||
line_t *mDestination;
|
line_t *mDestination;
|
||||||
fixed_t mXDisplacement;
|
DVector2 mDisplacement;
|
||||||
fixed_t mYDisplacement;
|
|
||||||
BYTE mType;
|
BYTE mType;
|
||||||
BYTE mFlags;
|
BYTE mFlags;
|
||||||
BYTE mDefFlags;
|
BYTE mDefFlags;
|
||||||
|
|
|
@ -82,7 +82,7 @@ static TArray<InterpolationViewer> PastViewers;
|
||||||
static FRandom pr_torchflicker ("TorchFlicker");
|
static FRandom pr_torchflicker ("TorchFlicker");
|
||||||
static FRandom pr_hom;
|
static FRandom pr_hom;
|
||||||
static bool NoInterpolateView;
|
static bool NoInterpolateView;
|
||||||
static TArray<fixedvec3a> InterpolationPath;
|
static TArray<DVector3a> InterpolationPath;
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||||
|
|
||||||
|
@ -609,26 +609,26 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
||||||
angle_t totaladiff = 0;
|
angle_t totaladiff = 0;
|
||||||
fixed_t oviewz = iview->oviewz;
|
fixed_t oviewz = iview->oviewz;
|
||||||
fixed_t nviewz = iview->nviewz;
|
fixed_t nviewz = iview->nviewz;
|
||||||
fixedvec3a oldpos = { iview->oviewx, iview->oviewy, 0, 0. };
|
DVector3a oldpos = { {FIXED2DBL(iview->oviewx), FIXED2DBL(iview->oviewy), 0.}, 0. };
|
||||||
fixedvec3a newpos = { iview->nviewx, iview->nviewy, 0, 0. };
|
DVector3a newpos = { {FIXED2DBL(iview->nviewx), FIXED2DBL(iview->nviewy), 0. }, 0. };
|
||||||
InterpolationPath.Push(newpos); // add this to the array to simplify the loops below
|
InterpolationPath.Push(newpos); // add this to the array to simplify the loops below
|
||||||
|
|
||||||
for (unsigned i = 0; i < InterpolationPath.Size(); i += 2)
|
for (unsigned i = 0; i < InterpolationPath.Size(); i += 2)
|
||||||
{
|
{
|
||||||
fixedvec3a &start = i == 0 ? oldpos : InterpolationPath[i - 1];
|
DVector3a &start = i == 0 ? oldpos : InterpolationPath[i - 1];
|
||||||
fixedvec3a &end = InterpolationPath[i];
|
DVector3a &end = InterpolationPath[i];
|
||||||
pathlen += xs_CRoundToInt(DVector2(end.x - start.x, end.y - start.y).Length());
|
pathlen += FLOAT2FIXED((end.pos-start.pos).Length());
|
||||||
totalzdiff += start.z;
|
totalzdiff += FLOAT2FIXED(start.pos.Z);
|
||||||
totaladiff += FLOAT2ANGLE(start.angle.Degrees);
|
totaladiff += FLOAT2ANGLE(start.angle.Degrees);
|
||||||
}
|
}
|
||||||
fixed_t interpolatedlen = FixedMul(frac, pathlen);
|
fixed_t interpolatedlen = FixedMul(frac, pathlen);
|
||||||
|
|
||||||
for (unsigned i = 0; i < InterpolationPath.Size(); i += 2)
|
for (unsigned i = 0; i < InterpolationPath.Size(); i += 2)
|
||||||
{
|
{
|
||||||
fixedvec3a &start = i == 0 ? oldpos : InterpolationPath[i - 1];
|
DVector3a &start = i == 0 ? oldpos : InterpolationPath[i - 1];
|
||||||
fixedvec3a &end = InterpolationPath[i];
|
DVector3a &end = InterpolationPath[i];
|
||||||
fixed_t fraglen = xs_CRoundToInt(DVector2(end.x - start.x, end.y - start.y).Length());
|
fixed_t fraglen = FLOAT2FIXED((end.pos - start.pos).Length());
|
||||||
zdiff += start.z;
|
zdiff += FLOAT2FIXED(start.pos.Z);
|
||||||
adiff += FLOAT2ANGLE(start.angle.Degrees);
|
adiff += FLOAT2ANGLE(start.angle.Degrees);
|
||||||
if (fraglen <= interpolatedlen)
|
if (fraglen <= interpolatedlen)
|
||||||
{
|
{
|
||||||
|
@ -636,13 +636,14 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fixed_t fragfrac = FixedDiv(interpolatedlen, fraglen);
|
double fragfrac = FIXED2DBL(FixedDiv(interpolatedlen, fraglen));
|
||||||
oviewz += zdiff;
|
oviewz += zdiff;
|
||||||
nviewz -= totalzdiff - zdiff;
|
nviewz -= totalzdiff - zdiff;
|
||||||
oviewangle += adiff;
|
oviewangle += adiff;
|
||||||
nviewangle -= totaladiff - adiff;
|
nviewangle -= totaladiff - adiff;
|
||||||
viewx = start.x + FixedMul(fragfrac, end.x - start.x);
|
DVector2 viewpos = start.pos + (fragfrac * (end.pos - start.pos));
|
||||||
viewy = start.y + FixedMul(fragfrac, end.y - start.y);
|
viewx = FLOAT2FIXED(viewpos.X);
|
||||||
|
viewy = FLOAT2FIXED(viewpos.Y);
|
||||||
viewz = oviewz + FixedMul(frac, nviewz - oviewz);
|
viewz = oviewz + FixedMul(frac, nviewz - oviewz);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -887,7 +888,7 @@ void R_ClearInterpolationPath()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void R_AddInterpolationPoint(const fixedvec3a &vec)
|
void R_AddInterpolationPoint(const DVector3a &vec)
|
||||||
{
|
{
|
||||||
InterpolationPath.Push(vec);
|
InterpolationPath.Push(vec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,9 +65,9 @@ inline angle_t R_PointToAnglePrecise (fixed_t viewx, fixed_t viewy, fixed_t x, f
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for interpolation waypoints.
|
// Used for interpolation waypoints.
|
||||||
struct fixedvec3a
|
struct DVector3a
|
||||||
{
|
{
|
||||||
fixed_t x, y, z;
|
DVector3 pos;
|
||||||
DAngle angle;
|
DAngle angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ void R_ResetViewInterpolation ();
|
||||||
void R_RebuildViewInterpolation(player_t *player);
|
void R_RebuildViewInterpolation(player_t *player);
|
||||||
bool R_GetViewInterpolationStatus();
|
bool R_GetViewInterpolationStatus();
|
||||||
void R_ClearInterpolationPath();
|
void R_ClearInterpolationPath();
|
||||||
void R_AddInterpolationPoint(const fixedvec3a &vec);
|
void R_AddInterpolationPoint(const DVector3a &vec);
|
||||||
void R_SetViewSize (int blocks);
|
void R_SetViewSize (int blocks);
|
||||||
void R_SetFOV (float fov);
|
void R_SetFOV (float fov);
|
||||||
float R_GetFOV ();
|
float R_GetFOV ();
|
||||||
|
|
|
@ -6642,7 +6642,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock)
|
||||||
if (flags & CBF_DROPOFF)
|
if (flags & CBF_DROPOFF)
|
||||||
{
|
{
|
||||||
mobj->SetZ(pos.Z);
|
mobj->SetZ(pos.Z);
|
||||||
checker = P_CheckMove(mobj, pos.X, pos.Y);
|
checker = P_CheckMove(mobj, pos);
|
||||||
mobj->SetZ(oldpos.Z);
|
mobj->SetZ(oldpos.Z);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue