X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Flib%2Fcsqcmodel%2Fcl_player.qc;h=12fa926e27f6fbae56aa32ebe7f3591ac6968405;hp=095b41ab7bf3bef9eeedf313e57f28253cc57a86;hb=21d11c60c712b035bfb746be27260030086802f6;hpb=36b1e07cbd318b9ef5262fb5951244f16ef297c8 diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index 095b41ab7b..12fa926e27 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 = 160; +float autocvar_cl_smoothviewheight = 0; 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; } @@ -279,7 +279,7 @@ 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); } }