2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "a_strifeglobal.h"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "g_level.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static FRandom pr_entity ("Entity");
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SubEntityDeath)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (CheckBossDeath (self))
|
|
|
|
{
|
|
|
|
G_ExitLevel (0, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-06 17:49:22 +00:00
|
|
|
void A_SpectralMissile (AActor *self, const char *missilename)
|
|
|
|
{
|
|
|
|
if (self->target != NULL)
|
|
|
|
{
|
|
|
|
AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT,
|
2009-08-09 19:12:16 +00:00
|
|
|
self, self->target, PClass::FindClass(missilename), false);
|
2008-08-06 17:49:22 +00:00
|
|
|
if (missile != NULL)
|
|
|
|
{
|
|
|
|
missile->tracer = self->target;
|
|
|
|
missile->health = -2;
|
|
|
|
P_CheckMissileSpawn(missile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 22:48:37 +00:00
|
|
|
DECLARE_ACTION(A_SpotLightning)
|
|
|
|
DECLARE_ACTION(A_Spectre3Attack)
|
2008-08-06 17:49:22 +00:00
|
|
|
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Apparent Strife bug: Case 5 was unreachable because they used % 5 instead of % 6.
|
|
|
|
// I've fixed that by making case 1 duplicate it, since case 1 did nothing.
|
|
|
|
switch (pr_entity() % 5)
|
|
|
|
{
|
|
|
|
case 0:
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_SpotLightning, self);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2008-08-06 17:49:22 +00:00
|
|
|
A_SpectralMissile (self, "SpectralLightningH3");
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_Spectre3Attack, self);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2008-08-06 17:49:22 +00:00
|
|
|
A_SpectralMissile (self, "SpectralLightningBigV2");
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 5:
|
2008-08-06 17:49:22 +00:00
|
|
|
A_SpectralMissile (self, "SpectralLightningBigBall2");
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-06 17:49:22 +00:00
|
|
|
AActor *entity = Spawn("EntityBoss", self->x, self->y, self->z + 70*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (entity != NULL)
|
|
|
|
{
|
|
|
|
entity->angle = self->angle;
|
2008-07-15 17:02:16 +00:00
|
|
|
entity->CopyFriendliness(self, true);
|
2009-06-30 20:57:51 +00:00
|
|
|
entity->velz = 5*FRACUNIT;
|
2008-08-06 17:49:22 +00:00
|
|
|
entity->tracer = self;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-06 17:49:22 +00:00
|
|
|
AActor *second;
|
|
|
|
fixed_t secondRadius = GetDefaultByName("EntitySecond")->radius * 2;
|
2006-02-24 04:48:15 +00:00
|
|
|
angle_t an;
|
2008-08-06 17:49:22 +00:00
|
|
|
|
|
|
|
AActor *spot = self->tracer;
|
|
|
|
if (spot == NULL) spot = self;
|
|
|
|
|
|
|
|
fixed_t SpawnX = spot->x;
|
|
|
|
fixed_t SpawnY = spot->y;
|
|
|
|
fixed_t SpawnZ = spot->z + self->tracer? 70*FRACUNIT : 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
an = self->angle >> ANGLETOFINESHIFT;
|
2008-08-06 17:49:22 +00:00
|
|
|
second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]),
|
|
|
|
SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE);
|
2008-07-15 17:02:16 +00:00
|
|
|
second->CopyFriendliness(self, true);
|
|
|
|
//second->target = self->target;
|
2006-02-24 04:48:15 +00:00
|
|
|
A_FaceTarget (second);
|
|
|
|
an = second->angle >> ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
second->velx += FixedMul (finecosine[an], 320000);
|
|
|
|
second->vely += FixedMul (finesine[an], 320000);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
an = (self->angle + ANGLE_90) >> ANGLETOFINESHIFT;
|
2008-08-06 17:49:22 +00:00
|
|
|
second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]),
|
|
|
|
SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE);
|
2008-07-15 17:02:16 +00:00
|
|
|
second->CopyFriendliness(self, true);
|
|
|
|
//second->target = self->target;
|
2009-06-30 20:57:51 +00:00
|
|
|
second->velx = FixedMul (secondRadius, finecosine[an]) << 2;
|
|
|
|
second->vely = FixedMul (secondRadius, finesine[an]) << 2;
|
2006-02-24 04:48:15 +00:00
|
|
|
A_FaceTarget (second);
|
|
|
|
|
|
|
|
an = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
|
2008-08-06 17:49:22 +00:00
|
|
|
second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]),
|
|
|
|
SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE);
|
2008-07-15 17:02:16 +00:00
|
|
|
second->CopyFriendliness(self, true);
|
|
|
|
//second->target = self->target;
|
2009-06-30 20:57:51 +00:00
|
|
|
second->velx = FixedMul (secondRadius, finecosine[an]) << 2;
|
|
|
|
second->vely = FixedMul (secondRadius, finesine[an]) << 2;
|
2006-02-24 04:48:15 +00:00
|
|
|
A_FaceTarget (second);
|
|
|
|
}
|