cl.cshifts[CSHIFT_BONUS].percent = 50;
cl.cshifts[CSHIFT_BONUS].alphafade = 100;
}
- else if(Cmd_Argc() == 6)
+ else if(Cmd_Argc() >= 4 && Cmd_Argc() <= 6)
{
cl.cshifts[CSHIFT_BONUS].destcolor[0] = atof(Cmd_Argv(1)) * 255;
cl.cshifts[CSHIFT_BONUS].destcolor[1] = atof(Cmd_Argv(2)) * 255;
cl.cshifts[CSHIFT_BONUS].destcolor[2] = atof(Cmd_Argv(3)) * 255;
- cl.cshifts[CSHIFT_BONUS].percent = atof(Cmd_Argv(4)) * 255; // yes, these are HEXADECIMAL percent ;)
- cl.cshifts[CSHIFT_BONUS].alphafade = atof(Cmd_Argv(5)) * 255;
+ if(Cmd_Argc() >= 5)
+ cl.cshifts[CSHIFT_BONUS].percent = atof(Cmd_Argv(4)) * 255; // yes, these are HEXADECIMAL percent ;)
+ else
+ cl.cshifts[CSHIFT_BONUS].percent = 50;
+ if(Cmd_Argc() >= 6)
+ cl.cshifts[CSHIFT_BONUS].alphafade = atof(Cmd_Argv(5)) * 255;
+ else
+ cl.cshifts[CSHIFT_BONUS].alphafade = 100;
}
else
- Con_Printf("usage:\nbf, or bf R G B A alphafade\n");
+ Con_Printf("usage:\nbf, or bf R G B [A [alphafade]]\n");
}
/*
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 += cl_deathfade.value * max(0.00001, cl.time - cl.oldtime);
+ cl.deathfade = bound(0.0f, cl.deathfade, 0.9f);
+ }
+ else
+ cl.deathfade = 0.0f;
+
+ if(cl.deathfade > 0)
+ {
+ float a;
+ float deathfadevec[3] = {0.3f, 0.0f, 0.0f};
+ a = r_refdef.viewblend[3] + cl.deathfade - r_refdef.viewblend[3]*cl.deathfade;
+ if(a > 0)
+ VectorMAM(r_refdef.viewblend[3] * (1 - cl.deathfade) / a, r_refdef.viewblend, cl.deathfade / a, deathfadevec, r_refdef.viewblend);
+ r_refdef.viewblend[3] = a;
+ }
}
}
void V_Init (void)
{
Cmd_AddCommand ("v_cshift", V_cshift_f, "sets tint color of view");
- Cmd_AddCommand ("bf", V_BonusFlash_f, "briefly flashes a bright color tint on view (used when items are picked up); optionally takes R G B A alphafade arguments to specify how the flash looks");
+ Cmd_AddCommand ("bf", V_BonusFlash_f, "briefly flashes a bright color tint on view (used when items are picked up); optionally takes R G B [A [alphafade]] arguments to specify how the flash looks");
Cmd_AddCommand ("centerview", V_StartPitchDrift, "gradually recenter view (stop looking up/down)");
Cvar_RegisterVariable (&v_centermove);