From: Mircea Kitsune Date: Thu, 31 Mar 2011 00:34:41 +0000 (+0300) Subject: Use chase_active -1 in the code, which behaves just like 1. This can be used to mark... X-Git-Tag: xonotic-v0.5.0~268^2^2~34 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=65a1df4a4d60c7f005103985378f7ba8a6cfb5f7;p=xonotic%2Fxonotic-data.pk3dir.git Use chase_active -1 in the code, which behaves just like 1. This can be used to mark chase_active as set by the code and thus avoid any risk of it getting stuck. --- diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 62578e539..3d1b8c5af 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -366,8 +366,6 @@ vector myhealth_gentlergb; float contentavgalpha, liquidalpha_prev; vector liquidcolor_prev; -float chase_used; -float chase_default; float chase_current_distance; void CSQC_UpdateView(float w, float h) @@ -407,14 +405,12 @@ void CSQC_UpdateView(float w, float h) // event chase cam if(spectatee_status >= 0 && (autocvar_cl_chase_death || autocvar_cl_chase_intermission)) + if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually { if((autocvar_cl_chase_death && getstati(STAT_HEALTH) <= 0 && !intermission) || (autocvar_cl_chase_intermission && intermission)) { - if(!chase_used) - { - cvar_set("chase_active", "1"); - chase_used = TRUE; - } + if(!autocvar_chase_active) + cvar_set("chase_active", "-1"); // -1 enables chase_active as well as marking it as enabled by this code, and not by the user (which would be 1) // make the camera smooth back if(autocvar_cl_chase_speed && chase_current_distance < autocvar_cl_chase_distance) @@ -426,18 +422,10 @@ void CSQC_UpdateView(float w, float h) R_SetView(VF_ORIGIN_X, pmove_org_x - view_forward_x * chase_current_distance); R_SetView(VF_ORIGIN_Y, pmove_org_y - view_forward_y * chase_current_distance); } - else + else if(autocvar_chase_active < 0) { - if(chase_used) - { - cvar_set("chase_active", ftos(chase_default)); - chase_current_distance = 0; // start from 0 - chase_used = FALSE; - } - - // keep the defaults updated - if(chase_default != cvar("chase_active")) - chase_default = cvar("chase_active"); + cvar_set("chase_active", "0"); + chase_current_distance = 0; // start from 0 } }