diff options
author | Andrey Nazarov <skuller@skuller.net> | 2010-03-03 19:39:22 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2010-03-03 19:39:22 +0000 |
commit | 8d5345be32ece1e2e396d2bd3499ded790cb9a8c (patch) | |
tree | 663dd8d43a5362dda8059613d980011dc2cc5b32 | |
parent | bcabef4d17896c4dd5b4f0b67f26cabff4b167ea (diff) |
Don't build client side dynamic lighting code unless software refresh is in use.
Renamed USE_DYNAMIC to USE_DLIGHTS.
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | source/cl_ents.c | 12 | ||||
-rw-r--r-- | source/cl_fx.c | 318 | ||||
-rw-r--r-- | source/cl_local.h | 25 | ||||
-rw-r--r-- | source/cl_main.c | 2 | ||||
-rw-r--r-- | source/cl_newfx.c | 2 | ||||
-rw-r--r-- | source/cl_parse.c | 35 | ||||
-rw-r--r-- | source/cl_tent.c | 4 | ||||
-rw-r--r-- | source/cl_view.c | 23 | ||||
-rw-r--r-- | source/gl_main.c | 6 | ||||
-rw-r--r-- | source/gl_world.c | 8 |
11 files changed, 263 insertions, 173 deletions
@@ -538,6 +538,7 @@ if [ "$use_ref" != "no" ]; then echo "#define DEFAULT_OPENGL_DRIVER \"$gldriver\"" >> $config_h else echo "#define USE_LIGHTSTYLES 1" >> $config_h + echo "#define USE_DLIGHTS 1" >> $config_h fi echo "#define VID_REF \"$use_ref\"" >> $config_h echo "#define VID_MODELIST \"$vid_modelist\"" >> $config_h diff --git a/source/cl_ents.c b/source/cl_ents.c index fb99c82..33473d9 100644 --- a/source/cl_ents.c +++ b/source/cl_ents.c @@ -603,14 +603,16 @@ static void CL_AddPacketEntities( void ) { } else if (effects & EF_BFG) { - static const int bfg_lightramp[6] = {300, 400, 600, 300, 150, 75}; - if (effects & EF_ANIM_ALLFAST) { CL_BfgParticles (&ent); +#if USE_DLIGHTS i = 200; } else { + static const int bfg_lightramp[6] = {300, 400, 600, 300, 150, 75}; + i = s1->frame; clamp( i, 0, 5 ); i = bfg_lightramp[i]; +#endif } V_AddLight (ent.origin, i, 0, 1, 0); } @@ -619,8 +621,10 @@ static void CL_AddPacketEntities( void ) { { ent.origin[2] += 32; CL_TrapParticles (&ent); +#if USE_DLIGHTS i = (rand()%100) + 100; V_AddLight (ent.origin, i, 1, 0.8, 0.1); +#endif } else if (effects & EF_FLAG1) { @@ -643,10 +647,12 @@ static void CL_AddPacketEntities( void ) { { if (effects & EF_TRACKER) { +#if USE_DLIGHTS float intensity; intensity = 50 + (500 * (sin(cl.time/500.0) + 1.0)); V_AddLight (ent.origin, intensity, -1.0, -1.0, -1.0); +#endif } else { @@ -982,7 +988,9 @@ void CL_AddEntities( void ) { CL_AddPacketEntities(); CL_AddTEnts(); CL_AddParticles(); +#if USE_DLIGHTS CL_AddDLights(); +#endif #if USE_LIGHTSTYLES CL_AddLightStyles(); #endif diff --git a/source/cl_fx.c b/source/cl_fx.c index ef32f7f..d302256 100644 --- a/source/cl_fx.c +++ b/source/cl_fx.c @@ -119,6 +119,8 @@ DLIGHT MANAGEMENT ============================================================== */ +#if USE_DLIGHTS + static cdlight_t cl_dlights[MAX_DLIGHTS]; static void clear_dlights (void) { @@ -218,6 +220,8 @@ void CL_AddDLights (void) } } +#endif + // ============================================================== /* @@ -227,25 +231,18 @@ CL_ParseMuzzleFlash */ void CL_ParseMuzzleFlash (void) { +#if USE_DLIGHTS vec3_t fv, rv; cdlight_t *dl; - int i, weapon; +#endif centity_t *pl; - int silenced; float volume; char soundname[MAX_QPATH]; - i = MSG_ReadShort (); - if (i < 1 || i >= MAX_EDICTS) - Com_Error (ERR_DROP, "CL_ParseMuzzleFlash: bad entity"); - - weapon = MSG_ReadByte (); - silenced = weapon & MZ_SILENCED; - weapon &= ~MZ_SILENCED; + pl = &cl_entities[mz.entity]; - pl = &cl_entities[i]; - - dl = CL_AllocDlight (i); +#if USE_DLIGHTS + dl = CL_AllocDlight (mz.entity); VectorCopy (pl->current.origin, dl->origin); AngleVectors (pl->current.angles, fv, rv, NULL); VectorMA (dl->origin, 18, fv, dl->origin); @@ -256,154 +253,162 @@ void CL_ParseMuzzleFlash (void) dl->radius = 200 + (rand()&31); dl->minlight = 32; dl->die = cl.time; // + 0.1; +#define DL_COLOR(r,g,b) VectorSet(dl->color,r,g,b) +#define DL_RADIUS(r) (dl->radius=r) +#define DL_DIE(t) (dl->die=cl.time+t) +#else +#define DL_COLOR(r,g,b) +#define DL_RADIUS(r) +#define DL_DIE(t) +#endif - if (silenced) + if (mz.silenced) volume = 0.2; else volume = 1; - switch (weapon) + switch (mz.weapon) { case MZ_BLASTER: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0); break; case MZ_BLUEHYPERBLASTER: - dl->color[0] = 0;dl->color[1] = 0;dl->color[2] = 1; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0); + DL_COLOR(0,0,1); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0); break; case MZ_HYPERBLASTER: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0); break; case MZ_MACHINEGUN: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); Q_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); break; case MZ_SHOTGUN: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0); - S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/shotgr1b.wav"), volume, ATTN_NORM, 0.1); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_AUTO, S_RegisterSound("weapons/shotgr1b.wav"), volume, ATTN_NORM, 0.1); break; case MZ_SSHOTGUN: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0); break; case MZ_CHAINGUN1: - dl->radius = 200 + (rand()&31); - dl->color[0] = 1;dl->color[1] = 0.25;dl->color[2] = 0; + DL_RADIUS(200 + (rand()&31)); + DL_COLOR(1,0.25,0); Q_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); break; case MZ_CHAINGUN2: - dl->radius = 225 + (rand()&31); - dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0; - dl->die = cl.time + 0.1; // long delay + DL_RADIUS(225 + (rand()&31)); + DL_COLOR(1,0.5,0); + DL_DIE(0.1); // long delay Q_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); Q_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.05); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.05); break; case MZ_CHAINGUN3: - dl->radius = 250 + (rand()&31); - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - dl->die = cl.time + 0.1; // long delay + DL_RADIUS(250 + (rand()&31)); + DL_COLOR(1,1,0); + DL_DIE(0.1); // long delay Q_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); Q_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033); Q_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066); break; case MZ_RAILGUN: - dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/railgf1a.wav"), volume, ATTN_NORM, 0); + DL_COLOR(0.5,0.5,1.0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/railgf1a.wav"), volume, ATTN_NORM, 0); break; case MZ_ROCKET: - dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/rocklf1a.wav"), volume, ATTN_NORM, 0); - S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/rocklr1b.wav"), volume, ATTN_NORM, 0.1); + DL_COLOR(1,0.5,0.2); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/rocklf1a.wav"), volume, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_AUTO, S_RegisterSound("weapons/rocklr1b.wav"), volume, ATTN_NORM, 0.1); break; case MZ_GRENADE: - dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), volume, ATTN_NORM, 0); - S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/grenlr1b.wav"), volume, ATTN_NORM, 0.1); + DL_COLOR(1,0.5,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), volume, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_AUTO, S_RegisterSound("weapons/grenlr1b.wav"), volume, ATTN_NORM, 0.1); break; case MZ_BFG: - dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/bfg__f1y.wav"), volume, ATTN_NORM, 0); + DL_COLOR(0,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/bfg__f1y.wav"), volume, ATTN_NORM, 0); break; case MZ_LOGIN: - dl->color[0] = 0;dl->color[1] = 1; dl->color[2] = 0; - dl->die = cl.time + 1.0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0); - CL_LogoutEffect (pl->current.origin, weapon); + DL_COLOR(0,1,0); + DL_DIE(1.0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0); + CL_LogoutEffect (pl->current.origin, mz.weapon); break; case MZ_LOGOUT: - dl->color[0] = 1;dl->color[1] = 0; dl->color[2] = 0; - dl->die = cl.time + 1.0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0); - CL_LogoutEffect (pl->current.origin, weapon); + DL_COLOR(1,0,0); + DL_DIE(1.0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0); + CL_LogoutEffect (pl->current.origin, mz.weapon); break; case MZ_RESPAWN: - dl->color[0] = 1;dl->color[1] = 1; dl->color[2] = 0; - dl->die = cl.time + 1.0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0); - CL_LogoutEffect (pl->current.origin, weapon); + DL_COLOR(1,1,0); + DL_DIE(1.0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0); + CL_LogoutEffect (pl->current.origin, mz.weapon); break; // RAFAEL case MZ_PHALANX: - dl->color[0] = 1;dl->color[1] = 0.5; dl->color[2] = 0.5; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/plasshot.wav"), volume, ATTN_NORM, 0); + DL_COLOR(1,0.5,0.5); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/plasshot.wav"), volume, ATTN_NORM, 0); break; // RAFAEL case MZ_IONRIPPER: - dl->color[0] = 1;dl->color[1] = 0.5; dl->color[2] = 0.5; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/rippfiref.wav"), volume, ATTN_NORM, 0); + DL_COLOR(1,0.5,0.5); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/rippfiref.wav"), volume, ATTN_NORM, 0); break; // ====================== // PGM case MZ_ETF_RIFLE: - dl->color[0] = 0.9;dl->color[1] = 0.7;dl->color[2] = 0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/nail1.wav"), volume, ATTN_NORM, 0); + DL_COLOR(0.9,0.7,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/nail1.wav"), volume, ATTN_NORM, 0); break; case MZ_SHOTGUN2: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/shotg2.wav"), volume, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/shotg2.wav"), volume, ATTN_NORM, 0); break; case MZ_HEATBEAM: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - dl->die = cl.time + 100; -// S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/bfg__l1a.wav"), volume, ATTN_NORM, 0); + DL_COLOR(1,1,0); + DL_DIE(100); +// S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/bfg__l1a.wav"), volume, ATTN_NORM, 0); break; case MZ_BLASTER2: - dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(0,1,0); // FIXME - different sound for blaster2 ?? - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0); break; case MZ_TRACKER: // negative flashes handled the same in gl/soft until CL_AddDLights - dl->color[0] = -1;dl->color[1] = -1;dl->color[2] = -1; - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/disint2.wav"), volume, ATTN_NORM, 0); + DL_COLOR(-1,-1,-1); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/disint2.wav"), volume, ATTN_NORM, 0); break; case MZ_NUKE1: - dl->color[0] = 1;dl->color[1] = 0;dl->color[2] = 0; - dl->die = cl.time + 100; + DL_COLOR(1,0,0); + DL_DIE(100); break; case MZ_NUKE2: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - dl->die = cl.time + 100; + DL_COLOR(1,1,0); + DL_DIE(100); break; case MZ_NUKE4: - dl->color[0] = 0;dl->color[1] = 0;dl->color[2] = 1; - dl->die = cl.time + 100; + DL_COLOR(0,0,1); + DL_DIE(100); break; case MZ_NUKE8: - dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 1; - dl->die = cl.time + 100; + DL_COLOR(0,1,1); + DL_DIE(100); break; // PGM // ====================== @@ -418,35 +423,32 @@ CL_ParseMuzzleFlash2 */ void CL_ParseMuzzleFlash2 (void) { - int ent; + centity_t *ent; vec3_t origin; - int flash_number; + const vec_t *ofs; +#if USE_DLIGHTS cdlight_t *dl; +#endif vec3_t forward, right; - char soundname[64]; - - ent = MSG_ReadShort (); - if (ent < 1 || ent >= MAX_EDICTS) - Com_Error (ERR_DROP, "CL_ParseMuzzleFlash2: bad entity"); - - flash_number = MSG_ReadByte (); - if( flash_number == -1 ) { - Com_Error (ERR_DROP, "CL_ParseMuzzleFlash2: read past end of message"); - } + char soundname[MAX_QPATH]; // locate the origin - AngleVectors (cl_entities[ent].current.angles, forward, right, NULL); - origin[0] = cl_entities[ent].current.origin[0] + forward[0] * monster_flash_offset[flash_number][0] + right[0] * monster_flash_offset[flash_number][1]; - origin[1] = cl_entities[ent].current.origin[1] + forward[1] * monster_flash_offset[flash_number][0] + right[1] * monster_flash_offset[flash_number][1]; - origin[2] = cl_entities[ent].current.origin[2] + forward[2] * monster_flash_offset[flash_number][0] + right[2] * monster_flash_offset[flash_number][1] + monster_flash_offset[flash_number][2]; - - dl = CL_AllocDlight (ent); + ent = &cl_entities[mz.entity]; + AngleVectors (ent->current.angles, forward, right, NULL); + ofs = monster_flash_offset[mz.weapon]; + origin[0] = ent->current.origin[0] + forward[0] * ofs[0] + right[0] * ofs[1]; + origin[1] = ent->current.origin[1] + forward[1] * ofs[0] + right[1] * ofs[1]; + origin[2] = ent->current.origin[2] + forward[2] * ofs[0] + right[2] * ofs[1] + ofs[2]; + +#if USE_DLIGHTS + dl = CL_AllocDlight (mz.entity); VectorCopy (origin, dl->origin); dl->radius = 200 + (rand()&31); dl->minlight = 32; dl->die = cl.time; // + 0.1; +#endif - switch (flash_number) + switch (mz.weapon) { case MZ2_INFANTRY_MACHINEGUN_1: case MZ2_INFANTRY_MACHINEGUN_2: @@ -461,10 +463,10 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_INFANTRY_MACHINEGUN_11: case MZ2_INFANTRY_MACHINEGUN_12: case MZ2_INFANTRY_MACHINEGUN_13: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0); break; case MZ2_SOLDIER_MACHINEGUN_1: @@ -475,10 +477,10 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_SOLDIER_MACHINEGUN_6: case MZ2_SOLDIER_MACHINEGUN_7: case MZ2_SOLDIER_MACHINEGUN_8: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck3.wav"), 1, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("soldier/solatck3.wav"), 1, ATTN_NORM, 0); break; case MZ2_GUNNER_MACHINEGUN_1: @@ -489,10 +491,10 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_GUNNER_MACHINEGUN_6: case MZ2_GUNNER_MACHINEGUN_7: case MZ2_GUNNER_MACHINEGUN_8: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0); break; case MZ2_ACTOR_MACHINEGUN_1: @@ -503,11 +505,10 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_SUPERTANK_MACHINEGUN_5: case MZ2_SUPERTANK_MACHINEGUN_6: case MZ2_TURRET_MACHINEGUN: // PGM - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0); break; case MZ2_BOSS2_MACHINEGUN_L1: @@ -517,11 +518,10 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_BOSS2_MACHINEGUN_L5: case MZ2_CARRIER_MACHINEGUN_L1: // PMM case MZ2_CARRIER_MACHINEGUN_L2: // PMM - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NONE, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NONE, 0); break; case MZ2_SOLDIER_BLASTER_1: @@ -533,29 +533,29 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_SOLDIER_BLASTER_7: case MZ2_SOLDIER_BLASTER_8: case MZ2_TURRET_BLASTER: // PGM - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck2.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("soldier/solatck2.wav"), 1, ATTN_NORM, 0); break; case MZ2_FLYER_BLASTER_1: case MZ2_FLYER_BLASTER_2: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("flyer/flyatck3.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("flyer/flyatck3.wav"), 1, ATTN_NORM, 0); break; case MZ2_MEDIC_BLASTER_1: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("medic/medatck1.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("medic/medatck1.wav"), 1, ATTN_NORM, 0); break; case MZ2_HOVER_BLASTER_1: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("hover/hovatck1.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("hover/hovatck1.wav"), 1, ATTN_NORM, 0); break; case MZ2_FLOAT_BLASTER_1: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("floater/fltatck1.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("floater/fltatck1.wav"), 1, ATTN_NORM, 0); break; case MZ2_SOLDIER_SHOTGUN_1: @@ -566,16 +566,16 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_SOLDIER_SHOTGUN_6: case MZ2_SOLDIER_SHOTGUN_7: case MZ2_SOLDIER_SHOTGUN_8: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); CL_SmokeAndFlash(origin); - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck1.wav"), 1, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("soldier/solatck1.wav"), 1, ATTN_NORM, 0); break; case MZ2_TANK_BLASTER_1: case MZ2_TANK_BLASTER_2: case MZ2_TANK_BLASTER_3: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0); break; case MZ2_TANK_MACHINEGUN_1: @@ -597,24 +597,24 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_TANK_MACHINEGUN_17: case MZ2_TANK_MACHINEGUN_18: case MZ2_TANK_MACHINEGUN_19: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); Q_snprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + rand() % 5); - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound(soundname), 1, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound(soundname), 1, ATTN_NORM, 0); break; case MZ2_CHICK_ROCKET_1: case MZ2_TURRET_ROCKET: // PGM - dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("chick/chkatck2.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,0.5,0.2); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("chick/chkatck2.wav"), 1, ATTN_NORM, 0); break; case MZ2_TANK_ROCKET_1: case MZ2_TANK_ROCKET_2: case MZ2_TANK_ROCKET_3: - dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck1.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,0.5,0.2); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("tank/tnkatck1.wav"), 1, ATTN_NORM, 0); break; case MZ2_SUPERTANK_ROCKET_1: @@ -628,16 +628,16 @@ void CL_ParseMuzzleFlash2 (void) // case MZ2_CARRIER_ROCKET_2: // case MZ2_CARRIER_ROCKET_3: // case MZ2_CARRIER_ROCKET_4: - dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/rocket.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,0.5,0.2); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("tank/rocket.wav"), 1, ATTN_NORM, 0); break; case MZ2_GUNNER_GRENADE_1: case MZ2_GUNNER_GRENADE_2: case MZ2_GUNNER_GRENADE_3: case MZ2_GUNNER_GRENADE_4: - dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck3.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,0.5,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("gunner/gunatck3.wav"), 1, ATTN_NORM, 0); break; case MZ2_GLADIATOR_RAILGUN_1: @@ -645,13 +645,13 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_CARRIER_RAILGUN: case MZ2_WIDOW_RAIL: // pmm - dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0; + DL_COLOR(0.5,0.5,1.0); break; // --- Xian's shit starts --- case MZ2_MAKRON_BFG: - dl->color[0] = 0.5;dl->color[1] = 1 ;dl->color[2] = 0.5; - //S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("makron/bfg_firef.wav"), 1, ATTN_NORM, 0); + DL_COLOR(0.5,1,0.5); + //S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("makron/bfg_firef.wav"), 1, ATTN_NORM, 0); break; case MZ2_MAKRON_BLASTER_1: @@ -671,8 +671,8 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_MAKRON_BLASTER_15: case MZ2_MAKRON_BLASTER_16: case MZ2_MAKRON_BLASTER_17: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("makron/blaster.wav"), 1, ATTN_NORM, 0); + DL_COLOR(1,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("makron/blaster.wav"), 1, ATTN_NORM, 0); break; case MZ2_JORG_MACHINEGUN_L1: @@ -681,10 +681,10 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_JORG_MACHINEGUN_L4: case MZ2_JORG_MACHINEGUN_L5: case MZ2_JORG_MACHINEGUN_L6: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("boss3/xfiref.wav"), 1, ATTN_NORM, 0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("boss3/xfiref.wav"), 1, ATTN_NORM, 0); break; case MZ2_JORG_MACHINEGUN_R1: @@ -693,13 +693,13 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_JORG_MACHINEGUN_R4: case MZ2_JORG_MACHINEGUN_R5: case MZ2_JORG_MACHINEGUN_R6: - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); break; case MZ2_JORG_BFG_1: - dl->color[0] = 0.5;dl->color[1] = 1 ;dl->color[2] = 0.5; + DL_COLOR(0.5,1,0.5); break; case MZ2_BOSS2_MACHINEGUN_R1: @@ -709,7 +709,7 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_BOSS2_MACHINEGUN_R5: case MZ2_CARRIER_MACHINEGUN_R1: // PMM case MZ2_CARRIER_MACHINEGUN_R2: // PMM - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; + DL_COLOR(1,1,0); CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_SmokeAndFlash(origin); break; @@ -755,13 +755,13 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_WIDOW_RUN_6: case MZ2_WIDOW_RUN_7: case MZ2_WIDOW_RUN_8: - dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0); + DL_COLOR(0,1,0); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0); break; case MZ2_WIDOW_DISRUPTOR: - dl->color[0] = -1;dl->color[1] = -1;dl->color[2] = -1; - S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/disint2.wav"), 1, ATTN_NORM, 0); + DL_COLOR(-1,-1,-1); + S_StartSound (NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/disint2.wav"), 1, ATTN_NORM, 0); break; case MZ2_WIDOW_PLASMABEAM: @@ -781,9 +781,9 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_WIDOW2_BEAM_SWEEP_9: case MZ2_WIDOW2_BEAM_SWEEP_10: case MZ2_WIDOW2_BEAM_SWEEP_11: - dl->radius = 300 + (rand()&100); - dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; - dl->die = cl.time + 200; + DL_RADIUS(300 + (rand()&100)); + DL_COLOR(1,1,0); + DL_DIE(200); break; // ROGUE // ====== @@ -1904,7 +1904,9 @@ CL_ClearEffects void CL_ClearEffects (void) { clear_particles (); +#if USE_DLIGHTS clear_dlights (); +#endif #if USE_LIGHTSTYLES clear_lightstyles (); #endif diff --git a/source/cl_local.h b/source/cl_local.h index 4b367cc..05e3eaa 100644 --- a/source/cl_local.h +++ b/source/cl_local.h @@ -449,7 +449,14 @@ typedef struct { int time; } tent_params_t; +typedef struct { + int entity; + int weapon; + int silenced; +} mz_params_t; + extern tent_params_t te; +extern mz_params_t mz; qboolean CL_CheckOrDownloadFile( const char *filename ); void CL_ParseServerMessage (void); @@ -477,8 +484,14 @@ void V_Shutdown( void ); void V_RenderView( void ); void V_AddEntity (entity_t *ent); void V_AddParticle( particle_t *p ); +#if USE_DLIGHTS void V_AddLight (vec3_t org, float intensity, float r, float g, float b); +#else +#define V_AddLight(org,intensity,r,g,b) +#endif +#if USE_LIGHTSTYLES void V_AddLightStyle (int style, vec4_t value); +#endif void CL_PrepRefresh (void); // @@ -542,6 +555,7 @@ typedef struct cparticle_s { color_t rgb; } cparticle_t; +#if USE_DLIGHTS typedef struct cdlight_s { int key; // so entities can reuse same entry vec3_t color; @@ -551,9 +565,8 @@ typedef struct cdlight_s { float decay; // drop this each second float minlight; // don't add when contributing less } cdlight_t; +#endif -cdlight_t *CL_AllocDlight (int key); -cparticle_t *CL_AllocParticle( void ); void CL_BigTeleportParticles (vec3_t org); void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old); void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags); @@ -576,10 +589,14 @@ void CL_TeleporterParticles (vec3_t org); void CL_TeleportParticles (vec3_t org); void CL_ParticleEffect (vec3_t org, vec3_t dir, int color, int count); void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count); +cparticle_t *CL_AllocParticle( void ); void CL_RunParticles (void); void CL_AddParticles (void); +#if USE_DLIGHTS +cdlight_t *CL_AllocDlight (int key); void CL_RunDLights (void); void CL_AddDLights (void); +#endif #if USE_LIGHTSTYLES void CL_SetLightStyle( int index, const char *string, size_t length ); void CL_RunLightStyles (void); @@ -596,7 +613,9 @@ void CL_BlasterParticles2 (vec3_t org, vec3_t dir, unsigned int color); void CL_BlasterTrail2 (vec3_t start, vec3_t end); void CL_DebugTrail (vec3_t start, vec3_t end); void CL_SmokeTrail (vec3_t start, vec3_t end, int colorStart, int colorRun, int spacing); +#if USE_DLIGHTS void CL_Flashlight (int ent, vec3_t pos); +#endif void CL_ForceWall (vec3_t start, vec3_t end, int color); void CL_FlameEffects (centity_t *ent, vec3_t origin); void CL_GenericParticleEffect (vec3_t org, vec3_t dir, int color, int count, int numcolors, int dirspread, float alphavel); @@ -606,7 +625,9 @@ void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int m void CL_TrackerTrail (vec3_t start, vec3_t end, int particleColor); void CL_Tracker_Explode(vec3_t origin); void CL_TagTrail (vec3_t start, vec3_t end, float color); +#if USE_DLIGHTS void CL_ColorFlash (vec3_t pos, int ent, int intensity, float r, float g, float b); +#endif void CL_Tracker_Shell(vec3_t origin); void CL_MonsterPlasma_Shell(vec3_t origin); void CL_ColorExplosionParticles (vec3_t org, int color, int run); diff --git a/source/cl_main.c b/source/cl_main.c index f4869e5..0c5d93d 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -2947,7 +2947,9 @@ void CL_Frame( unsigned msec ) { } // advance local effects for next frame +#if USE_DLIGHTS CL_RunDLights(); +#endif #if USE_LIGHTSTYLES CL_RunLightStyles(); #endif diff --git a/source/cl_newfx.c b/source/cl_newfx.c index 77ebdf3..c227953 100644 --- a/source/cl_newfx.c +++ b/source/cl_newfx.c @@ -68,6 +68,7 @@ void vectoangles2 (vec3_t value1, vec3_t angles) //============= //============= +#if USE_DLIGHTS void CL_Flashlight (int ent, vec3_t pos) { cdlight_t *dl; @@ -100,6 +101,7 @@ void CL_ColorFlash (vec3_t pos, int ent, int intensity, float r, float g, float dl->color[1] = g; dl->color[2] = b; } +#endif /* diff --git a/source/cl_parse.c b/source/cl_parse.c index 5d5d856..e516631 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -1012,7 +1012,8 @@ ACTION MESSAGES ===================================================================== */ -tent_params_t te; +tent_params_t te; +mz_params_t mz; static void CL_ParseTEntParams( void ) { te.type = MSG_ReadByte(); @@ -1137,6 +1138,34 @@ static void CL_ParseTEntParams( void ) { CL_ParseTEnt(); } +static void CL_ParseMuzzleFlashParams( void ) { + int entity, weapon; + + entity = MSG_ReadShort(); + if( entity < 1 || entity >= MAX_EDICTS ) + Com_Error( ERR_DROP, "%s: bad entity", __func__ ); + + weapon = MSG_ReadByte(); + mz.silenced = weapon & MZ_SILENCED; + mz.weapon = weapon & ~MZ_SILENCED; + mz.entity = entity; + + CL_ParseMuzzleFlash(); +} + +static void CL_ParseMuzzleFlashParams2( void ) { + int entity; + + entity = MSG_ReadShort(); + if( entity < 1 || entity >= MAX_EDICTS ) + Com_Error( ERR_DROP, "%s: bad entity", __func__ ); + + mz.weapon = MSG_ReadByte(); + mz.entity = entity; + + CL_ParseMuzzleFlash2(); +} + /* ================== CL_ParseStartSoundPacket @@ -1538,11 +1567,11 @@ void CL_ParseServerMessage( void ) { break; case svc_muzzleflash: - CL_ParseMuzzleFlash(); + CL_ParseMuzzleFlashParams(); break; case svc_muzzleflash2: - CL_ParseMuzzleFlash2(); + CL_ParseMuzzleFlashParams2(); break; case svc_download: diff --git a/source/cl_tent.c b/source/cl_tent.c index 17e8807..859c04e 100644 --- a/source/cl_tent.c +++ b/source/cl_tent.c @@ -1413,7 +1413,9 @@ void CL_ParseTEnt (void) break; case TE_FLASHLIGHT: +#if USE_DLIGHTS CL_Flashlight(te.entity1, te.pos1); +#endif break; case TE_FORCEWALL: @@ -1466,7 +1468,9 @@ void CL_ParseTEnt (void) break; case TE_TRACKER_EXPLOSION: +#if USE_DLIGHTS CL_ColorFlash (te.pos1, 0, 150, -1, -1, -1); +#endif CL_ColorExplosionParticles (te.pos1, 0, 1); S_StartSound (te.pos1, 0, 0, cl_sfx_disrexp, 1, ATTN_NORM, 0); break; diff --git a/source/cl_view.c b/source/cl_view.c index c018a48..7ec19fc 100644 --- a/source/cl_view.c +++ b/source/cl_view.c @@ -31,7 +31,9 @@ qhandle_t gun_model; //============= static cvar_t *cl_add_particles; +#if USE_DLIGHTS static cvar_t *cl_add_lights; +#endif static cvar_t *cl_add_entities; static cvar_t *cl_add_blend; @@ -44,9 +46,10 @@ static cvar_t *cl_testblend; static cvar_t *cl_stats; #endif - +#if USE_DLIGHTS int r_numdlights; dlight_t r_dlights[MAX_DLIGHTS]; +#endif int r_numentities; entity_t r_entities[MAX_ENTITIES]; @@ -66,7 +69,9 @@ Specifies the model that will be used as the world ==================== */ static void V_ClearScene (void) { +#if USE_DLIGHTS r_numdlights = 0; +#endif r_numentities = 0; r_numparticles = 0; } @@ -98,6 +103,7 @@ void V_AddParticle( particle_t *p ) { r_particles[r_numparticles++] = *p; } +#if USE_DLIGHTS /* ===================== V_AddLight @@ -126,6 +132,7 @@ void V_AddLight (vec3_t org, float intensity, float r, float g, float b) { dl->color[1] = g; dl->color[2] = b; } +#endif #if USE_LIGHTSTYLES /* @@ -150,6 +157,7 @@ void V_AddLightStyle (int style, vec4_t value) { #endif #ifdef _DEBUG + /* ================ V_TestParticles @@ -210,6 +218,7 @@ static void V_TestEntities (void) { } } +#if USE_DLIGHTS /* ================ V_TestLights @@ -253,6 +262,8 @@ static void V_TestLights (void) { } #endif +#endif + //=================================================================== /* @@ -448,8 +459,10 @@ void V_RenderView( void ) { V_TestParticles (); if (cl_testentities->integer) V_TestEntities (); +#if USE_DLIGHTS if (cl_testlights->integer) V_TestLights (); +#endif if (cl_testblend->integer) { cl.refdef.blend[0] = 1; @@ -484,8 +497,10 @@ void V_RenderView( void ) { r_numentities = 0; if (!cl_add_particles->integer) r_numparticles = 0; +#if USE_DLIGHTS if (!cl_add_lights->integer) r_numdlights = 0; +#endif if (!cl_add_blend->integer) Vector4Clear (cl.refdef.blend); @@ -493,8 +508,10 @@ void V_RenderView( void ) { cl.refdef.entities = r_entities; cl.refdef.num_particles = r_numparticles; cl.refdef.particles = r_particles; +#if USE_DLIGHTS cl.refdef.num_dlights = r_numdlights; cl.refdef.dlights = r_dlights; +#endif #if USE_LIGHTSTYLES cl.refdef.lightstyles = r_lightstyles; #endif @@ -546,12 +563,16 @@ void V_Init( void ) { cl_testblend = Cvar_Get ("cl_testblend", "0", 0); cl_testparticles = Cvar_Get ("cl_testparticles", "0", 0); cl_testentities = Cvar_Get ("cl_testentities", "0", 0); +#if USE_DLIGHTS cl_testlights = Cvar_Get ("cl_testlights", "0", CVAR_CHEAT); +#endif cl_stats = Cvar_Get ("cl_stats", "0", 0); #endif +#if USE_DLIGHTS cl_add_lights = Cvar_Get ( "cl_lights", "1", 0 ); +#endif cl_add_particles = Cvar_Get ( "cl_particles", "1", 0 ); cl_add_entities = Cvar_Get ( "cl_entities", "1", 0 ); cl_add_blend = Cvar_Get ( "cl_blend", "1", CVAR_ARCHIVE ); diff --git a/source/gl_main.c b/source/gl_main.c index b192bc7..2a8c2f6 100644 --- a/source/gl_main.c +++ b/source/gl_main.c @@ -59,7 +59,7 @@ cvar_t *gl_clear; cvar_t *gl_novis; cvar_t *gl_lockpvs; cvar_t *gl_lightmap; -#if USE_DYNAMIC +#if USE_DLIGHTS cvar_t *gl_dynamic; #endif cvar_t *gl_polyblend; @@ -451,7 +451,7 @@ void R_RenderFrame( refdef_t *fd ) { glr.fd = *fd; glr.num_beams = 0; -#if USE_DYNAMIC +#if USE_DLIGHTS if( !gl_dynamic->integer ) { glr.fd.num_dlights = 0; } @@ -714,7 +714,7 @@ static void GL_Register( void ) { gl_novis = Cvar_Get( "gl_novis", "0", 0 ); gl_lockpvs = Cvar_Get( "gl_lockpvs", "0", CVAR_CHEAT ); gl_lightmap = Cvar_Get( "gl_lightmap", "0", CVAR_CHEAT ); -#if USE_DYNAMIC +#if USE_DLIGHTS gl_dynamic = Cvar_Get( "gl_dynamic", "2", CVAR_ARCHIVE ); #endif gl_polyblend = Cvar_Get( "gl_polyblend", "1", 0 ); diff --git a/source/gl_world.c b/source/gl_world.c index a83eec9..6edc24b 100644 --- a/source/gl_world.c +++ b/source/gl_world.c @@ -74,7 +74,7 @@ qboolean GL_LightPoint( vec3_t origin, vec3_t color ) { return qtrue; } -#if USE_DYNAMIC +#if USE_DLIGHTS static void GL_MarkLights_r( mnode_t *node, dlight_t *light ) { vec_t dot; int count; @@ -172,7 +172,7 @@ void _R_LightPoint( vec3_t origin, vec3_t color ) { VectorSet( color, 1, 1, 1 ); } -#if USE_DYNAMIC +#if USE_DLIGHTS if( gl_dynamic->integer ) { // add dynamic lights GL_AddLights( origin, color ); @@ -328,7 +328,7 @@ void GL_DrawBspModel( mmodel_t *model ) { glr.drawframe++; -#if USE_DYNAMIC +#if USE_DLIGHTS if( gl_dynamic->integer ) { GL_TransformLights( model ); } @@ -456,7 +456,7 @@ static void GL_WorldNode_r( mnode_t *node, int clipflags ) { void GL_DrawWorld( void ) { GL_MarkLeaves(); -#if USE_DYNAMIC +#if USE_DLIGHTS if( gl_dynamic->integer ) { GL_MarkLights(); } |