Major particle interface cleanup, several bugfixes, and minor performance improvements. Oh, check out "/help easter_eggs" (gl-only, at the moment).

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-12-11 22:37:30 +00:00
parent 8a47406dcd
commit f66b7a93e5
19 changed files with 631 additions and 415 deletions

View file

@ -59,6 +59,7 @@ const char *MSG_ReadString (msg_t *msg);
const char *MSG_ReadStringLine (msg_t *msg);
float MSG_ReadCoord (msg_t *msg);
void MSG_ReadCoord3 (msg_t *msg, vec3_t coord);
float MSG_ReadAngle (msg_t *msg);
float MSG_ReadAngle16 (msg_t *msg);

View file

@ -1,3 +1,6 @@
extern struct cvar_s *easter_eggs;
extern void r_easter_eggs_f (cvar_t *var);
extern struct cvar_s *cl_crossx;
extern struct cvar_s *cl_crossy;
extern struct cvar_s *cl_verstring;

View file

@ -42,26 +42,36 @@ typedef enum {
PE_WIZSPIKE,
} particle_effect_t;
void R_ParseParticleEffect (void);
struct entity_s;
void R_RocketTrail (struct entity_s *ent);
void R_GrenadeTrail (struct entity_s *ent);
void R_BloodTrail (struct entity_s *ent);
void R_SlightBloodTrail (struct entity_s *ent);
void R_GreenTrail (struct entity_s *ent);
void R_FlameTrail (struct entity_s *ent);
void R_VoorTrail (struct entity_s *ent);
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
void R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count);
void R_RunSpikeEffect (vec3_t org, particle_effect_t type);
extern void (*R_RocketTrail) (struct entity_s *ent);
extern void (*R_GrenadeTrail) (struct entity_s *ent);
extern void (*R_BloodTrail) (struct entity_s *ent);
extern void (*R_SlightBloodTrail) (struct entity_s *ent);
extern void (*R_WizTrail) (struct entity_s *ent);
extern void (*R_FlameTrail) (struct entity_s *ent);
extern void (*R_VoorTrail) (struct entity_s *ent);
extern void (*R_RunParticleEffect) (vec3_t org, vec3_t dir, int color,
int count);
extern void (*R_BloodPuffEffect) (vec3_t org, int count);
extern void (*R_GunshotEffect) (vec3_t org, int count);
extern void (*R_LightningBloodEffect) (vec3_t org);
extern void (*R_SpikeEffect) (vec3_t org);
extern void (*R_KnightSpikeEffect) (vec3_t org);
extern void (*R_SuperSpikeEffect) (vec3_t org);
extern void (*R_WizSpikeEffect) (vec3_t org);
extern void (*R_BlobExplosion) (vec3_t org);
extern void (*R_ParticleExplosion) (vec3_t org);
extern void (*R_ParticleExplosion2) (vec3_t org, int colorStart,
int colorLength);
extern void (*R_LavaSplash) (vec3_t org);
extern void (*R_TeleportSplash) (vec3_t org);
void R_DarkFieldParticles (struct entity_s *ent);
void R_EntityParticles (struct entity_s *ent);
void R_BlobExplosion (vec3_t org);
void R_ParticleExplosion (vec3_t org);
void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
void R_LavaSplash (vec3_t org);
void R_TeleportSplash (vec3_t org);
void R_PushDlights (vec3_t entorigin);
struct cvar_s;
void R_MaxDlightsCheck (struct cvar_s *var);

View file

@ -118,7 +118,7 @@ MSG_WriteString (sizebuf_t *sb, const char *s)
void
MSG_WriteCoord (sizebuf_t *sb, float f)
{
MSG_WriteShort (sb, (unsigned int) (f * 8));
MSG_WriteShort (sb, (unsigned int) (f * 8.0));
}
void
@ -184,7 +184,6 @@ MSG_ReadShort (msg_t *msg)
msg->readcount = msg->message->cursize;
msg->badread = true;
return -1;
}
int
@ -269,17 +268,25 @@ MSG_ReadString (msg_t *msg)
float
MSG_ReadCoord (msg_t *msg)
{
return MSG_ReadShort (msg) * (1.0 / 8);
return MSG_ReadShort (msg) * (1.0 / 8.0);
}
void
MSG_ReadCoord3 (msg_t *msg, vec3_t coord)
{
coord[0] = MSG_ReadShort (msg) * (1.0 / 8.0);
coord[1] = MSG_ReadShort (msg) * (1.0 / 8.0);
coord[2] = MSG_ReadShort (msg) * (1.0 / 8.0);
}
float
MSG_ReadAngle (msg_t *msg)
{
return MSG_ReadChar (msg) * (360.0 / 256);
return MSG_ReadChar (msg) * (360.0 / 256.0);
}
float
MSG_ReadAngle16 (msg_t *msg)
{
return MSG_ReadShort (msg) * (360.0 / 65536);
return MSG_ReadShort (msg) * (360.0 / 65536.0);
}

View file

@ -102,11 +102,6 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
particle_new (type, texnum, porg, scale, pvel, die, color, alpha);
}
void
R_Particles_Init_Cvars (void)
{
}
inline void
R_ClearParticles (void)
{
@ -162,21 +157,20 @@ R_ReadPointFile_f (void)
}
void
R_ParticleExplosion (vec3_t org)
R_ParticleExplosion_QF (vec3_t org)
{
if (numparticles >= r_maxparticles)
return;
/*
R_NewExplosion (org);
*/
if (numparticles >= r_maxparticles)
return;
particle_new_random (pt_smokecloud, part_tex_smoke, org, 4, 30, 8,
r_realtime + 5.0,
(rand () & 7) + 8,
r_realtime + 5.0, (rand () & 7) + 8,
128 + (rand () & 63));
}
void
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength)
{
int i;
int colorMod = 0, j = 512;
@ -187,16 +181,15 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
j = r_maxparticles - numparticles;
for (i = 0; i < j; i++) {
particle_new_random (pt_blob, part_tex_dot, org, 16, 2, 256,
r_realtime + 0.3,
colorStart + (colorMod % colorLength),
255);
particle_new_random (pt_blob, part_tex_dot, org, 16, 2, 256,
r_realtime + 0.3,
colorStart + (colorMod % colorLength), 255);
colorMod++;
}
}
void
R_BlobExplosion (vec3_t org)
R_BlobExplosion_QF (vec3_t org)
{
int i;
int j = 1024;
@ -218,28 +211,25 @@ R_BlobExplosion (vec3_t org)
}
}
static void
R_RunSparkEffect (vec3_t org, int count, int ofuzz)
static inline void
R_RunSparkEffect_QF (vec3_t org, int count, int ofuzz)
{
int j = count + 1;
if (numparticles >= r_maxparticles)
return;
else if (numparticles + j >= r_maxparticles)
j = r_maxparticles - numparticles;
count = j - 1;
particle_new (pt_smokecloud, part_tex_smoke, org,
ofuzz * 0.08, vec3_origin, r_realtime + 9,
12 + (rand () & 3), 64 + (rand () & 31));
if (numparticles + count >= r_maxparticles)
count = r_maxparticles - numparticles;
while (count--)
particle_new_random (pt_fallfadespark, part_tex_dot, org,
ofuzz * 0.75, 0.7, 96, r_realtime + 5,
ramp[rand () & 7], 255);
}
inline static void
R_BloodPuff (vec3_t org, int count)
static inline void
R_BloodPuff_QF (vec3_t org, int count)
{
if (numparticles >= r_maxparticles)
return;
@ -249,54 +239,47 @@ R_BloodPuff (vec3_t org, int count)
}
void
R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count)
R_BloodPuffEffect_QF (vec3_t org, int count)
{
// FIXME: Is this test worthwhile?
if (numparticles >= r_maxparticles)
return;
switch (type) {
case PE_GUNSHOT:
{
int scale = 16;
if (count > 120)
scale = 24;
R_RunSparkEffect (org, count / 2, scale);
}
break;
case PE_BLOOD:
R_BloodPuff (org, count);
break;
case PE_LIGHTNINGBLOOD:
R_BloodPuff (org, 50);
if (numparticles >= r_maxparticles)
break;
particle_new (pt_smokecloud, part_tex_smoke, org,
3, vec3_origin, r_realtime + 9,
12 + (rand () & 3), 64 + (rand () & 31));
count = 7;
if (numparticles + count >= r_maxparticles)
count = r_maxparticles - numparticles;
while (count--)
particle_new_random (pt_fallfadespark, part_tex_spark, org,
12, 2, 128, r_realtime + 5,
244 + (rand () % 3), 255);
break;
default:
break;
}
R_BloodPuff_QF (org, count);
}
void
R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
R_GunshotEffect_QF (vec3_t org, int count)
{
int scale = 16;
if (count > 120)
scale = 24;
R_RunSparkEffect_QF (org, count >> 1, scale);
}
void
R_LightningBloodEffect_QF (vec3_t org)
{
int count = 7;
R_BloodPuff_QF (org, 50);
if (numparticles >= r_maxparticles)
return;
particle_new (pt_smokecloud, part_tex_smoke, org, 3, vec3_origin,
r_realtime + 9, 12 + (rand () & 3), 64 + (rand () & 31));
if (numparticles + count >= r_maxparticles)
count = r_maxparticles - numparticles;
while (count--)
particle_new_random (pt_fallfadespark, part_tex_spark, org, 12, 2,
128, r_realtime + 5, 244 + (rand () % 3), 255);
}
void
R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count)
{
int i, j;
if (numparticles >= r_maxparticles)
return;
if (numparticles + count >= r_maxparticles)
count = r_maxparticles - numparticles;
@ -305,34 +288,59 @@ R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
org[j] += ((rand () & 15) - 8);
}
particle_new (pt_slowgrav, part_tex_dot, org, 1.5, dir,
(r_realtime + 0.1 * (rand () % 5)),
r_realtime + 0.1 * (rand () % 5),
(color & ~7) + (rand () & 7), 255);
}
}
void
R_RunSpikeEffect (vec3_t org, particle_effect_t type)
R_SpikeEffect_QF (vec3_t org)
{
switch (type) {
case PE_SPIKE:
R_RunSparkEffect (org, 5, 8);
break;
case PE_SUPERSPIKE:
R_RunSparkEffect (org, 10, 8);
break;
case PE_KNIGHTSPIKE:
R_RunSparkEffect (org, 10, 8);
break;
case PE_WIZSPIKE:
R_RunSparkEffect (org, 15, 16);
break;
default:
break;
}
R_RunSparkEffect_QF (org, 5, 8);
}
void
R_LavaSplash (vec3_t org)
R_SuperSpikeEffect_QF (vec3_t org)
{
R_RunSparkEffect_QF (org, 10, 8);
}
void
R_KnightSpikeEffect_QF (vec3_t org)
{
int count = 10;
if (numparticles >= r_maxparticles)
return;
particle_new (pt_smokecloud, part_tex_smoke, org, 1, vec3_origin,
r_realtime + 9, 234, 64 + (rand () & 31));
if (numparticles + count >= r_maxparticles)
count = r_maxparticles - numparticles;
while (count--)
particle_new_random (pt_fallfadespark, part_tex_dot, org, 6, 0.7, 96,
r_realtime + 5, 234, 255);
}
void
R_WizSpikeEffect_QF (vec3_t org)
{
int count = 15;
if (numparticles >= r_maxparticles)
return;
particle_new (pt_smokecloud, part_tex_smoke, org, 2, vec3_origin,
r_realtime + 9, 52 + (rand () & 3), 64 + (rand () & 31));
if (numparticles + count >= r_maxparticles)
count = r_maxparticles - numparticles;
while (count--)
particle_new_random (pt_fallfadespark, part_tex_dot, org, 12, 0.7, 96,
r_realtime + 5, 52 + (rand () & 3), 255);
}
void
R_LavaSplash_QF (vec3_t org)
{
float vel;
int rnd, i, j;
@ -361,14 +369,14 @@ R_LavaSplash (vec3_t org)
vel = 50 + (rnd & 63);
VectorScale (dir, vel, pvel);
particle_new (pt_grav, part_tex_dot, porg, 3, pvel,
(r_realtime + 2 + ((rnd >> 7) & 31) * 0.02),
(224 + ((rnd >> 12) & 7)), 193);
r_realtime + 2 + ((rnd >> 7) & 31) * 0.02,
224 + ((rnd >> 12) & 7), 193);
}
}
}
void
R_TeleportSplash (vec3_t org)
R_TeleportSplash_QF (vec3_t org)
{
float vel;
int rnd, i, j, k;
@ -405,7 +413,7 @@ R_TeleportSplash (vec3_t org)
}
void
R_RocketTrail (entity_t *ent)
R_RocketTrail_QF (entity_t *ent)
{
float dist, maxlen, origlen, percent, pscale, pscalenext;
float len = 0.0;
@ -441,7 +449,7 @@ R_RocketTrail (entity_t *ent)
}
void
R_GrenadeTrail (entity_t *ent)
R_GrenadeTrail_QF (entity_t *ent)
{
float dist, maxlen, origlen, percent, pscale, pscalenext;
float len = 0.0;
@ -476,7 +484,7 @@ R_GrenadeTrail (entity_t *ent)
}
void
R_BloodTrail (entity_t *ent)
R_BloodTrail_QF (entity_t *ent)
{
float dist, maxlen, origlen, percent, pscale, pscalenext;
float len = 0.0;
@ -519,7 +527,7 @@ R_BloodTrail (entity_t *ent)
}
void
R_SlightBloodTrail (entity_t *ent)
R_SlightBloodTrail_QF (entity_t *ent)
{
float dist, maxlen, origlen, percent, pscale, pscalenext;
float len = 0;
@ -562,7 +570,7 @@ R_SlightBloodTrail (entity_t *ent)
}
void
R_GreenTrail (entity_t *ent)
R_WizTrail_QF (entity_t *ent)
{
float maxlen, origlen, percent;
float dist = 3.0, len = 0.0;
@ -602,7 +610,7 @@ R_GreenTrail (entity_t *ent)
}
void
R_FlameTrail (entity_t *ent)
R_FlameTrail_QF (entity_t *ent)
{
float maxlen, origlen, percent;
float dist = 3.0, len = 0.0;
@ -642,7 +650,7 @@ R_FlameTrail (entity_t *ent)
}
void
R_VoorTrail (entity_t *ent)
R_VoorTrail_QF (entity_t *ent)
{
float maxlen, origlen, percent;
float dist = 3.0, len = 0.0;
@ -673,6 +681,112 @@ R_VoorTrail (entity_t *ent)
}
}
void
R_ParticleExplosion_EE (vec3_t org)
{
/*
R_NewExplosion (org);
*/
if (numparticles >= r_maxparticles)
return;
particle_new_random (pt_smokecloud, part_tex_smoke, org, 4, 30, 8,
r_realtime + 5.0, rand () & 255,
128 + (rand () & 63));
}
void
R_RocketTrail_EE (entity_t *ent)
{
float dist, maxlen, origlen, percent, pscale, pscalenext;
float len = 0.0;
vec3_t subtract, vec;
if (numparticles >= r_maxparticles)
return;
VectorSubtract (ent->origin, ent->old_origin, vec);
maxlen = VectorNormalize (vec);
origlen = r_frametime / maxlen;
pscale = 1.5 + qfrandom (1.5);
while (len < maxlen) {
pscalenext = 1.5 + qfrandom (1.5);
dist = (pscale + pscalenext) * 3.0;
VectorScale (vec, min(dist, len), subtract);
VectorAdd (ent->old_origin, subtract, ent->old_origin);
percent = len * origlen;
particle_new (pt_smoke, part_tex_smoke, ent->old_origin,
pscale + percent * 4.0, vec3_origin,
r_realtime + 2.0 - percent * 2.0,
rand () & 255,
128 + (rand () & 31) - percent * 100.0);
if (numparticles >= r_maxparticles)
break;
len += dist;
pscale = pscalenext;
}
}
void
R_GrenadeTrail_EE (entity_t *ent)
{
float dist, maxlen, origlen, percent, pscale, pscalenext;
float len = 0.0;
vec3_t subtract, vec;
if (numparticles >= r_maxparticles)
return;
VectorSubtract (ent->origin, ent->old_origin, vec);
maxlen = VectorNormalize (vec);
origlen = r_frametime / maxlen;
pscale = 6.0 + qfrandom (7.0);
while (len < maxlen) {
pscalenext = 6.0 + qfrandom (7.0);
dist = (pscale + pscalenext) * 2.0;
VectorScale (vec, min(dist, len), subtract);
VectorAdd (ent->old_origin, subtract, ent->old_origin);
percent = len * origlen;
particle_new (pt_smoke, part_tex_smoke, ent->old_origin,
pscale + percent * 4.0, vec3_origin,
r_realtime + 2.0 - percent * 2.0,
rand () & 255,
160 + (rand () & 31) - percent * 100.0);
if (numparticles >= r_maxparticles)
break;
len += dist;
pscale = pscalenext;
}
}
void
R_ParticleExplosion_ID (vec3_t org)
{
int i;
int j = 1024;
ptype_t ptype;
if (numparticles >= r_maxparticles)
return;
else if (numparticles + j >= r_maxparticles)
j = r_maxparticles - numparticles;
for (i = 0; i < j; i++) {
if (i & 1)
ptype = pt_explode;
else
ptype = pt_explode2;
particle_new_random (ptype, part_tex_dot, org, 16, 1.5, 256,
r_realtime + 5.0, (rand () & 7) + 8, 255);
}
}
void
R_DrawParticles (void)
{
@ -700,18 +814,18 @@ R_DrawParticles (void)
varray[3].texcoord[0] = 1;
varray[3].texcoord[1] = 1;
grav = (fast_grav = r_frametime * 800) * 0.05;
dvel = bloodcloud_scale = smoke_scale = r_frametime * 4;
smoke_alpha = r_frametime * 100;
smokecloud_alpha = r_frametime * 140;
smokecloud_scale = r_frametime * 50;
smokecloud_org = r_frametime * 30;
bloodcloud_alpha = r_frametime * 65;
fallfadespark_alpha = r_frametime * 256;
fire_alpha = r_frametime * 32;
fire_scale = r_frametime * 2;
grav = (fast_grav = r_frametime * 800.0) * 0.05;
dvel = bloodcloud_scale = smoke_scale = r_frametime * 4.0;
smoke_alpha = r_frametime * 100.0;
smokecloud_alpha = r_frametime * 140.0;
smokecloud_scale = r_frametime * 50.0;
smokecloud_org = r_frametime * 30.0;
bloodcloud_alpha = r_frametime * 65.0;
fallfadespark_alpha = r_frametime * 256.0;
fire_alpha = r_frametime * 32.0;
fire_scale = r_frametime * 2.0;
minparticledist = DotProduct (r_refdef.vieworg, vpn) + 32.0f;
minparticledist = DotProduct (r_refdef.vieworg, vpn) + 32.0;
activeparticles = 0;
maxparticle = -1;
@ -728,20 +842,20 @@ R_DrawParticles (void)
varray[0].color[2] = at[2];
varray[0].color[3] = part->alpha;
memcpy(varray[1].color, varray[0].color, sizeof(varray[0].color));
memcpy(varray[2].color, varray[0].color, sizeof(varray[0].color));
memcpy(varray[3].color, varray[0].color, sizeof(varray[0].color));
memcpy (varray[1].color, varray[0].color, sizeof(varray[0].color));
memcpy (varray[2].color, varray[0].color, sizeof(varray[0].color));
memcpy (varray[3].color, varray[0].color, sizeof(varray[0].color));
scale = part->scale;
VectorScale (vup, scale, up_scale);
VectorScale (vright, scale, right_scale);
VectorScale (vup, scale, up_scale);
VectorScale (vright, scale, right_scale);
VectorAdd (right_scale, up_scale, up_right_scale);
VectorAdd (right_scale, up_scale, up_right_scale);
VectorSubtract (right_scale, up_scale, down_right_scale);
VectorAdd (part->org, up_right_scale, varray[0].vertex);
VectorAdd (part->org, down_right_scale, varray[1].vertex);
VectorAdd (part->org, up_right_scale, varray[0].vertex);
VectorAdd (part->org, down_right_scale, varray[1].vertex);
VectorSubtract (part->org, up_right_scale, varray[2].vertex);
VectorSubtract (part->org, down_right_scale, varray[3].vertex);
@ -773,8 +887,7 @@ R_DrawParticles (void)
// part->org[2] += smokecloud_org;
break;
case pt_smokecloud:
if ((part->alpha -= smokecloud_alpha) < 1)
{
if ((part->alpha -= smokecloud_alpha) < 1) {
part->die = -1;
break;
}
@ -782,8 +895,7 @@ R_DrawParticles (void)
part->org[2] += smokecloud_org;
break;
case pt_bloodcloud:
if ((part->alpha -= bloodcloud_alpha) < 1)
{
if ((part->alpha -= bloodcloud_alpha) < 1) {
part->die = -1;
break;
}
@ -808,8 +920,7 @@ R_DrawParticles (void)
// to ensure compactor below operates properly in all cases)
if (part->die < r_realtime)
freeparticles[j++] = part;
else
{
else {
maxparticle = k;
activeparticles++;
}
@ -818,7 +929,7 @@ R_DrawParticles (void)
while (maxparticle >= activeparticles) {
*freeparticles[k++] = particles[maxparticle--];
while (maxparticle >= activeparticles &&
particles[maxparticle].die <= r_realtime)
particles[maxparticle].die <= r_realtime)
maxparticle--;
}
numparticles = activeparticles;
@ -826,3 +937,53 @@ R_DrawParticles (void)
qfglColor3ubv (color_white);
qfglDepthMask (GL_TRUE);
}
void
r_easter_eggs_f (cvar_t *var)
{
if (easter_eggs) {
if (easter_eggs->int_val) {
R_ParticleExplosion = R_ParticleExplosion_EE;
R_RocketTrail = R_RocketTrail_EE;
R_GrenadeTrail = R_GrenadeTrail_EE;
} else {
R_ParticleExplosion = R_ParticleExplosion_QF;
R_RocketTrail = R_RocketTrail_QF;
R_GrenadeTrail = R_GrenadeTrail_QF;
}
}
}
void
R_ParticleFunctionInit (void)
{
R_BlobExplosion = R_BlobExplosion_QF;
R_ParticleExplosion = R_ParticleExplosion_QF;
R_ParticleExplosion2 = R_ParticleExplosion2_QF;
R_LavaSplash = R_LavaSplash_QF;
R_TeleportSplash = R_TeleportSplash_QF;
R_BloodPuffEffect = R_BloodPuffEffect_QF;
R_GunshotEffect = R_GunshotEffect_QF;
R_LightningBloodEffect = R_LightningBloodEffect_QF;
R_RunParticleEffect = R_RunParticleEffect_QF;
R_SpikeEffect = R_SpikeEffect_QF;
R_SuperSpikeEffect = R_SuperSpikeEffect_QF;
R_KnightSpikeEffect = R_KnightSpikeEffect_QF;
R_WizSpikeEffect = R_WizSpikeEffect_QF;
R_RocketTrail = R_RocketTrail_QF;
R_GrenadeTrail = R_GrenadeTrail_QF;
R_BloodTrail = R_BloodTrail_QF;
R_SlightBloodTrail = R_SlightBloodTrail_QF;
R_WizTrail = R_WizTrail_QF;
R_FlameTrail = R_FlameTrail_QF;
R_VoorTrail = R_VoorTrail_QF;
}
void
R_Particles_Init_Cvars (void)
{
R_ParticleFunctionInit ();
}

View file

@ -154,7 +154,7 @@ R_ShowNearestLoc (void)
dl->color[2] = 0;
VectorCopy (nearloc->loc, trueloc);
R_RunSpikeEffect (trueloc, 7);
(*R_WizSpikeEffect) (trueloc);
}
}

View file

@ -163,7 +163,8 @@ R_Init (void)
qfglEnableClientState (GL_VERTEX_ARRAY);
qfglEnableClientState (GL_TEXTURE_COORD_ARRAY);
// qfglInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, varray);
// qfglInterleavedArrays (GL_T2F_C4UB_N3F_V3F, 0, varray); // Models w/normals
// qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, varray); // Polys w/o normals
qfglTexCoordPointer (2, GL_FLOAT, sizeof(varray[0]), varray[0].texcoord);
qfglColorPointer (4, GL_UNSIGNED_BYTE, sizeof(varray[0]), varray[0].color);
qfglVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex);

View file

@ -41,6 +41,8 @@ static const char rcsid[] =
#include "r_cvar.h"
#include "r_dynamic.h"
cvar_t *easter_eggs;
cvar_t *cl_crossx;
cvar_t *cl_crossy;
cvar_t *cl_verstring;
@ -143,6 +145,8 @@ r_particles_max_f (cvar_t *var)
void
R_Init_Cvars (void)
{
easter_eggs = Cvar_Get ("easter_eggs", "0", CVAR_NONE, r_easter_eggs_f,
"Enables easter eggs.");
cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, NULL,
"Sets the position of the crosshair on the X-axis.");

View file

@ -44,6 +44,27 @@ unsigned int r_maxparticles, numparticles;
particle_t *active_particles, *free_particles, *particles, **freeparticles;
vec3_t r_pright, r_pup, r_ppn;
void (*R_RocketTrail) (struct entity_s *ent);
void (*R_GrenadeTrail) (struct entity_s *ent);
void (*R_BloodTrail) (struct entity_s *ent);
void (*R_SlightBloodTrail) (struct entity_s *ent);
void (*R_WizTrail) (struct entity_s *ent);
void (*R_FlameTrail) (struct entity_s *ent);
void (*R_VoorTrail) (struct entity_s *ent);
void (*R_RunParticleEffect) (vec3_t org, vec3_t dir, int color, int count);
void (*R_BloodPuffEffect) (vec3_t org, int count);
void (*R_GunshotEffect) (vec3_t org, int count);
void (*R_LightningBloodEffect) (vec3_t org);
void (*R_SpikeEffect) (vec3_t org);
void (*R_KnightSpikeEffect) (vec3_t org);
void (*R_SuperSpikeEffect) (vec3_t org);
void (*R_WizSpikeEffect) (vec3_t org);
void (*R_BlobExplosion) (vec3_t org);
void (*R_ParticleExplosion) (vec3_t org);
void (*R_ParticleExplosion2) (vec3_t org, int colorStart, int colorLength);
void (*R_LavaSplash) (vec3_t org);
void (*R_TeleportSplash) (vec3_t org);
/*
R_MaxParticlesCheck

View file

@ -50,11 +50,6 @@ int ramp3[8] = { 0x6d, 0x6b, 6, 5, 4, 3 };
void
R_Particles_Init_Cvars (void)
{
}
void
R_ClearParticles (void)
{
@ -119,49 +114,7 @@ R_ReadPointFile_f (void)
}
void
R_RunSpikeEffect (vec3_t pos, particle_effect_t type)
{
switch (type) {
case PE_WIZSPIKE:
R_RunParticleEffect (pos, vec3_origin, 20, 30);
break;
case PE_KNIGHTSPIKE:
R_RunParticleEffect (pos, vec3_origin, 226, 20);
break;
case PE_SPIKE:
R_RunParticleEffect (pos, vec3_origin, 0, 10);
break;
case PE_SUPERSPIKE:
R_RunParticleEffect (pos, vec3_origin, 0, 20);
break;
default:
break;
}
}
void
R_RunPuffEffect (vec3_t pos, particle_effect_t type, byte cnt)
{
if (!r_particles->int_val)
return;
switch (type) {
case PE_GUNSHOT:
R_RunParticleEffect (pos, vec3_origin, 0, cnt);
break;
case PE_BLOOD:
R_RunParticleEffect (pos, vec3_origin, 73, cnt);
break;
case PE_LIGHTNINGBLOOD:
R_RunParticleEffect (pos, vec3_origin, 225, 50);
break;
default:
break;
}
}
void
R_ParticleExplosion (vec3_t org)
R_ParticleExplosion_QF (vec3_t org)
{
int i, j;
particle_t *p;
@ -197,7 +150,7 @@ R_ParticleExplosion (vec3_t org)
}
void
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength)
{
int i, j;
particle_t *p;
@ -226,7 +179,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
}
void
R_BlobExplosion (vec3_t org)
R_BlobExplosion_QF (vec3_t org)
{
int i, j;
particle_t *p;
@ -263,7 +216,7 @@ R_BlobExplosion (vec3_t org)
}
void
R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count)
{
int i, j;
particle_t *p;
@ -290,7 +243,49 @@ R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
}
void
R_LavaSplash (vec3_t org)
R_SpikeEffect_QF (vec3_t org)
{
R_RunParticleEffect_QF (org, vec3_origin, 0, 10);
}
void
R_SuperSpikeEffect_QF (vec3_t org)
{
R_RunParticleEffect (org, vec3_origin, 0, 20);
}
void
R_KnightSpikeEffect_QF (vec3_t org)
{
R_RunParticleEffect_QF (org, vec3_origin, 226, 20);
}
void
R_WizSpikeEffect_QF (vec3_t org)
{
R_RunParticleEffect_QF (org, vec3_origin, 20, 30);
}
void
R_BloodPuffEffect_QF (vec3_t org, int count)
{
R_RunParticleEffect_QF (org, vec3_origin, 73, count);
}
void
R_GunshotEffect_QF (vec3_t org, int count)
{
R_RunParticleEffect_QF (org, vec3_origin, 0, count);
}
void
R_LightningBloodEffect_QF (vec3_t org)
{
R_RunParticleEffect_QF (org, vec3_origin, 225, 50);
}
void
R_LavaSplash_QF (vec3_t org)
{
int i, j, k;
particle_t *p;
@ -329,7 +324,7 @@ R_LavaSplash (vec3_t org)
}
void
R_TeleportSplash (vec3_t org)
R_TeleportSplash_QF (vec3_t org)
{
int i, j, k;
particle_t *p;
@ -368,7 +363,7 @@ R_TeleportSplash (vec3_t org)
}
void
R_RocketTrail (entity_t *ent)
R_RocketTrail_QF (entity_t *ent)
{
float len;
int j;
@ -405,7 +400,7 @@ R_RocketTrail (entity_t *ent)
}
void
R_GrenadeTrail (entity_t *ent)
R_GrenadeTrail_QF (entity_t *ent)
{
float len;
int j;
@ -442,7 +437,7 @@ R_GrenadeTrail (entity_t *ent)
}
void
R_BloodTrail (entity_t *ent)
R_BloodTrail_QF (entity_t *ent)
{
float len;
int j;
@ -479,7 +474,7 @@ R_BloodTrail (entity_t *ent)
}
void
R_SlightBloodTrail (entity_t *ent)
R_SlightBloodTrail_QF (entity_t *ent)
{
float len;
int j;
@ -515,7 +510,7 @@ R_SlightBloodTrail (entity_t *ent)
}
void
R_GreenTrail (entity_t *ent)
R_WizTrail_QF (entity_t *ent)
{
float len;
particle_t *p;
@ -552,7 +547,7 @@ R_GreenTrail (entity_t *ent)
}
void
R_FlameTrail (entity_t *ent)
R_FlameTrail_QF (entity_t *ent)
{
float len;
particle_t *p;
@ -598,7 +593,7 @@ R_FlameTrail (entity_t *ent)
}
void
R_VoorTrail (entity_t *ent)
R_VoorTrail_QF (entity_t *ent)
{
float len;
int j;
@ -726,3 +721,42 @@ R_DrawParticles (void)
}
D_EndParticles ();
}
void
r_easter_eggs_f (cvar_t *var)
{
}
void
R_ParticleFunctionInit (void)
{
R_BlobExplosion = R_BlobExplosion_QF;
R_ParticleExplosion = R_ParticleExplosion_QF;
R_ParticleExplosion2 = R_ParticleExplosion2_QF;
R_LavaSplash = R_LavaSplash_QF;
R_TeleportSplash = R_TeleportSplash_QF;
R_BloodPuffEffect = R_BloodPuffEffect_QF;
R_GunshotEffect = R_GunshotEffect_QF;
R_LightningBloodEffect = R_LightningBloodEffect_QF;
R_RunParticleEffect = R_RunParticleEffect_QF;
R_SpikeEffect = R_SpikeEffect_QF;
R_SuperSpikeEffect = R_SuperSpikeEffect_QF;
R_KnightSpikeEffect = R_KnightSpikeEffect_QF;
R_WizSpikeEffect = R_WizSpikeEffect_QF;
R_RocketTrail = R_RocketTrail_QF;
R_GrenadeTrail = R_GrenadeTrail_QF;
R_BloodTrail = R_BloodTrail_QF;
R_SlightBloodTrail = R_SlightBloodTrail_QF;
R_WizTrail = R_WizTrail_QF;
R_FlameTrail = R_FlameTrail_QF;
R_VoorTrail = R_VoorTrail_QF;
}
void
R_Particles_Init_Cvars (void)
{
R_ParticleFunctionInit ();
}

View file

@ -49,12 +49,6 @@ int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
int ramp3[8] = { 0x6d, 0x6b, 6, 5, 4, 3 };
void
R_Particles_Init_Cvars (void)
{
}
void
R_ClearParticles (void)
{
@ -119,49 +113,7 @@ R_ReadPointFile_f (void)
}
void
R_RunSpikeEffect (vec3_t pos, particle_effect_t type)
{
switch (type) {
case PE_WIZSPIKE:
R_RunParticleEffect (pos, vec3_origin, 20, 30);
break;
case PE_KNIGHTSPIKE:
R_RunParticleEffect (pos, vec3_origin, 226, 20);
break;
case PE_SPIKE:
R_RunParticleEffect (pos, vec3_origin, 0, 10);
break;
case PE_SUPERSPIKE:
R_RunParticleEffect (pos, vec3_origin, 0, 20);
break;
default:
break;
}
}
void
R_RunPuffEffect (vec3_t pos, particle_effect_t type, byte cnt)
{
if (!r_particles->int_val)
return;
switch (type) {
case PE_GUNSHOT:
R_RunParticleEffect (pos, vec3_origin, 0, cnt);
break;
case PE_BLOOD:
R_RunParticleEffect (pos, vec3_origin, 73, cnt);
break;
case PE_LIGHTNINGBLOOD:
R_RunParticleEffect (pos, vec3_origin, 225, 50);
break;
default:
break;
}
}
void
R_ParticleExplosion (vec3_t org)
R_ParticleExplosion_QF (vec3_t org)
{
int i, j;
particle_t *p;
@ -197,7 +149,7 @@ R_ParticleExplosion (vec3_t org)
}
void
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength)
{
int i, j;
particle_t *p;
@ -226,7 +178,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
}
void
R_BlobExplosion (vec3_t org)
R_BlobExplosion_QF (vec3_t org)
{
int i, j;
particle_t *p;
@ -263,34 +215,7 @@ R_BlobExplosion (vec3_t org)
}
void
R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
{
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;
p->die = r_realtime + 0.1 * (rand () % 5);
p->color = (color & ~7) + (rand () & 7);
p->type = pt_slowgrav;
for (j = 0; j < 3; j++) {
p->org[j] = org[j] + ((rand () & 15) - 8);
p->vel[j] = dir[j]; // + (rand()%300)-150;
}
}
}
void
R_LavaSplash (vec3_t org)
R_LavaSplash_QF (vec3_t org)
{
int i, j, k;
particle_t *p;
@ -329,7 +254,7 @@ R_LavaSplash (vec3_t org)
}
void
R_TeleportSplash (vec3_t org)
R_TeleportSplash_QF (vec3_t org)
{
float vel;
int i, j, k;
@ -368,7 +293,76 @@ R_TeleportSplash (vec3_t org)
}
void
R_RocketTrail (entity_t *ent)
R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count)
{
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;
p->die = r_realtime + 0.1 * (rand () % 5);
p->color = (color & ~7) + (rand () & 7);
p->type = pt_slowgrav;
for (j = 0; j < 3; j++) {
p->org[j] = org[j] + ((rand () & 15) - 8);
p->vel[j] = dir[j]; // + (rand()%300)-150;
}
}
}
void
R_SpikeEffect_QF (vec3_t org)
{
R_RunParticleEffect_QF (org, vec3_origin, 0, 10);
}
void
R_SuperSpikeEffect_QF (vec3_t org)
{
R_RunParticleEffect (org, vec3_origin, 0, 20);
}
void
R_KnightSpikeEffect_QF (vec3_t org)
{
R_RunParticleEffect_QF (org, vec3_origin, 226, 20);
}
void
R_WizSpikeEffect_QF (vec3_t org)
{
R_RunParticleEffect_QF (org, vec3_origin, 20, 30);
}
void
R_BloodPuffEffect_QF (vec3_t org, int count)
{
R_RunParticleEffect_QF (org, vec3_origin, 73, count);
}
void
R_GunshotEffect_QF (vec3_t org, int count)
{
R_RunParticleEffect_QF (org, vec3_origin, 0, count);
}
void
R_LightningBloodEffect_QF (vec3_t org)
{
R_RunParticleEffect_QF (org, vec3_origin, 225, 50);
}
void
R_RocketTrail_QF (entity_t *ent)
{
float len;
int j;
@ -405,7 +399,7 @@ R_RocketTrail (entity_t *ent)
}
void
R_GrenadeTrail (entity_t *ent)
R_GrenadeTrail_QF (entity_t *ent)
{
float len;
int j;
@ -442,7 +436,7 @@ R_GrenadeTrail (entity_t *ent)
}
void
R_BloodTrail (entity_t *ent)
R_BloodTrail_QF (entity_t *ent)
{
float len;
int j;
@ -479,7 +473,7 @@ R_BloodTrail (entity_t *ent)
}
void
R_SlightBloodTrail (entity_t *ent)
R_SlightBloodTrail_QF (entity_t *ent)
{
float len;
int j;
@ -515,7 +509,7 @@ R_SlightBloodTrail (entity_t *ent)
}
void
R_GreenTrail (entity_t *ent)
R_WizTrail_QF (entity_t *ent)
{
float len;
particle_t *p;
@ -552,7 +546,7 @@ R_GreenTrail (entity_t *ent)
}
void
R_FlameTrail (entity_t *ent)
R_FlameTrail_QF (entity_t *ent)
{
float len;
particle_t *p;
@ -598,7 +592,7 @@ R_FlameTrail (entity_t *ent)
}
void
R_VoorTrail (entity_t *ent)
R_VoorTrail_QF (entity_t *ent)
{
float len;
int j;
@ -727,3 +721,42 @@ R_DrawParticles (void)
}
D_EndParticles ();
}
void
r_easter_eggs_f (cvar_t *var)
{
}
void
R_ParticleFunctionInit (void)
{
R_BlobExplosion = R_BlobExplosion_QF;
R_ParticleExplosion = R_ParticleExplosion_QF;
R_ParticleExplosion2 = R_ParticleExplosion2_QF;
R_LavaSplash = R_LavaSplash_QF;
R_TeleportSplash = R_TeleportSplash_QF;
R_BloodPuffEffect = R_BloodPuffEffect_QF;
R_GunshotEffect = R_GunshotEffect_QF;
R_LightningBloodEffect = R_LightningBloodEffect_QF;
R_RunParticleEffect = R_RunParticleEffect_QF;
R_SpikeEffect = R_SpikeEffect_QF;
R_SuperSpikeEffect = R_SuperSpikeEffect_QF;
R_KnightSpikeEffect = R_KnightSpikeEffect_QF;
R_WizSpikeEffect = R_WizSpikeEffect_QF;
R_RocketTrail = R_RocketTrail_QF;
R_GrenadeTrail = R_GrenadeTrail_QF;
R_BloodTrail = R_BloodTrail_QF;
R_SlightBloodTrail = R_SlightBloodTrail_QF;
R_WizTrail = R_WizTrail_QF;
R_FlameTrail = R_FlameTrail_QF;
R_VoorTrail = R_VoorTrail_QF;
}
void
R_Particles_Init_Cvars (void)
{
R_ParticleFunctionInit ();
}

View file

@ -621,7 +621,7 @@ CL_RelinkEntities (void)
else if (ent->model->flags & EF_ZOMGIB)
R_SlightBloodTrail (ent);
else if (ent->model->flags & EF_TRACER)
R_GreenTrail (ent);
R_WizTrail (ent);
else if (ent->model->flags & EF_TRACER2)
R_FlameTrail (ent);
else if (ent->model->flags & EF_TRACER3)

View file

@ -127,7 +127,7 @@ void
CL_ParseStartSoundPacket (void)
{
float attenuation;
int channel, ent, field_mask, sound_num, volume, i;
int channel, ent, field_mask, sound_num, volume;
vec3_t pos;
field_mask = MSG_ReadByte (net_message);
@ -151,8 +151,7 @@ CL_ParseStartSoundPacket (void)
if (ent > MAX_EDICTS)
Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
for (i = 0; i < 3; i++)
pos[i] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos,
volume / 255.0, attenuation);
@ -644,11 +643,10 @@ CL_ParseStatic (void)
void
CL_ParseStaticSound (void)
{
int sound_num, vol, atten, i;
int sound_num, vol, atten;
vec3_t org;
for (i = 0; i < 3; i++)
org[i] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, org);
sound_num = MSG_ReadByte (net_message);
vol = MSG_ReadByte (net_message);
atten = MSG_ReadByte (net_message);

View file

@ -186,13 +186,8 @@ CL_ParseBeam (model_t *m)
ent = MSG_ReadShort (net_message);
start[0] = MSG_ReadCoord (net_message);
start[1] = MSG_ReadCoord (net_message);
start[2] = MSG_ReadCoord (net_message);
end[0] = MSG_ReadCoord (net_message);
end[1] = MSG_ReadCoord (net_message);
end[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, start);
MSG_ReadCoord3 (net_message, end);
// override any beam with the same entity
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
@ -238,26 +233,20 @@ CL_ParseTEnt (void)
}
switch (type) {
case TE_WIZSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, prot_to_rend[type]);
MSG_ReadCoord3 (net_message, pos);
R_WizSpikeEffect (pos);
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
case TE_KNIGHTSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, prot_to_rend[type]);
MSG_ReadCoord3 (net_message, pos);
R_KnightSpikeEffect (pos);
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
case TE_SPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, prot_to_rend[type]);
MSG_ReadCoord3 (net_message, pos);
R_SpikeEffect (pos);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@ -273,10 +262,8 @@ CL_ParseTEnt (void)
break;
case TE_SUPERSPIKE: // super spike hitting wall
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, prot_to_rend[type]);
MSG_ReadCoord3 (net_message, pos);
R_SuperSpikeEffect (pos);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@ -293,9 +280,7 @@ CL_ParseTEnt (void)
case TE_EXPLOSION: // rocket explosion
// particles
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
R_ParticleExplosion (pos);
// light
@ -319,9 +304,7 @@ CL_ParseTEnt (void)
break;
case TE_TAREXPLOSION: // tarbaby explosion
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
R_BlobExplosion (pos);
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
@ -346,23 +329,17 @@ CL_ParseTEnt (void)
// PGM 01/21/97
case TE_LAVASPLASH:
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
R_LavaSplash (pos);
break;
case TE_TELEPORT:
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
R_TeleportSplash (pos);
break;
case TE_EXPLOSION2: // color mapped explosion
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
colorStart = MSG_ReadByte (net_message);
colorLength = MSG_ReadByte (net_message);
R_ParticleExplosion2 (pos, colorStart, colorLength);
@ -381,22 +358,18 @@ CL_ParseTEnt (void)
break;
case TE_GUNSHOT: // bullet hitting wall
case TE_BLOOD: // bullets hitting body
if (type == TE_GUNSHOT) {
cnt = 20;
} else {
cnt = MSG_ReadByte (net_message) * 20;
}
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunPuffEffect (pos, prot_to_rend[type], cnt);
MSG_ReadCoord3 (net_message, pos);
R_GunshotEffect (pos, 20);
break;
case TE_BLOOD: // bullet hitting body
cnt = MSG_ReadByte (net_message) * 20;
MSG_ReadCoord3 (net_message, pos);
R_BloodPuffEffect (pos, cnt);
break;
case TE_LIGHTNINGBLOOD: // lightning hitting body
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
// light
dl = R_AllocDlight (0);
@ -408,7 +381,7 @@ CL_ParseTEnt (void)
dl->color[1] = 0.40;
dl->color[2] = 0.65;
R_RunPuffEffect (pos, prot_to_rend[type], 50);
R_LightningBloodEffect (pos);
break;
default:
@ -517,8 +490,7 @@ CL_ParseParticleEffect (void)
int i, count, color;
vec3_t org, dir;
for (i = 0; i < 3; i++)
org[i] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, org);
for (i = 0; i < 3; i++)
dir[i] = MSG_ReadChar (net_message) * (15.0 / 16.0);
count = MSG_ReadByte (net_message);

View file

@ -211,13 +211,12 @@ V_ParseDamage (void)
{
entity_t *ent;
float count, side;
int armor, blood, i;
int armor, blood;
vec3_t from, forward, right, up;
armor = MSG_ReadByte (net_message);
blood = MSG_ReadByte (net_message);
for (i = 0; i < 3; i++)
from[i] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, from);
count = blood * 0.5 + armor * 0.5;
if (count < 10)

View file

@ -527,7 +527,7 @@ CL_LinkPacketEntities (void)
else if (model->flags & EF_ZOMGIB)
R_SlightBloodTrail (*ent);
else if (model->flags & EF_TRACER)
R_GreenTrail (*ent);
R_WizTrail (*ent);
else if (model->flags & EF_TRACER2)
R_FlameTrail (*ent);
else if (model->flags & EF_TRACER3)
@ -610,9 +610,7 @@ CL_ParsePlayerinfo (void)
flags = state->flags = MSG_ReadShort (net_message);
state->messagenum = cl.parsecount;
state->origin[0] = MSG_ReadCoord (net_message);
state->origin[1] = MSG_ReadCoord (net_message);
state->origin[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, state->origin);
state->frame = MSG_ReadByte (net_message);

View file

@ -854,11 +854,10 @@ CL_ParseStatic (void)
void
CL_ParseStaticSound (void)
{
int sound_num, vol, atten, i;
int sound_num, vol, atten;
vec3_t org;
for (i = 0; i < 3; i++)
org[i] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, org);
sound_num = MSG_ReadByte (net_message);
vol = MSG_ReadByte (net_message);
atten = MSG_ReadByte (net_message);
@ -872,7 +871,7 @@ void
CL_ParseStartSoundPacket (void)
{
float attenuation;
int channel, ent, sound_num, volume, i;
int channel, ent, sound_num, volume;
vec3_t pos;
channel = MSG_ReadShort (net_message);
@ -889,8 +888,7 @@ CL_ParseStartSoundPacket (void)
sound_num = MSG_ReadByte (net_message);
for (i = 0; i < 3; i++)
pos[i] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
ent = (channel >> 3) & 1023;
channel &= 7;
@ -1319,8 +1317,8 @@ CL_ParseServerMessage (void)
cl.completed_time = realtime;
vid.recalc_refdef = true; // go to full screen
Con_DPrintf ("intermission simorg: ");
MSG_ReadCoord3 (net_message, cl.simorg);
for (i = 0; i < 3; i++) {
cl.simorg[i] = MSG_ReadCoord (net_message);
Con_DPrintf ("%f ", cl.simorg[i]);
}
Con_DPrintf ("\nintermission simangles: ");

View file

@ -191,13 +191,8 @@ CL_ParseBeam (model_t *m)
ent = MSG_ReadShort (net_message);
start[0] = MSG_ReadCoord (net_message);
start[1] = MSG_ReadCoord (net_message);
start[2] = MSG_ReadCoord (net_message);
end[0] = MSG_ReadCoord (net_message);
end[1] = MSG_ReadCoord (net_message);
end[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, start);
MSG_ReadCoord3 (net_message, end);
// override any beam with the same entity
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
@ -238,26 +233,20 @@ CL_ParseTEnt (void)
type = MSG_ReadByte (net_message);
switch (type) {
case TE_WIZSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, prot_to_rend[type]);
MSG_ReadCoord3 (net_message, pos);
R_WizSpikeEffect (pos);
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
case TE_KNIGHTSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, prot_to_rend[type]);
MSG_ReadCoord3 (net_message, pos);
R_KnightSpikeEffect (pos);
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
case TE_SPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, prot_to_rend[type]);
MSG_ReadCoord3 (net_message, pos);
R_SpikeEffect (pos);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@ -273,10 +262,8 @@ CL_ParseTEnt (void)
break;
case TE_SUPERSPIKE: // super spike hitting wall
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, prot_to_rend[type]);
MSG_ReadCoord3 (net_message, pos);
R_SuperSpikeEffect (pos);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@ -293,9 +280,7 @@ CL_ParseTEnt (void)
case TE_EXPLOSION: // rocket explosion
// particles
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
R_ParticleExplosion (pos);
// light
@ -319,9 +304,7 @@ CL_ParseTEnt (void)
break;
case TE_TAREXPLOSION: // tarbaby explosion
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
R_BlobExplosion (pos);
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
@ -346,23 +329,17 @@ CL_ParseTEnt (void)
// PGM 01/21/97
case TE_LAVASPLASH:
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
R_LavaSplash (pos);
break;
case TE_TELEPORT:
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
R_TeleportSplash (pos);
break;
case TE_EXPLOSION2: // color mapped explosion
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
colorStart = MSG_ReadByte (net_message);
colorLength = MSG_ReadByte (net_message);
R_ParticleExplosion2 (pos, colorStart, colorLength);
@ -381,18 +358,19 @@ CL_ParseTEnt (void)
break;
case TE_GUNSHOT: // bullet hitting wall
case TE_BLOOD: // bullets hitting body
cnt = MSG_ReadByte (net_message) * 20;
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunPuffEffect (pos, prot_to_rend[type], cnt);
MSG_ReadCoord3 (net_message, pos);
R_GunshotEffect (pos, cnt);
break;
case TE_BLOOD: // bullet hitting body
cnt = MSG_ReadByte (net_message) * 20;
MSG_ReadCoord3 (net_message, pos);
R_BloodPuffEffect (pos, cnt);
break;
case TE_LIGHTNINGBLOOD: // lightning hitting body
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, pos);
// light
dl = R_AllocDlight (0);
@ -404,7 +382,7 @@ CL_ParseTEnt (void)
dl->color[1] = 0.40;
dl->color[2] = 0.65;
R_RunPuffEffect (pos, prot_to_rend[type], cnt);
R_LightningBloodEffect (pos);
break;
default:

View file

@ -1782,9 +1782,7 @@ SV_ExecuteClientMessage (client_t *cl)
break;
case clc_tmove:
o[0] = MSG_ReadCoord (net_message);
o[1] = MSG_ReadCoord (net_message);
o[2] = MSG_ReadCoord (net_message);
MSG_ReadCoord3 (net_message, o);
// only allowed by spectators
if (host_client->spectator) {
VectorCopy (o, SVvector (sv_player, origin));