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 "gstrings.h"
|
|
|
|
#include "a_action.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
|
|
|
|
|
|
|
//
|
|
|
|
// PIT_VileCheck
|
|
|
|
// Detect a corpse that could be raised.
|
|
|
|
//
|
2008-12-06 10:22:37 +00:00
|
|
|
void A_Fire(AActor *self, int height);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// A_VileStart
|
|
|
|
//
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_VileStart)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
2006-02-24 04:48:15 +00:00
|
|
|
S_Sound (self, CHAN_VOICE, "vile/start", 1, ATTN_NORM);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// A_Fire
|
|
|
|
// Keep fire in front of player unless out of sight
|
|
|
|
//
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_StartFire)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
2006-02-24 04:48:15 +00:00
|
|
|
S_Sound (self, CHAN_BODY, "vile/firestrt", 1, ATTN_NORM);
|
2008-12-06 10:22:37 +00:00
|
|
|
A_Fire (self, 0);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireCrackle)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
2006-02-24 04:48:15 +00:00
|
|
|
S_Sound (self, CHAN_BODY, "vile/firecrkl", 1, ATTN_NORM);
|
2008-12-06 10:22:37 +00:00
|
|
|
A_Fire (self, 0);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2008-12-06 10:22:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Fire)
|
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
PARAM_FIXED_OPT(height) { height = 0; }
|
2008-12-06 10:22:37 +00:00
|
|
|
|
|
|
|
A_Fire(self, height);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 10:22:37 +00:00
|
|
|
void A_Fire(AActor *self, int height)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *dest;
|
|
|
|
angle_t an;
|
|
|
|
|
|
|
|
dest = self->tracer;
|
2009-04-10 03:54:28 +00:00
|
|
|
if (dest == NULL || self->target == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// don't move it if the vile lost sight
|
|
|
|
if (!P_CheckSight (self->target, dest, 0) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
an = dest->angle >> ANGLETOFINESHIFT;
|
|
|
|
|
|
|
|
self->SetOrigin (dest->x + FixedMul (24*FRACUNIT, finecosine[an]),
|
|
|
|
dest->y + FixedMul (24*FRACUNIT, finesine[an]),
|
2008-12-06 10:22:37 +00:00
|
|
|
dest->z + height);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// A_VileTarget
|
|
|
|
// Spawn the hellfire
|
|
|
|
//
|
2008-12-06 10:22:37 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileTarget)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
2010-03-24 02:49:37 +00:00
|
|
|
PARAM_CLASS_OPT(fire, AActor) { fire = PClass::FindActor("ArchvileFire"); }
|
2010-02-12 06:04:57 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
AActor *fog;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (!self->target)
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
A_FaceTarget (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-12-06 10:22:37 +00:00
|
|
|
fog = Spawn (fire, self->target->x, self->target->y,
|
2008-08-10 20:48:55 +00:00
|
|
|
self->target->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
self->tracer = fog;
|
|
|
|
fog->target = self;
|
|
|
|
fog->tracer = self->target;
|
2008-12-06 10:22:37 +00:00
|
|
|
A_Fire(fog, 0);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// A_VileAttack
|
|
|
|
//
|
2009-07-17 08:08:02 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
|
2010-02-12 06:04:57 +00:00
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
PARAM_SOUND_OPT (snd) { snd = "vile/stop"; }
|
|
|
|
PARAM_INT_OPT (dmg) { dmg = 20; }
|
|
|
|
PARAM_INT_OPT (blastdmg) { blastdmg = 70; }
|
|
|
|
PARAM_INT_OPT (blastrad) { blastrad = 70; }
|
|
|
|
PARAM_FIXED_OPT (thrust) { thrust = FRACUNIT; }
|
|
|
|
PARAM_NAME_OPT (dmgtype) { dmgtype = NAME_Fire; }
|
2009-07-17 08:08:02 +00:00
|
|
|
|
2009-04-10 03:54:28 +00:00
|
|
|
AActor *fire, *target;
|
2009-08-02 04:11:48 +00:00
|
|
|
angle_t an;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-04-10 03:54:28 +00:00
|
|
|
if (NULL == (target = self->target))
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
A_FaceTarget (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-04-10 03:54:28 +00:00
|
|
|
if (!P_CheckSight (self, target, 0) )
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-07-17 08:08:02 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, snd, 1, ATTN_NORM);
|
2013-01-02 04:39:59 +00:00
|
|
|
int newdam = P_DamageMobj (target, self, self, dmg, NAME_None);
|
|
|
|
P_TraceBleed (newdam > 0 ? newdam : dmg, target);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
an = self->angle >> ANGLETOFINESHIFT;
|
|
|
|
fire = self->tracer;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-04-10 03:54:28 +00:00
|
|
|
if (fire != NULL)
|
|
|
|
{
|
|
|
|
// move the fire between the vile and the player
|
|
|
|
fire->SetOrigin (target->x - FixedMul (24*FRACUNIT, finecosine[an]),
|
|
|
|
target->y - FixedMul (24*FRACUNIT, finesine[an]),
|
|
|
|
target->z);
|
|
|
|
|
2012-08-30 04:01:50 +00:00
|
|
|
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);
|
2009-04-10 03:54:28 +00:00
|
|
|
}
|
2009-08-02 04:11:48 +00:00
|
|
|
target->velz = Scale(thrust, 1000, target->Mass);
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|