]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fade the chase cam back when dying or entering intermission
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Mar 2011 16:59:54 +0000 (18:59 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Mar 2011 16:59:54 +0000 (18:59 +0200)
defaultXonotic.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh

index 1b9644cb8659acf72d23f9b8b6e761cc71318a2c..63ad0e8b1d9fc9a88fa36da9ec7f1bcec6e2656c 100644 (file)
@@ -318,6 +318,8 @@ set cl_hitsound_antispam_time 0.05 "don't play the hitsound more often than this
 
 seta cl_chase_death 1 "camera goes into 3rd person mode when dead"
 seta cl_chase_intermission 1 "camera goes into 3rd person mode at match end"
+seta cl_chase_distance 100
+seta cl_chase_speed 50
 
 //nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
 set teamplay_lockonrestart 0 "it set to 1 in a team-based game, the teams are locked once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)"
index a991b8d1e0e6eca3576a1fbb01ce926a6240a549..977119f70e503a4c2951b4badd00899dbb250606 100644 (file)
@@ -795,15 +795,26 @@ void CSQC_UpdateView(float w, float h)
        }
 
        // event chase cam
-       if(spectatee_status >= 0)
+       if(spectatee_status >= 0 && (autocvar_cl_chase_death || autocvar_cl_chase_intermission))
        {
                if((autocvar_cl_chase_death && getstati(STAT_HEALTH) <= 0 && !intermission) || (autocvar_cl_chase_intermission && intermission))
                {
                        if(!cvar("chase_active"))
                                cvar_set("chase_active", "1");
                }
-               else if(cvar("chase_active") && (autocvar_cl_chase_death || autocvar_cl_chase_intermission))
+               else if(cvar("chase_active"))
                        cvar_set("chase_active", "0");
+
+               // make the camera smooth back
+               if(cvar("chase_active"))
+               {
+                       if(autocvar_cl_chase_speed && cvar("chase_back") < autocvar_cl_chase_distance)
+                               cvar_set("chase_back", ftos(cvar("chase_back") + (autocvar_cl_chase_speed * 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
        }
 
        // Draw the mouse cursor
index 8989762ecf39f5d923fa548a7be8951c091d5416..4454b4dde56c44dd3d8f3473c1b5b954550e901d 100644 (file)
@@ -307,3 +307,5 @@ float autocvar_cl_hitsound;
 float autocvar_cl_hitsound_antispam_time;
 float autocvar_cl_chase_death;
 float autocvar_cl_chase_intermission;
+float autocvar_cl_chase_distance;
+float autocvar_cl_chase_speed;