]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mirceakitsune/event_chasecam
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 31 Mar 2011 15:00:39 +0000 (18:00 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 31 Mar 2011 15:00:39 +0000 (18:00 +0300)
defaultXonotic.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh

index e9e50c5c171659d2d9a022d28a7e41dbdc698ced..d56ab03e838f58c6503de27f1a019aaaeb1611eb 100644 (file)
@@ -241,7 +241,7 @@ vid_conheight 600
 v_deathtilt 0 // needed for spectators (who are dead to avoid prediction)
 
 // these settings determine how much the view is affected by movement/damage
-cl_deathfade 1 // fade screen to dark red when dead, value represents how fast the fade is (higher is faster)
+cl_deathfade 0.03 // fade screen to dark red when dead, value represents how fast the fade is (higher is faster)
 cl_bobcycle 0 // how long the cycle of up/down view movement takes (only works if cl_bob is not 0), default is 0.6
 cl_bob 0.01 // how much view moves up/down when moving (does not move if cl_bobcycle is 0, but still enables cl_bobmodel), default is 0.02
 cl_bob2cycle 0 // how long the cycle of left/right view movement takes (only works if cl_bob2 is not 0), default is 0.6
@@ -315,6 +315,11 @@ set sv_ready_restart_repeatable 0  "allows the players to restart the game as oft
 seta cl_hitsound 1 "play a hit notifier sound when you have hit an enemy"
 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 "final distance of the chase camera"
+seta cl_chase_speed 1.5 "how fast the chase camera slides back, 0 is instant"
+
 //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 09ec96eabaaa9ece2608496c64c551d646d1b695..540c077873613447ef72ee23c13694cd32c84c25 100644 (file)
@@ -366,6 +366,8 @@ vector myhealth_gentlergb;
 float contentavgalpha, liquidalpha_prev;
 vector liquidcolor_prev;
 
+float chase_current_distance;
+
 void CSQC_UpdateView(float w, float h)
 {
        entity e;
@@ -401,6 +403,39 @@ void CSQC_UpdateView(float w, float h)
        input_angles = warpzone_fixview_cl_viewangles;
        view_angles = warpzone_fixview_angles;
 
+       // 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) && intermission <= 1) // not during the map voting screen
+               {
+                       if(!autocvar_chase_active)
+                               cvar_set("chase_active", "-1"); // -1 enables chase_active as well as marking it as set 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)
+                               chase_current_distance += autocvar_cl_chase_speed * (autocvar_cl_chase_distance - chase_current_distance) * frametime; // slow down smoothly
+                       else if(chase_current_distance != autocvar_cl_chase_distance)
+                               chase_current_distance = autocvar_cl_chase_distance;
+
+                       vector target_origin;
+                       target_origin = pmove_org - view_forward * chase_current_distance;
+
+                       // don't allow the camera to go through walls
+                       traceline(pmove_org, target_origin, MOVE_NORMAL, self);
+                       if(trace_fraction == 1)
+                       {
+                               makevectors(view_angles);
+                               R_SetView(VF_ORIGIN, target_origin);
+                       }
+               }
+               else if(autocvar_chase_active < 0)
+               {
+                       cvar_set("chase_active", "0");
+                       chase_current_distance = 0; // start from 0
+               }
+       }
+
        if(autocvar_cl_lockview || (autocvar__hud_configure && spectatee_status <= 0))
        {
                pmove_org = freeze_pmove_org;
index e11266ce0223324944413047fc647a5d95314ea2..3f3f8301b34305c71dd18b265c78755772e5d07b 100644 (file)
@@ -305,3 +305,7 @@ float autocvar_viewsize;
 float autocvar_crosshair_color_by_health;
 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;