make gl_dyn_part.c and sw_rpart.c independent of client.h and host.h

This commit is contained in:
Bill Currie 2001-05-29 19:43:15 +00:00
parent 7708a2ddd1
commit 78702c07e4
8 changed files with 161 additions and 95 deletions

View File

@ -31,12 +31,23 @@
#include "QF/mathlib.h"
typedef enum {
PE_UNKNOWN,
PE_GUNSHOT,
PE_BLOOD,
PE_LIGHTNINGBLOOD,
PE_SPIKE,
PE_SUPERSPIKE,
PE_KNIGHTSPIKE,
PE_WIZSPIKE,
} particle_effect_t;
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);
void R_RunPuffEffect (vec3_t org, byte type, byte count);
void R_RunSpikeEffect (vec3_t org, byte type);
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);

View File

@ -84,6 +84,26 @@ sfx_t *cl_sfx_imp;
sfx_t *cl_sfx_rail;
#endif
static const particle_effect_t prot_to_rend[]={
PE_SPIKE, // TE_SPIKE
PE_SUPERSPIKE, // TE_SUPERSPIKE
PE_GUNSHOT, // TE_GUNSHOT
PE_UNKNOWN, // TE_EXPLOSION
PE_UNKNOWN, // TE_TAREXPLOSION
PE_UNKNOWN, // TE_LIGHTNING1
PE_UNKNOWN, // TE_LIGHTNING2
PE_WIZSPIKE, // TE_WIZSPIKE
PE_KNIGHTSPIKE, // TE_KNIGHTSPIKE
PE_UNKNOWN, // TE_LIGHTNING3
PE_UNKNOWN, // TE_LAVASPLASH
PE_UNKNOWN, // TE_TELEPORT
PE_BLOOD, // TE_BLOOD
PE_LIGHTNINGBLOOD, // TE_LIGHTNINGBLOOD
PE_UNKNOWN, // TE_IMPLOSION
PE_UNKNOWN, // TE_RAILTRAIL
PE_UNKNOWN, // TE_EXPLOSION2
PE_UNKNOWN, // TE_BEAM
};
void
CL_TEnts_Init (void)
@ -229,7 +249,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, type);
R_RunSpikeEffect (pos, prot_to_rend[type]);
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
@ -237,7 +257,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, type);
R_RunSpikeEffect (pos, prot_to_rend[type]);
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
@ -245,7 +265,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, type);
R_RunSpikeEffect (pos, prot_to_rend[type]);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@ -264,7 +284,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, type);
R_RunSpikeEffect (pos, prot_to_rend[type]);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@ -377,7 +397,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunPuffEffect (pos, type, cnt);
R_RunPuffEffect (pos, prot_to_rend[type], cnt);
break;
#ifdef QUAKE2

View File

@ -42,14 +42,14 @@
#include "QF/compat.h"
#include "QF/console.h"
#include "QF/qargs.h"
#include "QF/quakefs.h"
#include "QF/render.h"
#include "QF/sys.h"
#include "QF/varrays.h"
#include "client.h"
#include "glquake.h"
#include "host.h"
#include "r_dynamic.h"
#include "QF/render.h"
#include "r_shared.h"
static particle_t *particles, **freeparticles;
static short r_numparticles, numparticles;
@ -312,21 +312,23 @@ R_BloodPuff (vec3_t org, int count)
void
R_RunPuffEffect (vec3_t org, byte type, byte count)
R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count)
{
if (!r_particles->int_val)
return;
switch (type) {
case TE_GUNSHOT:
case PE_GUNSHOT:
R_RunGunshotEffect (org, count);
break;
case TE_BLOOD:
case PE_BLOOD:
R_BloodPuff (org, count);
break;
case TE_LIGHTNINGBLOOD:
case PE_LIGHTNINGBLOOD:
R_BloodPuff (org, 5 + (rand () & 1));
break;
default:
break;
}
}
@ -359,21 +361,23 @@ R_RunParticleEffect (vec3_t org, int color, int count)
void
R_RunSpikeEffect (vec3_t org, byte type)
R_RunSpikeEffect (vec3_t org, particle_effect_t type)
{
switch (type) {
case TE_SPIKE:
case PE_SPIKE:
R_RunSparkEffect (org, 5, 8);
break;
case TE_SUPERSPIKE:
case PE_SUPERSPIKE:
R_RunSparkEffect (org, 10, 8);
break;
case TE_KNIGHTSPIKE:
case PE_KNIGHTSPIKE:
R_RunSparkEffect (org, 10, 8);
break;
case TE_WIZSPIKE:
case PE_WIZSPIKE:
R_RunSparkEffect (org, 15, 16);
break;
default:
break;
}
}
@ -579,8 +583,8 @@ R_DrawParticles (void)
varray[2].texcoord[0] = 1; varray[2].texcoord[1] = 0;
varray[3].texcoord[0] = 1; varray[3].texcoord[1] = 1;
grav = (fast_grav = host_frametime * 800) * 0.05;
dvel = 4 * host_frametime;
grav = (fast_grav = r_frametime * 800) * 0.05;
dvel = 4 * r_frametime;
minparticledist = DotProduct (r_refdef.vieworg, vpn) + 32.0f;
@ -665,7 +669,7 @@ R_DrawParticles (void)
}
for (i = 0; i < 3; i++)
part->org[i] += part->vel[i] * host_frametime;
part->org[i] += part->vel[i] * r_frametime;
switch (part->type) {
case pt_static:
@ -684,47 +688,47 @@ R_DrawParticles (void)
part->vel[2] -= grav;
break;
case pt_smoke:
if ((part->alpha -= host_frametime * 90) < 1)
if ((part->alpha -= r_frametime * 90) < 1)
part->die = -1;
part->scale += host_frametime * 6;
// part->org[2] += host_frametime * 30;
part->scale += r_frametime * 6;
// part->org[2] += r_frametime * 30;
break;
case pt_smokering:
if ((part->alpha -= host_frametime * 130) < 1)
if ((part->alpha -= r_frametime * 130) < 1)
part->die = -1;
part->scale += host_frametime * 10;
// part->org[2] += host_frametime * 30;
part->scale += r_frametime * 10;
// part->org[2] += r_frametime * 30;
break;
case pt_smokecloud:
if ((part->alpha -= host_frametime * 128) < 1)
if ((part->alpha -= r_frametime * 128) < 1)
{
part->die = -1;
break;
}
part->scale += host_frametime * 60;
part->org[2] += host_frametime * 30;
part->scale += r_frametime * 60;
part->org[2] += r_frametime * 30;
break;
case pt_bloodcloud:
if ((part->alpha -= host_frametime * 64) < 1)
if ((part->alpha -= r_frametime * 64) < 1)
{
part->die = -1;
break;
}
part->scale += host_frametime * 4;
part->scale += r_frametime * 4;
part->vel[2] -= grav;
break;
case pt_fadespark:
if ((part->alpha -= host_frametime * 256) < 1)
if ((part->alpha -= r_frametime * 256) < 1)
part->die = -1;
part->vel[2] -= grav;
break;
case pt_fadespark2:
if ((part->alpha -= host_frametime * 512) < 1)
if ((part->alpha -= r_frametime * 512) < 1)
part->die = -1;
part->vel[2] -= grav;
break;
case pt_fallfadespark:
if ((part->alpha -= host_frametime * 256) < 1)
if ((part->alpha -= r_frametime * 256) < 1)
part->die = -1;
part->vel[2] -= fast_grav;
break;

View File

@ -34,10 +34,10 @@
#include "QF/qargs.h"
#include "QF/compat.h"
#include "QF/console.h"
#include "QF/render.h"
#include "client.h"
#include "r_local.h"
#include "QF/render.h"
#define MAX_PARTICLES 2048 // default max # of particles at one
// time

View File

@ -36,9 +36,8 @@
#include "QF/console.h"
#include "QF/qargs.h"
#include "QF/quakefs.h"
#include "QF/render.h"
#include "client.h"
#include "host.h"
#include "r_cvar.h"
#include "r_dynamic.h"
#include "r_local.h"
@ -155,41 +154,45 @@ R_ReadPointFile_f (void)
void
R_RunSpikeEffect (vec3_t pos, byte type)
R_RunSpikeEffect (vec3_t pos, particle_effect_t type)
{
switch (type) {
case TE_WIZSPIKE:
case PE_WIZSPIKE:
R_RunParticleEffect (pos, 20, 30);
break;
case TE_KNIGHTSPIKE:
case PE_KNIGHTSPIKE:
R_RunParticleEffect (pos, 226, 20);
break;
case TE_SPIKE:
case PE_SPIKE:
R_RunParticleEffect (pos, 0, 10);
break;
case TE_SUPERSPIKE:
case PE_SUPERSPIKE:
R_RunParticleEffect (pos, 0, 20);
break;
default:
break;
}
}
void
R_RunPuffEffect (vec3_t pos, byte type, byte cnt)
R_RunPuffEffect (vec3_t pos, particle_effect_t type, byte cnt)
{
if (!r_particles->int_val)
return;
switch (type) {
case TE_GUNSHOT:
case PE_GUNSHOT:
R_RunParticleEffect (pos, 0, 20 * cnt);
break;
case TE_BLOOD:
case PE_BLOOD:
R_RunParticleEffect (pos, 73, 20 * cnt);
break;
case TE_LIGHTNINGBLOOD:
case PE_LIGHTNINGBLOOD:
R_RunParticleEffect (pos, 225, 50);
break;
default:
break;
}
}
@ -515,7 +518,7 @@ R_DrawParticles (void)
VectorScale (vup, yscaleshrink, r_pup);
VectorCopy (vpn, r_ppn);
frametime = host_frametime;
frametime = r_frametime;
time3 = frametime * 15;
time2 = frametime * 10; // 15;
time1 = frametime * 5;

View File

@ -87,6 +87,27 @@ sfx_t *cl_sfx_imp;
sfx_t *cl_sfx_rail;
#endif
static const particle_effect_t prot_to_rend[]={
PE_SPIKE, // TE_SPIKE
PE_SUPERSPIKE, // TE_SUPERSPIKE
PE_GUNSHOT, // TE_GUNSHOT
PE_UNKNOWN, // TE_EXPLOSION
PE_UNKNOWN, // TE_TAREXPLOSION
PE_UNKNOWN, // TE_LIGHTNING1
PE_UNKNOWN, // TE_LIGHTNING2
PE_WIZSPIKE, // TE_WIZSPIKE
PE_KNIGHTSPIKE, // TE_KNIGHTSPIKE
PE_UNKNOWN, // TE_LIGHTNING3
PE_UNKNOWN, // TE_LAVASPLASH
PE_UNKNOWN, // TE_TELEPORT
PE_BLOOD, // TE_BLOOD
PE_LIGHTNINGBLOOD, // TE_LIGHTNINGBLOOD
PE_UNKNOWN, // TE_IMPLOSION
PE_UNKNOWN, // TE_RAILTRAIL
PE_UNKNOWN, // TE_EXPLOSION2
PE_UNKNOWN, // TE_BEAM
};
void
CL_TEnts_Init (void)
@ -225,7 +246,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, type);
R_RunSpikeEffect (pos, prot_to_rend[type]);
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
@ -233,7 +254,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, type);
R_RunSpikeEffect (pos, prot_to_rend[type]);
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
@ -241,7 +262,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, type);
R_RunSpikeEffect (pos, prot_to_rend[type]);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@ -260,7 +281,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunSpikeEffect (pos, type);
R_RunSpikeEffect (pos, prot_to_rend[type]);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@ -368,7 +389,7 @@ CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
R_RunPuffEffect (pos, type, cnt);
R_RunPuffEffect (pos, prot_to_rend[type], cnt);
break;
#ifdef QUAKE2

View File

@ -42,14 +42,14 @@
#include "QF/compat.h"
#include "QF/console.h"
#include "QF/qargs.h"
#include "QF/quakefs.h"
#include "QF/render.h"
#include "QF/sys.h"
#include "QF/varrays.h"
#include "client.h"
#include "glquake.h"
#include "host.h"
#include "r_dynamic.h"
#include "QF/render.h"
#include "r_shared.h"
static particle_t *particles, **freeparticles;
static short r_numparticles, numparticles;
@ -312,21 +312,23 @@ R_BloodPuff (vec3_t org, int count)
void
R_RunPuffEffect (vec3_t org, byte type, byte count)
R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count)
{
if (!r_particles->int_val)
return;
switch (type) {
case TE_GUNSHOT:
case PE_GUNSHOT:
R_RunGunshotEffect (org, count);
break;
case TE_BLOOD:
case PE_BLOOD:
R_BloodPuff (org, count);
break;
case TE_LIGHTNINGBLOOD:
case PE_LIGHTNINGBLOOD:
R_BloodPuff (org, 5 + (rand () & 1));
break;
default:
break;
}
}
@ -359,21 +361,23 @@ R_RunParticleEffect (vec3_t org, int color, int count)
void
R_RunSpikeEffect (vec3_t org, byte type)
R_RunSpikeEffect (vec3_t org, particle_effect_t type)
{
switch (type) {
case TE_SPIKE:
case PE_SPIKE:
R_RunSparkEffect (org, 5, 8);
break;
case TE_SUPERSPIKE:
case PE_SUPERSPIKE:
R_RunSparkEffect (org, 10, 8);
break;
case TE_KNIGHTSPIKE:
case PE_KNIGHTSPIKE:
R_RunSparkEffect (org, 10, 8);
break;
case TE_WIZSPIKE:
case PE_WIZSPIKE:
R_RunSparkEffect (org, 15, 16);
break;
default:
break;
}
}
@ -579,8 +583,8 @@ R_DrawParticles (void)
varray[2].texcoord[0] = 1; varray[2].texcoord[1] = 0;
varray[3].texcoord[0] = 1; varray[3].texcoord[1] = 1;
grav = (fast_grav = host_frametime * 800) * 0.05;
dvel = 4 * host_frametime;
grav = (fast_grav = r_frametime * 800) * 0.05;
dvel = 4 * r_frametime;
minparticledist = DotProduct (r_refdef.vieworg, vpn) + 32.0f;
@ -665,7 +669,7 @@ R_DrawParticles (void)
}
for (i = 0; i < 3; i++)
part->org[i] += part->vel[i] * host_frametime;
part->org[i] += part->vel[i] * r_frametime;
switch (part->type) {
case pt_static:
@ -684,47 +688,47 @@ R_DrawParticles (void)
part->vel[2] -= grav;
break;
case pt_smoke:
if ((part->alpha -= host_frametime * 90) < 1)
if ((part->alpha -= r_frametime * 90) < 1)
part->die = -1;
part->scale += host_frametime * 6;
// part->org[2] += host_frametime * 30;
part->scale += r_frametime * 6;
// part->org[2] += r_frametime * 30;
break;
case pt_smokering:
if ((part->alpha -= host_frametime * 130) < 1)
if ((part->alpha -= r_frametime * 130) < 1)
part->die = -1;
part->scale += host_frametime * 10;
// part->org[2] += host_frametime * 30;
part->scale += r_frametime * 10;
// part->org[2] += r_frametime * 30;
break;
case pt_smokecloud:
if ((part->alpha -= host_frametime * 128) < 1)
if ((part->alpha -= r_frametime * 128) < 1)
{
part->die = -1;
break;
}
part->scale += host_frametime * 60;
part->org[2] += host_frametime * 30;
part->scale += r_frametime * 60;
part->org[2] += r_frametime * 30;
break;
case pt_bloodcloud:
if ((part->alpha -= host_frametime * 64) < 1)
if ((part->alpha -= r_frametime * 64) < 1)
{
part->die = -1;
break;
}
part->scale += host_frametime * 4;
part->scale += r_frametime * 4;
part->vel[2] -= grav;
break;
case pt_fadespark:
if ((part->alpha -= host_frametime * 256) < 1)
if ((part->alpha -= r_frametime * 256) < 1)
part->die = -1;
part->vel[2] -= grav;
break;
case pt_fadespark2:
if ((part->alpha -= host_frametime * 512) < 1)
if ((part->alpha -= r_frametime * 512) < 1)
part->die = -1;
part->vel[2] -= grav;
break;
case pt_fallfadespark:
if ((part->alpha -= host_frametime * 256) < 1)
if ((part->alpha -= r_frametime * 256) < 1)
part->die = -1;
part->vel[2] -= fast_grav;
break;

View File

@ -36,9 +36,8 @@
#include "QF/console.h"
#include "QF/qargs.h"
#include "QF/quakefs.h"
#include "QF/render.h"
#include "client.h"
#include "host.h"
#include "r_cvar.h"
#include "r_dynamic.h"
#include "r_local.h"
@ -155,41 +154,45 @@ R_ReadPointFile_f (void)
void
R_RunSpikeEffect (vec3_t pos, byte type)
R_RunSpikeEffect (vec3_t pos, particle_effect_t type)
{
switch (type) {
case TE_WIZSPIKE:
case PE_WIZSPIKE:
R_RunParticleEffect (pos, 20, 30);
break;
case TE_KNIGHTSPIKE:
case PE_KNIGHTSPIKE:
R_RunParticleEffect (pos, 226, 20);
break;
case TE_SPIKE:
case PE_SPIKE:
R_RunParticleEffect (pos, 0, 10);
break;
case TE_SUPERSPIKE:
case PE_SUPERSPIKE:
R_RunParticleEffect (pos, 0, 20);
break;
default:
break;
}
}
void
R_RunPuffEffect (vec3_t pos, byte type, byte cnt)
R_RunPuffEffect (vec3_t pos, particle_effect_t type, byte cnt)
{
if (!r_particles->int_val)
return;
switch (type) {
case TE_GUNSHOT:
case PE_GUNSHOT:
R_RunParticleEffect (pos, 0, 20 * cnt);
break;
case TE_BLOOD:
case PE_BLOOD:
R_RunParticleEffect (pos, 73, 20 * cnt);
break;
case TE_LIGHTNINGBLOOD:
case PE_LIGHTNINGBLOOD:
R_RunParticleEffect (pos, 225, 50);
break;
default:
break;
}
}
@ -515,7 +518,7 @@ R_DrawParticles (void)
VectorScale (vup, yscaleshrink, r_pup);
VectorCopy (vpn, r_ppn);
frametime = host_frametime;
frametime = r_frametime;
time3 = frametime * 15;
time2 = frametime * 10; // 15;
time1 = frametime * 5;