mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-08 22:11:09 +00:00
760f70d3f1
so that all files are included by a central one instead of compiling each one separately. This speeds up the compilation process by 25% when doing a complete rebuild in Visual C. - Cleaned up more header dependencies. SVN r1226 (trunk)
128 lines
3 KiB
C++
128 lines
3 KiB
C++
/*
|
|
#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)
|
|
{
|
|
S_Sound (self, CHAN_BODY, "inquisitor/walk", 1, ATTN_NORM);
|
|
A_Chase (self);
|
|
}
|
|
|
|
bool InquisitorCheckDistance (AActor *self)
|
|
{
|
|
if (self->reactiontime == 0 && P_CheckSight (self, self->target))
|
|
{
|
|
return P_AproxDistance (self->x - self->target->x, self->y - self->target->y) < 264*FRACUNIT;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide)
|
|
{
|
|
if (self->target == NULL)
|
|
return;
|
|
|
|
A_FaceTarget (self);
|
|
if (!InquisitorCheckDistance (self))
|
|
{
|
|
self->SetState (self->FindState("Grenade"));
|
|
}
|
|
if (self->target->z != self->z)
|
|
{
|
|
if (self->z + self->height + 54*FRACUNIT < self->ceilingz)
|
|
{
|
|
self->SetState (self->FindState("Jump"));
|
|
}
|
|
}
|
|
}
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
|
|
{
|
|
AActor *proj;
|
|
|
|
if (self->target == NULL)
|
|
return;
|
|
|
|
A_FaceTarget (self);
|
|
|
|
self->z += 32*FRACBITS;
|
|
self->angle -= ANGLE_45/32;
|
|
proj = P_SpawnMissileZAimed (self, self->z, self->target, PClass::FindClass("InquisitorShot"));
|
|
if (proj != NULL)
|
|
{
|
|
proj->momz += 9*FRACUNIT;
|
|
}
|
|
self->angle += ANGLE_45/16;
|
|
proj = P_SpawnMissileZAimed (self, self->z, self->target, PClass::FindClass("InquisitorShot"));
|
|
if (proj != NULL)
|
|
{
|
|
proj->momz += 16*FRACUNIT;
|
|
}
|
|
self->z -= 32*FRACBITS;
|
|
}
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
|
|
{
|
|
fixed_t dist;
|
|
fixed_t speed;
|
|
angle_t an;
|
|
|
|
if (self->target == NULL)
|
|
return;
|
|
|
|
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
|
|
self->z += 64*FRACUNIT;
|
|
A_FaceTarget (self);
|
|
an = self->angle >> ANGLETOFINESHIFT;
|
|
speed = self->Speed * 2/3;
|
|
self->momx += FixedMul (speed, finecosine[an]);
|
|
self->momy += FixedMul (speed, finesine[an]);
|
|
dist = P_AproxDistance (self->target->x - self->x, self->target->y - self->y);
|
|
dist /= speed;
|
|
if (dist < 1)
|
|
{
|
|
dist = 1;
|
|
}
|
|
self->momz = (self->target->z - self->z) / dist;
|
|
self->reactiontime = 60;
|
|
self->flags |= MF_NOGRAVITY;
|
|
}
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
|
|
{
|
|
self->reactiontime--;
|
|
if (self->reactiontime < 0 ||
|
|
self->momx == 0 ||
|
|
self->momy == 0 ||
|
|
self->z <= self->floorz)
|
|
{
|
|
self->SetState (self->SeeState);
|
|
self->reactiontime = 0;
|
|
self->flags &= ~MF_NOGRAVITY;
|
|
S_StopSound (self, CHAN_ITEM);
|
|
return;
|
|
}
|
|
if (!S_IsActorPlayingSomething (self, CHAN_ITEM, -1))
|
|
{
|
|
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
|
|
}
|
|
|
|
}
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
|
|
{
|
|
AActor *foo = Spawn("InquisitorArm", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
|
|
foo->angle = self->angle - ANGLE_90 + (pr_inq.Random2() << 22);
|
|
foo->momx = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]) >> 3;
|
|
foo->momy = FixedMul (foo->Speed, finesine[foo->angle >> ANGLETOFINESHIFT]) >> 3;
|
|
foo->momz = pr_inq() << 10;
|
|
}
|
|
|