2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#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"
|
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
|
|
|
|
|
|
|
static FRandom pr_iceguylook ("IceGuyLook");
|
|
|
|
static FRandom pr_iceguychase ("IceGuyChase");
|
|
|
|
|
2008-08-10 11:29:19 +00:00
|
|
|
static const char *WispTypes[2] =
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 11:29:19 +00:00
|
|
|
"IceGuyWisp1",
|
|
|
|
"IceGuyWisp2",
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyLook
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
fixed_t dist;
|
|
|
|
fixed_t an;
|
|
|
|
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_Look, self);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (pr_iceguylook() < 64)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
dist = ((pr_iceguylook()-128)*self->radius)>>7;
|
|
|
|
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
Spawn (WispTypes[pr_iceguylook()&1],
|
2008-08-10 20:48:55 +00:00
|
|
|
self->x+FixedMul(dist, finecosine[an]),
|
|
|
|
self->y+FixedMul(dist, finesine[an]),
|
|
|
|
self->z+60*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyChase
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
fixed_t dist;
|
|
|
|
fixed_t an;
|
|
|
|
AActor *mo;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
A_Chase (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (pr_iceguychase() < 128)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
dist = ((pr_iceguychase()-128)*self->radius)>>7;
|
|
|
|
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
mo = Spawn (WispTypes[pr_iceguychase()&1],
|
2008-08-10 20:48:55 +00:00
|
|
|
self->x+FixedMul(dist, finecosine[an]),
|
|
|
|
self->y+FixedMul(dist, finesine[an]),
|
|
|
|
self->z+60*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
mo->velx = self->velx;
|
|
|
|
mo->vely = self->vely;
|
|
|
|
mo->velz = self->velz;
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->target = self;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyAttack
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
fixed_t an;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if(!self->target)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
|
|
|
|
P_SpawnMissileXYZ(self->x+FixedMul(self->radius>>1,
|
|
|
|
finecosine[an]), self->y+FixedMul(self->radius>>1,
|
|
|
|
finesine[an]), self->z+40*FRACUNIT, self, self->target,
|
2008-08-10 11:29:19 +00:00
|
|
|
PClass::FindClass ("IceGuyFX"));
|
2008-08-10 20:48:55 +00:00
|
|
|
an = (self->angle-ANG90)>>ANGLETOFINESHIFT;
|
|
|
|
P_SpawnMissileXYZ(self->x+FixedMul(self->radius>>1,
|
|
|
|
finecosine[an]), self->y+FixedMul(self->radius>>1,
|
|
|
|
finesine[an]), self->z+40*FRACUNIT, self, self->target,
|
2008-08-10 11:29:19 +00:00
|
|
|
PClass::FindClass ("IceGuyFX"));
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyDie
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = 0;
|
|
|
|
self->vely = 0;
|
|
|
|
self->velz = 0;
|
2008-08-10 20:48:55 +00:00
|
|
|
self->height = self->GetDefault()->height;
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_FreezeDeathChunks, self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyMissileExplode
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
mo = P_SpawnMissileAngleZ (self, self->z+3*FRACUNIT,
|
2008-08-10 11:29:19 +00:00
|
|
|
PClass::FindClass("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->target = self->target;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|