Merge branch 'master' into scripting

Conflicts:
	src/actor.h
	src/fragglescript/t_func.cpp
	src/g_doom/a_bossbrain.cpp
	src/g_doom/a_revenant.cpp
	src/g_heretic/a_hereticartifacts.cpp
	src/g_heretic/a_hereticweaps.cpp
	src/g_heretic/a_knight.cpp
	src/g_hexen/a_bishop.cpp
	src/g_hexen/a_clericholy.cpp
	src/g_hexen/a_dragon.cpp
	src/g_hexen/a_firedemon.cpp
	src/g_hexen/a_flechette.cpp
	src/g_hexen/a_heresiarch.cpp
	src/g_hexen/a_hexenspecialdecs.cpp
	src/g_hexen/a_iceguy.cpp
	src/g_hexen/a_korax.cpp
	src/g_hexen/a_magelightning.cpp
	src/g_hexen/a_serpent.cpp
	src/g_hexen/a_spike.cpp
	src/g_hexen/a_wraith.cpp
	src/g_raven/a_minotaur.cpp
	src/g_shared/a_bridge.cpp
	src/g_shared/a_pickups.cpp
	src/g_shared/a_randomspawner.cpp
	src/g_strife/a_alienspectres.cpp
	src/g_strife/a_crusader.cpp
	src/g_strife/a_entityboss.cpp
	src/g_strife/a_inquisitor.cpp
	src/g_strife/a_loremaster.cpp
	src/g_strife/a_programmer.cpp
	src/g_strife/a_sentinel.cpp
	src/g_strife/a_spectral.cpp
	src/g_strife/a_strifestuff.cpp
	src/g_strife/a_strifeweapons.cpp
	src/g_strife/a_thingstoblowup.cpp
	src/p_local.h
	src/r_utility.cpp
This commit is contained in:
Christoph Oelckers 2016-01-19 13:43:11 +01:00
commit bc63b70d88
93 changed files with 874 additions and 762 deletions

View file

@ -144,7 +144,9 @@ void GuillotineBinPack::Insert(TArray<RectSize> &rects, TArray<Rect> &dst, bool
usedRectangles.Push(newNode);
// Check that we're really producing correct packings here.
#ifdef _DEBUG
assert(disjointRects.Add(newNode) == true);
#endif
}
}
@ -355,8 +357,9 @@ Rect GuillotineBinPack::Insert(int width, int height, bool merge, FreeRectChoice
usedRectangles.Push(newRect);
// Check that we're really producing correct packings here.
#ifdef _DEBUG
assert(disjointRects.Add(newRect) == true);
#endif
return newRect;
}
@ -442,7 +445,9 @@ Rect GuillotineBinPack::FindPositionForNewNode(int width, int height, FreeRectCh
bestNode.height = height;
bestScore = INT_MIN;
*nodeIndex = i;
#ifdef _DEBUG
assert(disjointRects.Disjoint(bestNode));
#endif
break;
}
// If this is a perfect fit sideways, choose it.
@ -470,7 +475,9 @@ Rect GuillotineBinPack::FindPositionForNewNode(int width, int height, FreeRectCh
bestNode.height = height;
bestScore = score;
*nodeIndex = i;
#ifdef _DEBUG
assert(disjointRects.Disjoint(bestNode));
#endif
}
}
// Does the rectangle fit sideways?
@ -575,8 +582,10 @@ void GuillotineBinPack::SplitFreeRectAlongAxis(const Rect &freeRect, const Rect
if (right.width > 0 && right.height > 0)
freeRectangles.Push(right);
#ifdef _DEBUG
assert(disjointRects.Disjoint(bottom));
assert(disjointRects.Disjoint(right));
#endif
}
void GuillotineBinPack::MergeFreeList()

View file

@ -69,7 +69,9 @@ void SkylineBinPack::Insert(TArray<RectSize> &rects, TArray<Rect> &dst)
int score2;
int index;
newNode = FindPositionForNewNodeMinWaste(rects[i].width, rects[i].height, score2, score1, index);
#ifdef _DEBUG
assert(disjointRects.Disjoint(newNode));
#endif
if (newNode.height != 0)
{
if (score1 < bestScore1 || (score1 == bestScore1 && score2 < bestScore2))
@ -87,8 +89,8 @@ void SkylineBinPack::Insert(TArray<RectSize> &rects, TArray<Rect> &dst)
return;
// Perform the actual packing.
assert(disjointRects.Disjoint(bestNode));
#ifdef _DEBUG
assert(disjointRects.Disjoint(bestNode));
disjointRects.Add(bestNode);
#endif
AddSkylineLevel(bestSkylineIndex, bestNode);
@ -103,7 +105,9 @@ Rect SkylineBinPack::Insert(int width, int height)
// First try to pack this rectangle into the waste map, if it fits.
Rect node = wasteMap.Insert(width, height, true, GuillotineBinPack::RectBestShortSideFit,
GuillotineBinPack::SplitMaximizeArea);
#ifdef _DEBUG
assert(disjointRects.Disjoint(node));
#endif
if (node.height != 0)
{
@ -113,8 +117,8 @@ Rect SkylineBinPack::Insert(int width, int height)
newNode.width = node.width;
newNode.height = node.height;
usedSurfaceArea += width * height;
assert(disjointRects.Disjoint(newNode));
#ifdef _DEBUG
assert(disjointRects.Disjoint(newNode));
disjointRects.Add(newNode);
#endif
return newNode;
@ -190,7 +194,9 @@ void SkylineBinPack::AddWasteMapArea(int skylineNodeIndex, int width, int height
waste.width = rightSide - leftSide;
waste.height = y - skyLine[skylineNodeIndex].y;
#ifdef _DEBUG
assert(disjointRects.Disjoint(waste));
#endif
wasteMap.GetFreeRectangles().Push(waste);
}
}
@ -264,7 +270,9 @@ Rect SkylineBinPack::InsertBottomLeft(int width, int height)
if (bestIndex != -1)
{
#ifdef _DEBUG
assert(disjointRects.Disjoint(newNode));
#endif
// Perform the actual packing.
AddSkylineLevel(bestIndex, newNode);
@ -300,7 +308,9 @@ Rect SkylineBinPack::FindPositionForNewNodeBottomLeft(int width, int height, int
newNode.y = y;
newNode.width = width;
newNode.height = height;
#ifdef _DEBUG
assert(disjointRects.Disjoint(newNode));
#endif
}
}
/* if (RectangleFits(i, height, width, y))
@ -331,7 +341,9 @@ Rect SkylineBinPack::InsertMinWaste(int width, int height)
if (bestIndex != -1)
{
#ifdef _DEBUG
assert(disjointRects.Disjoint(newNode));
#endif
// Perform the actual packing.
AddSkylineLevel(bestIndex, newNode);
@ -369,7 +381,9 @@ Rect SkylineBinPack::FindPositionForNewNodeMinWaste(int width, int height, int &
newNode.y = y;
newNode.width = width;
newNode.height = height;
#ifdef _DEBUG
assert(disjointRects.Disjoint(newNode));
#endif
}
}
/* if (RectangleFits(i, height, width, y, wastedArea))

View file

@ -924,23 +924,43 @@ public:
return ret;
}
fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy) const
fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy, bool absolute = false) const
{
fixedvec2 ret = { x + dx, y + dy };
return ret;
}
fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz) const
fixedvec2 Vec2Angle(fixed_t length, angle_t angle, bool absolute = false) const
{
fixedvec2 ret = { x + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
y + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
return ret;
}
fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false) const
{
fixedvec3 ret = { x + dx, y + dy, z + dz };
return ret;
}
fixedvec3 Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false) const
{
fixedvec3 ret = { x + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
y + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), z + dz };
return ret;
}
void Move(fixed_t dx, fixed_t dy, fixed_t dz)
{
SetOrigin(x + dx, y + dy, z + dz, true);
}
void SetOrigin(const fixedvec3 & npos, bool moving)
{
SetOrigin(npos.x, npos.y, npos.z, moving);
}
inline void SetFriendPlayer(player_t *player);
bool IsVisibleToPlayer() const;
@ -1200,10 +1220,50 @@ public:
{
return z;
}
void SetZ(fixed_t newz)
fixedvec3 Pos() const
{
fixedvec3 ret = { X(), Y(), Z() };
return ret;
}
fixedvec3 InterpolatedPosition(fixed_t ticFrac) const
{
fixedvec3 ret;
ret.x = PrevX + FixedMul (ticFrac, X() - PrevX);
ret.y = PrevY + FixedMul (ticFrac, Y() - PrevY);
ret.z = PrevZ + FixedMul (ticFrac, Z() - PrevZ);
return ret;
}
fixedvec3 PosPlusZ(fixed_t zadd) const
{
fixedvec3 ret = { X(), Y(), Z() + zadd };
return ret;
}
fixed_t Top() const
{
return z + height;
}
void SetZ(fixed_t newz, bool moving = true)
{
z = newz;
}
void AddZ(fixed_t newz, bool moving = true)
{
z += newz;
}
// These are not for general use as they do not link the actor into the world!
void SetXY(fixed_t xx, fixed_t yy)
{
x = xx;
y = yy;
}
void SetXYZ(fixed_t xx, fixed_t yy, fixed_t zz)
{
x = xx;
y = yy;
z = zz;
}
};
@ -1308,6 +1368,14 @@ inline T *Spawn (const fixedvec3 &pos, replace_t allowreplacement)
return static_cast<T *>(AActor::StaticSpawn (RUNTIME_CLASS(T), pos.x, pos.y, pos.z, allowreplacement));
}
inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
{
fixedvec2 ret = { FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
return ret;
}
void PrintMiscActorInfo(AActor * query);
#define S_FREETARGMOBJ 1

View file

@ -459,7 +459,7 @@ void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
//Emulates missile travel. Returns distance travelled.
fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
{
AActor *th = Spawn ("CajunTrace", source->X(), source->Y(), source->Z() + 4*8*FRACUNIT, NO_REPLACE);
AActor *th = Spawn ("CajunTrace", source->PosPlusZ(4*8*FRACUNIT), NO_REPLACE);
th->target = source; // where it came from

View file

@ -3091,7 +3091,7 @@ bool ADehackedPickup::TryPickup (AActor *&toucher)
{
return false;
}
RealPickup = static_cast<AInventory *>(Spawn (type, X(), Y(), Z(), NO_REPLACE));
RealPickup = static_cast<AInventory *>(Spawn (type, Pos(), NO_REPLACE));
if (RealPickup != NULL)
{
// The internally spawned item should never count towards statistics.

View file

@ -2319,10 +2319,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
else
{
const AActor *def = GetDefaultByType (typeinfo);
fixedvec3 spawnpos = source->Vec3Offset(
FixedMul (def->radius * 2 + source->radius, finecosine[source->angle>>ANGLETOFINESHIFT]),
FixedMul (def->radius * 2 + source->radius, finesine[source->angle>>ANGLETOFINESHIFT]),
8 * FRACUNIT);
fixedvec3 spawnpos = source->Vec3Angle(def->radius * 2 + source->radius, source->angle, 8 * FRACUNIT);
AActor *spawned = Spawn (typeinfo, spawnpos, ALLOW_REPLACE);
if (spawned != NULL)
@ -2376,7 +2373,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
s = ReadString (stream);
if (Trace (players[player].mo->X(), players[player].mo->Y(),
players[player].mo->Z() + players[player].mo->height - (players[player].mo->height>>2),
players[player].mo->Top() - (players[player].mo->height>>2),
players[player].mo->Sector,
vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, players[player].mo,
trace, TRACE_NoSky))

View file

@ -982,7 +982,7 @@ void FParser::SF_ObjX(void)
}
t_return.type = svt_fixed; // haleyjd: SoM's fixed-point fix
t_return.value.f = mo ? mo->x : 0; // null ptr check
t_return.value.f = mo ? mo->X() : 0; // null ptr check
}
//==========================================================================
@ -1005,7 +1005,7 @@ void FParser::SF_ObjY(void)
}
t_return.type = svt_fixed; // haleyjd
t_return.value.f = mo ? mo->y : 0; // null ptr check
t_return.value.f = mo ? mo->Y() : 0; // null ptr check
}
//==========================================================================
@ -1028,7 +1028,7 @@ void FParser::SF_ObjZ(void)
}
t_return.type = svt_fixed; // haleyjd
t_return.value.f = mo ? mo->z : 0; // null ptr check
t_return.value.f = mo ? mo->Z() : 0; // null ptr check
}
@ -1466,8 +1466,8 @@ void FParser::SF_SetCamera(void)
angle = t_argc < 2 ? newcamera->angle : (fixed_t)FixedToAngle(fixedvalue(t_argv[1]));
newcamera->special1=newcamera->angle;
newcamera->special2=newcamera->z;
newcamera->z = t_argc < 3 ? (newcamera->z + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS);
newcamera->special2=newcamera->Z();
newcamera->SetZ(t_argc < 3 ? (newcamera->Z() + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS));
newcamera->angle = angle;
if(t_argc < 4) newcamera->pitch = 0;
else
@ -1498,7 +1498,7 @@ void FParser::SF_ClearCamera(void)
{
player->camera=player->mo;
cam->angle=cam->special1;
cam->z=cam->special2;
cam->SetZ(cam->special2);
}
}
@ -3065,7 +3065,7 @@ void FParser::SF_SetWeapon()
void FParser::SF_MoveCamera(void)
{
fixed_t x, y, z;
fixed_t xdist, ydist, zdist, xydist, movespeed;
fixed_t zdist, xydist, movespeed;
fixed_t xstep, ystep, zstep, targetheight;
angle_t anglespeed, anglestep, angledist, targetangle,
mobjangle, bigangle, smallangle;
@ -3097,9 +3097,8 @@ void FParser::SF_MoveCamera(void)
anglespeed = (angle_t)FixedToAngle(fixedvalue(t_argv[5]));
// figure out how big one step will be
xdist = target->x - cam->x;
ydist = target->y - cam->y;
zdist = targetheight - cam->z;
fixedvec2 dist = cam->Vec2To(target);
zdist = targetheight - cam->Z();
// Angle checking...
// 90
@ -3170,19 +3169,19 @@ void FParser::SF_MoveCamera(void)
else
anglestep = anglespeed;
if(abs(xstep) >= (abs(xdist) - 1))
x = target->x;
if(abs(xstep) >= (abs(dist.x) - 1))
x = cam->X() + dist.x;
else
{
x = cam->x + xstep;
x = cam->X() + xstep;
moved = 1;
}
if(abs(ystep) >= (abs(ydist) - 1))
y = target->y;
if(abs(ystep) >= (abs(dist.y) - 1))
y = cam->Y() + dist.y;
else
{
y = cam->y + ystep;
y = cam->Y() + ystep;
moved = 1;
}
@ -3190,7 +3189,7 @@ void FParser::SF_MoveCamera(void)
z = targetheight;
else
{
z = cam->z + zstep;
z = cam->Z() + zstep;
moved = 1;
}
@ -3212,12 +3211,12 @@ void FParser::SF_MoveCamera(void)
cam->radius=8;
cam->height=8;
if ((x != cam->x || y != cam->y) && !P_TryMove(cam, x, y, true))
if ((x != cam->X() || y != cam->Y()) && !P_TryMove(cam, x, y, true))
{
Printf("Illegal camera move to (%f, %f)\n", x/65536.f, y/65536.f);
return;
}
cam->z = z;
cam->SetZ(z);
t_return.type = svt_int;
t_return.value.i = moved;
@ -3410,13 +3409,10 @@ void FParser::SF_SetObjPosition()
if (!mobj) return;
mobj->UnlinkFromWorld();
mobj->x = intvalue(t_argv[1]) << FRACBITS;
if(t_argc >= 3) mobj->y = intvalue(t_argv[2]) << FRACBITS;
if(t_argc == 4) mobj->z = intvalue(t_argv[3]) << FRACBITS;
mobj->LinkToWorld();
mobj->SetOrigin(
fixedvalue(t_argv[1]),
(t_argc >= 3)? fixedvalue(t_argv[2]) : mobj->Y(),
(t_argc >= 4)? fixedvalue(t_argv[3]) : mobj->Z(), false);
}
}
@ -4285,7 +4281,7 @@ void FParser::SF_SpawnShot2(void)
t_return.type = svt_mobj;
AActor *mo = Spawn (pclass, source->x, source->y, source->z+z, ALLOW_REPLACE);
AActor *mo = Spawn (pclass, source->PosPlusZ(z), ALLOW_REPLACE);
if (mo)
{
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM);

View file

@ -59,7 +59,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Fire)
void A_Fire(AActor *self, int height)
{
AActor *dest;
angle_t an;
dest = self->tracer;
if (dest == NULL || self->target == NULL)
@ -69,11 +68,8 @@ void A_Fire(AActor *self, int height)
if (!P_CheckSight (self->target, dest, 0) )
return;
an = dest->angle >> ANGLETOFINESHIFT;
self->SetOrigin (dest->x + FixedMul (24*FRACUNIT, finecosine[an]),
dest->y + FixedMul (24*FRACUNIT, finesine[an]),
dest->z + height);
fixedvec3 newpos = dest->Vec3Angle(24 * FRACUNIT, dest->angle, height);
self->SetOrigin(newpos, true);
}
@ -94,8 +90,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileTarget)
A_FaceTarget (self);
fog = Spawn (fire, self->target->x, self->target->y,
self->target->z, ALLOW_REPLACE);
fog = Spawn (fire, self->target->Pos(), ALLOW_REPLACE);
self->tracer = fog;
fog->target = self;
@ -126,7 +121,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
PARAM_INT_OPT (flags) { flags = 0; }
AActor *fire, *target;
angle_t an;
if (NULL == (target = self->target))
return 0;
@ -148,15 +142,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
P_TraceBleed (newdam > 0 ? newdam : dmg, target);
an = self->angle >> ANGLETOFINESHIFT;
fire = self->tracer;
if (fire != NULL)
{
// move the fire between the vile and the player
fire->SetOrigin (target->x - FixedMul (24*FRACUNIT, finecosine[an]),
target->y - FixedMul (24*FRACUNIT, finesine[an]),
target->z);
fixedvec3 pos = target->Vec3Angle(-24 * FRACUNIT, self->angle, target->Z());
fire->SetOrigin (pos, true);
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);
}

View file

@ -59,9 +59,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
PARAM_ACTION_PROLOGUE;
fixed_t x;
for (x = self->x - 196*FRACUNIT; x < self->x + 320*FRACUNIT; x += 8*FRACUNIT)
for (x = self->X() - 196*FRACUNIT; x < self->X() + 320*FRACUNIT; x += 8*FRACUNIT)
{
BrainishExplosion (x, self->y - 320*FRACUNIT,
BrainishExplosion (x, self->Y() - 320*FRACUNIT,
128 + (pr_brainscream() << (FRACBITS + 1)));
}
S_Sound (self, CHAN_VOICE, "brain/death", 1, ATTN_NONE);
@ -71,9 +71,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
DEFINE_ACTION_FUNCTION(AActor, A_BrainExplode)
{
PARAM_ACTION_PROLOGUE;
fixed_t x = self->x + pr_brainexplode.Random2()*2048;
fixed_t x = self->X() + pr_brainexplode.Random2()*2048;
fixed_t z = 128 + pr_brainexplode()*2*FRACUNIT;
BrainishExplosion (x, self->y, z);
BrainishExplosion (x, self->Y(), z);
return 0;
}
@ -150,11 +150,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BrainSpit)
}
else if (abs(spit->vely) > abs(spit->velx))
{
spit->special2 = (targ->y - self->y) / spit->vely;
spit->special2 = (targ->Y() - self->Y()) / spit->vely;
}
else
{
spit->special2 = (targ->x - self->x) / spit->velx;
spit->special2 = (targ->X() - self->X()) / spit->velx;
}
// [GZ] Calculates when the projectile will have reached destination
spit->special2 += level.maptime;
@ -196,7 +196,7 @@ static void SpawnFly(AActor *self, PClassActor *spawntype, FSoundID sound)
if (spawntype != NULL)
{
fog = Spawn (spawntype, targ->x, targ->y, targ->z, ALLOW_REPLACE);
fog = Spawn (spawntype, targ->Pos(), ALLOW_REPLACE);
if (fog != NULL) S_Sound (fog, CHAN_BODY, sound, 1, ATTN_NORM);
}
@ -267,7 +267,7 @@ static void SpawnFly(AActor *self, PClassActor *spawntype, FSoundID sound)
spawntype = PClass::FindActor(SpawnName);
if (spawntype != NULL)
{
newmobj = Spawn (spawntype, targ->x, targ->y, targ->z, ALLOW_REPLACE);
newmobj = Spawn (spawntype, targ->Pos(), ALLOW_REPLACE);
if (newmobj != NULL)
{
// Make the new monster hate what the boss eye hates
@ -286,7 +286,7 @@ static void SpawnFly(AActor *self, PClassActor *spawntype, FSoundID sound)
if (!(newmobj->ObjectFlags & OF_EuthanizeMe))
{
// telefrag anything in this spot
P_TeleportMove (newmobj, newmobj->x, newmobj->y, newmobj->z, true);
P_TeleportMove (newmobj, newmobj->Pos(), true);
}
newmobj->flags4 |= MF4_BOSSSPAWNED;
}

View file

@ -666,8 +666,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
if (linetarget != NULL)
{
AActor *spray = Spawn(spraytype, linetarget->x, linetarget->y,
linetarget->z + (linetarget->height >> 2), ALLOW_REPLACE);
AActor *spray = Spawn(spraytype, linetarget->PosPlusZ(linetarget->height >> 2), ALLOW_REPLACE);
int dmgFlags = 0;
FName dmgType = NAME_BFGSplash;

View file

@ -155,7 +155,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
P_CheckSplash(self, 128<<FRACBITS);
// Now launch mushroom cloud
AActor *target = Spawn("Mapspot", 0, 0, 0, NO_REPLACE); // We need something to aim at.
AActor *target = Spawn("Mapspot", self->Pos(), NO_REPLACE); // We need something to aim at.
AActor *master = (flags & MSF_DontHurt) ? (AActor*)(self->target) : self;
target->height = self->height;
for (i = -n; i <= n; i += 8)
@ -163,9 +163,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
for (j = -n; j <= n; j += 8)
{
AActor *mo;
target->x = self->x + (i << FRACBITS); // Aim in many directions from source
target->y = self->y + (j << FRACBITS);
target->z = self->z + (P_AproxDistance(i,j) * vrange); // Aim up fairly high
target->SetXYZ(
self->X() + (i << FRACBITS), // Aim in many directions from source
self->Y() + (j << FRACBITS),
self->Z() + (P_AproxDistance(i,j) * vrange)); // Aim up fairly high
if ((flags & MSF_Classic) || // Flag explicitely set, or no flags and compat options
(flags == 0 && (self->state->DefineFlags & SDF_DEHACKED) && (i_compatflags & COMPATF_MUSHROOM)))
{ // Use old function for MBF compatibility

View file

@ -41,7 +41,7 @@ void A_SkullAttack(AActor *self, fixed_t speed)
if (dist < 1)
dist = 1;
self->velz = (dest->z + (dest->height>>1) - self->z) / dist;
self->velz = (dest->Z() + (dest->height>>1) - self->Z()) / dist;
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullAttack)

View file

@ -44,17 +44,14 @@ enum PA_Flags
//
void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int flags = 0, int limit = -1)
{
fixed_t x, y, z;
AActor *other;
angle_t an;
int prestep;
if (spawntype == NULL) return;
if (self->DamageType == NAME_Massacre) return;
// [RH] check to make sure it's not too close to the ceiling
if (self->z + self->height + 8*FRACUNIT > self->ceilingz)
if (self->Top() + 8*FRACUNIT > self->ceilingz)
{
if (self->flags & MF_FLOAT)
{
@ -85,26 +82,38 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
}
// okay, there's room for another one
an = angle >> ANGLETOFINESHIFT;
prestep = 4*FRACUNIT +
3*(self->radius + GetDefaultByType(spawntype)->radius)/2;
x = self->x + FixedMul (prestep, finecosine[an]);
y = self->y + FixedMul (prestep, finesine[an]);
z = self->z + 8*FRACUNIT;
// NOTE: The following code contains some advance work for line-to-line portals which is currenty inactive.
fixedvec2 dist = Vec2Angle(prestep, angle);
fixedvec3 pos = self->Vec3Offset(dist.x, dist.y, 8 * FRACUNIT, true);
fixedvec3 src = self->Pos();
for (int i = 0; i < 2; i++)
{
// Check whether the Lost Soul is being fired through a 1-sided // phares
// wall or an impassible line, or a "monsters can't cross" line.// |
// If it is, then we don't allow the spawn. // V
FBoundingBox box(MIN(self->x, x), MIN(self->y, y), MAX(self->x, x), MAX(self->y, y));
FBoundingBox box(MIN(src.x, pos.x), MIN(src.y, pos.y), MAX(src.x, pos.x), MAX(src.y, pos.y));
FBlockLinesIterator it(box);
line_t *ld;
bool inportal = false;
while ((ld = it.Next()))
{
if (!(ld->flags & ML_TWOSIDED) ||
if (ld->isLinePortal() && i == 0)
{
if (P_PointOnLineSidePrecise(src.x, src.y, ld) == 0 &&
P_PointOnLineSidePrecise(pos.x, pos.y, ld) == 1)
{
// crossed a portal line from front to back, we need to repeat the check on the other side as well.
inportal = true;
}
}
else if (!(ld->flags & ML_TWOSIDED) ||
(ld->flags & (ML_BLOCKING | ML_BLOCKMONSTERS | ML_BLOCKEVERYTHING)))
{
if (!(box.Left() > ld->bbox[BOXRIGHT] ||
@ -112,20 +121,28 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
box.Top() < ld->bbox[BOXBOTTOM] ||
box.Bottom() > ld->bbox[BOXTOP]))
{
if (P_PointOnLineSidePrecise(self->x,self->y,ld) != P_PointOnLineSidePrecise(x,y,ld))
if (P_PointOnLineSidePrecise(src.x, src.y, ld) != P_PointOnLineSidePrecise(pos.x, pos.y, ld))
return; // line blocks trajectory // ^
}
}
}
if (!inportal) break;
other = Spawn (spawntype, x, y, z, ALLOW_REPLACE);
// recalculate position and redo the check on the other side of the portal
pos = self->Vec3Offset(dist.x, dist.y, 8 * FRACUNIT, false);
src.x = pos.x - dist.x;
src.y = pos.y - dist.y;
}
other = Spawn (spawntype, pos.x, pos.y, pos.z, ALLOW_REPLACE);
// Check to see if the new Lost Soul's z value is above the
// ceiling of its new sector, or below the floor. If so, kill it.
if ((other->z >
(other->Sector->ceilingplane.ZatPoint (other->x, other->y) - other->height)) ||
(other->z < other->Sector->floorplane.ZatPoint (other->x, other->y)))
if ((other->Z() >
(other->Sector->HighestCeiling(other) - other->height)) ||
(other->Z() < other->Sector->LowestFloor(other)))
{
// kill it immediately
P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);// ^
@ -134,7 +151,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
// Check for movements.
if (!P_CheckPosition (other, other->x, other->y))
if (!P_CheckPosition (other, other->Pos()))
{
// kill it immediately
P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);

View file

@ -28,13 +28,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkelMissile)
return 0;
A_FaceTarget (self);
missile = P_SpawnMissileZ (self, self->z + 48*FRACUNIT,
missile = P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT,
self->target, PClass::FindActor("RevenantTracer"));
if (missile != NULL)
{
missile->x += missile->velx;
missile->y += missile->vely;
missile->SetOrigin(missile->Vec3Offset(missile->velx, missile->vely, 0), false);
missile->tracer = self->target;
}
return 0;
@ -65,10 +64,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
return 0;
// spawn a puff of smoke behind the rocket
P_SpawnPuff (self, PClass::FindActor(NAME_BulletPuff), self->x, self->y, self->z, 0, 3);
P_SpawnPuff (self, PClass::FindActor(NAME_BulletPuff), self->X(), self->Y(), self->Z(), 0, 3);
smoke = Spawn ("RevenantTracerSmoke", self->x - self->velx,
self->y - self->vely, self->z, ALLOW_REPLACE);
smoke = Spawn ("RevenantTracerSmoke", self->Vec3Offset(-self->velx, -self->vely, 0), ALLOW_REPLACE);
smoke->velz = FRACUNIT;
smoke->tics -= pr_tracer()&3;
@ -114,11 +112,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
if (dest->height >= 56*FRACUNIT)
{
slope = (dest->z+40*FRACUNIT - self->z) / dist;
slope = (dest->Z()+40*FRACUNIT - self->Z()) / dist;
}
else
{
slope = (dest->z + self->height*2/3 - self->z) / dist;
slope = (dest->Z() + self->height*2/3 - self->Z()) / dist;
}
if (slope < self->velz)

View file

@ -45,7 +45,7 @@ void AChickenPlayer::MorphPlayerThink ()
{ // Twitch view angle
angle += pr_chickenplayerthink.Random2 () << 19;
}
if ((z <= floorz) && (pr_chickenplayerthink() < 32))
if ((Z() <= floorz) && (pr_chickenplayerthink() < 32))
{ // Jump and noise
velz += JumpZ;
@ -105,7 +105,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Feathers)
}
for (i = 0; i < count; i++)
{
mo = Spawn("Feather", self->x, self->y, self->z+20*FRACUNIT, NO_REPLACE);
mo = Spawn("Feather", self->PosPlusZ(20*FRACUNIT), NO_REPLACE);
mo->target = self;
mo->velx = pr_feathers.Random2() << 8;
mo->vely = pr_feathers.Random2() << 8;

View file

@ -86,17 +86,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
PClassActor *fx = PClass::FindActor("SorcererFX1");
if (self->health > (self->SpawnHealth()/3)*2)
{ // Spit one fireball
P_SpawnMissileZ (self, self->z + 48*FRACUNIT, self->target, fx );
P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT, self->target, fx );
}
else
{ // Spit three fireballs
mo = P_SpawnMissileZ (self, self->z + 48*FRACUNIT, self->target, fx);
mo = P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT, self->target, fx);
if (mo != NULL)
{
velz = mo->velz;
angle = mo->angle;
P_SpawnMissileAngleZ (self, self->z + 48*FRACUNIT, fx, angle-ANGLE_1*3, velz);
P_SpawnMissileAngleZ (self, self->z + 48*FRACUNIT, fx, angle+ANGLE_1*3, velz);
P_SpawnMissileAngleZ (self, self->Z() + 48*FRACUNIT, fx, angle-ANGLE_1*3, velz);
P_SpawnMissileAngleZ (self, self->Z() + 48*FRACUNIT, fx, angle+ANGLE_1*3, velz);
}
if (self->health < self->SpawnHealth()/3)
{ // Maybe attack again
@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcererRise)
AActor *mo;
self->flags &= ~MF_SOLID;
mo = Spawn("Sorcerer2", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn("Sorcerer2", self->Pos(), ALLOW_REPLACE);
mo->Translation = self->Translation;
mo->SetState (mo->FindState("Rise"));
mo->angle = self->angle;
@ -152,20 +152,20 @@ void P_DSparilTeleport (AActor *actor)
DSpotState *state = DSpotState::GetSpotState();
if (state == NULL) return;
spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->x, actor->y, 128*FRACUNIT, 0);
spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->X(), actor->Y(), 128*FRACUNIT, 0);
if (spot == NULL) return;
prevX = actor->x;
prevY = actor->y;
prevZ = actor->z;
if (P_TeleportMove (actor, spot->x, spot->y, spot->z, false))
prevX = actor->X();
prevY = actor->Y();
prevZ = actor->Z();
if (P_TeleportMove (actor, spot->Pos(), false))
{
mo = Spawn("Sorcerer2Telefade", prevX, prevY, prevZ, ALLOW_REPLACE);
if (mo) mo->Translation = actor->Translation;
S_Sound (mo, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->SetState (actor->FindState("Teleport"));
S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->z = actor->floorz;
actor->SetZ(actor->floorz, false);
actor->angle = spot->angle;
actor->velx = actor->vely = actor->velz = 0;
}
@ -256,7 +256,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BlueSpark)
for (i = 0; i < 2; i++)
{
mo = Spawn("Sorcerer2FXSpark", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn("Sorcerer2FXSpark", self->Pos(), ALLOW_REPLACE);
mo->velx = pr_bluespark.Random2() << 9;
mo->vely = pr_bluespark.Random2() << 9;
mo->velz = FRACUNIT + (pr_bluespark()<<8);
@ -276,10 +276,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
AActor *mo;
mo = Spawn("Wizard", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn("Wizard", self->Pos(), ALLOW_REPLACE);
if (mo != NULL)
{
mo->z -= mo->GetDefault()->height/2;
mo->AddZ(-mo->GetDefault()->height / 2, false);
if (!P_TestMobjLocation (mo))
{ // Didn't fit
mo->ClearCounters();
@ -294,7 +294,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
self->flags &= ~MF_MISSILE;
mo->master = self->target;
// Heretic did not offset it by TELEFOGHEIGHT, so I won't either.
Spawn<ATeleportFog> (self->x, self->y, self->z, ALLOW_REPLACE);
Spawn<ATeleportFog> (self->Pos(), ALLOW_REPLACE);
}
}
return 0;

View file

@ -49,8 +49,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
{
PARAM_ACTION_PROLOGUE;
self->z += 32*FRACUNIT;
self->PrevZ = self->z; // no interpolation!
self->AddZ(32*FRACUNIT, false);
self->PrevZ = self->Z(); // no interpolation!
self->RenderStyle = STYLE_Add;
self->alpha = FRACUNIT;
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
@ -72,9 +72,7 @@ bool AArtiTimeBomb::Use (bool pickup)
{
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
AActor *mo = Spawn("ActivatedTimeBomb",
Owner->x + 24*finecosine[angle],
Owner->y + 24*finesine[angle],
Owner->z - Owner->floorclip, ALLOW_REPLACE);
Vec3Angle(24*FRACUNIT, Owner->angle, - Owner->floorclip), ALLOW_REPLACE);
mo->target = Owner;
return true;
}

View file

@ -46,12 +46,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_ImpExplode)
self->flags &= ~MF_NOGRAVITY;
chunk = Spawn("HereticImpChunk1", self->x, self->y, self->z, ALLOW_REPLACE);
chunk = Spawn("HereticImpChunk1", self->Pos(), ALLOW_REPLACE);
chunk->velx = pr_imp.Random2 () << 10;
chunk->vely = pr_imp.Random2 () << 10;
chunk->velz = 9*FRACUNIT;
chunk = Spawn("HereticImpChunk2", self->x, self->y, self->z, ALLOW_REPLACE);
chunk = Spawn("HereticImpChunk2", self->Pos(), ALLOW_REPLACE);
chunk->velx = pr_imp.Random2 () << 10;
chunk->vely = pr_imp.Random2 () << 10;
chunk->velz = 9*FRACUNIT;

View file

@ -57,7 +57,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PodPain)
}
for (count = chance > 240 ? 2 : 1; count; count--)
{
goo = Spawn(gootype, self->x, self->y, self->z + 48*FRACUNIT, ALLOW_REPLACE);
goo = Spawn(gootype, self->PosPlusZ(48*FRACUNIT), ALLOW_REPLACE);
goo->target = self;
goo->velx = pr_podpain.Random2() << 9;
goo->vely = pr_podpain.Random2() << 9;
@ -104,15 +104,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MakePod)
AActor *mo;
fixed_t x;
fixed_t y;
fixed_t z;
if (self->special1 == MAX_GEN_PODS)
{ // Too many generated pods
return 0;
}
x = self->x;
y = self->y;
z = self->z;
x = self->X();
y = self->Y();
mo = Spawn(podtype, x, y, ONFLOORZ, ALLOW_REPLACE);
if (!P_CheckPosition (mo, x, y))
{ // Didn't fit
@ -177,8 +175,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast)
count = 1 + (pr_blast() % 3);
for (i = 0; i < count; i++)
{
blast = Spawn("VolcanoBlast", self->x, self->y,
self->z + 44*FRACUNIT, ALLOW_REPLACE);
blast = Spawn("VolcanoBlast", self->PosPlusZ(44*FRACUNIT), ALLOW_REPLACE);
blast->target = self;
angle = pr_blast () << 24;
blast->angle = angle;
@ -206,17 +203,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
AActor *tiny;
angle_t angle;
if (self->z <= self->floorz)
if (self->Z() <= self->floorz)
{
self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT;
self->z += 28*FRACUNIT;
self->AddZ(28*FRACUNIT);
//self->velz = 3*FRACUNIT;
}
P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, RADF_HURTSOURCE);
for (i = 0; i < 4; i++)
{
tiny = Spawn("VolcanoTBlast", self->x, self->y, self->z, ALLOW_REPLACE);
tiny = Spawn("VolcanoTBlast", self->Pos(), ALLOW_REPLACE);
tiny->target = self;
angle = i*ANG90;
tiny->angle = angle;

View file

@ -401,14 +401,13 @@ void FireMacePL1B (AActor *actor)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
ball = Spawn("MaceFX2", actor->x, actor->y, actor->z + 28*FRACUNIT
- actor->floorclip, ALLOW_REPLACE);
ball = Spawn("MaceFX2", actor->PosPlusZ(28*FRACUNIT - actor->floorclip), ALLOW_REPLACE);
ball->velz = 2*FRACUNIT+/*((player->lookdir)<<(FRACBITS-5))*/
finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
angle = actor->angle;
ball->target = actor;
ball->angle = angle;
ball->z += 2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
ball->AddZ(2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)]);
angle >>= ANGLETOFINESHIFT;
ball->velx = (actor->velx>>1) + FixedMul(ball->Speed, finecosine[angle]);
ball->vely = (actor->vely>>1) + FixedMul(ball->Speed, finesine[angle]);
@ -538,10 +537,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
if (self->flags & MF_INBOUNCE)
{
fixed_t floordist = self->z - self->floorz;
fixed_t ceildist = self->ceilingz - self->z;
fixed_t floordist = self->Z() - self->floorz;
fixed_t ceildist = self->ceilingz - self->Z();
fixed_t vel;
// NOTE: The assumptions being made here about the plane to use for bouncing off are dead wrong.
// http://forum.zdoom.org/viewtopic.php?f=2&t=50449
if (floordist <= ceildist)
{
vel = MulScale32 (self->velz, self->Sector->floorplane.c);
@ -559,7 +560,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
self->velz = (self->velz * 192) >> 8;
self->SetState (self->SpawnState);
tiny = Spawn("MaceFX3", self->x, self->y, self->z, ALLOW_REPLACE);
tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE);
angle = self->angle+ANG90;
tiny->target = self->target;
tiny->angle = angle;
@ -569,7 +570,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
tiny->velz = self->velz;
P_CheckMissileSpawn (tiny, self->radius);
tiny = Spawn("MaceFX3", self->x, self->y, self->z, ALLOW_REPLACE);
tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE);
angle = self->angle-ANG90;
tiny->target = self->target;
tiny->angle = angle;
@ -647,17 +648,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
bool newAngle;
AActor *linetarget;
if ((self->z <= self->floorz) && P_HitFloor (self))
if ((self->Z() <= self->floorz) && P_HitFloor (self))
{ // Landed in some sort of liquid
self->Destroy ();
return 0;
}
if (self->flags & MF_INBOUNCE)
{
fixed_t floordist = self->z - self->floorz;
fixed_t ceildist = self->ceilingz - self->z;
fixed_t floordist = self->Z() - self->floorz;
fixed_t ceildist = self->ceilingz - self->Z();
fixed_t vel;
// NOTE: The assumptions being made here about the plane to use for bouncing off are dead wrong.
// http://forum.zdoom.org/viewtopic.php?f=2&t=50449
if (floordist <= ceildist)
{
vel = MulScale32 (self->velz, self->Sector->floorplane.c);
@ -757,7 +760,7 @@ void ABlasterFX1::Effect ()
{
if (pr_bfx1t() < 64)
{
Spawn("BlasterSmoke", x, y, MAX<fixed_t> (z - 8 * FRACUNIT, floorz), ALLOW_REPLACE);
Spawn("BlasterSmoke", X(), Y(), MAX<fixed_t> (Z() - 8 * FRACUNIT, floorz), ALLOW_REPLACE);
}
}
@ -841,7 +844,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers)
for(i = 0; i < 8; i++)
{
ripper = Spawn<ARipper> (self->x, self->y, self->z, ALLOW_REPLACE);
ripper = Spawn<ARipper> (self->Pos(), ALLOW_REPLACE);
angle = i*ANG45;
ripper->target = self->target;
ripper->angle = angle;
@ -1061,8 +1064,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
{
PARAM_ACTION_PROLOGUE;
fixed_t x;
fixed_t y;
AActor *mo;
ARainTracker *tracker;
@ -1093,20 +1094,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
{ // Fudge rain frequency
return 0;
}
x = self->x + ((pr_storm()&127) - 64) * FRACUNIT;
y = self->y + ((pr_storm()&127) - 64) * FRACUNIT;
mo = Spawn<ARainPillar> (x, y, ONCEILINGZ, ALLOW_REPLACE);
fixedvec2 pos = self->Vec2Offset(
((pr_storm()&127) - 64) * FRACUNIT,
((pr_storm()&127) - 64) * FRACUNIT);
mo = Spawn<ARainPillar> (pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE);
// We used bouncecount to store the 3D floor index in A_HideInCeiling
if (!mo) return 0;
fixed_t newz;
if (self->bouncecount >= 0
&& (unsigned)self->bouncecount < self->Sector->e->XFloor.ffloors.Size())
newz = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPoint(x, y);// - 40 * FRACUNIT;
newz = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPoint(pos.x, pos.y);// - 40 * FRACUNIT;
else
newz = self->Sector->ceilingplane.ZatPoint(x, y);
int moceiling = P_Find3DFloor(NULL, x, y, newz, false, false, newz);
newz = self->Sector->ceilingplane.ZatPoint(pos.x, pos.y);
int moceiling = P_Find3DFloor(NULL, pos.x, pos.y, newz, false, false, newz);
if (moceiling >= 0)
mo->z = newz - mo->height;
mo->SetZ(newz - mo->height, false);
mo->Translation = multiplayer ?
TRANSLATION(TRANSLATION_PlayersExtra,self->special2) : 0;
mo->target = self->target;
@ -1130,8 +1132,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
DEFINE_ACTION_FUNCTION(AActor, A_RainImpact)
{
PARAM_ACTION_PROLOGUE;
if (self->z > self->floorz)
if (self->Z() > self->floorz)
{
self->SetState (self->FindState("NotFloor"));
}
@ -1159,15 +1160,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
F3DFloor * rover = self->Sector->e->XFloor.ffloors[i];
if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if ((foo = rover->bottom.plane->ZatPoint(self)) >= (self->z + self->height))
if ((foo = rover->bottom.plane->ZatPoint(self)) >= (self->Top()))
{
self->z = foo + 4*FRACUNIT;
self->SetZ(foo + 4*FRACUNIT, false);
self->bouncecount = i;
return 0;
}
}
self->bouncecount = -1;
self->z = self->ceilingz + 4*FRACUNIT;
self->SetZ(self->ceilingz + 4*FRACUNIT, false);
return 0;
}
@ -1291,13 +1292,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_PhoenixPuff)
//[RH] Heretic never sets the target for seeking
//P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10);
puff = Spawn("PhoenixPuff", self->x, self->y, self->z, ALLOW_REPLACE);
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->angle + ANG90;
angle >>= ANGLETOFINESHIFT;
puff->velx = FixedMul (FRACUNIT*13/10, finecosine[angle]);
puff->vely = FixedMul (FRACUNIT*13/10, finesine[angle]);
puff->velz = 0;
puff = Spawn("PhoenixPuff", self->x, self->y, self->z, ALLOW_REPLACE);
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->angle - ANG90;
angle >>= ANGLETOFINESHIFT;
puff->velx = FixedMul (FRACUNIT*13/10, finecosine[angle]);
@ -1341,7 +1342,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
AActor *mo;
angle_t angle;
fixed_t x, y, z;
fixed_t slope;
FSoundID soundid;
@ -1364,12 +1364,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
return 0;
}
angle = self->angle;
x = self->x + (pr_fp2.Random2() << 9);
y = self->y + (pr_fp2.Random2() << 9);
z = self->z + 26*FRACUNIT + finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)];
z -= self->floorclip;
fixedvec3 pos = self->Vec3Offset(
(pr_fp2.Random2() << 9),
(pr_fp2.Random2() << 9),
26*FRACUNIT + finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] - self->floorclip);
slope = finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10);
mo = Spawn("PhoenixFX2", x, y, z, ALLOW_REPLACE);
mo = Spawn("PhoenixFX2", pos, ALLOW_REPLACE);
mo->target = self;
mo->angle = angle;
mo->velx = self->velx + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]);

View file

@ -108,8 +108,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
baseFire->SetState (baseFire->FindState("NoGrow"));
for (i = 0; i < 5; i++)
{
fire = Spawn("HeadFX3", baseFire->x, baseFire->y,
baseFire->z, ALLOW_REPLACE);
fire = Spawn("HeadFX3", baseFire->Pos(), ALLOW_REPLACE);
if (i == 0)
{
S_Sound (self, CHAN_BODY, "ironlich/attack1", 1, ATTN_NORM);
@ -130,7 +129,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
mo = P_SpawnMissile (self, target, RUNTIME_CLASS(AWhirlwind));
if (mo != NULL)
{
mo->z -= 32*FRACUNIT;
mo->AddZ(-32*FRACUNIT, false);
mo->tracer = target;
mo->special1 = 60;
mo->special2 = 50; // Timer for active sound
@ -188,7 +187,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
for (i = 0; i < 8; i++)
{
shard = Spawn("HeadFX2", self->x, self->y, self->z, ALLOW_REPLACE);
shard = Spawn("HeadFX2", self->Pos(), ALLOW_REPLACE);
angle = i*ANG45;
shard->target = self->target;
shard->angle = angle;
@ -212,7 +211,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow)
PARAM_ACTION_PROLOGUE;
self->health--;
self->z += 9*FRACUNIT;
self->AddZ(9*FRACUNIT);
if (self->health == 0)
{
self->Damage = self->GetDefault()->Damage;

View file

@ -24,11 +24,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
PARAM_ACTION_PROLOGUE;
AActor *mo;
fixed_t x, y;
x = self->x + (pr_dripblood.Random2 () << 11);
y = self->y + (pr_dripblood.Random2 () << 11);
mo = Spawn ("Blood", x, y, self->z, ALLOW_REPLACE);
fixedvec3 pos = self->Vec3Offset(
(pr_dripblood.Random2 () << 11),
(pr_dripblood.Random2 () << 11), 0);
mo = Spawn ("Blood", pos, ALLOW_REPLACE);
mo->velx = pr_dripblood.Random2 () << 10;
mo->vely = pr_dripblood.Random2 () << 10;
mo->gravity = FRACUNIT/8;
@ -61,11 +61,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_KnightAttack)
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
if (self->flags & MF_SHADOW || pr_knightatk () < 40)
{ // Red axe
P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindActor("RedAxe"));
return 0;
P_SpawnMissileZ (self, self->Z() + 36*FRACUNIT, self->target, PClass::FindActor("RedAxe"));
return;
}
// Green axe
P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindActor("KnightAxe"));
return 0;
P_SpawnMissileZ (self, self->Z() + 36*FRACUNIT, self->target, PClass::FindActor("KnightAxe"));
}

View file

@ -92,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
}
// Handle Z movement
self->z = self->target->z + 16*finesine[self->args[0] << BOBTOFINESHIFT];
self->SetZ(self->target->Z() + 16*finesine[self->args[0] << BOBTOFINESHIFT]);
self->args[0] = (self->args[0]+3)&63;
return 0;
}

View file

@ -157,7 +157,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
self->SetState (self->MissileState);
}
}
mo = Spawn ("BishopBlur", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn ("BishopBlur", self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->angle = self->angle;
@ -175,9 +175,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopChase)
{
PARAM_ACTION_PROLOGUE;
self->z -= finesine[self->special2 << BOBTOFINESHIFT] * 4;
fixed_t newz = self->Z() - finesine[self->special2 << BOBTOFINESHIFT] * 4;
self->special2 = (self->special2 + 4) & 63;
self->z += finesine[self->special2 << BOBTOFINESHIFT] * 4;
newz += finesine[self->special2 << BOBTOFINESHIFT] * 4;
self->SetZ(newz);
return 0;
}
@ -193,7 +194,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPuff)
AActor *mo;
mo = Spawn ("BishopPuff", self->x, self->y, self->z + 40*FRACUNIT, ALLOW_REPLACE);
mo = Spawn ("BishopPuff", self->PosPlusZ(40*FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->velz = FRACUNIT/2;
@ -218,10 +219,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur)
self->SetState (self->FindState ("Blur"));
return 0;
}
fixed_t x = self->x + (pr_pain.Random2()<<12);
fixed_t y = self->y + (pr_pain.Random2()<<12);
fixed_t z = self->z + (pr_pain.Random2()<<11);
mo = Spawn ("BishopPainBlur", x, y, z, ALLOW_REPLACE);
fixedvec3 pos = self->Vec3Offset(
(pr_pain.Random2()<<12),
(pr_pain.Random2()<<12),
(pr_pain.Random2()<<11));
mo = Spawn ("BishopPainBlur", pos, ALLOW_REPLACE);
if (mo)
{
mo->angle = self->angle;

View file

@ -26,7 +26,7 @@ void BlastActor (AActor *victim, fixed_t strength, fixed_t speed, AActor *Owner,
{
angle_t angle,ang;
AActor *mo;
fixed_t x,y,z;
fixedvec3 pos;
if (!victim->SpecialBlastHandling (Owner, strength))
{
@ -41,10 +41,11 @@ void BlastActor (AActor *victim, fixed_t strength, fixed_t speed, AActor *Owner,
// Spawn blast puff
ang = victim->AngleTo(Owner);
ang >>= ANGLETOFINESHIFT;
x = victim->x + FixedMul (victim->radius+FRACUNIT, finecosine[ang]);
y = victim->y + FixedMul (victim->radius+FRACUNIT, finesine[ang]);
z = victim->z - victim->floorclip + (victim->height>>1);
mo = Spawn (blasteffect, x, y, z, ALLOW_REPLACE);
pos = victim->Vec3Offset(
FixedMul (victim->radius+FRACUNIT, finecosine[ang]),
FixedMul (victim->radius+FRACUNIT, finesine[ang]),
-victim->floorclip + (victim->height>>1));
mo = Spawn (blasteffect, pos, ALLOW_REPLACE);
if (mo)
{
mo->velx = victim->velx;

View file

@ -48,12 +48,12 @@ void ACFlameMissile::Effect ()
if (!--special1)
{
special1 = 4;
newz = z-12*FRACUNIT;
newz = Z()-12*FRACUNIT;
if (newz < floorz)
{
newz = floorz;
}
AActor *mo = Spawn ("CFlameFloor", x, y, newz, ALLOW_REPLACE);
AActor *mo = Spawn ("CFlameFloor", X(), Y(), newz, ALLOW_REPLACE);
if (mo)
{
mo->angle = angle;
@ -131,9 +131,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
{
an = (i*ANG45)>>ANGLETOFINESHIFT;
an90 = (i*ANG45+ANG90)>>ANGLETOFINESHIFT;
mo = Spawn ("CircleFlame", BlockingMobj->x+FixedMul(dist, finecosine[an]),
BlockingMobj->y+FixedMul(dist, finesine[an]),
BlockingMobj->z+5*FRACUNIT, ALLOW_REPLACE);
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
FixedMul(dist, finecosine[an]),
FixedMul(dist, finesine[an]),
5*FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->angle = an<<ANGLETOFINESHIFT;
@ -142,9 +143,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
mo->vely = mo->special2 = FixedMul(FLAMESPEED, finesine[an]);
mo->tics -= pr_missile()&3;
}
mo = Spawn ("CircleFlame", BlockingMobj->x-FixedMul(dist, finecosine[an]),
BlockingMobj->y-FixedMul(dist, finesine[an]),
BlockingMobj->z+5*FRACUNIT, ALLOW_REPLACE);
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
-FixedMul(dist, finecosine[an]),
-FixedMul(dist, finesine[an]),
5*FRACUNIT), ALLOW_REPLACE);
if(mo)
{
mo->angle = ANG180+(an<<ANGLETOFINESHIFT);

View file

@ -94,7 +94,7 @@ bool AHolySpirit::Slam (AActor *thing)
P_DamageMobj (thing, this, target, dam, NAME_Melee);
if (pr_spiritslam() < 128)
{
Spawn ("HolyPuff", x, y, z, ALLOW_REPLACE);
Spawn ("HolyPuff", Pos(), ALLOW_REPLACE);
S_Sound (this, CHAN_WEAPON, "SpiritAttack", 1, ATTN_NORM);
if (thing->flags3&MF3_ISMONSTER && pr_spiritslam() < 128)
{
@ -138,7 +138,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
for (j = 0; j < 4; j++)
{
mo = Spawn<AHolySpirit> (self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn<AHolySpirit> (self->Pos(), ALLOW_REPLACE);
if (!mo)
{
continue;
@ -159,7 +159,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
mo->special2 = ((FINEANGLES/2 + i) << 16) + FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT);
break;
}
mo->z = self->z;
mo->SetZ(self->Z());
mo->angle = self->angle+(ANGLE_45+ANGLE_45/2)-ANGLE_45*j;
P_ThrustMobj(mo, mo->angle, mo->Speed);
mo->target = self->target;
@ -191,11 +191,11 @@ void SpawnSpiritTail (AActor *spirit)
AActor *tail, *next;
int i;
tail = Spawn ("HolyTail", spirit->x, spirit->y, spirit->z, ALLOW_REPLACE);
tail = Spawn ("HolyTail", spirit->Pos(), ALLOW_REPLACE);
tail->target = spirit; // parent
for (i = 1; i < 3; i++)
{
next = Spawn ("HolyTailTrail", spirit->x, spirit->y, spirit->z, ALLOW_REPLACE);
next = Spawn ("HolyTailTrail", spirit->Pos(), ALLOW_REPLACE);
tail->tracer = next;
tail = next;
}
@ -276,24 +276,24 @@ static void CHolyTailFollow (AActor *actor, fixed_t dist)
{
an = actor->AngleTo(child) >> ANGLETOFINESHIFT;
oldDistance = child->AproxDistance (actor);
if (P_TryMove (child, actor->x+FixedMul(dist, finecosine[an]),
actor->y+FixedMul(dist, finesine[an]), true))
if (P_TryMove (child, actor->X()+FixedMul(dist, finecosine[an]),
actor->Y()+FixedMul(dist, finesine[an]), true))
{
newDistance = child->AproxDistance (actor)-FRACUNIT;
if (oldDistance < FRACUNIT)
{
if (child->z < actor->z)
if (child->Z() < actor->Z())
{
child->z = actor->z-dist;
child->SetZ(actor->Z()-dist);
}
else
{
child->z = actor->z+dist;
child->SetZ(actor->Z()+dist);
}
}
else
{
child->z = actor->z + Scale (newDistance, child->z-actor->z, oldDistance);
child->SetZ(actor->Z() + Scale (newDistance, child->Z()-actor->Z(), oldDistance));
}
}
}
@ -342,10 +342,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyTail)
else
{
if (P_TryMove (self,
parent->x - 14*finecosine[parent->angle>>ANGLETOFINESHIFT],
parent->y - 14*finesine[parent->angle>>ANGLETOFINESHIFT], true))
parent->X() - 14*finecosine[parent->angle>>ANGLETOFINESHIFT],
parent->Y() - 14*finesine[parent->angle>>ANGLETOFINESHIFT], true))
{
self->z = parent->z-5*FRACUNIT;
self->SetZ(parent->Z()-5*FRACUNIT);
}
CHolyTailFollow (self, 10*FRACUNIT);
}
@ -422,11 +422,11 @@ static void CHolySeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
actor->velx = FixedMul (actor->Speed, finecosine[angle]);
actor->vely = FixedMul (actor->Speed, finesine[angle]);
if (!(level.time&15)
|| actor->z > target->z+(target->height)
|| actor->z+actor->height < target->z)
|| actor->Z() > target->Top()
|| actor->Top() < target->Z())
{
newZ = target->z+((pr_holyseeker()*target->height)>>8);
deltaZ = newZ-actor->z;
newZ = target->Z()+((pr_holyseeker()*target->height)>>8);
deltaZ = newZ - actor->Z();
if (abs(deltaZ) > 15*FRACUNIT)
{
if (deltaZ > 0)
@ -457,22 +457,24 @@ static void CHolySeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
void CHolyWeave (AActor *actor, FRandom &pr_random)
{
fixed_t newX, newY;
fixed_t newX, newY, newZ;
int weaveXY, weaveZ;
int angle;
weaveXY = actor->special2 >> 16;
weaveZ = actor->special2 & FINEMASK;
angle = (actor->angle + ANG90) >> ANGLETOFINESHIFT;
newX = actor->x - FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY = actor->y - FixedMul(finesine[angle], finesine[weaveXY] * 32);
newX = actor->X() - FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY = actor->Y() - FixedMul(finesine[angle], finesine[weaveXY] * 32);
weaveXY = (weaveXY + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
newX += FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY += FixedMul(finesine[angle], finesine[weaveXY] * 32);
P_TryMove(actor, newX, newY, true);
actor->z -= finesine[weaveZ] * 16;
newZ = actor->Z();
newZ -= finesine[weaveZ] * 16;
weaveZ = (weaveZ + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
actor->z += finesine[weaveZ] * 16;
newZ += finesine[weaveZ] * 16;
actor->SetZ(newZ);
actor->special2 = weaveZ + (weaveXY << 16);
}
@ -544,7 +546,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClericAttack)
if (!self->target) return 0;
AActor * missile = P_SpawnMissileZ (self, self->z + 40*FRACUNIT, self->target, PClass::FindActor("HolyMissile"));
AActor * missile = P_SpawnMissileZ (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor ("HolyMissile"));
if (missile != NULL) missile->tracer = NULL; // No initial target
S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
return 0;

View file

@ -60,14 +60,14 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
actor->velx = FixedMul (actor->Speed, finecosine[angle]);
actor->vely = FixedMul (actor->Speed, finesine[angle]);
dist = actor->AproxDistance (target) / actor->Speed;
if (actor->z+actor->height < target->z ||
target->z+target->height < actor->z)
if (actor->Top() < target->Z() ||
target->Top() < actor->Z())
{
if (dist < 1)
{
dist = 1;
}
actor->velz = (target->z - actor->z)/dist;
actor->velz = (target->Z() - actor->Z())/dist;
}
if (target->flags&MF_SHOOTABLE && pr_dragonseek() < 64)
{ // attack the destination mobj if it's attackable
@ -266,11 +266,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFX2)
delay = 16+(pr_dragonfx2()>>3);
for (i = 1+(pr_dragonfx2()&3); i; i--)
{
fixed_t x = self->x+((pr_dragonfx2()-128)<<14);
fixed_t y = self->y+((pr_dragonfx2()-128)<<14);
fixed_t z = self->z+((pr_dragonfx2()-128)<<12);
fixedvec3 pos = self->Vec3Offset(
((pr_dragonfx2()-128)<<14),
((pr_dragonfx2()-128)<<14),
((pr_dragonfx2()-128)<<12));
mo = Spawn ("DragonExplosion", x, y, z, ALLOW_REPLACE);
mo = Spawn ("DragonExplosion", pos, ALLOW_REPLACE);
if (mo)
{
mo->tics = delay+(pr_dragonfx2()&3)*i*2;
@ -308,7 +309,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonCheckCrash)
{
PARAM_ACTION_PROLOGUE;
if (self->z <= self->floorz)
if (self->Z() <= self->floorz)
{
self->SetState (self->FindState ("Crash"));
}

View file

@ -36,7 +36,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces)
PClassActor *cls = j == 0 ? p1 : j == 1 ? p2 : p3;
if (cls)
{
AActor *piece = Spawn (cls, self->x, self->y, self->z, ALLOW_REPLACE);
AActor *piece = Spawn (cls, self->Pos(), ALLOW_REPLACE);
if (piece != NULL)
{
piece->velx = self->velx + finecosine[fineang];
@ -118,10 +118,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FSwordFlames)
for (i = 1+(pr_fswordflame()&3); i; i--)
{
fixed_t x = self->x+((pr_fswordflame()-128)<<12);
fixed_t y = self->y+((pr_fswordflame()-128)<<12);
fixed_t z = self->z+((pr_fswordflame()-128)<<11);
Spawn ("FSwordFlame", x, y, z, ALLOW_REPLACE);
fixedvec3 pos = self->Vec3Offset(
((pr_fswordflame()-128)<<12),
((pr_fswordflame()-128)<<12),
((pr_fswordflame()-128)<<11));
Spawn ("FSwordFlame", pos, ALLOW_REPLACE);
}
return 0;
}

View file

@ -32,7 +32,6 @@ static FRandom pr_firedemonsplotch ("FiredSplotch");
void A_FiredSpawnRock (AActor *actor)
{
AActor *mo;
int x,y,z;
PClassActor *rtype;
switch (pr_firedemonrock() % 5)
@ -55,10 +54,11 @@ void A_FiredSpawnRock (AActor *actor)
break;
}
x = actor->x + ((pr_firedemonrock() - 128) << 12);
y = actor->y + ((pr_firedemonrock() - 128) << 12);
z = actor->z + ( pr_firedemonrock() << 11);
mo = Spawn (rtype, x, y, z, ALLOW_REPLACE);
fixedvec3 pos = actor->Vec3Offset(
((pr_firedemonrock() - 128) << 12),
((pr_firedemonrock() - 128) << 12),
( pr_firedemonrock() << 11));
mo = Spawn (rtype, pos, ALLOW_REPLACE);
if (mo)
{
mo->target = actor;
@ -102,7 +102,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SmBounce)
PARAM_ACTION_PROLOGUE;
// give some more velocity (x,y,&z)
self->z = self->floorz + FRACUNIT;
self->SetZ(self->floorz + FRACUNIT);
self->velz = (2*FRACUNIT) + (pr_smbounce() << 10);
self->velx = pr_smbounce()%3<<FRACBITS;
self->vely = pr_smbounce()%3<<FRACBITS;
@ -145,13 +145,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
if (self->threshold) self->threshold--;
// Float up and down
self->z += finesine[weaveindex << BOBTOFINESHIFT] * 8;
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->special1 = (weaveindex + 2) & 63;
// Ensure it stays above certain height
if (self->z < self->floorz + (64*FRACUNIT))
if (self->Z() < self->floorz + (64*FRACUNIT))
{
self->z += 2*FRACUNIT;
self->AddZ(2*FRACUNIT);
}
if(!self->target || !(self->target->flags&MF_SHOOTABLE))
@ -233,14 +233,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredSplotch)
AActor *mo;
mo = Spawn ("FireDemonSplotch1", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn ("FireDemonSplotch1", self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->velx = (pr_firedemonsplotch() - 128) << 11;
mo->vely = (pr_firedemonsplotch() - 128) << 11;
mo->velz = (pr_firedemonsplotch() << 10) + FRACUNIT*3;
}
mo = Spawn ("FireDemonSplotch2", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn ("FireDemonSplotch2", self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->velx = (pr_firedemonsplotch() - 128) << 11;

View file

@ -42,10 +42,10 @@ bool AArtiPoisonBag1::Use (bool pickup)
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
AActor *mo;
mo = Spawn ("PoisonBag",
Owner->x+16*finecosine[angle],
Owner->y+24*finesine[angle], Owner->z-
Owner->floorclip+8*FRACUNIT, ALLOW_REPLACE);
mo = Spawn ("PoisonBag", Owner->Vec3Offset(
16*finecosine[angle],
24*finesine[angle],
-Owner->floorclip+8*FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->target = Owner;
@ -70,10 +70,10 @@ bool AArtiPoisonBag2::Use (bool pickup)
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
AActor *mo;
mo = Spawn ("FireBomb",
Owner->x+16*finecosine[angle],
Owner->y+24*finesine[angle], Owner->z-
Owner->floorclip+8*FRACUNIT, ALLOW_REPLACE);
mo = Spawn ("FireBomb", Owner->Vec3Offset(
16*finecosine[angle],
24*finesine[angle],
-Owner->floorclip+8*FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->target = Owner;
@ -97,8 +97,7 @@ bool AArtiPoisonBag3::Use (bool pickup)
{
AActor *mo;
mo = Spawn("ThrowingBomb", Owner->x, Owner->y,
Owner->z-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0), ALLOW_REPLACE);
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
if (mo)
{
mo->angle = Owner->angle + (((pr_poisonbag()&7) - 4) << 24);
@ -124,7 +123,7 @@ bool AArtiPoisonBag3::Use (bool pickup)
mo->velz = FixedMul(speed, finesine[modpitch]);
mo->velx = FixedMul(xyscale, finecosine[angle]) + (Owner->velx >> 1);
mo->vely = FixedMul(xyscale, finesine[angle]) + (Owner->vely >> 1);
mo->z += FixedMul(mo->Speed, finesine[orgpitch]);
mo->AddZ(FixedMul(mo->Speed, finesine[orgpitch]));
mo->target = Owner;
mo->tics -= pr_poisonbag()&3;
@ -150,7 +149,7 @@ bool AArtiPoisonBagGiver::Use (bool pickup)
PClassActor *missiletype = PClass::FindActor(this->GetClass()->MissileName);
if (missiletype != NULL)
{
AActor *mo = Spawn (missiletype, Owner->x, Owner->y, Owner->z, ALLOW_REPLACE);
AActor *mo = Spawn (missiletype, Owner->Pos(), ALLOW_REPLACE);
if (mo != NULL)
{
if (mo->IsKindOf(RUNTIME_CLASS(AInventory)))
@ -377,7 +376,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagInit)
AActor *mo;
mo = Spawn<APoisonCloud> (self->x, self->y, self->z+28*FRACUNIT, ALLOW_REPLACE);
mo = Spawn<APoisonCloud> (self->PosPlusZ(28*FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->target = self->target;
@ -420,7 +419,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE);
bobIndex = self->special2;
self->z += finesine[bobIndex << BOBTOFINESHIFT] >> 1;
self->AddZ(finesine[bobIndex << BOBTOFINESHIFT] >> 1);
self->special2 = (bobIndex + 1) & 63;
return 0;
}
@ -460,7 +459,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2)
< (3*3)/(2*2))
{
self->SetState (self->SpawnState + 6);
self->z = self->floorz;
self->SetZ(self->floorz);
self->velz = 0;
self->BounceFlags = BOUNCE_None;
self->flags &= ~MF_MISSILE;

View file

@ -88,7 +88,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlyBuzz)
self->angle = ang;
self->args[0]++;
ang >>= ANGLETOFINESHIFT;
if (!P_TryMove(self, self->x + 6 * finecosine[ang], self->y + 6 * finesine[ang], true))
if (!P_TryMove(self, self->X() + 6 * finecosine[ang], self->Y() + 6 * finesine[ang], true))
{
self->SetIdle(true);
return 0;
@ -99,7 +99,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlyBuzz)
self->vely += (pr_fly() - 128) << BOBTOFINESHIFT;
}
int zrand = pr_fly();
if (targ->z + 5*FRACUNIT < self->z && zrand > 150)
if (targ->Z() + 5*FRACUNIT < self->Z() && zrand > 150)
{
zrand = -zrand;
}

View file

@ -45,7 +45,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn)
}
self->special1 = self->args[2]; // Reset frequency count
mo = Spawn (fogs[pr_fogspawn()%3], self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn (fogs[pr_fogspawn()%3], self->Pos(), ALLOW_REPLACE);
if (mo)
{
@ -90,7 +90,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
if ((self->args[3] % 4) == 0)
{
weaveindex = self->special2;
self->z += finesine[weaveindex << BOBTOFINESHIFT] * 4;
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 4);
self->special2 = (weaveindex + 1) & 63;
}

View file

@ -234,7 +234,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
PARAM_ACTION_PROLOGUE;
AActor *mo;
fixed_t z;
self->SpawnState += 2; // [RH] Don't spawn balls again
A_SlowBalls(self);
@ -242,17 +241,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
self->args[3] = SORC_NORMAL;
self->args[4] = SORCBALL_INITIAL_SPEED; // Initial orbit speed
self->special1 = ANGLE_1;
z = self->z - self->floorclip + self->height;
mo = Spawn("SorcBall1", self->x, self->y, z, NO_REPLACE);
fixedvec3 pos = self->PosPlusZ(-self->floorclip + self->height);
mo = Spawn("SorcBall1", pos, NO_REPLACE);
if (mo)
{
mo->target = self;
mo->special2 = SORCFX4_RAPIDFIRE_TIME;
}
mo = Spawn("SorcBall2", self->x, self->y, z, NO_REPLACE);
mo = Spawn("SorcBall2", pos, NO_REPLACE);
if (mo) mo->target = self;
mo = Spawn("SorcBall3", self->x, self->y, z, NO_REPLACE);
mo = Spawn("SorcBall3", pos, NO_REPLACE);
if (mo) mo->target = self;
return 0;
}
@ -276,7 +276,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
}
ASorcBall *actor;
int x,y;
angle_t angle, baseangle;
int mode = self->target->args[3];
AHeresiarch *parent = barrier_cast<AHeresiarch *>(self->target);
@ -375,9 +374,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
S_Sound (actor, CHAN_BODY, "SorcererBallWoosh", 1, ATTN_NORM);
}
actor->special1 = angle; // Set previous angle
x = parent->x + FixedMul(dist, finecosine[angle]);
y = parent->y + FixedMul(dist, finesine[angle]);
actor->SetOrigin (x, y, parent->z - parent->floorclip + parent->height);
fixedvec3 pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
-parent->floorclip + parent->height);
actor->SetOrigin (pos, true);
actor->floorz = parent->floorz;
actor->ceilingz = parent->ceilingz;
return 0;
@ -549,8 +551,7 @@ void ASorcBall2::CastSorcererSpell ()
AActor *parent = target;
AActor *mo;
fixed_t z = parent->z - parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT;
mo = Spawn("SorcFX2", x, y, z, ALLOW_REPLACE);
mo = Spawn("SorcFX2", PosPlusZ(-parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT), ALLOW_REPLACE);
parent->flags2 |= MF2_REFLECTIVE|MF2_INVULNERABLE;
parent->args[0] = SORC_DEFENSE_TIME;
if (mo) mo->target = parent;
@ -676,7 +677,7 @@ void A_SorcOffense2(AActor *actor)
mo->special2 = 35*5/2; // 5 seconds
dist = mo->AproxDistance(dest) / mo->Speed;
if(dist < 1) dist = 1;
mo->velz = (dest->z - mo->z) / dist;
mo->velz = (dest->Z() - mo->Z()) / dist;
}
}
@ -708,24 +709,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBossAttack)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnFizzle)
{
PARAM_ACTION_PROLOGUE;
fixed_t x,y,z;
fixed_t dist = 5*FRACUNIT;
angle_t angle = self->angle >> ANGLETOFINESHIFT;
fixed_t speed = self->Speed;
angle_t rangle;
AActor *mo;
int ix;
x = self->x + FixedMul(dist,finecosine[angle]);
y = self->y + FixedMul(dist,finesine[angle]);
z = self->z - self->floorclip + (self->height>>1);
fixedvec3 pos = self->Vec3Angle(dist, self->angle, -self->floorclip + (self->height >> 1));
for (ix=0; ix<5; ix++)
{
mo = Spawn("SorcSpark1", x, y, z, ALLOW_REPLACE);
mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE);
if (mo)
{
rangle = angle + ((pr_heresiarch()%5) << 1);
rangle = (self->angle >> ANGLETOFINESHIFT) + ((pr_heresiarch()%5) << 1);
mo->velx = FixedMul(pr_heresiarch()%speed, finecosine[rangle]);
mo->vely = FixedMul(pr_heresiarch()%speed, finesine[rangle]);
mo->velz = FRACUNIT*2;
@ -775,7 +771,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
AActor *mo;
mo = Spawn(self->GetClass(), self->x, self->y, self->z, NO_REPLACE);
mo = Spawn(self->GetClass(), self->Pos(), NO_REPLACE);
if (mo)
{
mo->target = self->target;
@ -783,7 +779,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
mo->special1 = self->angle; // Set angle
mo->SetState (mo->FindState("Orbit"));
}
mo = Spawn(self->GetClass(), self->x, self->y, self->z, NO_REPLACE);
mo = Spawn(self->GetClass(), self->Pos(), NO_REPLACE);
if (mo)
{
mo->target = self->target;
@ -808,7 +804,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
PARAM_ACTION_PROLOGUE;
angle_t angle;
fixed_t x,y,z;
fixedvec3 pos;
AActor *parent = self->target;
// [RH] If no parent, then disappear
@ -841,26 +837,28 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
{
self->special1 += ANGLE_1*10;
angle = ((angle_t)self->special1) >> ANGLETOFINESHIFT;
x = parent->x + FixedMul(dist, finecosine[angle]);
y = parent->y + FixedMul(dist, finesine[angle]);
z = parent->z - parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT;
z += FixedMul(15*FRACUNIT,finecosine[angle]);
pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT);
pos.z += FixedMul(15*FRACUNIT,finecosine[angle]);
// Spawn trailer
Spawn("SorcFX2T1", x, y, z, ALLOW_REPLACE);
Spawn("SorcFX2T1", pos, ALLOW_REPLACE);
}
else // Clock wise
{
self->special1 -= ANGLE_1*10;
angle = ((angle_t)self->special1) >> ANGLETOFINESHIFT;
x = parent->x + FixedMul(dist, finecosine[angle]);
y = parent->y + FixedMul(dist, finesine[angle]);
z = parent->z - parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT;
z += FixedMul(20*FRACUNIT,finesine[angle]);
pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT);
pos.z += FixedMul(20*FRACUNIT,finesine[angle]);
// Spawn trailer
Spawn("SorcFX2T1", x, y, z, ALLOW_REPLACE);
Spawn("SorcFX2T1", pos, ALLOW_REPLACE);
}
self->SetOrigin (x, y, z);
self->SetOrigin (pos, true);
self->floorz = parent->floorz;
self->ceilingz = parent->ceilingz;
return 0;
@ -879,7 +877,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnBishop)
PARAM_ACTION_PROLOGUE;
AActor *mo;
mo = Spawn("Bishop", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn("Bishop", self->Pos(), ALLOW_REPLACE);
if (mo)
{
if (!P_TestMobjLocation(mo))
@ -907,7 +905,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcererBishopEntry)
{
PARAM_ACTION_PROLOGUE;
Spawn("SorcFX3Explosion", self->x, self->y, self->z, ALLOW_REPLACE);
Spawn("SorcFX3Explosion", self->Pos(), ALLOW_REPLACE);
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NORM);
return 0;
}

View file

@ -62,7 +62,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryExplode)
for(i = (pr_pottery()&3)+3; i; i--)
{
mo = Spawn ("PotteryBit", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn ("PotteryBit", self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + (pr_pottery()%5));
@ -79,7 +79,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryExplode)
if (!((level.flags2 & LEVEL2_NOMONSTERS) || (dmflags & DF_NO_MONSTERS))
|| !(GetDefaultByType (type)->flags3 & MF3_ISMONSTER))
{ // Only spawn monsters if not -nomonsters
Spawn (type, self->x, self->y, self->z, ALLOW_REPLACE);
Spawn (type, self->Pos(), ALLOW_REPLACE);
}
}
return 0;
@ -141,7 +141,7 @@ IMPLEMENT_CLASS (AZCorpseLynchedNoHeart)
void AZCorpseLynchedNoHeart::PostBeginPlay ()
{
Super::PostBeginPlay ();
Spawn ("BloodPool", x, y, floorz, ALLOW_REPLACE);
Spawn ("BloodPool", X(), Y(), floorz, ALLOW_REPLACE);
}
//============================================================================
@ -156,7 +156,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CorpseBloodDrip)
if (pr_drip() <= 128)
{
Spawn ("CorpseBloodDrip", self->x, self->y, self->z + self->height/2, ALLOW_REPLACE);
Spawn ("CorpseBloodDrip", self->PosPlusZ(self->height/2), ALLOW_REPLACE);
}
return 0;
}
@ -176,7 +176,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CorpseExplode)
for (i = (pr_foo()&3)+3; i; i--)
{
mo = Spawn ("CorpseBit", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn ("CorpseBit", self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + (pr_foo()%3));
@ -186,7 +186,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CorpseExplode)
}
}
// Spawn a skull
mo = Spawn ("CorpseBit", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn ("CorpseBit", self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + 3);
@ -215,9 +215,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn)
for (i = (pr_leaf()&3)+1; i; i--)
{
mo = Spawn (pr_leaf()&1 ? PClass::FindActor("Leaf1") : PClass::FindActor("Leaf2"),
self->x + (pr_leaf.Random2()<<14),
self->y + (pr_leaf.Random2()<<14),
self->z + (pr_leaf()<<14), ALLOW_REPLACE);
self->Vec3Offset(
(pr_leaf.Random2()<<14),
(pr_leaf.Random2()<<14),
(pr_leaf()<<14)), ALLOW_REPLACE);
if (mo)
{
P_ThrustMobj (mo, self->angle, (pr_leaf()<<9)+3*FRACUNIT);
@ -306,9 +307,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode)
for (i = 0; i < 10; i++)
{
mo = Spawn ("ZArmorChunk", self->x+((pr_soaexplode()-128)<<12),
self->y+((pr_soaexplode()-128)<<12),
self->z+(pr_soaexplode()*self->height/256), ALLOW_REPLACE);
mo = Spawn ("ZArmorChunk", self->Vec3Offset(
((pr_soaexplode()-128)<<12),
((pr_soaexplode()-128)<<12),
(pr_soaexplode()*self->height/256)), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + i);
@ -324,7 +326,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode)
if (!((level.flags2 & LEVEL2_NOMONSTERS) || (dmflags & DF_NO_MONSTERS))
|| !(GetDefaultByType (type)->flags3 & MF3_ISMONSTER))
{ // Only spawn monsters if not -nomonsters
Spawn (type, self->x, self->y, self->z, ALLOW_REPLACE);
Spawn (type, self->Pos(), ALLOW_REPLACE);
}
}
S_Sound (self, CHAN_BODY, self->DeathSound, 1, ATTN_NORM);

View file

@ -37,10 +37,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook)
dist = ((pr_iceguylook()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
Spawn (WispTypes[pr_iceguylook()&1],
self->x+FixedMul(dist, finecosine[an]),
self->y+FixedMul(dist, finesine[an]),
self->z+60*FRACUNIT, ALLOW_REPLACE);
Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]),
FixedMul(dist, finesine[an]),
60 * FRACUNIT), ALLOW_REPLACE);
}
return 0;
}
@ -65,10 +65,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
dist = ((pr_iceguychase()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
mo = Spawn (WispTypes[pr_iceguychase()&1],
self->x+FixedMul(dist, finecosine[an]),
self->y+FixedMul(dist, finesine[an]),
self->z+60*FRACUNIT, ALLOW_REPLACE);
mo = Spawn(WispTypes[pr_iceguychase() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]),
FixedMul(dist, finesine[an]),
60 * FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->velx = self->velx;
@ -90,22 +90,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
{
PARAM_ACTION_PROLOGUE;
fixed_t an;
if(!self->target)
{
return 0;
}
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
P_SpawnMissileXYZ(self->x+FixedMul(self->radius>>1,
finecosine[an]), self->y+FixedMul(self->radius>>1,
finesine[an]), self->z+40*FRACUNIT, self, self->target,
PClass::FindActor("IceGuyFX"));
an = (self->angle-ANG90)>>ANGLETOFINESHIFT;
P_SpawnMissileXYZ(self->x+FixedMul(self->radius>>1,
finecosine[an]), self->y+FixedMul(self->radius>>1,
finesine[an]), self->z+40*FRACUNIT, self, self->target,
PClass::FindActor("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->angle+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->angle-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
return 0;
}
@ -143,7 +133,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
for (i = 0; i < 8; i++)
{
mo = P_SpawnMissileAngleZ (self, self->z+3*FRACUNIT,
mo = P_SpawnMissileAngleZ (self, self->Z()+3*FRACUNIT,
PClass::FindActor("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT));
if (mo)
{

View file

@ -99,7 +99,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
spot = iterator.Next ();
if (spot != NULL)
{
P_Teleport (self, spot->x, spot->y, ONFLOORZ, spot->angle, true, true, false);
P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, true, true, false);
}
P_StartScript (self, NULL, 249, NULL, NULL, 0, 0);
@ -141,7 +141,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
self->tracer = spot;
if (spot)
{
P_Teleport (self, spot->x, spot->y, ONFLOORZ, spot->angle, true, true, false);
P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, true, true, false);
}
}
}
@ -267,8 +267,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxMissile)
DEFINE_ACTION_FUNCTION(AActor, A_KoraxCommand)
{
PARAM_ACTION_PROLOGUE;
fixed_t x,y,z;
angle_t ang;
int numcommands;
@ -276,10 +274,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxCommand)
// Shoot stream of lightning to ceiling
ang = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
x = self->x + KORAX_COMMAND_OFFSET * finecosine[ang];
y = self->y + KORAX_COMMAND_OFFSET * finesine[ang];
z = self->z + KORAX_COMMAND_HEIGHT*FRACUNIT;
Spawn("KoraxBolt", x, y, z, ALLOW_REPLACE);
fixedvec3 pos = self->Vec3Offset(
KORAX_COMMAND_OFFSET * finecosine[ang],
KORAX_COMMAND_OFFSET * finesine[ang],
KORAX_COMMAND_HEIGHT*FRACUNIT);
Spawn("KoraxBolt", pos, ALLOW_REPLACE);
if (self->health <= (self->SpawnHealth() >> 1))
{
@ -331,14 +330,13 @@ void KoraxFire (AActor *actor, PClassActor *type, int arm)
};
angle_t ang;
fixed_t x,y,z;
ang = (actor->angle + (arm < 3 ? -KORAX_DELTAANGLE : KORAX_DELTAANGLE))
>> ANGLETOFINESHIFT;
x = actor->x + extension[arm] * finecosine[ang];
y = actor->y + extension[arm] * finesine[ang];
z = actor->z - actor->floorclip + armheight[arm];
P_SpawnKoraxMissile (x, y, z, actor, actor->target, type);
ang = (actor->angle + (arm < 3 ? -KORAX_DELTAANGLE : KORAX_DELTAANGLE)) >> ANGLETOFINESHIFT;
fixedvec3 pos = actor->Vec3Offset(
extension[arm] * finecosine[ang],
extension[arm] * finesine[ang],
-actor->floorclip + armheight[arm]);
P_SpawnKoraxMissile (pos.x, pos.y, pos.z, actor, actor->target, type);
}
//============================================================================
@ -393,11 +391,11 @@ void A_KSpiritSeeker (AActor *actor, angle_t thresh, angle_t turnMax)
actor->vely = FixedMul (actor->Speed, finesine[angle]);
if (!(level.time&15)
|| actor->z > target->z+(target->GetDefault()->height)
|| actor->z+actor->height < target->z)
|| actor->Z() > target->Z()+(target->GetDefault()->height)
|| actor->Top() < target->Z())
{
newZ = target->z+((pr_kspiritseek()*target->GetDefault()->height)>>8);
deltaZ = newZ-actor->z;
newZ = target->Z()+((pr_kspiritseek()*target->GetDefault()->height)>>8);
deltaZ = newZ-actor->Z();
if (abs(deltaZ) > 15*FRACUNIT)
{
if(deltaZ > 0)
@ -482,11 +480,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_KBoltRaise)
fixed_t z;
// Spawn a child upward
z = self->z + KORAX_BOLT_HEIGHT;
z = self->Z() + KORAX_BOLT_HEIGHT;
if ((z + KORAX_BOLT_HEIGHT) < self->ceilingz)
{
mo = Spawn("KoraxBolt", self->x, self->y, z, ALLOW_REPLACE);
mo = Spawn("KoraxBolt", self->X(), self->Y(), z, ALLOW_REPLACE);
if (mo)
{
mo->special1 = KORAX_BOLT_LIFETIME;
@ -529,6 +527,6 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
{
dist = 1;
}
th->velz = (dest->z-z+(30*FRACUNIT))/dist;
th->velz = (dest->Z()-z+(30*FRACUNIT))/dist;
return (P_CheckMissileSpawn(th, source->radius) ? th : NULL);
}

View file

@ -128,7 +128,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
// every so many calls, spawn a new missile in its set directions
if (spawndir & SHARDSPAWN_LEFT)
{
mo = P_SpawnMissileAngleZSpeed (self, self->z, RUNTIME_CLASS(AFrostMissile), self->angle+(ANG45/9),
mo = P_SpawnMissileAngleZSpeed (self, self->Z(), RUNTIME_CLASS(AFrostMissile), self->angle+(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target);
if (mo)
{
@ -140,7 +140,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
}
if (spawndir & SHARDSPAWN_RIGHT)
{
mo = P_SpawnMissileAngleZSpeed (self, self->z, RUNTIME_CLASS(AFrostMissile), self->angle-(ANG45/9),
mo = P_SpawnMissileAngleZSpeed (self, self->Z(), RUNTIME_CLASS(AFrostMissile), self->angle-(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target);
if (mo)
{
@ -152,7 +152,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
}
if (spawndir & SHARDSPAWN_UP)
{
mo = P_SpawnMissileAngleZSpeed (self, self->z+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle,
mo = P_SpawnMissileAngleZSpeed (self, self->Z()+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle,
0, (15+2*spermcount)<<FRACBITS, self->target);
if (mo)
{
@ -167,7 +167,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
}
if (spawndir & SHARDSPAWN_DOWN)
{
mo = P_SpawnMissileAngleZSpeed (self, self->z-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle,
mo = P_SpawnMissileAngleZSpeed (self, self->Z()-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle,
0, (15+2*spermcount)<<FRACBITS, self->target);
if (mo)
{

View file

@ -156,12 +156,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
{
return 0;
}
self->z = self->floorz;
self->SetZ(self->floorz);
target = self->lastenemy->tracer;
}
else if (self->flags3 & MF3_CEILINGHUGGER)
{
self->z = self->ceilingz-self->height;
self->SetZ(self->ceilingz-self->height);
target = self->tracer;
}
if (self->flags3 & MF3_FLOORHUGGER)
@ -240,9 +240,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
{
deltaZ = -10*FRACUNIT;
}
mo = Spawn(lightning, self->x+((pr_zap()-128)*self->radius/256),
self->y+((pr_zap()-128)*self->radius/256),
self->z+deltaZ, ALLOW_REPLACE);
mo = Spawn(lightning,
self->Vec3Offset(
((pr_zap() - 128)*self->radius / 256),
((pr_zap() - 128)*self->radius / 256),
deltaZ), ALLOW_REPLACE);
if (mo)
{
mo->lastenemy = self;
@ -351,7 +353,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LastZap)
{
lightning = PClass::FindActor(NAME_LightningZap);
}
mo = Spawn(lightning, self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn(lightning, self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->FindState (NAME_Death));

View file

@ -142,8 +142,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack)
P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &linetarget, ANGLE_1*32);
if (linetarget == NULL)
{
BlockCheckLine.x = self->x;
BlockCheckLine.y = self->y;
BlockCheckLine.x = self->X();
BlockCheckLine.y = self->Y();
BlockCheckLine.dx = -finesine[angle >> ANGLETOFINESHIFT];
BlockCheckLine.dy = -finecosine[angle >> ANGLETOFINESHIFT];
linetarget = P_BlockmapSearch (self, 10, FrontBlockCheck);
@ -211,7 +211,7 @@ static AActor *FrontBlockCheck (AActor *mo, int index, void *)
{
if (link->Me != mo)
{
if (P_PointOnDivlineSide (link->Me->x, link->Me->y, &BlockCheckLine) == 0 &&
if (P_PointOnDivlineSide (link->Me->X(), link->Me->Y(), &BlockCheckLine) == 0 &&
mo->IsOkayToAttack (link->Me))
{
return link->Me;
@ -231,7 +231,7 @@ void MStaffSpawn2 (AActor *actor, angle_t angle)
{
AActor *mo;
mo = P_SpawnMissileAngleZ (actor, actor->z+40*FRACUNIT,
mo = P_SpawnMissileAngleZ (actor, actor->Z()+40*FRACUNIT,
RUNTIME_CLASS(AMageStaffFX2), angle, 0);
if (mo)
{

View file

@ -101,7 +101,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PigPain)
PARAM_ACTION_PROLOGUE;
CALL_ACTION(A_Pain, self);
if (self->z <= self->floorz)
if (self->Z() <= self->floorz)
{
self->velz = FRACUNIT*7/2;
}

View file

@ -228,9 +228,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentSpawnGibs)
for (int i = countof(GibTypes)-1; i >= 0; --i)
{
mo = Spawn (GibTypes[i],
self->x+((pr_serpentgibs()-128)<<12),
self->y+((pr_serpentgibs()-128)<<12),
fixedvec2 pos = self->Vec2Offset(
((pr_serpentgibs() - 128) << 12),
((pr_serpentgibs() - 128) << 12));
mo = Spawn (GibTypes[i], pos.x, pos.y,
self->floorz+FRACUNIT, ALLOW_REPLACE);
if (mo)
{
@ -294,7 +296,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentHeadCheck)
{
PARAM_ACTION_PROLOGUE;
if (self->z <= self->floorz)
if (self->Z() <= self->floorz)
{
if (Terrains[P_GetThingFloorType(self)].IsLiquid)
{

View file

@ -100,7 +100,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustInitDn)
self->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
self->renderflags = RF_INVISIBLE;
static_cast<AThrustFloor *>(self)->DirtClump =
Spawn("DirtClump", self->x, self->y, self->z, ALLOW_REPLACE);
Spawn("DirtClump", self->Pos(), ALLOW_REPLACE);
return 0;
}
@ -154,7 +154,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale)
PARAM_ACTION_PROLOGUE;
AActor *thing;
FBlockThingsIterator it(FBoundingBox(self->x, self->y, self->radius));
FBlockThingsIterator it(FBoundingBox(self->X(), self->Y(), self->radius));
while ((thing = it.Next()))
{
if (!thing->intersects(self))

View file

@ -53,13 +53,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_Summon)
AMinotaurFriend *mo;
mo = Spawn<AMinotaurFriend> (self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn<AMinotaurFriend> (self->Pos(), ALLOW_REPLACE);
if (mo)
{
if (P_TestMobjLocation(mo) == false || !self->tracer)
{ // Didn't fit - change back to artifact
mo->Destroy ();
AActor *arti = Spawn<AArtiDarkServant> (self->x, self->y, self->z, ALLOW_REPLACE);
AActor *arti = Spawn<AArtiDarkServant> (self->Pos(), ALLOW_REPLACE);
if (arti) arti->flags |= MF_DROPPED;
return 0;
}
@ -78,7 +78,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Summon)
}
// Make smoke puff
Spawn ("MinotaurSmoke", self->x, self->y, self->z, ALLOW_REPLACE);
Spawn ("MinotaurSmoke", self->Pos(), ALLOW_REPLACE);
S_Sound (self, CHAN_VOICE, mo->ActiveSound, 1, ATTN_NORM);
}
return 0;

View file

@ -51,7 +51,7 @@ static void TeloSpawn (AActor *source, const char *type)
{
AActor *fx;
fx = Spawn (type, source->x, source->y, source->z, ALLOW_REPLACE);
fx = Spawn (type, source->Pos(), ALLOW_REPLACE);
if (fx)
{
fx->special1 = TELEPORT_LIFE; // Lifetime countdown

View file

@ -31,12 +31,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithInit)
{
PARAM_ACTION_PROLOGUE;
self->z += 48<<FRACBITS;
self->AddZ(48<<FRACBITS);
// [RH] Make sure the wraith didn't go into the ceiling
if (self->z + self->height > self->ceilingz)
if (self->Top() > self->ceilingz)
{
self->z = self->ceilingz - self->height;
self->SetZ(self->ceilingz - self->height);
}
self->special1 = 0; // index into floatbob
@ -124,7 +124,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX2)
for (i = 2; i; --i)
{
mo = Spawn ("WraithFX2", self->x, self->y, self->z, ALLOW_REPLACE);
mo = Spawn ("WraithFX2", self->Pos(), ALLOW_REPLACE);
if(mo)
{
if (pr_wraithfx2 ()<128)
@ -164,12 +164,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX3)
while (numdropped-- > 0)
{
mo = Spawn ("WraithFX3", self->x, self->y, self->z, ALLOW_REPLACE);
fixedvec3 pos = self->Vec3Offset(
(pr_wraithfx3()-128)<<11,
(pr_wraithfx3()-128)<<11,
(pr_wraithfx3()<<10));
mo = Spawn ("WraithFX3", pos, ALLOW_REPLACE);
if (mo)
{
mo->x += (pr_wraithfx3()-128)<<11;
mo->y += (pr_wraithfx3()-128)<<11;
mo->z += (pr_wraithfx3()<<10);
mo->floorz = self->floorz;
mo->ceilingz = self->ceilingz;
mo->target = self;
}
}
@ -213,23 +217,31 @@ void A_WraithFX4 (AActor *self)
if (spawn4)
{
mo = Spawn ("WraithFX4", self->x, self->y, self->z, ALLOW_REPLACE);
fixedvec3 pos = self->Vec3Offset(
(pr_wraithfx4()-128)<<12,
(pr_wraithfx4()-128)<<12,
(pr_wraithfx4()<<10));
mo = Spawn ("WraithFX4", pos, ALLOW_REPLACE);
if (mo)
{
mo->x += (pr_wraithfx4()-128)<<12;
mo->y += (pr_wraithfx4()-128)<<12;
mo->z += (pr_wraithfx4()<<10);
mo->floorz = self->floorz;
mo->ceilingz = self->ceilingz;
mo->target = self;
}
}
if (spawn5)
{
mo = Spawn ("WraithFX5", self->x, self->y, self->z, ALLOW_REPLACE);
fixedvec3 pos = self->Vec3Offset(
(pr_wraithfx4()-128)<<12,
(pr_wraithfx4()-128)<<12,
(pr_wraithfx4()<<10));
mo = Spawn ("WraithFX5", pos, ALLOW_REPLACE);
if (mo)
{
mo->x += (pr_wraithfx4()-128)<<11;
mo->y += (pr_wraithfx4()-128)<<11;
mo->z += (pr_wraithfx4()<<10);
mo->floorz = self->floorz;
mo->ceilingz = self->ceilingz;
mo->target = self;
}
}
@ -246,7 +258,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithChase)
PARAM_ACTION_PROLOGUE;
int weaveindex = self->special1;
self->z += finesine[weaveindex << BOBTOFINESHIFT] * 8;
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->special1 = (weaveindex + 2) & 63;
// if (self->floorclip > 0)
// {

View file

@ -1220,9 +1220,7 @@ void G_FinishTravel ()
pawn->angle = pawndup->angle;
pawn->pitch = pawndup->pitch;
}
pawn->x = pawndup->x;
pawn->y = pawndup->y;
pawn->z = pawndup->z;
pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z());
pawn->velx = pawndup->velx;
pawn->vely = pawndup->vely;
pawn->velz = pawndup->velz;

View file

@ -194,8 +194,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
S_Sound (self, CHAN_WEAPON, "minotaur/sight", 1, ATTN_NORM);
}
dist = self->AproxDistance (target);
if (target->z+target->height > self->z
&& target->z+target->height < self->z+self->height
if (target->Top() > self->Z()
&& target->Top() < self->Top()
&& dist < (friendly ? 16*64*FRACUNIT : 8*64*FRACUNIT)
&& dist > 1*64*FRACUNIT
&& pr_minotaurdecide() < 150)
@ -213,7 +213,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
self->vely = FixedMul (MNTR_CHARGE_SPEED, finesine[angle]);
self->special1 = TICRATE/2; // Charge duration
}
else if (target->z == target->floorz
else if (target->Z() == target->floorz
&& dist < 9*64*FRACUNIT
&& pr_minotaurdecide() < (friendly ? 100 : 220))
{ // Floor fire attack
@ -257,7 +257,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurCharge)
{
type = PClass::FindActor("PunchPuff");
}
puff = Spawn (type, self->x, self->y, self->z, ALLOW_REPLACE);
puff = Spawn (type, self->Pos(), ALLOW_REPLACE);
puff->velz = 2*FRACUNIT;
self->special1--;
}
@ -301,7 +301,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
return 0;
}
z = self->z + 40*FRACUNIT;
z = self->Z() + 40*FRACUNIT;
PClassActor *fx = PClass::FindActor("MinotaurFX1");
if (fx)
{
@ -391,10 +391,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
AActor *mo;
fixed_t x, y;
self->z = self->floorz;
x = self->x + (pr_fire.Random2 () << 10);
y = self->y + (pr_fire.Random2 () << 10);
mo = Spawn("MinotaurFX3", x, y, self->floorz, ALLOW_REPLACE);
self->SetZ(self->floorz);
fixedvec2 pos = self->Vec2Offset(
(pr_fire.Random2 () << 10),
(pr_fire.Random2 () << 10));
mo = Spawn("MinotaurFX3", pos.x, pos.y, self->floorz, ALLOW_REPLACE);
mo->target = self->target;
mo->velx = 1; // Force block checking
P_CheckMissileSpawn (mo, self->radius);

View file

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

View file

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

View file

@ -112,9 +112,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / (100 * FRACUNIT));
self->angle += rotationspeed;
self->x = self->target->x + rotationradius * finecosine[self->angle >> ANGLETOFINESHIFT];
self->y = self->target->y + rotationradius * finesine[self->angle >> ANGLETOFINESHIFT];
self->z = self->target->z;
self->SetOrigin(self->target->Vec3Angle(rotationradius, self->angle, 0), true);
self->floorz = self->target->floorz;
self->ceilingz = self->target->ceilingz;
return 0;
}
@ -126,16 +126,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
angle_t startangle;
AActor *ball;
fixed_t cx, cy, cz;
if (balltype == NULL)
{
balltype = PClass::FindActor("BridgeBall");
}
cx = self->x;
cy = self->y;
cz = self->z;
startangle = pr_orbit() << 24;
// Spawn triad into world -- may be more than a triad now.
@ -143,7 +139,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
for (int i = 0; i < ballcount; i++)
{
ball = Spawn(balltype, cx, cy, cz, ALLOW_REPLACE);
ball = Spawn(balltype, self->Pos(), ALLOW_REPLACE);
ball->angle = startangle + (ANGLE_45/32) * (256/ballcount) * i;
ball->target = self;
CALL_ACTION(A_BridgeOrbit, ball);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -22,7 +22,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall)
{
PARAM_ACTION_PROLOGUE;
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)
{
@ -43,7 +43,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge)
{
PARAM_ACTION_PROLOGUE;
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)
{
@ -67,7 +67,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack)
if (self->target == NULL)
return 0;
AActor *foo = Spawn("SpectralLightningV2", self->x, self->y, self->z + 32*FRACUNIT, ALLOW_REPLACE);
AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE);
foo->velz = -12*FRACUNIT;
foo->target = self;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail)
{
PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("SpectralLightningHTail", self->x - self->velx, self->y - self->vely, self->z, ALLOW_REPLACE);
AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->velx, -self->vely, 0), ALLOW_REPLACE);
foo->angle = self->angle;
foo->FriendPlayer = self->FriendPlayer;
@ -67,17 +67,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
self->velx += pr_zap5.Random2(3) << FRACBITS;
self->vely += pr_zap5.Random2(3) << FRACBITS;
x = self->x + pr_zap5.Random2(3) * FRACUNIT * 50;
y = self->y + pr_zap5.Random2(3) * FRACUNIT * 50;
fixedvec2 pos = self->Vec2Offset(
pr_zap5.Random2(3) * FRACUNIT * 50,
pr_zap5.Random2(3) * FRACUNIT * 50);
flash = Spawn (self->threshold > 25 ? PClass::FindActor(NAME_SpectralLightningV2) :
PClass::FindActor(NAME_SpectralLightningV1), x, y, ONCEILINGZ, ALLOW_REPLACE);
PClass::FindActor(NAME_SpectralLightningV1), pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE);
flash->target = self->target;
flash->velz = -18*FRACUNIT;
flash->FriendPlayer = self->FriendPlayer;
flash = Spawn(NAME_SpectralLightningV2, self->x, self->y, ONCEILINGZ, ALLOW_REPLACE);
flash = Spawn(NAME_SpectralLightningV2, self->X(), self->Y(), ONCEILINGZ, ALLOW_REPLACE);
flash->target = self->target;
flash->velz = -18*FRACUNIT;
@ -137,11 +138,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
}
if (dest->height >= 56*FRACUNIT)
{
slope = (dest->z+40*FRACUNIT - self->z) / dist;
slope = (dest->Z()+40*FRACUNIT - self->Z()) / dist;
}
else
{
slope = (dest->z + self->height*2/3 - self->z) / dist;
slope = (dest->Z() + self->height*2/3 - self->Z()) / dist;
}
if (slope < self->velz)
{

View file

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

View file

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

View file

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

View file

@ -20,10 +20,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud)
fixed_t spawnx, spawny;
spawnx = self->x + (pr_bang4cloud.Random2() & 3) * 10240;
spawny = self->y + (pr_bang4cloud.Random2() & 3) * 10240;
fixedvec3 pos = self->Vec3Offset((pr_bang4cloud.Random2() & 3) * 10240, (pr_bang4cloud.Random2() & 3) * 10240, 0);
Spawn("Bang4Cloud", spawnx, spawny, self->z, ALLOW_REPLACE);
Spawn("Bang4Cloud", pos, ALLOW_REPLACE);
return 0;
}
@ -110,7 +109,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
for (int i = 0; i < 8; ++i)
{
foo = Spawn("Rubble1", self->x, self->y, self->z, ALLOW_REPLACE);
foo = Spawn("Rubble1", self->Pos(), ALLOW_REPLACE);
if (foo != NULL)
{
int t = pr_lightout() & 15;

View file

@ -76,7 +76,8 @@ angle_t FNodeBuilder::PointToAngle (fixed_t x, fixed_t y)
#else // !__APPLE__ || __llvm__
double ang = atan2 (double(y), double(x));
#endif // __APPLE__ && !__llvm__
return angle_t(ang * rad2bam) << 1;
// Convert to signed first since negative double to unsigned is undefined.
return angle_t(int(ang * rad2bam)) << 1;
}
void FNodeBuilder::FindUsedVertices (vertex_t *oldverts, int max)

View file

@ -337,7 +337,7 @@ void P_PlayerOnSpecial3DFloor(player_t* player)
{
//Water and DEATH FOG!!! heh
if (player->mo->Z() > rover->top.plane->ZatPoint(player->mo) ||
(player->mo->Z() + player->mo->height) < rover->bottom.plane->ZatPoint(player->mo))
player->mo->Top() < rover->bottom.plane->ZatPoint(player->mo))
continue;
}

View file

@ -144,6 +144,10 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z);
int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz);
inline int P_Find3DFloor(sector_t * sec, const fixedvec3 &pos, bool above, bool floor, fixed_t &cmpz)
{
return P_Find3DFloor(sec, pos.x, pos.y, pos.z, above, floor, cmpz);
}
#endif

View file

@ -4157,7 +4157,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
}
else
{
fixed_t z = actor->Z() + actor->height;
fixed_t z = actor->Top();
// Looking through planes from bottom to top
for (i = numff-1; i >= 0; --i)
{

View file

@ -451,9 +451,7 @@ void P_RunEffect (AActor *actor, int effects)
{
// Grenade trail
fixedvec3 pos = actor->Vec3Offset(
-FixedMul(finecosine[(moveangle) >> ANGLETOFINESHIFT], actor->radius * 2),
-FixedMul(finesine[(moveangle) >> ANGLETOFINESHIFT], actor->radius * 2),
fixedvec3 pos = actor->Vec3Angle(-actor->radius * 2, moveangle,
-(actor->height >> 3) * (actor->velz >> 16) + (2 * actor->height) / 3);
P_DrawSplash2 (6, pos.x, pos.y, pos.z,

View file

@ -243,9 +243,9 @@ bool AActor::CheckMeleeRange ()
// [RH] Don't melee things too far above or below actor.
if (!(flags5 & MF5_NOVERTICALMELEERANGE))
{
if (pl->Z() > z + height)
if (pl->Z() > Top())
return false;
if (pl->Z() + pl->height < z)
if (pl->Top() < Z())
return false;
}
@ -280,11 +280,11 @@ bool P_CheckMeleeRange2 (AActor *actor)
{
return false;
}
if (mo->Z() > actor->Z()+actor->height)
if (mo->Z() > actor->Top())
{ // Target is higher than the attacker
return false;
}
else if (actor->Z() > mo->Z()+mo->height)
else if (actor->Z() > mo->Top())
{ // Attacker is higher
return false;
}
@ -473,8 +473,8 @@ bool P_Move (AActor *actor)
}
}
tryx = (origx = actor->x) + (deltax = FixedMul (speed, xspeed[actor->movedir]));
tryy = (origy = actor->y) + (deltay = FixedMul (speed, yspeed[actor->movedir]));
tryx = (origx = actor->X()) + (deltax = FixedMul (speed, xspeed[actor->movedir]));
tryy = (origy = actor->Y()) + (deltay = FixedMul (speed, yspeed[actor->movedir]));
// Like P_XYMovement this should do multiple moves if the step size is too large
@ -519,15 +519,14 @@ bool P_Move (AActor *actor)
// so make it switchable
if (nomonsterinterpolation)
{
actor->PrevX = actor->x;
actor->PrevY = actor->y;
actor->PrevZ = actor->z;
actor->PrevX = actor->X();
actor->PrevY = actor->Y();
actor->PrevZ = actor->Z();
}
if (try_ok && friction > ORIG_FRICTION)
{
actor->x = origx;
actor->y = origy;
actor->SetOrigin(origx, origy, actor->Z(), false);
movefactor *= FRACUNIT / ORIG_FRICTION_FACTOR / 4;
actor->velx += FixedMul (deltax, movefactor);
actor->vely += FixedMul (deltay, movefactor);
@ -543,12 +542,12 @@ bool P_Move (AActor *actor)
if (actor->Y() <= actor->floorz + actor->MaxStepHeight)
{
fixed_t savedz = actor->Z();
actor->z = actor->floorz;
actor->SetZ(actor->floorz);
// Make sure that there isn't some other actor between us and
// the floor we could get stuck in. The old code did not do this.
if (!P_TestMobjZ(actor))
{
actor->z = savedz;
actor->SetZ(savedz);
}
else
{ // The monster just hit the floor, so trigger any actions.
@ -568,10 +567,10 @@ bool P_Move (AActor *actor)
{ // must adjust height
fixed_t savedz = actor->Z();
if (actor->z < tm.floorz)
actor->z += actor->FloatSpeed;
if (actor->Z() < tm.floorz)
actor->AddZ(actor->FloatSpeed);
else
actor->z -= actor->FloatSpeed;
actor->AddZ(-actor->FloatSpeed);
// [RH] Check to make sure there's nothing in the way of the float
@ -580,7 +579,7 @@ bool P_Move (AActor *actor)
actor->flags |= MF_INFLOAT;
return true;
}
actor->z = savedz;
actor->SetZ(savedz);
}
if (!spechit.Size ())
@ -812,28 +811,25 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
void P_NewChaseDir(AActor * actor)
{
fixed_t deltax;
fixed_t deltay;
fixedvec2 delta;
actor->strafecount = 0;
if ((actor->flags5&MF5_CHASEGOAL || actor->goal == actor->target) && actor->goal!=NULL)
{
deltax = actor->goal->x - actor->x;
deltay = actor->goal->y - actor->y;
delta = actor->Vec2To(actor->goal);
}
else if (actor->target != NULL)
{
deltax = actor->target->x - actor->x;
deltay = actor->target->y - actor->y;
delta = actor->Vec2To(actor->target);
if (!(actor->flags6 & MF6_NOFEAR))
{
if ((actor->target->player != NULL && (actor->target->player->cheats & CF_FRIGHTENING)) ||
(actor->flags4 & MF4_FRIGHTENED))
{
deltax = -deltax;
deltay = -deltay;
delta.x = -delta.x;
delta.y = -delta.y;
}
}
}
@ -877,7 +873,7 @@ void P_NewChaseDir(AActor * actor)
{
angle = R_PointToAngle2(0,0,line->dx,line->dy); // front side dropoff
}
else if (front == actor->z && back < actor->z - actor->MaxDropOffHeight)
else if (front == actor->Z() && back < actor->Z() - actor->MaxDropOffHeight)
{
angle = R_PointToAngle2(line->dx,line->dy,0,0); // back side dropoff
}
@ -946,12 +942,12 @@ void P_NewChaseDir(AActor * actor)
if (ismeleeattacker)
{
actor->strafecount = pr_enemystrafe() & 15;
deltax = -deltax, deltay = -deltay;
delta.x = -delta.x, delta.y = -delta.y;
}
}
}
P_DoNewChaseDir(actor, deltax, deltay);
P_DoNewChaseDir(actor, delta.x, delta.y);
// If strafing, set movecount to strafecount so that old Doom
// logic still works the same, except in the strafing part
@ -983,7 +979,7 @@ void P_RandomChaseDir (AActor *actor)
if (actor->flags & MF_FRIENDLY)
{
AActor *player;
fixed_t deltax, deltay;
fixedvec2 delta;
dirtype_t d[3];
if (actor->FriendPlayer != 0)
@ -1005,19 +1001,18 @@ void P_RandomChaseDir (AActor *actor)
{
if (pr_newchasedir() & 1 || !P_CheckSight (actor, player))
{
deltax = player->x - actor->x;
deltay = player->y - actor->y;
delta = actor->Vec2To(player);
if (deltax>128*FRACUNIT)
if (delta.x>128*FRACUNIT)
d[1]= DI_EAST;
else if (deltax<-128*FRACUNIT)
else if (delta.x<-128*FRACUNIT)
d[1]= DI_WEST;
else
d[1]=DI_NODIR;
if (deltay<-128*FRACUNIT)
if (delta.y<-128*FRACUNIT)
d[2]= DI_SOUTH;
else if (deltay>128*FRACUNIT)
else if (delta.y>128*FRACUNIT)
d[2]= DI_NORTH;
else
d[2]=DI_NODIR;
@ -1025,13 +1020,13 @@ void P_RandomChaseDir (AActor *actor)
// try direct route
if (d[1] != DI_NODIR && d[2] != DI_NODIR)
{
actor->movedir = diags[((deltay<0)<<1) + (deltax>0)];
actor->movedir = diags[((delta.y<0)<<1) + (delta.x>0)];
if (actor->movedir != turnaround && P_TryWalk(actor))
return;
}
// try other directions
if (pr_newchasedir() > 200 || abs(deltay) > abs(deltax))
if (pr_newchasedir() > 200 || abs(delta.y) > abs(delta.x))
{
swapvalues (d[1], d[2]);
}
@ -2488,8 +2483,8 @@ void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *mele
if ((!fastchase || !actor->FastChaseStrafeCount) && !dontmove)
{
// CANTLEAVEFLOORPIC handling was completely missing in the non-serpent functions.
fixed_t oldX = actor->x;
fixed_t oldY = actor->y;
fixed_t oldX = actor->X();
fixed_t oldY = actor->Y();
FTextureID oldFloor = actor->floorpic;
// chase towards player
@ -2540,11 +2535,12 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (self->movedir != DI_NODIR)
{
const fixed_t absSpeed = abs (self->Speed);
fixed_t viletryx = self->x + FixedMul (absSpeed, xspeed[self->movedir]);
fixed_t viletryy = self->y + FixedMul (absSpeed, yspeed[self->movedir]);
fixedvec2 viletry = self->Vec2Offset(
FixedMul (absSpeed, xspeed[self->movedir]),
FixedMul (absSpeed, yspeed[self->movedir]), true);
AActor *corpsehit;
FBlockThingsIterator it(FBoundingBox(viletryx, viletryy, 32*FRACUNIT));
FBlockThingsIterator it(FBoundingBox(viletry.x, viletry.y, 32*FRACUNIT));
while ((corpsehit = it.Next()))
{
FState *raisestate = corpsehit->GetRaiseState();
@ -2553,8 +2549,8 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
// use the current actor's radius instead of the Arch Vile's default.
fixed_t maxdist = corpsehit->GetDefault()->radius + self->radius;
if (abs(corpsehit->x - viletryx) > maxdist ||
abs(corpsehit->y - viletryy) > maxdist)
if (abs(corpsehit->X() - viletry.x) > maxdist ||
abs(corpsehit->Y() - viletry.y) > maxdist)
continue; // not actually touching
// Let's check if there are floors in between the archvile and its target
sector_t *vilesec = self->Sector;
@ -2565,8 +2561,8 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (testsec)
{
fixed_t zdist1, zdist2;
if (P_Find3DFloor(testsec, corpsehit->X(), corpsehit->Y(), corpsehit->Z(), false, true, zdist1)
!= P_Find3DFloor(testsec, self->X(), self->Y(), self->Z(), false, true, zdist2))
if (P_Find3DFloor(testsec, corpsehit->Pos(), false, true, zdist1)
!= P_Find3DFloor(testsec, self->Pos(), false, true, zdist2))
{
// Not on same floor
if (vilesec == corpsec || abs(zdist1 - self->Z()) > self->height)
@ -2583,7 +2579,7 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
corpsehit->flags |= MF_SOLID;
corpsehit->height = corpsehit->GetDefault()->height;
bool check = P_CheckPosition(corpsehit, corpsehit->X(), corpsehit->Y());
bool check = P_CheckPosition(corpsehit, corpsehit->Pos());
corpsehit->flags = oldflags;
corpsehit->radius = oldradius;
corpsehit->height = oldheight;
@ -2804,18 +2800,15 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
// disabled and is so by default.
if (max_pitch <= ANGLE_180)
{
// [DH] Don't need to do proper fixed->double conversion, since the
// result is only used in a ratio.
double dist_x = other->x - self->x;
double dist_y = other->y - self->y;
TVector2<double> dist = self->Vec2To(other);
// Positioning ala missile spawning, 32 units above foot level
fixed_t source_z = self->z + 32*FRACUNIT + self->GetBobOffset();
fixed_t target_z = other->z + 32*FRACUNIT + other->GetBobOffset();
fixed_t source_z = self->Z() + 32*FRACUNIT + self->GetBobOffset();
fixed_t target_z = other->Z() + 32*FRACUNIT + other->GetBobOffset();
// If the target z is above the target's head, reposition to the middle of
// its body.
if (target_z >= other->Z() + other->height)
if (target_z >= other->Top())
{
target_z = other->Z() + (other->height / 2);
}
@ -2831,9 +2824,9 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
if (!(flags & FAF_NODISTFACTOR))
target_z += pitch_offset;
double dist_z = target_z - source_z;
double dist = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z);
int other_pitch = (int)rad2bam(asin(dist_z / dist));
double dist_z = FIXED2DBL(target_z - source_z);
double ddist = sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z);
int other_pitch = (int)rad2bam(asin(dist_z / ddist));
if (max_pitch != 0)
{
@ -2950,9 +2943,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
if (linetarget == NULL)
{
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
TVector2<double> xydiff(self->target->x - self->x, self->target->y - self->y);
double zdiff = (self->target->z + (self->target->height>>1)) -
(self->z + (self->height>>1) - self->floorclip);
TVector2<double> xydiff = self->Vec2To(self->target);
double zdiff = FIXED2DBL((self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip));
self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI);
}

View file

@ -3107,7 +3107,7 @@ FUNC(LS_GlassBreak)
{
glass = Spawn("GlassJunk", x, y, ONFLOORZ, ALLOW_REPLACE);
glass->z += 24 * FRACUNIT;
glass->AddZ(24 * FRACUNIT);
glass->SetState (glass->SpawnState + (pr_glass() % glass->health));
an = pr_glass() << (32-8);
glass->angle = an;

View file

@ -134,6 +134,10 @@ enum EPuffFlags
};
AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, int flags = 0, AActor *vict = NULL);
inline AActor *P_SpawnPuff(AActor *source, const PClass *pufftype, const fixedvec3 &pos, angle_t dir, int updown, int flags = 0, AActor *vict = NULL)
{
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_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);
@ -141,10 +145,13 @@ void P_RipperBlood (AActor *mo, AActor *bleeder);
int P_GetThingFloorType (AActor *thing);
void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target);
AActor * P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassActor *type);
AActor *P_SpawnMissile (AActor* source, AActor* dest, PClassActor *type, AActor* owner = NULL);
AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, PClassActor *type);
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, PClassActor *type, bool checkspawn = true, AActor *owner = NULL);
inline AActor *P_SpawnMissileXYZ(const fixedvec3 &pos, AActor *source, AActor *dest, PClassActor *type, bool checkspawn = true, AActor *owner = NULL)
{
return P_SpawnMissileXYZ(pos.x, pos.y, pos.z, source, dest, type, checkspawn, owner);
}
AActor *P_SpawnMissileAngle (AActor *source, PClassActor *type, angle_t angle, fixed_t velz);
AActor *P_SpawnMissileAngleSpeed (AActor *source, PClassActor *type, angle_t angle, fixed_t velz, fixed_t speed);
AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, PClassActor *type, angle_t angle, fixed_t velz);
@ -462,6 +469,10 @@ bool P_TestMobjLocation (AActor *mobj);
bool P_TestMobjZ (AActor *mobj, bool quick=true, AActor **pOnmobj = NULL);
bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bool actorsonly=false);
bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, bool actorsonly=false);
inline bool P_CheckPosition(AActor *thing, const fixedvec3 &pos, bool actorsonly = false)
{
return P_CheckPosition(thing, pos.x, pos.y, actorsonly);
}
AActor *P_CheckOnmobj (AActor *thing);
void P_FakeZMovement (AActor *mo);
bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false);
@ -469,6 +480,10 @@ bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane
bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y);
void P_ApplyTorque(AActor *mo);
bool P_TeleportMove (AActor* thing, fixed_t x, fixed_t y, fixed_t z, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters
inline bool P_TeleportMove(AActor* thing, const fixedvec3 &pos, bool telefrag, bool modifyactor = true)
{
return P_TeleportMove(thing, pos.x, pos.y, pos.z, telefrag, modifyactor);
}
void P_PlayerStartStomp (AActor *actor); // [RH] Stomp on things for a newly spawned player
void P_SlideMove (AActor* mo, fixed_t tryx, fixed_t tryy, int numsteps);
bool P_BounceWall (AActor *mo);

View file

@ -190,7 +190,7 @@ static bool PIT_FindFloorCeiling(line_t *ld, const FBoundingBox &box, FCheckPosi
}
else if (r >= (1 << 24))
{
P_LineOpening(open, tmf.thing, ld, sx = ld->v2->x, sy = ld->v2->y, tmf.thing->x, tmf.thing->y, flags);
P_LineOpening(open, tmf.thing, ld, sx = ld->v2->x, sy = ld->v2->y, tmf.thing->X(), tmf.thing->Y(), flags);
}
else
{
@ -288,9 +288,9 @@ void P_FindFloorCeiling(AActor *actor, int flags)
FCheckPosition tmf;
tmf.thing = actor;
tmf.x = actor->x;
tmf.y = actor->y;
tmf.z = actor->z;
tmf.x = actor->X();
tmf.y = actor->Y();
tmf.z = actor->Z();
if (flags & FFCF_ONLYSPAWNPOS)
{
@ -336,7 +336,7 @@ void P_FindFloorCeiling(AActor *actor, int flags)
if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz;
if (!(flags & FFCF_ONLYSPAWNPOS) || (tmf.abovemidtex && (tmf.floorz <= actor->z)))
if (!(flags & FFCF_ONLYSPAWNPOS) || (tmf.abovemidtex && (tmf.floorz <= actor->Z())))
{
actor->floorz = tmf.floorz;
actor->dropoffz = tmf.dropoffz;
@ -404,13 +404,13 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra
line_t *ld;
// P_LineOpening requires the thing's z to be the destination z in order to work.
fixed_t savedz = thing->z;
thing->z = z;
fixed_t savedz = thing->Z();
thing->SetZ(z);
while ((ld = it.Next()))
{
PIT_FindFloorCeiling(ld, box, tmf, 0);
}
thing->z = savedz;
thing->SetZ(savedz);
if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz;
@ -427,7 +427,7 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra
continue;
fixed_t blockdist = th->radius + tmf.thing->radius;
if (abs(th->x - tmf.x) >= blockdist || abs(th->y - tmf.y) >= blockdist)
if (abs(th->X() - tmf.x) >= blockdist || abs(th->Y() - tmf.y) >= blockdist)
continue;
// [RH] Z-Check
@ -437,8 +437,8 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra
{
if (!(th->flags3 & thing->flags3 & MF3_DONTOVERLAP))
{
if (z > th->z + th->height || // overhead
z + thing->height < th->z) // underneath
if (z > th->Top() || // overhead
z + thing->height < th->Z()) // underneath
continue;
}
}
@ -459,7 +459,7 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra
if (modifyactor)
{
// the move is ok, so link the thing into its new position
thing->SetOrigin(x, y, z);
thing->SetOrigin(x, y, z, false);
thing->floorz = tmf.floorz;
thing->ceilingz = tmf.ceilingz;
thing->floorsector = tmf.floorsector;
@ -507,7 +507,7 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra
void P_PlayerStartStomp(AActor *actor)
{
AActor *th;
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius));
while ((th = it.Next()))
{
@ -525,9 +525,9 @@ void P_PlayerStartStomp(AActor *actor)
if (th->player == NULL && !(th->flags3 & MF3_ISMONSTER))
continue;
if (actor->z > th->z + th->height)
if (actor->Z() > th->Top())
continue; // overhead
if (actor->z + actor->height < th->z)
if (actor->Top() < th->Z())
continue; // underneath
P_DamageMobj(th, actor, actor, TELEFRAG_DAMAGE, NAME_Telefrag);

View file

@ -82,7 +82,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog,
}
while (spot != NULL)
{
mobj = Spawn (kind, spot->X(), spot->Y(), spot->Z(), ALLOW_REPLACE);
mobj = Spawn (kind, spot->Pos(), ALLOW_REPLACE);
if (mobj != NULL)
{
@ -123,11 +123,11 @@ bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog)
{
fixed_t oldx, oldy, oldz;
oldx = source->x;
oldy = source->y;
oldz = source->z;
oldx = source->X();
oldy = source->Y();
oldz = source->Z();
source->SetOrigin (x, y, z);
source->SetOrigin (x, y, z, false);
if (P_TestMobjLocation (source))
{
if (fog)
@ -146,7 +146,7 @@ bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog)
}
else
{
source->SetOrigin (oldx, oldy, oldz);
source->SetOrigin (oldx, oldy, oldz, false);
return false;
}
}
@ -218,7 +218,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
{
do
{
fixed_t z = spot->z;
fixed_t z = spot->Z();
if (defflags3 & MF3_FLOORHUGGER)
{
z = ONFLOORZ;
@ -231,7 +231,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
{
z -= spot->floorclip;
}
mobj = Spawn (kind, spot->x, spot->y, z, ALLOW_REPLACE);
mobj = Spawn (kind, spot->X(), spot->Y(), z, ALLOW_REPLACE);
if (mobj)
{
@ -254,8 +254,9 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
if (targ != NULL)
{
fixed_t spot[3] = { targ->x, targ->y, targ->z+targ->height/2 };
FVector3 aim(float(spot[0] - mobj->x), float(spot[1] - mobj->y), float(spot[2] - mobj->z));
fixedvec3 vect = mobj->Vec3To(targ);
vect.z += targ->height / 2;
FVector3 aim = vect;
if (leadTarget && speed > 0 && (targ->velx | targ->vely | targ->velz))
{
@ -435,7 +436,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser)
thing->flags |= MF_SOLID;
thing->height = info->height; // [RH] Use real height
thing->radius = info->radius; // [RH] Use real radius
if (!P_CheckPosition (thing, thing->x, thing->y))
if (!P_CheckPosition (thing, thing->Pos()))
{
thing->flags = oldflags;
thing->radius = oldradius;
@ -477,7 +478,7 @@ bool P_Thing_CanRaise(AActor *thing)
thing->height = info->height;
thing->radius = info->radius;
bool check = P_CheckPosition (thing, thing->x, thing->y);
bool check = P_CheckPosition (thing, thing->Pos());
// Restore checked properties
thing->flags = oldflags;
@ -690,8 +691,8 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
caller = temp;
}
fixed_t oldx = caller->x;
fixed_t oldy = caller->y;
fixed_t oldx = caller->X();
fixed_t oldy = caller->Y();
fixed_t oldz = caller->z;
zofs += FixedMul(reference->height, heightoffset);

View file

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

View file

@ -455,6 +455,11 @@ struct secspecial_t
short leakydamage; // chance of leaking through radiation suit
int Flags;
secspecial_t()
{
Clear();
}
void Clear()
{
memset(this, 0, sizeof(*this));
@ -678,6 +683,17 @@ struct sector_t
return pos == floor? floorplane:ceilingplane;
}
fixed_t HighestCeiling(AActor *a) const
{
return ceilingplane.ZatPoint(a);
}
fixed_t LowestFloor(AActor *a) const
{
return floorplane.ZatPoint(a);
}
bool isSecret() const
{
return !!(Flags & SECF_SECRET);
@ -972,6 +988,11 @@ struct line_t
sector_t *frontsector, *backsector;
int validcount; // if == validcount, already checked
int locknumber; // [Dusk] lock number for special
bool isLinePortal() const
{
return false;
}
};
// phares 3/14/98

View file

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

View file

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

View file

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