mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-07 21:41:07 +00:00
bc63b70d88
Conflicts: src/actor.h src/fragglescript/t_func.cpp src/g_doom/a_bossbrain.cpp src/g_doom/a_revenant.cpp src/g_heretic/a_hereticartifacts.cpp src/g_heretic/a_hereticweaps.cpp src/g_heretic/a_knight.cpp src/g_hexen/a_bishop.cpp src/g_hexen/a_clericholy.cpp src/g_hexen/a_dragon.cpp src/g_hexen/a_firedemon.cpp src/g_hexen/a_flechette.cpp src/g_hexen/a_heresiarch.cpp src/g_hexen/a_hexenspecialdecs.cpp src/g_hexen/a_iceguy.cpp src/g_hexen/a_korax.cpp src/g_hexen/a_magelightning.cpp src/g_hexen/a_serpent.cpp src/g_hexen/a_spike.cpp src/g_hexen/a_wraith.cpp src/g_raven/a_minotaur.cpp src/g_shared/a_bridge.cpp src/g_shared/a_pickups.cpp src/g_shared/a_randomspawner.cpp src/g_strife/a_alienspectres.cpp src/g_strife/a_crusader.cpp src/g_strife/a_entityboss.cpp src/g_strife/a_inquisitor.cpp src/g_strife/a_loremaster.cpp src/g_strife/a_programmer.cpp src/g_strife/a_sentinel.cpp src/g_strife/a_spectral.cpp src/g_strife/a_strifestuff.cpp src/g_strife/a_strifeweapons.cpp src/g_strife/a_thingstoblowup.cpp src/p_local.h src/r_utility.cpp
181 lines
4.4 KiB
C++
181 lines
4.4 KiB
C++
/*
|
|
#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"
|
|
*/
|
|
|
|
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 ------------------------------------------------------------
|
|
|
|
class ACFlameMissile : public AFastProjectile
|
|
{
|
|
DECLARE_CLASS (ACFlameMissile, AFastProjectile)
|
|
public:
|
|
void BeginPlay ();
|
|
void Effect ();
|
|
};
|
|
|
|
IMPLEMENT_CLASS (ACFlameMissile)
|
|
|
|
void ACFlameMissile::BeginPlay ()
|
|
{
|
|
special1 = 2;
|
|
}
|
|
|
|
void ACFlameMissile::Effect ()
|
|
{
|
|
fixed_t newz;
|
|
|
|
if (!--special1)
|
|
{
|
|
special1 = 4;
|
|
newz = Z()-12*FRACUNIT;
|
|
if (newz < floorz)
|
|
{
|
|
newz = floorz;
|
|
}
|
|
AActor *mo = Spawn ("CFlameFloor", X(), Y(), newz, ALLOW_REPLACE);
|
|
if (mo)
|
|
{
|
|
mo->angle = angle;
|
|
}
|
|
}
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// 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;
|
|
self->velx = 0;
|
|
self->vely = 0;
|
|
self->velz = 0;
|
|
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
|
|
return 0;
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_CFlameMissile
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
|
|
{
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
int i;
|
|
int an, an90;
|
|
fixed_t dist;
|
|
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
|
|
dist = BlockingMobj->radius+18*FRACUNIT;
|
|
for (i = 0; i < 4; i++)
|
|
{
|
|
an = (i*ANG45)>>ANGLETOFINESHIFT;
|
|
an90 = (i*ANG45+ANG90)>>ANGLETOFINESHIFT;
|
|
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
|
|
FixedMul(dist, finecosine[an]),
|
|
FixedMul(dist, finesine[an]),
|
|
5*FRACUNIT), ALLOW_REPLACE);
|
|
if (mo)
|
|
{
|
|
mo->angle = an<<ANGLETOFINESHIFT;
|
|
mo->target = self->target;
|
|
mo->velx = mo->special1 = FixedMul(FLAMESPEED, finecosine[an]);
|
|
mo->vely = mo->special2 = FixedMul(FLAMESPEED, finesine[an]);
|
|
mo->tics -= pr_missile()&3;
|
|
}
|
|
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
|
|
-FixedMul(dist, finecosine[an]),
|
|
-FixedMul(dist, finesine[an]),
|
|
5*FRACUNIT), ALLOW_REPLACE);
|
|
if(mo)
|
|
{
|
|
mo->angle = ANG180+(an<<ANGLETOFINESHIFT);
|
|
mo->target = self->target;
|
|
mo->velx = mo->special1 = FixedMul(-FLAMESPEED, finecosine[an]);
|
|
mo->vely = mo->special2 = FixedMul(-FLAMESPEED, finesine[an]);
|
|
mo->tics -= pr_missile()&3;
|
|
}
|
|
}
|
|
self->SetState (self->SpawnState);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_CFlameRotate
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CFlameRotate)
|
|
{
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
int an;
|
|
|
|
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
|
|
self->velx = self->special1+FixedMul(FLAMEROTSPEED, finecosine[an]);
|
|
self->vely = self->special2+FixedMul(FLAMEROTSPEED, finesine[an]);
|
|
self->angle += ANG90/15;
|
|
return 0;
|
|
}
|