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-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-03-28 10:51:35 +00:00
|
|
|
static bool CrusaderCheckRange (AActor *self)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2016-01-10 16:52:41 +00:00
|
|
|
if (self->reactiontime == 0 && P_CheckSight (self, self->target))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2016-01-10 16:52:41 +00:00
|
|
|
return self->AproxDistance (self->target) < 264*FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (self->target == NULL)
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-03-28 10:51:35 +00:00
|
|
|
if (CrusaderCheckRange (self))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
A_FaceTarget (self);
|
|
|
|
self->angle -= ANGLE_180/16;
|
2016-01-19 12:43:11 +00:00
|
|
|
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (P_CheckMissileRange (self))
|
|
|
|
{
|
|
|
|
A_FaceTarget (self);
|
2016-01-19 12:43:11 +00:00
|
|
|
P_SpawnMissileZAimed (self, self->Z() + 56*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
|
2006-02-24 04:48:15 +00:00
|
|
|
self->angle -= ANGLE_45/32;
|
2016-01-19 12:43:11 +00:00
|
|
|
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
|
2006-02-24 04:48:15 +00:00
|
|
|
self->angle += ANGLE_45/16;
|
2016-01-19 12:43:11 +00:00
|
|
|
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
|
2006-02-24 04:48:15 +00:00
|
|
|
self->angle -= ANGLE_45/16;
|
|
|
|
self->reactiontime += 15;
|
|
|
|
}
|
|
|
|
self->SetState (self->SeeState);
|
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
self->angle += ANGLE_90/16;
|
2016-01-19 12:43:11 +00:00
|
|
|
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (misl != NULL)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
misl->velz += FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
self->angle -= ANGLE_90/16;
|
2016-01-19 12:43:11 +00:00
|
|
|
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (misl != NULL)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
misl->velz += FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderRefire)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (self->target == NULL ||
|
|
|
|
self->target->health <= 0 ||
|
|
|
|
!P_CheckSight (self, self->target))
|
|
|
|
{
|
|
|
|
self->SetState (self->SeeState);
|
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderDeath)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (CheckBossDeath (self))
|
|
|
|
{
|
2014-10-24 21:12:38 +00:00
|
|
|
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 667, FRACUNIT, 0, -1, 0, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|