]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/view.qc
Merge branch 'AriosJentu/DisconnectDialog' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / view.qc
index b1593cf3a222315b6f7d6c66514d0bb6c25932c6..5ae7d50056a64ba22ec96656873ba25eef86e5a6 100644 (file)
@@ -714,7 +714,7 @@ vector liquidcolor_prev;
 
 float eventchase_current_distance;
 float eventchase_running;
-int WantEventchase(entity this)
+int WantEventchase(entity this, bool want_vehiclechase)
 {
        if(autocvar_cl_orthoview)
                return 0;
@@ -724,7 +724,7 @@ int WantEventchase(entity this)
                return 1;
        if(spectatee_status >= 0)
        {
-               if(hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0))
+               if(want_vehiclechase)
                        return 1;
                if(MUTATOR_CALLHOOK(WantEventchase, this))
                        return 1;
@@ -980,8 +980,9 @@ void HUD_Crosshair(entity this)
                        if(csqcplayer && crosshair_chase_playeralpha && crosshair_chase_playeralpha < 1)
                        {
                                traceline(view_origin, view_origin + max_shot_distance * view_forward, MOVE_NORMAL, NULL);
-                               if(trace_ent == csqcplayer)
-                                       csqcplayer.alpha = crosshair_chase_playeralpha;
+                               float myalpha = (!csqcplayer.m_alpha) ? 1 : csqcplayer.m_alpha;
+                               if(trace_ent == csqcplayer && STAT(HEALTH) > 0)
+                                       csqcplayer.alpha = min(crosshair_chase_playeralpha, myalpha);
                                else
                                        csqcplayer.alpha = csqcplayer.m_alpha;
                        }
@@ -1093,8 +1094,10 @@ void HUD_Crosshair(entity this)
                        wcross_color.z += sin(hitindication_crosshair_size) * hitindication_color.z;
                }
 
-               if(shottype == SHOTTYPE_HITENEMY)
-                       wcross_scale *= autocvar_crosshair_hittest; // is not queried if hittest is 0
+               // no effects needed for targeting enemies, this can't possibly span all valid targets!
+               // just show for teammates to give a sign that they're an invalid target
+               //if(shottype == SHOTTYPE_HITENEMY)
+                       //wcross_scale *= autocvar_crosshair_hittest; // is not queried if hittest is 0
                if(shottype == SHOTTYPE_HITTEAM)
                        wcross_scale /= autocvar_crosshair_hittest; // is not queried if hittest is 0
 
@@ -1671,7 +1674,7 @@ void CSQC_UpdateView(entity this, float w, float h)
                else if(autocvar_chase_active == -2)
                        cvar_set("chase_active", "0");
 
-               float vehicle_chase = (hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0));
+               bool vehicle_chase = (hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0));
 
                float vehicle_viewdist = 0;
                vector vehicle_viewofs = '0 0 0';
@@ -1683,10 +1686,14 @@ void CSQC_UpdateView(entity this, float w, float h)
                                Vehicle info = Vehicles_from(hud);
                                vehicle_viewdist = info.height;
                                vehicle_viewofs = info.view_ofs;
+                               if(vehicle_viewdist < 0) // when set below 0, this vehicle doesn't use third person view (gunner slots)
+                                       vehicle_chase = false;
                        }
+                       else
+                               vehicle_chase = false;
                }
 
-               int eventchase = WantEventchase(this);
+               int eventchase = WantEventchase(this, vehicle_chase);
                if (eventchase)
                {
                        vector current_view_origin_override = '0 0 0';