-// if (gl_cshiftpercent.value)
-// {
- for (j=0 ; j<NUM_CSHIFTS ; j++)
- {
-// a2 = ((cl.cshifts[j].percent * gl_cshiftpercent.value) / 100.0) / 255.0;
- a2 = cl.cshifts[j].percent * (1.0f / 255.0f);
-
- if (!a2)
- continue;
- if (a2 > 1)
- a2 = 1;
- r += (cl.cshifts[j].destcolor[0]-r) * a2;
- g += (cl.cshifts[j].destcolor[1]-g) * a2;
- b += (cl.cshifts[j].destcolor[2]-b) * a2;
- a = 1 - (1 - a) * (1 - a2); // correct alpha multiply... took a while to find it on the web
- }
- // saturate color (to avoid blending in black)
- if (a)
- {
- a2 = 1 / a;
- r *= a2;
- g *= a2;
- b *= a2;
- }
-// }
-
- v_blend[0] = bound(0, r * (1.0/255.0), 1);
- v_blend[1] = bound(0, g * (1.0/255.0), 1);
- v_blend[2] = bound(0, b * (1.0/255.0), 1);
- v_blend[3] = bound(0, a , 1);
-}
-
-/*
-=============
-V_UpdateBlends
-=============
-*/
-void V_UpdateBlends (void)
-{
- int i, j;
- qboolean new;
-
- V_CalcPowerupCshift ();
-
- new = false;
-
- for (i=0 ; i<NUM_CSHIFTS ; i++)
- {
- if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent)
- {
- new = true;
- cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
- }
- for (j=0 ; j<3 ; j++)
- if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
- {
- new = true;
- cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
- }
- }
-
-// drop the damage value
- cl.cshifts[CSHIFT_DAMAGE].percent -= (cl.time - cl.oldtime)*150;
- if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
- cl.cshifts[CSHIFT_DAMAGE].percent = 0;
-
-// drop the bonus value
- cl.cshifts[CSHIFT_BONUS].percent -= (cl.time - cl.oldtime)*100;
- if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
- cl.cshifts[CSHIFT_BONUS].percent = 0;
-
- if (!new)
- return;
-
- V_CalcBlend ();
-}
-
-/*
-==============================================================================
-
- VIEW RENDERING
-
-==============================================================================
-*/
-
-float angledelta (float a)
-{
- a = anglemod(a);
- if (a > 180)
- a -= 360;
- return a;
-}
-
-/*
-==================
-CalcGunAngle
-==================
-*/
-void CalcGunAngle (void)
-{
- /*
- float yaw, pitch, move;
- static float oldyaw = 0;
- static float oldpitch = 0;
-
- yaw = r_refdef.viewangles[YAW];
- pitch = -r_refdef.viewangles[PITCH];
-
- yaw = angledelta(yaw - r_refdef.viewangles[YAW]) * 0.4;
- if (yaw > 10)
- yaw = 10;
- if (yaw < -10)
- yaw = -10;
- pitch = angledelta(-pitch - r_refdef.viewangles[PITCH]) * 0.4;
- if (pitch > 10)
- pitch = 10;
- if (pitch < -10)
- pitch = -10;
- move = cl.frametime*20;
- if (yaw > oldyaw)