2006-02-24 04:48:15 +00:00
|
|
|
#include "templates.h"
|
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "a_doomglobal.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "a_action.h"
|
2008-07-19 12:40:10 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
FRandom pr_lost ("LostMissileRange");
|
|
|
|
|
|
|
|
//
|
|
|
|
// SkullAttack
|
|
|
|
// Fly at the player like a missile.
|
|
|
|
//
|
|
|
|
#define SKULLSPEED (20*FRACUNIT)
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SkullAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *dest;
|
|
|
|
angle_t an;
|
|
|
|
int dist;
|
2008-07-19 12:40:10 +00:00
|
|
|
int n;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (!self->target)
|
|
|
|
return;
|
|
|
|
|
2008-07-19 12:40:10 +00:00
|
|
|
int index = CheckIndex (1, NULL);
|
|
|
|
if (index >= 0)
|
|
|
|
{
|
|
|
|
n = FLOAT2FIXED(EvalExpressionF (StateParameters[index], self));
|
|
|
|
if (n == 0) n = SKULLSPEED;
|
|
|
|
}
|
|
|
|
else n = SKULLSPEED;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
dest = self->target;
|
|
|
|
self->flags |= MF_SKULLFLY;
|
|
|
|
|
2008-06-15 02:25:09 +00:00
|
|
|
S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
A_FaceTarget (self);
|
|
|
|
an = self->angle >> ANGLETOFINESHIFT;
|
2008-07-19 12:40:10 +00:00
|
|
|
self->momx = FixedMul (n, finecosine[an]);
|
|
|
|
self->momy = FixedMul (n, finesine[an]);
|
2006-02-24 04:48:15 +00:00
|
|
|
dist = P_AproxDistance (dest->x - self->x, dest->y - self->y);
|
2008-07-19 12:40:10 +00:00
|
|
|
dist = dist / n;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (dist < 1)
|
|
|
|
dist = 1;
|
|
|
|
self->momz = (dest->z+(dest->height>>1) - self->z) / dist;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CVAR transsouls
|
|
|
|
//
|
|
|
|
// How translucent things drawn with STYLE_SoulTrans are. Normally, only
|
|
|
|
// Lost Souls have this render style, but a dehacked patch could give other
|
|
|
|
// things this style. Values less than 0.25 will automatically be set to
|
|
|
|
// 0.25 to ensure some degree of visibility. Likewise, values above 1.0 will
|
|
|
|
// be set to 1.0, because anything higher doesn't make sense.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CUSTOM_CVAR (Float, transsouls, 0.75f, CVAR_ARCHIVE)
|
|
|
|
{
|
|
|
|
if (self < 0.25f)
|
|
|
|
{
|
|
|
|
self = 0.25f;
|
|
|
|
}
|
|
|
|
else if (self > 1.f)
|
|
|
|
{
|
|
|
|
self = 1.f;
|
|
|
|
}
|
|
|
|
}
|