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); 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 PalEntry GetBloodColor() const
{ {
return (PalEntry)GetClass()->Meta.GetMetaInt(AMETA_BloodColor); return (PalEntry)GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
@ -884,103 +878,109 @@ public:
return bloodcls; 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 // 'absolute' is reserved for a linked portal implementation which needs
// to distinguish between portal-aware and portal-unaware distance calculation. // to distinguish between portal-aware and portal-unaware distance calculation.
fixed_t AproxDistance(AActor *other, bool absolute = false) 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. // same with 'ref' here.
fixed_t AproxDistance(fixed_t otherx, fixed_t othery, AActor *ref = NULL) 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) 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) 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 // more precise, but slower version, being used in a few places
fixed_t Distance2D(AActor *other, bool absolute = false) 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 // a full 3D version of the above
fixed_t Distance3D(AActor *other, bool absolute = false) 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 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 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) 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) 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 Vec2To(AActor *other) const
{ {
fixedvec2 ret = { other->x - x, other->y - y }; fixedvec2 ret = { other->X() - X(), other->Y() - Y() };
return ret; return ret;
} }
fixedvec3 Vec3To(AActor *other) const 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; return ret;
} }
fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy, bool absolute = false) const 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; return ret;
} }
fixedvec2 Vec2Angle(fixed_t length, angle_t angle, bool absolute = false) const fixedvec2 Vec2Angle(fixed_t length, angle_t angle, bool absolute = false) const
{ {
fixedvec2 ret = { x + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), fixedvec2 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
y + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) }; Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
return ret; return ret;
} }
fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false) const 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; return ret;
} }
fixedvec3 Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false) const fixedvec3 Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false) const
{ {
fixedvec3 ret = { x + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), fixedvec3 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
y + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), z + dz }; Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), Z() + dz };
return ret; return ret;
} }
void Move(fixed_t dx, fixed_t dy, fixed_t dz) 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) void SetOrigin(const fixedvec3 & npos, bool moving)
@ -1006,9 +1006,10 @@ public:
void CheckSectorTransition(sector_t *oldsec); void CheckSectorTransition(sector_t *oldsec);
// info for drawing // info for drawing
// NOTE: The first member variable *must* be x. // NOTE: The first member variable *must* be snext.
fixed_t x,y,z;
AActor *snext, **sprev; // links in sector (if needed) 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; angle_t angle;
WORD sprite; // used to find patch_t and flip value WORD sprite; // used to find patch_t and flip value
BYTE frame; // sprite frame to draw BYTE frame; // sprite frame to draw
@ -1237,21 +1238,57 @@ public:
fixed_t X() const fixed_t X() const
{ {
return x; return __pos.x;
} }
fixed_t Y() const fixed_t Y() const
{ {
return y; return __pos.y;
} }
fixed_t Z() const fixed_t Z() const
{ {
return z; return __pos.z;
} }
fixedvec3 Pos() const fixedvec3 Pos() const
{ {
fixedvec3 ret = { X(), Y(), Z() }; fixedvec3 ret = { X(), Y(), Z() };
return ret; return ret;
} }
fixedvec3 PosRelative(AActor *other) const
{
fixedvec3 ret = { X(), Y(), Z() };
return ret;
}
fixedvec3 PosRelative(sector_t *sec) const
{
fixedvec3 ret = { X(), Y(), Z() };
return ret;
}
fixedvec3 PosRelative(line_t *line) const
{
fixedvec3 ret = { X(), Y(), Z() };
return ret;
}
fixed_t SoundX() const
{
return X();
}
fixed_t SoundY() const
{
return Y();
}
fixed_t SoundZ() const
{
return Z();
}
fixedvec3 InterpolatedPosition(fixed_t ticFrac) const
{
fixedvec3 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 PosPlusZ(fixed_t zadd) const
{ {
fixedvec3 ret = { X(), Y(), Z() + zadd }; fixedvec3 ret = { X(), Y(), Z() + zadd };
@ -1259,28 +1296,43 @@ public:
} }
fixed_t Top() const fixed_t Top() const
{ {
return z + height; return Z() + height;
} }
void SetZ(fixed_t newz, bool moving = true) void SetZ(fixed_t newz, bool moving = true)
{ {
z = newz; __pos.z = newz;
} }
void AddZ(fixed_t newz, bool moving = true) 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! // These are not for general use as they do not link the actor into the world!
void SetXY(fixed_t xx, fixed_t yy) void SetXY(fixed_t xx, fixed_t yy)
{ {
x = xx; __pos.x = xx;
y = yy; __pos.y = yy;
} }
void SetXYZ(fixed_t xx, fixed_t yy, fixed_t zz) void SetXYZ(fixed_t xx, fixed_t yy, fixed_t zz)
{ {
x = xx; __pos.x = xx;
y = yy; __pos.y = yy;
z = zz; __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; return ret;
} }
inline fixedvec3 PosRelative(const fixedvec3 &pos, line_t *line, sector_t *refsec = NULL)
{
return pos;
}
void PrintMiscActorInfo(AActor * query); void PrintMiscActorInfo(AActor * query);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -965,7 +965,7 @@ void APowerFlight::InitEffect ()
Super::InitEffect(); Super::InitEffect();
Owner->flags2 |= MF2_FLY; Owner->flags2 |= MF2_FLY;
Owner->flags |= MF_NOGRAVITY; 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 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->flags7 & MF7_FLYCHEAT))
{ {
if (Owner->z != Owner->floorz) if (Owner->Z() != Owner->floorz)
{ {
Owner->player->centering = true; Owner->player->centering = true;
} }
@ -1250,7 +1250,7 @@ void APowerSpeed::DoEffect ()
if (P_AproxDistance (Owner->velx, Owner->vely) <= 12*FRACUNIT) if (P_AproxDistance (Owner->velx, Owner->vely) <= 12*FRACUNIT)
return; return;
AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->x, Owner->y, Owner->z, NO_REPLACE); AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->Pos(), NO_REPLACE);
if (speedMo) if (speedMo)
{ {
speedMo->angle = Owner->angle; speedMo->angle = Owner->angle;

View file

@ -100,19 +100,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
// Set default values // Set default values
// Every five tics, Hexen moved the ball 3/256th of a revolution. // Every five tics, Hexen moved the ball 3/256th of a revolution.
int rotationspeed = ANGLE_45/32*3/5; 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. // 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° // 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; 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; else if (self->target->args[3] > 0) rotationspeed = ANGLE_45/32 * (self->target->args[3]) / TICRATE;
// Set rotation radius // 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->angle += rotationspeed;
self->x = self->target->x + rotationradius * finecosine[self->angle >> ANGLETOFINESHIFT]; self->SetOrigin(self->target->Vec3Angle(rotationradius, self->angle, 0), true);
self->y = self->target->y + rotationradius * finesine[self->angle >> ANGLETOFINESHIFT]; self->floorz = self->target->floorz;
self->z = self->target->z; self->ceilingz = self->target->ceilingz;
} }
@ -120,16 +120,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
{ {
angle_t startangle; angle_t startangle;
AActor *ball; AActor *ball;
fixed_t cx, cy, cz;
ACTION_PARAM_START(1); ACTION_PARAM_START(1);
ACTION_PARAM_CLASS(balltype, 0); ACTION_PARAM_CLASS(balltype, 0);
if (balltype == NULL) balltype = PClass::FindClass("BridgeBall"); if (balltype == NULL) balltype = PClass::FindClass("BridgeBall");
cx = self->x;
cy = self->y;
cz = self->z;
startangle = pr_orbit() << 24; startangle = pr_orbit() << 24;
// Spawn triad into world -- may be more than a triad now. // 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++) 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->angle = startangle + (ANGLE_45/32) * (256/ballcount) * i;
ball->target = self; ball->target = self;
CALL_ACTION(A_BridgeOrbit, ball); CALL_ACTION(A_BridgeOrbit, ball);

View file

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

View file

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

View file

@ -91,7 +91,7 @@ DBaseDecal::DBaseDecal (int statnum, fixed_t z)
DBaseDecal::DBaseDecal (const AActor *basis) DBaseDecal::DBaseDecal (const AActor *basis)
: DThinker(STAT_DECAL), : 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), Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle) RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle)
{ {
@ -817,22 +817,22 @@ void ADecal::BeginPlay ()
{ {
if (!tpl->PicNum.Exists()) 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 else
{ {
// Look for a wall within 64 units behind the actor. If none can be // 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 // found, then no decal is created, and this actor is destroyed
// without effectively doing anything. // 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 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. // This actor doesn't need to stick around anymore.
Destroy(); Destroy();

View file

@ -25,10 +25,10 @@ void AFastProjectile::Tick ()
fixed_t zfrac; fixed_t zfrac;
int changexy; int changexy;
PrevX = x; PrevX = X();
PrevY = y; PrevY = Y();
PrevZ = z; PrevZ = Z();
fixed_t oldz = z; fixed_t oldz = Z();
PrevAngle = angle; PrevAngle = angle;
if (!(flags5 & MF5_NOTIMEFREEZE)) if (!(flags5 & MF5_NOTIMEFREEZE))
@ -57,7 +57,7 @@ void AFastProjectile::Tick ()
} }
// Handle movement // Handle movement
if (velx || vely || (z != floorz) || velz) if (velx || vely || (Z() != floorz) || velz)
{ {
xfrac = velx >> shift; xfrac = velx >> shift;
yfrac = vely >> shift; yfrac = vely >> shift;
@ -73,14 +73,14 @@ void AFastProjectile::Tick ()
tm.LastRipped = NULL; // [RH] Do rip damage each step, like Hexen 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 { // Blocked move
if (!(flags3 & MF3_SKYEXPLODE)) if (!(flags3 & MF3_SKYEXPLODE))
{ {
if (tm.ceilingline && if (tm.ceilingline &&
tm.ceilingline->backsector && tm.ceilingline->backsector &&
tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum && 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. // Hack to prevent missiles exploding against the sky.
// Does not handle sky floors. // Does not handle sky floors.
@ -99,10 +99,10 @@ void AFastProjectile::Tick ()
return; return;
} }
} }
z += zfrac; AddZ(zfrac);
UpdateWaterLevel (oldz); UpdateWaterLevel (oldz);
oldz = z; oldz = Z();
if (z <= floorz) if (Z() <= floorz)
{ // Hit the floor { // Hit the floor
if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE)) if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
@ -113,12 +113,12 @@ void AFastProjectile::Tick ()
return; return;
} }
z = floorz; SetZ(floorz);
P_HitFloor (this); P_HitFloor (this);
P_ExplodeMissile (this, NULL, NULL); P_ExplodeMissile (this, NULL, NULL);
return; return;
} }
if (z + height > ceilingz) if (Top() > ceilingz)
{ // Hit the ceiling { // Hit the ceiling
if (ceilingpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE)) if (ceilingpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
@ -127,7 +127,7 @@ void AFastProjectile::Tick ()
return; return;
} }
z = ceilingz - height; SetZ(ceilingz - height);
P_ExplodeMissile (this, NULL, NULL); P_ExplodeMissile (this, NULL, NULL);
return; return;
} }
@ -160,7 +160,7 @@ void AFastProjectile::Effect()
FName name = (ENamedName) this->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None); FName name = (ENamedName) this->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None);
if (name != NAME_None) if (name != NAME_None)
{ {
fixed_t hitz = z-8*FRACUNIT; fixed_t hitz = Z()-8*FRACUNIT;
if (hitz < floorz) if (hitz < floorz)
{ {
@ -172,7 +172,7 @@ void AFastProjectile::Effect()
const PClass *trail = PClass::FindClass(name); const PClass *trail = PClass::FindClass(name);
if (trail != NULL) if (trail != NULL)
{ {
AActor *act = Spawn (trail, x, y, hitz, ALLOW_REPLACE); AActor *act = Spawn (trail, X(), Y(), hitz, ALLOW_REPLACE);
if (act != NULL) if (act != NULL)
{ {
act->angle = this->angle; 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; 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); EndAllPowerupEffects(actor->Inventory);
DObject::StaticPointerSubstitution (actor, morphed); DObject::StaticPointerSubstitution (actor, morphed);
if ((actor->tid != 0) && (style & MORPH_NEWTIDBEHAVIOUR)) 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->flags |= actor->flags & (MF_SHADOW|MF_NOGRAVITY);
morphed->flags2 |= actor->flags2 & MF2_FLY; morphed->flags2 |= actor->flags2 & MF2_FLY;
morphed->flags3 |= actor->flags3 & MF3_GHOST; 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->player = NULL;
actor->flags &= ~(MF_SOLID|MF_SHOOTABLE); actor->flags &= ~(MF_SOLID|MF_SHOOTABLE);
actor->flags |= MF_UNMORPHED; 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 = barrier_cast<APlayerPawn *>(pmo->tracer);
mo->SetOrigin (pmo->x, pmo->y, pmo->z); mo->SetOrigin (pmo->Pos(), false);
mo->flags |= MF_SOLID; mo->flags |= MF_SOLID;
pmo->flags &= ~MF_SOLID; pmo->flags &= ~MF_SOLID;
if (!force && !P_TestMobjLocation (mo)) if (!force && !P_TestMobjLocation (mo))
@ -310,7 +310,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
AActor *eflash = NULL; AActor *eflash = NULL;
if (exit_flash != 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; if (eflash) eflash->target = mo;
} }
mo->SetupWeaponSlots(); // Use original class's weapon slots. 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; 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); DObject::StaticPointerSubstitution (actor, morphed);
morphed->tid = actor->tid; morphed->tid = actor->tid;
morphed->angle = actor->angle; 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_SOLID|MF_SHOOTABLE);
actor->flags |= MF_UNMORPHED; actor->flags |= MF_UNMORPHED;
actor->renderflags |= RF_INVISIBLE; 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) if (eflash)
eflash->target = morphed; eflash->target = morphed;
return true; return true;
@ -436,7 +436,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
return false; return false;
} }
actor = beast->UnmorphedMe; actor = beast->UnmorphedMe;
actor->SetOrigin (beast->x, beast->y, beast->z); actor->SetOrigin (beast->Pos(), false);
actor->flags |= MF_SOLID; actor->flags |= MF_SOLID;
beast->flags &= ~MF_SOLID; beast->flags &= ~MF_SOLID;
ActorFlags6 beastflags6 = beast->flags6; ActorFlags6 beastflags6 = beast->flags6;
@ -472,7 +472,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
DObject::StaticPointerSubstitution (beast, actor); DObject::StaticPointerSubstitution (beast, actor);
const PClass *exit_flash = beast->MorphExitFlash; const PClass *exit_flash = beast->MorphExitFlash;
beast->Destroy (); 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) if (eflash)
eflash->target = actor; eflash->target = actor;
return true; return true;

View file

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

View file

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

View file

@ -131,7 +131,7 @@ void DEarthquake::Tick ()
dist = m_Spot->AproxDistance (victim, true); dist = m_Spot->AproxDistance (victim, true);
// Check if in damage radius // 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) if (pr_quake() < 50)
{ {

View file

@ -91,7 +91,7 @@ class ARandomSpawner : public AActor
// So now we can spawn the dropped item. // So now we can spawn the dropped item.
if (di == NULL || bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions 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(); Destroy();
return; return;
} }
@ -144,9 +144,9 @@ class ARandomSpawner : public AActor
if (this->flags & MF_MISSILE && target && target->target) // Attempting to spawn a missile. if (this->flags & MF_MISSILE && target && target->target) // Attempting to spawn a missile.
{ {
if ((tracer == NULL) && (flags2 & MF2_SEEKERMISSILE)) tracer = target->target; 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) if (newmobj != NULL)
{ {
// copy everything relevant // copy everything relevant
@ -179,7 +179,7 @@ class ARandomSpawner : public AActor
// Handle special altitude flags // Handle special altitude flags
if (newmobj->flags & MF_SPAWNCEILING) 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) else if (newmobj->flags2 & MF2_SPAWNFLOAT)
{ {
@ -187,9 +187,9 @@ class ARandomSpawner : public AActor
if (space > 48*FRACUNIT) if (space > 48*FRACUNIT)
{ {
space -= 40*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) if (newmobj->flags & MF_MISSILE)
P_CheckMissileSpawn(newmobj, 0); P_CheckMissileSpawn(newmobj, 0);

View file

@ -50,6 +50,6 @@ IMPLEMENT_CLASS (ASpark)
void ASpark::Activate (AActor *activator) void ASpark::Activate (AActor *activator)
{ {
Super::Activate (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); S_Sound (this, CHAN_AUTO, "world/spark", 1, ATTN_STATIC);
} }

View file

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

View file

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

View file

@ -1286,8 +1286,8 @@ void DBaseStatusBar::Draw (EHudState state)
y -= height * 2; y -= height * 2;
} }
value = &CPlayer->mo->z; fixedvec3 pos = CPlayer->mo->Pos();
for (i = 2, value = &CPlayer->mo->z; i >= 0; y -= height, --value, --i) for (i = 2, value = &pos.z; i >= 0; y -= height, --value, --i)
{ {
mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS); mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS);
screen->DrawText (SmallFont, CR_GREEN, xpos, y, line, 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) 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) if (foo != NULL)
{ {
@ -40,7 +40,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall)
DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge) 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) if (foo != NULL)
{ {
@ -62,7 +62,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack)
if (self->target == NULL) if (self->target == NULL)
return; 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->velz = -12*FRACUNIT;
foo->target = self; foo->target = self;

View file

@ -80,22 +80,22 @@ AInventory *ACoin::CreateTossable ()
if (Amount >= 50) if (Amount >= 50)
{ {
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) else if (Amount >= 25)
{ {
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) else if (Amount >= 10)
{ {
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)) else if (Amount > 1 || (ItemFlags & IF_KEEPDEPLETED))
{ {
Amount -= 1; 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) else // Amount == 1 && !(ItemFlags & IF_KEEPDEPLETED)
{ {

View file

@ -27,18 +27,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
{ {
A_FaceTarget (self); A_FaceTarget (self);
self->angle -= ANGLE_180/16; 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 else
{ {
if (P_CheckMissileRange (self)) if (P_CheckMissileRange (self))
{ {
A_FaceTarget (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; 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; 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->angle -= ANGLE_45/16;
self->reactiontime += 15; self->reactiontime += 15;
} }
@ -49,7 +49,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft) DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
{ {
self->angle += ANGLE_90/16; 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) if (misl != NULL)
{ {
misl->velz += FRACUNIT; misl->velz += FRACUNIT;
@ -59,7 +59,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight) DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight)
{ {
self->angle -= ANGLE_90/16; 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) if (misl != NULL)
{ {
misl->velz += FRACUNIT; misl->velz += FRACUNIT;

View file

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

View file

@ -35,9 +35,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide)
{ {
self->SetState (self->FindState("Grenade")); 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")); self->SetState (self->FindState("Jump"));
} }
@ -53,20 +53,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
A_FaceTarget (self); A_FaceTarget (self);
self->z += 32*FRACUNIT; self->AddZ(32*FRACUNIT);
self->angle -= ANGLE_45/32; 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) if (proj != NULL)
{ {
proj->velz += 9*FRACUNIT; proj->velz += 9*FRACUNIT;
} }
self->angle += ANGLE_45/16; 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) if (proj != NULL)
{ {
proj->velz += 16*FRACUNIT; proj->velz += 16*FRACUNIT;
} }
self->z -= 32*FRACUNIT; self->AddZ(-32*FRACUNIT);
} }
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump) DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
@ -79,7 +79,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
return; return;
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM); S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
self->z += 64*FRACUNIT; self->AddZ(64*FRACUNIT);
A_FaceTarget (self); A_FaceTarget (self);
an = self->angle >> ANGLETOFINESHIFT; an = self->angle >> ANGLETOFINESHIFT;
speed = self->Speed * 2/3; speed = self->Speed * 2/3;
@ -91,7 +91,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
{ {
dist = 1; dist = 1;
} }
self->velz = (self->target->z - self->z) / dist; self->velz = (self->target->Z() - self->Z()) / dist;
self->reactiontime = 60; self->reactiontime = 60;
self->flags |= MF_NOGRAVITY; self->flags |= MF_NOGRAVITY;
} }
@ -102,7 +102,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
if (self->reactiontime < 0 || if (self->reactiontime < 0 ||
self->velx == 0 || self->velx == 0 ||
self->vely == 0 || self->vely == 0 ||
self->z <= self->floorz) self->Z() <= self->floorz)
{ {
self->SetState (self->SeeState); self->SetState (self->SeeState);
self->reactiontime = 0; self->reactiontime = 0;
@ -119,7 +119,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
DEFINE_ACTION_FUNCTION(AActor, A_TossArm) 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->angle = self->angle - ANGLE_90 + (pr_inq.Random2() << 22);
foo->velx = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]) >> 3; foo->velx = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]) >> 3;
foo->vely = FixedMul (foo->Speed, finesine[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) int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
{ {
FVector3 thrust;
if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST)) if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST))
{ {
thrust.X = float(target->x - victim->x); fixedvec3 fixthrust = victim->Vec3To(target);
thrust.Y = float(target->y - victim->y); TVector3<double> thrust(fixthrust.x, fixthrust.y, fixthrust.z);
thrust.Z = float(target->z - victim->z);
thrust.MakeUnit(); 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->velx += fixed_t(thrust.X);
victim->vely += fixed_t(thrust.Y); 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) DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain)
{ {
S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM);
Spawn("LoreShot2", self->x, self->y, self->z, ALLOW_REPLACE); Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE);
Spawn("LoreShot2", self->x - (self->velx >> 1), self->y - (self->vely >> 1), self->z - (self->velz >> 1), ALLOW_REPLACE); Spawn("LoreShot2", self->Vec3Offset(-(self->velx >> 1), -(self->vely >> 1), -(self->velz >> 1)), ALLOW_REPLACE);
Spawn("LoreShot2", self->x - self->velx, self->y - self->vely, self->z - self->velz, 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) if (self->target == NULL)
return; 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) if (spot != NULL)
{ {
spot->threshold = 25; spot->threshold = 25;
@ -122,7 +122,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase) 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) if (foo != NULL)
{ {
foo->angle = self->angle + ANGLE_180 + (pr_prog.Random2() << 22); foo->angle = self->angle + ANGLE_180 + (pr_prog.Random2() << 22);

View file

@ -75,8 +75,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
AActor *rebel; AActor *rebel;
angle_t an; angle_t an;
rebel = Spawn("Rebel1", self->x, self->y, self->floorz, ALLOW_REPLACE); rebel = Spawn("Rebel1", self->X(), self->Y(), self->floorz, ALLOW_REPLACE);
if (!P_TryMove (rebel, rebel->x, rebel->y, true)) if (!P_TryMove (rebel, rebel->X(), rebel->Y(), true))
{ {
rebel->Destroy (); rebel->Destroy ();
return; return;
@ -112,7 +112,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
rebel->SetState (rebel->SeeState); rebel->SetState (rebel->SeeState);
rebel->angle = self->angle; rebel->angle = self->angle;
an = self->angle >> ANGLETOFINESHIFT; 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) if (--self->health < 0)
{ {
self->SetState(self->FindState(NAME_Death)); self->SetState(self->FindState(NAME_Death));

View file

@ -27,7 +27,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
{ {
minz = maxz; minz = maxz;
} }
if (minz < self->z) if (minz < self->Z())
{ {
self->velz -= FRACUNIT; self->velz -= FRACUNIT;
} }
@ -35,7 +35,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
{ {
self->velz += FRACUNIT; self->velz += FRACUNIT;
} }
self->reactiontime = (minz >= self->z) ? 4 : 0; self->reactiontime = (minz >= self->Z()) ? 4 : 0;
} }
DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack) DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
@ -48,16 +48,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
return; 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) if (missile != NULL && (missile->velx | missile->vely) != 0)
{ {
for (int i = 8; i > 1; --i) for (int i = 8; i > 1; --i)
{ {
trail = Spawn("SentinelFX1", trail = Spawn("SentinelFX1",
self->x + FixedMul (missile->radius * i, finecosine[missile->angle >> ANGLETOFINESHIFT]), self->Vec3Angle(missile->radius*i, missile->angle, (missile->velz / 4 * i)), ALLOW_REPLACE);
self->y + FixedMul (missile->radius * i, finesine[missile->angle >> ANGLETOFINESHIFT]),
missile->z + (missile->velz / 4 * i), ALLOW_REPLACE);
if (trail != NULL) if (trail != NULL)
{ {
trail->target = self; trail->target = self;
@ -67,7 +65,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
P_CheckMissileSpawn (trail, self->radius); 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) 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->angle = self->angle;
foo->FriendPlayer = self->FriendPlayer; foo->FriendPlayer = self->FriendPlayer;
@ -53,7 +53,6 @@ static FRandom pr_zap5 ("Zap5");
DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning) DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
{ {
AActor *flash; AActor *flash;
fixed_t x, y;
if (self->threshold != 0) if (self->threshold != 0)
--self->threshold; --self->threshold;
@ -61,17 +60,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
self->velx += pr_zap5.Random2(3) << FRACBITS; self->velx += pr_zap5.Random2(3) << FRACBITS;
self->vely += pr_zap5.Random2(3) << FRACBITS; self->vely += pr_zap5.Random2(3) << FRACBITS;
x = self->x + pr_zap5.Random2(3) * FRACUNIT * 50; fixedvec2 pos = self->Vec2Offset(
y = self->y + pr_zap5.Random2(3) * FRACUNIT * 50; pr_zap5.Random2(3) * FRACUNIT * 50,
pr_zap5.Random2(3) * FRACUNIT * 50);
flash = Spawn (self->threshold > 25 ? PClass::FindClass(NAME_SpectralLightningV2) : 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->target = self->target;
flash->velz = -18*FRACUNIT; flash->velz = -18*FRACUNIT;
flash->FriendPlayer = self->FriendPlayer; 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->target = self->target;
flash->velz = -18*FRACUNIT; flash->velz = -18*FRACUNIT;
@ -128,11 +128,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
} }
if (dest->height >= 56*FRACUNIT) if (dest->height >= 56*FRACUNIT)
{ {
slope = (dest->z+40*FRACUNIT - self->z) / dist; slope = (dest->Z()+40*FRACUNIT - self->Z()) / dist;
} }
else 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) if (slope < self->velz)
{ {

View file

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

View file

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

View file

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

View file

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

View file

@ -843,10 +843,11 @@ void P_DisconnectEffect (AActor *actor)
if (!p) if (!p)
break; break;
fixedvec3 pos = actor->Vec3Offset(
((M_Random()-128)<<9) * (actor->radius>>FRACBITS), fixed_t xo = ((M_Random() - 128) << 9) * (actor->radius >> FRACBITS);
((M_Random()-128)<<9) * (actor->radius>>FRACBITS), fixed_t yo = ((M_Random() - 128) << 9) * (actor->radius >> FRACBITS);
(M_Random()<<8) * (actor->height>>FRACBITS)); fixed_t zo = (M_Random() << 8) * (actor->height >> FRACBITS);
fixedvec3 pos = actor->Vec3Offset(xo, yo, zo);
p->x = pos.x; p->x = pos.x;
p->y = pos.y; p->y = pos.y;
p->z = pos.z; 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); 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); 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_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_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator);
void P_RipperBlood (AActor *mo, AActor *bleeder); 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) if (!buggy || numgamenodes == 0)
{ {
sec = P_PointInSector (x, y); sec = P_PointInSector (X(), Y());
} }
else else
{ {
@ -344,7 +344,7 @@ void AActor::LinkToWorld (sector_t *sec)
return; return;
} }
Sector = sec; 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) ) 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 // When a node is deleted, its sector links (the links starting
// at sector_t->touching_thinglist) are broken. When a node is // at sector_t->touching_thinglist) are broken. When a node is
// added, new sector links are created. // added, new sector links are created.
P_CreateSecNodeList (this, x, y); P_CreateSecNodeList (this, X(), Y());
touching_sectorlist = sector_list; // Attach to thing touching_sectorlist = sector_list; // Attach to thing
sector_list = NULL; // clear for next time 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) // link into blockmap (inert things don't need to be in the blockmap)
if ( !(flags & MF_NOBLOCKMAP) ) if ( !(flags & MF_NOBLOCKMAP) )
{ {
int x1 = GetSafeBlockX(x - radius - bmaporgx); int x1 = GetSafeBlockX(X() - radius - bmaporgx);
int x2 = GetSafeBlockX(x + radius - bmaporgx); int x2 = GetSafeBlockX(X() + radius - bmaporgx);
int y1 = GetSafeBlockY(y - radius - bmaporgy); int y1 = GetSafeBlockY(Y() - radius - bmaporgy);
int y2 = GetSafeBlockY(y + radius - bmaporgy); int y2 = GetSafeBlockY(Y() + radius - bmaporgy);
if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0) if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0)
{ // thing is off the map { // thing is off the map
@ -496,7 +496,7 @@ sector_t *AActor::LinkToWorldForMapThing ()
// that lies directly on a line should always be // that lies directly on a line should always be
// considered as "in front" of the line. The orientation // considered as "in front" of the line. The orientation
// of the line should be irrelevant. // 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)); 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 // 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. // the line would not be included as one of its subsector's segs.
int blockx = GetSafeBlockX(x - bmaporgx); int blockx = GetSafeBlockX(X() - bmaporgx);
int blocky = GetSafeBlockY(y - bmaporgy); int blocky = GetSafeBlockY(Y() - bmaporgy);
if ((unsigned int)blockx < (unsigned int)bmapwidth && if ((unsigned int)blockx < (unsigned int)bmapwidth &&
(unsigned int)blocky < (unsigned int)bmapheight) (unsigned int)blocky < (unsigned int)bmapheight)
@ -536,10 +536,10 @@ sector_t *AActor::LinkToWorldForMapThing ()
} }
// Not inside the line's bounding box // Not inside the line's bounding box
if (x + radius <= ldef->bbox[BOXLEFT] if (X() + radius <= ldef->bbox[BOXLEFT]
|| x - radius >= ldef->bbox[BOXRIGHT] || X() - radius >= ldef->bbox[BOXRIGHT]
|| y + radius <= ldef->bbox[BOXBOTTOM] || Y() + radius <= ldef->bbox[BOXBOTTOM]
|| y - radius >= ldef->bbox[BOXTOP] ) || Y() - radius >= ldef->bbox[BOXTOP] )
continue; continue;
// Get the exact distance to the line // Get the exact distance to the line
@ -548,8 +548,8 @@ sector_t *AActor::LinkToWorldForMapThing ()
P_MakeDivline (ldef, &dll); P_MakeDivline (ldef, &dll);
dlv.x = x; dlv.x = X();
dlv.y = y; dlv.y = Y();
dlv.dx = FixedDiv(dll.dy, linelen); dlv.dx = FixedDiv(dll.dy, linelen);
dlv.dy = -FixedDiv(dll.dx, linelen); dlv.dy = -FixedDiv(dll.dx, linelen);
@ -558,7 +558,7 @@ sector_t *AActor::LinkToWorldForMapThing ()
if (distance < radius) if (distance < radius)
{ {
DPrintf ("%s at (%d,%d) lies on %s line %td, distance = %f\n", 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->dx == 0? "vertical" : ldef->dy == 0? "horizontal" : "diagonal",
ldef-lines, FIXED2FLOAT(distance)); ldef-lines, FIXED2FLOAT(distance));
angle_t finean = R_PointToAngle2 (0, 0, ldef->dx, ldef->dy); 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 // Get the distance we have to move the object away from the wall
distance = radius - distance; distance = radius - distance;
x += FixedMul(distance, finecosine[finean]); SetXY(X() + FixedMul(distance, finecosine[finean]), Y() + FixedMul(distance, finesine[finean]));
y += FixedMul(distance, finesine[finean]); return P_PointInSector (X(), Y());
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) void AActor::SetOrigin (fixed_t ix, fixed_t iy, fixed_t iz, bool moving)
{ {
UnlinkFromWorld (); UnlinkFromWorld ();
x = ix; SetXYZ(ix, iy, iz);
y = iy; if (moving) SetMovement(ix - X(), iy - Y(), iz - Z());
z = iz;
LinkToWorld (); LinkToWorld ();
floorz = Sector->floorplane.ZatPoint (ix, iy); floorz = Sector->floorplane.ZatPoint (ix, iy);
ceilingz = Sector->ceilingplane.ZatPoint (ix, iy); ceilingz = Sector->ceilingplane.ZatPoint (ix, iy);
@ -878,8 +876,8 @@ AActor *FBlockThingsIterator::Next(bool centeronly)
fixed_t blocktop = blockbottom + MAPBLOCKSIZE; fixed_t blocktop = blockbottom + MAPBLOCKSIZE;
// only return actors with the center in this block // only return actors with the center in this block
if (me->x >= blockleft && me->x < blockright && if (me->X() >= blockleft && me->X() < blockright &&
me->y >= blockbottom && me->y < blocktop) me->Y() >= blockbottom && me->Y() < blocktop)
{ {
return me; return me;
} }
@ -1028,29 +1026,29 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
switch (i) switch (i)
{ {
case 0: // Top edge case 0: // Top edge
line.x = thing->x + thing->radius; line.x = thing->X() + thing->radius;
line.y = thing->y + thing->radius; line.y = thing->Y() + thing->radius;
line.dx = -thing->radius * 2; line.dx = -thing->radius * 2;
line.dy = 0; line.dy = 0;
break; break;
case 1: // Right edge case 1: // Right edge
line.x = thing->x + thing->radius; line.x = thing->X() + thing->radius;
line.y = thing->y - thing->radius; line.y = thing->Y() - thing->radius;
line.dx = 0; line.dx = 0;
line.dy = thing->radius * 2; line.dy = thing->radius * 2;
break; break;
case 2: // Bottom edge case 2: // Bottom edge
line.x = thing->x - thing->radius; line.x = thing->X() - thing->radius;
line.y = thing->y - thing->radius; line.y = thing->Y() - thing->radius;
line.dx = thing->radius * 2; line.dx = thing->radius * 2;
line.dy = 0; line.dy = 0;
break; break;
case 3: // Left edge case 3: // Left edge
line.x = thing->x - thing->radius; line.x = thing->X() - thing->radius;
line.y = thing->y + thing->radius; line.y = thing->Y() + thing->radius;
line.dx = 0; line.dx = 0;
line.dy = thing->radius * -2; line.dy = thing->radius * -2;
break; break;
@ -1107,19 +1105,19 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
// check a corner to corner crossection for hit // check a corner to corner crossection for hit
if (tracepositive) if (tracepositive)
{ {
x1 = thing->x - thing->radius; x1 = thing->X() - thing->radius;
y1 = thing->y + thing->radius; y1 = thing->Y() + thing->radius;
x2 = thing->x + thing->radius; x2 = thing->X() + thing->radius;
y2 = thing->y - thing->radius; y2 = thing->Y() - thing->radius;
} }
else else
{ {
x1 = thing->x - thing->radius; x1 = thing->X() - thing->radius;
y1 = thing->y - thing->radius; y1 = thing->Y() - thing->radius;
x2 = thing->x + thing->radius; x2 = thing->X() + thing->radius;
y2 = thing->y + thing->radius; y2 = thing->Y() + thing->radius;
} }
s1 = P_PointOnDivlineSide (x1, y1, &trace); s1 = P_PointOnDivlineSide (x1, y1, &trace);
@ -1422,8 +1420,8 @@ AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, in
int count; int count;
AActor *target; AActor *target;
startX = GetSafeBlockX(mo->x-bmaporgx); startX = GetSafeBlockX(mo->X()-bmaporgx);
startY = GetSafeBlockY(mo->y-bmaporgy); startY = GetSafeBlockY(mo->Y()-bmaporgy);
validcount++; validcount++;
if (startX >= 0 && startX < bmapwidth && startY >= 0 && startY < bmapheight) 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 () void P_FreeLevelData ()
{ {
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
Renderer->CleanLevelData(); Renderer->CleanLevelData();
FPolyObj::ClearAllSubsectorLinks(); // can't be done as part of the polyobj deletion process. FPolyObj::ClearAllSubsectorLinks(); // can't be done as part of the polyobj deletion process.
SN_StopAllSequences (); SN_StopAllSequences ();
@ -3610,7 +3611,6 @@ void P_SetupLevel (const char *lumpname, int position)
// Free all level data from the previous map // Free all level data from the previous map
P_FreeLevelData (); P_FreeLevelData ();
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
MapData *map = P_OpenMapData(lumpname, true); MapData *map = P_OpenMapData(lumpname, true);
if (map == NULL) if (map == NULL)

View file

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

View file

@ -433,7 +433,7 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
{ {
// Falling, not all the way down yet? // Falling, not all the way down yet?
sector = player->mo->Sector; 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) && !player->mo->waterlevel)
{ {
return; return;
@ -510,7 +510,7 @@ static void DoSectorDamage(AActor *actor, sector_t *sec, int amount, FName type,
if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL) if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL)
return; 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; return;
if (protectClass != NULL) if (protectClass != NULL)
@ -556,12 +556,12 @@ void P_SectorDamage(int tag, int amount, FName type, const PClass *protectClass,
z1 = z2; z1 = z2;
z2 = zz; 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 // 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 // damaged (so, anything touching it or above it). Other 3D floors between
// the actor and this one will not stop this effect. // 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 // 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 // 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) if (Sector == NULL)
{ {
Printf("Sector not initialized for SkyCamCompat\n"); 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) if (Sector)
{ {
@ -2189,8 +2189,8 @@ DPusher::DPusher (DPusher::EPusher type, line_t *l, int magnitude, int angle,
if (source) // point source exist? if (source) // point source exist?
{ {
m_Radius = (m_Magnitude) << (FRACBITS+1); // where force goes to zero m_Radius = (m_Magnitude) << (FRACBITS+1); // where force goes to zero
m_X = m_Source->x; m_X = m_Source->X();
m_Y = m_Source->y; m_Y = m_Source->Y();
} }
m_Affectee = affectee; m_Affectee = affectee;
} }
@ -2305,7 +2305,7 @@ void DPusher::Tick ()
{ {
if (hsec == NULL) if (hsec == NULL)
{ // NOT special water sector { // NOT special water sector
if (thing->z > thing->floorz) // above ground if (thing->Z() > thing->floorz) // above ground
{ {
xspeed = m_Xmag; // full force xspeed = m_Xmag; // full force
yspeed = m_Ymag; yspeed = m_Ymag;
@ -2319,7 +2319,7 @@ void DPusher::Tick ()
else // special water sector else // special water sector
{ {
ht = hsec->floorplane.ZatPoint(thing); ht = hsec->floorplane.ZatPoint(thing);
if (thing->z > ht) // above ground if (thing->Z() > ht) // above ground
{ {
xspeed = m_Xmag; // full force xspeed = m_Xmag; // full force
yspeed = m_Ymag; yspeed = m_Ymag;
@ -2347,7 +2347,7 @@ void DPusher::Tick ()
{ // special water sector { // special water sector
floor = &hsec->floorplane; floor = &hsec->floorplane;
} }
if (thing->z > floor->ZatPoint(thing)) if (thing->Z() > floor->ZatPoint(thing))
{ // above ground { // above ground
xspeed = yspeed = 0; // no force xspeed = yspeed = 0; // no force
} }

View file

@ -903,6 +903,10 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag);
// P_TELEPT // 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). 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 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_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); 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); P_MakeDivline (line, &dll);
dlu.x = user->x; fixedvec3 pos = user->PosRelative(line);
dlu.y = user->y; dlu.x = pos.x;
dlu.y = pos.y;
dlu.dx = finecosine[user->angle >> ANGLETOFINESHIFT]; dlu.dx = finecosine[user->angle >> ANGLETOFINESHIFT];
dlu.dy = finesine[user->angle >> ANGLETOFINESHIFT]; dlu.dy = finesine[user->angle >> ANGLETOFINESHIFT];
inter = P_InterceptVector(&dll, &dlu); inter = P_InterceptVector(&dll, &dlu);
@ -167,11 +168,11 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
onesided: onesided:
fixed_t sectorc = front->ceilingplane.ZatPoint(checkx, checky); fixed_t sectorc = front->ceilingplane.ZatPoint(checkx, checky);
fixed_t sectorf = front->floorplane.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. // 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) if (open.range <= 0)
goto onesided; 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_EXISTS)) continue;
if (!(rover->flags & FF_UPPERTEXTURE)) continue; if (!(rover->flags & FF_UPPERTEXTURE)) continue;
if (user->z > rover->top.plane->ZatPoint(checkx, checky) || if (user->Z() > rover->top.plane->ZatPoint(checkx, checky) ||
user->z + user->height < rover->bottom.plane->ZatPoint(checkx, checky)) user->Top() < rover->bottom.plane->ZatPoint(checkx, checky))
continue; continue;
// This 3D floor depicts a switch texture in front of the player's eyes // 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) 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_EXISTS)) continue;
if (!(rover->flags & FF_LOWERTEXTURE)) continue; if (!(rover->flags & FF_LOWERTEXTURE)) continue;
if (user->z > rover->top.plane->ZatPoint(checkx, checky) || if (user->Z() > rover->top.plane->ZatPoint(checkx, checky) ||
user->z + user->height < rover->bottom.plane->ZatPoint(checkx, checky)) user->Top() < rover->bottom.plane->ZatPoint(checkx, checky))
continue; continue;
// This 3D floor depicts a switch texture in front of the player's eyes // 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) 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. // to keep compatibility with Eternity's implementation.
if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot)) if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot))
return false; return false;
return user->z < checktop && user->z + user->height > checkbot; return user->Z() < checktop && user->Top() > checkbot;
} }
else else
{ {
// no switch found. Check whether the player can touch either top or bottom texture // 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)); bool predicting = (thing->player && (thing->player->cheats & CF_PREDICTING));
fixed_t oldx; fixedvec3 old;
fixed_t oldy;
fixed_t oldz;
fixed_t aboveFloor; fixed_t aboveFloor;
player_t *player; player_t *player;
angle_t an; 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 floorheight, ceilingheight;
fixed_t missilespeed; fixed_t missilespeed;
oldx = thing->x; old = thing->Pos();
oldy = thing->y; aboveFloor = thing->Z() - thing->floorz;
oldz = thing->z;
aboveFloor = thing->z - thing->floorz;
destsect = P_PointInSector (x, y); destsect = P_PointInSector (x, y);
// killough 5/12/98: exclude voodoo dolls: // killough 5/12/98: exclude voodoo dolls:
player = thing->player; 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) if (player)
{ {
player->viewz = thing->z + player->viewheight; player->viewz = thing->Z() + player->viewheight;
if (resetpitch) if (resetpitch)
{ {
player->mo->pitch = 0; 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 // Spawn teleport fog at source and destination
if (sourceFog && !predicting) 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) 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; fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT;
an = angle >> ANGLETOFINESHIFT; 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) 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; velx = thing->velx;
vely = thing->vely; vely = thing->vely;
z = searcher->z; z = searcher->Z();
} }
else if (searcher->IsKindOf (PClass::FindClass(NAME_TeleportDest2))) else if (searcher->IsKindOf (PClass::FindClass(NAME_TeleportDest2)))
{ {
z = searcher->z; z = searcher->Z();
} }
else else
{ {
@ -386,7 +382,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool
{ {
badangle = 1 << ANGLETOFINESHIFT; 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 // [RH] Lee Killough's changes for silent teleporters from BOOM
if (!fog && line && keepOrientation) if (!fog && line && keepOrientation)
@ -447,8 +443,8 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
} }
else else
{ {
SQWORD num = (SQWORD)(thing->x-line->v1->x)*line->dx + SQWORD num = (SQWORD)(thing->X()-line->v1->x)*line->dx +
(SQWORD)(thing->y-line->v1->y)*line->dy; (SQWORD)(thing->Y()-line->v1->y)*line->dy;
if (num <= 0) if (num <= 0)
{ {
pos = 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)); pos = (SDWORD)(num / (den>>30));
} }
nposx = thing->x - line->v1->x - MulScale30 (line->dx, pos); nposx = thing->X() - line->v1->x - MulScale30 (line->dx, pos);
nposy = thing->y - line->v1->y - MulScale30 (line->dy, 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); bool stepdown = l->frontsector->floorplane.ZatPoint(x, y) < l->backsector->floorplane.ZatPoint(x, y);
// Height of thing above ground // 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. // 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) static bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool floorz, bool fog)
{ {
int an = (dest->angle - source->angle) >> ANGLETOFINESHIFT; int an = (dest->angle - source->angle) >> ANGLETOFINESHIFT;
fixed_t offX = victim->x - source->x; fixed_t offX = victim->X() - source->X();
fixed_t offY = victim->y - source->y; fixed_t offY = victim->Y() - source->Y();
angle_t offAngle = victim->angle - source->angle; angle_t offAngle = victim->angle - source->angle;
fixed_t newX = DMulScale16 (offX, finecosine[an], -offY, finesine[an]); fixed_t newX = DMulScale16 (offX, finecosine[an], -offY, finesine[an]);
fixed_t newY = DMulScale16 (offX, finesine[an], offY, finecosine[an]); fixed_t newY = DMulScale16 (offX, finesine[an], offY, finecosine[an]);
bool res = bool res =
P_Teleport (victim, dest->x + newX, P_Teleport (victim, dest->X() + newX,
dest->y + newY, dest->Y() + newY,
floorz ? ONFLOORZ : dest->z + victim->z - source->z, floorz ? ONFLOORZ : dest->Z() + victim->Z() - source->Z(),
0, fog, fog, !fog); 0, fog, fog, !fog);
// P_Teleport only changes angle if fog is true // P_Teleport only changes angle if fog is true
victim->angle = dest->angle + offAngle; 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) if (moveSource && didSomething)
{ {
didSomething |= didSomething |=
P_Teleport (sourceOrigin, destOrigin->x, destOrigin->y, P_Teleport (sourceOrigin, destOrigin->X(), destOrigin->Y(),
floorz ? ONFLOORZ : destOrigin->z, 0, false, false, true); floorz ? ONFLOORZ : destOrigin->Z(), 0, false, false, true);
sourceOrigin->angle = destOrigin->angle; 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; caller = temp;
} }
fixed_t oldx = caller->X(); fixedvec3 old = caller->Pos();
fixed_t oldy = caller->Y();
fixed_t oldz = caller->z;
zofs += FixedMul(reference->height, heightoffset); 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 // now the caller's floorz should be appropriate for the assigned xy-position
// assigning position again with. // assigning position again with.
// extra unlink, link and environment calculation // extra unlink, link and environment calculation
caller->SetOrigin( caller->SetOrigin(reference->Vec3Offset(
reference->x + xofs + FixedMul(rad, finecosine[fineangle]), xofs + FixedMul(rad, finecosine[fineangle]),
reference->y + yofs + FixedMul(rad, finesine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]),
reference->z); 0), true);
caller->z = caller->floorz + zofs; caller->SetZ(caller->floorz + zofs);
} }
else else
{ {
caller->SetOrigin( caller->SetOrigin(reference->Vec3Offset(
reference->x + xofs + FixedMul(rad, finecosine[fineangle]), xofs + FixedMul(rad, finecosine[fineangle]),
reference->y + yofs + FixedMul(rad, finesine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]),
reference->z + zofs); zofs), true);
} }
} }
else // [MC] The idea behind "absolute" is meant to be "absolute". Override everything, just like A_SpawnItemEx's. 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) if (flags & WARPF_TOFLOOR)
{ {
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs); caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs);
caller->z = caller->floorz + zofs; caller->SetZ(caller->floorz + zofs);
} }
else else
{ {
@ -756,7 +754,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
{ {
if (flags & WARPF_TESTONLY) if (flags & WARPF_TESTONLY)
{ {
caller->SetOrigin(oldx, oldy, oldz); caller->SetOrigin(old, true);
} }
else else
{ {
@ -783,29 +781,29 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
if (flags & WARPF_WARPINTERPOLATION) if (flags & WARPF_WARPINTERPOLATION)
{ {
caller->PrevX += caller->x - oldx; caller->PrevX += caller->X() - old.x;
caller->PrevY += caller->y - oldy; caller->PrevY += caller->Y() - old.y;
caller->PrevZ += caller->z - oldz; caller->PrevZ += caller->Z() - old.z;
} }
else if (flags & WARPF_COPYINTERPOLATION) else if (flags & WARPF_COPYINTERPOLATION)
{ {
caller->PrevX = caller->x + reference->PrevX - reference->x; caller->PrevX = caller->X() + reference->PrevX - reference->X();
caller->PrevY = caller->y + reference->PrevY - reference->y; caller->PrevY = caller->Y() + reference->PrevY - reference->Y();
caller->PrevZ = caller->z + reference->PrevZ - reference->z; caller->PrevZ = caller->Z() + reference->PrevZ - reference->Z();
} }
else if (!(flags & WARPF_INTERPOLATE)) else if (!(flags & WARPF_INTERPOLATE))
{ {
caller->PrevX = caller->x; caller->PrevX = caller->X();
caller->PrevY = caller->y; caller->PrevY = caller->Y();
caller->PrevZ = caller->z; caller->PrevZ = caller->Z();
} }
if ((flags & WARPF_BOB) && (reference->flags2 & MF2_FLOATBOB)) if ((flags & WARPF_BOB) && (reference->flags2 & MF2_FLOATBOB))
{ {
caller->z += reference->GetBobOffset(); caller->AddZ(reference->GetBobOffset());
} }
} }
return true; return true;
} }
caller->SetOrigin(oldx, oldy, oldz); caller->SetOrigin(old, true);
return false; return false;
} }

View file

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

View file

@ -671,10 +671,10 @@ void APlayerPawn::PostBeginPlay()
// Voodoo dolls: restore original floorz/ceilingz logic // Voodoo dolls: restore original floorz/ceilingz logic
if (player == NULL || player->mo != this) if (player == NULL || player->mo != this)
{ {
dropoffz = floorz = Sector->floorplane.ZatPoint(x, y); dropoffz = floorz = Sector->floorplane.ZatPoint(this);
ceilingz = Sector->ceilingplane.ZatPoint(x, y); ceilingz = Sector->ceilingplane.ZatPoint(this);
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS); P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS);
z = floorz; SetZ(floorz);
} }
else else
{ {
@ -1553,7 +1553,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullPop)
} }
self->flags &= ~MF_SOLID; 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->target = self;
mo->velx = pr_skullpop.Random2() << 9; mo->velx = pr_skullpop.Random2() << 9;
mo->vely = 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) 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) if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
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; 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 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; player->viewz -= player->mo->floorclip;
} }
@ -1863,7 +1863,7 @@ void P_MovePlayer (player_t *player)
mo->angle += cmd->ucmd.yaw << 16; 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: // 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), 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->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; msecnode_t *n = player->mo->touching_sectorlist;
while (n != NULL) while (n != NULL)
{ {
@ -2052,7 +2052,7 @@ void P_DeathThink (player_t *player)
P_MovePsprites (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))) if (player->mo->IsKindOf (RUNTIME_CLASS(APlayerChunk)))
{ // Flying bloody skull or flying ice chunk { // Flying bloody skull or flying ice chunk
player->viewheight = 6 * FRACUNIT; player->viewheight = 6 * FRACUNIT;
@ -2165,7 +2165,7 @@ void P_CrouchMove(player_t * player, int direction)
// check whether the move is ok // check whether the move is ok
player->mo->height = FixedMul(defaultheight, player->crouchfactor); 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; player->mo->height = savedheight;
if (direction > 0) if (direction > 0)
@ -2182,7 +2182,7 @@ void P_CrouchMove(player_t * player, int direction)
player->crouchviewdelta = player->viewheight - player->mo->ViewHeight; player->crouchviewdelta = player->viewheight - player->mo->ViewHeight;
// Check for eyes going above/below fake floor due to crouching motion. // 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)) 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", 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->mo->angle>>ANGLETOFINESHIFT, player->cmd.ucmd.buttons,
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove, player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,
player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove); player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove);
@ -2329,7 +2329,7 @@ void P_PlayerThink (player_t *player)
player->crouching = 0; player->crouching = 0;
} }
if (crouchdir == 1 && player->crouchfactor < FRACUNIT && 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); P_CrouchMove(player, 1);
} }
@ -2542,8 +2542,7 @@ void P_PlayerThink (player_t *player)
P_PlayerOnSpecial3DFloor (player); P_PlayerOnSpecial3DFloor (player);
P_PlayerInSpecialSector (player); P_PlayerInSpecialSector (player);
if (player->mo->z <= player->mo->Sector->floorplane.ZatPoint( if (player->mo->Z() <= player->mo->Sector->floorplane.ZatPoint(player->mo) ||
player->mo->x, player->mo->y) ||
player->mo->waterlevel) player->mo->waterlevel)
{ {
// Player must be touching the floor // Player must be touching the floor
@ -2697,7 +2696,7 @@ void P_PredictPlayer (player_t *player)
PredictionPlayerBackup = *player; PredictionPlayerBackup = *player;
APlayerPawn *act = player->mo; 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->flags &= ~MF_PICKUP;
act->flags2 &= ~MF2_PUSHWALL; 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 // Z is not compared as lifts will alter this with no apparent change
// Make lerping less picky by only testing whole units // Make lerping less picky by only testing whole units
DoLerp = ((PredictionLast.x >> 16) != (player->mo->x >> 16) || DoLerp = ((PredictionLast.x >> 16) != (player->mo->X() >> 16) ||
(PredictionLast.y >> 16) != (player->mo->y >> 16)); (PredictionLast.y >> 16) != (player->mo->Y() >> 16));
// Aditional Debug information // Aditional Debug information
if (developer && DoLerp) if (developer && DoLerp)
{ {
DPrintf("Lerp! Ltic (%d) && Ptic (%d) | Lx (%d) && Px (%d) | Ly (%d) && Py (%d)\n", DPrintf("Lerp! Ltic (%d) && Ptic (%d) | Lx (%d) && Px (%d) | Ly (%d) && Py (%d)\n",
PredictionLast.gametic, i, PredictionLast.gametic, i,
(PredictionLast.x >> 16), (player->mo->x >> 16), (PredictionLast.x >> 16), (player->mo->X() >> 16),
(PredictionLast.y >> 16), (player->mo->y >> 16)); (PredictionLast.y >> 16), (player->mo->Y() >> 16));
} }
} }
} }
@ -2796,9 +2795,9 @@ void P_PredictPlayer (player_t *player)
} }
PredictionLast.gametic = maxtic - 1; PredictionLast.gametic = maxtic - 1;
PredictionLast.x = player->mo->x; PredictionLast.x = player->mo->X();
PredictionLast.y = player->mo->y; PredictionLast.y = player->mo->Y();
PredictionLast.z = player->mo->z; PredictionLast.z = player->mo->Z();
if (PredictionLerptics > 0) if (PredictionLerptics > 0)
{ {
@ -2806,9 +2805,7 @@ void P_PredictPlayer (player_t *player)
P_LerpCalculate(PredictionLerpFrom, PredictionLast, PredictionLerpResult, (float)PredictionLerptics * cl_predict_lerpscale)) P_LerpCalculate(PredictionLerpFrom, PredictionLast, PredictionLerpResult, (float)PredictionLerptics * cl_predict_lerpscale))
{ {
PredictionLerptics++; PredictionLerptics++;
player->mo->x = PredictionLerpResult.x; player->mo->SetXYZ(PredictionLerpResult.x, PredictionLerpResult.y, PredictionLerpResult.z);
player->mo->y = PredictionLerpResult.y;
player->mo->z = PredictionLerpResult.z;
} }
else else
{ {
@ -2840,7 +2837,7 @@ void P_UnPredictPlayer ()
player->camera = savedcamera; player->camera = savedcamera;
act->UnlinkFromWorld(); 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. // The blockmap ordering needs to remain unchanged, too.
// Restore sector links and refrences. // Restore sector links and refrences.
@ -3114,7 +3111,7 @@ void player_t::Serialize (FArchive &arc)
} }
else 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) 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} }; mapthinghexen_t mt = { 0, 0, 0, 0, 0, 0, 0, 0, {0} };
AActor *mo = players[consoleplayer].mo; AActor *mo = players[consoleplayer].mo;
mt.x = LittleShort(short(mo->x >> FRACBITS)); mt.x = LittleShort(short(mo->X() >> FRACBITS));
mt.y = LittleShort(short(mo->y >> FRACBITS)); mt.y = LittleShort(short(mo->Y() >> FRACBITS));
mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360))); mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360)));
mt.type = LittleShort((short)1); mt.type = LittleShort((short)1);
mt.flags = LittleShort((short)(7|224|MTF_SINGLE)); 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; actor->vely += thrustY;
if (crush) if (crush)
{ {
if (bHurtOnTouch || !P_CheckMove (actor, actor->x + thrustX, actor->y + thrustY)) fixedvec2 pos = actor->Vec2Offset(thrustX, thrustY);
if (bHurtOnTouch || !P_CheckMove (actor, pos.x, pos.y))
{ {
int newdam = P_DamageMobj (actor, NULL, NULL, crush, NAME_Crush); int newdam = P_DamageMobj (actor, NULL, NULL, crush, NAME_Crush);
P_TraceBleed (newdam > 0 ? newdam : crush, actor); P_TraceBleed (newdam > 0 ? newdam : crush, actor);
@ -1199,8 +1200,8 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
&& !((mobj->flags & MF_FLOAT) && (ld->flags & ML_BLOCK_FLOATERS)) && !((mobj->flags & MF_FLOAT) && (ld->flags & ML_BLOCK_FLOATERS))
&& (!(ld->flags & ML_3DMIDTEX) || && (!(ld->flags & ML_3DMIDTEX) ||
(!P_LineOpening_3dMidtex(mobj, ld, open) && (!P_LineOpening_3dMidtex(mobj, ld, open) &&
(mobj->z + mobj->height < open.top) (mobj->Top() < open.top)
) || (open.abovemidtex && mobj->z > mobj->floorz)) ) || (open.abovemidtex && mobj->Z() > mobj->floorz))
) )
{ {
// [BL] We can't just continue here since we must // [BL] We can't just continue here since we must
@ -1213,7 +1214,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
performBlockingThrust = true; performBlockingThrust = true;
} }
FBoundingBox box(mobj->x, mobj->y, mobj->radius); FBoundingBox box(mobj->X(), mobj->Y(), mobj->radius);
if (box.Right() <= ld->bbox[BOXLEFT] if (box.Right() <= ld->bbox[BOXLEFT]
|| box.Left() >= ld->bbox[BOXRIGHT] || box.Left() >= ld->bbox[BOXRIGHT]
@ -1231,15 +1232,15 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
// Best use the one facing the player and ignore the back side. // Best use the one facing the player and ignore the back side.
if (ld->sidedef[1] != NULL) if (ld->sidedef[1] != NULL)
{ {
int side = P_PointOnLineSidePrecise(mobj->x, mobj->y, ld); int side = P_PointOnLineSidePrecise(mobj->X(), mobj->Y(), ld);
if (ld->sidedef[side] != sd) if (ld->sidedef[side] != sd)
{ {
continue; continue;
} }
// [BL] See if we hit below the floor/ceiling of the poly. // [BL] See if we hit below the floor/ceiling of the poly.
else if(!performBlockingThrust && ( else if(!performBlockingThrust && (
mobj->z < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) || mobj->Z() < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) ||
mobj->z + mobj->height > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj) mobj->Top() > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj)
)) ))
{ {
performBlockingThrust = true; performBlockingThrust = true;

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

View file

@ -1224,9 +1224,10 @@ void R_DrawSkyBoxes ()
extralight = 0; extralight = 0;
R_SetVisibility (sky->args[0] * 0.25f); R_SetVisibility (sky->args[0] * 0.25f);
viewx = sky->PrevX + FixedMul(r_TicFrac, sky->x - sky->PrevX); fixedvec3 viewpos = sky->InterpolatedPosition(r_TicFrac);
viewy = sky->PrevY + FixedMul(r_TicFrac, sky->y - sky->PrevY); viewx = viewpos.x;
viewz = sky->PrevZ + FixedMul(r_TicFrac, sky->z - sky->PrevZ); viewy = viewpos.y;
viewz = viewpos.z;
viewangle = savedangle + sky->PrevAngle + FixedMul(r_TicFrac, sky->angle - sky->PrevAngle); viewangle = savedangle + sky->PrevAngle + FixedMul(r_TicFrac, sky->angle - sky->PrevAngle);
R_CopyStackedViewParameters(); R_CopyStackedViewParameters();
@ -1235,8 +1236,8 @@ void R_DrawSkyBoxes ()
{ {
extralight = pl->extralight; extralight = pl->extralight;
R_SetVisibility (pl->visibility); R_SetVisibility (pl->visibility);
viewx = pl->viewx - sky->Mate->x + sky->x; viewx = pl->viewx - sky->Mate->X() + sky->X();
viewy = pl->viewy - sky->Mate->y + sky->y; viewy = pl->viewy - sky->Mate->Y() + sky->Y();
viewz = pl->viewz; viewz = pl->viewz;
viewangle = pl->viewangle; 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 // [RH] Interpolate the sprite's position to make it look smooth
fx = thing->PrevX + FixedMul (r_TicFrac, thing->x - thing->PrevX); fixedvec3 pos = thing->InterpolatedPosition(r_TicFrac);
fy = thing->PrevY + FixedMul (r_TicFrac, thing->y - thing->PrevY); fx = pos.x;
fz = thing->PrevZ + FixedMul (r_TicFrac, thing->z - thing->PrevZ) + thing->GetBobOffset(r_TicFrac); fy = pos.y;
fz = pos.z +thing->GetBobOffset(r_TicFrac);
tex = NULL; tex = NULL;
voxel = 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->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->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); 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 && player - players == consoleplayer &&
camera == player->mo && camera == player->mo &&
!demoplayback && !demoplayback &&
iview->nviewx == camera->x && iview->nviewx == camera->X() &&
iview->nviewy == camera->y && iview->nviewy == camera->Y() &&
!(player->cheats & (CF_TOTALLYFROZEN|CF_FROZEN)) && !(player->cheats & (CF_TOTALLYFROZEN|CF_FROZEN)) &&
player->playerstate == PST_LIVE && player->playerstate == PST_LIVE &&
player->mo->reactiontime == 0 && player->mo->reactiontime == 0 &&
@ -839,9 +839,9 @@ void R_SetupFrame (AActor *actor)
} }
else else
{ {
iview->nviewx = camera->x; iview->nviewx = camera->X();
iview->nviewy = camera->y; iview->nviewy = camera->Y();
iview->nviewz = camera->player ? camera->player->viewz : camera->z + camera->GetClass()->Meta.GetMetaFixed(AMETA_CameraHeight); iview->nviewz = camera->player ? camera->player->viewz : camera->Z() + camera->GetClass()->Meta.GetMetaFixed(AMETA_CameraHeight);
viewsector = camera->Sector; viewsector = camera->Sector;
r_showviewer = false; r_showviewer = false;
} }

View file

@ -175,9 +175,10 @@ void S_NoiseDebug (void)
return; return;
} }
listener.X = FIXED2FLOAT(players[consoleplayer].camera->x);
listener.Y = FIXED2FLOAT(players[consoleplayer].camera->z); listener.X = FIXED2FLOAT(players[consoleplayer].camera->SoundX());
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->y); listener.Y = FIXED2FLOAT(players[consoleplayer].camera->SoundZ());
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->SoundY());
// Display the oldest channel first. // Display the oldest channel first.
for (chan = Channels; chan->NextChan != NULL; chan = chan->NextChan) for (chan = Channels; chan->NextChan != NULL; chan = chan->NextChan)
@ -666,9 +667,9 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
if (players[consoleplayer].camera != NULL) if (players[consoleplayer].camera != NULL)
{ {
x = players[consoleplayer].camera->x; x = players[consoleplayer].camera->SoundX();
y = players[consoleplayer].camera->z; y = players[consoleplayer].camera->SoundZ();
z = players[consoleplayer].camera->y; z = players[consoleplayer].camera->SoundY();
} }
else else
{ {
@ -685,9 +686,9 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
// assert(actor != NULL); // assert(actor != NULL);
if (actor != NULL) if (actor != NULL)
{ {
x = actor->x; x = actor->SoundX();
y = actor->z; y = actor->SoundZ();
z = actor->y; z = actor->SoundY();
} }
break; break;
@ -723,7 +724,7 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
{ {
if ((chanflags & CHAN_LISTENERZ) && players[consoleplayer].camera != NULL) if ((chanflags & CHAN_LISTENERZ) && players[consoleplayer].camera != NULL)
{ {
y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->z : 0; y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->SoundZ() : 0;
} }
pos->X = FIXED2FLOAT(x); pos->X = FIXED2FLOAT(x);
pos->Y = FIXED2FLOAT(y); pos->Y = FIXED2FLOAT(y);
@ -763,8 +764,8 @@ static void CalcSectorSoundOrg(const sector_t *sec, int channum, fixed_t *x, fix
// Are we inside the sector? If yes, the closest point is the one we're on. // Are we inside the sector? If yes, the closest point is the one we're on.
if (P_PointInSector(*x, *y) == sec) if (P_PointInSector(*x, *y) == sec)
{ {
*x = players[consoleplayer].camera->x; *x = players[consoleplayer].camera->SoundX();
*y = players[consoleplayer].camera->y; *y = players[consoleplayer].camera->SoundY();
} }
else else
{ {
@ -1567,9 +1568,9 @@ void S_RelinkSound (AActor *from, AActor *to)
{ {
chan->Actor = NULL; chan->Actor = NULL;
chan->SourceType = SOURCE_Unattached; chan->SourceType = SOURCE_Unattached;
chan->Point[0] = FIXED2FLOAT(from->x); chan->Point[0] = FIXED2FLOAT(from->SoundX());
chan->Point[1] = FIXED2FLOAT(from->z); chan->Point[1] = FIXED2FLOAT(from->SoundZ());
chan->Point[2] = FIXED2FLOAT(from->y); chan->Point[2] = FIXED2FLOAT(from->SoundY());
} }
else else
{ {
@ -1959,9 +1960,9 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor)
listener.velocity.Z = listenactor->vely * (TICRATE/65536.f); listener.velocity.Z = listenactor->vely * (TICRATE/65536.f);
*/ */
listener.velocity.Zero(); listener.velocity.Zero();
listener.position.X = FIXED2FLOAT(listenactor->x); listener.position.X = FIXED2FLOAT(listenactor->SoundX());
listener.position.Y = FIXED2FLOAT(listenactor->z); listener.position.Y = FIXED2FLOAT(listenactor->SoundZ());
listener.position.Z = FIXED2FLOAT(listenactor->y); listener.position.Z = FIXED2FLOAT(listenactor->SoundY());
listener.underwater = listenactor->waterlevel == 3; listener.underwater = listenactor->waterlevel == 3;
assert(zones != NULL); assert(zones != NULL);
listener.Environment = zones[listenactor->Sector->ZoneNumber].Environment; listener.Environment = zones[listenactor->Sector->ZoneNumber].Environment;
@ -2640,10 +2641,7 @@ CCMD (loopsound)
} }
else else
{ {
AActor *icon = Spawn("SpeakerIcon", players[consoleplayer].mo->x, AActor *icon = Spawn("SpeakerIcon", players[consoleplayer].mo->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE);
players[consoleplayer].mo->y,
players[consoleplayer].mo->z + 32*FRACUNIT,
ALLOW_REPLACE);
if (icon != NULL) if (icon != NULL)
{ {
S_Sound(icon, CHAN_BODY | CHAN_LOOP, id, 1.f, ATTN_IDLE); S_Sound(icon, CHAN_BODY | CHAN_LOOP, id, 1.f, ATTN_IDLE);

View file

@ -600,9 +600,9 @@ public:
protected: protected:
void Heapify(); void Heapify();
unsigned int Parent(unsigned int i) { return (i + 1u) / 2u - 1u; } unsigned int Parent(unsigned int i) const { return (i + 1u) / 2u - 1u; }
unsigned int Left(unsigned int i) { return (i + 1u) * 2u - 1u; } unsigned int Left(unsigned int i) const { return (i + 1u) * 2u - 1u; }
unsigned int Right(unsigned int i) { return (i + 1u) * 2u; } unsigned int Right(unsigned int i) const { return (i + 1u) * 2u; }
}; };
class HMISong : public MIDIStreamer class HMISong : public MIDIStreamer
@ -630,7 +630,7 @@ protected:
struct TrackInfo; struct TrackInfo;
void ProcessInitialMetaEvents (); 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 (); TrackInfo *FindNextDue ();
static DWORD ReadVarLenHMI(TrackInfo *); static DWORD ReadVarLenHMI(TrackInfo *);
@ -673,7 +673,7 @@ protected:
void AdvanceSong(DWORD time); void AdvanceSong(DWORD time);
void ProcessInitialMetaEvents(); 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(); EventSource FindNextDue();
BYTE *MusHeader; 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. // Play all events for this tick.
do 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(); TrackDue = FindNextDue();
if (new_events != events) 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; DWORD len;
BYTE event, data1 = 0, data2 = 0; BYTE event, data1 = 0, data2 = 0;
@ -584,10 +589,20 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
return events + 3; return events + 3;
} }
sysex_noroom = false;
size_t start_p = track->TrackP;
CHECK_FINISHED CHECK_FINISHED
event = track->TrackBegin[track->TrackP++]; event = track->TrackBegin[track->TrackP++];
CHECK_FINISHED 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) if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND && event != 0xFe)
{ {
// Normal short message // Normal short message
@ -626,17 +641,10 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
data2 = VolumeControllerChange(event & 15, data2); data2 = VolumeControllerChange(event & 15, data2);
} }
events[0] = delay;
events[1] = 0;
if (event != MIDI_META) if (event != MIDI_META)
{ {
events[2] = event | (data1<<8) | (data2<<16); events[2] = event | (data1<<8) | (data2<<16);
} }
else
{
events[2] = MEVT_NOP << 24;
}
events += 3;
if (ReadVarLen == ReadVarLenHMI && (event & 0x70) == (MIDI_NOTEON & 0x70)) if (ReadVarLen == ReadVarLenHMI && (event & 0x70) == (MIDI_NOTEON & 0x70))
{ // HMI note on events include the time until an implied note off event. { // HMI note on events include the time until an implied note off event.
@ -645,14 +653,42 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
} }
else else
{ {
// Skip SysEx events just because I don't want to bother with them. // SysEx events could potentially not have enough room in the buffer...
// The old MIDI player ignored them too, so this won't break
// anything that played before.
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND) if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{ {
len = ReadVarLen(track); len = ReadVarLen(track);
if (len >= (MAX_EVENTS-1)*3*4)
{ // This message will never fit. Throw it away.
track->TrackP += len; 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) else if (event == MIDI_META)
{ {
// It's a meta-event // It's a meta-event
@ -677,7 +713,6 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
events[0] = delay; events[0] = delay;
events[1] = 0; events[1] = 0;
events[2] = (MEVT_TEMPO << 24) | Tempo; events[2] = (MEVT_TEMPO << 24) | Tempo;
events += 3;
break; break;
} }
track->TrackP += len; track->TrackP += len;
@ -720,6 +755,18 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay)
{ {
track->Delay = ReadVarLen(track); 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; return events;
} }

View file

@ -384,6 +384,11 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
event = track->TrackBegin[track->TrackP++]; event = track->TrackBegin[track->TrackP++];
CHECK_FINISHED 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) if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND)
{ {
// Normal short message // Normal short message
@ -582,17 +587,10 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
break; break;
} }
} }
events[0] = delay;
events[1] = 0;
if (event != MIDI_META && (!track->Designated || (track->Designation & DesignationMask))) if (event != MIDI_META && (!track->Designated || (track->Designation & DesignationMask)))
{ {
events[2] = event | (data1<<8) | (data2<<16); events[2] = event | (data1<<8) | (data2<<16);
} }
else
{
events[2] = MEVT_NOP << 24;
}
events += 3;
} }
else else
{ {
@ -612,8 +610,6 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
} }
else else
{ {
events[0] = delay;
events[1] = 0;
BYTE *msg = (BYTE *)&events[3]; BYTE *msg = (BYTE *)&events[3];
if (event == MIDI_SYSEX) if (event == MIDI_SYSEX)
{ // Need to add the SysEx marker to the message. { // 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; *msg++ = 0;
} }
events = (DWORD *)msg;
track->TrackP += len; track->TrackP += len;
} }
} }
@ -659,7 +654,6 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
events[0] = delay; events[0] = delay;
events[1] = 0; events[1] = 0;
events[2] = (MEVT_TEMPO << 24) | Tempo; events[2] = (MEVT_TEMPO << 24) | Tempo;
events += 3;
break; break;
} }
track->TrackP += len; track->TrackP += len;
@ -678,6 +672,18 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
{ {
track->Delay = track->ReadVarLen(); 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; 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. // Play all events for this tick.
do 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(); EventDue = FindNextDue();
if (new_events != events) 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; DWORD len;
BYTE event, data1 = 0, data2 = 0; BYTE event, data1 = 0, data2 = 0;
@ -399,10 +404,20 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
TrackInfo *track = CurrSong; TrackInfo *track = CurrSong;
sysex_noroom = false;
size_t start_p = track->EventP;
CHECK_FINISHED CHECK_FINISHED
event = track->EventChunk[track->EventP++]; event = track->EventChunk[track->EventP++];
CHECK_FINISHED 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) if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND)
{ {
// Normal short message // Normal short message
@ -499,10 +514,6 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
{ {
events[2] = event | (data1<<8) | (data2<<16); events[2] = event | (data1<<8) | (data2<<16);
} }
else
{
events[2] = MEVT_NOP << 24;
}
events += 3; events += 3;
@ -513,14 +524,42 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
} }
else else
{ {
// Skip SysEx events just because I don't want to bother with them. // SysEx events could potentially not have enough room in the buffer...
// The old MIDI player ignored them too, so this won't break
// anything that played before.
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND) if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{ {
len = track->ReadVarLen (); len = track->ReadVarLen();
if (len >= (MAX_EVENTS-1)*3*4)
{ // This message will never fit. Throw it away.
track->EventP += len; 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) else if (event == MIDI_META)
{ {
// It's a meta-event // It's a meta-event
@ -551,6 +590,18 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay)
{ {
track->Delay = track->ReadDelay(); 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; 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(tid, AActor)
DEFINE_MEMBER_VARIABLE(TIDtoHate, AActor) DEFINE_MEMBER_VARIABLE(TIDtoHate, AActor)
DEFINE_MEMBER_VARIABLE(waterlevel, AActor) DEFINE_MEMBER_VARIABLE(waterlevel, AActor)
DEFINE_MEMBER_VARIABLE(x, AActor) DEFINE_MEMBER_VARIABLE_ALIAS(x, __pos.x, AActor)
DEFINE_MEMBER_VARIABLE(y, AActor) DEFINE_MEMBER_VARIABLE_ALIAS(y, __pos.y, AActor)
DEFINE_MEMBER_VARIABLE(z, AActor) DEFINE_MEMBER_VARIABLE_ALIAS(z, __pos.z, AActor)
DEFINE_MEMBER_VARIABLE(velx, AActor) DEFINE_MEMBER_VARIABLE(velx, AActor)
DEFINE_MEMBER_VARIABLE(vely, AActor) DEFINE_MEMBER_VARIABLE(vely, AActor)
DEFINE_MEMBER_VARIABLE(velz, AActor) DEFINE_MEMBER_VARIABLE(velz, AActor)

View file

@ -1228,7 +1228,7 @@ void WI_initDeathmatchStats (void)
acceleratestage = 0; acceleratestage = 0;
memset(playerready, 0, sizeof(playerready)); memset(playerready, 0, sizeof(playerready));
memset(cnt_frags, 0, sizeof(cnt_frags)); 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)); memset(player_deaths, 0, sizeof(player_deaths));
total_frags = 0; total_frags = 0;
total_deaths = 0; total_deaths = 0;

View file

@ -41,7 +41,6 @@ struct wbplayerstruct_t
int stime; int stime;
int frags[MAXPLAYERS]; int frags[MAXPLAYERS];
int fragcount; // [RH] Cumulative frags for this player int fragcount; // [RH] Cumulative frags for this player
}; };
struct wbstartstruct_t struct wbstartstruct_t

View file

@ -208,6 +208,7 @@ enum
TF_USEACTORFOG = 0x00000100, // Use the actor's TeleFogSourceType and TeleFogDestType fogs. TF_USEACTORFOG = 0x00000100, // Use the actor's TeleFogSourceType and TeleFogDestType fogs.
TF_NOJUMP = 0x00000200, // Don't jump after teleporting. TF_NOJUMP = 0x00000200, // Don't jump after teleporting.
TF_OVERRIDE = 0x00000400, // Ignore NOTELEPORT. 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_KEEPORIENTATION = TF_KEEPVELOCITY|TF_KEEPANGLE,
TF_NOFOG = TF_NOSRCFOG|TF_NODESTFOG, TF_NOFOG = TF_NOSRCFOG|TF_NODESTFOG,