]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow chase_active to be used normally while not dead or during an intermission....
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Mar 2011 17:51:33 +0000 (19:51 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Mar 2011 17:51:33 +0000 (19:51 +0200)
qcsrc/client/View.qc

index 0f67d60b70d90d9af121cfe252f45c0205a3d327..909aceae86f5b0aae665cfe7f98fa18fa8d907f5 100644 (file)
@@ -366,6 +366,9 @@ vector myhealth_gentlergb;
 float contentavgalpha, liquidalpha_prev;
 vector liquidcolor_prev;
 
+float chase_used;
+float chase_default, chase_back_default;
+
 void CSQC_UpdateView(float w, float h)
 {
        entity e;
@@ -799,22 +802,34 @@ void CSQC_UpdateView(float w, float h)
        {
                if((autocvar_cl_chase_death && getstati(STAT_HEALTH) <= 0 && !intermission) || (autocvar_cl_chase_intermission && intermission))
                {
-                       if(!cvar("chase_active"))
+                       if(!chase_used)
+                       {
                                cvar_set("chase_active", "1");
-               }
-               else if(cvar("chase_active"))
-                       cvar_set("chase_active", "0");
+                               cvar_set("chase_back", "0"); // start from 0
+                               chase_used = TRUE;
+                       }
 
-               // make the camera smooth back
-               if(cvar("chase_active"))
-               {
+                       // make the camera smooth back
                        if(autocvar_cl_chase_speed && cvar("chase_back") < autocvar_cl_chase_distance)
                                cvar_set("chase_back", ftos(cvar("chase_back") + (autocvar_cl_chase_speed * (autocvar_cl_chase_distance - cvar("chase_back")) * frametime)));
                        else if(cvar("chase_back") != autocvar_cl_chase_distance)
                                cvar_set("chase_back", ftos(autocvar_cl_chase_distance));
                }
-               else if(cvar("chase_back"))
-                       cvar_set("chase_back", "0"); // start from 0 next time we fade this
+               else
+               {
+                       if(chase_used)
+                       {
+                               cvar_set("chase_active", ftos(chase_default));
+                               cvar_set("chase_back", ftos(chase_back_default));
+                               chase_used = FALSE;
+                       }
+
+                       // keep the defaults updated
+                       if(chase_default != cvar("chase_active"))
+                               chase_default = cvar("chase_active");
+                       if(chase_back_default != cvar("chase_back"))
+                               chase_back_default = cvar("chase_back");
+               }
        }
 
        // Draw the mouse cursor