From: terencehill Date: Sun, 21 Feb 2016 17:39:11 +0000 (+0100) Subject: Implement a more effective limit for cl_followmodel; set lower values for cl_followmo... X-Git-Tag: xonotic-v0.8.2~1171^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f399e014a79b4b2a98e694096f25a35053c9fba9;p=xonotic%2Fxonotic-data.pk3dir.git Implement a more effective limit for cl_followmodel; set lower values for cl_followmodel_limit and cl_leanmodel_limit --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 50e0ad7e7..2a9d17dd8 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -166,7 +166,7 @@ cl_bobmodel_up 0.1 // amount the gun sways up and down cl_followmodel 1 // enables weapon pushing / pulling effect when walking seta cl_followmodel_speed 0.3 "gun following speed" -seta cl_followmodel_limit 1000 "gun following limit" +seta cl_followmodel_limit 135 "gun following limit" seta cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes (side effect: it causes a glitch when teleporting / passing through a warpzone)" seta cl_followmodel_velocity_lowpass 0.05 "gun following velocity lowpass averaging time" seta cl_followmodel_highpass 0.05 "gun following highpass averaging time" @@ -174,7 +174,7 @@ seta cl_followmodel_lowpass 0.03 "gun following lowpass averaging time" cl_leanmodel 1 // enables weapon leaning effect when looking around seta cl_leanmodel_speed 0.3 "gun leaning speed" -seta cl_leanmodel_limit 1000 "gun leaning limit" +seta cl_leanmodel_limit 30 "gun leaning limit" seta cl_leanmodel_highpass1 0.2 "gun leaning pre-highpass averaging time" seta cl_leanmodel_highpass 0.2 "gun leaning highpass averaging time" seta cl_leanmodel_lowpass 0.05 "gun leaning lowpass averaging time" diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index debe7a5c1..e05809078 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -40,14 +40,15 @@ float autocvar_cl_bobmodel_up; float autocvar_cl_followmodel; float autocvar_cl_followmodel_speed = 0.3; -float autocvar_cl_followmodel_limit = 1000; +float autocvar_cl_followmodel_limit = 135; float autocvar_cl_followmodel_velocity_lowpass = 0.05; float autocvar_cl_followmodel_highpass = 0.05; float autocvar_cl_followmodel_lowpass = 0.03; +bool autocvar_cl_followmodel_velocity_absolute; float autocvar_cl_leanmodel; float autocvar_cl_leanmodel_speed = 0.3; -float autocvar_cl_leanmodel_limit = 1000; +float autocvar_cl_leanmodel_limit = 30; float autocvar_cl_leanmodel_highpass1 = 0.2; float autocvar_cl_leanmodel_highpass = 0.2; float autocvar_cl_leanmodel_lowpass = 0.05; @@ -82,12 +83,6 @@ float autocvar_cl_leanmodel_lowpass = 0.05; lowpass(value.y, frac, ref_store.y, ref_out.y); \ } MACRO_END -#define lowpass2_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \ -{ \ - lowpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \ - lowpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \ -} MACRO_END - #define highpass2(value, frac, ref_store, ref_out) MACRO_BEGIN \ { \ highpass(value.x, frac, ref_store.x, ref_out.x); \ @@ -114,21 +109,6 @@ float autocvar_cl_leanmodel_lowpass = 0.05; highpass(value.z, frac, ref_store.z, ref_out.z); \ } MACRO_END -#define highpass3_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \ -{ \ - highpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \ - highpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \ - highpass_limited(value.z, frac, limit, ref_store.z, ref_out.z); \ -} MACRO_END - -#define lowpass3_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \ -{ \ - lowpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \ - lowpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \ - lowpass_limited(value.z, frac, limit, ref_store.z, ref_out.z); \ -} MACRO_END - -bool autocvar_cl_followmodel_velocity_absolute; void viewmodel_animate(entity this) { static float prevtime; @@ -177,8 +157,12 @@ void viewmodel_animate(entity this) vel.z = view.velocity * up; } + 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_limited(vel, frac, autocvar_cl_followmodel_limit, vel_average, gunorg); + lowpass3(vel, frac, vel_average, gunorg); gunorg *= -autocvar_cl_followmodel_speed * 0.042;