X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Flib%2Fcsqcmodel%2Fcl_player.qc;h=2af309c02e2a2c364973127c210c70c5f5f4dbb4;hb=0d8cf4b6fa4832f92453d8c48973998d8afae025;hp=095b41ab7bf3bef9eeedf313e57f28253cc57a86;hpb=7d0df5ac293f4d6c163a663bdd215a9f06e257fc;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index 095b41ab7..2af309c02 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -208,8 +208,8 @@ bool CSQCPlayer_IsLocalPlayer(entity this) } float stairsmoothz; -float autocvar_cl_stairsmoothspeed; -float autocvar_cl_smoothviewheight; +float autocvar_cl_stairsmoothspeed = 200; +float autocvar_cl_smoothviewheight = 0.05; float smooth_prevtime; float viewheightavg; vector CSQCPlayer_ApplySmoothing(entity this, vector v) @@ -240,7 +240,7 @@ bool autocvar_v_deathtilt; float autocvar_v_deathtiltangle; void CSQCPlayer_ApplyDeathTilt(entity this) { - if(!IS_DEAD(this) || !autocvar_v_deathtilt) + if(!this.csqcmodel_isdead || !autocvar_v_deathtilt) return; view_angles.z = autocvar_v_deathtiltangle; } @@ -262,24 +262,24 @@ void CSQCPlayer_ApplyIdleScaling(entity this) //setproperty(VF_CL_VIEWANGLES, view_angles); // update view angles as well so we can aim } -float autocvar_cl_bob; -float autocvar_cl_bobcycle; -float autocvar_cl_bob_limit; -float autocvar_cl_bob_limit_heightcheck; -float autocvar_cl_bob_velocity_limit; -float autocvar_cl_bobup; -float autocvar_cl_bobfall; -float autocvar_cl_bobfallcycle; -float autocvar_cl_bobfallminspeed; -float autocvar_cl_bob2; -float autocvar_cl_bob2cycle; -float autocvar_cl_bob2smooth; +float autocvar_cl_bob = 0; +float autocvar_cl_bobcycle = 0.5; +float autocvar_cl_bob_limit = 7; +float autocvar_cl_bob_limit_heightcheck = 0; +float autocvar_cl_bob_velocity_limit = 400; +float autocvar_cl_bobup = 0.5; +float autocvar_cl_bobfall = 0.05; +float autocvar_cl_bobfallcycle = 3; +float autocvar_cl_bobfallminspeed = 200; +float autocvar_cl_bob2 = 0; +float autocvar_cl_bob2cycle = 1; +float autocvar_cl_bob2smooth = 0.05; float bobfall_swing; float bobfall_speed; float bob2_smooth; vector CSQCPlayer_ApplyBobbing(entity this, vector v) { - if(IS_DEAD(this)) + if(this.csqcmodel_isdead) return v; // bounded XY speed, used by several effects below @@ -472,7 +472,37 @@ vector CSQCPlayer_ApplyChase(entity this, vector v) return v; } -bool autocvar_cl_useenginerefdef; +void CSQCPlayer_CalcRefdef(entity this) +{ + vector vieworg = this.origin; + if(intermission) + { + // just update view offset, don't need to do anything else + vieworg.z += this.view_ofs.z; + } + else + { + vieworg = CSQCPlayer_ApplySmoothing(this, vieworg); + if(autocvar_chase_active) + vieworg = CSQCPlayer_ApplyChase(this, vieworg); + else + { + // angles + CSQCPlayer_ApplyDeathTilt(this); + view_angles = view_angles + view_punchangle; + view_angles.z += CSQCPlayer_CalcRoll(this); + // TODO? we don't have damage time accessible here + // origin + vieworg = vieworg + view_punchvector; + vieworg = CSQCPlayer_ApplyBobbing(this, vieworg); + } + CSQCPlayer_ApplyIdleScaling(this); + } + setproperty(VF_ORIGIN, vieworg); + setproperty(VF_ANGLES, view_angles); +} + +bool autocvar_cl_useenginerefdef = true; /** Called once per CSQC_UpdateView() */ void CSQCPlayer_SetCamera() @@ -564,32 +594,7 @@ void CSQCPlayer_SetCamera() } else { - vector vieworg = view.origin; - if(intermission) - { - // just update view offset, don't need to do anything else - vieworg.z += view.view_ofs.z; - } - else - { - vieworg = CSQCPlayer_ApplySmoothing(view, vieworg); - if(autocvar_chase_active) - vieworg = CSQCPlayer_ApplyChase(view, vieworg); - else - { - // angles - CSQCPlayer_ApplyDeathTilt(view); - view_angles = view_angles + view_punchangle; - view_angles.z += CSQCPlayer_CalcRoll(view); - // TODO? we don't have damage time accessible here - // origin - vieworg = vieworg + view_punchvector; - vieworg = CSQCPlayer_ApplyBobbing(view, vieworg); - } - CSQCPlayer_ApplyIdleScaling(view); - } - setproperty(VF_ORIGIN, vieworg); - setproperty(VF_ANGLES, view_angles); + CSQCPlayer_CalcRefdef(view); } }