mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +00:00
- refactoring complete. The source compiles again with the renamed position variable.
This commit is contained in:
parent
13e25faea7
commit
68c0f929dc
7 changed files with 128 additions and 136 deletions
87
src/actor.h
87
src/actor.h
|
@ -844,12 +844,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 (PalEntry)GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
|
@ -884,103 +878,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)
|
||||
|
@ -1006,9 +1006,10 @@ public:
|
|||
void CheckSectorTransition(sector_t *oldsec);
|
||||
|
||||
// info for drawing
|
||||
// NOTE: The first member variable *must* be x.
|
||||
// NOTE: The first member variable *must* be snext.
|
||||
AActor *snext, **sprev; // links in sector (if needed)
|
||||
fixed_t x,y,z;
|
||||
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
|
||||
|
@ -1237,15 +1238,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
|
||||
{
|
||||
|
@ -1295,39 +1296,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)
|
||||
{
|
||||
|
|
|
@ -156,9 +156,9 @@ void AActor::Serialize (FArchive &arc)
|
|||
sprite = arc.ReadSprite ();
|
||||
}
|
||||
|
||||
arc << x
|
||||
<< y
|
||||
<< z
|
||||
arc << __pos.x
|
||||
<< __pos.y
|
||||
<< __pos.z
|
||||
<< angle
|
||||
<< frame
|
||||
<< scaleX
|
||||
|
|
|
@ -101,9 +101,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;
|
||||
|
@ -112,10 +110,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;
|
||||
|
@ -171,7 +167,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;
|
||||
|
@ -188,7 +184,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)
|
||||
{
|
||||
|
@ -196,7 +192,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)
|
||||
|
@ -372,11 +368,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
|
||||
{
|
||||
|
@ -386,7 +382,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)
|
||||
|
@ -447,8 +443,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;
|
||||
|
@ -461,8 +457,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -502,7 +498,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.
|
||||
//
|
||||
|
@ -615,16 +611,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;
|
||||
|
@ -692,8 +688,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -671,10 +671,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
|
||||
{
|
||||
|
@ -1553,7 +1553,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;
|
||||
|
@ -1762,7 +1762,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;
|
||||
|
@ -1818,9 +1818,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;
|
||||
}
|
||||
|
@ -1863,7 +1863,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:
|
||||
//
|
||||
|
@ -1920,7 +1920,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)
|
||||
{
|
||||
|
@ -2052,7 +2052,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;
|
||||
|
@ -2165,7 +2165,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)
|
||||
|
@ -2182,7 +2182,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);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -2203,7 +2203,7 @@ void P_PlayerThink (player_t *player)
|
|||
if (debugfile && !(player->cheats & CF_PREDICTING))
|
||||
{
|
||||
fprintf (debugfile, "tic %d for pl %td: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
|
||||
gametic, player-players, player->mo->x, player->mo->y, player->mo->z,
|
||||
gametic, 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);
|
||||
|
@ -2329,7 +2329,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);
|
||||
}
|
||||
|
@ -2542,8 +2542,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
|
||||
|
@ -2697,7 +2696,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;
|
||||
|
@ -2769,16 +2768,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2796,9 +2795,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)
|
||||
{
|
||||
|
@ -2806,9 +2805,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
|
||||
{
|
||||
|
@ -2840,7 +2837,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.
|
||||
|
@ -3114,7 +3111,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)
|
||||
|
|
|
@ -69,9 +69,9 @@ DEFINE_MEMBER_VARIABLE(special2, AActor)
|
|||
DEFINE_MEMBER_VARIABLE(tid, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(TIDtoHate, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(waterlevel, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(x, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(y, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(z, AActor)
|
||||
DEFINE_MEMBER_VARIABLE_ALIAS(x, __pos.x, AActor)
|
||||
DEFINE_MEMBER_VARIABLE_ALIAS(y, __pos.y, AActor)
|
||||
DEFINE_MEMBER_VARIABLE_ALIAS(z, __pos.z, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(velx, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(vely, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(velz, AActor)
|
||||
|
|
Loading…
Reference in a new issue