]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/dynamic_hud
authorterencehill <piuntn@gmail.com>
Wed, 23 Mar 2016 21:58:50 +0000 (22:58 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 23 Mar 2016 21:58:50 +0000 (22:58 +0100)
Conflicts:
qcsrc/client/view.qc

1  2 
qcsrc/client/autocvars.qh
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/hud_config.qc
qcsrc/client/main.qc
qcsrc/client/view.qc
qcsrc/menu/xonotic/dialog_settings_game_hud.qc

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index f2c0204e586967099b4d92468a1641ca2a3ae1a6,8d001cb5920979590328368c366d56ab5eb9c434..8aeac192633cdf5a84ef341f308a3dd221f65064
@@@ -109,99 -114,17 +114,99 @@@ float autocvar_cl_leanmodel_lowpass = 0
        highpass(value.z, frac, ref_store.z, ref_out.z); \
  } MACRO_END
  
 -void viewmodel_animate(entity this)
 +void calc_followmodel_ofs(entity view)
  {
 -      static float prevtime;
 -      float frametime = (time - prevtime);
 -      prevtime = time;
 +      if(cl_followmodel_time == time)
 +              return; // cl_followmodel_ofs already calculated for this frame
  
 -      if (autocvar_chase_active) return;
 -      if (STAT(HEALTH) <= 0) return;
 +      float frac;
 +      vector gunorg = '0 0 0';
 +      static vector vel_average;
 +      static vector gunorg_prev = '0 0 0';
 +      static vector gunorg_adjustment_highpass;
 +      static vector gunorg_adjustment_lowpass;
 +
 +      vector vel;
 +      if (autocvar_cl_followmodel_velocity_absolute)
 +              vel = view.velocity;
 +      else
 +      {
-               vector forward, right = '0 0 0', up = '0 0 0';
++              vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
 +              MAKEVECTORS(makevectors, view_angles, forward, right, up);
 +              vel.x = view.velocity * forward;
 +              vel.y = view.velocity * right * -1;
 +              vel.z = view.velocity * up;
 +      }
  
 -      entity view = CSQCModel_server2csqc(player_localentnum - 1);
 +      vel.x = bound(vel_average.x - autocvar_cl_followmodel_limit, vel.x, vel_average.x + autocvar_cl_followmodel_limit);
 +      vel.y = bound(vel_average.y - autocvar_cl_followmodel_limit, vel.y, vel_average.y + autocvar_cl_followmodel_limit);
 +      vel.z = bound(vel_average.z - autocvar_cl_followmodel_limit, vel.z, vel_average.z + autocvar_cl_followmodel_limit);
 +
 +      frac = avg_factor(autocvar_cl_followmodel_velocity_lowpass);
 +      lowpass3(vel, frac, vel_average, gunorg);
 +
 +      gunorg *= -autocvar_cl_followmodel_speed * 0.042;
 +
 +      // perform highpass/lowpass on the adjustment vectors (turning velocity into acceleration!)
 +      // trick: we must do the lowpass LAST, so the lowpass vector IS the final vector!
 +      frac = avg_factor(autocvar_cl_followmodel_highpass);
 +      highpass3(gunorg, frac, gunorg_adjustment_highpass, gunorg);
 +      frac = avg_factor(autocvar_cl_followmodel_lowpass);
 +      lowpass3(gunorg, frac, gunorg_adjustment_lowpass, gunorg);
 +
 +      if (autocvar_cl_followmodel_velocity_absolute)
 +      {
 +              vector fixed_gunorg;
-               vector forward, right = '0 0 0', up = '0 0 0';
++              vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
 +              MAKEVECTORS(makevectors, view_angles, forward, right, up);
 +              fixed_gunorg.x = gunorg * forward;
 +              fixed_gunorg.y = gunorg * right * -1;
 +              fixed_gunorg.z = gunorg * up;
 +              gunorg = fixed_gunorg;
 +      }
 +
 +      cl_followmodel_ofs = gunorg;
 +      cl_followmodel_time = time;
 +}
 +
 +vector leanmodel_ofs(entity view)
 +{
 +      float frac;
 +      vector gunangles = '0 0 0';
 +      static vector gunangles_prev = '0 0 0';
 +      static vector gunangles_highpass = '0 0 0';
 +      static vector gunangles_adjustment_highpass;
 +      static vector gunangles_adjustment_lowpass;
 +
 +      if (view.csqcmodel_teleported)
 +              gunangles_prev = view_angles;
 +
 +      // in the highpass, we _store_ the DIFFERENCE to the actual view angles...
 +      gunangles_highpass += gunangles_prev;
 +      PITCH(gunangles_highpass) += 360 * floor((PITCH(view_angles) - PITCH(gunangles_highpass)) / 360 + 0.5);
 +      YAW(gunangles_highpass) += 360 * floor((YAW(view_angles) - YAW(gunangles_highpass)) / 360 + 0.5);
 +      ROLL(gunangles_highpass) += 360 * floor((ROLL(view_angles) - ROLL(gunangles_highpass)) / 360 + 0.5);
 +      frac = avg_factor(autocvar_cl_leanmodel_highpass1);
 +      highpass2_limited(view_angles, frac, autocvar_cl_leanmodel_limit, gunangles_highpass, gunangles);
 +      gunangles_prev = view_angles;
 +      gunangles_highpass -= gunangles_prev;
 +
 +      PITCH(gunangles) *= -autocvar_cl_leanmodel_speed;
 +      YAW(gunangles) *= -autocvar_cl_leanmodel_speed;
 +
 +      // we assume here: PITCH = 0, YAW = 1, ROLL = 2
 +      frac = avg_factor(autocvar_cl_leanmodel_highpass);
 +      highpass2(gunangles, frac, gunangles_adjustment_highpass, gunangles);
 +      frac = avg_factor(autocvar_cl_leanmodel_lowpass);
 +      lowpass2(gunangles, frac, gunangles_adjustment_lowpass, gunangles);
  
 +      gunangles.x = -gunangles.x; // pitch was inverted, now that actually matters
 +
 +      return gunangles;
 +}
 +
 +vector bobmodel_ofs(entity view)
 +{
        bool clonground = !(view.anim_implicit_state & ANIMIMPLICITSTATE_INAIR);
        static bool oldonground;
        static float hitgroundtime;