gzdoom-gles/src/g_strife/a_sentinel.cpp
Christoph Oelckers bc63b70d88 Merge branch 'master' into scripting
Conflicts:
	src/actor.h
	src/fragglescript/t_func.cpp
	src/g_doom/a_bossbrain.cpp
	src/g_doom/a_revenant.cpp
	src/g_heretic/a_hereticartifacts.cpp
	src/g_heretic/a_hereticweaps.cpp
	src/g_heretic/a_knight.cpp
	src/g_hexen/a_bishop.cpp
	src/g_hexen/a_clericholy.cpp
	src/g_hexen/a_dragon.cpp
	src/g_hexen/a_firedemon.cpp
	src/g_hexen/a_flechette.cpp
	src/g_hexen/a_heresiarch.cpp
	src/g_hexen/a_hexenspecialdecs.cpp
	src/g_hexen/a_iceguy.cpp
	src/g_hexen/a_korax.cpp
	src/g_hexen/a_magelightning.cpp
	src/g_hexen/a_serpent.cpp
	src/g_hexen/a_spike.cpp
	src/g_hexen/a_wraith.cpp
	src/g_raven/a_minotaur.cpp
	src/g_shared/a_bridge.cpp
	src/g_shared/a_pickups.cpp
	src/g_shared/a_randomspawner.cpp
	src/g_strife/a_alienspectres.cpp
	src/g_strife/a_crusader.cpp
	src/g_strife/a_entityboss.cpp
	src/g_strife/a_inquisitor.cpp
	src/g_strife/a_loremaster.cpp
	src/g_strife/a_programmer.cpp
	src/g_strife/a_sentinel.cpp
	src/g_strife/a_spectral.cpp
	src/g_strife/a_strifestuff.cpp
	src/g_strife/a_strifeweapons.cpp
	src/g_strife/a_thingstoblowup.cpp
	src/p_local.h
	src/r_utility.cpp
2016-01-19 13:43:11 +01:00

97 lines
2 KiB
C++

/*
#include "actor.h"
#include "p_enemy.h"
#include "a_action.h"
#include "p_local.h"
#include "m_random.h"
#include "thingdef/thingdef.h"
*/
static FRandom pr_sentinelrefire ("SentinelRefire");
DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
{
PARAM_ACTION_PROLOGUE;
fixed_t minz, maxz;
if (self->flags & MF_INFLOAT)
{
self->velz = 0;
return 0;
}
if (self->threshold != 0)
return 0;
maxz = self->ceilingz - self->height - 16*FRACUNIT;
minz = self->floorz + 96*FRACUNIT;
if (minz > maxz)
{
minz = maxz;
}
if (minz < self->Z())
{
self->velz -= FRACUNIT;
}
else
{
self->velz += FRACUNIT;
}
self->reactiontime = (minz >= self->Z()) ? 4 : 0;
return 0;
}
DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
{
PARAM_ACTION_PROLOGUE;
AActor *missile, *trail;
// [BB] Without a target the P_SpawnMissileZAimed call will crash.
if (!self->target)
{
return 0;
}
missile = P_SpawnMissileZAimed (self, self->Z() + 32*FRACUNIT, self->target, PClass::FindActor("SentinelFX2"));
if (missile != NULL && (missile->velx | missile->vely) != 0)
{
for (int i = 8; i > 1; --i)
{
trail = Spawn("SentinelFX1",
self->Vec3Angle(missile->radius*i, missile->angle, (missile->velz / 4 * i)), ALLOW_REPLACE);
if (trail != NULL)
{
trail->target = self;
trail->velx = missile->velx;
trail->vely = missile->vely;
trail->velz = missile->velz;
P_CheckMissileSpawn (trail, self->radius);
}
}
missile->AddZ(missile->velz >> 2);
}
return 0;
}
DEFINE_ACTION_FUNCTION(AActor, A_SentinelRefire)
{
PARAM_ACTION_PROLOGUE;
A_FaceTarget (self);
if (pr_sentinelrefire() >= 30)
{
if (self->target == NULL ||
self->target->health <= 0 ||
!P_CheckSight (self, self->target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES) ||
P_HitFriend(self) ||
(self->MissileState == NULL && !self->CheckMeleeRange()) ||
pr_sentinelrefire() < 40)
{
self->SetState (self->SeeState);
}
}
return 0;
}