mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
fix the persistent fires. For sanity's sake, the non-renderer specific parts
of gl_dyn_fires.c have been moved to r_main.c (for now).
This commit is contained in:
parent
85d2176bb6
commit
f61ca0e321
11 changed files with 116 additions and 153 deletions
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
qf_rlight.h
|
||||
|
||||
GL light stuff from the renderer.
|
||||
|
||||
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
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef __QF_GL_fires_h
|
||||
#define __QF_GL_fires_h
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
void R_AddFire (vec3_t, vec3_t, struct entity_s *ent);
|
||||
void R_UpdateFires (void);
|
||||
|
||||
#endif // __QF_GL_fires_h
|
|
@ -49,6 +49,7 @@ extern struct cvar_s *r_draworder;
|
|||
extern struct cvar_s *r_drawviewmodel;
|
||||
extern struct cvar_s *r_dspeeds;
|
||||
extern struct cvar_s *r_dynamic;
|
||||
extern struct cvar_s *r_firecolor;
|
||||
extern struct cvar_s *r_fullbright;
|
||||
extern struct cvar_s *r_graphheight;
|
||||
extern struct cvar_s *r_lightmap;
|
||||
|
|
|
@ -50,7 +50,7 @@ void R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count);
|
|||
void R_RunSpikeEffect (vec3_t org, particle_effect_t type);
|
||||
|
||||
#ifdef QUAKE2
|
||||
void R_DarkFieldParticles (entity_t *ent);
|
||||
void R_DarkFieldParticles (struct entity_s *ent);
|
||||
#endif
|
||||
void R_EntityParticles (struct entity_s *ent);
|
||||
void R_BlobExplosion (vec3_t org);
|
||||
|
@ -64,4 +64,23 @@ void R_InitParticles (void);
|
|||
void R_ClearParticles (void);
|
||||
void R_DrawParticles (void);
|
||||
|
||||
#define MAX_FIRES 128 // rocket flames
|
||||
|
||||
typedef struct {
|
||||
int key; // allows reusability
|
||||
vec3_t origin, owner;
|
||||
float size;
|
||||
float die, decay; // duration settings
|
||||
float minlight; // lighting threshold
|
||||
float color[3]; // RGB
|
||||
} fire_t;
|
||||
|
||||
extern fire_t r_fires[];
|
||||
|
||||
void R_AddFire (vec3_t start, vec3_t end, struct entity_s *ent);
|
||||
void R_DrawFire (fire_t *f);
|
||||
void R_UpdateFires (void);
|
||||
fire_t *R_AllocFire (int key);
|
||||
void R_ClearFires (void);
|
||||
|
||||
#endif // _R_DYNAMIC_H
|
||||
|
|
|
@ -47,100 +47,9 @@
|
|||
#include "QF/GL/qf_rlight.h"
|
||||
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "r_shared.h"
|
||||
|
||||
#define MAX_FIRES 128 // rocket flames
|
||||
|
||||
typedef struct {
|
||||
int key; // allows reusability
|
||||
vec3_t origin, owner;
|
||||
float size;
|
||||
float die, decay; // duration settings
|
||||
float minlight; // lighting threshold
|
||||
float color[3]; // RGB
|
||||
} fire_t;
|
||||
|
||||
static fire_t r_fires[MAX_FIRES];
|
||||
extern cvar_t *gl_fires;
|
||||
extern cvar_t *r_firecolor;
|
||||
|
||||
void R_AddFire (vec3_t, vec3_t, struct entity_s *ent);
|
||||
fire_t *R_AllocFire (int);
|
||||
void R_DrawFire (fire_t *);
|
||||
void R_UpdateFires (void);
|
||||
|
||||
/*
|
||||
R_AddFire
|
||||
|
||||
Nifty ball of fire GL effect. Kinda a meshing of the dlight and
|
||||
particle engine code.
|
||||
*/
|
||||
void
|
||||
R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
fire_t *f;
|
||||
vec3_t vec;
|
||||
int key;
|
||||
|
||||
if (!gl_fires->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
len = VectorNormalize (vec);
|
||||
key = ent->keynum;
|
||||
|
||||
if (len) {
|
||||
f = R_AllocFire (key);
|
||||
VectorCopy (end, f->origin);
|
||||
VectorCopy (start, f->owner);
|
||||
f->size = 10;
|
||||
f->die = r_realtime + 0.5;
|
||||
f->decay = 1;
|
||||
VectorCopy (r_firecolor->vec, f->color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_AllocFire
|
||||
|
||||
Clears out and returns a new fireball
|
||||
*/
|
||||
fire_t *
|
||||
R_AllocFire (int key)
|
||||
{
|
||||
int i;
|
||||
fire_t *f;
|
||||
|
||||
if (key) // first try to find/reuse a keyed
|
||||
// spot
|
||||
{
|
||||
f = r_fires;
|
||||
for (i = 0; i < MAX_FIRES; i++, f++)
|
||||
if (f->key == key) {
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = r_fires; // no match, look for a free spot
|
||||
for (i = 0; i < MAX_FIRES; i++, f++) {
|
||||
if (f->die < r_realtime) {
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = &r_fires[0];
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_DrawFire
|
||||
|
||||
|
|
|
@ -39,21 +39,20 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/render.h"
|
||||
#include "QF/sys.h"
|
||||
#include "varrays.h"
|
||||
#include "QF/vfs.h"
|
||||
#include "QF/GL/defines.h"
|
||||
#include "QF/GL/funcs.h"
|
||||
#include "r_cvar.h"
|
||||
#include "QF/GL/qf_fires.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "r_shared.h"
|
||||
#include "varrays.h"
|
||||
|
||||
static particle_t *particles, **freeparticles;
|
||||
static short r_numparticles, numparticles;
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#include "QF/GL/qf_vid.h"
|
||||
#include "QF/GL/qf_rsurf.h"
|
||||
#include "QF/GL/qf_rlight.h"
|
||||
#include "QF/GL/qf_fires.h"
|
||||
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
|
|
|
@ -85,6 +85,7 @@ cvar_t *r_drawflat;
|
|||
cvar_t *r_drawviewmodel;
|
||||
cvar_t *r_dspeeds;
|
||||
cvar_t *r_dynamic;
|
||||
cvar_t *r_firecolor;
|
||||
cvar_t *r_graphheight;
|
||||
cvar_t *r_maxedges;
|
||||
cvar_t *r_maxsurfs;
|
||||
|
@ -222,6 +223,8 @@ R_Init_Cvars (void)
|
|||
"Toggles the display of drawing speed information");
|
||||
r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, NULL,
|
||||
"Set to 0 to disable lightmap changes");
|
||||
r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, NULL,
|
||||
"color of rocket and lava ball fires");
|
||||
r_graphheight = Cvar_Get ("r_graphheight", "32", CVAR_NONE, NULL,
|
||||
"Set the number of lines displayed in the "
|
||||
"various graphs");
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/render.h"
|
||||
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "r_local.h"
|
||||
|
||||
qboolean r_inhibit_viewmodel;
|
||||
|
@ -26,6 +29,7 @@ int r_lineadj;
|
|||
qboolean r_active;
|
||||
float r_time1;
|
||||
|
||||
fire_t r_fires[MAX_FIRES];
|
||||
|
||||
dlight_t *
|
||||
R_AllocDlight (int key)
|
||||
|
@ -86,3 +90,80 @@ R_ClearDlights (void)
|
|||
{
|
||||
memset (r_dlights, 0, sizeof (r_dlights));
|
||||
}
|
||||
|
||||
void
|
||||
R_ClearFires (void)
|
||||
{
|
||||
memset (r_fires, 0, sizeof (r_fires));
|
||||
}
|
||||
|
||||
/*
|
||||
R_AddFire
|
||||
|
||||
Nifty ball of fire GL effect. Kinda a meshing of the dlight and
|
||||
particle engine code.
|
||||
*/
|
||||
void
|
||||
R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
fire_t *f;
|
||||
vec3_t vec;
|
||||
int key;
|
||||
|
||||
if (!gl_fires->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
len = VectorNormalize (vec);
|
||||
key = ent->keynum;
|
||||
|
||||
if (len) {
|
||||
f = R_AllocFire (key);
|
||||
VectorCopy (end, f->origin);
|
||||
VectorCopy (start, f->owner);
|
||||
f->size = 10;
|
||||
f->die = r_realtime + 0.5;
|
||||
f->decay = 1;
|
||||
VectorCopy (r_firecolor->vec, f->color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_AllocFire
|
||||
|
||||
Clears out and returns a new fireball
|
||||
*/
|
||||
fire_t *
|
||||
R_AllocFire (int key)
|
||||
{
|
||||
int i;
|
||||
fire_t *f;
|
||||
|
||||
if (key) // first try to find/reuse a keyed
|
||||
// spot
|
||||
{
|
||||
f = r_fires;
|
||||
for (i = 0; i < MAX_FIRES; i++, f++)
|
||||
if (f->key == key) {
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = r_fires; // no match, look for a free spot
|
||||
for (i = 0; i < MAX_FIRES; i++, f++) {
|
||||
if (f->die < r_realtime) {
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = &r_fires[0];
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#endif
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/input.h"
|
||||
|
@ -42,10 +41,12 @@
|
|||
#include "QF/skin.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "chase.h"
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
#include "host.h"
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "server.h"
|
||||
|
||||
|
@ -74,8 +75,6 @@ cvar_t *m_yaw;
|
|||
cvar_t *m_forward;
|
||||
cvar_t *m_side;
|
||||
|
||||
cvar_t *r_firecolor;
|
||||
|
||||
cvar_t *show_fps;
|
||||
cvar_t *show_time;
|
||||
|
||||
|
@ -152,8 +151,6 @@ CL_InitCvars (void)
|
|||
"mouse forward/back speed");
|
||||
m_side = Cvar_Get ("m_side", "0.8", CVAR_ARCHIVE, NULL,
|
||||
"mouse strafe speed");
|
||||
r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, NULL,
|
||||
"color of rocket and lava ball fires");
|
||||
show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE, NULL,
|
||||
"display realtime frames per second");
|
||||
show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL,
|
||||
|
@ -183,6 +180,7 @@ CL_ClearState (void)
|
|||
|
||||
R_ClearEfrags ();
|
||||
R_ClearDlights ();
|
||||
R_ClearFires ();
|
||||
|
||||
for (i = 0; i < MAX_EDICTS; i++) {
|
||||
cl_entities[i].baseline = &cl_baselines[i];
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "host.h"
|
||||
#include "msg_ucmd.h"
|
||||
#include "pmove.h"
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "view.h"
|
||||
|
||||
|
@ -60,8 +61,6 @@ extern cvar_t *cl_predict_players;
|
|||
extern cvar_t *cl_predict_players2;
|
||||
extern cvar_t *cl_solid_players;
|
||||
|
||||
cvar_t *r_firecolor;
|
||||
|
||||
static struct predicted_player {
|
||||
int flags;
|
||||
qboolean active;
|
||||
|
@ -1076,6 +1075,4 @@ CL_EmitEntities (void)
|
|||
void
|
||||
CL_Ents_Init (void)
|
||||
{
|
||||
r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, NULL,
|
||||
"color of rocket and lava ball fires");
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
#include "net.h"
|
||||
#include "pmove.h"
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "sbar.h"
|
||||
#include "view.h"
|
||||
|
||||
|
@ -426,6 +427,7 @@ CL_ClearState (void)
|
|||
|
||||
R_ClearEfrags ();
|
||||
R_ClearDlights ();
|
||||
R_ClearFires ();
|
||||
|
||||
// wipe the entire cl structure
|
||||
memset (&cl, 0, sizeof (cl));
|
||||
|
|
Loading…
Reference in a new issue