]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
Actually, rework that last commit a bit
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index 08c247f4e2ddd3a418f6a78798b69ba02f7f1c91..44f8236f2f55cb859b9a04e3b5eff1d58567c433 100644 (file)
@@ -214,6 +214,9 @@ string wcross_name_goal_prev, wcross_name_goal_prev_prev;
 float wcross_resolution_goal_prev, wcross_resolution_goal_prev_prev;
 float wcross_name_changestarttime, wcross_name_changedonetime;
 float wcross_name_alpha_goal_prev, wcross_name_alpha_goal_prev_prev;
 float wcross_resolution_goal_prev, wcross_resolution_goal_prev_prev;
 float wcross_name_changestarttime, wcross_name_changedonetime;
 float wcross_name_alpha_goal_prev, wcross_name_alpha_goal_prev_prev;
+
+float wcross_ring_prev;
+
 entity trueaim;
 entity trueaim_rifle;
 
 entity trueaim;
 entity trueaim_rifle;
 
@@ -480,7 +483,15 @@ void CSQC_UpdateView(float w, float h)
                if(spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead) || intermission)
                {
                        // 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.)
                if(spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead) || intermission)
                {
                        // 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) + autocvar_cl_eventchase_viewoffset);
+                       vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
+
+                       // detect maximum viewoffset and use it
+                       if(autocvar_cl_eventchase_viewoffset)
+                       {
+                               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; }
+                               else { current_view_origin_z += max(0, (trace_endpos_z - current_view_origin_z) - autocvar_cl_eventchase_maxs_z); }
+                       }
 
                        // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
                        // Ideally, there should be another way to enable third person cameras, such as through setproperty()
 
                        // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
                        // Ideally, there should be another way to enable third person cameras, such as through setproperty()
@@ -1418,11 +1429,24 @@ void CSQC_UpdateView(float w, float h)
                                        }
 
                                        // if in weapon switch animation, fade ring out/in
                                        }
 
                                        // if in weapon switch animation, fade ring out/in
-                                       if(fabs(autocvar_crosshair_effect_time) > 0)
+                                       if(autocvar_crosshair_effect_time > 0)
                                        {
                                        {
-                                               f = (time - wcross_name_changestarttime) / wcross_changedonetime;
-                                               if(f > 0 && f < 2)
-                                                       ring_alpha *= fabs(1 - f);
+                                               f = (time - wcross_name_changestarttime) / autocvar_crosshair_effect_time;
+                                               if not(f < 1)
+                                               {
+                                                       wcross_ring_prev = ((ring_image) ? TRUE : FALSE);
+                                               }
+                                               
+                                               if(wcross_ring_prev)
+                                               {
+                                                       if(f < 1)
+                                                               ring_alpha *= fabs(1 - bound(0, f, 1));
+                                               }
+                                               else
+                                               {
+                                                       if(f < 1)
+                                                               ring_alpha *= bound(0, f, 1);
+                                               }
                                        }
 
                                        if (autocvar_crosshair_ring_inner && ring_inner_value) // lets draw a ring inside a ring so you can ring while you ring
                                        }
 
                                        if (autocvar_crosshair_ring_inner && ring_inner_value) // lets draw a ring inside a ring so you can ring while you ring