mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- yet more refactoring.
Note about A_SkelMissile: The direct change of the missile's position was changed to use SetOrigin. If this is later supposed to be portal-aware, such direct coordinate changes are a no-go to ensure that everything is properly maintained.
This commit is contained in:
parent
2b5e5b6bc3
commit
57ab1387f2
11 changed files with 59 additions and 51 deletions
18
src/actor.h
18
src/actor.h
|
@ -1247,6 +1247,11 @@ public:
|
|||
{
|
||||
return z;
|
||||
}
|
||||
fixedvec3 Pos() const
|
||||
{
|
||||
fixedvec3 ret = { X(), Y(), Z() };
|
||||
return ret;
|
||||
}
|
||||
fixed_t Top() const
|
||||
{
|
||||
return z + height;
|
||||
|
@ -1256,6 +1261,19 @@ public:
|
|||
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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class FActorIterator
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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->X() + missile->velx, missile->Y() + missile->vely, missile->Z(), 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)
|
||||
|
|
|
@ -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->X(), spot->Y(), spot->Z(), 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);
|
||||
|
|
|
@ -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->SetZ(self->Z() + 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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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->X(), thing->Y()))
|
||||
{
|
||||
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->X(), thing->Y());
|
||||
|
||||
// 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue