From Khaladrogo, 7 Months ago, written in Plain Text.
Embed
  1. /*This code should work for all source ports of Quake that have the Intermission camera animation.*/
  2. /*First, find the V_CalcRefdef function in view.c*/
  3. /*Next, skip down to the line where V_AddIdle() first appears.*/
  4. /*Replace it with the following:*/
  5.         float old = v_idlescale.value;//This may not comply with C99.  Instantiate this variable at the beginning of the function.
  6.         v_idlescale.value = 1;
  7.         V_AddIdle();
  8.         v_idlescale.value = old;
  9. /*Now build the code, and see how it looks.  I kinda like it myself.*/
  10.  
  11. //Here's my "improved" variant of the above.  It uses an extra variable, that stores the abs value of velocity vector.
  12. //Again, you may need to instatiate both these variables at the beginning of the function.
  13.         float old = v_idlescale.value;
  14.         float absVel = q_max(fabs(cl.velocity[0]),fabs(cl.velocity[1]));
  15.  
  16.         if (absVel < 200.0f)//we do not want to idle when player moves, duh.
  17.         {
  18.                 //"lerp" to an idlescale of 2.
  19.                 v_idlescale.value = 0.01f*(200.0f - absVel);
  20.         }
  21.         else v_idlescale.value = 0;
  22.         V_AddIdle();
  23.         v_idlescale.value = old;
  24. //Let me know how crappy this is or not.