cvar_t cl_beams_instantaimhack = {CVAR_SAVE, "cl_beams_instantaimhack", "0", "makes your lightning gun aiming update instantly"};
cvar_t cl_beams_lightatend = {CVAR_SAVE, "cl_beams_lightatend", "0", "make a light at the end of the beam"};
+cvar_t cl_deathfade = {CVAR_SAVE, "cl_deathfade", "0", "fade screen to dark red when dead, value = how fast the fade is"};
+
cvar_t cl_noplayershadow = {CVAR_SAVE, "cl_noplayershadow", "0","hide player shadow"};
cvar_t cl_dlights_decayradius = {CVAR_SAVE, "cl_dlights_decayradius", "1", "reduces size of light flashes over time"};
Cvar_RegisterVariable (&cl_anglespeedkey);
Cvar_RegisterVariable (&cl_shownet);
Cvar_RegisterVariable (&cl_nolerp);
+ Cvar_RegisterVariable (&cl_deathfade);
Cvar_RegisterVariable (&lookspring);
Cvar_RegisterVariable (&lookstrafe);
Cvar_RegisterVariable (&sensitivity);
// how long it has been since the previous client frame in real time
// (not game time, for that use cl.time - cl.oldtime)
double realframetime;
+
+ // fade var for fading while dead
+ float deathfade;
// copy of realtime from last recieved message, for net trouble icon
float last_received_message;
a2 = 1 / r_refdef.viewblend[3];
VectorScale(r_refdef.viewblend, a2, r_refdef.viewblend);
}
-
- r_refdef.viewblend[0] = bound(0.0f, r_refdef.viewblend[0] * (1.0f/255.0f), 1.0f);
- r_refdef.viewblend[1] = bound(0.0f, r_refdef.viewblend[1] * (1.0f/255.0f), 1.0f);
- r_refdef.viewblend[2] = bound(0.0f, r_refdef.viewblend[2] * (1.0f/255.0f), 1.0f);
- r_refdef.viewblend[3] = bound(0.0f, r_refdef.viewblend[3] * gl_polyblend.value, 1.0f);
+ // Samual: Ugly hack, I know. But it's the best we can do since
+ // there is no way to detect client states from the engine.
+ if (cl.stats[STAT_HEALTH] <= 0 && cl.stats[STAT_HEALTH] != -666 &&
+ cl.stats[STAT_HEALTH] != -2342 && cl_deathfade.value > 0)
+ {
+ cl.deathfade += bound(0.0f, cl_deathfade.value, 2.0f) * max(0.0001, cl.time - cl.oldtime);
+ r_refdef.viewblend[0] = 0.3f;
+ r_refdef.viewblend[1] = 0.0f;
+ r_refdef.viewblend[2] = 0.0f;
+ r_refdef.viewblend[3] = bound(0.0f, cl.deathfade, 0.9f);
+ }
+ else
+ {
+ cl.deathfade = 0.0f;
+ r_refdef.viewblend[0] = bound(0.0f, r_refdef.viewblend[0] * (1.0f/255.0f), 1.0f);
+ r_refdef.viewblend[1] = bound(0.0f, r_refdef.viewblend[1] * (1.0f/255.0f), 1.0f);
+ r_refdef.viewblend[2] = bound(0.0f, r_refdef.viewblend[2] * (1.0f/255.0f), 1.0f);
+ r_refdef.viewblend[3] = bound(0.0f, r_refdef.viewblend[3] * gl_polyblend.value, 1.0f);
+ }
}
}