total merge of the particle system (except r_part.c isn't in qw yet)

This commit is contained in:
Bill Currie 2001-05-18 19:58:49 +00:00
parent 6ee0692e58
commit 664c640e42
8 changed files with 46 additions and 65 deletions

View file

@ -319,6 +319,7 @@ void CL_InitInput (void);
void CL_SendCmd (void);
void CL_SendMove (usercmd_t *cmd);
void CL_ParseParticleEffect (void);
void CL_ParseTEnt (void);
void CL_UpdateTEnts (void);

View file

@ -139,7 +139,6 @@ void R_RemoveEfrags (entity_t *ent);
void R_NewMap (void);
void R_ParseParticleEffect (void);
struct entity_s;
void R_RocketTrail (int type, struct entity_s *ent);
void R_RunParticleEffect (vec3_t org, int color, int count);

View file

@ -790,7 +790,7 @@ CL_ParseServerMessage (void)
break;
case svc_particle:
R_ParseParticleEffect ();
CL_ParseParticleEffect ();
break;
case svc_spawnbaseline:

View file

@ -524,3 +524,30 @@ CL_UpdateTEnts (void)
CL_UpdateBeams ();
CL_UpdateExplosions ();
}
/*
CL_ParseParticleEffect
Parse an effect out of the server message
*/
void
CL_ParseParticleEffect (void)
{
vec3_t org, dir;
int i, count, msgcount, color;
for (i = 0; i < 3; i++)
org[i] = MSG_ReadCoord (net_message);
for (i = 0; i < 3; i++)
dir[i] = MSG_ReadChar (net_message) * (1.0 / 16);
msgcount = MSG_ReadByte (net_message);
color = MSG_ReadByte (net_message);
if (msgcount == 255)
count = 1024;
else
count = msgcount;
R_RunParticleEffect (org, color, count);
}

View file

@ -299,7 +299,6 @@ R_RunGunshotEffect (vec3_t org, int count)
}
/*
static void
R_BloodPuff (vec3_t org, int count)
{
@ -310,7 +309,6 @@ R_BloodPuff (vec3_t org, int count)
vec3_origin, cl.time + 99, 68 + (rand () & 3), 128,
vec3_origin, vec3_origin);
}
*/
void
@ -323,6 +321,12 @@ R_RunPuffEffect (vec3_t org, byte type, byte count)
case TE_GUNSHOT:
R_RunGunshotEffect (org, count);
break;
case TE_BLOOD:
R_BloodPuff (org, count);
break;
case TE_LIGHTNINGBLOOD:
R_BloodPuff (org, 5 + (rand () & 1));
break;
}
}
@ -448,12 +452,12 @@ R_RocketTrail (int type, entity_t *ent)
byte palpha, pcolor;
if (type == 0)
R_AddFire (ent->msg_origins[1], ent->origin, ent);
R_AddFire (ent->old_origin, ent->origin, ent);
if (!r_particles->int_val)
return;
VectorSubtract (ent->origin, ent->msg_origins[1], vec);
VectorSubtract (ent->origin, ent->old_origin, vec);
len = VectorNormalize (vec);
while (len > 0) {
VectorCopy (vec3_origin, up);
@ -477,7 +481,7 @@ R_RocketTrail (int type, entity_t *ent)
pcolor = (rand () & 3) + 12;
palpha = 128 + (rand () & 31);
// VectorVectors(vec, right, up); // Mercury's Rings
VectorCopy (ent->msg_origins[1], porg);
VectorCopy (ent->old_origin, porg);
// ptex = part_tex_smoke_ring[rand () & 7]; // Mercury's Rings
ptex = part_tex_smoke[rand () & 7];
break;
@ -487,7 +491,7 @@ R_RocketTrail (int type, entity_t *ent)
// pcolor = (rand () & 255); // Misty-chan's Easter Egg
pcolor = (rand () & 3);
palpha = 128 + (rand () & 31);
VectorCopy (ent->msg_origins[1], porg);
VectorCopy (ent->old_origin, porg);
ptex = part_tex_smoke[rand () & 7];
break;
case 2: // blood
@ -498,7 +502,7 @@ R_RocketTrail (int type, entity_t *ent)
pcolor = 68 + (rand () & 3);
for (j = 0; j < 3; j++) {
pvel[j] = lhrandom (-3, 3) * type;
porg[j] = ent->msg_origins[1][j] + lhrandom (-1.5, 1.5);
porg[j] = ent->old_origin[j] + lhrandom (-1.5, 1.5);
}
ptype = pt_grav;
break;
@ -510,7 +514,7 @@ R_RocketTrail (int type, entity_t *ent)
pscale = lhrandom (.75, 1.5);
pdie = cl.time + 0.3;
for (j = 0; j < 3; j++)
porg[j] = ent->msg_origins[1][j] + lhrandom (-8, 8);
porg[j] = ent->old_origin[j] + lhrandom (-8, 8);
break;
case 3:
case 5: // tracer
@ -528,7 +532,7 @@ R_RocketTrail (int type, entity_t *ent)
tracercount++;
VectorCopy (ent->msg_origins[1], porg);
VectorCopy (ent->old_origin, porg);
if (tracercount & 1) {
pvel[0] = 30 * vec[1];
pvel[1] = 30 * -vec[0];
@ -541,7 +545,7 @@ R_RocketTrail (int type, entity_t *ent)
}
VectorScale (vec, min(dist, len), subtract);
VectorAdd (ent->msg_origins[1], subtract, ent->msg_origins[1]);
VectorAdd (ent->old_origin, subtract, ent->old_origin);
len -= dist;
particle_new (ptype, ptex, porg, pscale, pvel, pdie, pcolor, palpha,

View file

@ -34,10 +34,10 @@
#include "QF/qargs.h"
#include "QF/compat.h"
#include "QF/console.h"
#include "QF/msg.h"
#include "client.h"
#include "r_local.h"
#include "server.h"
#include "render.h"
#define MAX_PARTICLES 2048 // default max # of particles at one
// time
@ -53,26 +53,6 @@ int r_numparticles;
vec3_t r_pright, r_pup, r_ppn;
void
R_InitParticles (void)
{
int i;
i = COM_CheckParm ("-particles");
if (i) {
r_numparticles = (int) (atoi (com_argv[i + 1]));
if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
r_numparticles = ABSOLUTE_MIN_PARTICLES;
} else {
r_numparticles = MAX_PARTICLES;
}
particles = (particle_t *)
Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles");
}
#ifdef QUAKE2
void
R_DarkFieldParticles (entity_t *ent)
@ -181,32 +161,3 @@ R_EntityParticles (entity_t *ent)
forward[2] * beamlength;
}
}
/*
===============
R_ParseParticleEffect
Parse an effect out of the server message
===============
*/
void
R_ParseParticleEffect (void)
{
vec3_t org, dir;
int i, count, msgcount, color;
for (i = 0; i < 3; i++)
org[i] = MSG_ReadCoord (net_message);
for (i = 0; i < 3; i++)
dir[i] = MSG_ReadChar (net_message) * (1.0 / 16);
msgcount = MSG_ReadByte (net_message);
color = MSG_ReadByte (net_message);
if (msgcount == 255)
count = 1024;
else
count = msgcount;
R_RunParticleEffect (org, color, count);
}

View file

@ -173,8 +173,6 @@ R_Init (void)
r_refdef.xOrigin = XCENTERING;
r_refdef.yOrigin = YCENTERING;
R_InitParticles ();
// TODO: collect 386-specific code in one place
#ifdef USE_INTEL_ASM
Sys_MakeCodeWriteable ((long) R_EdgeCodeStart,

View file

@ -66,6 +66,7 @@ D_DrawParticle (particle_t *pparticle)
if (transformed[2] < PARTICLE_Z_CLIP)
return;
// project the point
// FIXME: preadjust xcenter and ycenter
zi = 1.0 / transformed[2];