2001-08-25 02:47:11 +00:00
|
|
|
/*
|
|
|
|
sw32_rpart.c
|
|
|
|
|
2003-10-22 06:00:36 +00:00
|
|
|
24 bit color software renderer particle effects.
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-02-22 07:32:34 +00:00
|
|
|
#define NH_DEFINE
|
|
|
|
#include "namehack.h"
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2001-08-25 02:47:11 +00:00
|
|
|
#include <stdlib.h>
|
2010-08-24 07:20:07 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2001-08-28 22:46:02 +00:00
|
|
|
#include "QF/cvar.h"
|
2013-01-21 11:06:54 +00:00
|
|
|
#include "QF/mersenne.h"
|
2001-08-25 02:47:11 +00:00
|
|
|
#include "QF/qargs.h"
|
2002-08-27 07:16:28 +00:00
|
|
|
#include "QF/quakefs.h"
|
2001-08-28 22:46:02 +00:00
|
|
|
#include "QF/render.h"
|
2007-11-06 10:17:14 +00:00
|
|
|
#include "QF/sys.h"
|
2010-08-24 07:20:07 +00:00
|
|
|
#include "QF/va.h"
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
#include "compat.h"
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "r_internal.h"
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2012-02-18 05:34:14 +00:00
|
|
|
static int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
|
|
|
|
//static int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
|
|
|
|
static int ramp3[8] = { 0x6d, 0x6b, 6, 5, 4, 3 };
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2013-01-21 11:06:54 +00:00
|
|
|
static mtstate_t mt; // private PRNG state
|
|
|
|
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2001-12-19 04:03:57 +00:00
|
|
|
void
|
2012-02-22 07:32:34 +00:00
|
|
|
sw32_R_InitParticles (void)
|
2001-12-19 04:03:57 +00:00
|
|
|
{
|
2013-01-21 11:06:54 +00:00
|
|
|
mtwist_seed (&mt, 0xdeadbeef);
|
2001-12-19 04:03:57 +00:00
|
|
|
}
|
|
|
|
|
2012-02-18 13:28:42 +00:00
|
|
|
void
|
2012-02-22 07:32:34 +00:00
|
|
|
sw32_R_ClearParticles (void)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
2003-04-17 00:01:48 +00:00
|
|
|
unsigned int i;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
free_particles = &particles[0];
|
|
|
|
active_particles = NULL;
|
|
|
|
|
2001-09-19 18:07:09 +00:00
|
|
|
for (i = 0; i < r_maxparticles; i++)
|
2001-08-25 02:47:11 +00:00
|
|
|
particles[i].next = &particles[i + 1];
|
2001-10-27 20:52:33 +00:00
|
|
|
if (r_maxparticles)
|
|
|
|
particles[r_maxparticles - 1].next = NULL;
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-02-22 07:32:34 +00:00
|
|
|
sw32_R_ReadPointFile_f (void)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
2002-08-27 07:16:28 +00:00
|
|
|
QFile *f;
|
2001-08-25 02:47:11 +00:00
|
|
|
vec3_t org;
|
|
|
|
int r;
|
|
|
|
int c;
|
|
|
|
particle_t *p;
|
2010-08-24 07:20:07 +00:00
|
|
|
const char *name;
|
|
|
|
char *mapname;
|
|
|
|
|
2021-03-09 14:52:40 +00:00
|
|
|
mapname = strdup (r_worldentity.renderer.model->path);
|
2010-08-24 07:20:07 +00:00
|
|
|
if (!mapname)
|
|
|
|
Sys_Error ("Can't duplicate mapname!");
|
|
|
|
QFS_StripExtension (mapname, mapname);
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2021-01-31 07:01:20 +00:00
|
|
|
name = va (0, "maps/%s.pts", mapname);
|
2010-08-24 07:20:07 +00:00
|
|
|
free (mapname);
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2014-01-23 02:57:57 +00:00
|
|
|
f = QFS_FOpenFile (name);
|
2001-08-25 02:47:11 +00:00
|
|
|
if (!f) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("couldn't open %s\n", name);
|
2001-08-25 02:47:11 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Reading %s...\n", name);
|
2001-08-25 02:47:11 +00:00
|
|
|
c = 0;
|
|
|
|
for (;;) {
|
|
|
|
char buf[64];
|
|
|
|
|
|
|
|
Qgets (f, buf, sizeof (buf));
|
|
|
|
r = sscanf (buf, "%f %f %f\n", &org[0], &org[1], &org[2]);
|
|
|
|
if (r != 3)
|
|
|
|
break;
|
|
|
|
c++;
|
|
|
|
|
|
|
|
if (!free_particles) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Not enough free particles\n");
|
2001-08-25 02:47:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->die = 99999;
|
|
|
|
p->color = (-c) & 15;
|
|
|
|
p->type = pt_static;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2003-09-03 22:17:04 +00:00
|
|
|
VectorZero (p->vel);
|
2001-08-25 02:47:11 +00:00
|
|
|
VectorCopy (org, p->org);
|
|
|
|
}
|
|
|
|
|
|
|
|
Qclose (f);
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%i points read\n", c);
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_ParticleExplosion_QF (const vec3_t org)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
particle_t *p;
|
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < 1024; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 5;
|
2001-08-25 02:47:11 +00:00
|
|
|
p->color = ramp1[0];
|
2013-01-21 11:06:54 +00:00
|
|
|
p->ramp = mtwist_rand (&mt) & 3;
|
2001-08-25 02:47:11 +00:00
|
|
|
if (i & 1) {
|
|
|
|
p->type = pt_explode;
|
|
|
|
for (j = 0; j < 3; j++) {
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = org[j] + ((mtwist_rand (&mt) % 32) - 16);
|
|
|
|
p->vel[j] = (mtwist_rand (&mt) % 512) - 256;
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
p->type = pt_explode2;
|
|
|
|
for (j = 0; j < 3; j++) {
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = org[j] + ((mtwist_rand (&mt) % 32) - 16);
|
|
|
|
p->vel[j] = (mtwist_rand (&mt) % 512) - 256;
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength)
|
2001-08-25 03:24:44 +00:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
particle_t *p;
|
|
|
|
int colorMod = 0;
|
|
|
|
|
|
|
|
for (i=0; i<512; i++)
|
|
|
|
{
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 0.3;
|
2001-08-25 03:24:44 +00:00
|
|
|
p->color = colorStart + (colorMod % colorLength);
|
|
|
|
colorMod++;
|
|
|
|
|
|
|
|
p->type = pt_blob;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-08-25 03:24:44 +00:00
|
|
|
for (j=0 ; j<3 ; j++)
|
|
|
|
{
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = org[j] + ((mtwist_rand (&mt)%32)-16);
|
|
|
|
p->vel[j] = (mtwist_rand (&mt)%512)-256;
|
2001-08-25 03:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_BlobExplosion_QF (const vec3_t org)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
particle_t *p;
|
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < 1024; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2013-01-21 11:06:54 +00:00
|
|
|
p->die = vr_data.realtime + 1 + (mtwist_rand (&mt) & 8) * 0.05;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
if (i & 1) {
|
|
|
|
p->type = pt_blob;
|
2013-01-21 11:06:54 +00:00
|
|
|
p->color = 66 + mtwist_rand (&mt) % 6;
|
2001-08-25 02:47:11 +00:00
|
|
|
for (j = 0; j < 3; j++) {
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = org[j] + ((mtwist_rand (&mt) % 32) - 16);
|
|
|
|
p->vel[j] = (mtwist_rand (&mt) % 512) - 256;
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
p->type = pt_blob2;
|
2013-01-21 11:06:54 +00:00
|
|
|
p->color = 150 + mtwist_rand (&mt) % 6;
|
2001-08-25 02:47:11 +00:00
|
|
|
for (j = 0; j < 3; j++) {
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = org[j] + ((mtwist_rand (&mt) % 32) - 16);
|
|
|
|
p->vel[j] = (mtwist_rand (&mt) % 512) - 256;
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_LavaSplash_QF (const vec3_t org)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
|
|
|
int i, j, k;
|
|
|
|
particle_t *p;
|
|
|
|
float vel;
|
|
|
|
vec3_t dir;
|
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = -16; i < 16; i++)
|
|
|
|
for (j = -16; j < 16; j++)
|
|
|
|
for (k = 0; k < 1; k++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2013-01-21 11:06:54 +00:00
|
|
|
p->die = vr_data.realtime + 2 + (mtwist_rand (&mt) & 31) * 0.02;
|
|
|
|
p->color = 224 + (mtwist_rand (&mt) & 7);
|
2001-08-25 02:47:11 +00:00
|
|
|
p->type = pt_grav;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2013-01-21 11:06:54 +00:00
|
|
|
dir[0] = j * 8 + (mtwist_rand (&mt) & 7);
|
|
|
|
dir[1] = i * 8 + (mtwist_rand (&mt) & 7);
|
2001-08-25 02:47:11 +00:00
|
|
|
dir[2] = 256;
|
|
|
|
|
|
|
|
p->org[0] = org[0] + dir[0];
|
|
|
|
p->org[1] = org[1] + dir[1];
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[2] = org[2] + (mtwist_rand (&mt) & 63);
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
VectorNormalize (dir);
|
2013-01-21 11:06:54 +00:00
|
|
|
vel = 50 + (mtwist_rand (&mt) & 63);
|
2001-08-25 02:47:11 +00:00
|
|
|
VectorScale (dir, vel, p->vel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_TeleportSplash_QF (const vec3_t org)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
2001-09-07 05:37:11 +00:00
|
|
|
float vel;
|
|
|
|
int i, j, k;
|
2001-08-25 02:47:11 +00:00
|
|
|
particle_t *p;
|
2001-09-07 05:37:11 +00:00
|
|
|
vec3_t dir;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
2003-10-22 06:00:36 +00:00
|
|
|
for (i = -16; i < 16; i += 4) {
|
|
|
|
for (j = -16; j < 16; j += 4) {
|
2001-08-25 02:47:11 +00:00
|
|
|
for (k = -24; k < 32; k += 4) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2013-01-21 11:06:54 +00:00
|
|
|
p->die = vr_data.realtime + 0.2 + (mtwist_rand (&mt) & 7) * 0.02;
|
|
|
|
p->color = 7 + (mtwist_rand (&mt) & 7);
|
2001-08-25 02:47:11 +00:00
|
|
|
p->type = pt_grav;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
dir[0] = j * 8;
|
|
|
|
dir[1] = i * 8;
|
|
|
|
dir[2] = k * 8;
|
|
|
|
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[0] = org[0] + i + (mtwist_rand (&mt) & 3);
|
|
|
|
p->org[1] = org[1] + j + (mtwist_rand (&mt) & 3);
|
|
|
|
p->org[2] = org[2] + k + (mtwist_rand (&mt) & 3);
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
VectorNormalize (dir);
|
2013-01-21 11:06:54 +00:00
|
|
|
vel = 50 + (mtwist_rand (&mt) & 63);
|
2001-08-25 02:47:11 +00:00
|
|
|
VectorScale (dir, vel, p->vel);
|
|
|
|
}
|
2003-10-22 06:00:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_DarkFieldParticles_ID (const entity_t *ent)
|
2003-10-22 06:00:36 +00:00
|
|
|
{
|
|
|
|
int i, j, k;
|
|
|
|
unsigned int rnd;
|
|
|
|
float vel;
|
|
|
|
particle_t *p;
|
|
|
|
vec3_t dir, org;
|
|
|
|
|
|
|
|
org[0] = ent->origin[0];
|
|
|
|
org[1] = ent->origin[1];
|
|
|
|
org[2] = ent->origin[2];
|
|
|
|
for (i = -16; i < 16; i += 8) {
|
|
|
|
for (j = -16; j < 16; j += 8) {
|
|
|
|
for (k = 0; k < 32; k += 8) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2013-01-21 11:06:54 +00:00
|
|
|
rnd = mtwist_rand (&mt);
|
2003-10-22 06:00:36 +00:00
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 0.2 + (rnd & 7) * 0.02;
|
2013-01-21 11:06:54 +00:00
|
|
|
p->color = 150 + mtwist_rand (&mt) % 6;
|
2003-10-22 06:00:36 +00:00
|
|
|
p->type = pt_slowgrav;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2003-10-22 06:00:36 +00:00
|
|
|
|
|
|
|
dir[0] = j * 8;
|
|
|
|
dir[1] = i * 8;
|
|
|
|
dir[2] = k * 8;
|
|
|
|
|
|
|
|
p->org[0] = org[0] + i + ((rnd >> 3) & 3);
|
|
|
|
p->org[1] = org[1] + j + ((rnd >> 5) & 3);
|
|
|
|
p->org[2] = org[2] + k + ((rnd >> 7) & 3);
|
|
|
|
|
|
|
|
VectorNormalize (dir);
|
|
|
|
vel = 50 + ((rnd >> 9) & 63);
|
|
|
|
VectorScale (dir, vel, p->vel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static vec3_t avelocities[NUMVERTEXNORMALS];
|
|
|
|
|
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_EntityParticles_ID (const entity_t *ent)
|
2003-10-22 06:00:36 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
float angle, sp, sy, cp, cy; // cr, sr
|
|
|
|
float beamlength = 16.0, dist = 64.0;
|
|
|
|
particle_t *p;
|
|
|
|
vec3_t forward;
|
|
|
|
|
2013-09-27 14:08:33 +00:00
|
|
|
for (i = 0; i < NUMVERTEXNORMALS; i++) {
|
|
|
|
int k;
|
|
|
|
for (k = 0; k < 3; k++) {
|
|
|
|
avelocities[i][k] = (mtwist_rand (&mt) & 255) * 0.01;
|
|
|
|
}
|
2003-10-22 06:00:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < NUMVERTEXNORMALS; i++) {
|
2012-02-14 08:28:09 +00:00
|
|
|
angle = vr_data.realtime * avelocities[i][0];
|
2003-10-22 06:00:36 +00:00
|
|
|
cy = cos (angle);
|
|
|
|
sy = sin (angle);
|
2012-02-14 08:28:09 +00:00
|
|
|
angle = vr_data.realtime * avelocities[i][1];
|
2003-10-22 06:00:36 +00:00
|
|
|
cp = cos (angle);
|
|
|
|
sp = sin (angle);
|
|
|
|
// Next 3 lines results aren't currently used, may be in future. --Despair
|
2012-02-14 08:28:09 +00:00
|
|
|
// angle = vr_data.realtime * avelocities[i][2];
|
2003-10-22 06:00:36 +00:00
|
|
|
// sr = sin (angle);
|
|
|
|
// cr = cos (angle);
|
|
|
|
|
|
|
|
forward[0] = cp * cy;
|
|
|
|
forward[1] = cp * sy;
|
|
|
|
forward[2] = -sp;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 0.01;
|
2003-10-22 06:00:36 +00:00
|
|
|
p->color = 0x6f;
|
|
|
|
p->type = pt_explode;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2003-10-22 06:00:36 +00:00
|
|
|
|
|
|
|
p->org[0] = ent->origin[0] + r_avertexnormals[i][0] * dist +
|
|
|
|
forward[0] * beamlength;
|
|
|
|
p->org[1] = ent->origin[1] + r_avertexnormals[i][1] * dist +
|
|
|
|
forward[1] * beamlength;
|
|
|
|
p->org[2] = ent->origin[2] + r_avertexnormals[i][2] * dist +
|
|
|
|
forward[2] * beamlength;
|
|
|
|
}
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color,
|
|
|
|
int count)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
particle_t *p;
|
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2013-01-21 11:06:54 +00:00
|
|
|
p->die = vr_data.realtime + 0.1 * (mtwist_rand (&mt) % 5);
|
|
|
|
p->color = (color & ~7) + (mtwist_rand (&mt) & 7);
|
2001-12-11 22:37:30 +00:00
|
|
|
p->type = pt_slowgrav;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-12-11 22:37:30 +00:00
|
|
|
for (j = 0; j < 3; j++) {
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = org[j] + ((mtwist_rand (&mt) & 15) - 8);
|
|
|
|
p->vel[j] = dir[j]; // + (mtwist_rand (&mt)%300)-150;
|
2001-12-11 22:37:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_SpikeEffect_QF (const vec3_t org)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
|
|
|
R_RunParticleEffect_QF (org, vec3_origin, 0, 10);
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_SuperSpikeEffect_QF (const vec3_t org)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
2012-02-14 08:28:09 +00:00
|
|
|
R_RunParticleEffect_QF (org, vec3_origin, 0, 20);
|
2001-12-11 22:37:30 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_KnightSpikeEffect_QF (const vec3_t org)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
|
|
|
R_RunParticleEffect_QF (org, vec3_origin, 226, 20);
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_WizSpikeEffect_QF (const vec3_t org)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
|
|
|
R_RunParticleEffect_QF (org, vec3_origin, 20, 30);
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_BloodPuffEffect_QF (const vec3_t org, int count)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
|
|
|
R_RunParticleEffect_QF (org, vec3_origin, 73, count);
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_GunshotEffect_QF (const vec3_t org, int count)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
|
|
|
R_RunParticleEffect_QF (org, vec3_origin, 0, count);
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-01-03 05:29:38 +00:00
|
|
|
R_LightningBloodEffect_QF (const vec3_t org)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
|
|
|
R_RunParticleEffect_QF (org, vec3_origin, 225, 50);
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_RocketTrail_QF (const entity_t *ent)
|
2001-09-07 05:37:11 +00:00
|
|
|
{
|
|
|
|
float len;
|
|
|
|
int j;
|
|
|
|
particle_t *p;
|
2003-10-23 03:53:59 +00:00
|
|
|
vec3_t old_origin, vec;
|
2001-09-07 05:37:11 +00:00
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorCopy (ent->old_origin, old_origin);
|
2001-09-07 05:37:11 +00:00
|
|
|
VectorSubtract (ent->origin, ent->old_origin, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= 3;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2003-09-03 22:17:04 +00:00
|
|
|
VectorZero (p->vel);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 2;
|
2013-01-21 11:06:54 +00:00
|
|
|
p->ramp = (mtwist_rand (&mt) & 3);
|
2001-09-07 05:37:11 +00:00
|
|
|
p->color = ramp3[(int) p->ramp];
|
|
|
|
p->type = pt_fire;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-09-07 05:37:11 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = old_origin[j] + ((mtwist_rand (&mt) % 6) - 3);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorAdd (old_origin, vec, old_origin);
|
2001-09-07 05:37:11 +00:00
|
|
|
}
|
|
|
|
}
|
2001-08-28 22:46:02 +00:00
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_GrenadeTrail_QF (const entity_t *ent)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
2001-09-07 05:37:11 +00:00
|
|
|
float len;
|
|
|
|
int j;
|
2001-08-25 02:47:11 +00:00
|
|
|
particle_t *p;
|
2003-10-23 03:53:59 +00:00
|
|
|
vec3_t old_origin, vec;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorCopy (ent->old_origin, old_origin);
|
|
|
|
VectorSubtract (ent->origin, old_origin, vec);
|
2001-08-25 02:47:11 +00:00
|
|
|
len = VectorNormalize (vec);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2001-08-25 02:47:11 +00:00
|
|
|
while (len > 0) {
|
|
|
|
len -= 3;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2003-09-03 22:17:04 +00:00
|
|
|
VectorZero (p->vel);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 2;
|
2013-01-21 11:06:54 +00:00
|
|
|
p->ramp = (mtwist_rand (&mt) & 3) + 2;
|
2001-09-07 05:37:11 +00:00
|
|
|
p->color = ramp3[(int) p->ramp];
|
|
|
|
p->type = pt_fire;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-09-07 05:37:11 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = old_origin[j] + ((mtwist_rand (&mt) % 6) - 3);
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorAdd (old_origin, vec, old_origin);
|
2001-09-07 05:37:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_BloodTrail_QF (const entity_t *ent)
|
2001-09-07 05:37:11 +00:00
|
|
|
{
|
|
|
|
float len;
|
|
|
|
int j;
|
|
|
|
particle_t *p;
|
2003-10-23 03:53:59 +00:00
|
|
|
vec3_t old_origin, vec;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2001-09-07 05:37:11 +00:00
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorCopy (ent->old_origin, old_origin);
|
|
|
|
VectorSubtract (ent->origin, old_origin, vec);
|
2001-09-07 05:37:11 +00:00
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= 3;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2003-09-03 22:17:04 +00:00
|
|
|
VectorZero (p->vel);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 2;
|
2001-09-07 05:37:11 +00:00
|
|
|
p->type = pt_slowgrav;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2013-01-21 11:06:54 +00:00
|
|
|
p->color = 67 + (mtwist_rand (&mt) & 3);
|
2001-09-07 05:37:11 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = old_origin[j] + ((mtwist_rand (&mt) % 6) - 3);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorAdd (old_origin, vec, old_origin);
|
2001-09-07 05:37:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_SlightBloodTrail_QF (const entity_t *ent)
|
2001-09-07 05:37:11 +00:00
|
|
|
{
|
|
|
|
float len;
|
|
|
|
int j;
|
|
|
|
particle_t *p;
|
2003-10-23 03:53:59 +00:00
|
|
|
vec3_t old_origin, vec;
|
2001-09-07 05:37:11 +00:00
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorCopy (ent->old_origin, old_origin);
|
|
|
|
VectorSubtract (ent->origin, old_origin, vec);
|
2001-09-07 05:37:11 +00:00
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= 6;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2003-09-03 22:17:04 +00:00
|
|
|
VectorZero (p->vel);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 2;
|
2001-09-07 05:37:11 +00:00
|
|
|
p->type = pt_slowgrav;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2013-01-21 11:06:54 +00:00
|
|
|
p->color = 67 + (mtwist_rand (&mt) & 3);
|
2001-09-07 05:37:11 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = old_origin[j] + ((mtwist_rand (&mt) % 6) - 3);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorAdd (old_origin, vec, old_origin);
|
2001-09-07 05:37:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_WizTrail_QF (const entity_t *ent)
|
2001-09-07 05:37:11 +00:00
|
|
|
{
|
|
|
|
float len;
|
|
|
|
particle_t *p;
|
2003-10-23 03:53:59 +00:00
|
|
|
vec3_t old_origin, vec;
|
2001-09-07 05:37:11 +00:00
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorCopy (ent->old_origin, old_origin);
|
|
|
|
VectorSubtract (ent->origin, old_origin, vec);
|
2001-09-07 05:37:11 +00:00
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
static int tracercount;
|
|
|
|
|
|
|
|
len -= 3;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 0.5;
|
2001-09-07 05:37:11 +00:00
|
|
|
p->type = pt_static;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-09-07 05:37:11 +00:00
|
|
|
p->color = 52 + ((tracercount & 4) << 1);
|
|
|
|
|
|
|
|
tracercount++;
|
|
|
|
|
2012-05-21 23:23:22 +00:00
|
|
|
VectorCopy (old_origin, p->org);
|
|
|
|
if (tracercount & 1) {
|
|
|
|
p->vel[0] = 30.0 * vec[1];
|
|
|
|
p->vel[1] = 30.0 * -vec[0];
|
|
|
|
} else {
|
|
|
|
p->vel[0] = 30.0 * -vec[1];
|
|
|
|
p->vel[1] = 30.0 * vec[0];
|
|
|
|
}
|
2002-01-06 23:12:09 +00:00
|
|
|
p->vel[2] = 0.0;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorAdd (old_origin, vec, old_origin);
|
2001-09-07 05:37:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_FlameTrail_QF (const entity_t *ent)
|
2001-09-07 05:37:11 +00:00
|
|
|
{
|
|
|
|
float len;
|
|
|
|
particle_t *p;
|
2003-10-23 03:53:59 +00:00
|
|
|
vec3_t old_origin, vec;
|
2001-09-07 05:37:11 +00:00
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorCopy (ent->old_origin, old_origin);
|
|
|
|
VectorSubtract (ent->origin, old_origin, vec);
|
2001-09-07 05:37:11 +00:00
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
static int tracercount;
|
|
|
|
|
|
|
|
len -= 3;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 0.5;
|
2001-09-07 05:37:11 +00:00
|
|
|
p->type = pt_static;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2001-09-07 05:37:11 +00:00
|
|
|
p->color = 230 + ((tracercount & 4) << 1);
|
|
|
|
|
|
|
|
tracercount++;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorCopy (old_origin, p->org);
|
2001-09-07 05:37:11 +00:00
|
|
|
if (tracercount & 1) {
|
2002-01-06 23:12:09 +00:00
|
|
|
p->vel[0] = 30.0 * vec[1];
|
|
|
|
p->vel[1] = 30.0 * -vec[0];
|
2001-09-07 05:37:11 +00:00
|
|
|
} else {
|
2002-01-06 23:12:09 +00:00
|
|
|
p->vel[0] = 30.0 * -vec[1];
|
|
|
|
p->vel[1] = 30.0 * vec[0];
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
2002-01-06 23:12:09 +00:00
|
|
|
p->vel[2] = 0.0;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorAdd (old_origin, vec, old_origin);
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2003-10-23 03:53:59 +00:00
|
|
|
R_VoorTrail_QF (const entity_t *ent)
|
2001-09-07 05:37:11 +00:00
|
|
|
{
|
|
|
|
float len;
|
|
|
|
int j;
|
|
|
|
particle_t *p;
|
2003-10-23 03:53:59 +00:00
|
|
|
vec3_t old_origin, vec;
|
2001-09-07 05:37:11 +00:00
|
|
|
|
|
|
|
if (!r_particles->int_val)
|
|
|
|
return;
|
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorCopy (ent->old_origin, old_origin);
|
|
|
|
VectorSubtract (ent->origin, old_origin, vec);
|
2001-09-07 05:37:11 +00:00
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= 3;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2003-09-03 22:17:04 +00:00
|
|
|
VectorZero (p->vel);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
p->die = vr_data.realtime + 0.3;
|
2001-09-07 05:37:11 +00:00
|
|
|
p->type = pt_static;
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
2013-01-21 11:06:54 +00:00
|
|
|
p->color = 9 * 16 + 8 + (mtwist_rand (&mt) & 3);
|
2001-09-07 05:37:11 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
2013-01-21 11:06:54 +00:00
|
|
|
p->org[j] = old_origin[j] + ((mtwist_rand (&mt) & 15) - 8);
|
2001-09-07 05:37:11 +00:00
|
|
|
|
2003-10-23 03:53:59 +00:00
|
|
|
VectorAdd (old_origin, vec, old_origin);
|
2001-09-07 05:37:11 +00:00
|
|
|
}
|
|
|
|
}
|
2001-08-28 22:46:02 +00:00
|
|
|
|
2001-08-25 02:47:11 +00:00
|
|
|
void
|
2012-02-22 07:32:34 +00:00
|
|
|
sw32_R_DrawParticles (void)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
2003-10-23 03:53:59 +00:00
|
|
|
particle_t *p, **particle;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2012-02-22 07:32:34 +00:00
|
|
|
VectorScale (vright, sw32_xscaleshrink, r_pright);
|
|
|
|
VectorScale (vup, sw32_yscaleshrink, r_pup);
|
2001-08-25 02:47:11 +00:00
|
|
|
VectorCopy (vpn, r_ppn);
|
|
|
|
|
|
|
|
for (particle = &active_particles; *particle;) {
|
2012-02-14 08:28:09 +00:00
|
|
|
if ((*particle)->die < vr_data.realtime) {
|
2001-08-25 02:47:11 +00:00
|
|
|
p = (*particle)->next;
|
|
|
|
(*particle)->next = free_particles;
|
|
|
|
free_particles = (*particle);
|
|
|
|
(*particle) = p;
|
|
|
|
} else {
|
|
|
|
p = *particle;
|
|
|
|
particle = &(*particle)->next;
|
|
|
|
|
2012-02-22 07:32:34 +00:00
|
|
|
sw32_D_DrawParticle (p);
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2012-01-15 11:14:36 +00:00
|
|
|
p->phys (p);
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-12-11 22:37:30 +00:00
|
|
|
|
|
|
|
void
|
2012-02-22 07:32:34 +00:00
|
|
|
sw32_r_easter_eggs_f (cvar_t *var)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-01-04 03:32:59 +00:00
|
|
|
void
|
2012-02-22 07:32:34 +00:00
|
|
|
sw32_r_particles_style_f (cvar_t *var)
|
2002-01-04 03:32:59 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-01-18 03:46:06 +00:00
|
|
|
static void
|
|
|
|
sw32_R_Particle_New (ptype_t type, int texnum, const vec3_t org, float scale,
|
|
|
|
const vec3_t vel, float die, int color, float alpha,
|
|
|
|
float ramp)
|
|
|
|
{
|
|
|
|
particle_t *p;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
VectorCopy (org, p->org);
|
|
|
|
p->color = color;
|
|
|
|
p->tex = texnum;
|
|
|
|
p->scale = scale;
|
|
|
|
p->alpha = alpha;
|
|
|
|
VectorCopy (vel, p->vel);
|
|
|
|
p->type = type;
|
|
|
|
p->phys = R_ParticlePhysics (p->type);
|
|
|
|
p->die = die;
|
|
|
|
p->ramp = ramp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sw32_R_Particle_NewRandom (ptype_t type, int texnum, const vec3_t org,
|
|
|
|
int org_fuzz, float scale, int vel_fuzz, float die,
|
|
|
|
int color, float alpha, float ramp)
|
|
|
|
{
|
|
|
|
float o_fuzz = org_fuzz, v_fuzz = vel_fuzz;
|
|
|
|
int rnd;
|
|
|
|
vec3_t porg, pvel;
|
|
|
|
|
|
|
|
rnd = mtwist_rand (&mt);
|
|
|
|
porg[0] = o_fuzz * ((rnd & 63) - 31.5) / 63.0 + org[0];
|
|
|
|
porg[1] = o_fuzz * (((rnd >> 6) & 63) - 31.5) / 63.0 + org[1];
|
|
|
|
porg[2] = o_fuzz * (((rnd >> 12) & 63) - 31.5) / 63.0 + org[2];
|
|
|
|
rnd = mtwist_rand (&mt);
|
|
|
|
pvel[0] = v_fuzz * ((rnd & 63) - 31.5) / 63.0;
|
|
|
|
pvel[1] = v_fuzz * (((rnd >> 6) & 63) - 31.5) / 63.0;
|
|
|
|
pvel[2] = v_fuzz * (((rnd >> 12) & 63) - 31.5) / 63.0;
|
|
|
|
|
|
|
|
sw32_R_Particle_New (type, texnum, porg, scale, pvel, die, color, alpha, ramp);
|
|
|
|
}
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
static vid_particle_funcs_t particles_QF = {
|
|
|
|
R_RocketTrail_QF,
|
|
|
|
R_GrenadeTrail_QF,
|
|
|
|
R_BloodTrail_QF,
|
|
|
|
R_SlightBloodTrail_QF,
|
|
|
|
R_WizTrail_QF,
|
|
|
|
R_FlameTrail_QF,
|
|
|
|
R_VoorTrail_QF,
|
|
|
|
0,//R_GlowTrail_QF,
|
|
|
|
R_RunParticleEffect_QF,
|
|
|
|
R_BloodPuffEffect_QF,
|
|
|
|
R_GunshotEffect_QF,
|
|
|
|
R_LightningBloodEffect_QF,
|
|
|
|
R_SpikeEffect_QF,
|
|
|
|
R_KnightSpikeEffect_QF,
|
|
|
|
R_SuperSpikeEffect_QF,
|
|
|
|
R_WizSpikeEffect_QF,
|
|
|
|
R_BlobExplosion_QF,
|
|
|
|
R_ParticleExplosion_QF,
|
|
|
|
R_ParticleExplosion2_QF,
|
|
|
|
R_LavaSplash_QF,
|
|
|
|
R_TeleportSplash_QF,
|
|
|
|
R_DarkFieldParticles_ID,
|
|
|
|
R_EntityParticles_ID,
|
2012-07-06 01:18:05 +00:00
|
|
|
R_Particle_New,
|
|
|
|
R_Particle_NewRandom,
|
2012-02-14 08:28:09 +00:00
|
|
|
};
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-12-11 22:37:30 +00:00
|
|
|
R_ParticleFunctionInit (void)
|
|
|
|
{
|
2012-02-22 12:53:17 +00:00
|
|
|
sw32_vid_render_funcs.particles = &particles_QF;
|
2001-12-11 22:37:30 +00:00
|
|
|
}
|
|
|
|
|
2012-04-11 13:45:23 +00:00
|
|
|
static void
|
|
|
|
r_particles_nearclip_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
Cvar_SetValue (r_particles_nearclip, bound (r_nearclip->value, var->value,
|
|
|
|
r_farclip->value));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
r_particles_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
R_MaxParticlesCheck (var, r_particles_max);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
r_particles_max_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
R_MaxParticlesCheck (r_particles, var);
|
|
|
|
}
|
|
|
|
|
2012-02-18 13:28:42 +00:00
|
|
|
void
|
2012-02-22 07:32:34 +00:00
|
|
|
sw32_R_Particles_Init_Cvars (void)
|
2001-12-11 22:37:30 +00:00
|
|
|
{
|
2012-04-11 13:45:23 +00:00
|
|
|
easter_eggs = Cvar_Get ("easter_eggs", "0", CVAR_NONE, r_easter_eggs_f,
|
|
|
|
"Enables easter eggs.");
|
|
|
|
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, r_particles_f,
|
|
|
|
"Toggles drawing of particles.");
|
|
|
|
r_particles_max = Cvar_Get ("r_particles_max", "2048", CVAR_ARCHIVE,
|
|
|
|
r_particles_max_f, "Maximum amount of "
|
|
|
|
"particles to display. No maximum, minimum "
|
|
|
|
"is 0.");
|
|
|
|
r_particles_nearclip = Cvar_Get ("r_particles_nearclip", "32",
|
|
|
|
CVAR_ARCHIVE, r_particles_nearclip_f,
|
|
|
|
"Distance of the particle near clipping "
|
|
|
|
"plane from the player.");
|
|
|
|
r_particles_style = Cvar_Get ("r_particles_style", "1", CVAR_ARCHIVE,
|
|
|
|
r_particles_style_f, "Sets particle style. "
|
|
|
|
"0 for Id, 1 for QF.");
|
2001-12-11 22:37:30 +00:00
|
|
|
R_ParticleFunctionInit ();
|
|
|
|
}
|