gzdoom/src/g_hexen/a_iceguy.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

145 lines
3.4 KiB
C++

/*
#include "actor.h"
#include "info.h"
#include "p_local.h"
#include "s_sound.h"
#include "p_enemy.h"
#include "a_action.h"
#include "m_random.h"
#include "thingdef/thingdef.h"
*/
static FRandom pr_iceguylook ("IceGuyLook");
static FRandom pr_iceguychase ("IceGuyChase");
static const char *WispTypes[2] =
{
"IceGuyWisp1",
"IceGuyWisp2",
};
//============================================================================
//
// A_IceGuyLook
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook)
{
PARAM_ACTION_PROLOGUE;
fixed_t dist;
fixed_t an;
CALL_ACTION(A_Look, self);
if (pr_iceguylook() < 64)
{
dist = ((pr_iceguylook()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]),
FixedMul(dist, finesine[an]),
60 * FRACUNIT), ALLOW_REPLACE);
}
return 0;
}
//============================================================================
//
// A_IceGuyChase
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
{
PARAM_ACTION_PROLOGUE;
fixed_t dist;
fixed_t an;
AActor *mo;
A_Chase (stack, self);
if (pr_iceguychase() < 128)
{
dist = ((pr_iceguychase()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
mo = Spawn(WispTypes[pr_iceguychase() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]),
FixedMul(dist, finesine[an]),
60 * FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->velx = self->velx;
mo->vely = self->vely;
mo->velz = self->velz;
mo->target = self;
}
}
return 0;
}
//============================================================================
//
// A_IceGuyAttack
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
{
PARAM_ACTION_PROLOGUE;
if(!self->target)
{
return 0;
}
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->angle+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->angle-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
return 0;
}
//============================================================================
//
// A_IceGuyDie
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie)
{
PARAM_ACTION_PROLOGUE;
self->velx = 0;
self->vely = 0;
self->velz = 0;
self->height = self->GetDefault()->height;
CALL_ACTION(A_FreezeDeathChunks, self);
return 0;
}
//============================================================================
//
// A_IceGuyMissileExplode
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
{
PARAM_ACTION_PROLOGUE;
AActor *mo;
unsigned int i;
for (i = 0; i < 8; i++)
{
mo = P_SpawnMissileAngleZ (self, self->Z()+3*FRACUNIT,
PClass::FindActor("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT));
if (mo)
{
mo->target = self->target;
}
}
return 0;
}