2016-03-01 15:47:10 +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 "thingdef/thingdef.h"
|
|
|
|
*/
|
|
|
|
|
|
|
|
static FRandom pr_inq ("Inquisitor");
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorWalk)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
|
|
|
S_Sound (self, CHAN_BODY, "inquisitor/walk", 1, ATTN_NORM);
|
|
|
|
A_Chase (stack, self);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool InquisitorCheckDistance (AActor *self)
|
|
|
|
{
|
|
|
|
if (self->reactiontime == 0 && P_CheckSight (self, self->target))
|
|
|
|
{
|
2016-03-22 11:42:27 +00:00
|
|
|
return self->Distance2D (self->target) < 264.;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
|
|
|
if (self->target == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
if (!InquisitorCheckDistance (self))
|
|
|
|
{
|
|
|
|
self->SetState (self->FindState("Grenade"));
|
|
|
|
}
|
|
|
|
if (self->target->Z() != self->Z())
|
|
|
|
{
|
2016-03-20 12:32:53 +00:00
|
|
|
if (self->Top() + 54 < self->ceilingz)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
self->SetState (self->FindState("Jump"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
|
|
|
AActor *proj;
|
|
|
|
|
|
|
|
if (self->target == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
|
2016-03-22 11:42:27 +00:00
|
|
|
self->AddZ(32);
|
2016-03-16 11:41:26 +00:00
|
|
|
self->Angles.Yaw -= 45./32;
|
2016-03-22 11:42:27 +00:00
|
|
|
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot"));
|
2016-03-01 15:47:10 +00:00
|
|
|
if (proj != NULL)
|
|
|
|
{
|
2016-03-19 23:54:18 +00:00
|
|
|
proj->Vel.Z += 9;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-03-16 11:41:26 +00:00
|
|
|
self->Angles.Yaw += 45./16;
|
2016-03-22 11:42:27 +00:00
|
|
|
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot"));
|
2016-03-01 15:47:10 +00:00
|
|
|
if (proj != NULL)
|
|
|
|
{
|
2016-03-19 23:54:18 +00:00
|
|
|
proj->Vel.Z += 16;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-03-22 11:42:27 +00:00
|
|
|
self->AddZ(-32);
|
2016-03-01 15:47:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2016-03-19 23:54:18 +00:00
|
|
|
double dist;
|
|
|
|
double speed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
if (self->target == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
|
2016-03-22 11:42:27 +00:00
|
|
|
self->AddZ(64);
|
2016-03-01 15:47:10 +00:00
|
|
|
A_FaceTarget (self);
|
2016-03-19 23:54:18 +00:00
|
|
|
speed = self->Speed * (2./3);
|
|
|
|
self->VelFromAngle(speed);
|
|
|
|
dist = self->DistanceBySpeed(self->target, speed);
|
|
|
|
self->Vel.Z = (self->target->Z() - self->Z()) / dist;
|
2016-03-01 15:47:10 +00:00
|
|
|
self->reactiontime = 60;
|
|
|
|
self->flags |= MF_NOGRAVITY;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
|
|
|
self->reactiontime--;
|
|
|
|
if (self->reactiontime < 0 ||
|
2016-03-19 23:54:18 +00:00
|
|
|
self->Vel.X == 0 ||
|
|
|
|
self->Vel.Y == 0 ||
|
2016-03-20 18:52:35 +00:00
|
|
|
self->Z() <= self->floorz)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
self->SetState (self->SeeState);
|
|
|
|
self->reactiontime = 0;
|
|
|
|
self->flags &= ~MF_NOGRAVITY;
|
|
|
|
S_StopSound (self, CHAN_ITEM);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!S_IsActorPlayingSomething (self, CHAN_ITEM, -1))
|
|
|
|
{
|
|
|
|
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2016-03-23 09:42:41 +00:00
|
|
|
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24.), ALLOW_REPLACE);
|
2016-03-16 11:41:26 +00:00
|
|
|
foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.);
|
|
|
|
foo->VelFromAngle(foo->Speed / 8);
|
2016-03-19 23:54:18 +00:00
|
|
|
foo->Vel.Z = pr_inq() / 64.;
|
2016-03-01 15:47:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|