mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-14 22:21:32 +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
102 lines
2.4 KiB
C++
102 lines
2.4 KiB
C++
/*
|
|
#include "m_random.h"
|
|
#include "p_local.h"
|
|
#include "thingdef/thingdef.h"
|
|
*/
|
|
|
|
static FRandom pr_fogspawn ("FogSpawn");
|
|
|
|
//==========================================================================
|
|
// Fog Variables:
|
|
//
|
|
// args[0] Speed (0..10) of fog
|
|
// args[1] Angle of spread (0..128)
|
|
// args[2] Frequency of spawn (1..10)
|
|
// args[3] Lifetime countdown
|
|
// args[4] Boolean: fog moving?
|
|
// special1 Internal: Counter for spawn frequency
|
|
// special2 Internal: Index into floatbob table
|
|
//
|
|
//==========================================================================
|
|
|
|
//==========================================================================
|
|
//
|
|
// A_FogSpawn
|
|
//
|
|
//==========================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn)
|
|
{
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
static const char *fogs[3] =
|
|
{
|
|
"FogPatchSmall",
|
|
"FogPatchMedium",
|
|
"FogPatchLarge"
|
|
};
|
|
|
|
AActor *mo = NULL;
|
|
angle_t delta;
|
|
|
|
if (self->special1-- > 0)
|
|
{
|
|
return 0;
|
|
}
|
|
self->special1 = self->args[2]; // Reset frequency count
|
|
|
|
mo = Spawn (fogs[pr_fogspawn()%3], self->Pos(), ALLOW_REPLACE);
|
|
|
|
if (mo)
|
|
{
|
|
delta = self->args[1];
|
|
if (delta==0) delta=1;
|
|
mo->angle = self->angle + (((pr_fogspawn()%delta)-(delta>>1))<<24);
|
|
mo->target = self;
|
|
if (self->args[0] < 1) self->args[0] = 1;
|
|
mo->args[0] = (pr_fogspawn() % (self->args[0]))+1; // Random speed
|
|
mo->args[3] = self->args[3]; // Set lifetime
|
|
mo->args[4] = 1; // Set to moving
|
|
mo->special2 = pr_fogspawn()&63;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
//==========================================================================
|
|
//
|
|
// A_FogMove
|
|
//
|
|
//==========================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
|
|
{
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
int speed = self->args[0]<<FRACBITS;
|
|
angle_t angle;
|
|
int weaveindex;
|
|
|
|
if (!self->args[4])
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
if (self->args[3]-- <= 0)
|
|
{
|
|
self->SetState (self->FindState(NAME_Death), true);
|
|
return 0;
|
|
}
|
|
|
|
if ((self->args[3] % 4) == 0)
|
|
{
|
|
weaveindex = self->special2;
|
|
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 4);
|
|
self->special2 = (weaveindex + 1) & 63;
|
|
}
|
|
|
|
angle = self->angle>>ANGLETOFINESHIFT;
|
|
self->velx = FixedMul(speed, finecosine[angle]);
|
|
self->vely = FixedMul(speed, finesine[angle]);
|
|
return 0;
|
|
}
|
|
|