Some minor cleanups, and lots of particle effects tweaks.

Less blinding rocket trails is probably the most noticable change, other than a nice speedup in nq timedemos. Little change for overkill, though. Aw...
This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-09-04 10:32:51 +00:00
parent 83e3f10520
commit 65c526c057
14 changed files with 160 additions and 141 deletions

View file

@ -59,7 +59,7 @@ void R_TeleportSplash (vec3_t org);
void R_PushDlights (vec3_t entorigin);
void R_InitParticles (void);
void R_ClearParticles (void);
inline void R_ClearParticles (void); // DESPAIR
void R_DrawParticles (void);
#define MAX_FIRES 128 // rocket flames

View file

@ -46,7 +46,7 @@
typedef struct
{
int destcolor[3];
int percent; // 0-256
int percent; // 0-255
} cshift_t;
#define CSHIFT_CONTENTS 0
@ -269,7 +269,7 @@ qboolean R_AliasCheckBBox (void);
void R_DrawParticles (void);
void R_InitParticles (void);
void R_ClearParticles (void);
inline void R_ClearParticles (void);
void R_ReadPointFile_f (void);
void R_SurfacePatch (void);

View file

@ -84,8 +84,6 @@ typedef struct {
int texnum;
} glpic_t;
extern int gl_filter_min, gl_filter_max;
typedef struct cachepic_s {
char name[MAX_QPATH];
qboolean dirty;
@ -95,12 +93,12 @@ typedef struct cachepic_s {
#define MAX_CACHED_PICS 128
static cachepic_t cachepics[MAX_CACHED_PICS];
static int numcachepics;
static int numcachepics;
static byte menuplyr_pixels[4096];
extern byte *vid_basepal;
static byte menuplyr_pixels[4096];
extern byte *vid_basepal;
extern int gl_filter_max, gl_filter_min;
extern cvar_t *crosshair, *cl_crossx, *cl_crossy, *crosshaircolor,
*r_lightmap_components;

View file

@ -42,14 +42,30 @@
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/render.h"
#include "QF/GL/funcs.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_rlight.h"
#include "r_cvar.h"
#include "r_dynamic.h"
#include "r_shared.h"
extern float v_blend[4];
void
AddLightBlend (float r, float g, float b, float a2)
{
float a;
v_blend[3] = a = v_blend[3] + a2 * (1 - v_blend[3]);
a2 = a2 / a;
v_blend[0] = v_blend[0] * (1 - a2) + r * a2;
v_blend[1] = v_blend[1] * (1 - a2) + g * a2;
v_blend[2] = v_blend[2] * (1 - a2) + b * a2;
}
/*
R_DrawFire

View file

@ -50,22 +50,6 @@
float bubble_sintable[33], bubble_costable[33];
extern float v_blend[4];
void
AddLightBlend (float r, float g, float b, float a2)
{
float a;
v_blend[3] = a = v_blend[3] + a2 * (1 - v_blend[3]);
a2 = a2 / a;
v_blend[0] = v_blend[0] * (1 - a2) + r * a2;
v_blend[1] = v_blend[1] * (1 - a2) + g * a2;
v_blend[2] = v_blend[2] * (1 - a2) + b * a2;
}
void
R_InitBubble ()

View file

@ -89,8 +89,8 @@ particle_new (ptype_t type, int texnum, vec3_t org, float scale, vec3_t vel,
part->tex = texnum;
part->scale = scale;
VectorScale (up, 1.5, part->up);
VectorScale (right, 1.5, part->right);
// VectorScale (up, 1.5, part->up);
// VectorScale (right, 1.5, part->right);
return part;
}
@ -163,7 +163,7 @@ R_Particles_Init_Cvars (void)
"is 0, although it's best to use r_particles 0 instead.");
}
void
inline void
R_ClearParticles (void)
{
numparticles = 0;
@ -221,6 +221,7 @@ R_ParticleExplosion (vec3_t org)
{
if (!r_particles->int_val)
return;
particle_new_random (pt_smokecloud, part_tex_smoke[rand () & 7], org, 4,
30, 8, r_realtime + 5, (rand () & 7) + 8,
128 + (rand () & 63));
@ -266,9 +267,6 @@ R_BlobExplosion (vec3_t org)
static void
R_RunSparkEffect (vec3_t org, int count, int ofuzz)
{
if (!r_particles->int_val)
return;
particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org,
(ofuzz / 8) * .75, vec3_origin, r_realtime + 99,
12 + (rand () & 3), 96, vec3_origin, vec3_origin);
@ -278,29 +276,23 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz)
ramp[rand () % 6], lhrandom (0, 255));
}
static void
inline static void
R_RunGunshotEffect (vec3_t org, int count)
{
int scale;
if (!r_particles->int_val)
return;
if (count > 6)
scale = 3;
scale = 24;
else
scale = 2;
scale = 16;
R_RunSparkEffect (org, count * 10, 8 * scale);
R_RunSparkEffect (org, count * 10, scale);
return;
}
static void
inline static void
R_BloodPuff (vec3_t org, int count)
{
if (!r_particles->int_val)
return;
particle_new (pt_bloodcloud, part_tex_smoke[rand () & 7], org, 9,
vec3_origin, r_realtime + 99, 68 + (rand () & 3), 128,
vec3_origin, vec3_origin);
@ -357,6 +349,9 @@ R_RunParticleEffect (vec3_t org, int color, int count)
void
R_RunSpikeEffect (vec3_t org, particle_effect_t type)
{
if (!r_particles->int_val)
return;
switch (type) {
case PE_SPIKE:
R_RunSparkEffect (org, 5, 8);
@ -441,7 +436,7 @@ void
R_RocketTrail (int type, entity_t *ent)
{
byte palpha, pcolor;
float dist, len, pdie, pscale;
float dist, len, pdie, pscale, pscalenext;
int ptex, j;
ptype_t ptype;
vec3_t porg, pvel, up, right, subtract, vec;
@ -454,35 +449,69 @@ R_RocketTrail (int type, entity_t *ent)
VectorSubtract (ent->origin, ent->old_origin, vec);
len = VectorNormalize (vec);
pdie = r_realtime + 2;
ptex = part_tex_dot;
ptype = pt_static;
palpha = 255;
pcolor = 0;
pscale = pscalenext = 3;
dist = 3;
switch (type) {
case 0: // rocket trail
pdie = r_realtime + 0.4;
pscale = lhrandom (1, 2);
ptype = pt_smoke;
break;
case 1: // grenade trail
pscale = lhrandom (4, 9);
ptype = pt_smoke;
break;
case 2: // blood
pscale = lhrandom (4, 10);
ptype = pt_grav;
break;
case 4: // slight blood
palpha = 192;
pdie = r_realtime + 1.3;
pscale = lhrandom (1, 6);
ptype = pt_grav;
break;
case 3: // green tracer
pdie = r_realtime + 0.5;
ptype = pt_fire;
break;
case 5: // flame tracer
pdie = r_realtime + 0.5;
ptype = pt_fire;
break;
case 6: // voor trail
pdie = r_realtime + 0.3;
ptex = part_tex_dot;
ptype = pt_static;
break;
}
while (len > 0) {
VectorCopy (vec3_origin, up);
VectorCopy (vec3_origin, right);
VectorCopy (vec3_origin, pvel);
pdie = r_realtime + 2;
ptype = pt_static;
ptex = part_tex_dot;
palpha = 255;
pcolor = 0;
pscale = 6;
dist = 40;
switch (type) {
case 0: // rocket trail
pdie = r_realtime + 60;
// ptype = pt_smokering; // Mercury's Rings
ptype = pt_smoke;
pscale = lhrandom (6, 8);
pscalenext = lhrandom (1, 2);
dist = (pscale + pscalenext) * 4;
// pcolor = (rand () & 255); // Misty-chan's Easter Egg
pcolor = (rand () & 3) + 12;
palpha = 128 + (rand () & 31);
// VectorVectors(vec, right, up); // Mercury's Rings
VectorCopy (ent->old_origin, porg);
// ptype = pt_smokering; // Mercury's Rings
// ptex = part_tex_smoke_ring[rand () & 7]; // Mercury's Rings
ptex = part_tex_smoke[rand () & 7];
break;
case 1: // grenade trail
ptype = pt_smoke;
pscale = lhrandom (7, 10);
pscalenext = lhrandom (4, 9);
dist = (pscale + pscalenext) * 4;
// pcolor = (rand () & 255); // Misty-chan's Easter Egg
pcolor = (rand () & 3);
palpha = 128 + (rand () & 31);
@ -490,25 +519,30 @@ R_RocketTrail (int type, entity_t *ent)
ptex = part_tex_smoke[rand () & 7];
break;
case 2: // blood
pscale = 5;
case 4: // slight blood
pscale += lhrandom (1, 4);
pscalenext = lhrandom (4, 10);
dist = (pscale + pscalenext) * 4;
ptex = part_tex_smoke[rand () & 7];
pcolor = 68 + (rand () & 3);
for (j = 0; j < 3; j++) {
pvel[j] = lhrandom (-3, 3) * type;
porg[j] = ent->old_origin[j] + lhrandom (-1.5, 1.5);
}
break;
case 4: // slight blood
pscalenext = lhrandom (1, 6);
dist = (pscale + pscalenext) * 4;
ptex = part_tex_smoke[rand () & 7];
pcolor = 68 + (rand () & 3);
for (j = 0; j < 3; j++) {
pvel[j] = lhrandom (-3, 3) * type;
porg[j] = ent->old_origin[j] + lhrandom (-1.5, 1.5);
}
ptype = pt_grav;
break;
case 3: // green tracer
case 5: // flame tracer
{
static int tracercount;
dist = 3;
pdie = r_realtime + 0.5;
ptype = pt_fire;
ptex = part_tex_smoke[rand () & 7];
pscale = lhrandom (1, 2);
if (type == 3)
@ -526,17 +560,14 @@ R_RocketTrail (int type, entity_t *ent)
pvel[0] = 30 * -vec[1];
pvel[1] = 30 * vec[0];
}
break;
}
break;
case 6: // voor trail
dist = 3;
pcolor = 9 * 16 + 8 + (rand () & 3);
ptype = pt_static;
pscale = lhrandom (.75, 1.5);
pdie = r_realtime + 0.3;
for (j = 0; j < 3; j++)
porg[j] = ent->old_origin[j] + lhrandom (-8, 8);
break;
}
}
VectorScale (vec, min(dist, len), subtract);
@ -545,6 +576,7 @@ R_RocketTrail (int type, entity_t *ent)
particle_new (ptype, ptex, porg, pscale, pvel, pdie, pcolor, palpha,
up, right);
pscale = pscalenext;
}
}
@ -651,13 +683,13 @@ R_DrawParticles (void)
part->vel[2] -= grav;
break;
case pt_smoke:
if ((part->alpha -= r_frametime * 90) < 1)
if ((part->alpha -= r_frametime * 96) < 1)
part->die = -1;
part->scale += r_frametime * 6;
part->scale += r_frametime * 4;
// part->org[2] += r_frametime * 30 - grav;
break;
case pt_smokering:
if ((part->alpha -= r_frametime * 130) < 1)
if ((part->alpha -= r_frametime * 128) < 1)
part->die = -1;
part->scale += r_frametime * 10;
// part->org[2] += r_frametime * 30 - grav;

View file

@ -34,8 +34,8 @@
#include "QF/qtypes.h"
#include "QF/GL/defines.h"
#include "QF/GL/qf_vid.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_vid.h"
extern void noise_diamondsquare(unsigned char *noise, int size);
extern void noise_plasma(unsigned char *noise, int size);

View file

@ -57,7 +57,6 @@ static int graph_size[NUM_GRAPH_TEXTURES];
static int graph_width[NUM_GRAPH_TEXTURES];
extern byte *draw_chars; // 8*8 graphic characters
extern cvar_t *r_netgraph;
extern cvar_t *r_netgraph_alpha;
extern cvar_t *r_netgraph_box;

View file

@ -121,7 +121,7 @@ glrmain_init (void)
// LordHavoc: place for gl_rmain setup code
}
void
inline void
R_RotateForEntity (entity_t *e)
{
qfglTranslatef (e->origin[0], e->origin[1], e->origin[2]);
@ -247,7 +247,6 @@ float *shadedots = r_avertexnormal_dots[0];
int lastposenum, lastposenum0;
vec3_t shadevector;
static void
GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
{
@ -371,7 +370,8 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
Interpolated shadow drawing
*/
void
GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t *e)
GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2,
entity_t *e)
{
float blend, height, lheight, lerp;
int count;
@ -807,7 +807,7 @@ R_DrawViewModel (void)
qfglColor3ubv (color_white);
}
static int
inline static int
SignbitsForPlane (mplane_t *out)
{
int bits, j;

View file

@ -44,14 +44,14 @@
#include "QF/render.h"
#include "QF/skin.h"
#include "QF/sys.h"
#include "QF/vid.h"
#include "QF/vfs.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_vid.h"
#include "QF/vid.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_rmain.h"
#include "QF/GL/qf_rsurf.h"
#include "QF/GL/qf_screen.h"
#include "QF/GL/qf_vid.h"
#include "r_dynamic.h"
#include "r_local.h"
@ -66,7 +66,7 @@ extern cvar_t *gl_lerp_anim;
extern cvar_t *r_netgraph;
extern void GDT_Init ();
extern int R_InitGraphTextures (int base);
extern int R_InitGraphTextures (int base);
/*

View file

@ -44,15 +44,15 @@
#include "QF/vid.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_rlight.h"
#include "QF/GL/qf_sky.h"
#include "QF/GL/qf_textures.h"
#include "QF/GL/qf_rlight.h"
#include "QF/GL/qf_vid.h"
#include "compat.h"
#include "r_cvar.h"
#include "r_shared.h"
#include "view.h"
#include "r_cvar.h"
char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
int solidskytexture;
@ -103,15 +103,15 @@ R_LoadSkys (const char *skyname)
Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
}
void
inline void
R_SkyBoxPolyVec (vec5_t v)
{
// avoid interpolation seams
// s = s * (254.0/256.0) + (1.0/256.0);
// t = t * (254.0/256.0) + (1.0/256.0);
qfglTexCoord2fv (v);
qfglVertex3f (r_refdef.vieworg[0] + v[2],
r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]);
qfglVertex3f (r_refdef.vieworg[0] + v[2], r_refdef.vieworg[1] + v[3],
r_refdef.vieworg[2] + v[4]);
}
#define ftc(x) (x * (254.0/256.0) + (1.0/256.0))
@ -261,7 +261,7 @@ R_DrawSkyDome (void)
qfglDepthRange (gldepthmin, gldepthmax);
}
void
inline void
R_DrawSky (void)
{
if (skyloaded)

View file

@ -201,7 +201,7 @@ R_Init_Cvars (void)
"Detail of player skins. 0 best, 4 worst.");
gl_reporttjunctions = Cvar_Get ("gl_reporttjunctions", "0", CVAR_NONE,
NULL, "None");
gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_ARCHIVE, NULL,
gl_sky_clip = Cvar_Get ("gl_sky_clip", "2", CVAR_ARCHIVE, NULL,
"controls amount of sky overdraw");
gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, NULL,
"subdivide sky polys");

View file

@ -288,9 +288,7 @@ R_PushDlights (vec3_t entorigin)
}
}
/*
LIGHT SAMPLING
*/
/* LIGHT SAMPLING */
mplane_t *lightplane;
vec3_t lightspot;

View file

@ -35,8 +35,8 @@
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/vfs.h"
#include "QF/render.h"
#include "QF/vfs.h"
#include "compat.h"
#include "r_cvar.h"
@ -47,13 +47,11 @@ int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
int ramp3[8] = { 0x6d, 0x6b, 6, 5, 4, 3 };
particle_t *active_particles, *free_particles;
particle_t *particles;
int r_numparticles;
particle_t *active_particles, *free_particles, *particles;
vec3_t r_pright, r_pup, r_ppn;
/*
R_MaxParticlesCheck
@ -80,16 +78,15 @@ R_MaxParticlesCheck (cvar_t *var)
R_ClearParticles ();
}
void
R_Particles_Init_Cvars (void)
{
// Does a callback to R_MaxParticleCheck when the cvar changes. Neat trick.
Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck,
"Maximum amount of particles to display. No maximum, minimum is 1.");
"Maximum amount of particles to display. No maximum, minimum "
"is 1.");
}
void
R_ClearParticles (void)
{
@ -103,7 +100,6 @@ R_ClearParticles (void)
particles[r_numparticles - 1].next = NULL;
}
void
R_ReadPointFile_f (void)
{
@ -153,7 +149,6 @@ R_ReadPointFile_f (void)
Con_Printf ("%i points read\n", c);
}
void
R_RunSpikeEffect (vec3_t pos, particle_effect_t type)
{
@ -175,7 +170,6 @@ R_RunSpikeEffect (vec3_t pos, particle_effect_t type)
}
}
void
R_RunPuffEffect (vec3_t pos, particle_effect_t type, byte cnt)
{
@ -197,7 +191,6 @@ R_RunPuffEffect (vec3_t pos, particle_effect_t type, byte cnt)
}
}
void
R_ParticleExplosion (vec3_t org)
{
@ -234,7 +227,6 @@ R_ParticleExplosion (vec3_t org)
}
}
void
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
{
@ -264,7 +256,6 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
}
}
void
R_BlobExplosion (vec3_t org)
{
@ -302,7 +293,6 @@ R_BlobExplosion (vec3_t org)
}
}
void
R_RunParticleEffect (vec3_t org, int color, int count)
{
@ -338,7 +328,6 @@ R_RunParticleEffect (vec3_t org, int color, int count)
}
}
void
R_LavaSplash (vec3_t org)
{
@ -378,7 +367,6 @@ R_LavaSplash (vec3_t org)
}
}
void
R_TeleportSplash (vec3_t org)
{
@ -418,7 +406,6 @@ R_TeleportSplash (vec3_t org)
}
}
void
R_RocketTrail (int type, entity_t *ent)
{
@ -445,36 +432,38 @@ R_RocketTrail (int type, entity_t *ent)
VectorCopy (vec3_origin, p->vel);
p->die = r_realtime + 2;
if (type == 4) { // slight blood
p->type = pt_slowgrav;
p->color = 67 + (rand () & 3);
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
len -= 3;
} else if (type == 2) { // blood
p->type = pt_slowgrav;
p->color = 67 + (rand () & 3);
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
} else if (type == 6) { // voor trail
p->color = 9 * 16 + 8 + (rand () & 3);
p->type = pt_static;
p->die = r_realtime + 0.3;
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8);
} else if (type == 1) { // smoke smoke
p->ramp = (rand () & 3) + 2;
p->color = ramp3[(int) p->ramp];
p->type = pt_fire;
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
} else if (type == 0) { // rocket trail
// originally an if/else, ordered 4, 2, 6, 1, 0, 3|5
switch (type) {
case 0: // rocket trail
p->ramp = (rand () & 3);
p->color = ramp3[(int) p->ramp];
p->type = pt_fire;
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
} else if (type == 3 || type == 5) { // tracer
break;
case 1: // smoke smoke
p->ramp = (rand () & 3) + 2;
p->color = ramp3[(int) p->ramp];
p->type = pt_fire;
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
break;
case 4: // slight blood
p->type = pt_slowgrav;
p->color = 67 + (rand () & 3);
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
len -= 3;
break;
case 2: // blood
p->type = pt_slowgrav;
p->color = 67 + (rand () & 3);
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
break;
case 3: // green tracer
case 5: // flame tracer
{
static int tracercount;
p->die = r_realtime + 0.5;
@ -494,7 +483,15 @@ R_RocketTrail (int type, entity_t *ent)
p->vel[0] = 30 * -vec[1];
p->vel[1] = 30 * vec[0];
}
}
break;
case 6: // voor trail
p->color = 9 * 16 + 8 + (rand () & 3);
p->type = pt_static;
p->die = r_realtime + 0.3;
for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8);
break;
}
VectorAdd (ent->old_origin, vec, ent->old_origin);
@ -553,7 +550,6 @@ R_DrawParticles (void)
p->color = ramp3[(int) p->ramp];
p->vel[2] += grav;
break;
case pt_explode:
p->ramp += time2;
if (p->ramp >= 8)
@ -564,7 +560,6 @@ R_DrawParticles (void)
p->vel[i] += p->vel[i] * dvel;
p->vel[2] -= grav;
break;
case pt_explode2:
p->ramp += time3;
if (p->ramp >= 8)
@ -575,19 +570,16 @@ R_DrawParticles (void)
p->vel[i] -= p->vel[i] * frametime;
p->vel[2] -= grav;
break;
case pt_blob:
for (i = 0; i < 3; i++)
p->vel[i] += p->vel[i] * dvel;
p->vel[2] -= grav;
break;
case pt_blob2:
for (i = 0; i < 2; i++)
p->vel[i] -= p->vel[i] * dvel;
p->vel[2] -= grav;
break;
case pt_slowgrav:
case pt_grav:
p->vel[2] -= grav;