Merge branch 'master' into scripting

Conflicts:
	src/actor.h
	src/p_user.cpp
	src/thingdef/thingdef_expression.cpp
This commit is contained in:
Christoph Oelckers 2016-01-20 15:16:06 +01:00
commit c78344c19d
11 changed files with 303 additions and 324 deletions

View file

@ -814,12 +814,6 @@ public:
return (flags & MF_COUNTKILL) && !(flags & MF_FRIENDLY);
}
bool intersects(AActor *other) const
{
fixed_t blockdist = radius + other->radius;
return ( abs(x - other->x) < blockdist && abs(y - other->y) < blockdist);
}
PalEntry GetBloodColor() const
{
return GetClass()->BloodColor;
@ -857,103 +851,109 @@ public:
return bloodcls;
}
bool intersects(AActor *other) const
{
fixed_t blockdist = radius + other->radius;
return ( abs(X() - other->Y()) < blockdist && abs(Y() - other->Y()) < blockdist);
}
// 'absolute' is reserved for a linked portal implementation which needs
// to distinguish between portal-aware and portal-unaware distance calculation.
fixed_t AproxDistance(AActor *other, bool absolute = false)
{
return P_AproxDistance(x - other->x, y - other->y);
return P_AproxDistance(X() - other->X(), Y() - other->Y());
}
// same with 'ref' here.
fixed_t AproxDistance(fixed_t otherx, fixed_t othery, AActor *ref = NULL)
{
return P_AproxDistance(x - otherx, y - othery);
return P_AproxDistance(X() - otherx, Y() - othery);
}
fixed_t AproxDistance(AActor *other, fixed_t xadd, fixed_t yadd, bool absolute = false)
{
return P_AproxDistance(x - other->x + xadd, y - other->y + yadd);
return P_AproxDistance(X() - other->X() + xadd, Y() - other->Y() + yadd);
}
fixed_t AproxDistance3D(AActor *other, bool absolute = false)
{
return P_AproxDistance(AproxDistance(other), z - other->z);
return P_AproxDistance(AproxDistance(other), Z() - other->Z());
}
// more precise, but slower version, being used in a few places
fixed_t Distance2D(AActor *other, bool absolute = false)
{
return xs_RoundToInt(FVector2(x - other->x, y - other->y).Length());
return xs_RoundToInt(FVector2(X() - other->X(), Y() - other->Y()).Length());
}
// a full 3D version of the above
fixed_t Distance3D(AActor *other, bool absolute = false)
{
return xs_RoundToInt(FVector3(x - other->x, y - other->y, z - other->z).Length());
return xs_RoundToInt(FVector3(X() - other->X(), Y() - other->Y(), Z() - other->Z()).Length());
}
angle_t AngleTo(AActor *other, bool absolute = false) const
{
return R_PointToAngle2(x, y, other->x, other->y);
return R_PointToAngle2(X(), Y(), other->X(), other->Y());
}
angle_t AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const
{
return R_PointToAngle2(x, y, other->x + oxofs, other->y + oyofs);
return R_PointToAngle2(X(), Y(), other->X() + oxofs, other->Y() + oyofs);
}
fixed_t AngleTo(fixed_t otherx, fixed_t othery, AActor *ref = NULL)
{
return R_PointToAngle2(x, y, otherx, othery);
return R_PointToAngle2(X(), Y(), otherx, othery);
}
fixed_t AngleXYTo(fixed_t myx, fixed_t myy, AActor *other, bool absolute = false)
{
return R_PointToAngle2(myx, myy, other->x, other->y);
return R_PointToAngle2(myx, myy, other->X(), other->Y());
}
fixedvec2 Vec2To(AActor *other) const
{
fixedvec2 ret = { other->x - x, other->y - y };
fixedvec2 ret = { other->X() - X(), other->Y() - Y() };
return ret;
}
fixedvec3 Vec3To(AActor *other) const
{
fixedvec3 ret = { other->x - x, other->y - y, other->z - z };
fixedvec3 ret = { other->X() - X(), other->Y() - Y(), other->Z() - Z() };
return ret;
}
fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy, bool absolute = false) const
{
fixedvec2 ret = { x + dx, y + dy };
fixedvec2 ret = { X() + dx, Y() + dy };
return ret;
}
fixedvec2 Vec2Angle(fixed_t length, angle_t angle, bool absolute = false) const
{
fixedvec2 ret = { x + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
y + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
fixedvec2 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
return ret;
}
fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false) const
{
fixedvec3 ret = { x + dx, y + dy, z + dz };
fixedvec3 ret = { X() + dx, Y() + dy, Z() + dz };
return ret;
}
fixedvec3 Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false) const
{
fixedvec3 ret = { x + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
y + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), z + dz };
fixedvec3 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), Z() + dz };
return ret;
}
void Move(fixed_t dx, fixed_t dy, fixed_t dz)
{
SetOrigin(x + dx, y + dy, z + dz, true);
SetOrigin(X() + dx, Y() + dy, Z() + dz, true);
}
void SetOrigin(const fixedvec3 & npos, bool moving)
@ -979,9 +979,10 @@ public:
void CheckSectorTransition(sector_t *oldsec);
// info for drawing
// NOTE: The first member variable *must* be x.
fixed_t x,y,z;
// NOTE: The first member variable *must* be snext.
AActor *snext, **sprev; // links in sector (if needed)
fixedvec3 __pos; // double underscores so that it won't get used by accident. Access to this should be exclusively through the designated access functions.
angle_t angle;
WORD sprite; // used to find patch_t and flip value
BYTE frame; // sprite frame to draw
@ -1210,15 +1211,15 @@ public:
fixed_t X() const
{
return x;
return __pos.x;
}
fixed_t Y() const
{
return y;
return __pos.y;
}
fixed_t Z() const
{
return z;
return __pos.z;
}
fixedvec3 Pos() const
{
@ -1268,39 +1269,39 @@ public:
}
fixed_t Top() const
{
return z + height;
return Z() + height;
}
void SetZ(fixed_t newz, bool moving = true)
{
z = newz;
__pos.z = newz;
}
void AddZ(fixed_t newz, bool moving = true)
{
z += newz;
__pos.z += newz;
}
// These are not for general use as they do not link the actor into the world!
void SetXY(fixed_t xx, fixed_t yy)
{
x = xx;
y = yy;
__pos.x = xx;
__pos.y = yy;
}
void SetXYZ(fixed_t xx, fixed_t yy, fixed_t zz)
{
x = xx;
y = yy;
z = zz;
__pos.x = xx;
__pos.y = yy;
__pos.z = zz;
}
void SetXY(const fixedvec2 &npos)
{
x = npos.x;
y = npos.y;
__pos.x = npos.x;
__pos.y = npos.y;
}
void SetXYZ(const fixedvec3 &npos)
{
x = npos.x;
y = npos.y;
z = npos.z;
__pos.x = npos.x;
__pos.y = npos.y;
__pos.z = npos.z;
}
void SetMovement(fixed_t x, fixed_t y, fixed_t z)
{

View file

@ -3801,8 +3801,8 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
fixed_t dist = trace.Distance;
// position a bit closer for puffs/blood if using compatibility mode.
if (i_compatflags & COMPATF_HITSCAN) dist -= 10 * FRACUNIT;
hitx = t1->x + FixedMul(vx, dist);
hity = t1->y + FixedMul(vy, dist);
hitx = t1->X() + FixedMul(vx, dist);
hity = t1->Y() + FixedMul(vy, dist);
hitz = shootz + FixedMul(vz, dist);
@ -3943,7 +3943,7 @@ AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch,
vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = -finesine[pitch];
shootz = t1->z - t1->floorclip + (t1->height >> 1);
shootz = t1->Z() - t1->floorclip + (t1->height >> 1);
if (t1->player != NULL)
{
shootz += FixedMul(t1->player->mo->AttackZOffset, t1->player->crouchfactor);
@ -3959,7 +3959,7 @@ AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch,
TData.Caller = t1;
TData.hitGhosts = true;
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,
actorMask, wallMask, t1, trace, TRACE_NoSky, CheckForActor, &TData))
{
if (trace.HitType == TRACE_HitActor)
@ -4063,7 +4063,7 @@ void P_TraceBleed(int damage, fixed_t x, fixed_t y, fixed_t z, AActor *actor, an
void P_TraceBleed(int damage, AActor *target, angle_t angle, int pitch)
{
P_TraceBleed(damage, target->x, target->y, target->z + target->height / 2,
P_TraceBleed(damage, target->X(), target->Y(), target->Z() + target->height / 2,
target, angle, pitch);
}
@ -4086,14 +4086,14 @@ void P_TraceBleed(int damage, AActor *target, AActor *missile)
{
double aim;
aim = atan((double)missile->velz / (double)P_AproxDistance(missile->x - target->x, missile->y - target->y));
aim = atan((double)missile->velz / (double)target->AproxDistance(missile));
pitch = -(int)(aim * ANGLE_180 / PI);
}
else
{
pitch = 0;
}
P_TraceBleed(damage, target->x, target->y, target->z + target->height / 2,
P_TraceBleed(damage, target->X(), target->Y(), target->Z() + target->height / 2,
target, missile->AngleTo(target),
pitch);
}
@ -4111,7 +4111,7 @@ void P_TraceBleed(int damage, AActor *target)
fixed_t one = pr_tracebleed() << 24;
fixed_t two = (pr_tracebleed() - 128) << 16;
P_TraceBleed(damage, target->x, target->y, target->z + target->height / 2,
P_TraceBleed(damage, target->X(), target->Y(), target->Z() + target->height / 2,
target, one, two);
}
}
@ -4174,7 +4174,6 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
{
fixed_t vx, vy, vz;
angle_t angle, pitch;
fixed_t x1, y1;
TVector3<double> start, end;
FTraceResults trace;
fixed_t shootz;
@ -4191,10 +4190,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = finesine[pitch];
x1 = source->x;
y1 = source->y;
shootz = source->z - source->floorclip + (source->height >> 1) + offset_z;
shootz = source->Z() - source->floorclip + (source->height >> 1) + offset_z;
if (!(railflags & RAF_CENTERZ))
{
@ -4209,15 +4205,15 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
}
angle = ((source->angle + angleoffset) - ANG90) >> ANGLETOFINESHIFT;
x1 += offset_xy * finecosine[angle];
y1 += offset_xy * finesine[angle];
fixedvec2 xy = source->Vec2Offset(offset_xy * finecosine[angle], offset_xy * finesine[angle]);
RailData rail_data;
rail_data.Caller = source;
rail_data.StopAtOne = !!(railflags & RAF_NOPIERCE);
start.X = FIXED2FLOAT(x1);
start.Y = FIXED2FLOAT(y1);
start.X = FIXED2FLOAT(xy.x);
start.Y = FIXED2FLOAT(xy.y);
start.Z = FIXED2FLOAT(shootz);
int flags;
@ -4228,7 +4224,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? 0 : TRACE_PCross | TRACE_Impact;
rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true;
rail_data.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false;
Trace(x1, y1, shootz, source->Sector, vx, vy, vz,
Trace(xy.x, xy.y, shootz, source->Sector, vx, vy, vz,
distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace,
flags, ProcessRailHit, &rail_data);
@ -4239,7 +4235,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
// used as damage inflictor
AActor *thepuff = NULL;
if (puffclass != NULL) thepuff = Spawn(puffclass, source->x, source->y, source->z, ALLOW_REPLACE);
if (puffclass != NULL) thepuff = Spawn(puffclass, source->Pos(), ALLOW_REPLACE);
for (i = 0; i < rail_data.RailHits.Size(); i++)
{
@ -4253,8 +4249,8 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
AActor *hitactor = rail_data.RailHits[i].HitActor;
fixed_t hitdist = rail_data.RailHits[i].Distance;
x = x1 + FixedMul(hitdist, vx);
y = y1 + FixedMul(hitdist, vy);
x = xy.x + FixedMul(hitdist, vx);
y = xy.y + FixedMul(hitdist, vy);
z = shootz + FixedMul(hitdist, vz);
if ((hitactor->flags & MF_NOBLOOD) ||
@ -4332,7 +4328,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
trace.CrossedWater == NULL &&
trace.Sector->heightsec == NULL)
{
thepuff->SetOrigin(trace.X, trace.Y, trace.Z);
thepuff->SetOrigin(trace.X, trace.Y, trace.Z, false);
P_HitWater(thepuff, trace.Sector);
}
if (trace.Crossed3DWater || trace.CrossedWater)
@ -4370,16 +4366,16 @@ void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camera
vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = finesine[pitch];
sz = t1->z - t1->floorclip + t1->height + (fixed_t)(clamp<double>(chase_height, -1000, 1000) * FRACUNIT);
sz = t1->Z() - t1->floorclip + t1->height + (fixed_t)(clamp<double>(chase_height, -1000, 1000) * FRACUNIT);
if (Trace(t1->x, t1->y, sz, t1->Sector,
if (Trace(t1->X(), t1->Y(), sz, t1->Sector,
vx, vy, vz, distance, 0, 0, NULL, trace) &&
trace.Distance > 10 * FRACUNIT)
{
// Position camera slightly in front of hit thing
fixed_t dist = trace.Distance - 5 * FRACUNIT;
CameraX = t1->x + FixedMul(vx, dist);
CameraY = t1->y + FixedMul(vy, dist);
CameraX = t1->X() + FixedMul(vx, dist);
CameraY = t1->Y() + FixedMul(vy, dist);
CameraZ = sz + FixedMul(vz, dist);
}
else
@ -4446,7 +4442,7 @@ bool P_TalkFacing(AActor *player)
bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline)
{
FPathTraverse it(usething->x, usething->y, endx, endy, PT_ADDLINES | PT_ADDTHINGS);
FPathTraverse it(usething->X(), usething->Y(), endx, endy, PT_ADDLINES | PT_ADDTHINGS);
intercept_t *in;
while ((in = it.Next()))
@ -4495,7 +4491,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline
return true;
}
sec = P_PointOnLineSide(usething->x, usething->y, in->d.line) == 0 ?
sec = P_PointOnLineSide(usething->X(), usething->Y(), in->d.line) == 0 ?
in->d.line->frontsector : in->d.line->backsector;
if (sec != NULL && sec->SecActTarget &&
@ -4514,7 +4510,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline
continue; // not a special line, but keep checking
}
if (P_PointOnLineSide(usething->x, usething->y, in->d.line) == 1)
if (P_PointOnLineSide(usething->X(), usething->Y(), in->d.line) == 1)
{
if (!(in->d.line->activation & SPAC_UseBack))
{
@ -4574,7 +4570,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline
bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy)
{
FPathTraverse it(usething->x, usething->y, endx, endy, PT_ADDLINES);
FPathTraverse it(usething->X(), usething->Y(), endx, endy, PT_ADDLINES);
intercept_t *in;
while ((in = it.Next()))
@ -4589,8 +4585,8 @@ bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy)
P_LineOpening(open, NULL, ld, it.Trace().x + FixedMul(it.Trace().dx, in->frac),
it.Trace().y + FixedMul(it.Trace().dy, in->frac));
if (open.range <= 0 ||
open.bottom > usething->z + usething->MaxStepHeight ||
open.top < usething->z + usething->height) return true;
open.bottom > usething->Z() + usething->MaxStepHeight ||
open.top < usething->Top()) return true;
}
return false;
}
@ -4605,18 +4601,10 @@ bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy)
void P_UseLines(player_t *player)
{
angle_t angle;
fixed_t x1, y1, usedist;
bool foundline;
foundline = false;
angle = player->mo->angle >> ANGLETOFINESHIFT;
usedist = player->mo->UseRange;
bool foundline = false;
// [NS] Now queries the Player's UseRange.
x1 = player->mo->x + FixedMul(usedist, finecosine[angle]);
y1 = player->mo->y + FixedMul(usedist, finesine[angle]);
fixedvec2 end = player->mo->Vec2Angle(player->mo->UseRange, player->mo->angle, true);
// old code:
//
@ -4624,13 +4612,13 @@ void P_UseLines(player_t *player)
//
// This added test makes the "oof" sound work on 2s lines -- killough:
if (!P_UseTraverse(player->mo, x1, y1, foundline))
if (!P_UseTraverse(player->mo, end.x, end.y, foundline))
{ // [RH] Give sector a chance to eat the use
sector_t *sec = player->mo->Sector;
int spac = SECSPAC_Use;
if (foundline) spac |= SECSPAC_UseWall;
if ((!sec->SecActTarget || !sec->SecActTarget->TriggerAction(player->mo, spac)) &&
P_NoWayTraverse(player->mo, x1, y1))
P_NoWayTraverse(player->mo, end.x, end.y))
{
S_Sound(player->mo, CHAN_VOICE, "*usefail", 1, ATTN_IDLE);
}
@ -4651,8 +4639,8 @@ bool P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType)
fixed_t x1, y1, x2, y2, usedist;
angle = PuzzleItemUser->angle >> ANGLETOFINESHIFT;
x1 = PuzzleItemUser->x;
y1 = PuzzleItemUser->y;
x1 = PuzzleItemUser->X();
y1 = PuzzleItemUser->Y();
// [NS] If it's a Player, get their UseRange.
if (PuzzleItemUser->player)
@ -4683,7 +4671,7 @@ bool P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType)
}
continue;
}
if (P_PointOnLineSide(PuzzleItemUser->x, PuzzleItemUser->y, in->d.line) == 1)
if (P_PointOnLineSide(PuzzleItemUser->X(), PuzzleItemUser->Y(), in->d.line) == 1)
{ // Don't use back sides
return false;
}
@ -4750,7 +4738,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
double bombdistancefloat = 1.f / (double)(bombdistance - fulldamagedistance);
double bombdamagefloat = (double)bombdamage;
FBlockThingsIterator it(FBoundingBox(bombspot->x, bombspot->y, bombdistance << FRACBITS));
FBlockThingsIterator it(FBoundingBox(bombspot->X(), bombspot->Y(), bombdistance << FRACBITS));
AActor *thing;
if (flags & RADF_SOURCEISSPOT)
@ -4799,24 +4787,25 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
fixed_t dx, dy;
double boxradius;
dx = abs(thing->x - bombspot->x);
dy = abs(thing->y - bombspot->y);
fixedvec2 vec = bombspot->Vec2To(thing);
dx = abs(vec.x);
dy = abs(vec.y);
boxradius = double(thing->radius);
// The damage pattern is square, not circular.
len = double(dx > dy ? dx : dy);
if (bombspot->z < thing->z || bombspot->z >= thing->z + thing->height)
if (bombspot->Z() < thing->Z() || bombspot->Z() >= thing->Top())
{
double dz;
if (bombspot->z > thing->z)
if (bombspot->Z() > thing->Z())
{
dz = double(bombspot->z - thing->z - thing->height);
dz = double(bombspot->Z() - thing->Top());
}
else
{
dz = double(thing->z - bombspot->z);
dz = double(thing->Z() - bombspot->Z());
}
if (len <= boxradius)
{
@ -4873,7 +4862,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
{
thrust *= selfthrustscale;
}
velz = (double)(thing->z + (thing->height >> 1) - bombspot->z) * thrust;
velz = (double)(thing->Z() + (thing->height >> 1) - bombspot->Z()) * thrust;
if (bombsource != thing)
{
velz *= 0.5f;
@ -4898,8 +4887,9 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
// [RH] Old code just for barrels
fixed_t dx, dy, dist;
dx = abs(thing->x - bombspot->x);
dy = abs(thing->y - bombspot->y);
fixedvec2 vec = bombspot->Vec2To(thing);
dx = abs(vec.x);
dy = abs(vec.y);
dist = dx>dy ? dx : dy;
dist = (dist - thing->radius) >> FRACBITS;
@ -4986,7 +4976,7 @@ bool P_AdjustFloorCeil(AActor *thing, FChangePosition *cpos)
thing->flags2 |= MF2_PASSMOBJ;
}
bool isgood = P_CheckPosition(thing, thing->x, thing->y, tm);
bool isgood = P_CheckPosition(thing, thing->X(), thing->Y(), tm);
thing->floorz = tm.floorz;
thing->ceilingz = tm.ceilingz;
thing->dropoffz = tm.dropoffz; // killough 11/98: remember dropoffs
@ -5017,7 +5007,7 @@ void P_FindAboveIntersectors(AActor *actor)
return;
AActor *thing;
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius));
while ((thing = it.Next()))
{
if (!thing->intersects(actor))
@ -5048,8 +5038,8 @@ void P_FindAboveIntersectors(AActor *actor)
// not what is wanted here.
continue;
}
if (thing->z >= actor->z &&
thing->z <= actor->z + actor->height)
if (thing->Z() >= actor->Z() &&
thing->Z() <= actor->Top())
{ // Thing intersects above the base
intersectors.Push(thing);
}
@ -5071,7 +5061,7 @@ void P_FindBelowIntersectors(AActor *actor)
return;
AActor *thing;
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius));
while ((thing = it.Next()))
{
if (!thing->intersects(actor))
@ -5102,8 +5092,8 @@ void P_FindBelowIntersectors(AActor *actor)
// not what is wanted here.
continue;
}
if (thing->z + thing->height <= actor->z + actor->height &&
thing->z + thing->height > actor->z)
if (thing->Top() <= actor->Top() &&
thing->Top() > actor->Z())
{ // Thing intersects below the base
intersectors.Push(thing);
}
@ -5138,8 +5128,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
{
AActor *mo;
mo = Spawn(bloodcls, thing->x, thing->y,
thing->z + thing->height / 2, ALLOW_REPLACE);
mo = Spawn(bloodcls, thing->PosPlusZ(thing->height / 2), ALLOW_REPLACE);
mo->velx = pr_crunch.Random2() << 12;
mo->vely = pr_crunch.Random2() << 12;
@ -5155,7 +5144,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
an = (M_Random() - 128) << 24;
if (cl_bloodtype >= 1)
{
P_DrawSplash2(32, thing->x, thing->y, thing->z + thing->height / 2, an, 2, bloodcolor);
P_DrawSplash2(32, thing->X(), thing->Y(), thing->Z() + thing->height / 2, an, 2, bloodcolor);
}
}
if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound))
@ -5183,7 +5172,7 @@ int P_PushUp(AActor *thing, FChangePosition *cpos)
unsigned int lastintersect;
int mymass = thing->Mass;
if (thing->z + thing->height > thing->ceilingz)
if (thing->Top() > thing->ceilingz)
{
return 1;
}
@ -5212,13 +5201,13 @@ int P_PushUp(AActor *thing, FChangePosition *cpos)
return 2;
}
fixed_t oldz;
oldz = intersect->z;
oldz = intersect->Z();
P_AdjustFloorCeil(intersect, cpos);
intersect->z = thing->z + thing->height + 1;
intersect->SetZ(thing->Top() + 1);
if (P_PushUp(intersect, cpos))
{ // Move blocked
P_DoCrunch(intersect, cpos);
intersect->z = oldz;
intersect->SetZ(oldz);
return 2;
}
}
@ -5239,7 +5228,7 @@ int P_PushDown(AActor *thing, FChangePosition *cpos)
unsigned int lastintersect;
int mymass = thing->Mass;
if (thing->z <= thing->floorz)
if (thing->Z() <= thing->floorz)
{
return 1;
}
@ -5256,15 +5245,15 @@ int P_PushDown(AActor *thing, FChangePosition *cpos)
// Can't push bridges or things more massive than ourself
return 2;
}
fixed_t oldz = intersect->z;
fixed_t oldz = intersect->Z();
P_AdjustFloorCeil(intersect, cpos);
if (oldz > thing->z - intersect->height)
if (oldz > thing->Z() - intersect->height)
{ // Only push things down, not up.
intersect->z = thing->z - intersect->height;
intersect->SetZ(thing->Z() - intersect->height);
if (P_PushDown(intersect, cpos))
{ // Move blocked
P_DoCrunch(intersect, cpos);
intersect->z = oldz;
intersect->SetZ(oldz);
return 2;
}
}
@ -5289,24 +5278,24 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
if (thing->velz == 0 &&
(!(thing->flags & MF_NOGRAVITY) ||
(thing->z == oldfloorz && !(thing->flags & MF_NOLIFTDROP))))
(thing->Z() == oldfloorz && !(thing->flags & MF_NOLIFTDROP))))
{
fixed_t oldz = thing->z;
fixed_t oldz = thing->Z();
if ((thing->flags & MF_NOGRAVITY) || (thing->flags5 & MF5_MOVEWITHSECTOR) ||
(((cpos->sector->Flags & SECF_FLOORDROP) || cpos->moveamt < 9 * FRACUNIT)
&& thing->z - thing->floorz <= cpos->moveamt))
&& thing->Z() - thing->floorz <= cpos->moveamt))
{
thing->z = thing->floorz;
thing->SetZ(thing->floorz);
P_CheckFakeFloorTriggers(thing, oldz);
}
}
else if ((thing->z != oldfloorz && !(thing->flags & MF_NOLIFTDROP)))
else if ((thing->Z() != oldfloorz && !(thing->flags & MF_NOLIFTDROP)))
{
fixed_t oldz = thing->z;
fixed_t oldz = thing->Z();
if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR))
{
thing->z = thing->z - oldfloorz + thing->floorz;
thing->AddZ(-oldfloorz + thing->floorz);
P_CheckFakeFloorTriggers(thing, oldz);
}
}
@ -5321,14 +5310,14 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
{
fixed_t oldfloorz = thing->floorz;
fixed_t oldz = thing->z;
fixed_t oldz = thing->Z();
P_AdjustFloorCeil(thing, cpos);
if (oldfloorz == thing->floorz) return;
// Move things intersecting the floor up
if (thing->z <= thing->floorz)
if (thing->Z() <= thing->floorz)
{
if (thing->flags4 & MF4_ACTLIKEBRIDGE)
{
@ -5336,14 +5325,14 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
return; // do not move bridge things
}
intersectors.Clear();
thing->z = thing->floorz;
thing->SetZ(thing->floorz);
}
else
{
if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR))
{
intersectors.Clear();
thing->z = thing->z - oldfloorz + thing->floorz;
thing->AddZ(-oldfloorz + thing->floorz);
}
else return;
}
@ -5358,7 +5347,7 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
break;
case 2:
P_DoCrunch(thing, cpos);
thing->z = oldz;
thing->SetZ(oldz);
break;
}
}
@ -5373,10 +5362,10 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos)
{
bool onfloor;
onfloor = thing->z <= thing->floorz;
onfloor = thing->Z() <= thing->floorz;
P_AdjustFloorCeil(thing, cpos);
if (thing->z + thing->height > thing->ceilingz)
if (thing->Top() > thing->ceilingz)
{
if (thing->flags4 & MF4_ACTLIKEBRIDGE)
{
@ -5384,14 +5373,14 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos)
return; // do not move bridge things
}
intersectors.Clear();
fixed_t oldz = thing->z;
fixed_t oldz = thing->Z();
if (thing->ceilingz - thing->height >= thing->floorz)
{
thing->z = thing->ceilingz - thing->height;
thing->SetZ(thing->ceilingz - thing->height);
}
else
{
thing->z = thing->floorz;
thing->SetZ(thing->floorz);
}
switch (P_PushDown(thing, cpos))
{
@ -5399,7 +5388,7 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos)
// intentional fall-through
case 1:
if (onfloor)
thing->z = thing->floorz;
thing->SetZ(thing->floorz);
P_DoCrunch(thing, cpos);
P_CheckFakeFloorTriggers(thing, oldz);
break;
@ -5425,25 +5414,24 @@ void PIT_CeilingRaise(AActor *thing, FChangePosition *cpos)
// For DOOM compatibility, only move things that are inside the floor.
// (or something else?) Things marked as hanging from the ceiling will
// stay where they are.
if (thing->z < thing->floorz &&
thing->z + thing->height >= thing->ceilingz - cpos->moveamt &&
if (thing->Z() < thing->floorz &&
thing->Top() >= thing->ceilingz - cpos->moveamt &&
!(thing->flags & MF_NOLIFTDROP))
{
fixed_t oldz = thing->z;
thing->z = thing->floorz;
if (thing->z + thing->height > thing->ceilingz)
fixed_t oldz = thing->Z();
thing->SetZ(thing->floorz);
if (thing->Top() > thing->ceilingz)
{
thing->z = thing->ceilingz - thing->height;
thing->SetZ(thing->ceilingz - thing->height);
}
P_CheckFakeFloorTriggers(thing, oldz);
}
else if ((thing->flags2 & MF2_PASSMOBJ) && !isgood && thing->z + thing->height < thing->ceilingz)
else if ((thing->flags2 & MF2_PASSMOBJ) && !isgood && thing->Top() < thing->ceilingz)
{
AActor *onmobj;
if (!P_TestMobjZ(thing, true, &onmobj) && onmobj->z <= thing->z)
if (!P_TestMobjZ(thing, true, &onmobj) && onmobj->Z() <= thing->Z())
{
thing->z = MIN(thing->ceilingz - thing->height,
onmobj->z + onmobj->height);
thing->SetZ( MIN(thing->ceilingz - thing->height, onmobj->Top()));
}
}
}
@ -5600,8 +5588,8 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool
{
n->visited = true; // mark thing as processed
n->m_thing->UpdateWaterLevel(n->m_thing->z, false);
P_CheckFakeFloorTriggers(n->m_thing, n->m_thing->z - amt);
n->m_thing->UpdateWaterLevel(n->m_thing->Z(), false);
P_CheckFakeFloorTriggers(n->m_thing, n->m_thing->Z() - amt);
}
}
} while (n); // repeat from scratch until all things left are marked valid
@ -5821,7 +5809,7 @@ void P_CreateSecNodeList(AActor *thing, fixed_t x, fixed_t y)
node = node->m_tnext;
}
FBoundingBox box(thing->x, thing->y, thing->radius);
FBoundingBox box(thing->X(), thing->Y(), thing->radius);
FBlockLinesIterator it(box);
line_t *ld;
@ -5924,13 +5912,13 @@ static void SpawnDeepSplash(AActor *t1, const FTraceResults &trace, AActor *puff
den = TMulScale16(plane->a, vx, plane->b, vy, plane->c, vz);
if (den != 0)
{
num = TMulScale16(plane->a, t1->x, plane->b, t1->y, plane->c, shootz) + plane->d;
num = TMulScale16(plane->a, t1->X(), plane->b, t1->Y(), plane->c, shootz) + plane->d;
hitdist = FixedDiv(-num, den);
if (hitdist >= 0 && hitdist <= trace.Distance)
{
fixed_t hitx = t1->x + FixedMul(vx, hitdist);
fixed_t hity = t1->y + FixedMul(vy, hitdist);
fixed_t hitx = t1->X() + FixedMul(vx, hitdist);
fixed_t hity = t1->Y() + FixedMul(vy, hitdist);
fixed_t hitz = shootz + FixedMul(vz, hitdist);
P_HitWater(puff != NULL ? puff : t1, P_PointInSector(hitx, hity), hitx, hity, hitz);

View file

@ -326,7 +326,7 @@ void AActor::LinkToWorld (bool buggy)
if (!buggy || numgamenodes == 0)
{
sec = P_PointInSector (x, y);
sec = P_PointInSector (X(), Y());
}
else
{
@ -344,7 +344,7 @@ void AActor::LinkToWorld (sector_t *sec)
return;
}
Sector = sec;
subsector = R_PointInSubsector(x, y); // this is from the rendering nodes, not the gameplay nodes!
subsector = R_PointInSubsector(X(), Y()); // this is from the rendering nodes, not the gameplay nodes!
if ( !(flags & MF_NOSECTOR) )
{
@ -371,7 +371,7 @@ void AActor::LinkToWorld (sector_t *sec)
// When a node is deleted, its sector links (the links starting
// at sector_t->touching_thinglist) are broken. When a node is
// added, new sector links are created.
P_CreateSecNodeList (this, x, y);
P_CreateSecNodeList (this, X(), Y());
touching_sectorlist = sector_list; // Attach to thing
sector_list = NULL; // clear for next time
}
@ -380,10 +380,10 @@ void AActor::LinkToWorld (sector_t *sec)
// link into blockmap (inert things don't need to be in the blockmap)
if ( !(flags & MF_NOBLOCKMAP) )
{
int x1 = GetSafeBlockX(x - radius - bmaporgx);
int x2 = GetSafeBlockX(x + radius - bmaporgx);
int y1 = GetSafeBlockY(y - radius - bmaporgy);
int y2 = GetSafeBlockY(y + radius - bmaporgy);
int x1 = GetSafeBlockX(X() - radius - bmaporgx);
int x2 = GetSafeBlockX(X() + radius - bmaporgx);
int y1 = GetSafeBlockY(Y() - radius - bmaporgy);
int y2 = GetSafeBlockY(Y() + radius - bmaporgy);
if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0)
{ // thing is off the map
@ -496,7 +496,7 @@ sector_t *AActor::LinkToWorldForMapThing ()
// that lies directly on a line should always be
// considered as "in front" of the line. The orientation
// of the line should be irrelevant.
node = (node_t *)node->children[R_PointOnSideSlow (x, y, node)];
node = (node_t *)node->children[R_PointOnSideSlow (X(), Y(), node)];
}
while (!((size_t)node & 1));
@ -510,8 +510,8 @@ sector_t *AActor::LinkToWorldForMapThing ()
// one-sided line might go into a subsector behind the line, so
// the line would not be included as one of its subsector's segs.
int blockx = GetSafeBlockX(x - bmaporgx);
int blocky = GetSafeBlockY(y - bmaporgy);
int blockx = GetSafeBlockX(X() - bmaporgx);
int blocky = GetSafeBlockY(Y() - bmaporgy);
if ((unsigned int)blockx < (unsigned int)bmapwidth &&
(unsigned int)blocky < (unsigned int)bmapheight)
@ -536,10 +536,10 @@ sector_t *AActor::LinkToWorldForMapThing ()
}
// Not inside the line's bounding box
if (x + radius <= ldef->bbox[BOXLEFT]
|| x - radius >= ldef->bbox[BOXRIGHT]
|| y + radius <= ldef->bbox[BOXBOTTOM]
|| y - radius >= ldef->bbox[BOXTOP] )
if (X() + radius <= ldef->bbox[BOXLEFT]
|| X() - radius >= ldef->bbox[BOXRIGHT]
|| Y() + radius <= ldef->bbox[BOXBOTTOM]
|| Y() - radius >= ldef->bbox[BOXTOP] )
continue;
// Get the exact distance to the line
@ -548,8 +548,8 @@ sector_t *AActor::LinkToWorldForMapThing ()
P_MakeDivline (ldef, &dll);
dlv.x = x;
dlv.y = y;
dlv.x = X();
dlv.y = Y();
dlv.dx = FixedDiv(dll.dy, linelen);
dlv.dy = -FixedDiv(dll.dx, linelen);
@ -558,7 +558,7 @@ sector_t *AActor::LinkToWorldForMapThing ()
if (distance < radius)
{
DPrintf ("%s at (%d,%d) lies on %s line %td, distance = %f\n",
this->GetClass()->TypeName.GetChars(), x>>FRACBITS, y>>FRACBITS,
this->GetClass()->TypeName.GetChars(), X()>>FRACBITS, Y()>>FRACBITS,
ldef->dx == 0? "vertical" : ldef->dy == 0? "horizontal" : "diagonal",
ldef-lines, FIXED2FLOAT(distance));
angle_t finean = R_PointToAngle2 (0, 0, ldef->dx, ldef->dy);
@ -574,9 +574,8 @@ sector_t *AActor::LinkToWorldForMapThing ()
// Get the distance we have to move the object away from the wall
distance = radius - distance;
x += FixedMul(distance, finecosine[finean]);
y += FixedMul(distance, finesine[finean]);
return P_PointInSector (x, y);
SetXY(X() + FixedMul(distance, finecosine[finean]), Y() + FixedMul(distance, finesine[finean]));
return P_PointInSector (X(), Y());
}
}
}
@ -588,9 +587,8 @@ sector_t *AActor::LinkToWorldForMapThing ()
void AActor::SetOrigin (fixed_t ix, fixed_t iy, fixed_t iz, bool moving)
{
UnlinkFromWorld ();
x = ix;
y = iy;
z = iz;
SetXYZ(ix, iy, iz);
if (moving) SetMovement(ix - X(), iy - Y(), iz - Z());
LinkToWorld ();
floorz = Sector->floorplane.ZatPoint (ix, iy);
ceilingz = Sector->ceilingplane.ZatPoint (ix, iy);
@ -878,8 +876,8 @@ AActor *FBlockThingsIterator::Next(bool centeronly)
fixed_t blocktop = blockbottom + MAPBLOCKSIZE;
// only return actors with the center in this block
if (me->x >= blockleft && me->x < blockright &&
me->y >= blockbottom && me->y < blocktop)
if (me->X() >= blockleft && me->X() < blockright &&
me->Y() >= blockbottom && me->Y() < blocktop)
{
return me;
}
@ -1028,29 +1026,29 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
switch (i)
{
case 0: // Top edge
line.x = thing->x + thing->radius;
line.y = thing->y + thing->radius;
line.x = thing->X() + thing->radius;
line.y = thing->Y() + thing->radius;
line.dx = -thing->radius * 2;
line.dy = 0;
break;
case 1: // Right edge
line.x = thing->x + thing->radius;
line.y = thing->y - thing->radius;
line.x = thing->X() + thing->radius;
line.y = thing->Y() - thing->radius;
line.dx = 0;
line.dy = thing->radius * 2;
break;
case 2: // Bottom edge
line.x = thing->x - thing->radius;
line.y = thing->y - thing->radius;
line.x = thing->X() - thing->radius;
line.y = thing->Y() - thing->radius;
line.dx = thing->radius * 2;
line.dy = 0;
break;
case 3: // Left edge
line.x = thing->x - thing->radius;
line.y = thing->y + thing->radius;
line.x = thing->X() - thing->radius;
line.y = thing->Y() + thing->radius;
line.dx = 0;
line.dy = thing->radius * -2;
break;
@ -1107,19 +1105,19 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
// check a corner to corner crossection for hit
if (tracepositive)
{
x1 = thing->x - thing->radius;
y1 = thing->y + thing->radius;
x1 = thing->X() - thing->radius;
y1 = thing->Y() + thing->radius;
x2 = thing->x + thing->radius;
y2 = thing->y - thing->radius;
x2 = thing->X() + thing->radius;
y2 = thing->Y() - thing->radius;
}
else
{
x1 = thing->x - thing->radius;
y1 = thing->y - thing->radius;
x1 = thing->X() - thing->radius;
y1 = thing->Y() - thing->radius;
x2 = thing->x + thing->radius;
y2 = thing->y + thing->radius;
x2 = thing->X() + thing->radius;
y2 = thing->Y() + thing->radius;
}
s1 = P_PointOnDivlineSide (x1, y1, &trace);
@ -1422,8 +1420,8 @@ AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, in
int count;
AActor *target;
startX = GetSafeBlockX(mo->x-bmaporgx);
startY = GetSafeBlockY(mo->y-bmaporgy);
startX = GetSafeBlockX(mo->X()-bmaporgx);
startY = GetSafeBlockY(mo->Y()-bmaporgy);
validcount++;
if (startX >= 0 && startX < bmapwidth && startY >= 0 && startY < bmapheight)

View file

@ -230,9 +230,9 @@ void AActor::Serialize (FArchive &arc)
sprite = arc.ReadSprite ();
}
arc << x
<< y
<< z
arc << __pos.x
<< __pos.y
<< __pos.z
<< angle
<< frame
<< scaleX

View file

@ -68,11 +68,11 @@ public:
SightCheck(const AActor * t1, const AActor * t2, int flags)
{
lastztop = lastzbottom = sightzstart = t1->z + t1->height - (t1->height>>2);
lastztop = lastzbottom = sightzstart = t1->Z() + t1->height - (t1->height>>2);
lastsector = t1->Sector;
sightthing=t1;
seeingthing=t2;
bottomslope = t2->z - sightzstart;
bottomslope = t2->Z() - sightzstart;
topslope = bottomslope + t2->height;
Flags = flags;
@ -132,7 +132,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
{
int frontflag;
frontflag = P_PointOnLineSidePrecise(sightthing->x, sightthing->y, li);
frontflag = P_PointOnLineSidePrecise(sightthing->X(), sightthing->Y(), li);
//Check 3D FLOORS!
for(int i=1;i<=2;i++)
@ -413,8 +413,8 @@ bool SightCheck::P_SightTraverseIntercepts ()
if((rover->flags & FF_SOLID) == myseethrough || !(rover->flags & FF_EXISTS)) continue;
if ((Flags & SF_IGNOREWATERBOUNDARY) && (rover->flags & FF_SOLID) == 0) continue;
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(seeingthing->x, seeingthing->y);
fixed_t ff_top=rover->top.plane->ZatPoint(seeingthing->x, seeingthing->y);
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(seeingthing);
fixed_t ff_top=rover->top.plane->ZatPoint(seeingthing);
if (lastztop<=ff_bottom && topz>ff_bottom && lastzbottom<=ff_bottom && bottomz>ff_bottom) return false;
if (lastzbottom>=ff_top && bottomz<ff_top && lastztop>=ff_top && topz<ff_top) return false;
@ -458,8 +458,8 @@ bool SightCheck::P_SightPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_
if(!(rover->flags & FF_EXISTS)) continue;
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sightthing->x, sightthing->y);
fixed_t ff_top=rover->top.plane->ZatPoint(sightthing->x, sightthing->y);
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sightthing);
fixed_t ff_top=rover->top.plane->ZatPoint(sightthing);
if (sightzstart < ff_top && sightzstart >= ff_bottom)
{
@ -691,16 +691,16 @@ sightcounts[0]++;
if (!(flags & SF_IGNOREWATERBOUNDARY))
{
if ((s1->GetHeightSec() &&
((t1->z + t1->height <= s1->heightsec->floorplane.ZatPoint (t1->x, t1->y) &&
t2->z >= s1->heightsec->floorplane.ZatPoint (t2->x, t2->y)) ||
(t1->z >= s1->heightsec->ceilingplane.ZatPoint (t1->x, t1->y) &&
t2->z + t1->height <= s1->heightsec->ceilingplane.ZatPoint (t2->x, t2->y))))
((t1->Z() + t1->height <= s1->heightsec->floorplane.ZatPoint(t1) &&
t2->Z() >= s1->heightsec->floorplane.ZatPoint(t2)) ||
(t1->Z() >= s1->heightsec->ceilingplane.ZatPoint(t1) &&
t2->Z() + t1->height <= s1->heightsec->ceilingplane.ZatPoint(t2))))
||
(s2->GetHeightSec() &&
((t2->z + t2->height <= s2->heightsec->floorplane.ZatPoint (t2->x, t2->y) &&
t1->z >= s2->heightsec->floorplane.ZatPoint (t1->x, t1->y)) ||
(t2->z >= s2->heightsec->ceilingplane.ZatPoint (t2->x, t2->y) &&
t1->z + t2->height <= s2->heightsec->ceilingplane.ZatPoint (t1->x, t1->y)))))
((t2->Z() + t2->height <= s2->heightsec->floorplane.ZatPoint(t2) &&
t1->Z() >= s2->heightsec->floorplane.ZatPoint(t1)) ||
(t2->Z() >= s2->heightsec->ceilingplane.ZatPoint(t2) &&
t1->Z() + t2->height <= s2->heightsec->ceilingplane.ZatPoint(t1)))))
{
res = false;
goto done;
@ -713,7 +713,7 @@ sightcounts[0]++;
validcount++;
{
SightCheck s(t1, t2, flags);
res = s.P_SightPathTraverse (t1->x, t1->y, t2->x, t2->y);
res = s.P_SightPathTraverse (t1->X(), t1->Y(), t2->X(), t2->Y());
}
done:

View file

@ -430,7 +430,7 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
{
// Falling, not all the way down yet?
sector = player->mo->Sector;
if (player->mo->z != sector->floorplane.ZatPoint(player->mo)
if (player->mo->Z() != sector->floorplane.ZatPoint(player->mo)
&& !player->mo->waterlevel)
{
return;
@ -507,7 +507,7 @@ static void DoSectorDamage(AActor *actor, sector_t *sec, int amount, FName type,
if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL)
return;
if (!(flags & DAMAGE_IN_AIR) && actor->z != sec->floorplane.ZatPoint(actor) && !actor->waterlevel)
if (!(flags & DAMAGE_IN_AIR) && actor->Z() != sec->floorplane.ZatPoint(actor) && !actor->waterlevel)
return;
if (protectClass != NULL)
@ -553,12 +553,12 @@ void P_SectorDamage(int tag, int amount, FName type, PClassActor *protectClass,
z1 = z2;
z2 = zz;
}
if (actor->z + actor->height > z1)
if (actor->Z() + actor->height > z1)
{
// If DAMAGE_IN_AIR is used, anything not beneath the 3D floor will be
// damaged (so, anything touching it or above it). Other 3D floors between
// the actor and this one will not stop this effect.
if ((flags & DAMAGE_IN_AIR) || actor->z <= z2)
if ((flags & DAMAGE_IN_AIR) || actor->Z() <= z2)
{
// Here we pass the DAMAGE_IN_AIR flag to disable the floor check, since it
// only works with the real sector's floor. We did the appropriate height checks
@ -1058,7 +1058,7 @@ void P_SpawnSkybox(ASkyViewpoint *origin)
if (Sector == NULL)
{
Printf("Sector not initialized for SkyCamCompat\n");
origin->Sector = Sector = P_PointInSector(origin->x, origin->y);
origin->Sector = Sector = P_PointInSector(origin->X(), origin->Y());
}
if (Sector)
{
@ -2152,8 +2152,8 @@ DPusher::DPusher (DPusher::EPusher type, line_t *l, int magnitude, int angle,
if (source) // point source exist?
{
m_Radius = (m_Magnitude) << (FRACBITS+1); // where force goes to zero
m_X = m_Source->x;
m_Y = m_Source->y;
m_X = m_Source->X();
m_Y = m_Source->Y();
}
m_Affectee = affectee;
}
@ -2268,7 +2268,7 @@ void DPusher::Tick ()
{
if (hsec == NULL)
{ // NOT special water sector
if (thing->z > thing->floorz) // above ground
if (thing->Z() > thing->floorz) // above ground
{
xspeed = m_Xmag; // full force
yspeed = m_Ymag;
@ -2282,7 +2282,7 @@ void DPusher::Tick ()
else // special water sector
{
ht = hsec->floorplane.ZatPoint(thing);
if (thing->z > ht) // above ground
if (thing->Z() > ht) // above ground
{
xspeed = m_Xmag; // full force
yspeed = m_Ymag;
@ -2310,7 +2310,7 @@ void DPusher::Tick ()
{ // special water sector
floor = &hsec->floorplane;
}
if (thing->z > floor->ZatPoint(thing))
if (thing->Z() > floor->ZatPoint(thing))
{ // above ground
xspeed = yspeed = 0; // no force
}

View file

@ -138,8 +138,9 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
P_MakeDivline (line, &dll);
dlu.x = user->x;
dlu.y = user->y;
fixedvec3 pos = user->PosRelative(line);
dlu.x = pos.x;
dlu.y = pos.y;
dlu.dx = finecosine[user->angle >> ANGLETOFINESHIFT];
dlu.dy = finesine[user->angle >> ANGLETOFINESHIFT];
inter = P_InterceptVector(&dll, &dlu);
@ -167,11 +168,11 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
onesided:
fixed_t sectorc = front->ceilingplane.ZatPoint(checkx, checky);
fixed_t sectorf = front->floorplane.ZatPoint(checkx, checky);
return (user->z + user->height >= sectorf && user->z <= sectorc);
return (user->Top() >= sectorf && user->Z() <= sectorc);
}
// Now get the information from the line.
P_LineOpening(open, NULL, line, checkx, checky, user->x, user->y);
P_LineOpening(open, NULL, line, checkx, checky, pos.x, pos.y);
if (open.range <= 0)
goto onesided;
@ -187,8 +188,8 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_UPPERTEXTURE)) continue;
if (user->z > rover->top.plane->ZatPoint(checkx, checky) ||
user->z + user->height < rover->bottom.plane->ZatPoint(checkx, checky))
if (user->Z() > rover->top.plane->ZatPoint(checkx, checky) ||
user->Top() < rover->bottom.plane->ZatPoint(checkx, checky))
continue;
// This 3D floor depicts a switch texture in front of the player's eyes
@ -196,7 +197,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
}
}
return (user->z + user->height > open.top);
return (user->Top() > open.top);
}
else if ((TexMan.FindSwitch(side->GetTexture(side_t::bottom))) != NULL)
{
@ -209,8 +210,8 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_LOWERTEXTURE)) continue;
if (user->z > rover->top.plane->ZatPoint(checkx, checky) ||
user->z + user->height < rover->bottom.plane->ZatPoint(checkx, checky))
if (user->Z() > rover->top.plane->ZatPoint(checkx, checky) ||
user->Top() < rover->bottom.plane->ZatPoint(checkx, checky))
continue;
// This 3D floor depicts a switch texture in front of the player's eyes
@ -218,7 +219,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
}
}
return (user->z < open.bottom);
return (user->Z() < open.bottom);
}
else if ((flags & ML_3DMIDTEX) || (TexMan.FindSwitch(side->GetTexture(side_t::mid))) != NULL)
{
@ -226,12 +227,12 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
// to keep compatibility with Eternity's implementation.
if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot))
return false;
return user->z < checktop && user->z + user->height > checkbot;
return user->Z() < checktop && user->Top() > checkbot;
}
else
{
// no switch found. Check whether the player can touch either top or bottom texture
return (user->z + user->height > open.top) || (user->z < open.bottom);
return (user->Top() > open.top) || (user->Z() < open.bottom);
}
}

View file

@ -100,9 +100,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
{
bool predicting = (thing->player && (thing->player->cheats & CF_PREDICTING));
fixed_t oldx;
fixed_t oldy;
fixed_t oldz;
fixedvec3 old;
fixed_t aboveFloor;
player_t *player;
angle_t an;
@ -111,10 +109,8 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
fixed_t floorheight, ceilingheight;
fixed_t missilespeed;
oldx = thing->x;
oldy = thing->y;
oldz = thing->z;
aboveFloor = thing->z - thing->floorz;
old = thing->Pos();
aboveFloor = thing->Z() - thing->floorz;
destsect = P_PointInSector (x, y);
// killough 5/12/98: exclude voodoo dolls:
player = thing->player;
@ -170,7 +166,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
}
if (player)
{
player->viewz = thing->z + player->viewheight;
player->viewz = thing->Z() + player->viewheight;
if (resetpitch)
{
player->mo->pitch = 0;
@ -187,7 +183,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
// Spawn teleport fog at source and destination
if (sourceFog && !predicting)
{
P_SpawnTeleportFog(thing, oldx, oldy, oldz, true, true); //Passes the actor through which then pulls the TeleFog metadata types based on properties.
P_SpawnTeleportFog(thing, old, true, true); //Passes the actor through which then pulls the TeleFog metadata types based on properties.
}
if (useFog)
{
@ -195,7 +191,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
{
fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT;
an = angle >> ANGLETOFINESHIFT;
P_SpawnTeleportFog(thing, x + 20 * finecosine[an], y + 20 * finesine[an], thing->z + fogDelta, false, true);
P_SpawnTeleportFog(thing, x + 20 * finecosine[an], y + 20 * finesine[an], thing->Z() + fogDelta, false, true);
}
if (thing->player)
@ -371,11 +367,11 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool
velx = thing->velx;
vely = thing->vely;
z = searcher->z;
z = searcher->Z();
}
else if (searcher->IsKindOf (PClass::FindClass(NAME_TeleportDest2)))
{
z = searcher->z;
z = searcher->Z();
}
else
{
@ -385,7 +381,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool
{
badangle = 1 << ANGLETOFINESHIFT;
}
if (P_Teleport (thing, searcher->x, searcher->y, z, searcher->angle + badangle, fog, sourceFog, keepOrientation, haltVelocity, keepHeight))
if (P_Teleport (thing, searcher->X(), searcher->Y(), z, searcher->angle + badangle, fog, sourceFog, keepOrientation, haltVelocity, keepHeight))
{
// [RH] Lee Killough's changes for silent teleporters from BOOM
if (!fog && line && keepOrientation)
@ -446,8 +442,8 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
}
else
{
SQWORD num = (SQWORD)(thing->x-line->v1->x)*line->dx +
(SQWORD)(thing->y-line->v1->y)*line->dy;
SQWORD num = (SQWORD)(thing->X()-line->v1->x)*line->dx +
(SQWORD)(thing->Y()-line->v1->y)*line->dy;
if (num <= 0)
{
pos = 0;
@ -460,8 +456,8 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
{
pos = (SDWORD)(num / (den>>30));
}
nposx = thing->x - line->v1->x - MulScale30 (line->dx, pos);
nposy = thing->y - line->v1->y - MulScale30 (line->dy, pos);
nposx = thing->X() - line->v1->x - MulScale30 (line->dx, pos);
nposy = thing->Y() - line->v1->y - MulScale30 (line->dy, pos);
}
}
@ -501,7 +497,7 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
bool stepdown = l->frontsector->floorplane.ZatPoint(x, y) < l->backsector->floorplane.ZatPoint(x, y);
// Height of thing above ground
fixed_t z = thing->z - thing->floorz;
fixed_t z = thing->Z() - thing->floorz;
// Side to exit the linedef on positionally.
//
@ -614,16 +610,16 @@ bool EV_TeleportOther (int other_tid, int dest_tid, bool fog)
static bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool floorz, bool fog)
{
int an = (dest->angle - source->angle) >> ANGLETOFINESHIFT;
fixed_t offX = victim->x - source->x;
fixed_t offY = victim->y - source->y;
fixed_t offX = victim->X() - source->X();
fixed_t offY = victim->Y() - source->Y();
angle_t offAngle = victim->angle - source->angle;
fixed_t newX = DMulScale16 (offX, finecosine[an], -offY, finesine[an]);
fixed_t newY = DMulScale16 (offX, finesine[an], offY, finecosine[an]);
bool res =
P_Teleport (victim, dest->x + newX,
dest->y + newY,
floorz ? ONFLOORZ : dest->z + victim->z - source->z,
P_Teleport (victim, dest->X() + newX,
dest->Y() + newY,
floorz ? ONFLOORZ : dest->Z() + victim->Z() - source->Z(),
0, fog, fog, !fog);
// P_Teleport only changes angle if fog is true
victim->angle = dest->angle + offAngle;
@ -691,8 +687,8 @@ bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_t
if (moveSource && didSomething)
{
didSomething |=
P_Teleport (sourceOrigin, destOrigin->x, destOrigin->y,
floorz ? ONFLOORZ : destOrigin->z, 0, false, false, true);
P_Teleport (sourceOrigin, destOrigin->X(), destOrigin->Y(),
floorz ? ONFLOORZ : destOrigin->Z(), 0, false, false, true);
sourceOrigin->angle = destOrigin->angle;
}

View file

@ -691,9 +691,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
caller = temp;
}
fixed_t oldx = caller->X();
fixed_t oldy = caller->Y();
fixed_t oldz = caller->z;
fixedvec3 old = caller->Pos();
zofs += FixedMul(reference->height, heightoffset);
@ -725,18 +723,18 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
// now the caller's floorz should be appropriate for the assigned xy-position
// assigning position again with.
// extra unlink, link and environment calculation
caller->SetOrigin(
reference->x + xofs + FixedMul(rad, finecosine[fineangle]),
reference->y + yofs + FixedMul(rad, finesine[fineangle]),
reference->z);
caller->z = caller->floorz + zofs;
caller->SetOrigin(reference->Vec3Offset(
xofs + FixedMul(rad, finecosine[fineangle]),
yofs + FixedMul(rad, finesine[fineangle]),
0), true);
caller->SetZ(caller->floorz + zofs);
}
else
{
caller->SetOrigin(
reference->x + xofs + FixedMul(rad, finecosine[fineangle]),
reference->y + yofs + FixedMul(rad, finesine[fineangle]),
reference->z + zofs);
caller->SetOrigin(reference->Vec3Offset(
xofs + FixedMul(rad, finecosine[fineangle]),
yofs + FixedMul(rad, finesine[fineangle]),
zofs), true);
}
}
else // [MC] The idea behind "absolute" is meant to be "absolute". Override everything, just like A_SpawnItemEx's.
@ -744,7 +742,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
if (flags & WARPF_TOFLOOR)
{
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs);
caller->z = caller->floorz + zofs;
caller->SetZ(caller->floorz + zofs);
}
else
{
@ -756,7 +754,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
{
if (flags & WARPF_TESTONLY)
{
caller->SetOrigin(oldx, oldy, oldz);
caller->SetOrigin(old, true);
}
else
{
@ -783,29 +781,29 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
if (flags & WARPF_WARPINTERPOLATION)
{
caller->PrevX += caller->x - oldx;
caller->PrevY += caller->y - oldy;
caller->PrevZ += caller->z - oldz;
caller->PrevX += caller->X() - old.x;
caller->PrevY += caller->Y() - old.y;
caller->PrevZ += caller->Z() - old.z;
}
else if (flags & WARPF_COPYINTERPOLATION)
{
caller->PrevX = caller->x + reference->PrevX - reference->x;
caller->PrevY = caller->y + reference->PrevY - reference->y;
caller->PrevZ = caller->z + reference->PrevZ - reference->z;
caller->PrevX = caller->X() + reference->PrevX - reference->X();
caller->PrevY = caller->Y() + reference->PrevY - reference->Y();
caller->PrevZ = caller->Z() + reference->PrevZ - reference->Z();
}
else if (!(flags & WARPF_INTERPOLATE))
{
caller->PrevX = caller->x;
caller->PrevY = caller->y;
caller->PrevZ = caller->z;
caller->PrevX = caller->X();
caller->PrevY = caller->Y();
caller->PrevZ = caller->Z();
}
if ((flags & WARPF_BOB) && (reference->flags2 & MF2_FLOATBOB))
{
caller->z += reference->GetBobOffset();
caller->AddZ(reference->GetBobOffset());
}
}
return true;
}
caller->SetOrigin(oldx, oldy, oldz);
caller->SetOrigin(old, true);
return false;
}

View file

@ -524,12 +524,12 @@ cont:
hity = StartY + FixedMul (Vy, dist);
hitz = StartZ + FixedMul (Vz, dist);
if (hitz > in->d.thing->z + in->d.thing->height)
if (hitz > in->d.thing->Top())
{ // trace enters above actor
if (Vz >= 0) continue; // Going up: can't hit
// Does it hit the top of the actor?
dist = FixedDiv(in->d.thing->z + in->d.thing->height - StartZ, Vz);
dist = FixedDiv(in->d.thing->Top() - StartZ, Vz);
if (dist > MaxDist) continue;
in->frac = FixedDiv(dist, MaxDist);
@ -539,15 +539,15 @@ cont:
hitz = StartZ + FixedMul (Vz, dist);
// calculated coordinate is outside the actor's bounding box
if (abs(hitx - in->d.thing->x) > in->d.thing->radius ||
abs(hity - in->d.thing->y) > in->d.thing->radius) continue;
if (abs(hitx - in->d.thing->X()) > in->d.thing->radius ||
abs(hity - in->d.thing->Y()) > in->d.thing->radius) continue;
}
else if (hitz < in->d.thing->z)
else if (hitz < in->d.thing->Z())
{ // trace enters below actor
if (Vz <= 0) continue; // Going down: can't hit
// Does it hit the bottom of the actor?
dist = FixedDiv(in->d.thing->z - StartZ, Vz);
dist = FixedDiv(in->d.thing->Z() - StartZ, Vz);
if (dist > MaxDist) continue;
in->frac = FixedDiv(dist, MaxDist);
@ -556,8 +556,8 @@ cont:
hitz = StartZ + FixedMul (Vz, dist);
// calculated coordinate is outside the actor's bounding box
if (abs(hitx - in->d.thing->x) > in->d.thing->radius ||
abs(hity - in->d.thing->y) > in->d.thing->radius) continue;
if (abs(hitx - in->d.thing->X()) > in->d.thing->radius ||
abs(hity - in->d.thing->Y()) > in->d.thing->radius) continue;
}
// check for extrafloors first

View file

@ -754,10 +754,10 @@ void APlayerPawn::PostBeginPlay()
// Voodoo dolls: restore original floorz/ceilingz logic
if (player == NULL || player->mo != this)
{
dropoffz = floorz = Sector->floorplane.ZatPoint(x, y);
ceilingz = Sector->ceilingplane.ZatPoint(x, y);
dropoffz = floorz = Sector->floorplane.ZatPoint(this);
ceilingz = Sector->ceilingplane.ZatPoint(this);
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS);
z = floorz;
SetZ(floorz);
}
else
{
@ -1636,7 +1636,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullPop)
}
self->flags &= ~MF_SOLID;
mo = (APlayerPawn *)Spawn (spawntype, self->x, self->y, self->z + 48*FRACUNIT, NO_REPLACE);
mo = (APlayerPawn *)Spawn (spawntype, self->PosPlusZ(48*FRACUNIT), NO_REPLACE);
//mo->target = self;
mo->velx = pr_skullpop.Random2() << 9;
mo->vely = pr_skullpop.Random2() << 9;
@ -1849,7 +1849,7 @@ void P_CalcHeight (player_t *player)
if (player->cheats & CF_NOVELOCITY)
{
player->viewz = player->mo->z + defaultviewheight;
player->viewz = player->mo->Z() + defaultviewheight;
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
player->viewz = player->mo->ceilingz-4*FRACUNIT;
@ -1905,9 +1905,9 @@ void P_CalcHeight (player_t *player)
{
bob = 0;
}
player->viewz = player->mo->z + player->viewheight + bob;
player->viewz = player->mo->Z() + player->viewheight + bob;
if (player->mo->floorclip && player->playerstate != PST_DEAD
&& player->mo->z <= player->mo->floorz)
&& player->mo->Z() <= player->mo->floorz)
{
player->viewz -= player->mo->floorclip;
}
@ -1950,7 +1950,7 @@ void P_MovePlayer (player_t *player)
mo->angle += cmd->ucmd.yaw << 16;
}
player->onground = (mo->z <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
player->onground = (mo->Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
// killough 10/98:
//
@ -2007,7 +2007,7 @@ void P_MovePlayer (player_t *player)
{
fprintf (debugfile, "move player for pl %d%c: (%d,%d,%d) (%d,%d) %d %d w%d [", int(player-players),
player->cheats&CF_PREDICTING?'p':' ',
player->mo->x, player->mo->y, player->mo->z,forwardmove, sidemove, movefactor, friction, player->mo->waterlevel);
player->mo->X(), player->mo->Y(), player->mo->Z(),forwardmove, sidemove, movefactor, friction, player->mo->waterlevel);
msecnode_t *n = player->mo->touching_sectorlist;
while (n != NULL)
{
@ -2139,7 +2139,7 @@ void P_DeathThink (player_t *player)
P_MovePsprites (player);
player->onground = (player->mo->z <= player->mo->floorz);
player->onground = (player->mo->Z() <= player->mo->floorz);
if (player->mo->IsKindOf (RUNTIME_CLASS(APlayerChunk)))
{ // Flying bloody skull or flying ice chunk
player->viewheight = 6 * FRACUNIT;
@ -2252,7 +2252,7 @@ void P_CrouchMove(player_t * player, int direction)
// check whether the move is ok
player->mo->height = FixedMul(defaultheight, player->crouchfactor);
if (!P_TryMove(player->mo, player->mo->x, player->mo->y, false, NULL))
if (!P_TryMove(player->mo, player->mo->X(), player->mo->Y(), false, NULL))
{
player->mo->height = savedheight;
if (direction > 0)
@ -2269,7 +2269,7 @@ void P_CrouchMove(player_t * player, int direction)
player->crouchviewdelta = player->viewheight - player->mo->ViewHeight;
// Check for eyes going above/below fake floor due to crouching motion.
P_CheckFakeFloorTriggers(player->mo, player->mo->z + oldheight, true);
P_CheckFakeFloorTriggers(player->mo, player->mo->Z() + oldheight, true);
}
//----------------------------------------------------------------------------
@ -2290,7 +2290,7 @@ void P_PlayerThink (player_t *player)
if (debugfile && !(player->cheats & CF_PREDICTING))
{
fprintf (debugfile, "tic %d for pl %d: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
gametic, (int)(player-players), player->mo->x, player->mo->y, player->mo->z,
gametic, (int)(player-players), player->mo->X(), player->mo->Y(), player->mo->Z(),
player->mo->angle>>ANGLETOFINESHIFT, player->cmd.ucmd.buttons,
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,
player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove);
@ -2416,7 +2416,7 @@ void P_PlayerThink (player_t *player)
player->crouching = 0;
}
if (crouchdir == 1 && player->crouchfactor < FRACUNIT &&
player->mo->z + player->mo->height < player->mo->ceilingz)
player->mo->Top() < player->mo->ceilingz)
{
P_CrouchMove(player, 1);
}
@ -2629,8 +2629,7 @@ void P_PlayerThink (player_t *player)
P_PlayerOnSpecial3DFloor (player);
P_PlayerInSpecialSector (player);
if (player->mo->z <= player->mo->Sector->floorplane.ZatPoint(
player->mo->x, player->mo->y) ||
if (player->mo->Z() <= player->mo->Sector->floorplane.ZatPoint(player->mo) ||
player->mo->waterlevel)
{
// Player must be touching the floor
@ -2784,7 +2783,7 @@ void P_PredictPlayer (player_t *player)
PredictionPlayerBackup = *player;
APlayerPawn *act = player->mo;
memcpy(PredictionActorBackup, &act->x, sizeof(APlayerPawn) - ((BYTE *)&act->x - (BYTE *)act));
memcpy(PredictionActorBackup, &act->snext, sizeof(APlayerPawn) - ((BYTE *)&act->snext - (BYTE *)act));
act->flags &= ~MF_PICKUP;
act->flags2 &= ~MF2_PUSHWALL;
@ -2856,16 +2855,16 @@ void P_PredictPlayer (player_t *player)
{
// Z is not compared as lifts will alter this with no apparent change
// Make lerping less picky by only testing whole units
DoLerp = ((PredictionLast.x >> 16) != (player->mo->x >> 16) ||
(PredictionLast.y >> 16) != (player->mo->y >> 16));
DoLerp = ((PredictionLast.x >> 16) != (player->mo->X() >> 16) ||
(PredictionLast.y >> 16) != (player->mo->Y() >> 16));
// Aditional Debug information
if (developer && DoLerp)
{
DPrintf("Lerp! Ltic (%d) && Ptic (%d) | Lx (%d) && Px (%d) | Ly (%d) && Py (%d)\n",
PredictionLast.gametic, i,
(PredictionLast.x >> 16), (player->mo->x >> 16),
(PredictionLast.y >> 16), (player->mo->y >> 16));
(PredictionLast.x >> 16), (player->mo->X() >> 16),
(PredictionLast.y >> 16), (player->mo->Y() >> 16));
}
}
}
@ -2883,9 +2882,9 @@ void P_PredictPlayer (player_t *player)
}
PredictionLast.gametic = maxtic - 1;
PredictionLast.x = player->mo->x;
PredictionLast.y = player->mo->y;
PredictionLast.z = player->mo->z;
PredictionLast.x = player->mo->X();
PredictionLast.y = player->mo->Y();
PredictionLast.z = player->mo->Z();
if (PredictionLerptics > 0)
{
@ -2893,9 +2892,7 @@ void P_PredictPlayer (player_t *player)
P_LerpCalculate(PredictionLerpFrom, PredictionLast, PredictionLerpResult, (float)PredictionLerptics * cl_predict_lerpscale))
{
PredictionLerptics++;
player->mo->x = PredictionLerpResult.x;
player->mo->y = PredictionLerpResult.y;
player->mo->z = PredictionLerpResult.z;
player->mo->SetXYZ(PredictionLerpResult.x, PredictionLerpResult.y, PredictionLerpResult.z);
}
else
{
@ -2927,7 +2924,7 @@ void P_UnPredictPlayer ()
player->camera = savedcamera;
act->UnlinkFromWorld();
memcpy(&act->x, PredictionActorBackup, sizeof(APlayerPawn) - ((BYTE *)&act->x - (BYTE *)act));
memcpy(&act->snext, PredictionActorBackup, sizeof(APlayerPawn) - ((BYTE *)&act->snext - (BYTE *)act));
// The blockmap ordering needs to remain unchanged, too.
// Restore sector links and refrences.
@ -3201,7 +3198,7 @@ void player_t::Serialize (FArchive &arc)
}
else
{
onground = (mo->z <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (cheats & CF_NOCLIP2);
onground = (mo->Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (cheats & CF_NOCLIP2);
}
if (SaveVersion < 4514 && IsBot)