djcev.com

//

Git Repos / fte_dogmode / qc / misc / particles.qc

Last update to this file was on 2024-03-24 at 02:40.

Show particles.qc

//==============================================================================
// misc_particles AKA misc_splash
// selections from Rubicon 2 qc by john fitzgibbons
// renamed from misc_splash (Rubicon 2) -- dumptruck_ds
//==============================================================================

//======================================================================
// constants
//======================================================================

const float PARTICLES_START_OFF = 1;

//======================================================================
// forward declarations
//======================================================================

// misc_particles
void() misc_particles_think;
void() misc_particles_use;
void(entity e) misc_particles_init;
void() misc_particles;

// misc_splash
void() misc_splash;

//------------------------------------------------------------------------------

/*QUAKED misc_particles (0 .5 .8) (-8 -8 -8) (8 8 8) PARTICLES_START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

Produces a continuous particle splash for waterfalls and other effects

"color" color of particles. 0 through 15, corresponds to a row of the quake palette. (default 0)

"movedir" average movement vector of particles (default 0 0 4)

"wait" time between particle generation cycles. (default 0.1)

"volume" density of particles. (default 10)
*/
//----------------------------------------------------------------------
// class misc_particles: base_mapentity
// {
//--------------------------------------------------------------
// was splash_think -- CEV
//--------------------------------------------------------------
void() misc_particles_think =
{
local vector vec;
local float variance = vlen (self.movedir) / 2;
vec_x = self.movedir_x - variance + random() * variance * 2;
vec_y = self.movedir_y - variance + random() * variance * 2;
vec_z = self.movedir_z - variance + random() * variance * 2;
particle (self.origin, vec, self.color, self.volume);
self.think = misc_particles_think;
self.nextthink = time + self.wait;
};

//--------------------------------------------------------------
void() misc_particles_use =
{
if (self.spawnflags & PARTICLES_START_OFF)
{
self.spawnflags = self.spawnflags - PARTICLES_START_OFF;
self.think = __NULL__;
}
else
{
self.spawnflags = self.spawnflags + PARTICLES_START_OFF;
self.think = misc_particles_think;
self.nextthink = time + self.wait;
}
};

//--------------------------------------------------------------
void(entity e) misc_particles_init =
{
e.classname = "misc_particles";
e.classtype = CT_MISC_PARTICLES;
base_mapentity_init (e);

if (!e.wait)
e.wait = 0.1;

if (!e.movedir)
e.movedir = '0 0 4';

if (!e.volume)
e.volume = 10;

if (e.spawnflags & PARTICLES_START_OFF)
{
e.think = __NULL__;
}
else
{
e.think = misc_particles_think;
e.nextthink = time + e.wait;
}

e.color = e.color * 16;
e.use = misc_particles_use;
};

//--------------------------------------------------------------
void() misc_particles =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

misc_particles_init (self);
};
// };

//----------------------------------------------------------------------
// class misc_splash: misc_particles
// {
//--------------------------------------------------------------
void() misc_splash =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

misc_particles_init (self);
};
// };

Return to the top of this page or return to the overview of this repo.

Log particles.qc

Date Commit Message Author + -
2024-03-24 2nd pass refactor, rework QC class structure cev +78 -34
2024-01-31 Class based monster refactor & start projectiles cev +1 -1
2024-01-09 Continue OO / Class-based refactor cev +33 -31
2023-12-09 Start OO / class-based refactor, work on items cev +58 -51
2023-11-27 Code reorg, minor movement changes, misc cev +74  

Return to the top of this page or return to the overview of this repo.