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"
|
|
|
|
|
|
|
|
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
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_IceGuyLook (AActor *actor)
|
|
|
|
{
|
|
|
|
fixed_t dist;
|
|
|
|
fixed_t an;
|
|
|
|
|
|
|
|
A_Look (actor);
|
|
|
|
if (pr_iceguylook() < 64)
|
|
|
|
{
|
|
|
|
dist = ((pr_iceguylook()-128)*actor->radius)>>7;
|
|
|
|
an = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
|
|
|
|
|
|
|
|
Spawn (WispTypes[pr_iceguylook()&1],
|
|
|
|
actor->x+FixedMul(dist, finecosine[an]),
|
|
|
|
actor->y+FixedMul(dist, finesine[an]),
|
2006-07-16 09:10:45 +00:00
|
|
|
actor->z+60*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyChase
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_IceGuyChase (AActor *actor)
|
|
|
|
{
|
|
|
|
fixed_t dist;
|
|
|
|
fixed_t an;
|
|
|
|
AActor *mo;
|
|
|
|
|
|
|
|
A_Chase (actor);
|
|
|
|
if (pr_iceguychase() < 128)
|
|
|
|
{
|
|
|
|
dist = ((pr_iceguychase()-128)*actor->radius)>>7;
|
|
|
|
an = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
|
|
|
|
|
|
|
|
mo = Spawn (WispTypes[pr_iceguychase()&1],
|
|
|
|
actor->x+FixedMul(dist, finecosine[an]),
|
|
|
|
actor->y+FixedMul(dist, finesine[an]),
|
2006-07-16 09:10:45 +00:00
|
|
|
actor->z+60*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
|
|
|
mo->momx = actor->momx;
|
|
|
|
mo->momy = actor->momy;
|
|
|
|
mo->momz = actor->momz;
|
|
|
|
mo->target = actor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyAttack
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_IceGuyAttack (AActor *actor)
|
|
|
|
{
|
|
|
|
fixed_t an;
|
|
|
|
|
|
|
|
if(!actor->target)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
an = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
|
|
|
|
P_SpawnMissileXYZ(actor->x+FixedMul(actor->radius>>1,
|
|
|
|
finecosine[an]), actor->y+FixedMul(actor->radius>>1,
|
|
|
|
finesine[an]), actor->z+40*FRACUNIT, actor, actor->target,
|
2008-08-10 11:29:19 +00:00
|
|
|
PClass::FindClass ("IceGuyFX"));
|
2006-02-24 04:48:15 +00:00
|
|
|
an = (actor->angle-ANG90)>>ANGLETOFINESHIFT;
|
|
|
|
P_SpawnMissileXYZ(actor->x+FixedMul(actor->radius>>1,
|
|
|
|
finecosine[an]), actor->y+FixedMul(actor->radius>>1,
|
|
|
|
finesine[an]), actor->z+40*FRACUNIT, actor, actor->target,
|
2008-08-10 11:29:19 +00:00
|
|
|
PClass::FindClass ("IceGuyFX"));
|
2008-06-15 02:25:09 +00:00
|
|
|
S_Sound (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyDie
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_IceGuyDie (AActor *actor)
|
|
|
|
{
|
|
|
|
actor->momx = 0;
|
|
|
|
actor->momy = 0;
|
|
|
|
actor->momz = 0;
|
|
|
|
actor->height = actor->GetDefault()->height;
|
|
|
|
A_FreezeDeathChunks (actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceGuyMissileExplode
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void A_IceGuyMissileExplode (AActor *actor)
|
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
{
|
2008-08-10 11:29:19 +00:00
|
|
|
mo = P_SpawnMissileAngleZ (actor, actor->z+3*FRACUNIT,
|
|
|
|
PClass::FindClass("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
|
|
|
mo->target = actor->target;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|