Conflicts:
	src/r_data/r_interpolate.cpp
This commit is contained in:
Christoph Oelckers 2016-01-21 12:09:12 +01:00
commit 8f7be01dd4
75 changed files with 1696 additions and 1449 deletions

View file

@ -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.
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
@ -1237,21 +1238,57 @@ 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
{
fixedvec3 ret = { X(), Y(), Z() };
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 ret;
ret.x = PrevX + FixedMul (ticFrac, X() - PrevX);
ret.y = PrevY + FixedMul (ticFrac, Y() - PrevY);
ret.z = PrevZ + FixedMul (ticFrac, Z() - PrevZ);
return ret;
}
fixedvec3 PosPlusZ(fixed_t zadd) const
{
fixedvec3 ret = { X(), Y(), Z() + zadd };
@ -1259,28 +1296,43 @@ 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)
{
__pos.x = npos.x;
__pos.y = npos.y;
}
void SetXYZ(const fixedvec3 &npos)
{
__pos.x = npos.x;
__pos.y = npos.y;
__pos.z = npos.z;
}
void SetMovement(fixed_t x, fixed_t y, fixed_t z)
{
// not yet implemented
}
@ -1402,6 +1454,10 @@ inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
return ret;
}
inline fixedvec3 PosRelative(const fixedvec3 &pos, line_t *line, sector_t *refsec = NULL)
{
return pos;
}
void PrintMiscActorInfo(AActor * query);

View file

@ -203,6 +203,11 @@ private: \
#define IMPLEMENT_ABSTRACT_CLASS(cls) \
_IMP_PCLASS(cls,NULL,NULL)
#define IMPLEMENT_ABSTRACT_POINTY_CLASS(cls) \
_IMP_PCLASS(cls,cls::PointerOffsets,NULL) \
const size_t cls::PointerOffsets[] = {
enum EObjectFlags
{
// GC flags

View file

@ -335,6 +335,7 @@ static void MarkRoot()
SectorMarker->SecNum = 0;
}
Mark(SectorMarker);
Mark(interpolator.Head);
// Mark bot stuff.
Mark(bglobal.firstthing);
Mark(bglobal.body1);

View file

@ -1930,9 +1930,6 @@ void G_DoLoadGame ()
}
G_ReadSnapshots (png);
STAT_Read(png);
FRandom::StaticReadRNGState (png);
P_ReadACSDefereds (png);
// load a base level
savegamerestore = true; // Use the player actors in the savegame
@ -1942,6 +1939,9 @@ void G_DoLoadGame ()
delete[] map;
savegamerestore = false;
STAT_Read(png);
FRandom::StaticReadRNGState(png);
P_ReadACSDefereds(png);
P_ReadACSVars(png);
NextSkill = -1;

View file

@ -1294,9 +1294,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
}
angle = self->angle;
fixedvec3 pos = self->Vec3Offset(
(pr_fp2.Random2() << 9),
(pr_fp2.Random2() << 9),
fixed_t xo = (pr_fp2.Random2() << 9);
fixed_t yo = (pr_fp2.Random2() << 9);
fixedvec3 pos = self->Vec3Offset(xo, yo,
26*FRACUNIT + finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] - self->floorclip);
slope = finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10);

View file

@ -23,10 +23,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
{
AActor *mo;
fixedvec3 pos = self->Vec3Offset(
(pr_dripblood.Random2 () << 11),
(pr_dripblood.Random2 () << 11), 0);
mo = Spawn ("Blood", pos, ALLOW_REPLACE);
fixed_t xo = (pr_dripblood.Random2() << 11);
fixed_t yo = (pr_dripblood.Random2() << 11);
mo = Spawn ("Blood", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE);
mo->velx = pr_dripblood.Random2 () << 10;
mo->vely = pr_dripblood.Random2 () << 10;
mo->gravity = FRACUNIT/8;

View file

@ -193,11 +193,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur)
self->SetState (self->FindState ("Blur"));
return;
}
fixedvec3 pos = self->Vec3Offset(
(pr_pain.Random2()<<12),
(pr_pain.Random2()<<12),
(pr_pain.Random2()<<11));
mo = Spawn ("BishopPainBlur", pos, ALLOW_REPLACE);
fixed_t xo = (pr_pain.Random2() << 12);
fixed_t yo = (pr_pain.Random2() << 12);
fixed_t zo = (pr_pain.Random2() << 11);
mo = Spawn ("BishopPainBlur", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->angle = self->angle;

View file

@ -252,12 +252,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFX2)
delay = 16+(pr_dragonfx2()>>3);
for (i = 1+(pr_dragonfx2()&3); i; i--)
{
fixedvec3 pos = self->Vec3Offset(
((pr_dragonfx2()-128)<<14),
((pr_dragonfx2()-128)<<14),
((pr_dragonfx2()-128)<<12));
fixed_t xo = ((pr_dragonfx2() - 128) << 14);
fixed_t yo = ((pr_dragonfx2() - 128) << 14);
fixed_t zo = ((pr_dragonfx2() - 128) << 12);
mo = Spawn ("DragonExplosion", pos, ALLOW_REPLACE);
mo = Spawn ("DragonExplosion", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->tics = delay+(pr_dragonfx2()&3)*i*2;

View file

@ -112,11 +112,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FSwordFlames)
for (i = 1+(pr_fswordflame()&3); i; i--)
{
fixedvec3 pos = self->Vec3Offset(
((pr_fswordflame()-128)<<12),
((pr_fswordflame()-128)<<12),
((pr_fswordflame()-128)<<11));
Spawn ("FSwordFlame", pos, ALLOW_REPLACE);
fixed_t xo = ((pr_fswordflame() - 128) << 12);
fixed_t yo = ((pr_fswordflame() - 128) << 12);
fixed_t zo = ((pr_fswordflame() - 128) << 11);
Spawn ("FSwordFlame", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
}
}

View file

@ -54,11 +54,10 @@ void A_FiredSpawnRock (AActor *actor)
break;
}
fixedvec3 pos = actor->Vec3Offset(
((pr_firedemonrock() - 128) << 12),
((pr_firedemonrock() - 128) << 12),
( pr_firedemonrock() << 11));
mo = Spawn (rtype, pos, ALLOW_REPLACE);
fixed_t xo = ((pr_firedemonrock() - 128) << 12);
fixed_t yo = ((pr_firedemonrock() - 128) << 12);
fixed_t zo = (pr_firedemonrock() << 11);
mo = Spawn (rtype, actor->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->target = actor;

View file

@ -197,11 +197,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn)
for (i = (pr_leaf()&3)+1; i; i--)
{
fixed_t xo = (pr_leaf.Random2() << 14);
fixed_t yo = (pr_leaf.Random2() << 14);
fixed_t zo = (pr_leaf() << 14);
mo = Spawn (pr_leaf()&1 ? PClass::FindClass ("Leaf1") : PClass::FindClass ("Leaf2"),
self->Vec3Offset(
(pr_leaf.Random2()<<14),
(pr_leaf.Random2()<<14),
(pr_leaf()<<14)), ALLOW_REPLACE);
self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
P_ThrustMobj (mo, self->angle, (pr_leaf()<<9)+3*FRACUNIT);
@ -278,10 +279,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode)
for (i = 0; i < 10; i++)
{
mo = Spawn ("ZArmorChunk", self->Vec3Offset(
((pr_soaexplode()-128)<<12),
((pr_soaexplode()-128)<<12),
(pr_soaexplode()*self->height/256)), ALLOW_REPLACE);
fixed_t xo = ((pr_soaexplode() - 128) << 12);
fixed_t yo = ((pr_soaexplode() - 128) << 12);
fixed_t zo = (pr_soaexplode()*self->height / 256);
mo = Spawn ("ZArmorChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + i);

View file

@ -227,12 +227,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
else
{
deltaZ = -10*FRACUNIT;
}
mo = Spawn(lightning,
self->Vec3Offset(
((pr_zap() - 128)*self->radius / 256),
((pr_zap() - 128)*self->radius / 256),
deltaZ), ALLOW_REPLACE);
}
fixed_t xo = ((pr_zap() - 128)*self->radius / 256);
fixed_t yo = ((pr_zap() - 128)*self->radius / 256);
mo = Spawn(lightning, self->Vec3Offset(xo, yo, deltaZ), ALLOW_REPLACE);
if (mo)
{
mo->lastenemy = self;

View file

@ -147,12 +147,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX3)
while (numdropped-- > 0)
{
fixedvec3 pos = self->Vec3Offset(
(pr_wraithfx3()-128)<<11,
(pr_wraithfx3()-128)<<11,
(pr_wraithfx3()<<10));
fixed_t xo = (pr_wraithfx3() - 128) << 11;
fixed_t yo = (pr_wraithfx3() - 128) << 11;
fixed_t zo = pr_wraithfx3() << 10;
mo = Spawn ("WraithFX3", pos, ALLOW_REPLACE);
mo = Spawn ("WraithFX3", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->floorz = self->floorz;
@ -199,12 +198,11 @@ void A_WraithFX4 (AActor *self)
if (spawn4)
{
fixedvec3 pos = self->Vec3Offset(
(pr_wraithfx4()-128)<<12,
(pr_wraithfx4()-128)<<12,
(pr_wraithfx4()<<10));
fixed_t xo = (pr_wraithfx4() - 128) << 12;
fixed_t yo = (pr_wraithfx4() - 128) << 12;
fixed_t zo = (pr_wraithfx4() << 10);
mo = Spawn ("WraithFX4", pos, ALLOW_REPLACE);
mo = Spawn ("WraithFX4", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->floorz = self->floorz;
@ -214,12 +212,11 @@ void A_WraithFX4 (AActor *self)
}
if (spawn5)
{
fixedvec3 pos = self->Vec3Offset(
(pr_wraithfx4()-128)<<12,
(pr_wraithfx4()-128)<<12,
(pr_wraithfx4()<<10));
fixed_t xo = (pr_wraithfx4() - 128) << 11;
fixed_t yo = (pr_wraithfx4() - 128) << 11;
fixed_t zo = (pr_wraithfx4()<<10);
mo = Spawn ("WraithFX5", pos, ALLOW_REPLACE);
mo = Spawn ("WraithFX5", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->floorz = self->floorz;

View file

@ -367,7 +367,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk3)
DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
{
AActor *mo;
fixed_t x, y;
self->SetZ(self->floorz);
fixedvec2 pos = self->Vec2Offset(

View file

@ -262,14 +262,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
i = (pr_freeze.Random2()) % (numChunks/4);
for (i = MAX (24, numChunks + i); i >= 0; i--)
{
mo = Spawn("IceChunk",
self->x + (((pr_freeze()-128)*self->radius)>>7),
self->y + (((pr_freeze()-128)*self->radius)>>7),
self->z + (pr_freeze()*self->height/255), ALLOW_REPLACE);
fixed_t xo = (((pr_freeze() - 128)*self->radius) >> 7);
fixed_t yo = (((pr_freeze() - 128)*self->radius) >> 7);
fixed_t zo = (pr_freeze()*self->height / 255);
mo = Spawn("IceChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + (pr_freeze()%3));
mo->velz = FixedDiv(mo->z - self->z, self->height)<<2;
mo->velz = FixedDiv(mo->Z() - self->Z(), self->height)<<2;
mo->velx = pr_freeze.Random2 () << (FRACBITS-7);
mo->vely = pr_freeze.Random2 () << (FRACBITS-7);
CALL_ACTION(A_IceSetTics, mo); // set a random tic wait
@ -279,11 +279,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
}
if (self->player)
{ // attach the player's view to a chunk of ice
AActor *head = Spawn("IceChunkHead", self->x, self->y,
self->z + self->player->mo->ViewHeight, ALLOW_REPLACE);
AActor *head = Spawn("IceChunkHead", self->PosPlusZ(self->player->mo->ViewHeight), ALLOW_REPLACE);
if (head != NULL)
{
head->velz = FixedDiv(head->z - self->z, self->height)<<2;
head->velz = FixedDiv(head->Z() - self->Z(), self->height)<<2;
head->velx = pr_freeze.Random2 () << (FRACBITS-7);
head->vely = pr_freeze.Random2 () << (FRACBITS-7);
head->health = self->health;

View file

@ -965,7 +965,7 @@ void APowerFlight::InitEffect ()
Super::InitEffect();
Owner->flags2 |= MF2_FLY;
Owner->flags |= MF_NOGRAVITY;
if (Owner->z <= Owner->floorz)
if (Owner->Z() <= Owner->floorz)
{
Owner->velz = 4*FRACUNIT; // thrust the player in the air a bit
}
@ -1012,7 +1012,7 @@ void APowerFlight::EndEffect ()
if (!(Owner->flags7 & MF7_FLYCHEAT))
{
if (Owner->z != Owner->floorz)
if (Owner->Z() != Owner->floorz)
{
Owner->player->centering = true;
}
@ -1250,7 +1250,7 @@ void APowerSpeed::DoEffect ()
if (P_AproxDistance (Owner->velx, Owner->vely) <= 12*FRACUNIT)
return;
AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->x, Owner->y, Owner->z, NO_REPLACE);
AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->Pos(), NO_REPLACE);
if (speedMo)
{
speedMo->angle = Owner->angle;

View file

@ -100,19 +100,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
// Set default values
// Every five tics, Hexen moved the ball 3/256th of a revolution.
int rotationspeed = ANGLE_45/32*3/5;
int rotationradius = ORBIT_RADIUS;
int rotationradius = ORBIT_RADIUS * FRACUNIT;
// If the bridge is custom, set non-default values if any.
// Set angular speed; 1--128: counterclockwise rotation ~=1--180°; 129--255: clockwise rotation ~= 180--1°
if (self->target->args[3] > 128) rotationspeed = ANGLE_45/32 * (self->target->args[3]-256) / TICRATE;
else if (self->target->args[3] > 0) rotationspeed = ANGLE_45/32 * (self->target->args[3]) / TICRATE;
// Set rotation radius
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / (100 * FRACUNIT));
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100);
self->angle += rotationspeed;
self->x = self->target->x + rotationradius * finecosine[self->angle >> ANGLETOFINESHIFT];
self->y = self->target->y + rotationradius * finesine[self->angle >> ANGLETOFINESHIFT];
self->z = self->target->z;
self->SetOrigin(self->target->Vec3Angle(rotationradius, self->angle, 0), true);
self->floorz = self->target->floorz;
self->ceilingz = self->target->ceilingz;
}
@ -120,16 +120,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
{
angle_t startangle;
AActor *ball;
fixed_t cx, cy, cz;
ACTION_PARAM_START(1);
ACTION_PARAM_CLASS(balltype, 0);
if (balltype == NULL) balltype = PClass::FindClass("BridgeBall");
cx = self->x;
cy = self->y;
cz = self->z;
startangle = pr_orbit() << 24;
// Spawn triad into world -- may be more than a triad now.
@ -137,7 +133,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
for (int i = 0; i < ballcount; i++)
{
ball = Spawn(balltype, cx, cy, cz, ALLOW_REPLACE);
ball = Spawn(balltype, self->Pos(), ALLOW_REPLACE);
ball->angle = startangle + (ANGLE_45/32) * (256/ballcount) * i;
ball->target = self;
CALL_ACTION(A_BridgeOrbit, ball);

View file

@ -176,11 +176,10 @@ void AAimingCamera::Tick ()
}
if (MaxPitchChange)
{ // Aim camera's pitch; use floats for precision
float dx = FIXED2FLOAT(x - tracer->x);
float dy = FIXED2FLOAT(y - tracer->y);
float dz = FIXED2FLOAT(z - tracer->z - tracer->height/2);
float dist = (float)sqrt (dx*dx + dy*dy);
float ang = dist != 0.f ? (float)atan2 (dz, dist) : 0;
TVector2<double> vect = tracer->Vec2To(this);
double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2);
double dist = vect.Length();
double ang = dist != 0.f ? atan2 (dz, dist) : 0;
int desiredpitch = (angle_t)(ang * 2147483648.f / PI);
if (abs (desiredpitch - pitch) < MaxPitchChange)
{

View file

@ -31,22 +31,18 @@ IMPLEMENT_CLASS(AGlassShard)
void P_SpawnDirt (AActor *actor, fixed_t radius)
{
fixed_t x,y,z;
const PClass *dtype = NULL;
AActor *mo;
angle_t angle;
angle = pr_dirt()<<5; // <<24 >>19
x = actor->x + FixedMul(radius,finecosine[angle]);
y = actor->y + FixedMul(radius,finesine[angle]);
z = actor->z + (pr_dirt()<<9) + FRACUNIT;
fixed_t zo = (pr_dirt() << 9) + FRACUNIT;
fixedvec3 pos = actor->Vec3Angle(radius, pr_dirt() << 24, zo);
char fmt[8];
mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6);
dtype = PClass::FindClass(fmt);
if (dtype)
{
mo = Spawn (dtype, x, y, z, ALLOW_REPLACE);
mo = Spawn (dtype, pos, ALLOW_REPLACE);
if (mo)
{
mo->velz = pr_dirt()<<10;

View file

@ -91,7 +91,7 @@ DBaseDecal::DBaseDecal (int statnum, fixed_t z)
DBaseDecal::DBaseDecal (const AActor *basis)
: DThinker(STAT_DECAL),
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->z), ScaleX(basis->scaleX), ScaleY(basis->scaleY),
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->Z()), ScaleX(basis->scaleX), ScaleY(basis->scaleY),
Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle)
{
@ -817,22 +817,22 @@ void ADecal::BeginPlay ()
{
if (!tpl->PicNum.Exists())
{
Printf("Decal actor at (%d,%d) does not have a valid texture\n", x>>FRACBITS, y>>FRACBITS);
Printf("Decal actor at (%d,%d) does not have a valid texture\n", X()>>FRACBITS, Y()>>FRACBITS);
}
else
{
// Look for a wall within 64 units behind the actor. If none can be
// found, then no decal is created, and this actor is destroyed
// without effectively doing anything.
if (NULL == ShootDecal(tpl, this, Sector, x, y, z, angle + ANGLE_180, 64*FRACUNIT, true))
if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), Z(), angle + ANGLE_180, 64*FRACUNIT, true))
{
DPrintf ("Could not find a wall to stick decal to at (%d,%d)\n", x>>FRACBITS, y>>FRACBITS);
DPrintf ("Could not find a wall to stick decal to at (%d,%d)\n", X()>>FRACBITS, Y()>>FRACBITS);
}
}
}
else
{
DPrintf ("Decal actor at (%d,%d) does not have a good template\n", x>>FRACBITS, y>>FRACBITS);
DPrintf ("Decal actor at (%d,%d) does not have a good template\n", X()>>FRACBITS, Y()>>FRACBITS);
}
// This actor doesn't need to stick around anymore.
Destroy();

View file

@ -25,10 +25,10 @@ void AFastProjectile::Tick ()
fixed_t zfrac;
int changexy;
PrevX = x;
PrevY = y;
PrevZ = z;
fixed_t oldz = z;
PrevX = X();
PrevY = Y();
PrevZ = Z();
fixed_t oldz = Z();
PrevAngle = angle;
if (!(flags5 & MF5_NOTIMEFREEZE))
@ -57,7 +57,7 @@ void AFastProjectile::Tick ()
}
// Handle movement
if (velx || vely || (z != floorz) || velz)
if (velx || vely || (Z() != floorz) || velz)
{
xfrac = velx >> shift;
yfrac = vely >> shift;
@ -73,14 +73,14 @@ void AFastProjectile::Tick ()
tm.LastRipped = NULL; // [RH] Do rip damage each step, like Hexen
}
if (!P_TryMove (this, x + xfrac,y + yfrac, true, NULL, tm))
if (!P_TryMove (this, X() + xfrac,Y() + yfrac, true, NULL, tm))
{ // Blocked move
if (!(flags3 & MF3_SKYEXPLODE))
{
if (tm.ceilingline &&
tm.ceilingline->backsector &&
tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
z >= tm.ceilingline->backsector->ceilingplane.ZatPoint (x, y))
Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint (this))
{
// Hack to prevent missiles exploding against the sky.
// Does not handle sky floors.
@ -99,10 +99,10 @@ void AFastProjectile::Tick ()
return;
}
}
z += zfrac;
AddZ(zfrac);
UpdateWaterLevel (oldz);
oldz = z;
if (z <= floorz)
oldz = Z();
if (Z() <= floorz)
{ // Hit the floor
if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
@ -113,12 +113,12 @@ void AFastProjectile::Tick ()
return;
}
z = floorz;
SetZ(floorz);
P_HitFloor (this);
P_ExplodeMissile (this, NULL, NULL);
return;
}
if (z + height > ceilingz)
if (Top() > ceilingz)
{ // Hit the ceiling
if (ceilingpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
@ -127,7 +127,7 @@ void AFastProjectile::Tick ()
return;
}
z = ceilingz - height;
SetZ(ceilingz - height);
P_ExplodeMissile (this, NULL, NULL);
return;
}
@ -160,7 +160,7 @@ void AFastProjectile::Effect()
FName name = (ENamedName) this->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None);
if (name != NAME_None)
{
fixed_t hitz = z-8*FRACUNIT;
fixed_t hitz = Z()-8*FRACUNIT;
if (hitz < floorz)
{
@ -172,7 +172,7 @@ void AFastProjectile::Effect()
const PClass *trail = PClass::FindClass(name);
if (trail != NULL)
{
AActor *act = Spawn (trail, x, y, hitz, ALLOW_REPLACE);
AActor *act = Spawn (trail, X(), Y(), hitz, ALLOW_REPLACE);
if (act != NULL)
{
act->angle = this->angle;

View file

@ -77,7 +77,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i
return false;
}
morphed = static_cast<APlayerPawn *>(Spawn (spawntype, actor->x, actor->y, actor->z, NO_REPLACE));
morphed = static_cast<APlayerPawn *>(Spawn (spawntype, actor->Pos(), NO_REPLACE));
EndAllPowerupEffects(actor->Inventory);
DObject::StaticPointerSubstitution (actor, morphed);
if ((actor->tid != 0) && (style & MORPH_NEWTIDBEHAVIOUR))
@ -105,7 +105,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i
morphed->flags |= actor->flags & (MF_SHADOW|MF_NOGRAVITY);
morphed->flags2 |= actor->flags2 & MF2_FLY;
morphed->flags3 |= actor->flags3 & MF3_GHOST;
AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->x, actor->y, actor->z + TELEFOGHEIGHT, ALLOW_REPLACE);
AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE);
actor->player = NULL;
actor->flags &= ~(MF_SOLID|MF_SHOOTABLE);
actor->flags |= MF_UNMORPHED;
@ -192,7 +192,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
}
mo = barrier_cast<APlayerPawn *>(pmo->tracer);
mo->SetOrigin (pmo->x, pmo->y, pmo->z);
mo->SetOrigin (pmo->Pos(), false);
mo->flags |= MF_SOLID;
pmo->flags &= ~MF_SOLID;
if (!force && !P_TestMobjLocation (mo))
@ -310,7 +310,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
AActor *eflash = NULL;
if (exit_flash != NULL)
{
eflash = Spawn(exit_flash, pmo->x + 20*finecosine[angle], pmo->y + 20*finesine[angle], pmo->z + TELEFOGHEIGHT, ALLOW_REPLACE);
eflash = Spawn(exit_flash, pmo->Vec3Offset(20*finecosine[angle], 20*finesine[angle], TELEFOGHEIGHT), ALLOW_REPLACE);
if (eflash) eflash->target = mo;
}
mo->SetupWeaponSlots(); // Use original class's weapon slots.
@ -381,7 +381,7 @@ bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int s
return false;
}
morphed = static_cast<AMorphedMonster *>(Spawn (spawntype, actor->x, actor->y, actor->z, NO_REPLACE));
morphed = static_cast<AMorphedMonster *>(Spawn (spawntype, actor->Pos(), NO_REPLACE));
DObject::StaticPointerSubstitution (actor, morphed);
morphed->tid = actor->tid;
morphed->angle = actor->angle;
@ -410,7 +410,7 @@ bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int s
actor->flags &= ~(MF_SOLID|MF_SHOOTABLE);
actor->flags |= MF_UNMORPHED;
actor->renderflags |= RF_INVISIBLE;
AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->x, actor->y, actor->z + TELEFOGHEIGHT, ALLOW_REPLACE);
AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE);
if (eflash)
eflash->target = morphed;
return true;
@ -436,7 +436,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
return false;
}
actor = beast->UnmorphedMe;
actor->SetOrigin (beast->x, beast->y, beast->z);
actor->SetOrigin (beast->Pos(), false);
actor->flags |= MF_SOLID;
beast->flags &= ~MF_SOLID;
ActorFlags6 beastflags6 = beast->flags6;
@ -472,7 +472,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
DObject::StaticPointerSubstitution (beast, actor);
const PClass *exit_flash = beast->MorphExitFlash;
beast->Destroy ();
AActor *eflash = Spawn(exit_flash, beast->x, beast->y, beast->z + TELEFOGHEIGHT, ALLOW_REPLACE);
AActor *eflash = Spawn(exit_flash, beast->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE);
if (eflash)
eflash->target = actor;
return true;

View file

@ -282,7 +282,7 @@ void APathFollower::Activate (AActor *activator)
if (CurrNode != NULL)
{
NewNode ();
SetOrigin (CurrNode->x, CurrNode->y, CurrNode->z);
SetOrigin (CurrNode->Pos(), false);
Time = 0.f;
HoldTime = 0;
bJustStepped = true;
@ -302,9 +302,7 @@ void APathFollower::Tick ()
if (CurrNode->args[2])
{
HoldTime = level.time + CurrNode->args[2] * TICRATE / 8;
x = CurrNode->x;
y = CurrNode->y;
z = CurrNode->z;
SetXYZ(CurrNode->X(), CurrNode->Y(), CurrNode->Z());
}
}
@ -362,31 +360,33 @@ bool APathFollower::Interpolate ()
if ((args[2] & 8) && Time > 0.f)
{
dx = x;
dy = y;
dz = z;
dx = X();
dy = Y();
dz = Z();
}
if (CurrNode->Next==NULL) return false;
UnlinkFromWorld ();
fixed_t x, y, z;
if (args[2] & 1)
{ // linear
x = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->x), FIXED2FLOAT(CurrNode->Next->x)));
y = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->y), FIXED2FLOAT(CurrNode->Next->y)));
z = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->z), FIXED2FLOAT(CurrNode->Next->z)));
x = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->X()), FIXED2FLOAT(CurrNode->Next->X())));
y = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->Y()), FIXED2FLOAT(CurrNode->Next->Y())));
z = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->Z()), FIXED2FLOAT(CurrNode->Next->Z())));
}
else
{ // spline
if (CurrNode->Next->Next==NULL) return false;
x = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->x), FIXED2FLOAT(CurrNode->x),
FIXED2FLOAT(CurrNode->Next->x), FIXED2FLOAT(CurrNode->Next->Next->x)));
y = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->y), FIXED2FLOAT(CurrNode->y),
FIXED2FLOAT(CurrNode->Next->y), FIXED2FLOAT(CurrNode->Next->Next->y)));
z = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->z), FIXED2FLOAT(CurrNode->z),
FIXED2FLOAT(CurrNode->Next->z), FIXED2FLOAT(CurrNode->Next->Next->z)));
x = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->X()), FIXED2FLOAT(CurrNode->X()),
FIXED2FLOAT(CurrNode->Next->X()), FIXED2FLOAT(CurrNode->Next->Next->X())));
y = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->Y()), FIXED2FLOAT(CurrNode->Y()),
FIXED2FLOAT(CurrNode->Next->Y()), FIXED2FLOAT(CurrNode->Next->Next->Y())));
z = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->Z()), FIXED2FLOAT(CurrNode->Z()),
FIXED2FLOAT(CurrNode->Next->Z()), FIXED2FLOAT(CurrNode->Next->Next->Z())));
}
SetXYZ(x, y, z);
LinkToWorld ();
if (args[2] & 6)
@ -395,9 +395,9 @@ bool APathFollower::Interpolate ()
{
if (args[2] & 1)
{ // linear
dx = CurrNode->Next->x - CurrNode->x;
dy = CurrNode->Next->y - CurrNode->y;
dz = CurrNode->Next->z - CurrNode->z;
dx = CurrNode->Next->X() - CurrNode->X();
dy = CurrNode->Next->Y() - CurrNode->Y();
dz = CurrNode->Next->Z() - CurrNode->Z();
}
else if (Time > 0.f)
{ // spline
@ -422,6 +422,7 @@ bool APathFollower::Interpolate ()
x -= dx;
y -= dy;
z -= dz;
SetXYZ(x, y, z);
}
if (args[2] & 2)
{ // adjust yaw
@ -548,11 +549,11 @@ bool AActorMover::Interpolate ()
if (Super::Interpolate ())
{
fixed_t savedz = tracer->z;
tracer->z = z;
if (!P_TryMove (tracer, x, y, true))
fixed_t savedz = tracer->Z();
tracer->SetZ(Z());
if (!P_TryMove (tracer, X(), Y(), true))
{
tracer->z = savedz;
tracer->SetZ(savedz);
return false;
}
@ -589,9 +590,9 @@ void AActorMover::Activate (AActor *activator)
// Don't let the renderer interpolate between the actor's
// old position and its new position.
Interpolate ();
tracer->PrevX = tracer->x;
tracer->PrevY = tracer->y;
tracer->PrevZ = tracer->z;
tracer->PrevX = tracer->X();
tracer->PrevY = tracer->Y();
tracer->PrevZ = tracer->Z();
tracer->PrevAngle = tracer->angle;
}
@ -667,15 +668,15 @@ bool AMovingCamera::Interpolate ()
if (Super::Interpolate ())
{
angle = R_PointToAngle2 (x, y, tracer->x, tracer->y);
angle = AngleTo(tracer, true);
if (args[2] & 4)
{ // Also aim camera's pitch; use floats for precision
float dx = FIXED2FLOAT(x - tracer->x);
float dy = FIXED2FLOAT(y - tracer->y);
float dz = FIXED2FLOAT(z - tracer->z - tracer->height/2);
float dist = (float)sqrt (dx*dx + dy*dy);
float ang = dist != 0.f ? (float)atan2 (dz, dist) : 0;
double dx = FIXED2DBL(X() - tracer->X());
double dy = FIXED2DBL(Y() - tracer->Y());
double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2);
double dist = sqrt (dx*dx + dy*dy);
double ang = dist != 0.f ? atan2 (dz, dist) : 0;
pitch = (angle_t)(ang * 2147483648.f / PI);
}

View file

@ -331,7 +331,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialDoomThing)
{
self->SetState (self->SpawnState);
S_Sound (self, CHAN_VOICE, "misc/spawn", 1, ATTN_IDLE);
Spawn ("ItemFog", self->x, self->y, self->z, ALLOW_REPLACE);
Spawn ("ItemFog", self->Pos(), ALLOW_REPLACE);
}
}
@ -351,19 +351,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
_y = self->SpawnPoint[1];
self->UnlinkFromWorld();
self->x = _x;
self->y = _y;
self->SetXY(_x, _y);
self->LinkToWorld(true);
sec = self->Sector;
self->z =
self->dropoffz =
self->floorz = sec->floorplane.ZatPoint(_x, _y);
self->ceilingz = sec->ceilingplane.ZatPoint(_x, _y);
self->SetZ(self->floorz);
P_FindFloorCeiling(self, FFCF_ONLYSPAWNPOS);
if (self->flags & MF_SPAWNCEILING)
{
self->z = self->ceilingz - self->height - self->SpawnPoint[2];
self->SetZ(self->ceilingz - self->height - self->SpawnPoint[2]);
}
else if (self->flags2 & MF2_SPAWNFLOAT)
{
@ -371,33 +370,33 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
if (space > 48*FRACUNIT)
{
space -= 40*FRACUNIT;
self->z = ((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT;
self->SetZ(((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT);
}
else
{
self->z = self->floorz;
self->SetZ(self->floorz);
}
}
else
{
self->z = self->SpawnPoint[2] + self->floorz;
self->SetZ(self->SpawnPoint[2] + self->floorz);
}
// Redo floor/ceiling check, in case of 3D floors
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
if (self->z < self->floorz)
if (self->Z() < self->floorz)
{ // Do not reappear under the floor, even if that's where we were for the
// initial spawn.
self->z = self->floorz;
self->SetZ(self->floorz);
}
if ((self->flags & MF_SOLID) && (self->z + self->height > self->ceilingz))
if ((self->flags & MF_SOLID) && (self->Top() > self->ceilingz))
{ // Do the same for the ceiling.
self->z = self->ceilingz - self->height;
self->SetZ(self->ceilingz - self->height);
}
// Do not interpolate from the position the actor was at when it was
// picked up, in case that is different from where it is now.
self->PrevX = self->x;
self->PrevY = self->y;
self->PrevZ = self->z;
self->PrevX = self->X();
self->PrevY = self->Y();
self->PrevZ = self->Z();
}
int AInventory::StaticLastMessageTic;
@ -728,8 +727,7 @@ AInventory *AInventory::CreateTossable ()
flags &= ~(MF_SPECIAL|MF_SOLID);
return this;
}
copy = static_cast<AInventory *>(Spawn (GetClass(), Owner->x,
Owner->y, Owner->z, NO_REPLACE));
copy = static_cast<AInventory *>(Spawn (GetClass(), Owner->Pos(), NO_REPLACE));
if (copy != NULL)
{
copy->MaxAmount = MaxAmount;
@ -994,7 +992,7 @@ void AInventory::Touch (AActor *toucher)
// This is the only situation when a pickup flash should ever play.
if (PickupFlash != NULL && !ShouldStay())
{
Spawn(PickupFlash, x, y, z, ALLOW_REPLACE);
Spawn(PickupFlash, Pos(), ALLOW_REPLACE);
}
if (!(ItemFlags & IF_QUIET))
@ -1290,8 +1288,8 @@ bool AInventory::DoRespawn ()
if (state != NULL) spot = state->GetRandomSpot(SpawnPointClass);
if (spot != NULL)
{
SetOrigin (spot->x, spot->y, spot->z);
z = floorz;
SetOrigin (spot->Pos(), false);
SetZ(floorz);
}
}
return true;

View file

@ -131,7 +131,7 @@ void DEarthquake::Tick ()
dist = m_Spot->AproxDistance (victim, true);
// Check if in damage radius
if (dist < m_DamageRadius && victim->z <= victim->floorz)
if (dist < m_DamageRadius && victim->Z() <= victim->floorz)
{
if (pr_quake() < 50)
{

View file

@ -91,7 +91,7 @@ class ARandomSpawner : public AActor
// So now we can spawn the dropped item.
if (di == NULL || bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions
{
Spawn("Unknown", x, y, z, NO_REPLACE); // Show that there's a problem.
Spawn("Unknown", Pos(), NO_REPLACE); // Show that there's a problem.
Destroy();
return;
}
@ -144,9 +144,9 @@ class ARandomSpawner : public AActor
if (this->flags & MF_MISSILE && target && target->target) // Attempting to spawn a missile.
{
if ((tracer == NULL) && (flags2 & MF2_SEEKERMISSILE)) tracer = target->target;
newmobj = P_SpawnMissileXYZ(x, y, z, target, target->target, cls, false);
newmobj = P_SpawnMissileXYZ(Pos(), target, target->target, cls, false);
}
else newmobj = Spawn(cls, x, y, z, NO_REPLACE);
else newmobj = Spawn(cls, Pos(), NO_REPLACE);
if (newmobj != NULL)
{
// copy everything relevant
@ -179,7 +179,7 @@ class ARandomSpawner : public AActor
// Handle special altitude flags
if (newmobj->flags & MF_SPAWNCEILING)
{
newmobj->z = newmobj->ceilingz - newmobj->height - SpawnPoint[2];
newmobj->SetZ(newmobj->ceilingz - newmobj->height - SpawnPoint[2]);
}
else if (newmobj->flags2 & MF2_SPAWNFLOAT)
{
@ -187,9 +187,9 @@ class ARandomSpawner : public AActor
if (space > 48*FRACUNIT)
{
space -= 40*FRACUNIT;
newmobj->z = MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT;
newmobj->SetZ(MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT);
}
newmobj->z += SpawnPoint[2];
newmobj->AddZ(SpawnPoint[2]);
}
if (newmobj->flags & MF_MISSILE)
P_CheckMissileSpawn(newmobj, 0);

View file

@ -50,6 +50,6 @@ IMPLEMENT_CLASS (ASpark)
void ASpark::Activate (AActor *activator)
{
Super::Activate (activator);
P_DrawSplash (args[0] ? args[0] : 32, x, y, z, angle, 1);
P_DrawSplash (args[0] ? args[0] : 32, X(), Y(), Z(), angle, 1);
S_Sound (this, CHAN_AUTO, "world/spark", 1, ATTN_STATIC);
}

View file

@ -423,12 +423,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnSingleItem)
return;
}
AActor *spawned = Spawn(cls, self->x, self->y, self->z, ALLOW_REPLACE);
AActor *spawned = Spawn(cls, self->Pos(), ALLOW_REPLACE);
if (spawned)
{
spawned->SetOrigin (spot->x, spot->y, spot->z);
spawned->z = spawned->floorz;
spawned->SetOrigin (spot->Pos(), false);
spawned->SetZ(spawned->floorz);
// We want this to respawn.
if (!(self->flags & MF_DROPPED))
{

View file

@ -826,9 +826,9 @@ static void DrawCoordinates(player_t * CPlayer)
if (!map_point_coordinates || !automapactive)
{
x=CPlayer->mo->x;
y=CPlayer->mo->y;
z=CPlayer->mo->z;
x=CPlayer->mo->X();
y=CPlayer->mo->Y();
z=CPlayer->mo->Z();
}
else
{

View file

@ -1286,8 +1286,8 @@ void DBaseStatusBar::Draw (EHudState state)
y -= height * 2;
}
value = &CPlayer->mo->z;
for (i = 2, value = &CPlayer->mo->z; i >= 0; y -= height, --value, --i)
fixedvec3 pos = CPlayer->mo->Pos();
for (i = 2, value = &pos.z; i >= 0; y -= height, --value, --i)
{
mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS);
screen->DrawText (SmallFont, CR_GREEN, xpos, y, line,

View file

@ -22,7 +22,7 @@ AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target);
DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall)
{
AActor *foo = Spawn("AlienChunkSmall", self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE);
AActor *foo = Spawn("AlienChunkSmall", self->PosPlusZ(10*FRACUNIT), ALLOW_REPLACE);
if (foo != NULL)
{
@ -40,7 +40,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall)
DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge)
{
AActor *foo = Spawn("AlienChunkLarge", self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE);
AActor *foo = Spawn("AlienChunkLarge", self->PosPlusZ(10*FRACUNIT), ALLOW_REPLACE);
if (foo != NULL)
{
@ -62,7 +62,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack)
if (self->target == NULL)
return;
AActor *foo = Spawn("SpectralLightningV2", self->x, self->y, self->z + 32*FRACUNIT, ALLOW_REPLACE);
AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE);
foo->velz = -12*FRACUNIT;
foo->target = self;

View file

@ -80,22 +80,22 @@ AInventory *ACoin::CreateTossable ()
if (Amount >= 50)
{
Amount -= 50;
tossed = static_cast<ACoin*>(Spawn("Gold50", Owner->x, Owner->y, Owner->z, NO_REPLACE));
tossed = static_cast<ACoin*>(Spawn("Gold50", Owner->Pos(), NO_REPLACE));
}
else if (Amount >= 25)
{
Amount -= 25;
tossed = static_cast<ACoin*>(Spawn("Gold25", Owner->x, Owner->y, Owner->z, NO_REPLACE));
tossed = static_cast<ACoin*>(Spawn("Gold25", Owner->Pos(), NO_REPLACE));
}
else if (Amount >= 10)
{
Amount -= 10;
tossed = static_cast<ACoin*>(Spawn("Gold10", Owner->x, Owner->y, Owner->z, NO_REPLACE));
tossed = static_cast<ACoin*>(Spawn("Gold10", Owner->Pos(), NO_REPLACE));
}
else if (Amount > 1 || (ItemFlags & IF_KEEPDEPLETED))
{
Amount -= 1;
tossed = static_cast<ACoin*>(Spawn("Coin", Owner->x, Owner->y, Owner->z, NO_REPLACE));
tossed = static_cast<ACoin*>(Spawn("Coin", Owner->Pos(), NO_REPLACE));
}
else // Amount == 1 && !(ItemFlags & IF_KEEPDEPLETED)
{

View file

@ -27,18 +27,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
{
A_FaceTarget (self);
self->angle -= ANGLE_180/16;
P_SpawnMissileZAimed (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile"));
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile"));
}
else
{
if (P_CheckMissileRange (self))
{
A_FaceTarget (self);
P_SpawnMissileZAimed (self, self->z + 56*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile"));
P_SpawnMissileZAimed (self, self->Z() + 56*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile"));
self->angle -= ANGLE_45/32;
P_SpawnMissileZAimed (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile"));
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile"));
self->angle += ANGLE_45/16;
P_SpawnMissileZAimed (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile"));
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile"));
self->angle -= ANGLE_45/16;
self->reactiontime += 15;
}
@ -49,7 +49,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
{
self->angle += ANGLE_90/16;
AActor *misl = P_SpawnMissileZAimed (self, self->z + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile"));
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile"));
if (misl != NULL)
{
misl->velz += FRACUNIT;
@ -59,7 +59,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight)
{
self->angle -= ANGLE_90/16;
AActor *misl = P_SpawnMissileZAimed (self, self->z + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile"));
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile"));
if (misl != NULL)
{
misl->velz += FRACUNIT;

View file

@ -24,7 +24,7 @@ void A_SpectralMissile (AActor *self, const char *missilename)
{
if (self->target != NULL)
{
AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT,
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT),
self, self->target, PClass::FindClass(missilename), false);
if (missile != NULL)
{
@ -70,7 +70,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity)
{
AActor *entity = Spawn("EntityBoss", self->x, self->y, self->z + 70*FRACUNIT, ALLOW_REPLACE);
AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70*FRACUNIT), ALLOW_REPLACE);
if (entity != NULL)
{
entity->angle = self->angle;
@ -89,13 +89,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath)
AActor *spot = self->tracer;
if (spot == NULL) spot = self;
fixed_t SpawnX = spot->x;
fixed_t SpawnY = spot->y;
fixed_t SpawnZ = spot->z + (self->tracer? 70*FRACUNIT : 0);
fixedvec3 pos = spot->Vec3Angle(secondRadius, self->angle, self->tracer? 70*FRACUNIT : 0);
an = self->angle >> ANGLETOFINESHIFT;
second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]),
SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE);
second = Spawn("EntitySecond", pos, ALLOW_REPLACE);
second->CopyFriendliness(self, true);
//second->target = self->target;
A_FaceTarget (second);
@ -103,18 +100,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath)
second->velx += FixedMul (finecosine[an], 320000);
second->vely += FixedMul (finesine[an], 320000);
pos = spot->Vec3Angle(secondRadius, self->angle + ANGLE_90, self->tracer? 70*FRACUNIT : 0);
an = (self->angle + ANGLE_90) >> ANGLETOFINESHIFT;
second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]),
SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE);
second = Spawn("EntitySecond", pos, ALLOW_REPLACE);
second->CopyFriendliness(self, true);
//second->target = self->target;
second->velx = FixedMul (secondRadius, finecosine[an]) << 2;
second->vely = FixedMul (secondRadius, finesine[an]) << 2;
A_FaceTarget (second);
pos = spot->Vec3Angle(secondRadius, self->angle - ANGLE_90, self->tracer? 70*FRACUNIT : 0);
an = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]),
SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE);
second = Spawn("EntitySecond", pos, ALLOW_REPLACE);
second->CopyFriendliness(self, true);
//second->target = self->target;
second->velx = FixedMul (secondRadius, finecosine[an]) << 2;

View file

@ -35,9 +35,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide)
{
self->SetState (self->FindState("Grenade"));
}
if (self->target->z != self->z)
if (self->target->Z() != self->Z())
{
if (self->z + self->height + 54*FRACUNIT < self->ceilingz)
if (self->Top() + 54*FRACUNIT < self->ceilingz)
{
self->SetState (self->FindState("Jump"));
}
@ -53,20 +53,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
A_FaceTarget (self);
self->z += 32*FRACUNIT;
self->AddZ(32*FRACUNIT);
self->angle -= ANGLE_45/32;
proj = P_SpawnMissileZAimed (self, self->z, self->target, PClass::FindClass("InquisitorShot"));
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindClass("InquisitorShot"));
if (proj != NULL)
{
proj->velz += 9*FRACUNIT;
}
self->angle += ANGLE_45/16;
proj = P_SpawnMissileZAimed (self, self->z, self->target, PClass::FindClass("InquisitorShot"));
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindClass("InquisitorShot"));
if (proj != NULL)
{
proj->velz += 16*FRACUNIT;
}
self->z -= 32*FRACUNIT;
self->AddZ(-32*FRACUNIT);
}
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
@ -79,7 +79,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
return;
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
self->z += 64*FRACUNIT;
self->AddZ(64*FRACUNIT);
A_FaceTarget (self);
an = self->angle >> ANGLETOFINESHIFT;
speed = self->Speed * 2/3;
@ -91,7 +91,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
{
dist = 1;
}
self->velz = (self->target->z - self->z) / dist;
self->velz = (self->target->Z() - self->Z()) / dist;
self->reactiontime = 60;
self->flags |= MF_NOGRAVITY;
}
@ -102,7 +102,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
if (self->reactiontime < 0 ||
self->velx == 0 ||
self->vely == 0 ||
self->z <= self->floorz)
self->Z() <= self->floorz)
{
self->SetState (self->SeeState);
self->reactiontime = 0;
@ -119,7 +119,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
{
AActor *foo = Spawn("InquisitorArm", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
foo->angle = self->angle - ANGLE_90 + (pr_inq.Random2() << 22);
foo->velx = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]) >> 3;
foo->vely = FixedMul (foo->Speed, finesine[foo->angle >> ANGLETOFINESHIFT]) >> 3;

View file

@ -21,16 +21,14 @@ IMPLEMENT_CLASS (ALoreShot)
int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
{
FVector3 thrust;
if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST))
{
thrust.X = float(target->x - victim->x);
thrust.Y = float(target->y - victim->y);
thrust.Z = float(target->z - victim->z);
fixedvec3 fixthrust = victim->Vec3To(target);
TVector3<double> thrust(fixthrust.x, fixthrust.y, fixthrust.z);
thrust.MakeUnit();
thrust *= float((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1));
thrust *= double((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1));
victim->velx += fixed_t(thrust.X);
victim->vely += fixed_t(thrust.Y);
@ -42,7 +40,7 @@ int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain)
{
S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM);
Spawn("LoreShot2", self->x, self->y, self->z, ALLOW_REPLACE);
Spawn("LoreShot2", self->x - (self->velx >> 1), self->y - (self->vely >> 1), self->z - (self->velz >> 1), ALLOW_REPLACE);
Spawn("LoreShot2", self->x - self->velx, self->y - self->vely, self->z - self->velz, ALLOW_REPLACE);
Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-(self->velx >> 1), -(self->vely >> 1), -(self->velz >> 1)), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-self->velx, -self->vely, -self->velz), ALLOW_REPLACE);
}

View file

@ -104,7 +104,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning)
if (self->target == NULL)
return;
spot = Spawn("SpectralLightningSpot", self->target->x, self->target->y, self->target->floorz, ALLOW_REPLACE);
spot = Spawn("SpectralLightningSpot", self->target->X(), self->target->Y(), self->target->floorz, ALLOW_REPLACE);
if (spot != NULL)
{
spot->threshold = 25;
@ -122,7 +122,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase)
{
AActor *foo = Spawn("ProgrammerBase", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
if (foo != NULL)
{
foo->angle = self->angle + ANGLE_180 + (pr_prog.Random2() << 22);

View file

@ -75,8 +75,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
AActor *rebel;
angle_t an;
rebel = Spawn("Rebel1", self->x, self->y, self->floorz, ALLOW_REPLACE);
if (!P_TryMove (rebel, rebel->x, rebel->y, true))
rebel = Spawn("Rebel1", self->X(), self->Y(), self->floorz, ALLOW_REPLACE);
if (!P_TryMove (rebel, rebel->X(), rebel->Y(), true))
{
rebel->Destroy ();
return;
@ -112,7 +112,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
rebel->SetState (rebel->SeeState);
rebel->angle = self->angle;
an = self->angle >> ANGLETOFINESHIFT;
Spawn<ATeleportFog> (rebel->x + 20*finecosine[an], rebel->y + 20*finesine[an], rebel->z + TELEFOGHEIGHT, ALLOW_REPLACE);
Spawn<ATeleportFog> (rebel->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE);
if (--self->health < 0)
{
self->SetState(self->FindState(NAME_Death));

View file

@ -27,7 +27,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
{
minz = maxz;
}
if (minz < self->z)
if (minz < self->Z())
{
self->velz -= FRACUNIT;
}
@ -35,7 +35,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
{
self->velz += FRACUNIT;
}
self->reactiontime = (minz >= self->z) ? 4 : 0;
self->reactiontime = (minz >= self->Z()) ? 4 : 0;
}
DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
@ -48,16 +48,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
return;
}
missile = P_SpawnMissileZAimed (self, self->z + 32*FRACUNIT, self->target, PClass::FindClass("SentinelFX2"));
missile = P_SpawnMissileZAimed (self, self->Z() + 32*FRACUNIT, self->target, PClass::FindClass("SentinelFX2"));
if (missile != NULL && (missile->velx | missile->vely) != 0)
{
for (int i = 8; i > 1; --i)
{
trail = Spawn("SentinelFX1",
self->x + FixedMul (missile->radius * i, finecosine[missile->angle >> ANGLETOFINESHIFT]),
self->y + FixedMul (missile->radius * i, finesine[missile->angle >> ANGLETOFINESHIFT]),
missile->z + (missile->velz / 4 * i), ALLOW_REPLACE);
self->Vec3Angle(missile->radius*i, missile->angle, (missile->velz / 4 * i)), ALLOW_REPLACE);
if (trail != NULL)
{
trail->target = self;
@ -67,7 +65,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
P_CheckMissileSpawn (trail, self->radius);
}
}
missile->z += missile->velz >> 2;
missile->AddZ(missile->velz >> 2);
}
}

View file

@ -28,7 +28,7 @@ void ASpectralMonster::Touch (AActor *toucher)
DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail)
{
AActor *foo = Spawn("SpectralLightningHTail", self->x - self->velx, self->y - self->vely, self->z, ALLOW_REPLACE);
AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->velx, -self->vely, 0), ALLOW_REPLACE);
foo->angle = self->angle;
foo->FriendPlayer = self->FriendPlayer;
@ -53,7 +53,6 @@ static FRandom pr_zap5 ("Zap5");
DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
{
AActor *flash;
fixed_t x, y;
if (self->threshold != 0)
--self->threshold;
@ -61,17 +60,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
self->velx += pr_zap5.Random2(3) << FRACBITS;
self->vely += pr_zap5.Random2(3) << FRACBITS;
x = self->x + pr_zap5.Random2(3) * FRACUNIT * 50;
y = self->y + pr_zap5.Random2(3) * FRACUNIT * 50;
fixedvec2 pos = self->Vec2Offset(
pr_zap5.Random2(3) * FRACUNIT * 50,
pr_zap5.Random2(3) * FRACUNIT * 50);
flash = Spawn (self->threshold > 25 ? PClass::FindClass(NAME_SpectralLightningV2) :
PClass::FindClass(NAME_SpectralLightningV1), x, y, ONCEILINGZ, ALLOW_REPLACE);
PClass::FindClass(NAME_SpectralLightningV1), pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE);
flash->target = self->target;
flash->velz = -18*FRACUNIT;
flash->FriendPlayer = self->FriendPlayer;
flash = Spawn(NAME_SpectralLightningV2, self->x, self->y, ONCEILINGZ, ALLOW_REPLACE);
flash = Spawn(NAME_SpectralLightningV2, self->X(), self->Y(), ONCEILINGZ, ALLOW_REPLACE);
flash->target = self->target;
flash->velz = -18*FRACUNIT;
@ -128,11 +128,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
}
if (dest->height >= 56*FRACUNIT)
{
slope = (dest->z+40*FRACUNIT - self->z) / dist;
slope = (dest->Z()+40*FRACUNIT - self->Z()) / dist;
}
else
{
slope = (dest->z + self->height*2/3 - self->z) / dist;
slope = (dest->Z() + self->height*2/3 - self->Z()) / dist;
}
if (slope < self->velz)
{

View file

@ -17,7 +17,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_StalkerChaseDecide)
{
self->SetState (self->FindState("SeeFloor"));
}
else if (self->ceilingz - self->height > self->z)
else if (self->ceilingz > self->Top())
{
self->SetState (self->FindState("Drop"));
}

View file

@ -580,7 +580,7 @@ IMPLEMENT_CLASS (AMeat)
DEFINE_ACTION_FUNCTION(AActor, A_TossGib)
{
const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat";
AActor *gib = Spawn (gibtype, self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
AActor *gib = Spawn (gibtype, self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
angle_t an;
int speed;
@ -628,7 +628,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
{
sector_t *sec = self->Sector;
if (self->z == sec->floorplane.ZatPoint(self))
if (self->Z() == sec->floorplane.ZatPoint(self))
{
if (sec->special == Damage_InstantDeath)
{
@ -681,7 +681,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ItBurnsItBurns)
DEFINE_ACTION_FUNCTION(AActor, A_DropFire)
{
AActor *drop = Spawn("FireDroplet", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
AActor *drop = Spawn("FireDroplet", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
drop->velz = -FRACUNIT;
P_RadiusAttack (self, self, 64, 64, NAME_Fire, 0);
}

View file

@ -360,8 +360,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight)
AActor *trail;
S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM);
P_SpawnPuff (self, PClass::FindClass("MiniMissilePuff"), self->x, self->y, self->z, self->angle - ANGLE_180, 2, PF_HITTHING);
trail = Spawn("RocketTrail", self->x - self->velx, self->y - self->vely, self->z, ALLOW_REPLACE);
P_SpawnPuff (self, PClass::FindClass("MiniMissilePuff"), self->Pos(), self->angle - ANGLE_180, 2, PF_HITTHING);
trail = Spawn("RocketTrail", self->Vec3Offset(-self->velx, -self->vely, 0), ALLOW_REPLACE);
if (trail != NULL)
{
trail->velz = FRACUNIT;
@ -516,10 +516,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
self->angle += ANGLE_180;
// If the torpedo hit the ceiling, it should still spawn the wave
savedz = self->z;
if (wavedef && self->ceilingz - self->z < wavedef->height)
savedz = self->Z();
if (wavedef && self->ceilingz - self->Z() < wavedef->height)
{
self->z = self->ceilingz - wavedef->height;
self->SetZ(self->ceilingz - wavedef->height);
}
for (int i = 0; i < 80; ++i)
@ -527,12 +527,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
self->angle += ANGLE_45/10;
P_SpawnSubMissile (self, PClass::FindClass("MaulerTorpedoWave"), self->target);
}
self->z = savedz;
self->SetZ(savedz);
}
AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target)
{
AActor *other = Spawn (type, source->x, source->y, source->z, ALLOW_REPLACE);
AActor *other = Spawn (type, source->Pos(), ALLOW_REPLACE);
if (other == NULL)
{
@ -619,20 +619,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
yofs = -yofs;
}
fixed_t x = self->x + (xofs << FRACBITS);
fixed_t y = self->y + (yofs << FRACBITS);
sector_t * sector = P_PointInSector(x, y);
fixedvec2 pos = self->Vec2Offset(xofs << FRACBITS, yofs << FRACBITS);
sector_t * sector = P_PointInSector(pos.x, pos.y);
// The sector's floor is too high so spawn the flame elsewhere.
if (sector->floorplane.ZatPoint(x, y) > self->z + self->MaxStepHeight)
if (sector->floorplane.ZatPoint(pos.x, pos.y) > self->Z() + self->MaxStepHeight)
{
x = self->x;
y = self->y;
pos.x = self->X();
pos.y = self->Y();
}
AActor *drop = Spawn<APhosphorousFire> (
x, y,
self->z + 4*FRACUNIT, ALLOW_REPLACE);
pos.x, pos.y,
self->Z() + 4*FRACUNIT, ALLOW_REPLACE);
if (drop != NULL)
{
drop->velx = self->velx + ((pr_phburn.Random2 (7)) << FRACBITS);
@ -677,9 +676,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
if (grenadetype != NULL)
{
self->z += 32*FRACUNIT;
self->AddZ(32*FRACUNIT);
grenade = P_SpawnSubMissile (self, grenadetype, self);
self->z -= 32*FRACUNIT;
self->AddZ(-32*FRACUNIT);
if (grenade == NULL)
return;
@ -690,15 +689,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
grenade->velz = FixedMul (finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], grenade->Speed) + 8*FRACUNIT;
fixedvec2 offset;
an = self->angle >> ANGLETOFINESHIFT;
tworadii = self->radius + grenade->radius;
grenade->x += FixedMul (finecosine[an], tworadii);
grenade->y += FixedMul (finesine[an], tworadii);
offset.x = FixedMul (finecosine[an], tworadii);
offset.y = FixedMul (finesine[an], tworadii);
an = self->angle + Angle;
an >>= ANGLETOFINESHIFT;
grenade->x += FixedMul (finecosine[an], 15*FRACUNIT);
grenade->y += FixedMul (finesine[an], 15*FRACUNIT);
offset.x += FixedMul (finecosine[an], 15*FRACUNIT);
offset.y += FixedMul (finesine[an], 15*FRACUNIT);
fixedvec2 newpos = grenade->Vec2Offset(offset.x, offset.y);
grenade->SetOrigin(newpos.x, newpos.y, grenade->Z(), false);
}
}
@ -923,7 +927,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
P_BulletSlope (self, &linetarget);
if (linetarget != NULL)
{
spot = Spawn("SpectralLightningSpot", linetarget->x, linetarget->y, linetarget->floorz, ALLOW_REPLACE);
spot = Spawn("SpectralLightningSpot", linetarget->X(), linetarget->Y(), linetarget->floorz, ALLOW_REPLACE);
if (spot != NULL)
{
spot->tracer = linetarget;
@ -931,7 +935,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
}
else
{
spot = Spawn("SpectralLightningSpot", self->x, self->y, self->z, ALLOW_REPLACE);
spot = Spawn("SpectralLightningSpot", self->Pos(), ALLOW_REPLACE);
if (spot != NULL)
{
spot->velx += 28 * finecosine[self->angle >> ANGLETOFINESHIFT];
@ -989,7 +993,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3)
spot = P_SpawnSubMissile (self, PClass::FindClass("SpectralLightningBall1"), self);
if (spot != NULL)
{
spot->z = self->z + 32*FRACUNIT;
spot->SetZ(self->Z() + 32*FRACUNIT);
}
}
self->angle -= (ANGLE_180/20)*10;

View file

@ -18,12 +18,10 @@ extern const PClass *QuestItemClasses[31];
DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud)
{
fixed_t spawnx, spawny;
fixed_t xo = (pr_bang4cloud.Random2() & 3) * 10240;
fixed_t yo = (pr_bang4cloud.Random2() & 3) * 10240;
spawnx = self->x + (pr_bang4cloud.Random2() & 3) * 10240;
spawny = self->y + (pr_bang4cloud.Random2() & 3) * 10240;
Spawn("Bang4Cloud", spawnx, spawny, self->z, ALLOW_REPLACE);
Spawn("Bang4Cloud", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE);
}
// -------------------------------------------------------------------
@ -97,7 +95,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
for (int i = 0; i < 8; ++i)
{
foo = Spawn("Rubble1", self->x, self->y, self->z, ALLOW_REPLACE);
foo = Spawn("Rubble1", self->Pos(), ALLOW_REPLACE);
if (foo != NULL)
{
int t = pr_lightout() & 15;

View file

@ -843,10 +843,11 @@ void P_DisconnectEffect (AActor *actor)
if (!p)
break;
fixedvec3 pos = actor->Vec3Offset(
((M_Random()-128)<<9) * (actor->radius>>FRACBITS),
((M_Random()-128)<<9) * (actor->radius>>FRACBITS),
(M_Random()<<8) * (actor->height>>FRACBITS));
fixed_t xo = ((M_Random() - 128) << 9) * (actor->radius >> FRACBITS);
fixed_t yo = ((M_Random() - 128) << 9) * (actor->radius >> FRACBITS);
fixed_t zo = (M_Random() << 8) * (actor->height >> FRACBITS);
fixedvec3 pos = actor->Vec3Offset(xo, yo, zo);
p->x = pos.x;
p->y = pos.y;
p->z = pos.z;

View file

@ -139,6 +139,10 @@ inline AActor *P_SpawnPuff(AActor *source, const PClass *pufftype, const fixedve
return P_SpawnPuff(source, pufftype, pos.x, pos.y, pos.z, dir, updown, flags, vict);
}
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AActor *originator);
inline void P_SpawnBlood(const fixedvec3 &pos, angle_t dir, int damage, AActor *originator)
{
P_SpawnBlood(pos.x, pos.y, pos.z, dir, damage, originator);
}
void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator);
void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator);
void P_RipperBlood (AActor *mo, AActor *bleeder);

File diff suppressed because it is too large Load diff

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)

File diff suppressed because it is too large Load diff

View file

@ -3379,6 +3379,7 @@ extern polyblock_t **PolyBlockMap;
void P_FreeLevelData ()
{
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
Renderer->CleanLevelData();
FPolyObj::ClearAllSubsectorLinks(); // can't be done as part of the polyobj deletion process.
SN_StopAllSequences ();
@ -3610,7 +3611,6 @@ void P_SetupLevel (const char *lumpname, int position)
// Free all level data from the previous map
P_FreeLevelData ();
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
MapData *map = P_OpenMapData(lumpname, true);
if (map == NULL)

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

@ -433,7 +433,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;
@ -510,7 +510,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)
@ -556,12 +556,12 @@ void P_SectorDamage(int tag, int amount, FName type, const PClass *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
@ -1078,7 +1078,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)
{
@ -2189,8 +2189,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;
}
@ -2305,7 +2305,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;
@ -2319,7 +2319,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;
@ -2347,7 +2347,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

@ -903,6 +903,10 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag);
// P_TELEPT
//
void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool beforeTele = true, bool setTarget = false); //Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false).
inline void P_SpawnTeleportFog(AActor *mobj, const fixedvec3 &pos, bool beforeTele = true, bool setTarget = false)
{
P_SpawnTeleportFog(mobj, pos.x, pos.y, pos.z, beforeTele, setTarget);
}
bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false);
bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool fog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false);
bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse);

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

@ -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;
}

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

@ -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)

View file

@ -98,8 +98,8 @@ static int WriteTHINGS (FILE *file)
mapthinghexen_t mt = { 0, 0, 0, 0, 0, 0, 0, 0, {0} };
AActor *mo = players[consoleplayer].mo;
mt.x = LittleShort(short(mo->x >> FRACBITS));
mt.y = LittleShort(short(mo->y >> FRACBITS));
mt.x = LittleShort(short(mo->X() >> FRACBITS));
mt.y = LittleShort(short(mo->Y() >> FRACBITS));
mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360)));
mt.type = LittleShort((short)1);
mt.flags = LittleShort((short)(7|224|MTF_SINGLE));

View file

@ -901,7 +901,8 @@ void FPolyObj::ThrustMobj (AActor *actor, side_t *side)
actor->vely += thrustY;
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);
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))
&& (!(ld->flags & ML_3DMIDTEX) ||
(!P_LineOpening_3dMidtex(mobj, ld, open) &&
(mobj->z + mobj->height < open.top)
) || (open.abovemidtex && mobj->z > mobj->floorz))
(mobj->Top() < open.top)
) || (open.abovemidtex && mobj->Z() > mobj->floorz))
)
{
// [BL] We can't just continue here since we must
@ -1213,7 +1214,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
performBlockingThrust = true;
}
FBoundingBox box(mobj->x, mobj->y, mobj->radius);
FBoundingBox box(mobj->X(), mobj->Y(), mobj->radius);
if (box.Right() <= ld->bbox[BOXLEFT]
|| 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.
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)
{
continue;
}
// [BL] See if we hit below the floor/ceiling of the poly.
else if(!performBlockingThrust && (
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->Z() < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) ||
mobj->Top() > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj)
))
{
performBlockingThrust = true;

View file

@ -157,7 +157,10 @@ public:
//
//==========================================================================
IMPLEMENT_ABSTRACT_CLASS(DInterpolation)
IMPLEMENT_ABSTRACT_POINTY_CLASS(DInterpolation)
DECLARE_POINTER(Next)
DECLARE_POINTER(Prev)
END_POINTERS
IMPLEMENT_CLASS(DSectorPlaneInterpolation)
IMPLEMENT_CLASS(DSectorScrollInterpolation)
IMPLEMENT_CLASS(DWallScrollInterpolation)
@ -213,9 +216,9 @@ void FInterpolator::UpdateInterpolations()
void FInterpolator::AddInterpolation(DInterpolation *interp)
{
interp->Next = Head;
if (Head != NULL) Head->Prev = &interp->Next;
if (Head != NULL) Head->Prev = interp;
interp->Prev = NULL;
Head = interp;
interp->Prev = &Head;
count++;
}
@ -227,14 +230,19 @@ void FInterpolator::AddInterpolation(DInterpolation *interp)
void FInterpolator::RemoveInterpolation(DInterpolation *interp)
{
if (interp->Prev != NULL)
if (Head == interp)
{
*interp->Prev = interp->Next;
Head = interp->Next;
if (Head != NULL) Head->Prev = NULL;
}
else
{
if (interp->Prev != NULL) interp->Prev->Next = interp->Next;
if (interp->Next != NULL) interp->Next->Prev = interp->Prev;
}
interp->Next = NULL;
interp->Prev = NULL;
count--;
}
}
//==========================================================================
@ -285,13 +293,15 @@ void FInterpolator::RestoreInterpolations()
void FInterpolator::ClearInterpolations()
{
for (DInterpolation *probe = Head; probe != NULL; )
DInterpolation *probe = Head;
Head = NULL;
while (probe != NULL)
{
DInterpolation *next = probe->Next;
probe->Next = probe->Prev = NULL;
probe->Destroy();
probe = next;
}
Head = NULL;
}
@ -334,10 +344,6 @@ int DInterpolation::AddRef()
int DInterpolation::DelRef()
{
if (refcount > 0) --refcount;
if (refcount <= 0 && !(ObjectFlags & OF_EuthanizeMe))
{
Destroy();
}
return refcount;
}
@ -486,9 +492,16 @@ void DSectorPlaneInterpolation::Interpolate(fixed_t smoothratio)
bakheight = *pheight;
baktexz = sector->GetPlaneTexZ(pos);
if (refcount == 0 && oldheight == bakheight)
{
Destroy();
}
else
{
*pheight = oldheight + FixedMul(bakheight - oldheight, smoothratio);
sector->SetPlaneTexZ(pos, oldtexz + FixedMul(baktexz - oldtexz, smoothratio), true);
P_RecalculateAttached3DFloors(sector);
}
}
//==========================================================================
@ -612,8 +625,15 @@ void DSectorScrollInterpolation::Interpolate(fixed_t smoothratio)
bakx = sector->GetXOffset(ceiling);
baky = sector->GetYOffset(ceiling, false);
sector->SetXOffset(ceiling, oldx + FixedMul(bakx - oldx, smoothratio));
sector->SetYOffset(ceiling, oldy + FixedMul(baky - oldy, smoothratio));
if (refcount == 0 && oldx == bakx && oldy == baky)
{
Destroy();
}
else
{
sector->SetXOffset(ceiling, oldx + FixedMul(bakx - oldx, smoothratio));
sector->SetYOffset(ceiling, oldy + FixedMul(baky - oldy, smoothratio));
}
}
//==========================================================================
@ -696,8 +716,15 @@ void DWallScrollInterpolation::Interpolate(fixed_t smoothratio)
bakx = side->GetTextureXOffset(part);
baky = side->GetTextureYOffset(part);
side->SetTextureXOffset(part, oldx + FixedMul(bakx - oldx, smoothratio));
side->SetTextureYOffset(part, oldy + FixedMul(baky - oldy, smoothratio));
if (refcount == 0 && oldx == bakx && oldy == baky)
{
Destroy();
}
else
{
side->SetTextureXOffset(part, oldx + FixedMul(bakx - oldx, smoothratio));
side->SetTextureYOffset(part, oldy + FixedMul(baky - oldy, smoothratio));
}
}
//==========================================================================
@ -788,6 +815,7 @@ void DPolyobjInterpolation::Restore()
void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
{
bool changed = false;
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
{
fixed_t *px = &poly->Vertices[i]->x;
@ -796,15 +824,26 @@ void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
bakverts[i*2 ] = *px;
bakverts[i*2+1] = *py;
*px = oldverts[i*2 ] + FixedMul(bakverts[i*2 ] - oldverts[i*2 ], smoothratio);
*py = oldverts[i*2+1] + FixedMul(bakverts[i*2+1] - oldverts[i*2+1], smoothratio);
if (bakverts[i * 2] != oldverts[i * 2] || bakverts[i * 2 + i] != oldverts[i * 2 + 1])
{
changed = true;
*px = oldverts[i * 2] + FixedMul(bakverts[i * 2] - oldverts[i * 2], smoothratio);
*py = oldverts[i * 2 + 1] + FixedMul(bakverts[i * 2 + 1] - oldverts[i * 2 + 1], smoothratio);
}
}
bakcx = poly->CenterSpot.x;
bakcy = poly->CenterSpot.y;
poly->CenterSpot.x = bakcx + FixedMul(bakcx - oldcx, smoothratio);
poly->CenterSpot.y = bakcy + FixedMul(bakcy - oldcy, smoothratio);
if (refcount == 0 && !changed)
{
Destroy();
}
else
{
bakcx = poly->CenterSpot.x;
bakcy = poly->CenterSpot.y;
poly->CenterSpot.x = bakcx + FixedMul(bakcx - oldcx, smoothratio);
poly->CenterSpot.y = bakcy + FixedMul(bakcy - oldcy, smoothratio);
poly->ClearSubsectorLinks();
poly->ClearSubsectorLinks();
}
}
//==========================================================================

View file

@ -13,12 +13,14 @@ class DInterpolation : public DObject
friend struct FInterpolator;
DECLARE_ABSTRACT_CLASS(DInterpolation, DObject)
HAS_OBJECT_POINTERS
DInterpolation *Next;
DInterpolation **Prev;
int refcount;
TObjPtr<DInterpolation> Next;
TObjPtr<DInterpolation> Prev;
protected:
int refcount;
DInterpolation();
public:
@ -40,7 +42,7 @@ public:
struct FInterpolator
{
DInterpolation *Head;
TObjPtr<DInterpolation> Head;
bool didInterp;
int count;

View file

@ -1224,9 +1224,10 @@ void R_DrawSkyBoxes ()
extralight = 0;
R_SetVisibility (sky->args[0] * 0.25f);
viewx = sky->PrevX + FixedMul(r_TicFrac, sky->x - sky->PrevX);
viewy = sky->PrevY + FixedMul(r_TicFrac, sky->y - sky->PrevY);
viewz = sky->PrevZ + FixedMul(r_TicFrac, sky->z - sky->PrevZ);
fixedvec3 viewpos = sky->InterpolatedPosition(r_TicFrac);
viewx = viewpos.x;
viewy = viewpos.y;
viewz = viewpos.z;
viewangle = savedangle + sky->PrevAngle + FixedMul(r_TicFrac, sky->angle - sky->PrevAngle);
R_CopyStackedViewParameters();
@ -1235,8 +1236,8 @@ void R_DrawSkyBoxes ()
{
extralight = pl->extralight;
R_SetVisibility (pl->visibility);
viewx = pl->viewx - sky->Mate->x + sky->x;
viewy = pl->viewy - sky->Mate->y + sky->y;
viewx = pl->viewx - sky->Mate->X() + sky->X();
viewy = pl->viewy - sky->Mate->Y() + sky->Y();
viewz = pl->viewz;
viewangle = pl->viewangle;
}

View file

@ -670,9 +670,10 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
}
// [RH] Interpolate the sprite's position to make it look smooth
fx = thing->PrevX + FixedMul (r_TicFrac, thing->x - thing->PrevX);
fy = thing->PrevY + FixedMul (r_TicFrac, thing->y - thing->PrevY);
fz = thing->PrevZ + FixedMul (r_TicFrac, thing->z - thing->PrevZ) + thing->GetBobOffset(r_TicFrac);
fixedvec3 pos = thing->InterpolatedPosition(r_TicFrac);
fx = pos.x;
fy = pos.y;
fz = pos.z +thing->GetBobOffset(r_TicFrac);
tex = NULL;
voxel = NULL;
@ -1145,12 +1146,12 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
{
if(!(rover->top.plane->a) && !(rover->top.plane->b))
{
if(rover->top.plane->Zat0() <= thing->z) fakefloor = rover;
if(rover->top.plane->Zat0() <= thing->Z()) fakefloor = rover;
}
}
if(!(rover->bottom.plane->a) && !(rover->bottom.plane->b))
{
if(rover->bottom.plane->Zat0() >= thing->z + thing->height) fakeceiling = rover;
if(rover->bottom.plane->Zat0() >= thing->Top()) fakeceiling = rover;
}
}
R_ProjectSprite (thing, fakeside, fakefloor, fakeceiling);

View file

@ -587,8 +587,8 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
player - players == consoleplayer &&
camera == player->mo &&
!demoplayback &&
iview->nviewx == camera->x &&
iview->nviewy == camera->y &&
iview->nviewx == camera->X() &&
iview->nviewy == camera->Y() &&
!(player->cheats & (CF_TOTALLYFROZEN|CF_FROZEN)) &&
player->playerstate == PST_LIVE &&
player->mo->reactiontime == 0 &&
@ -839,9 +839,9 @@ void R_SetupFrame (AActor *actor)
}
else
{
iview->nviewx = camera->x;
iview->nviewy = camera->y;
iview->nviewz = camera->player ? camera->player->viewz : camera->z + camera->GetClass()->Meta.GetMetaFixed(AMETA_CameraHeight);
iview->nviewx = camera->X();
iview->nviewy = camera->Y();
iview->nviewz = camera->player ? camera->player->viewz : camera->Z() + camera->GetClass()->Meta.GetMetaFixed(AMETA_CameraHeight);
viewsector = camera->Sector;
r_showviewer = false;
}

View file

@ -175,9 +175,10 @@ void S_NoiseDebug (void)
return;
}
listener.X = FIXED2FLOAT(players[consoleplayer].camera->x);
listener.Y = FIXED2FLOAT(players[consoleplayer].camera->z);
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->y);
listener.X = FIXED2FLOAT(players[consoleplayer].camera->SoundX());
listener.Y = FIXED2FLOAT(players[consoleplayer].camera->SoundZ());
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->SoundY());
// Display the oldest channel first.
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)
{
x = players[consoleplayer].camera->x;
y = players[consoleplayer].camera->z;
z = players[consoleplayer].camera->y;
x = players[consoleplayer].camera->SoundX();
y = players[consoleplayer].camera->SoundZ();
z = players[consoleplayer].camera->SoundY();
}
else
{
@ -685,9 +686,9 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
// assert(actor != NULL);
if (actor != NULL)
{
x = actor->x;
y = actor->z;
z = actor->y;
x = actor->SoundX();
y = actor->SoundZ();
z = actor->SoundY();
}
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)
{
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->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.
if (P_PointInSector(*x, *y) == sec)
{
*x = players[consoleplayer].camera->x;
*y = players[consoleplayer].camera->y;
*x = players[consoleplayer].camera->SoundX();
*y = players[consoleplayer].camera->SoundY();
}
else
{
@ -1567,9 +1568,9 @@ void S_RelinkSound (AActor *from, AActor *to)
{
chan->Actor = NULL;
chan->SourceType = SOURCE_Unattached;
chan->Point[0] = FIXED2FLOAT(from->x);
chan->Point[1] = FIXED2FLOAT(from->z);
chan->Point[2] = FIXED2FLOAT(from->y);
chan->Point[0] = FIXED2FLOAT(from->SoundX());
chan->Point[1] = FIXED2FLOAT(from->SoundZ());
chan->Point[2] = FIXED2FLOAT(from->SoundY());
}
else
{
@ -1959,9 +1960,9 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor)
listener.velocity.Z = listenactor->vely * (TICRATE/65536.f);
*/
listener.velocity.Zero();
listener.position.X = FIXED2FLOAT(listenactor->x);
listener.position.Y = FIXED2FLOAT(listenactor->z);
listener.position.Z = FIXED2FLOAT(listenactor->y);
listener.position.X = FIXED2FLOAT(listenactor->SoundX());
listener.position.Y = FIXED2FLOAT(listenactor->SoundZ());
listener.position.Z = FIXED2FLOAT(listenactor->SoundY());
listener.underwater = listenactor->waterlevel == 3;
assert(zones != NULL);
listener.Environment = zones[listenactor->Sector->ZoneNumber].Environment;
@ -2640,10 +2641,7 @@ CCMD (loopsound)
}
else
{
AActor *icon = Spawn("SpeakerIcon", players[consoleplayer].mo->x,
players[consoleplayer].mo->y,
players[consoleplayer].mo->z + 32*FRACUNIT,
ALLOW_REPLACE);
AActor *icon = Spawn("SpeakerIcon", players[consoleplayer].mo->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE);
if (icon != NULL)
{
S_Sound(icon, CHAN_BODY | CHAN_LOOP, id, 1.f, ATTN_IDLE);

View file

@ -600,9 +600,9 @@ public:
protected:
void Heapify();
unsigned int Parent(unsigned int i) { return (i + 1u) / 2u - 1u; }
unsigned int Left(unsigned int i) { return (i + 1u) * 2u - 1u; }
unsigned int Right(unsigned int i) { return (i + 1u) * 2u; }
unsigned int Parent(unsigned int i) const { return (i + 1u) / 2u - 1u; }
unsigned int Left(unsigned int i) const { return (i + 1u) * 2u - 1u; }
unsigned int Right(unsigned int i) const { return (i + 1u) * 2u; }
};
class HMISong : public MIDIStreamer
@ -630,7 +630,7 @@ protected:
struct TrackInfo;
void ProcessInitialMetaEvents ();
DWORD *SendCommand (DWORD *event, TrackInfo *track, DWORD delay);
DWORD *SendCommand (DWORD *event, TrackInfo *track, DWORD delay, ptrdiff_t room, bool &sysex_noroom);
TrackInfo *FindNextDue ();
static DWORD ReadVarLenHMI(TrackInfo *);
@ -673,7 +673,7 @@ protected:
void AdvanceSong(DWORD time);
void ProcessInitialMetaEvents();
DWORD *SendCommand (DWORD *event, EventSource track, DWORD delay);
DWORD *SendCommand (DWORD *event, EventSource track, DWORD delay, ptrdiff_t room, bool &sysex_noroom);
EventSource FindNextDue();
BYTE *MusHeader;

View file

@ -523,7 +523,12 @@ DWORD *HMISong::MakeEvents(DWORD *events, DWORD *max_event_p, DWORD max_time)
// Play all events for this tick.
do
{
DWORD *new_events = SendCommand(events, TrackDue, time);
bool sysex_noroom = false;
DWORD *new_events = SendCommand(events, TrackDue, time, max_event_p - events, sysex_noroom);
if (sysex_noroom)
{
return events;
}
TrackDue = FindNextDue();
if (new_events != events)
{
@ -568,7 +573,7 @@ void HMISong::AdvanceTracks(DWORD time)
//
//==========================================================================
DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdiff_t room, bool &sysex_noroom)
{
DWORD len;
BYTE event, data1 = 0, data2 = 0;
@ -584,10 +589,20 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
return events + 3;
}
sysex_noroom = false;
size_t start_p = track->TrackP;
CHECK_FINISHED
event = track->TrackBegin[track->TrackP++];
CHECK_FINISHED
// The actual event type will be filled in below. If it's not a NOP,
// the events pointer will be advanced once the actual event is written.
// Otherwise, we do it at the end of the function.
events[0] = delay;
events[1] = 0;
events[2] = MEVT_NOP << 24;
if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND && event != 0xFe)
{
// Normal short message
@ -626,17 +641,10 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
data2 = VolumeControllerChange(event & 15, data2);
}
events[0] = delay;
events[1] = 0;
if (event != MIDI_META)
{
events[2] = event | (data1<<8) | (data2<<16);
}
else
{
events[2] = MEVT_NOP << 24;
}
events += 3;
if (ReadVarLen == ReadVarLenHMI && (event & 0x70) == (MIDI_NOTEON & 0x70))
{ // HMI note on events include the time until an implied note off event.
@ -645,13 +653,41 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
}
else
{
// Skip SysEx events just because I don't want to bother with them.
// The old MIDI player ignored them too, so this won't break
// anything that played before.
// SysEx events could potentially not have enough room in the buffer...
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{
len = ReadVarLen(track);
track->TrackP += len;
if (len >= (MAX_EVENTS-1)*3*4)
{ // This message will never fit. Throw it away.
track->TrackP += len;
}
else if (len + 12 >= (size_t)room * 4)
{ // Not enough room left in this buffer. Backup and wait for the next one.
track->TrackP = start_p;
sysex_noroom = true;
return events;
}
else
{
BYTE *msg = (BYTE *)&events[3];
if (event == MIDI_SYSEX)
{ // Need to add the SysEx marker to the message.
events[2] = (MEVT_LONGMSG << 24) | (len + 1);
*msg++ = MIDI_SYSEX;
}
else
{
events[2] = (MEVT_LONGMSG << 24) | len;
}
memcpy(msg, &track->TrackBegin[track->TrackP], len);
msg += len;
// Must pad with 0
while ((size_t)msg & 3)
{
*msg++ = 0;
}
track->TrackP += len;
}
}
else if (event == MIDI_META)
{
@ -677,7 +713,6 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
events[0] = delay;
events[1] = 0;
events[2] = (MEVT_TEMPO << 24) | Tempo;
events += 3;
break;
}
track->TrackP += len;
@ -720,6 +755,18 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
{
track->Delay = ReadVarLen(track);
}
// Advance events pointer unless this is a non-delaying NOP.
if (events[0] != 0 || MEVT_EVENTTYPE(events[2]) != MEVT_NOP)
{
if (MEVT_EVENTTYPE(events[2]) == MEVT_LONGMSG)
{
events += 3 + ((MEVT_EVENTPARM(events[2]) + 3) >> 2);
}
else
{
events += 3;
}
}
return events;
}

View file

@ -384,6 +384,11 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
event = track->TrackBegin[track->TrackP++];
CHECK_FINISHED
// The actual event type will be filled in below.
events[0] = delay;
events[1] = 0;
events[2] = MEVT_NOP << 24;
if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND)
{
// Normal short message
@ -582,17 +587,10 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
break;
}
}
events[0] = delay;
events[1] = 0;
if (event != MIDI_META && (!track->Designated || (track->Designation & DesignationMask)))
{
events[2] = event | (data1<<8) | (data2<<16);
}
else
{
events[2] = MEVT_NOP << 24;
}
events += 3;
}
else
{
@ -612,8 +610,6 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
}
else
{
events[0] = delay;
events[1] = 0;
BYTE *msg = (BYTE *)&events[3];
if (event == MIDI_SYSEX)
{ // Need to add the SysEx marker to the message.
@ -631,7 +627,6 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
{
*msg++ = 0;
}
events = (DWORD *)msg;
track->TrackP += len;
}
}
@ -659,7 +654,6 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
events[0] = delay;
events[1] = 0;
events[2] = (MEVT_TEMPO << 24) | Tempo;
events += 3;
break;
}
track->TrackP += len;
@ -678,6 +672,18 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
{
track->Delay = track->ReadVarLen();
}
// Advance events pointer unless this is a non-delaying NOP.
if (events[0] != 0 || MEVT_EVENTTYPE(events[2]) != MEVT_NOP)
{
if (MEVT_EVENTTYPE(events[2]) == MEVT_LONGMSG)
{
events += 3 + ((MEVT_EVENTPARM(events[2]) + 3) >> 2);
}
else
{
events += 3;
}
}
return events;
}

View file

@ -337,7 +337,12 @@ DWORD *XMISong::MakeEvents(DWORD *events, DWORD *max_event_p, DWORD max_time)
// Play all events for this tick.
do
{
DWORD *new_events = SendCommand(events, EventDue, time);
bool sysex_noroom = false;
DWORD *new_events = SendCommand(events, EventDue, time, max_event_p - events, sysex_noroom);
if (sysex_noroom)
{
return events;
}
EventDue = FindNextDue();
if (new_events != events)
{
@ -382,7 +387,7 @@ void XMISong::AdvanceSong(DWORD time)
//
//==========================================================================
DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay, ptrdiff_t room, bool &sysex_noroom)
{
DWORD len;
BYTE event, data1 = 0, data2 = 0;
@ -399,10 +404,20 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
TrackInfo *track = CurrSong;
sysex_noroom = false;
size_t start_p = track->EventP;
CHECK_FINISHED
event = track->EventChunk[track->EventP++];
CHECK_FINISHED
// The actual event type will be filled in below. If it's not a NOP,
// the events pointer will be advanced once the actual event is written.
// Otherwise, we do it at the end of the function.
events[0] = delay;
events[1] = 0;
events[2] = MEVT_NOP << 24;
if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND)
{
// Normal short message
@ -499,10 +514,6 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
{
events[2] = event | (data1<<8) | (data2<<16);
}
else
{
events[2] = MEVT_NOP << 24;
}
events += 3;
@ -513,13 +524,41 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
}
else
{
// Skip SysEx events just because I don't want to bother with them.
// The old MIDI player ignored them too, so this won't break
// anything that played before.
// SysEx events could potentially not have enough room in the buffer...
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{
len = track->ReadVarLen ();
track->EventP += len;
len = track->ReadVarLen();
if (len >= (MAX_EVENTS-1)*3*4)
{ // This message will never fit. Throw it away.
track->EventP += len;
}
else if (len + 12 >= (size_t)room * 4)
{ // Not enough room left in this buffer. Backup and wait for the next one.
track->EventP = start_p;
sysex_noroom = true;
return events;
}
else
{
BYTE *msg = (BYTE *)&events[3];
if (event == MIDI_SYSEX)
{ // Need to add the SysEx marker to the message.
events[2] = (MEVT_LONGMSG << 24) | (len + 1);
*msg++ = MIDI_SYSEX;
}
else
{
events[2] = (MEVT_LONGMSG << 24) | len;
}
memcpy(msg, &track->EventChunk[track->EventP++], len);
msg += len;
// Must pad with 0
while ((size_t)msg & 3)
{
*msg++ = 0;
}
track->EventP += len;
}
}
else if (event == MIDI_META)
{
@ -551,6 +590,18 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
{
track->Delay = track->ReadDelay();
}
// Advance events pointer unless this is a non-delaying NOP.
if (events[0] != 0 || MEVT_EVENTTYPE(events[2]) != MEVT_NOP)
{
if (MEVT_EVENTTYPE(events[2]) == MEVT_LONGMSG)
{
events += 3 + ((MEVT_EVENTPARM(events[2]) + 3) >> 2);
}
else
{
events += 3;
}
}
return events;
}

File diff suppressed because it is too large Load diff

View file

@ -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)

View file

@ -1228,7 +1228,7 @@ void WI_initDeathmatchStats (void)
acceleratestage = 0;
memset(playerready, 0, sizeof(playerready));
memset(cnt_frags, 0, sizeof(cnt_frags));
memset(cnt_deaths, 0, sizeof(cnt_frags));
memset(cnt_deaths, 0, sizeof(cnt_deaths));
memset(player_deaths, 0, sizeof(player_deaths));
total_frags = 0;
total_deaths = 0;

View file

@ -33,7 +33,7 @@ class FTexture;
struct wbplayerstruct_t
{
bool in; // whether the player is in game
// Player stats, kills, collected items etc.
int skills;
int sitems;
@ -41,7 +41,6 @@ struct wbplayerstruct_t
int stime;
int frags[MAXPLAYERS];
int fragcount; // [RH] Cumulative frags for this player
};
struct wbstartstruct_t
@ -54,7 +53,7 @@ struct wbstartstruct_t
FTexture *LName0;
FTexture *LName1;
int maxkills;
int maxitems;
int maxsecret;
@ -63,19 +62,19 @@ struct wbstartstruct_t
// the par time and sucktime
int partime; // in tics
int sucktime; // in minutes
// total time for the entire current game
int totaltime;
// index of this player in game
int pnum;
int pnum;
wbplayerstruct_t plyr[MAXPLAYERS];
};
// Intermission stats.
// Parameters for world map / intermission.
extern wbstartstruct_t wminfo;
extern wbstartstruct_t wminfo;
// Called by main loop, animate the intermission.

View file

@ -208,6 +208,7 @@ enum
TF_USEACTORFOG = 0x00000100, // Use the actor's TeleFogSourceType and TeleFogDestType fogs.
TF_NOJUMP = 0x00000200, // Don't jump after teleporting.
TF_OVERRIDE = 0x00000400, // Ignore NOTELEPORT.
TF_SENSITIVEZ = 0x00000800, // Fail if the actor wouldn't fit in the position (for Z).
TF_KEEPORIENTATION = TF_KEEPVELOCITY|TF_KEEPANGLE,
TF_NOFOG = TF_NOSRCFOG|TF_NODESTFOG,