mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- more Heretic and Hexen refactoring.
This commit is contained in:
parent
ca5ac72364
commit
61b66904da
7 changed files with 54 additions and 49 deletions
|
@ -163,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;
|
||||
|
|
|
@ -22,7 +22,6 @@ static FRandom pr_knightatk ("KnightAttack");
|
|||
DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
|
||||
{
|
||||
AActor *mo;
|
||||
fixed_t x, y;
|
||||
|
||||
fixedvec3 pos = self->Vec3Offset(
|
||||
(pr_dripblood.Random2 () << 11),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue