]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use chase_active -1 in the code, which behaves just like 1. This can be used to mark...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 31 Mar 2011 00:34:41 +0000 (03:34 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 31 Mar 2011 00:34:41 +0000 (03:34 +0300)
qcsrc/client/View.qc

index 62578e539e701b27ee6c07a81bca053280a3102a..3d1b8c5af880496c873aabd8fe91bab363527b00 100644 (file)
@@ -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
                }
        }