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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2016-01-18 11:37:39 +00:00
|
|
|
fixedvec3 newpos = dest->Vec3Angle(24 * FRACUNIT, dest->angle, height);
|
|
|
|
self->SetOrigin(newpos, true);
|
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
|
|
|
|
2016-01-18 17:52:24 +00:00
|
|
|
fog = Spawn (fire, self->target->Pos(), 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
|
|
|
|
//
|
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)
|
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; }
|
2013-08-09 11:03:28 +00:00
|
|
|
PARAM_INT_OPT (flags) { flags = 0; }
|
2009-07-17 08:08:02 +00:00
|
|
|
|
2009-04-10 03:54:28 +00:00
|
|
|
AActor *fire, *target;
|
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-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
|
|
|
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
|
2016-02-07 11:27:11 +00:00
|
|
|
fixedvec3 pos = target->Vec3Angle(-24 * FRACUNIT, self->angle, 0);
|
2016-01-18 11:37:39 +00:00
|
|
|
fire->SetOrigin (pos, true);
|
2009-04-10 03:54:28 +00:00
|
|
|
|
2012-08-30 04:01:50 +00:00
|
|
|
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);
|
2009-04-10 03:54:28 +00:00
|
|
|
}
|
2015-01-22 13:13:25 +00:00
|
|
|
if (!(target->flags7 & MF7_DONTTHRUST))
|
2015-01-30 02:53:08 +00:00
|
|
|
{
|
2015-01-22 13:13:25 +00:00
|
|
|
target->velz = Scale(thrust, 1000, target->Mass);
|
2015-01-30 02:53:08 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|