mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-08 05:51:26 +00:00
760f70d3f1
so that all files are included by a central one instead of compiling each one separately. This speeds up the compilation process by 25% when doing a complete rebuild in Visual C. - Cleaned up more header dependencies. SVN r1226 (trunk)
91 lines
2.3 KiB
C++
91 lines
2.3 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)
|
|
{
|
|
static const char *fogs[3] =
|
|
{
|
|
"FogPatchSmall",
|
|
"FogPatchMedium",
|
|
"FogPatchLarge"
|
|
};
|
|
|
|
AActor *mo=NULL;
|
|
angle_t delta;
|
|
|
|
if (self->special1-- > 0) return;
|
|
|
|
self->special1 = self->args[2]; // Reset frequency count
|
|
|
|
mo = Spawn (fogs[pr_fogspawn()%3], self->x, self->y, self->z, 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;
|
|
}
|
|
}
|
|
|
|
//==========================================================================
|
|
//
|
|
// A_FogMove
|
|
//
|
|
//==========================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
|
|
{
|
|
int speed = self->args[0]<<FRACBITS;
|
|
angle_t angle;
|
|
int weaveindex;
|
|
|
|
if (!(self->args[4])) return;
|
|
|
|
if (self->args[3]-- <= 0)
|
|
{
|
|
self->SetStateNF (self->FindState(NAME_Death));
|
|
return;
|
|
}
|
|
|
|
if ((self->args[3] % 4) == 0)
|
|
{
|
|
weaveindex = self->special2;
|
|
self->z += FloatBobOffsets[weaveindex]>>1;
|
|
self->special2 = (weaveindex+1)&63;
|
|
}
|
|
|
|
angle = self->angle>>ANGLETOFINESHIFT;
|
|
self->momx = FixedMul(speed, finecosine[angle]);
|
|
self->momy = FixedMul(speed, finesine[angle]);
|
|
}
|
|
|