mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 08:30:50 +00:00
- refactored p_mobj.cpp and the first half of p_map.cpp.
This commit is contained in:
parent
7658111566
commit
7ea3e49332
6 changed files with 403 additions and 360 deletions
31
src/actor.h
31
src/actor.h
|
@ -1252,6 +1252,33 @@ public:
|
||||||
fixedvec3 ret = { X(), Y(), Z() };
|
fixedvec3 ret = { X(), Y(), Z() };
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
fixedvec3 PosRelative(AActor *other) const
|
||||||
|
{
|
||||||
|
fixedvec3 ret = { X(), Y(), Z() };
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
fixedvec3 PosRelative(sector_t *sec) const
|
||||||
|
{
|
||||||
|
fixedvec3 ret = { X(), Y(), Z() };
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
fixedvec3 PosRelative(line_t *line) const
|
||||||
|
{
|
||||||
|
fixedvec3 ret = { X(), Y(), Z() };
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
fixed_t SoundX() const
|
||||||
|
{
|
||||||
|
return X();
|
||||||
|
}
|
||||||
|
fixed_t SoundY() const
|
||||||
|
{
|
||||||
|
return Y();
|
||||||
|
}
|
||||||
|
fixed_t SoundZ() const
|
||||||
|
{
|
||||||
|
return Z();
|
||||||
|
}
|
||||||
fixedvec3 InterpolatedPosition(fixed_t ticFrac) const
|
fixedvec3 InterpolatedPosition(fixed_t ticFrac) const
|
||||||
{
|
{
|
||||||
fixedvec3 ret;
|
fixedvec3 ret;
|
||||||
|
@ -1418,6 +1445,10 @@ inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline fixedvec3 PosRelative(const fixedvec3 &pos, line_t *line, sector_t *refsec = NULL)
|
||||||
|
{
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
void PrintMiscActorInfo(AActor * query);
|
void PrintMiscActorInfo(AActor * query);
|
||||||
|
|
||||||
|
|
336
src/p_map.cpp
336
src/p_map.cpp
|
@ -581,7 +581,7 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
|
||||||
friction = FRICTION_FLY;
|
friction = FRICTION_FLY;
|
||||||
}
|
}
|
||||||
else if ((!(mo->flags & MF_NOGRAVITY) && mo->waterlevel > 1) ||
|
else if ((!(mo->flags & MF_NOGRAVITY) && mo->waterlevel > 1) ||
|
||||||
(mo->waterlevel == 1 && mo->z > mo->floorz + 6 * FRACUNIT))
|
(mo->waterlevel == 1 && mo->Z() > mo->floorz + 6 * FRACUNIT))
|
||||||
{
|
{
|
||||||
friction = secfriction(mo->Sector);
|
friction = secfriction(mo->Sector);
|
||||||
movefactor = secmovefac(mo->Sector) >> 1;
|
movefactor = secmovefac(mo->Sector) >> 1;
|
||||||
|
@ -593,8 +593,8 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
|
||||||
if (!(rover->flags & FF_EXISTS)) continue;
|
if (!(rover->flags & FF_EXISTS)) continue;
|
||||||
if (!(rover->flags & FF_SWIMMABLE)) continue;
|
if (!(rover->flags & FF_SWIMMABLE)) continue;
|
||||||
|
|
||||||
if (mo->z > rover->top.plane->ZatPoint(mo) ||
|
if (mo->Z() > rover->top.plane->ZatPoint(mo) ||
|
||||||
mo->z < rover->bottom.plane->ZatPoint(mo))
|
mo->Z() < rover->bottom.plane->ZatPoint(mo))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newfriction = secfriction(rover->model, rover->top.isceiling);
|
newfriction = secfriction(rover->model, rover->top.isceiling);
|
||||||
|
@ -623,13 +623,13 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
|
||||||
if (rover->flags & FF_SOLID)
|
if (rover->flags & FF_SOLID)
|
||||||
{
|
{
|
||||||
// Must be standing on a solid floor
|
// Must be standing on a solid floor
|
||||||
if (mo->z != rover->top.plane->ZatPoint(mo)) continue;
|
if (mo->Z() != rover->top.plane->ZatPoint(mo)) continue;
|
||||||
}
|
}
|
||||||
else if (rover->flags & FF_SWIMMABLE)
|
else if (rover->flags & FF_SWIMMABLE)
|
||||||
{
|
{
|
||||||
// Or on or inside a swimmable floor (e.g. in shallow water)
|
// Or on or inside a swimmable floor (e.g. in shallow water)
|
||||||
if (mo->z > rover->top.plane->ZatPoint(mo) ||
|
if (mo->Z() > rover->top.plane->ZatPoint(mo) ||
|
||||||
(mo->z + mo->height) < rover->bottom.plane->ZatPoint(mo))
|
(mo->Top()) < rover->bottom.plane->ZatPoint(mo))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -650,9 +650,9 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
|
||||||
}
|
}
|
||||||
newfriction = secfriction(sec);
|
newfriction = secfriction(sec);
|
||||||
if ((newfriction < friction || friction == ORIG_FRICTION) &&
|
if ((newfriction < friction || friction == ORIG_FRICTION) &&
|
||||||
(mo->z <= sec->floorplane.ZatPoint(mo) ||
|
(mo->Z() <= sec->floorplane.ZatPoint(mo) ||
|
||||||
(sec->GetHeightSec() != NULL &&
|
(sec->GetHeightSec() != NULL &&
|
||||||
mo->z <= sec->heightsec->floorplane.ZatPoint(mo))))
|
mo->Z() <= sec->heightsec->floorplane.ZatPoint(mo))))
|
||||||
{
|
{
|
||||||
friction = newfriction;
|
friction = newfriction;
|
||||||
movefactor = secmovefac(sec);
|
movefactor = secmovefac(sec);
|
||||||
|
@ -768,6 +768,7 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
|
||||||
bool NotBlocked = ((tm.thing->flags3 & MF3_NOBLOCKMONST)
|
bool NotBlocked = ((tm.thing->flags3 & MF3_NOBLOCKMONST)
|
||||||
|| ((i_compatflags & COMPATF_NOBLOCKFRIENDS) && (tm.thing->flags & MF_FRIENDLY)));
|
|| ((i_compatflags & COMPATF_NOBLOCKFRIENDS) && (tm.thing->flags & MF_FRIENDLY)));
|
||||||
|
|
||||||
|
fixedvec3 pos = tm.thing->PosRelative(ld);
|
||||||
if (!(Projectile) || (ld->flags & (ML_BLOCKEVERYTHING | ML_BLOCKPROJECTILE)))
|
if (!(Projectile) || (ld->flags & (ML_BLOCKEVERYTHING | ML_BLOCKPROJECTILE)))
|
||||||
{
|
{
|
||||||
if (ld->flags & ML_RAILING)
|
if (ld->flags & ML_RAILING)
|
||||||
|
@ -786,7 +787,7 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
|
||||||
}
|
}
|
||||||
tm.thing->BlockingLine = ld;
|
tm.thing->BlockingLine = ld;
|
||||||
// Calculate line side based on the actor's original position, not the new one.
|
// Calculate line side based on the actor's original position, not the new one.
|
||||||
CheckForPushSpecial(ld, P_PointOnLineSide(tm.thing->x, tm.thing->y, ld), tm.thing, false);
|
CheckForPushSpecial(ld, P_PointOnLineSide(pos.x, pos.y, ld), tm.thing, false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -797,8 +798,8 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
|
||||||
{
|
{
|
||||||
secplane_t frontplane, backplane;
|
secplane_t frontplane, backplane;
|
||||||
// Check 3D floors as well
|
// Check 3D floors as well
|
||||||
frontplane = P_FindFloorPlane(ld->frontsector, tm.thing->x, tm.thing->y, tm.thing->floorz);
|
frontplane = P_FindFloorPlane(ld->frontsector, pos.x, pos.y, tm.thing->floorz);
|
||||||
backplane = P_FindFloorPlane(ld->backsector, tm.thing->x, tm.thing->y, tm.thing->floorz);
|
backplane = P_FindFloorPlane(ld->backsector, pos.x, pos.y, tm.thing->floorz);
|
||||||
if (frontplane.c < STEEPSLOPE || backplane.c < STEEPSLOPE)
|
if (frontplane.c < STEEPSLOPE || backplane.c < STEEPSLOPE)
|
||||||
{
|
{
|
||||||
const msecnode_t *node = tm.thing->touching_sectorlist;
|
const msecnode_t *node = tm.thing->touching_sectorlist;
|
||||||
|
@ -853,7 +854,7 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
|
||||||
}
|
}
|
||||||
else if (r >= (1 << 24))
|
else if (r >= (1 << 24))
|
||||||
{
|
{
|
||||||
P_LineOpening(open, tm.thing, ld, sx = ld->v2->x, sy = ld->v2->y, tm.thing->x, tm.thing->y);
|
P_LineOpening(open, tm.thing, ld, sx = ld->v2->x, sy = ld->v2->y, pos.x, pos.y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1031,8 +1032,9 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY))
|
if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY))
|
||||||
return true; // can't hit thing
|
return true; // can't hit thing
|
||||||
|
|
||||||
|
fixedvec3 thingpos = thing->PosRelative(tm.thing);
|
||||||
fixed_t blockdist = thing->radius + tm.thing->radius;
|
fixed_t blockdist = thing->radius + tm.thing->radius;
|
||||||
if (abs(thing->x - tm.x) >= blockdist || abs(thing->y - tm.y) >= blockdist)
|
if (abs(thingpos.x - tm.thing->X()) >= blockdist || abs(thingpos.y - tm.thing->Y()) >= blockdist)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS)
|
if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS)
|
||||||
|
@ -1042,13 +1044,13 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
tm.thing->BlockingMobj = thing;
|
tm.thing->BlockingMobj = thing;
|
||||||
topz = thing->z + thing->height;
|
topz = thing->Top();
|
||||||
if (!(i_compatflags & COMPATF_NO_PASSMOBJ) && !(tm.thing->flags & (MF_FLOAT | MF_MISSILE | MF_SKULLFLY | MF_NOGRAVITY)) &&
|
if (!(i_compatflags & COMPATF_NO_PASSMOBJ) && !(tm.thing->flags & (MF_FLOAT | MF_MISSILE | MF_SKULLFLY | MF_NOGRAVITY)) &&
|
||||||
(thing->flags & MF_SOLID) && (thing->flags4 & MF4_ACTLIKEBRIDGE))
|
(thing->flags & MF_SOLID) && (thing->flags4 & MF4_ACTLIKEBRIDGE))
|
||||||
{
|
{
|
||||||
// [RH] Let monsters walk on actors as well as floors
|
// [RH] Let monsters walk on actors as well as floors
|
||||||
if ((tm.thing->flags3 & MF3_ISMONSTER) &&
|
if ((tm.thing->flags3 & MF3_ISMONSTER) &&
|
||||||
topz >= tm.floorz && topz <= tm.thing->z + tm.thing->MaxStepHeight)
|
topz >= tm.floorz && topz <= tm.thing->Z() + tm.thing->MaxStepHeight)
|
||||||
{
|
{
|
||||||
// The commented-out if is an attempt to prevent monsters from walking off a
|
// The commented-out if is an attempt to prevent monsters from walking off a
|
||||||
// thing further than they would walk off a ledge. I can't think of an easy
|
// thing further than they would walk off a ledge. I can't think of an easy
|
||||||
|
@ -1071,12 +1073,12 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
{
|
{
|
||||||
// Both actors already overlap. To prevent them from remaining stuck allow the move if it
|
// Both actors already overlap. To prevent them from remaining stuck allow the move if it
|
||||||
// takes them further apart or the move does not change the position (when called from P_ChangeSector.)
|
// takes them further apart or the move does not change the position (when called from P_ChangeSector.)
|
||||||
if (tm.x == tm.thing->x && tm.y == tm.thing->y)
|
if (tm.x == tm.thing->X() && tm.y == tm.thing->Y())
|
||||||
{
|
{
|
||||||
unblocking = true;
|
unblocking = true;
|
||||||
}
|
}
|
||||||
else if (abs(thing->x - tm.thing->x) < (thing->radius+tm.thing->radius) &&
|
else if (abs(thingpos.x - tm.thing->X()) < (thing->radius+tm.thing->radius) &&
|
||||||
abs(thing->y - tm.thing->y) < (thing->radius+tm.thing->radius))
|
abs(thingpos.y - tm.thing->Y()) < (thing->radius+tm.thing->radius))
|
||||||
|
|
||||||
{
|
{
|
||||||
fixed_t newdist = thing->AproxDistance(tm.x, tm.y, tm.thing);
|
fixed_t newdist = thing->AproxDistance(tm.x, tm.y, tm.thing);
|
||||||
|
@ -1085,8 +1087,8 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
if (newdist > olddist)
|
if (newdist > olddist)
|
||||||
{
|
{
|
||||||
// ... but not if they did not overlap in z-direction before but would after the move.
|
// ... but not if they did not overlap in z-direction before but would after the move.
|
||||||
unblocking = !((tm.thing->z >= thing->z + thing->height && tm.z < thing->z + thing->height) ||
|
unblocking = !((tm.thing->Z() >= thingpos.z + thing->height && tm.z < thingpos.z + thing->height) ||
|
||||||
(tm.thing->z + tm.thing->height <= thing->z && tm.z + tm.thing->height > thing->z));
|
(tm.thing->Top() <= thingpos.z && tm.thing->Top() > thingpos.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1104,7 +1106,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
{ // Some things prefer not to overlap each other, if possible
|
{ // Some things prefer not to overlap each other, if possible
|
||||||
return unblocking;
|
return unblocking;
|
||||||
}
|
}
|
||||||
if ((tm.thing->z >= topz) || (tm.thing->z + tm.thing->height <= thing->z))
|
if ((tm.thing->Z() >= topz) || (tm.thing->Top() <= thing->Z()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1120,7 +1122,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
// or different species if DONTHARMSPECIES
|
// or different species if DONTHARMSPECIES
|
||||||
(!(thing->flags6 & MF6_DONTHARMSPECIES) || thing->GetSpecies() != tm.thing->GetSpecies()) &&
|
(!(thing->flags6 & MF6_DONTHARMSPECIES) || thing->GetSpecies() != tm.thing->GetSpecies()) &&
|
||||||
// touches vertically
|
// touches vertically
|
||||||
thing->z + thing->height >= tm.thing->z && tm.thing->z + tm.thing->height >= thing->z &&
|
topz >= tm.thing->Z() && tm.thing->Z() + tm.thing->height >= thingpos.z &&
|
||||||
// prevents lost souls from exploding when fired by pain elementals
|
// prevents lost souls from exploding when fired by pain elementals
|
||||||
(thing->master != tm.thing && tm.thing->master != thing))
|
(thing->master != tm.thing && tm.thing->master != thing))
|
||||||
// Difference with MBF: MBF hardcodes the LS/PE check and lets actors of the same species
|
// Difference with MBF: MBF hardcodes the LS/PE check and lets actors of the same species
|
||||||
|
@ -1223,11 +1225,11 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it went over / under
|
// Check if it went over / under
|
||||||
if (tm.thing->z > thing->z + clipheight)
|
if (tm.thing->Z() > thingpos.z + clipheight)
|
||||||
{ // Over thing
|
{ // Over thing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (tm.thing->z + tm.thing->height < thing->z)
|
if (tm.thing->Top() < thingpos.z)
|
||||||
{ // Under thing
|
{ // Under thing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1335,7 +1337,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
!(tm.thing->flags3 & MF3_BLOODLESSIMPACT) &&
|
!(tm.thing->flags3 & MF3_BLOODLESSIMPACT) &&
|
||||||
(pr_checkthing() < 192))
|
(pr_checkthing() < 192))
|
||||||
{
|
{
|
||||||
P_BloodSplatter(tm.thing->x, tm.thing->y, tm.thing->z, thing);
|
P_BloodSplatter(tm.thing->X(), tm.thing->Y(), tm.thing->Z(), thing);
|
||||||
}
|
}
|
||||||
if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT))
|
if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT))
|
||||||
{
|
{
|
||||||
|
@ -1377,7 +1379,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
|
||||||
// [RH] The next condition is to compensate for the extra height
|
// [RH] The next condition is to compensate for the extra height
|
||||||
// that gets added by P_CheckPosition() so that you cannot pick
|
// that gets added by P_CheckPosition() so that you cannot pick
|
||||||
// up things that are above your true height.
|
// up things that are above your true height.
|
||||||
&& thing->z < tm.thing->z + tm.thing->height - tm.thing->MaxStepHeight)
|
&& thingpos.z < tm.thing->Top() - tm.thing->MaxStepHeight)
|
||||||
{ // Can be picked up by tmthing
|
{ // Can be picked up by tmthing
|
||||||
P_TouchSpecialThing(thing, tm.thing); // can remove thing
|
P_TouchSpecialThing(thing, tm.thing); // can remove thing
|
||||||
}
|
}
|
||||||
|
@ -1464,7 +1466,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
|
||||||
F3DFloor* rover;
|
F3DFloor* rover;
|
||||||
fixed_t delta1;
|
fixed_t delta1;
|
||||||
fixed_t delta2;
|
fixed_t delta2;
|
||||||
int thingtop = thing->z + (thing->height == 0 ? 1 : thing->height);
|
int thingtop = thing->Z() + (thing->height == 0 ? 1 : thing->height);
|
||||||
|
|
||||||
for (unsigned i = 0; i<newsec->e->XFloor.ffloors.Size(); i++)
|
for (unsigned i = 0; i<newsec->e->XFloor.ffloors.Size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -1474,7 +1476,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
|
||||||
fixed_t ff_bottom = rover->bottom.plane->ZatPoint(x, y);
|
fixed_t ff_bottom = rover->bottom.plane->ZatPoint(x, y);
|
||||||
fixed_t ff_top = rover->top.plane->ZatPoint(x, y);
|
fixed_t ff_top = rover->top.plane->ZatPoint(x, y);
|
||||||
|
|
||||||
delta1 = thing->z - (ff_bottom + ((ff_top - ff_bottom) / 2));
|
delta1 = thing->Z() - (ff_bottom + ((ff_top - ff_bottom) / 2));
|
||||||
delta2 = thingtop - (ff_bottom + ((ff_top - ff_bottom) / 2));
|
delta2 = thingtop - (ff_bottom + ((ff_top - ff_bottom) / 2));
|
||||||
|
|
||||||
if (ff_top > tm.floorz && abs(delta1) < abs(delta2))
|
if (ff_top > tm.floorz && abs(delta1) < abs(delta2))
|
||||||
|
@ -1526,17 +1528,17 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (!BlockingMobj->player && !(thing->flags & (MF_FLOAT | MF_MISSILE | MF_SKULLFLY)) &&
|
else if (!BlockingMobj->player && !(thing->flags & (MF_FLOAT | MF_MISSILE | MF_SKULLFLY)) &&
|
||||||
BlockingMobj->z + BlockingMobj->height - thing->z <= thing->MaxStepHeight)
|
BlockingMobj->Top() - thing->Z() <= thing->MaxStepHeight)
|
||||||
{
|
{
|
||||||
if (thingblocker == NULL ||
|
if (thingblocker == NULL ||
|
||||||
BlockingMobj->z > thingblocker->z)
|
BlockingMobj->Z() > thingblocker->Z())
|
||||||
{
|
{
|
||||||
thingblocker = BlockingMobj;
|
thingblocker = BlockingMobj;
|
||||||
}
|
}
|
||||||
thing->BlockingMobj = NULL;
|
thing->BlockingMobj = NULL;
|
||||||
}
|
}
|
||||||
else if (thing->player &&
|
else if (thing->player &&
|
||||||
thing->z + thing->height - BlockingMobj->z <= thing->MaxStepHeight)
|
thing->Top() - BlockingMobj->Z() <= thing->MaxStepHeight)
|
||||||
{
|
{
|
||||||
if (thingblocker)
|
if (thingblocker)
|
||||||
{ // There is something to step up on. Return this thing as
|
{ // There is something to step up on. Return this thing as
|
||||||
|
@ -1629,10 +1631,10 @@ bool P_TestMobjLocation(AActor *mobj)
|
||||||
|
|
||||||
flags = mobj->flags;
|
flags = mobj->flags;
|
||||||
mobj->flags &= ~MF_PICKUP;
|
mobj->flags &= ~MF_PICKUP;
|
||||||
if (P_CheckPosition(mobj, mobj->x, mobj->y))
|
if (P_CheckPosition(mobj, mobj->X(), mobj->Y()))
|
||||||
{ // XY is ok, now check Z
|
{ // XY is ok, now check Z
|
||||||
mobj->flags = flags;
|
mobj->flags = flags;
|
||||||
if ((mobj->z < mobj->floorz) || (mobj->z + mobj->height > mobj->ceilingz))
|
if ((mobj->Z() < mobj->floorz) || (mobj->Top() > mobj->ceilingz))
|
||||||
{ // Bad Z
|
{ // Bad Z
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1656,10 +1658,10 @@ AActor *P_CheckOnmobj(AActor *thing)
|
||||||
bool good;
|
bool good;
|
||||||
AActor *onmobj;
|
AActor *onmobj;
|
||||||
|
|
||||||
oldz = thing->z;
|
oldz = thing->Z();
|
||||||
P_FakeZMovement(thing);
|
P_FakeZMovement(thing);
|
||||||
good = P_TestMobjZ(thing, false, &onmobj);
|
good = P_TestMobjZ(thing, false, &onmobj);
|
||||||
thing->z = oldz;
|
thing->SetZ(oldz);
|
||||||
|
|
||||||
return good ? NULL : onmobj;
|
return good ? NULL : onmobj;
|
||||||
}
|
}
|
||||||
|
@ -1679,7 +1681,7 @@ bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
|
FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius));
|
||||||
AActor *thing;
|
AActor *thing;
|
||||||
|
|
||||||
while ((thing = it.Next()))
|
while ((thing = it.Next()))
|
||||||
|
@ -1721,15 +1723,15 @@ bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
|
||||||
{ // Don't clip against whoever shot the missile.
|
{ // Don't clip against whoever shot the missile.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (actor->z > thing->z + thing->height)
|
if (actor->Z() > thing->Top())
|
||||||
{ // over thing
|
{ // over thing
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (actor->z + actor->height <= thing->z)
|
else if (actor->Top() <= thing->Z())
|
||||||
{ // under thing
|
{ // under thing
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!quick && onmobj != NULL && thing->z + thing->height < onmobj->z + onmobj->height)
|
else if (!quick && onmobj != NULL && thing->Top() < onmobj->Top())
|
||||||
{ // something higher is in the way
|
{ // something higher is in the way
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1753,35 +1755,35 @@ void P_FakeZMovement(AActor *mo)
|
||||||
//
|
//
|
||||||
// adjust height
|
// adjust height
|
||||||
//
|
//
|
||||||
mo->z += mo->velz;
|
mo->AddZ(mo->velz);
|
||||||
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);
|
fixed_t dist = mo->AproxDistance(mo->target);
|
||||||
fixed_t delta = (mo->target->z + (mo->height >> 1)) - mo->z;
|
fixed_t delta = (mo->target->Z() + (mo->height >> 1)) - mo->Z();
|
||||||
if (delta < 0 && dist < -(delta * 3))
|
if (delta < 0 && dist < -(delta * 3))
|
||||||
mo->z -= mo->FloatSpeed;
|
mo->AddZ(-mo->FloatSpeed);
|
||||||
else if (delta > 0 && dist < (delta * 3))
|
else if (delta > 0 && dist < (delta * 3))
|
||||||
mo->z += mo->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->z += finesine[(FINEANGLES / 80 * level.maptime)&FINEMASK] / 8;
|
mo->AddZ(finesine[(FINEANGLES / 80 * level.maptime)&FINEMASK] / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// clip movement
|
// clip movement
|
||||||
//
|
//
|
||||||
if (mo->z <= mo->floorz)
|
if (mo->Z() <= mo->floorz)
|
||||||
{ // hit the floor
|
{ // hit the floor
|
||||||
mo->z = mo->floorz;
|
mo->SetZ(mo->floorz);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->z + mo->height > mo->ceilingz)
|
if (mo->Top() > mo->ceilingz)
|
||||||
{ // hit the ceiling
|
{ // hit the ceiling
|
||||||
mo->z = mo->ceilingz - mo->height;
|
mo->SetZ(mo->ceilingz - mo->height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1802,8 +1804,8 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo
|
||||||
fixed_t fzb = line->frontsector->floorplane.ZatPoint(mobj);
|
fixed_t fzb = line->frontsector->floorplane.ZatPoint(mobj);
|
||||||
fixed_t bzt = line->backsector->ceilingplane.ZatPoint(mobj);
|
fixed_t bzt = line->backsector->ceilingplane.ZatPoint(mobj);
|
||||||
fixed_t bzb = line->backsector->floorplane.ZatPoint(mobj);
|
fixed_t bzb = line->backsector->floorplane.ZatPoint(mobj);
|
||||||
if (fzt >= mobj->z + mobj->height && bzt >= mobj->z + mobj->height &&
|
if (fzt >= mobj->Top() && bzt >= mobj->Top() &&
|
||||||
fzb <= mobj->z && bzb <= mobj->z)
|
fzb <= mobj->Z() && bzb <= mobj->Z())
|
||||||
{
|
{
|
||||||
// we must also check if some 3D floor in the backsector may be blocking
|
// we must also check if some 3D floor in the backsector may be blocking
|
||||||
for (unsigned int i = 0; i<line->backsector->e->XFloor.ffloors.Size(); i++)
|
for (unsigned int i = 0; i<line->backsector->e->XFloor.ffloors.Size(); i++)
|
||||||
|
@ -1815,7 +1817,7 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo
|
||||||
fixed_t ff_bottom = rover->bottom.plane->ZatPoint(mobj);
|
fixed_t ff_bottom = rover->bottom.plane->ZatPoint(mobj);
|
||||||
fixed_t ff_top = rover->top.plane->ZatPoint(mobj);
|
fixed_t ff_top = rover->top.plane->ZatPoint(mobj);
|
||||||
|
|
||||||
if (ff_bottom < mobj->z + mobj->height && ff_top > mobj->z)
|
if (ff_bottom < mobj->Top() && ff_top > mobj->Z())
|
||||||
{
|
{
|
||||||
goto isblocking;
|
goto isblocking;
|
||||||
}
|
}
|
||||||
|
@ -1858,8 +1860,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
FCheckPosition &tm,
|
FCheckPosition &tm,
|
||||||
bool missileCheck) // [GZ] Fired missiles ignore the drop-off test
|
bool missileCheck) // [GZ] Fired missiles ignore the drop-off test
|
||||||
{
|
{
|
||||||
fixed_t oldx;
|
fixedvec3 oldpos;
|
||||||
fixed_t oldy;
|
sector_t *oldsector;
|
||||||
fixed_t oldz;
|
fixed_t oldz;
|
||||||
int side;
|
int side;
|
||||||
int oldside;
|
int oldside;
|
||||||
|
@ -1868,10 +1870,10 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
sector_t* newsec;
|
sector_t* newsec;
|
||||||
|
|
||||||
tm.floatok = false;
|
tm.floatok = false;
|
||||||
oldz = thing->z;
|
oldz = thing->Z();
|
||||||
if (onfloor)
|
if (onfloor)
|
||||||
{
|
{
|
||||||
thing->z = onfloor->ZatPoint(x, y);
|
thing->SetZ(onfloor->ZatPoint(x, y));
|
||||||
}
|
}
|
||||||
thing->flags6 |= MF6_INTRYMOVE;
|
thing->flags6 |= MF6_INTRYMOVE;
|
||||||
if (!P_CheckPosition(thing, x, y, tm))
|
if (!P_CheckPosition(thing, x, y, tm))
|
||||||
|
@ -1888,19 +1890,16 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
{
|
{
|
||||||
goto pushline;
|
goto pushline;
|
||||||
}
|
}
|
||||||
else if (BlockingMobj->z + BlockingMobj->height - thing->z
|
else if (BlockingMobj->Top() - thing->Z() > thing->MaxStepHeight
|
||||||
> thing->MaxStepHeight
|
|| (BlockingMobj->Sector->ceilingplane.ZatPoint(x, y) - (BlockingMobj->Top()) < thing->height)
|
||||||
|| (BlockingMobj->Sector->ceilingplane.ZatPoint(x, y)
|
|| (tm.ceilingz - (BlockingMobj->Top()) < thing->height))
|
||||||
- (BlockingMobj->z + BlockingMobj->height) < thing->height)
|
|
||||||
|| (tm.ceilingz - (BlockingMobj->z + BlockingMobj->height)
|
|
||||||
< thing->height))
|
|
||||||
{
|
{
|
||||||
goto pushline;
|
goto pushline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(tm.thing->flags2 & MF2_PASSMOBJ) || (i_compatflags & COMPATF_NO_PASSMOBJ))
|
if (!(tm.thing->flags2 & MF2_PASSMOBJ) || (i_compatflags & COMPATF_NO_PASSMOBJ))
|
||||||
{
|
{
|
||||||
thing->z = oldz;
|
thing->SetZ(oldz);
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1908,16 +1907,16 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
|
|
||||||
if (thing->flags3 & MF3_FLOORHUGGER)
|
if (thing->flags3 & MF3_FLOORHUGGER)
|
||||||
{
|
{
|
||||||
thing->z = tm.floorz;
|
thing->SetZ(tm.floorz);
|
||||||
}
|
}
|
||||||
else if (thing->flags3 & MF3_CEILINGHUGGER)
|
else if (thing->flags3 & MF3_CEILINGHUGGER)
|
||||||
{
|
{
|
||||||
thing->z = tm.ceilingz - thing->height;
|
thing->SetZ(tm.ceilingz - thing->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onfloor && tm.floorsector == thing->floorsector)
|
if (onfloor && tm.floorsector == thing->floorsector)
|
||||||
{
|
{
|
||||||
thing->z = tm.floorz;
|
thing->SetZ(tm.floorz);
|
||||||
}
|
}
|
||||||
if (!(thing->flags & MF_NOCLIP))
|
if (!(thing->flags & MF_NOCLIP))
|
||||||
{
|
{
|
||||||
|
@ -1929,7 +1928,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
tm.floatok = true;
|
tm.floatok = true;
|
||||||
|
|
||||||
if (!(thing->flags & MF_TELEPORT)
|
if (!(thing->flags & MF_TELEPORT)
|
||||||
&& tm.ceilingz - thing->z < thing->height
|
&& tm.ceilingz - thing->Z() < thing->height
|
||||||
&& !(thing->flags3 & MF3_CEILINGHUGGER)
|
&& !(thing->flags3 & MF3_CEILINGHUGGER)
|
||||||
&& (!(thing->flags2 & MF2_FLY) || !(thing->flags & MF_NOGRAVITY)))
|
&& (!(thing->flags2 & MF2_FLY) || !(thing->flags & MF_NOGRAVITY)))
|
||||||
{
|
{
|
||||||
|
@ -1938,17 +1937,17 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
if (thing->flags2 & MF2_FLY && thing->flags & MF_NOGRAVITY)
|
if (thing->flags2 & MF2_FLY && thing->flags & MF_NOGRAVITY)
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
if (thing->z + thing->height > tm.ceilingz)
|
if (thing->Top() > tm.ceilingz)
|
||||||
goto pushline;
|
goto pushline;
|
||||||
#else
|
#else
|
||||||
// When flying, slide up or down blocking lines until the actor
|
// When flying, slide up or down blocking lines until the actor
|
||||||
// is not blocked.
|
// is not blocked.
|
||||||
if (thing->z + thing->height > tm.ceilingz)
|
if (thing->Top() > tm.ceilingz)
|
||||||
{
|
{
|
||||||
thing->velz = -8 * FRACUNIT;
|
thing->velz = -8 * FRACUNIT;
|
||||||
goto pushline;
|
goto pushline;
|
||||||
}
|
}
|
||||||
else if (thing->z < tm.floorz && tm.floorz - tm.dropoffz > thing->MaxDropOffHeight)
|
else if (thing->Z() < tm.floorz && tm.floorz - tm.dropoffz > thing->MaxDropOffHeight)
|
||||||
{
|
{
|
||||||
thing->velz = 8 * FRACUNIT;
|
thing->velz = 8 * FRACUNIT;
|
||||||
goto pushline;
|
goto pushline;
|
||||||
|
@ -1957,28 +1956,28 @@ bool P_TryMove(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 ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm.floorz > thing->z)
|
if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm.floorz > thing->Z())
|
||||||
{ // [RH] Don't let normal missiles climb steps
|
{ // [RH] Don't let normal missiles climb steps
|
||||||
goto pushline;
|
goto pushline;
|
||||||
}
|
}
|
||||||
if (tm.floorz - thing->z > thing->MaxStepHeight)
|
if (tm.floorz - thing->Z() > thing->MaxStepHeight)
|
||||||
{ // too big a step up
|
{ // too big a step up
|
||||||
goto pushline;
|
goto pushline;
|
||||||
}
|
}
|
||||||
else if (thing->z < tm.floorz)
|
else if (thing->Z() < 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->z;
|
fixed_t savedz = thing->Z();
|
||||||
bool good;
|
bool good;
|
||||||
thing->z = tm.floorz;
|
thing->SetZ(tm.floorz);
|
||||||
good = P_TestMobjZ(thing);
|
good = P_TestMobjZ(thing);
|
||||||
thing->z = savedz;
|
thing->SetZ(savedz);
|
||||||
if (!good)
|
if (!good)
|
||||||
{
|
{
|
||||||
goto pushline;
|
goto pushline;
|
||||||
}
|
}
|
||||||
if (thing->flags6 & MF6_STEPMISSILE)
|
if (thing->flags6 & MF6_STEPMISSILE)
|
||||||
{
|
{
|
||||||
thing->z = tm.floorz;
|
thing->SetZ(tm.floorz);
|
||||||
// If moving down, cancel vertical component of the velocity
|
// If moving down, cancel vertical component of the velocity
|
||||||
if (thing->velz < 0)
|
if (thing->velz < 0)
|
||||||
{
|
{
|
||||||
|
@ -2004,7 +2003,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropoff == 2 && // large jump down (e.g. dogs)
|
if (dropoff == 2 && // large jump down (e.g. dogs)
|
||||||
(tm.floorz - tm.dropoffz > 128 * FRACUNIT || thing->target == NULL || thing->target->z >tm.dropoffz))
|
(tm.floorz - tm.dropoffz > 128 * FRACUNIT || thing->target == NULL || thing->target->Z() >tm.dropoffz))
|
||||||
{
|
{
|
||||||
dropoff = false;
|
dropoff = false;
|
||||||
}
|
}
|
||||||
|
@ -2020,14 +2019,14 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
// This is so that it does not walk off of things onto a drop off.
|
// This is so that it does not walk off of things onto a drop off.
|
||||||
if (thing->flags2 & MF2_ONMOBJ)
|
if (thing->flags2 & MF2_ONMOBJ)
|
||||||
{
|
{
|
||||||
floorz = MAX(thing->z, tm.floorz);
|
floorz = MAX(thing->Z(), tm.floorz);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (floorz - tm.dropoffz > thing->MaxDropOffHeight &&
|
if (floorz - tm.dropoffz > thing->MaxDropOffHeight &&
|
||||||
!(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->z = oldz;
|
thing->SetZ(oldz);
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2046,9 +2045,9 @@ bool P_TryMove(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.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->z = oldz;
|
thing->SetZ(oldz);
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2063,7 +2062,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
thing->player->Bot->dest = NULL;
|
thing->player->Bot->dest = NULL;
|
||||||
thing->velx = 0;
|
thing->velx = 0;
|
||||||
thing->vely = 0;
|
thing->vely = 0;
|
||||||
thing->z = oldz;
|
thing->SetZ(oldz);
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2090,7 +2089,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
// Borrowed from MBF:
|
// Borrowed from MBF:
|
||||||
if (thing->BounceFlags & BOUNCE_MBF && // killough 8/13/98
|
if (thing->BounceFlags & BOUNCE_MBF && // killough 8/13/98
|
||||||
!(thing->flags & (MF_MISSILE | MF_NOGRAVITY)) &&
|
!(thing->flags & (MF_MISSILE | MF_NOGRAVITY)) &&
|
||||||
!thing->IsSentient() && tm.floorz - thing->z > 16 * FRACUNIT)
|
!thing->IsSentient() && tm.floorz - thing->Z() > 16 * FRACUNIT)
|
||||||
{ // too big a step up for MBF bouncers under gravity
|
{ // too big a step up for MBF bouncers under gravity
|
||||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||||
return false;
|
return false;
|
||||||
|
@ -2099,8 +2098,8 @@ 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();
|
||||||
|
|
||||||
oldx = thing->x;
|
oldpos = thing->Pos();
|
||||||
oldy = thing->y;
|
oldsector = thing->Sector;
|
||||||
thing->floorz = tm.floorz;
|
thing->floorz = tm.floorz;
|
||||||
thing->ceilingz = tm.ceilingz;
|
thing->ceilingz = tm.ceilingz;
|
||||||
thing->dropoffz = tm.dropoffz; // killough 11/98: keep track of dropoffs
|
thing->dropoffz = tm.dropoffz; // killough 11/98: keep track of dropoffs
|
||||||
|
@ -2109,8 +2108,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->x = x;
|
thing->SetXY(x, y);
|
||||||
thing->y = y;
|
|
||||||
|
|
||||||
thing->LinkToWorld();
|
thing->LinkToWorld();
|
||||||
|
|
||||||
|
@ -2124,9 +2122,11 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
||||||
{
|
{
|
||||||
while (spechit.Pop(ld))
|
while (spechit.Pop(ld))
|
||||||
{
|
{
|
||||||
|
fixedvec3 thingpos = thing->PosRelative(ld);
|
||||||
|
fixedvec3 oldrelpos = PosRelative(oldpos, ld, oldsector);
|
||||||
// see if the line was crossed
|
// see if the line was crossed
|
||||||
side = P_PointOnLineSide(thing->x, thing->y, ld);
|
side = P_PointOnLineSide(thingpos.x, thingpos.y, ld);
|
||||||
oldside = P_PointOnLineSide(oldx, oldy, ld);
|
oldside = P_PointOnLineSide(oldrelpos.x, oldrelpos.y, ld);
|
||||||
if (side != oldside && ld->special && !(thing->flags6 & MF6_NOTRIGGER))
|
if (side != oldside && ld->special && !(thing->flags6 & MF6_NOTRIGGER))
|
||||||
{
|
{
|
||||||
if (thing->player && (thing->player->cheats & CF_PREDICTING))
|
if (thing->player && (thing->player->cheats & CF_PREDICTING))
|
||||||
|
@ -2171,7 +2171,7 @@ 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->z + viewheight;
|
fixed_t eyez = thing->Z() + viewheight;
|
||||||
fixed_t fakez = hs->floorplane.ZatPoint(x, y);
|
fixed_t fakez = hs->floorplane.ZatPoint(x, y);
|
||||||
|
|
||||||
if (!oldAboveFakeFloor && eyez > fakez)
|
if (!oldAboveFakeFloor && eyez > fakez)
|
||||||
|
@ -2211,7 +2211,7 @@ pushline:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
thing->z = oldz;
|
thing->SetZ(oldz);
|
||||||
if (!(thing->flags&(MF_TELEPORT | MF_NOCLIP)))
|
if (!(thing->flags&(MF_TELEPORT | MF_NOCLIP)))
|
||||||
{
|
{
|
||||||
int numSpecHitTemp;
|
int numSpecHitTemp;
|
||||||
|
@ -2225,7 +2225,8 @@ pushline:
|
||||||
{
|
{
|
||||||
// see which lines were pushed
|
// see which lines were pushed
|
||||||
ld = spechit[--numSpecHitTemp];
|
ld = spechit[--numSpecHitTemp];
|
||||||
side = P_PointOnLineSide(thing->x, thing->y, ld);
|
fixedvec3 pos = thing->PosRelative(ld);
|
||||||
|
side = P_PointOnLineSide(pos.x, pos.y, ld);
|
||||||
CheckForPushSpecial(ld, side, thing, true);
|
CheckForPushSpecial(ld, side, thing, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2252,7 +2253,7 @@ 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, fixed_t x, fixed_t y)
|
||||||
{
|
{
|
||||||
FCheckPosition tm;
|
FCheckPosition tm;
|
||||||
fixed_t newz = thing->z;
|
fixed_t newz = thing->Z();
|
||||||
|
|
||||||
if (!P_CheckPosition(thing, x, y, tm))
|
if (!P_CheckPosition(thing, x, y, tm))
|
||||||
{
|
{
|
||||||
|
@ -2284,7 +2285,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
|
||||||
}
|
}
|
||||||
if (thing->flags2 & MF2_FLY && thing->flags & MF_NOGRAVITY)
|
if (thing->flags2 & MF2_FLY && thing->flags & MF_NOGRAVITY)
|
||||||
{
|
{
|
||||||
if (thing->z + thing->height > tm.ceilingz)
|
if (thing->Top() > tm.ceilingz)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER))
|
if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER))
|
||||||
|
@ -2299,10 +2300,10 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
|
||||||
}
|
}
|
||||||
else if (newz < tm.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->z;
|
fixed_t savedz = thing->Z();
|
||||||
thing->z = newz = tm.floorz;
|
thing->SetZ(newz = tm.floorz);
|
||||||
bool good = P_TestMobjZ(thing);
|
bool good = P_TestMobjZ(thing);
|
||||||
thing->z = savedz;
|
thing->SetZ(savedz);
|
||||||
if (!good)
|
if (!good)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -2383,7 +2384,7 @@ void FSlide::HitSlideLine(line_t* ld)
|
||||||
icyfloor =
|
icyfloor =
|
||||||
(P_AproxDistance(tmxmove, tmymove) > 4 * FRACUNIT) &&
|
(P_AproxDistance(tmxmove, tmymove) > 4 * FRACUNIT) &&
|
||||||
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->dx == 0)
|
||||||
|
@ -2421,7 +2422,8 @@ void FSlide::HitSlideLine(line_t* ld)
|
||||||
// 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
|
||||||
|
|
||||||
side = P_PointOnLineSide(slidemo->x, slidemo->y, ld);
|
fixedvec3 pos = slidemo->PosRelative(ld);
|
||||||
|
side = P_PointOnLineSide(pos.x, pos.y, ld);
|
||||||
|
|
||||||
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
|
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
|
||||||
|
|
||||||
|
@ -2473,8 +2475,8 @@ void FSlide::HitSlideLine(line_t* ld)
|
||||||
|
|
||||||
P_MakeDivline(ld, &dll);
|
P_MakeDivline(ld, &dll);
|
||||||
|
|
||||||
dlv.x = slidemo->x;
|
dlv.x = pos.x;
|
||||||
dlv.y = slidemo->y;
|
dlv.y = pos.y;
|
||||||
dlv.dx = dll.dy;
|
dlv.dx = dll.dy;
|
||||||
dlv.dy = -dll.dx;
|
dlv.dy = -dll.dx;
|
||||||
|
|
||||||
|
@ -2526,7 +2528,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)
|
||||||
{
|
{
|
||||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
fixedvec3 pos = slidemo->PosRelative(li);
|
||||||
|
if (P_PointOnLineSide(pos.x, pos.y, li))
|
||||||
{
|
{
|
||||||
// don't hit the back side
|
// don't hit the back side
|
||||||
continue;
|
continue;
|
||||||
|
@ -2554,19 +2557,19 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t
|
||||||
if (open.range < slidemo->height)
|
if (open.range < slidemo->height)
|
||||||
goto isblocking; // doesn't fit
|
goto isblocking; // doesn't fit
|
||||||
|
|
||||||
if (open.top - slidemo->z < slidemo->height)
|
if (open.top - slidemo->Z() < slidemo->height)
|
||||||
goto isblocking; // mobj is too high
|
goto isblocking; // mobj is too high
|
||||||
|
|
||||||
if (open.bottom - slidemo->z > slidemo->MaxStepHeight)
|
if (open.bottom - slidemo->Z() > slidemo->MaxStepHeight)
|
||||||
{
|
{
|
||||||
goto isblocking; // too big a step up
|
goto isblocking; // too big a step up
|
||||||
}
|
}
|
||||||
else if (slidemo->z < open.bottom)
|
else if (slidemo->Z() < open.bottom)
|
||||||
{ // [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 = slidemo->z;
|
fixed_t savedz = slidemo->Z();
|
||||||
slidemo->z = open.bottom;
|
slidemo->SetZ(open.bottom);
|
||||||
bool good = P_TestMobjZ(slidemo);
|
bool good = P_TestMobjZ(slidemo);
|
||||||
slidemo->z = savedz;
|
slidemo->SetZ(savedz);
|
||||||
if (!good)
|
if (!good)
|
||||||
{
|
{
|
||||||
goto isblocking;
|
goto isblocking;
|
||||||
|
@ -2627,24 +2630,24 @@ retry:
|
||||||
// trace along the three leading corners
|
// trace along the three leading corners
|
||||||
if (tryx > 0)
|
if (tryx > 0)
|
||||||
{
|
{
|
||||||
leadx = mo->x + mo->radius;
|
leadx = mo->X() + mo->radius;
|
||||||
trailx = mo->x - mo->radius;
|
trailx = mo->X() - mo->radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leadx = mo->x - mo->radius;
|
leadx = mo->X() - mo->radius;
|
||||||
trailx = mo->x + mo->radius;
|
trailx = mo->X() + mo->radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tryy > 0)
|
if (tryy > 0)
|
||||||
{
|
{
|
||||||
leady = mo->y + mo->radius;
|
leady = mo->Y() + mo->radius;
|
||||||
traily = mo->y - mo->radius;
|
traily = mo->Y() - mo->radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leady = mo->y - mo->radius;
|
leady = mo->Y() - mo->radius;
|
||||||
traily = mo->y + mo->radius;
|
traily = mo->Y() + mo->radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
bestslidefrac = FRACUNIT + 1;
|
bestslidefrac = FRACUNIT + 1;
|
||||||
|
@ -2661,11 +2664,11 @@ retry:
|
||||||
// killough 3/15/98: Allow objects to drop off ledges
|
// killough 3/15/98: Allow objects to drop off ledges
|
||||||
xmove = 0, ymove = tryy;
|
xmove = 0, ymove = tryy;
|
||||||
walkplane = P_CheckSlopeWalk(mo, xmove, ymove);
|
walkplane = P_CheckSlopeWalk(mo, xmove, ymove);
|
||||||
if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true, walkplane))
|
if (!P_TryMove(mo, mo->X() + xmove, mo->Y() + ymove, true, walkplane))
|
||||||
{
|
{
|
||||||
xmove = tryx, ymove = 0;
|
xmove = tryx, ymove = 0;
|
||||||
walkplane = P_CheckSlopeWalk(mo, xmove, ymove);
|
walkplane = P_CheckSlopeWalk(mo, xmove, ymove);
|
||||||
P_TryMove(mo, mo->x + xmove, mo->y + ymove, true, walkplane);
|
P_TryMove(mo, mo->X() + xmove, mo->Y() + ymove, true, walkplane);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2682,7 +2685,7 @@ retry:
|
||||||
const fixed_t startvely = mo->vely;
|
const fixed_t startvely = mo->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->x + newx, mo->y + newy, true))
|
if (!P_TryMove(mo, mo->X() + newx, mo->Y() + newy, true))
|
||||||
goto stairstep;
|
goto stairstep;
|
||||||
|
|
||||||
if (mo->velx != startvelx || mo->vely != startvely)
|
if (mo->velx != startvelx || mo->vely != startvely)
|
||||||
|
@ -2716,7 +2719,7 @@ retry:
|
||||||
walkplane = P_CheckSlopeWalk(mo, tmxmove, tmymove);
|
walkplane = P_CheckSlopeWalk(mo, tmxmove, tmymove);
|
||||||
|
|
||||||
// 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->x + tmxmove, mo->y + tmymove, true, walkplane))
|
if (!P_TryMove(mo, mo->X() + tmxmove, mo->Y() + tmymove, true, walkplane))
|
||||||
{
|
{
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@ -2752,7 +2755,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
|
||||||
|
|
||||||
fixed_t thisplanez = rover->top.plane->ZatPoint(actor);
|
fixed_t thisplanez = rover->top.plane->ZatPoint(actor);
|
||||||
|
|
||||||
if (thisplanez>planezhere && thisplanez <= actor->z + actor->MaxStepHeight)
|
if (thisplanez>planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight)
|
||||||
{
|
{
|
||||||
copyplane = *rover->top.plane;
|
copyplane = *rover->top.plane;
|
||||||
if (copyplane.c<0) copyplane.FlipVert();
|
if (copyplane.c<0) copyplane.FlipVert();
|
||||||
|
@ -2770,7 +2773,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
|
||||||
|
|
||||||
fixed_t thisplanez = rover->top.plane->ZatPoint(actor);
|
fixed_t thisplanez = rover->top.plane->ZatPoint(actor);
|
||||||
|
|
||||||
if (thisplanez>planezhere && thisplanez <= actor->z + actor->MaxStepHeight)
|
if (thisplanez>planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight)
|
||||||
{
|
{
|
||||||
copyplane = *rover->top.plane;
|
copyplane = *rover->top.plane;
|
||||||
if (copyplane.c<0) copyplane.FlipVert();
|
if (copyplane.c<0) copyplane.FlipVert();
|
||||||
|
@ -2787,7 +2790,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actor->z - planezhere > FRACUNIT)
|
if (actor->Z() - planezhere > FRACUNIT)
|
||||||
{ // not on floor
|
{ // not on floor
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2797,9 +2800,9 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
|
||||||
fixed_t destx, desty;
|
fixed_t destx, desty;
|
||||||
fixed_t t;
|
fixed_t t;
|
||||||
|
|
||||||
destx = actor->x + xmove;
|
destx = actor->X() + xmove;
|
||||||
desty = actor->y + ymove;
|
desty = actor->Y() + ymove;
|
||||||
t = TMulScale16(plane->a, destx, plane->b, desty, plane->c, actor->z) + plane->d;
|
t = TMulScale16(plane->a, destx, plane->b, desty, plane->c, actor->Z()) + plane->d;
|
||||||
if (t < 0)
|
if (t < 0)
|
||||||
{ // Desired location is behind (below) the plane
|
{ // Desired location is behind (below) the plane
|
||||||
// (i.e. Walking up the plane)
|
// (i.e. Walking up the plane)
|
||||||
|
@ -2821,7 +2824,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
|
||||||
const sector_t *sec = node->m_sector;
|
const sector_t *sec = node->m_sector;
|
||||||
if (sec->floorplane.c >= STEEPSLOPE)
|
if (sec->floorplane.c >= STEEPSLOPE)
|
||||||
{
|
{
|
||||||
if (sec->floorplane.ZatPoint(destx, desty) >= actor->z - actor->MaxStepHeight)
|
if (sec->floorplane.ZatPoint(destx, desty) >= actor->Z() - actor->MaxStepHeight)
|
||||||
{
|
{
|
||||||
dopush = false;
|
dopush = false;
|
||||||
break;
|
break;
|
||||||
|
@ -2841,19 +2844,19 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
|
||||||
// so that it lies on the plane's surface
|
// so that it lies on the plane's surface
|
||||||
destx -= FixedMul(plane->a, t);
|
destx -= FixedMul(plane->a, t);
|
||||||
desty -= FixedMul(plane->b, t);
|
desty -= FixedMul(plane->b, t);
|
||||||
xmove = destx - actor->x;
|
xmove = destx - actor->X();
|
||||||
ymove = desty - actor->y;
|
ymove = desty - actor->Y();
|
||||||
return (actor->floorsector == actor->Sector) ? plane : NULL;
|
return (actor->floorsector == actor->Sector) ? plane : NULL;
|
||||||
}
|
}
|
||||||
else if (t > 0)
|
else if (t > 0)
|
||||||
{ // Desired location is in front of (above) the plane
|
{ // Desired location is in front of (above) the plane
|
||||||
if (planezhere == actor->z)
|
if (planezhere == actor->Z())
|
||||||
{ // Actor's current spot is on/in the plane, so walk down it
|
{ // Actor's current spot is on/in the plane, so walk down it
|
||||||
// Same principle as walking up, except reversed
|
// Same principle as walking up, except reversed
|
||||||
destx += FixedMul(plane->a, t);
|
destx += FixedMul(plane->a, t);
|
||||||
desty += FixedMul(plane->b, t);
|
desty += FixedMul(plane->b, t);
|
||||||
xmove = destx - actor->x;
|
xmove = destx - actor->X();
|
||||||
ymove = desty - actor->y;
|
ymove = desty - actor->Y();
|
||||||
return (actor->floorsector == actor->Sector) ? plane : NULL;
|
return (actor->floorsector == actor->Sector) ? plane : NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2892,7 +2895,7 @@ bool FSlide::BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_
|
||||||
}
|
}
|
||||||
if (!(li->flags&ML_TWOSIDED) || !li->backsector)
|
if (!(li->flags&ML_TWOSIDED) || !li->backsector)
|
||||||
{
|
{
|
||||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
if (P_PointOnLineSide(slidemo->X(), slidemo->Y(), li))
|
||||||
continue; // don't hit the back side
|
continue; // don't hit the back side
|
||||||
goto bounceblocking;
|
goto bounceblocking;
|
||||||
}
|
}
|
||||||
|
@ -2903,10 +2906,10 @@ bool FSlide::BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_
|
||||||
if (open.range < slidemo->height)
|
if (open.range < slidemo->height)
|
||||||
goto bounceblocking; // doesn't fit
|
goto bounceblocking; // doesn't fit
|
||||||
|
|
||||||
if (open.top - slidemo->z < slidemo->height)
|
if (open.top - slidemo->Z() < slidemo->height)
|
||||||
goto bounceblocking; // mobj is too high
|
goto bounceblocking; // mobj is too high
|
||||||
|
|
||||||
if (open.bottom > slidemo->z)
|
if (open.bottom > slidemo->Z())
|
||||||
goto bounceblocking; // mobj is too low
|
goto bounceblocking; // mobj is too low
|
||||||
|
|
||||||
continue; // this line doesn't block movement
|
continue; // this line doesn't block movement
|
||||||
|
@ -2950,26 +2953,26 @@ bool FSlide::BounceWall(AActor *mo)
|
||||||
//
|
//
|
||||||
if (mo->velx > 0)
|
if (mo->velx > 0)
|
||||||
{
|
{
|
||||||
leadx = mo->x + mo->radius;
|
leadx = mo->X() + mo->radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leadx = mo->x - mo->radius;
|
leadx = mo->X() - mo->radius;
|
||||||
}
|
}
|
||||||
if (mo->vely > 0)
|
if (mo->vely > 0)
|
||||||
{
|
{
|
||||||
leady = mo->y + mo->radius;
|
leady = mo->Y() + mo->radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leady = mo->y - mo->radius;
|
leady = mo->Y() - mo->radius;
|
||||||
}
|
}
|
||||||
bestslidefrac = FRACUNIT + 1;
|
bestslidefrac = FRACUNIT + 1;
|
||||||
bestslideline = mo->BlockingLine;
|
bestslideline = mo->BlockingLine;
|
||||||
if (BounceTraverse(leadx, leady, leadx + mo->velx, leady + mo->vely) && mo->BlockingLine == NULL)
|
if (BounceTraverse(leadx, leady, leadx + mo->velx, leady + mo->vely) && 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.
|
||||||
fixed_t floordist = mo->z - mo->floorz;
|
fixed_t floordist = mo->Z() - mo->floorz;
|
||||||
fixed_t ceildist = mo->ceilingz - mo->z;
|
fixed_t ceildist = mo->ceilingz - mo->Z();
|
||||||
if (floordist <= ceildist)
|
if (floordist <= ceildist)
|
||||||
{
|
{
|
||||||
mo->FloorBounceMissile(mo->Sector->floorplane);
|
mo->FloorBounceMissile(mo->Sector->floorplane);
|
||||||
|
@ -3000,7 +3003,7 @@ bool FSlide::BounceWall(AActor *mo)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
side = P_PointOnLineSide(mo->x, mo->y, line);
|
side = P_PointOnLineSide(mo->X(), mo->Y(), line);
|
||||||
lineangle = R_PointToAngle2(0, 0, line->dx, line->dy);
|
lineangle = R_PointToAngle2(0, 0, line->dx, line->dy);
|
||||||
if (side == 1)
|
if (side == 1)
|
||||||
{
|
{
|
||||||
|
@ -3015,11 +3018,14 @@ bool FSlide::BounceWall(AActor *mo)
|
||||||
movelen = fixed_t(sqrt(double(mo->velx)*mo->velx + double(mo->vely)*mo->vely));
|
movelen = fixed_t(sqrt(double(mo->velx)*mo->velx + double(mo->vely)*mo->vely));
|
||||||
movelen = FixedMul(movelen, mo->wallbouncefactor);
|
movelen = FixedMul(movelen, mo->wallbouncefactor);
|
||||||
|
|
||||||
FBoundingBox box(mo->x, mo->y, mo->radius);
|
FBoundingBox box(mo->X(), mo->Y(), mo->radius);
|
||||||
if (box.BoxOnLineSide(line) == -1)
|
if (box.BoxOnLineSide(line) == -1)
|
||||||
{
|
{
|
||||||
mo->SetOrigin(mo->x + FixedMul(mo->radius,
|
fixedvec3 pos = mo->Vec3Offset(
|
||||||
finecosine[deltaangle]), mo->y + FixedMul(mo->radius, finesine[deltaangle]), mo->z);
|
FixedMul(mo->radius, finecosine[deltaangle]),
|
||||||
|
FixedMul(mo->radius, finesine[deltaangle]), 0);
|
||||||
|
mo->SetOrigin(pos, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (movelen < FRACUNIT)
|
if (movelen < FRACUNIT)
|
||||||
{
|
{
|
||||||
|
@ -3193,7 +3199,7 @@ bool aim_t::AimTraverse3DFloors(const divline_t &trace, intercept_t * in)
|
||||||
fixed_t trY = trace.y + FixedMul(trace.dy, in->frac);
|
fixed_t trY = trace.y + FixedMul(trace.dy, in->frac);
|
||||||
fixed_t dist = FixedMul(attackrange, in->frac);
|
fixed_t dist = FixedMul(attackrange, in->frac);
|
||||||
|
|
||||||
frontflag = P_PointOnLineSide(shootthing->x, shootthing->y, li);
|
frontflag = P_PointOnLineSide(shootthing->X(), shootthing->Y(), li);
|
||||||
|
|
||||||
// 3D floor check. This is not 100% accurate but normally sufficient when
|
// 3D floor check. This is not 100% accurate but normally sufficient when
|
||||||
// combined with a final sight check
|
// combined with a final sight check
|
||||||
|
@ -3365,7 +3371,7 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en
|
||||||
{
|
{
|
||||||
if (lastceilingplane)
|
if (lastceilingplane)
|
||||||
{
|
{
|
||||||
fixed_t ff_top = lastceilingplane->ZatPoint(th->x, th->y);
|
fixed_t ff_top = lastceilingplane->ZatPoint(th);
|
||||||
fixed_t pitch = -(int)R_PointToAngle2(0, shootz, dist, ff_top);
|
fixed_t pitch = -(int)R_PointToAngle2(0, shootz, dist, ff_top);
|
||||||
// upper slope intersects with this 3d-floor
|
// upper slope intersects with this 3d-floor
|
||||||
if (pitch > toppitch)
|
if (pitch > toppitch)
|
||||||
|
@ -3375,7 +3381,7 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en
|
||||||
}
|
}
|
||||||
if (lastfloorplane)
|
if (lastfloorplane)
|
||||||
{
|
{
|
||||||
fixed_t ff_bottom = lastfloorplane->ZatPoint(th->x, th->y);
|
fixed_t ff_bottom = lastfloorplane->ZatPoint(th);
|
||||||
fixed_t pitch = -(int)R_PointToAngle2(0, shootz, dist, ff_bottom);
|
fixed_t pitch = -(int)R_PointToAngle2(0, shootz, dist, ff_bottom);
|
||||||
// lower slope intersects with this 3d-floor
|
// lower slope intersects with this 3d-floor
|
||||||
if (pitch < bottompitch)
|
if (pitch < bottompitch)
|
||||||
|
@ -3387,12 +3393,12 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en
|
||||||
|
|
||||||
// check angles to see if the thing can be aimed at
|
// check angles to see if the thing can be aimed at
|
||||||
|
|
||||||
thingtoppitch = -(int)R_PointToAngle2(0, shootz, dist, th->z + th->height);
|
thingtoppitch = -(int)R_PointToAngle2(0, shootz, dist, th->Z() + th->height);
|
||||||
|
|
||||||
if (thingtoppitch > bottompitch)
|
if (thingtoppitch > bottompitch)
|
||||||
continue; // shot over the thing
|
continue; // shot over the thing
|
||||||
|
|
||||||
thingbottompitch = -(int)R_PointToAngle2(0, shootz, dist, th->z);
|
thingbottompitch = -(int)R_PointToAngle2(0, shootz, dist, th->Z());
|
||||||
|
|
||||||
if (thingbottompitch < toppitch)
|
if (thingbottompitch < toppitch)
|
||||||
continue; // shot under the thing
|
continue; // shot under the thing
|
||||||
|
@ -3502,9 +3508,9 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL
|
||||||
aim.shootthing = t1;
|
aim.shootthing = t1;
|
||||||
aim.friender = (friender == NULL) ? t1 : friender;
|
aim.friender = (friender == NULL) ? t1 : friender;
|
||||||
|
|
||||||
x2 = t1->x + (distance >> FRACBITS)*finecosine[angle];
|
x2 = t1->X() + (distance >> FRACBITS)*finecosine[angle];
|
||||||
y2 = t1->y + (distance >> FRACBITS)*finesine[angle];
|
y2 = t1->Y() + (distance >> FRACBITS)*finesine[angle];
|
||||||
aim.shootz = t1->z + (t1->height >> 1) - t1->floorclip;
|
aim.shootz = t1->Z() + (t1->height >> 1) - t1->floorclip;
|
||||||
if (t1->player != NULL)
|
if (t1->player != NULL)
|
||||||
{
|
{
|
||||||
aim.shootz += FixedMul(t1->player->mo->AttackZOffset, t1->player->crouchfactor);
|
aim.shootz += FixedMul(t1->player->mo->AttackZOffset, t1->player->crouchfactor);
|
||||||
|
@ -3559,15 +3565,15 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL
|
||||||
for (unsigned i = 0; i<t1->Sector->e->XFloor.ffloors.Size(); i++)
|
for (unsigned i = 0; i<t1->Sector->e->XFloor.ffloors.Size(); i++)
|
||||||
{
|
{
|
||||||
F3DFloor * rover = t1->Sector->e->XFloor.ffloors[i];
|
F3DFloor * rover = t1->Sector->e->XFloor.ffloors[i];
|
||||||
fixed_t bottomz = rover->bottom.plane->ZatPoint(t1->x, t1->y);
|
fixed_t bottomz = rover->bottom.plane->ZatPoint(t1);
|
||||||
|
|
||||||
if (bottomz >= t1->z + t1->height) aim.lastceilingplane = rover->bottom.plane;
|
if (bottomz >= t1->Top()) aim.lastceilingplane = rover->bottom.plane;
|
||||||
|
|
||||||
bottomz = rover->top.plane->ZatPoint(t1->x, t1->y);
|
bottomz = rover->top.plane->ZatPoint(t1);
|
||||||
if (bottomz <= t1->z) aim.lastfloorplane = rover->top.plane;
|
if (bottomz <= t1->Z()) aim.lastfloorplane = rover->top.plane;
|
||||||
}
|
}
|
||||||
|
|
||||||
aim.AimTraverse(t1->x, t1->y, x2, y2, target);
|
aim.AimTraverse(t1->X(), t1->Y(), x2, y2, target);
|
||||||
|
|
||||||
if (!aim.linetarget)
|
if (!aim.linetarget)
|
||||||
{
|
{
|
||||||
|
@ -3670,7 +3676,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
|
||||||
vy = FixedMul(finecosine[pitch], finesine[angle]);
|
vy = FixedMul(finecosine[pitch], finesine[angle]);
|
||||||
vz = -finesine[pitch];
|
vz = -finesine[pitch];
|
||||||
|
|
||||||
shootz = t1->z - t1->floorclip + (t1->height >> 1);
|
shootz = t1->Z() - t1->floorclip + (t1->height >> 1);
|
||||||
if (t1->player != NULL)
|
if (t1->player != NULL)
|
||||||
{
|
{
|
||||||
shootz += FixedMul(t1->player->mo->AttackZOffset, t1->player->crouchfactor);
|
shootz += FixedMul(t1->player->mo->AttackZOffset, t1->player->crouchfactor);
|
||||||
|
@ -3708,7 +3714,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
|
||||||
if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) tflags = TRACE_NoSky;
|
if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) tflags = TRACE_NoSky;
|
||||||
else tflags = TRACE_NoSky | TRACE_Impact;
|
else tflags = TRACE_NoSky | TRACE_Impact;
|
||||||
|
|
||||||
if (!Trace(t1->x, t1->y, shootz, t1->Sector, vx, vy, vz, distance,
|
if (!Trace(t1->X(), t1->Y(), shootz, t1->Sector, vx, vy, vz, distance,
|
||||||
MF_SHOOTABLE, ML_BLOCKEVERYTHING | ML_BLOCKHITSCAN, t1, trace,
|
MF_SHOOTABLE, ML_BLOCKEVERYTHING | ML_BLOCKHITSCAN, t1, trace,
|
||||||
tflags, CheckForActor, &TData))
|
tflags, CheckForActor, &TData))
|
||||||
{ // hit nothing
|
{ // hit nothing
|
||||||
|
@ -3738,8 +3744,8 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
|
||||||
if (trace.HitType != TRACE_HitWall || trace.Line->special != Line_Horizon)
|
if (trace.HitType != TRACE_HitWall || trace.Line->special != Line_Horizon)
|
||||||
{
|
{
|
||||||
fixed_t closer = trace.Distance - 4 * FRACUNIT;
|
fixed_t closer = trace.Distance - 4 * FRACUNIT;
|
||||||
puff = P_SpawnPuff(t1, pufftype, t1->x + FixedMul(vx, closer),
|
fixedvec2 pos = t1->Vec2Offset(FixedMul(vx, closer), FixedMul(vy, closer));
|
||||||
t1->y + FixedMul(vy, closer),
|
puff = P_SpawnPuff(t1, pufftype, pos.x, pos.y,
|
||||||
shootz + FixedMul(vz, closer), angle - ANG90, 0, puffFlags);
|
shootz + FixedMul(vz, closer), angle - ANG90, 0, puffFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3775,8 +3781,8 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
|
||||||
{
|
{
|
||||||
// Using the puff's position is not accurate enough.
|
// Using the puff's position is not accurate enough.
|
||||||
// Instead make it splash at the actual hit position
|
// Instead make it splash at the actual hit position
|
||||||
hitx = t1->x + FixedMul(vx, trace.Distance);
|
hitx = t1->X() + FixedMul(vx, trace.Distance);
|
||||||
hity = t1->y + FixedMul(vy, trace.Distance);
|
hity = t1->Y() + FixedMul(vy, trace.Distance);
|
||||||
hitz = shootz + FixedMul(vz, trace.Distance);
|
hitz = shootz + FixedMul(vz, trace.Distance);
|
||||||
P_HitWater(puff, P_PointInSector(hitx, hity), hitx, hity, hitz);
|
P_HitWater(puff, P_PointInSector(hitx, hity), hitx, hity, hitz);
|
||||||
}
|
}
|
||||||
|
|
343
src/p_mobj.cpp
343
src/p_mobj.cpp
File diff suppressed because it is too large
Load diff
|
@ -901,7 +901,8 @@ void FPolyObj::ThrustMobj (AActor *actor, side_t *side)
|
||||||
actor->vely += thrustY;
|
actor->vely += thrustY;
|
||||||
if (crush)
|
if (crush)
|
||||||
{
|
{
|
||||||
if (bHurtOnTouch || !P_CheckMove (actor, actor->x + thrustX, actor->y + thrustY))
|
fixedvec2 pos = actor->Vec2Offset(thrustX, thrustY);
|
||||||
|
if (bHurtOnTouch || !P_CheckMove (actor, pos.x, pos.y))
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
@ -1199,8 +1200,8 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
|
||||||
&& !((mobj->flags & MF_FLOAT) && (ld->flags & ML_BLOCK_FLOATERS))
|
&& !((mobj->flags & MF_FLOAT) && (ld->flags & ML_BLOCK_FLOATERS))
|
||||||
&& (!(ld->flags & ML_3DMIDTEX) ||
|
&& (!(ld->flags & ML_3DMIDTEX) ||
|
||||||
(!P_LineOpening_3dMidtex(mobj, ld, open) &&
|
(!P_LineOpening_3dMidtex(mobj, ld, open) &&
|
||||||
(mobj->z + mobj->height < open.top)
|
(mobj->Top() < open.top)
|
||||||
) || (open.abovemidtex && mobj->z > mobj->floorz))
|
) || (open.abovemidtex && mobj->Z() > mobj->floorz))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// [BL] We can't just continue here since we must
|
// [BL] We can't just continue here since we must
|
||||||
|
@ -1213,7 +1214,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
|
||||||
performBlockingThrust = true;
|
performBlockingThrust = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FBoundingBox box(mobj->x, mobj->y, mobj->radius);
|
FBoundingBox box(mobj->X(), mobj->Y(), mobj->radius);
|
||||||
|
|
||||||
if (box.Right() <= ld->bbox[BOXLEFT]
|
if (box.Right() <= ld->bbox[BOXLEFT]
|
||||||
|| box.Left() >= ld->bbox[BOXRIGHT]
|
|| box.Left() >= ld->bbox[BOXRIGHT]
|
||||||
|
@ -1231,15 +1232,15 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
|
||||||
// Best use the one facing the player and ignore the back side.
|
// Best use the one facing the player and ignore the back side.
|
||||||
if (ld->sidedef[1] != NULL)
|
if (ld->sidedef[1] != NULL)
|
||||||
{
|
{
|
||||||
int side = P_PointOnLineSidePrecise(mobj->x, mobj->y, ld);
|
int side = P_PointOnLineSidePrecise(mobj->X(), mobj->Y(), ld);
|
||||||
if (ld->sidedef[side] != sd)
|
if (ld->sidedef[side] != sd)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// [BL] See if we hit below the floor/ceiling of the poly.
|
// [BL] See if we hit below the floor/ceiling of the poly.
|
||||||
else if(!performBlockingThrust && (
|
else if(!performBlockingThrust && (
|
||||||
mobj->z < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) ||
|
mobj->Z() < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) ||
|
||||||
mobj->z + mobj->height > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj)
|
mobj->Top() > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj)
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
performBlockingThrust = true;
|
performBlockingThrust = true;
|
||||||
|
|
|
@ -175,9 +175,10 @@ void S_NoiseDebug (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
listener.X = FIXED2FLOAT(players[consoleplayer].camera->x);
|
|
||||||
listener.Y = FIXED2FLOAT(players[consoleplayer].camera->z);
|
listener.X = FIXED2FLOAT(players[consoleplayer].camera->SoundX());
|
||||||
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->y);
|
listener.Y = FIXED2FLOAT(players[consoleplayer].camera->SoundZ());
|
||||||
|
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->SoundY());
|
||||||
|
|
||||||
// Display the oldest channel first.
|
// Display the oldest channel first.
|
||||||
for (chan = Channels; chan->NextChan != NULL; chan = chan->NextChan)
|
for (chan = Channels; chan->NextChan != NULL; chan = chan->NextChan)
|
||||||
|
@ -666,9 +667,9 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
|
||||||
|
|
||||||
if (players[consoleplayer].camera != NULL)
|
if (players[consoleplayer].camera != NULL)
|
||||||
{
|
{
|
||||||
x = players[consoleplayer].camera->x;
|
x = players[consoleplayer].camera->SoundX();
|
||||||
y = players[consoleplayer].camera->z;
|
y = players[consoleplayer].camera->SoundZ();
|
||||||
z = players[consoleplayer].camera->y;
|
z = players[consoleplayer].camera->SoundY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -685,9 +686,9 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
|
||||||
// assert(actor != NULL);
|
// assert(actor != NULL);
|
||||||
if (actor != NULL)
|
if (actor != NULL)
|
||||||
{
|
{
|
||||||
x = actor->x;
|
x = actor->SoundX();
|
||||||
y = actor->z;
|
y = actor->SoundZ();
|
||||||
z = actor->y;
|
z = actor->SoundY();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -723,7 +724,7 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
|
||||||
{
|
{
|
||||||
if ((chanflags & CHAN_LISTENERZ) && players[consoleplayer].camera != NULL)
|
if ((chanflags & CHAN_LISTENERZ) && players[consoleplayer].camera != NULL)
|
||||||
{
|
{
|
||||||
y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->z : 0;
|
y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->SoundZ() : 0;
|
||||||
}
|
}
|
||||||
pos->X = FIXED2FLOAT(x);
|
pos->X = FIXED2FLOAT(x);
|
||||||
pos->Y = FIXED2FLOAT(y);
|
pos->Y = FIXED2FLOAT(y);
|
||||||
|
@ -763,8 +764,8 @@ static void CalcSectorSoundOrg(const sector_t *sec, int channum, fixed_t *x, fix
|
||||||
// Are we inside the sector? If yes, the closest point is the one we're on.
|
// Are we inside the sector? If yes, the closest point is the one we're on.
|
||||||
if (P_PointInSector(*x, *y) == sec)
|
if (P_PointInSector(*x, *y) == sec)
|
||||||
{
|
{
|
||||||
*x = players[consoleplayer].camera->x;
|
*x = players[consoleplayer].camera->SoundX();
|
||||||
*y = players[consoleplayer].camera->y;
|
*y = players[consoleplayer].camera->SoundY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1567,9 +1568,9 @@ void S_RelinkSound (AActor *from, AActor *to)
|
||||||
{
|
{
|
||||||
chan->Actor = NULL;
|
chan->Actor = NULL;
|
||||||
chan->SourceType = SOURCE_Unattached;
|
chan->SourceType = SOURCE_Unattached;
|
||||||
chan->Point[0] = FIXED2FLOAT(from->x);
|
chan->Point[0] = FIXED2FLOAT(from->SoundX());
|
||||||
chan->Point[1] = FIXED2FLOAT(from->z);
|
chan->Point[1] = FIXED2FLOAT(from->SoundZ());
|
||||||
chan->Point[2] = FIXED2FLOAT(from->y);
|
chan->Point[2] = FIXED2FLOAT(from->SoundY());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1959,9 +1960,9 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor)
|
||||||
listener.velocity.Z = listenactor->vely * (TICRATE/65536.f);
|
listener.velocity.Z = listenactor->vely * (TICRATE/65536.f);
|
||||||
*/
|
*/
|
||||||
listener.velocity.Zero();
|
listener.velocity.Zero();
|
||||||
listener.position.X = FIXED2FLOAT(listenactor->x);
|
listener.position.X = FIXED2FLOAT(listenactor->SoundX());
|
||||||
listener.position.Y = FIXED2FLOAT(listenactor->z);
|
listener.position.Y = FIXED2FLOAT(listenactor->SoundZ());
|
||||||
listener.position.Z = FIXED2FLOAT(listenactor->y);
|
listener.position.Z = FIXED2FLOAT(listenactor->SoundY());
|
||||||
listener.underwater = listenactor->waterlevel == 3;
|
listener.underwater = listenactor->waterlevel == 3;
|
||||||
assert(zones != NULL);
|
assert(zones != NULL);
|
||||||
listener.Environment = zones[listenactor->Sector->ZoneNumber].Environment;
|
listener.Environment = zones[listenactor->Sector->ZoneNumber].Environment;
|
||||||
|
|
|
@ -4603,7 +4603,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
|
||||||
fixedvec2 vec = self->Vec2To(self->target);
|
fixedvec2 vec = self->Vec2To(self->target);
|
||||||
fixed_t dx = abs (vec.x);
|
fixed_t dx = abs (vec.x);
|
||||||
fixed_t dy = abs (vec.y);
|
fixed_t dy = abs (vec.y);
|
||||||
fixed_t dz;
|
|
||||||
fixed_t dist = dx > dy ? dx : dy;
|
fixed_t dist = dx > dy ? dx : dy;
|
||||||
|
|
||||||
// Some enemies are more precise
|
// Some enemies are more precise
|
||||||
|
|
Loading…
Reference in a new issue