Conflicts:
	src/r_defs.h
This commit is contained in:
Christoph Oelckers 2016-01-19 10:51:42 +01:00
commit 6ae09334a3
56 changed files with 520 additions and 407 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

@ -1247,6 +1247,16 @@ public:
{
return z;
}
fixedvec3 Pos() const
{
fixedvec3 ret = { X(), Y(), Z() };
return ret;
}
fixedvec3 PosPlusZ(fixed_t zadd) const
{
fixedvec3 ret = { X(), Y(), Z() + zadd };
return ret;
}
fixed_t Top() const
{
return z + height;
@ -1255,6 +1265,23 @@ public:
{
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;
}
// begin of GZDoom specific additions
@ -1368,6 +1395,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

@ -3056,7 +3056,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)

View File

@ -4281,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

@ -82,8 +82,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;

View File

@ -55,9 +55,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
{
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);
@ -65,9 +65,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
DEFINE_ACTION_FUNCTION(AActor, A_BrainExplode)
{
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);
}
DEFINE_ACTION_FUNCTION(AActor, A_BrainDie)
@ -140,11 +140,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;
@ -185,7 +185,7 @@ static void SpawnFly(AActor *self, const PClass *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);
}
@ -256,7 +256,7 @@ static void SpawnFly(AActor *self, const PClass *spawntype, FSoundID sound)
spawntype = PClass::FindClass(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
@ -275,7 +275,7 @@ static void SpawnFly(AActor *self, const PClass *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

@ -612,8 +612,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

@ -145,7 +145,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)
@ -153,9 +153,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

@ -35,17 +35,14 @@ enum PA_Flags
//
void A_PainShootSkull (AActor *self, angle_t angle, const PClass *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)
{
@ -76,47 +73,67 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *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;
// 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));
FBlockLinesIterator it(box);
line_t *ld;
// NOTE: The following code contains some advance work for line-to-line portals which is currenty inactive.
while ((ld = it.Next()))
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++)
{
if (!(ld->flags & ML_TWOSIDED) ||
(ld->flags & (ML_BLOCKING|ML_BLOCKMONSTERS|ML_BLOCKEVERYTHING)))
// 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(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 (!(box.Left() > ld->bbox[BOXRIGHT] ||
box.Right() < ld->bbox[BOXLEFT] ||
box.Top() < ld->bbox[BOXBOTTOM] ||
box.Bottom() > ld->bbox[BOXTOP]))
if (ld->isLinePortal() && i == 0)
{
if (P_PointOnLineSidePrecise(self->x,self->y,ld) != P_PointOnLineSidePrecise(x,y,ld))
return; // line blocks trajectory // ^
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] ||
box.Right() < ld->bbox[BOXLEFT] ||
box.Top() < ld->bbox[BOXBOTTOM] ||
box.Bottom() > ld->bbox[BOXTOP]))
{
if (P_PointOnLineSidePrecise(src.x, src.y, ld) != P_PointOnLineSidePrecise(pos.x, pos.y, ld))
return; // line blocks trajectory // ^
}
}
}
if (!inportal) break;
// 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, x, y, z, ALLOW_REPLACE);
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);// ^
@ -125,7 +142,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *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

@ -26,13 +26,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkelMissile)
return;
A_FaceTarget (self);
missile = P_SpawnMissileZ (self, self->z + 48*FRACUNIT,
missile = P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT,
self->target, PClass::FindClass("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;
}
}
@ -60,10 +59,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
return;
// spawn a puff of smoke behind the rocket
P_SpawnPuff (self, PClass::FindClass(NAME_BulletPuff), self->x, self->y, self->z, 0, 3);
P_SpawnPuff (self, PClass::FindClass(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;
@ -109,11 +107,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;
@ -100,7 +100,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

@ -78,17 +78,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
const PClass *fx = PClass::FindClass("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
@ -116,7 +116,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;
@ -140,20 +140,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;
}
@ -237,7 +237,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);
@ -254,10 +254,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();
@ -272,7 +272,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);
}
}
}

View File

@ -47,8 +47,8 @@ bool AArtiTomeOfPower::Use (bool pickup)
DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
{
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);
@ -69,9 +69,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

@ -41,12 +41,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;
@ -100,15 +100,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;
}
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
@ -165,8 +163,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;
@ -191,17 +188,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

@ -382,14 +382,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]);
@ -508,10 +507,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);
@ -529,7 +530,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;
@ -539,7 +540,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;
@ -611,17 +612,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;
}
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);
@ -720,7 +723,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);
}
}
@ -799,7 +802,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;
@ -1007,8 +1010,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_AddPlayerRain)
DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
{
fixed_t x;
fixed_t y;
AActor *mo;
ARainTracker *tracker;
@ -1039,20 +1040,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
{ // Fudge rain frequency
return;
}
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;
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;
@ -1074,7 +1076,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
DEFINE_ACTION_FUNCTION(AActor, A_RainImpact)
{
if (self->z > self->floorz)
if (self->Z() > self->floorz)
{
self->SetState (self->FindState("NotFloor"));
}
@ -1099,15 +1101,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;
}
}
self->bouncecount = -1;
self->z = self->ceilingz + 4*FRACUNIT;
self->SetZ(self->ceilingz + 4*FRACUNIT, false);
}
// --- Phoenix Rod ----------------------------------------------------------
@ -1225,13 +1227,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]);
@ -1269,7 +1271,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
{
AActor *mo;
angle_t angle;
fixed_t x, y, z;
fixed_t slope;
FSoundID soundid;
@ -1292,12 +1293,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
return;
}
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

@ -106,8 +106,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);
@ -128,7 +127,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
@ -180,7 +179,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;
@ -201,7 +200,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow)
{
self->health--;
self->z += 9*FRACUNIT;
self->AddZ(9*FRACUNIT);
if (self->health == 0)
{
self->Damage = self->GetDefault()->Damage;

View File

@ -22,11 +22,11 @@ static FRandom pr_knightatk ("KnightAttack");
DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
{
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;
@ -56,10 +56,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::FindClass("RedAxe"));
P_SpawnMissileZ (self, self->Z() + 36*FRACUNIT, self->target, PClass::FindClass("RedAxe"));
return;
}
// Green axe
P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindClass("KnightAxe"));
P_SpawnMissileZ (self, self->Z() + 36*FRACUNIT, self->target, PClass::FindClass("KnightAxe"));
}

View File

@ -84,6 +84,6 @@ 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;
}

View File

@ -140,7 +140,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;
@ -155,9 +155,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
DEFINE_ACTION_FUNCTION(AActor, A_BishopChase)
{
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);
}
//============================================================================
@ -170,7 +171,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;
@ -192,10 +193,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur)
self->SetState (self->FindState ("Blur"));
return;
}
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;
@ -123,9 +123,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;
@ -134,9 +135,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)
{
@ -136,7 +136,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;
@ -157,7 +157,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;
@ -188,11 +188,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;
}
@ -264,24 +264,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));
}
}
}
@ -328,10 +328,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);
}
@ -407,11 +407,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)
@ -442,22 +442,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);
}
@ -521,7 +523,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClericAttack)
{
if (!self->target) return;
AActor * missile = P_SpawnMissileZ (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass ("HolyMissile"));
AActor * missile = P_SpawnMissileZ (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindClass ("HolyMissile"));
if (missile != NULL) missile->tracer = NULL; // No initial target
S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
}

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
@ -252,11 +252,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;
@ -288,7 +289,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonPain)
DEFINE_ACTION_FUNCTION(AActor, A_DragonCheckCrash)
{
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)
const PClass *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];
@ -112,10 +112,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);
}
}

View File

@ -32,7 +32,6 @@ static FRandom pr_firedemonsplotch ("FiredSplotch");
void A_FiredSpawnRock (AActor *actor)
{
AActor *mo;
int x,y,z;
const PClass *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;
@ -97,7 +97,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredRocks)
DEFINE_ACTION_FUNCTION(AActor, A_SmBounce)
{
// 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;
@ -134,13 +134,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))
@ -219,14 +219,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

@ -51,10 +51,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;
@ -79,10 +79,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;
@ -106,8 +106,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);
@ -133,7 +132,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;
@ -159,7 +158,7 @@ bool AArtiPoisonBagGiver::Use (bool pickup)
const PClass *MissileType = PClass::FindClass((ENamedName) this->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None));
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)))
@ -385,7 +384,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;
@ -422,7 +421,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;
}
@ -456,7 +455,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

@ -83,7 +83,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;
@ -94,7 +94,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

@ -41,7 +41,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)
{
@ -80,7 +80,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

@ -232,7 +232,6 @@ void ASorcBall1::DoFireSpell ()
DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
{
AActor *mo;
fixed_t z;
self->SpawnState += 2; // [RH] Don't spawn balls again
A_SlowBalls(self);
@ -240,17 +239,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;
fixedvec3 pos = self->PosPlusZ(-self->floorclip + self->height);
mo = Spawn("SorcBall1", self->x, self->y, z, NO_REPLACE);
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;
}
@ -271,7 +271,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);
@ -370,9 +369,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;
}
@ -540,8 +542,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;
@ -667,7 +668,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;
}
}
@ -695,23 +696,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBossAttack)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnFizzle)
{
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;
@ -755,7 +752,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;
@ -763,7 +760,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;
@ -785,7 +782,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
{
angle_t angle;
fixed_t x,y,z;
fixedvec3 pos;
AActor *parent = self->target;
// [RH] If no parent, then disappear
@ -818,26 +815,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;
}
@ -853,7 +852,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnBishop)
{
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))
@ -878,7 +877,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnBishop)
DEFINE_ACTION_FUNCTION(AActor, A_SorcererBishopEntry)
{
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);
}

View File

@ -60,7 +60,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));
@ -77,7 +77,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);
}
}
}
@ -132,7 +132,7 @@ IMPLEMENT_CLASS (AZCorpseLynchedNoHeart)
void AZCorpseLynchedNoHeart::PostBeginPlay ()
{
Super::PostBeginPlay ();
Spawn ("BloodPool", x, y, floorz, ALLOW_REPLACE);
Spawn ("BloodPool", X(), Y(), floorz, ALLOW_REPLACE);
}
//============================================================================
@ -145,7 +145,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);
}
}
@ -162,7 +162,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));
@ -172,7 +172,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);
@ -198,9 +198,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn)
for (i = (pr_leaf()&3)+1; i; i--)
{
mo = Spawn (pr_leaf()&1 ? PClass::FindClass ("Leaf1") : PClass::FindClass ("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);
@ -277,9 +278,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);
@ -295,7 +297,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

@ -35,10 +35,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);
}
}
@ -60,10 +60,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;
@ -82,22 +82,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
{
fixed_t an;
if(!self->target)
{
return;
}
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::FindClass ("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::FindClass ("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->angle+ANG90, 40*FRACUNIT), self, self->target, PClass::FindClass ("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->angle-ANG90, 40*FRACUNIT), self, self->target, PClass::FindClass ("IceGuyFX"));
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
}
@ -129,7 +119,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::FindClass("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT));
if (mo)
{

View File

@ -97,7 +97,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);
@ -136,7 +136,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);
}
}
}
@ -248,7 +248,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxMissile)
DEFINE_ACTION_FUNCTION(AActor, A_KoraxCommand)
{
fixed_t x,y,z;
angle_t ang;
int numcommands;
@ -256,10 +255,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))
{
@ -310,14 +310,13 @@ void KoraxFire (AActor *actor, const PClass *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);
}
//============================================================================
@ -372,11 +371,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)
@ -453,11 +452,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;
@ -499,6 +498,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

@ -120,7 +120,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)
{
@ -132,7 +132,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)
{
@ -144,7 +144,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)
{
@ -159,7 +159,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

@ -151,12 +151,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
{
return;
}
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)
@ -228,9 +228,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;
@ -329,7 +331,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LastZap)
AActor *mo;
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

@ -140,8 +140,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);
@ -202,7 +202,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;
@ -222,7 +222,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

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

View File

@ -202,9 +202,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)
{
@ -256,7 +258,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DelayGib)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentHeadCheck)
{
if (self->z <= self->floorz)
if (self->Z() <= self->floorz)
{
if (Terrains[P_GetThingFloorType(self)].IsLiquid)
{

View File

@ -95,7 +95,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);
}
@ -140,7 +140,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustLower)
DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale)
{
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

@ -51,13 +51,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;
}
@ -76,7 +76,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);
}
}

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

@ -29,12 +29,12 @@ static FRandom pr_wraithfx4 ("WraithFX4");
DEFINE_ACTION_FUNCTION(AActor, A_WraithInit)
{
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
@ -110,7 +110,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)
@ -147,12 +147,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;
}
}
@ -195,23 +199,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;
}
}
@ -226,7 +238,7 @@ void A_WraithFX4 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_WraithChase)
{
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

@ -186,8 +186,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)
@ -205,7 +205,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
@ -244,7 +244,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurCharge)
{
type = PClass::FindClass ("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--;
}
@ -285,7 +285,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
return;
}
z = self->z + 40*FRACUNIT;
z = self->Z() + 40*FRACUNIT;
const PClass *fx = PClass::FindClass("MinotaurFX1");
if (fx)
{
@ -369,10 +369,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

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

@ -145,6 +145,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

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

@ -568,9 +568,9 @@ bool P_Move (AActor *actor)
fixed_t savedz = actor->Z();
if (actor->Z() < tm.floorz)
actor->SetZ(actor->Z() + actor->FloatSpeed);
actor->AddZ(actor->FloatSpeed);
else
actor->SetZ(actor->Z() - actor->FloatSpeed);
actor->AddZ(-actor->FloatSpeed);
// [RH] Check to make sure there's nothing in the way of the float
@ -2547,8 +2547,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)
@ -2565,7 +2565,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;
@ -2777,9 +2777,7 @@ 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.
fixedvec2 dist = self->Vec2To(other);
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();
@ -2803,8 +2801,8 @@ 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 ddist = sqrt(dist.x*dist.x + dist.y*dist.y + dist_z*dist_z);
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)

View File

@ -3107,7 +3107,7 @@ FUNC(LS_GlassBreak)
{
glass = Spawn("GlassJunk", x, y, ONFLOORZ, ALLOW_REPLACE);
glass->SetZ(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, const PClass *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);
@ -144,6 +148,10 @@ void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target);
AActor *P_SpawnMissile (AActor* source, AActor* dest, const PClass *type, AActor* owner = NULL);
AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, const PClass *type);
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, const PClass *type, bool checkspawn = true, AActor *owner = NULL);
inline AActor *P_SpawnMissileXYZ(const fixedvec3 &pos, AActor *source, AActor *dest, const PClass *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, const PClass *type, angle_t angle, fixed_t velz);
AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type, angle_t angle, fixed_t velz, fixed_t speed);
AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, const PClass *type, angle_t angle, fixed_t velz);
@ -458,6 +466,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);
@ -465,6 +477,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

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

@ -742,6 +742,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);
@ -1074,6 +1085,11 @@ struct line_t
int validcount; // if == validcount, already checked
int locknumber; // [Dusk] lock number for special
TObjPtr<ASkyViewpoint> skybox;
bool isLinePortal() const
{
return false;
}
};
// phares 3/14/98