- all those 'actor->SetZ(actor->Z() +...) calls weren't pretty so now there's an AddZ method, too.

This commit is contained in:
Christoph Oelckers 2016-01-18 22:32:36 +01:00
parent c8052ce1b8
commit ef7be016c4
9 changed files with 13 additions and 13 deletions

View file

@ -257,7 +257,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
mo = Spawn("Wizard", self->Pos(), ALLOW_REPLACE); mo = Spawn("Wizard", self->Pos(), ALLOW_REPLACE);
if (mo != NULL) if (mo != NULL)
{ {
mo->SetZ(mo->Z() - mo->GetDefault()->height / 2, false); mo->AddZ(-mo->GetDefault()->height / 2, false);
if (!P_TestMobjLocation (mo)) if (!P_TestMobjLocation (mo))
{ // Didn't fit { // Didn't fit
mo->ClearCounters(); mo->ClearCounters();

View file

@ -47,7 +47,7 @@ bool AArtiTomeOfPower::Use (bool pickup)
DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb) DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
{ {
self->SetZ(self->Z() + 32*FRACUNIT, false); self->AddZ(32*FRACUNIT, false);
self->PrevZ = self->Z(); // no interpolation! self->PrevZ = self->Z(); // no interpolation!
self->RenderStyle = STYLE_Add; self->RenderStyle = STYLE_Add;
self->alpha = FRACUNIT; self->alpha = FRACUNIT;

View file

@ -192,7 +192,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
{ {
self->flags |= MF_NOGRAVITY; self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT; self->gravity = FRACUNIT;
self->SetZ(self->Z() + 28*FRACUNIT); self->AddZ(28*FRACUNIT);
//self->velz = 3*FRACUNIT; //self->velz = 3*FRACUNIT;
} }
P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, RADF_HURTSOURCE); P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, RADF_HURTSOURCE);

View file

@ -388,7 +388,7 @@ void FireMacePL1B (AActor *actor)
angle = actor->angle; angle = actor->angle;
ball->target = actor; ball->target = actor;
ball->angle = angle; ball->angle = angle;
ball->SetZ(ball->Z() + 2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)]); ball->AddZ(2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)]);
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
ball->velx = (actor->velx>>1) + FixedMul(ball->Speed, finecosine[angle]); ball->velx = (actor->velx>>1) + FixedMul(ball->Speed, finecosine[angle]);
ball->vely = (actor->vely>>1) + FixedMul(ball->Speed, finesine[angle]); ball->vely = (actor->vely>>1) + FixedMul(ball->Speed, finesine[angle]);

View file

@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
mo = P_SpawnMissile (self, target, RUNTIME_CLASS(AWhirlwind)); mo = P_SpawnMissile (self, target, RUNTIME_CLASS(AWhirlwind));
if (mo != NULL) if (mo != NULL)
{ {
mo->SetZ(mo->Z() - 32*FRACUNIT, false); mo->AddZ(-32*FRACUNIT, false);
mo->tracer = target; mo->tracer = target;
mo->special1 = 60; mo->special1 = 60;
mo->special2 = 50; // Timer for active sound mo->special2 = 50; // Timer for active sound
@ -200,7 +200,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow) DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow)
{ {
self->health--; self->health--;
self->SetZ(self->Z() + 9*FRACUNIT); self->AddZ(9*FRACUNIT);
if (self->health == 0) if (self->health == 0)
{ {
self->Damage = self->GetDefault()->Damage; self->Damage = self->GetDefault()->Damage;

View file

@ -134,13 +134,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
if (self->threshold) self->threshold--; if (self->threshold) self->threshold--;
// Float up and down // Float up and down
self->SetZ(self->Z() + finesine[weaveindex << BOBTOFINESHIFT] * 8); self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->special1 = (weaveindex + 2) & 63; self->special1 = (weaveindex + 2) & 63;
// Ensure it stays above certain height // Ensure it stays above certain height
if (self->Z() < self->floorz + (64*FRACUNIT)) if (self->Z() < self->floorz + (64*FRACUNIT))
{ {
self->SetZ(self->Z() + 2*FRACUNIT); self->AddZ(2*FRACUNIT);
} }
if(!self->target || !(self->target->flags&MF_SHOOTABLE)) if(!self->target || !(self->target->flags&MF_SHOOTABLE))

View file

@ -132,7 +132,7 @@ bool AArtiPoisonBag3::Use (bool pickup)
mo->velz = FixedMul(speed, finesine[modpitch]); mo->velz = FixedMul(speed, finesine[modpitch]);
mo->velx = FixedMul(xyscale, finecosine[angle]) + (Owner->velx >> 1); mo->velx = FixedMul(xyscale, finecosine[angle]) + (Owner->velx >> 1);
mo->vely = FixedMul(xyscale, finesine[angle]) + (Owner->vely >> 1); mo->vely = FixedMul(xyscale, finesine[angle]) + (Owner->vely >> 1);
mo->SetZ(mo->Z() + FixedMul(mo->Speed, finesine[orgpitch])); mo->AddZ(FixedMul(mo->Speed, finesine[orgpitch]));
mo->target = Owner; mo->target = Owner;
mo->tics -= pr_poisonbag()&3; mo->tics -= pr_poisonbag()&3;
@ -421,7 +421,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE); P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE);
bobIndex = self->special2; bobIndex = self->special2;
self->SetZ(self->Z() + finesine[bobIndex << BOBTOFINESHIFT] >> 1); self->AddZ(finesine[bobIndex << BOBTOFINESHIFT] >> 1);
self->special2 = (bobIndex + 1) & 63; self->special2 = (bobIndex + 1) & 63;
} }

View file

@ -568,9 +568,9 @@ bool P_Move (AActor *actor)
fixed_t savedz = actor->Z(); fixed_t savedz = actor->Z();
if (actor->Z() < tm.floorz) if (actor->Z() < tm.floorz)
actor->SetZ(actor->Z() + actor->FloatSpeed); actor->AddZ(actor->FloatSpeed);
else 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 // [RH] Check to make sure there's nothing in the way of the float

View file

@ -3107,7 +3107,7 @@ FUNC(LS_GlassBreak)
{ {
glass = Spawn("GlassJunk", x, y, ONFLOORZ, ALLOW_REPLACE); 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)); glass->SetState (glass->SpawnState + (pr_glass() % glass->health));
an = pr_glass() << (32-8); an = pr_glass() << (32-8);
glass->angle = an; glass->angle = an;