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
|
|
|
{
|
|
|
|
S_Sound (self, CHAN_VOICE, "vile/start", 1, ATTN_NORM);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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
|
|
|
{
|
|
|
|
S_Sound (self, CHAN_BODY, "vile/firestrt", 1, ATTN_NORM);
|
2008-12-06 10:22:37 +00:00
|
|
|
A_Fire (self, 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
|
|
|
{
|
|
|
|
S_Sound (self, CHAN_BODY, "vile/firecrkl", 1, ATTN_NORM);
|
2008-12-06 10:22:37 +00:00
|
|
|
A_Fire (self, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Fire)
|
|
|
|
{
|
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_FIXED(height,0);
|
|
|
|
|
|
|
|
A_Fire(self, height);
|
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
|
|
|
{
|
2008-12-06 10:22:37 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_CLASS(fire,0);
|
2006-02-24 04:48:15 +00:00
|
|
|
AActor *fog;
|
|
|
|
|
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
|
|
|
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);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// A_VileAttack
|
|
|
|
//
|
2013-08-09 10:18:58 +00:00
|
|
|
|
|
|
|
// A_VileAttack flags
|
|
|
|
#define VAF_DMGTYPEAPPLYTODIRECT 1
|
|
|
|
|
2009-07-17 08:08:02 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2013-08-09 10:18:58 +00:00
|
|
|
ACTION_PARAM_START(7);
|
2009-07-17 08:08:02 +00:00
|
|
|
ACTION_PARAM_SOUND(snd,0);
|
|
|
|
ACTION_PARAM_INT(dmg,1);
|
|
|
|
ACTION_PARAM_INT(blastdmg,2);
|
2009-08-02 04:11:48 +00:00
|
|
|
ACTION_PARAM_INT(blastrad,3);
|
|
|
|
ACTION_PARAM_FIXED(thrust,4);
|
|
|
|
ACTION_PARAM_NAME(dmgtype,5);
|
2013-08-09 10:18:58 +00:00
|
|
|
ACTION_PARAM_INT(flags,6);
|
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))
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
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) )
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
2009-07-17 08:08:02 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, snd, 1, ATTN_NORM);
|
2013-08-09 10:18:58 +00:00
|
|
|
|
|
|
|
int newdam;
|
|
|
|
|
|
|
|
if (flags & VAF_DMGTYPEAPPLYTODIRECT)
|
|
|
|
newdam = P_DamageMobj (target, self, self, dmg, dmgtype);
|
|
|
|
|
|
|
|
else
|
|
|
|
newdam = P_DamageMobj (target, self, self, dmg, NAME_None);
|
|
|
|
|
2013-01-02 04:39:59 +00:00
|
|
|
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);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|