From: divverent Date: Fri, 16 Jul 2010 22:25:06 +0000 (+0000) Subject: Cvars. Enabled by default just for testing until everything is done. X-Git-Tag: xonotic-v0.1.0preview~230^2~134 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=019b0e8cb38955f1b8e5e51667a100f5c78c521f;p=xonotic%2Fdarkplaces.git Cvars. Enabled by default just for testing until everything is done. From: MirceaKitsune git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10344 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/darkplaces.txt b/darkplaces.txt index eb3b3033..81c82c68 100644 --- a/darkplaces.txt +++ b/darkplaces.txt @@ -399,6 +399,8 @@ cl_bobcycle 0.6 view bobbi cl_bob2 0 sideways view bobbing amount cl_bob2cycle 0.6 sideways view bobbing speed cl_bob2smooth 0.05 how fast the view goes back when you stop touching the ground +cl_bobfall 0 how much the view swings down when falling (influenced by the speed you hit the ground with) +cl_bobfallcycle 0.25 speed of the bobfall swing cl_bobmodel 1 enables gun bobbing cl_bobmodel_side 0.05 gun bobbing sideways sway amount cl_bobmodel_speed 7 gun bobbing speed diff --git a/view.c b/view.c index fe3e8130..70011bfa 100644 --- a/view.c +++ b/view.c @@ -42,6 +42,8 @@ cvar_t cl_bobup = {CVAR_SAVE, "cl_bobup","0.5", "view bobbing adjustment that ma cvar_t cl_bob2 = {CVAR_SAVE, "cl_bob2","0", "sideways view bobbing amount"}; cvar_t cl_bob2cycle = {CVAR_SAVE, "cl_bob2cycle","0.6", "sideways view bobbing speed"}; cvar_t cl_bob2smooth = {CVAR_SAVE, "cl_bob2smooth","0.05", "how fast the view goes back when you stop touching the ground"}; +cvar_t cl_bobfall = {CVAR_SAVE, "cl_bobfall","0.1", "how much the view swings down when falling (influenced by the speed you hit the ground with)"}; +cvar_t cl_bobfallcycle = {CVAR_SAVE, "cl_bobfallcycle","0.025", "speed of the bobfall swing"}; cvar_t cl_bobmodel = {CVAR_SAVE, "cl_bobmodel", "1", "enables gun bobbing"}; cvar_t cl_bobmodel_side = {CVAR_SAVE, "cl_bobmodel_side", "0.15", "gun bobbing sideways sway amount"}; cvar_t cl_bobmodel_up = {CVAR_SAVE, "cl_bobmodel_up", "0.06", "gun bobbing upward movement amount"}; @@ -715,20 +717,23 @@ void V_CalcRefdef (void) // fall bobbing code // causes the view to swing down and back up when touching the ground - if (!cl.onground) + if (cl_bobfall.value && cl_bobfallcycle.value) { - cl.bobfall_speed = cl.velocity[2] * 0.1; // replace 0.1 with cvar - cl.bobfall_swing = 1; - } - else - { - if(cl.bobfall_swing > 0) - cl.bobfall_swing -= 0.01; // replace 0.1 with cvar + if (!cl.onground) + { + cl.bobfall_speed = cl.velocity[2] * cl_bobfall.value; + cl.bobfall_swing = 1; + } else - cl.bobfall_swing = 0; + { + if(cl.bobfall_swing > 0) + cl.bobfall_swing -= cl_bobfallcycle.value; + else + cl.bobfall_swing = 0; - vieworg[2] += sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed; - gunorg[2] += sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed; + vieworg[2] += sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed; + gunorg[2] += sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed; + } } // gun model bobbing code @@ -969,6 +974,8 @@ void V_Init (void) Cvar_RegisterVariable (&cl_bob2); Cvar_RegisterVariable (&cl_bob2cycle); Cvar_RegisterVariable (&cl_bob2smooth); + Cvar_RegisterVariable (&cl_bobfall); + Cvar_RegisterVariable (&cl_bobfallcycle); Cvar_RegisterVariable (&cl_bobmodel); Cvar_RegisterVariable (&cl_bobmodel_side); Cvar_RegisterVariable (&cl_bobmodel_up);