2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +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"
|
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
|
|
|
|
|
|
|
const fixed_t FLAMESPEED = fixed_t(0.45*FRACUNIT);
|
|
|
|
const fixed_t CFLAMERANGE = 12*64*FRACUNIT;
|
|
|
|
const fixed_t FLAMEROTSPEED = 2*FRACUNIT;
|
|
|
|
|
|
|
|
static FRandom pr_missile ("CFlameMissile");
|
|
|
|
|
|
|
|
void A_CFlameAttack (AActor *);
|
|
|
|
void A_CFlameRotate (AActor *);
|
|
|
|
void A_CFlamePuff (AActor *);
|
|
|
|
void A_CFlameMissile (AActor *);
|
|
|
|
|
|
|
|
// Flame Missile ------------------------------------------------------------
|
|
|
|
|
2008-11-15 09:57:18 +00:00
|
|
|
class ACFlameMissile : public AFastProjectile
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-11-15 09:57:18 +00:00
|
|
|
DECLARE_CLASS (ACFlameMissile, AFastProjectile)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void BeginPlay ();
|
2008-11-15 09:57:18 +00:00
|
|
|
void Effect ();
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-08-03 19:42:24 +00:00
|
|
|
IMPLEMENT_CLASS (ACFlameMissile)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void ACFlameMissile::BeginPlay ()
|
|
|
|
{
|
|
|
|
special1 = 2;
|
|
|
|
}
|
|
|
|
|
2008-11-15 09:57:18 +00:00
|
|
|
void ACFlameMissile::Effect ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
fixed_t newz;
|
|
|
|
|
2008-11-15 09:57:18 +00:00
|
|
|
if (!--special1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-11-15 09:57:18 +00:00
|
|
|
special1 = 4;
|
|
|
|
newz = z-12*FRACUNIT;
|
|
|
|
if (newz < floorz)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-11-15 09:57:18 +00:00
|
|
|
newz = floorz;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-11-15 09:57:18 +00:00
|
|
|
AActor *mo = Spawn ("CFlameFloor", x, y, newz, ALLOW_REPLACE);
|
|
|
|
if (mo)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-11-15 09:57:18 +00:00
|
|
|
mo->angle = angle;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_CFlameAttack
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlameAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACFlameMissile));
|
|
|
|
S_Sound (self, CHAN_WEAPON, "ClericFlameFire", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_CFlamePuff
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlamePuff)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 22:48:37 +00:00
|
|
|
self->renderflags &= ~RF_INVISIBLE;
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = 0;
|
|
|
|
self->vely = 0;
|
|
|
|
self->velz = 0;
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_CFlameMissile
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int an, an90;
|
|
|
|
fixed_t dist;
|
|
|
|
AActor *mo;
|
|
|
|
|
2008-08-10 22:48:37 +00:00
|
|
|
self->renderflags &= ~RF_INVISIBLE;
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
|
|
|
|
AActor *BlockingMobj = self->BlockingMobj;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (BlockingMobj && BlockingMobj->flags&MF_SHOOTABLE)
|
|
|
|
{ // Hit something, so spawn the flame circle around the thing
|
|
|
|
dist = BlockingMobj->radius+18*FRACUNIT;
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
an = (i*ANG45)>>ANGLETOFINESHIFT;
|
|
|
|
an90 = (i*ANG45+ANG90)>>ANGLETOFINESHIFT;
|
2008-08-03 19:42:24 +00:00
|
|
|
mo = Spawn ("CircleFlame", BlockingMobj->x+FixedMul(dist, finecosine[an]),
|
2006-02-24 04:48:15 +00:00
|
|
|
BlockingMobj->y+FixedMul(dist, finesine[an]),
|
2006-07-16 09:10:45 +00:00
|
|
|
BlockingMobj->z+5*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
|
|
|
mo->angle = an<<ANGLETOFINESHIFT;
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->target = self->target;
|
2009-06-30 20:57:51 +00:00
|
|
|
mo->velx = mo->special1 = FixedMul(FLAMESPEED, finecosine[an]);
|
|
|
|
mo->vely = mo->special2 = FixedMul(FLAMESPEED, finesine[an]);
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->tics -= pr_missile()&3;
|
|
|
|
}
|
2008-08-03 19:42:24 +00:00
|
|
|
mo = Spawn ("CircleFlame", BlockingMobj->x-FixedMul(dist, finecosine[an]),
|
2006-02-24 04:48:15 +00:00
|
|
|
BlockingMobj->y-FixedMul(dist, finesine[an]),
|
2006-07-16 09:10:45 +00:00
|
|
|
BlockingMobj->z+5*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if(mo)
|
|
|
|
{
|
|
|
|
mo->angle = ANG180+(an<<ANGLETOFINESHIFT);
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->target = self->target;
|
2009-06-30 20:57:51 +00:00
|
|
|
mo->velx = mo->special1 = FixedMul(-FLAMESPEED, finecosine[an]);
|
|
|
|
mo->vely = mo->special2 = FixedMul(-FLAMESPEED, finesine[an]);
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->tics -= pr_missile()&3;
|
|
|
|
}
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self->SetState (self->SpawnState);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_CFlameRotate
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlameRotate)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int an;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velx = self->special1+FixedMul(FLAMEROTSPEED, finecosine[an]);
|
|
|
|
self->vely = self->special2+FixedMul(FLAMEROTSPEED, finesine[an]);
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle += ANG90/15;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|