2016-03-01 15:47:10 +00:00
|
|
|
/*
|
|
|
|
#include "actor.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "p_pspr.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "a_hexenglobal.h"
|
|
|
|
#include "thingdef/thingdef.h"
|
|
|
|
*/
|
|
|
|
|
2016-03-19 23:54:18 +00:00
|
|
|
const double FLAMESPEED = 0.45;
|
|
|
|
const double FLAMEROTSPEED = 2.;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
static FRandom pr_missile ("CFlameMissile");
|
|
|
|
|
|
|
|
void A_CFlameAttack (AActor *);
|
|
|
|
void A_CFlameRotate (AActor *);
|
|
|
|
void A_CFlamePuff (AActor *);
|
|
|
|
void A_CFlameMissile (AActor *);
|
|
|
|
|
|
|
|
// Flame Missile ------------------------------------------------------------
|
|
|
|
|
|
|
|
class ACFlameMissile : public AFastProjectile
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (ACFlameMissile, AFastProjectile)
|
|
|
|
public:
|
|
|
|
void BeginPlay ();
|
|
|
|
void Effect ();
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPLEMENT_CLASS (ACFlameMissile)
|
|
|
|
|
|
|
|
void ACFlameMissile::BeginPlay ()
|
|
|
|
{
|
|
|
|
special1 = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ACFlameMissile::Effect ()
|
|
|
|
{
|
|
|
|
if (!--special1)
|
|
|
|
{
|
|
|
|
special1 = 4;
|
2016-03-21 13:00:05 +00:00
|
|
|
double newz = Z() - 12;
|
2016-03-01 15:47:10 +00:00
|
|
|
if (newz < floorz)
|
|
|
|
{
|
|
|
|
newz = floorz;
|
|
|
|
}
|
2016-03-20 18:52:35 +00:00
|
|
|
AActor *mo = Spawn ("CFlameFloor", PosAtZ(newz), ALLOW_REPLACE);
|
2016-03-01 15:47:10 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
2016-03-16 11:41:26 +00:00
|
|
|
mo->Angles.Yaw = Angles.Yaw;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_CFlameAttack
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlameAttack)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
|
|
|
player_t *player;
|
|
|
|
|
|
|
|
if (NULL == (player = self->player))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACFlameMissile));
|
|
|
|
S_Sound (self, CHAN_WEAPON, "ClericFlameFire", 1, ATTN_NORM);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_CFlamePuff
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlamePuff)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
|
|
|
self->renderflags &= ~RF_INVISIBLE;
|
2016-03-19 23:54:18 +00:00
|
|
|
self->Vel.Zero();
|
2016-03-01 15:47:10 +00:00
|
|
|
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_CFlameMissile
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
|
|
|
int i;
|
2016-03-16 11:41:26 +00:00
|
|
|
DAngle an;
|
2016-03-21 13:00:05 +00:00
|
|
|
double dist;
|
2016-03-01 15:47:10 +00:00
|
|
|
AActor *mo;
|
|
|
|
|
|
|
|
self->renderflags &= ~RF_INVISIBLE;
|
|
|
|
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
|
|
|
|
AActor *BlockingMobj = self->BlockingMobj;
|
|
|
|
if (BlockingMobj && BlockingMobj->flags&MF_SHOOTABLE)
|
|
|
|
{ // Hit something, so spawn the flame circle around the thing
|
2016-03-21 13:00:05 +00:00
|
|
|
dist = BlockingMobj->radius + 18;
|
2016-03-01 15:47:10 +00:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
2016-03-16 11:41:26 +00:00
|
|
|
an = i*45.;
|
2016-03-21 13:00:05 +00:00
|
|
|
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Angle(dist, an, 5), ALLOW_REPLACE);
|
2016-03-01 15:47:10 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
2016-03-16 11:41:26 +00:00
|
|
|
mo->Angles.Yaw = an;
|
2016-03-01 15:47:10 +00:00
|
|
|
mo->target = self->target;
|
2016-03-16 11:41:26 +00:00
|
|
|
mo->VelFromAngle(FLAMESPEED);
|
2016-03-20 20:51:09 +00:00
|
|
|
mo->specialf1 = mo->Vel.X;
|
|
|
|
mo->specialf2 = mo->Vel.Y;
|
2016-03-01 15:47:10 +00:00
|
|
|
mo->tics -= pr_missile()&3;
|
|
|
|
}
|
2016-03-21 13:00:05 +00:00
|
|
|
mo = Spawn("CircleFlame", BlockingMobj->Vec3Angle(dist, an, 5), ALLOW_REPLACE);
|
2016-03-01 15:47:10 +00:00
|
|
|
if(mo)
|
|
|
|
{
|
2016-03-16 11:41:26 +00:00
|
|
|
mo->Angles.Yaw = an + 180.;
|
2016-03-01 15:47:10 +00:00
|
|
|
mo->target = self->target;
|
2016-03-16 11:41:26 +00:00
|
|
|
mo->VelFromAngle(-FLAMESPEED);
|
2016-03-20 20:51:09 +00:00
|
|
|
mo->specialf1 = mo->Vel.X;
|
|
|
|
mo->specialf2 = mo->Vel.Y;
|
2016-03-01 15:47:10 +00:00
|
|
|
mo->tics -= pr_missile()&3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self->SetState (self->SpawnState);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_CFlameRotate
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlameRotate)
|
|
|
|
{
|
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2016-03-16 11:41:26 +00:00
|
|
|
DAngle an = self->Angles.Yaw + 90.;
|
|
|
|
self->VelFromAngle(an, FLAMEROTSPEED);
|
2016-03-20 20:51:09 +00:00
|
|
|
self->Vel += DVector2(self->specialf1, self->specialf2);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-03-16 11:41:26 +00:00
|
|
|
self->Angles.Yaw += 6.;
|
2016-03-01 15:47:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|