]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/view.qc
Merge branch 'master' into Mario/ons_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / view.qc
index 35793364fafd3c60c9853065064f39a32f6bc840..177261d3f8e959b6eea500797704a383c6669b5a 100644 (file)
@@ -1091,18 +1091,39 @@ void CSQC_UpdateView(float w, float h)
        // event chase camera
        if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
        {
-               if(WantEventchase())
+               float ons_roundlost = (gametype == MAPINFO_TYPE_ONSLAUGHT && getstati(STAT_ROUNDLOST));
+               entity gen = world;
+               
+               if(ons_roundlost)
+               {
+                       entity e;
+                       for(e = world; (e = find(e, classname, "onslaught_generator")); )
+                       {
+                               if(e.health <= 0)
+                               {
+                                       gen = e;
+                                       break;
+                               }
+                       }
+                       if(!gen)
+                               ons_roundlost = FALSE; // don't enforce the 3rd person camera if there is no dead generator to show
+               }
+               if(WantEventchase() || (!autocvar_cl_orthoview && ons_roundlost))
                {
                        eventchase_running = true;
 
                        // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
                        vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
+                       if(ons_roundlost) { current_view_origin = gen.origin; }
 
                        // detect maximum viewoffset and use it
-                       if(autocvar_cl_eventchase_viewoffset)
+                       vector view_offset = autocvar_cl_eventchase_viewoffset;
+                       if(ons_roundlost) { view_offset = autocvar_cl_eventchase_generator_viewoffset; }
+
+                       if(view_offset)
                        {
-                               WarpZone_TraceLine(current_view_origin, current_view_origin + autocvar_cl_eventchase_viewoffset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self);
-                               if(trace_fraction == 1) { current_view_origin += autocvar_cl_eventchase_viewoffset; }
+                               WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self);
+                               if(trace_fraction == 1) { current_view_origin += view_offset; }
                                else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); }
                        }
 
@@ -1112,10 +1133,13 @@ void CSQC_UpdateView(float w, float h)
                        if(!autocvar_chase_active) { cvar_set("chase_active", "-1"); }
 
                        // make the camera smooth back
-                       if(autocvar_cl_eventchase_speed && eventchase_current_distance < autocvar_cl_eventchase_distance)
-                               eventchase_current_distance += autocvar_cl_eventchase_speed * (autocvar_cl_eventchase_distance - eventchase_current_distance) * frametime; // slow down the further we get
-                       else if(eventchase_current_distance != autocvar_cl_eventchase_distance)
-                               eventchase_current_distance = autocvar_cl_eventchase_distance;
+                       float chase_distance = autocvar_cl_eventchase_distance;
+                       if(ons_roundlost) { chase_distance = autocvar_cl_eventchase_generator_distance; }
+
+                       if(autocvar_cl_eventchase_speed && eventchase_current_distance < chase_distance)
+                               eventchase_current_distance += autocvar_cl_eventchase_speed * (chase_distance - eventchase_current_distance) * frametime; // slow down the further we get
+                       else if(eventchase_current_distance != chase_distance)
+                               eventchase_current_distance = chase_distance;
 
                        makevectors(view_angles);
 
@@ -1784,6 +1808,8 @@ void CSQC_UpdateView(float w, float h)
 
        if(autocvar__hud_configure)
                HUD_Panel_Mouse();
+       else 
+               HUD_Radar_Mouse();
 
     if(hud && !intermission)
     {