]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/view.qc
Avoid potentially drawing a 'bad string' (better to show no reticle at all than to...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / view.qc
index 63a0aef279706cdc7ec78d7c649c30734ee12856..ae6b0ee7638ae0a3b36fc0b1e0e9a3b181ad4197 100644 (file)
@@ -666,7 +666,7 @@ float TrueAimCheck(entity wepent)
                        mv = MOVE_NORMAL;
                        if(zoomscript_caught)
                        {
-                               tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+                               tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * max_shot_distance, mv, ta);
                                return EnemyHitCheck();
                        }
                        break;
@@ -692,7 +692,7 @@ float TrueAimCheck(entity wepent)
 
        vecs = decompressShotOrigin(STAT(SHOTORG));
 
-       traceline(traceorigin, traceorigin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+       traceline(traceorigin, traceorigin + view_forward * max_shot_distance, mv, ta);
        trueaimpoint = trace_endpos;
 
        if(vdist((trueaimpoint - traceorigin), <, g_trueaim_minrange))
@@ -759,7 +759,7 @@ bool WantEventchase(entity this)
 {
        if(autocvar_cl_orthoview)
                return false;
-       if(STAT(GAMEOVER) || intermission)
+       if(STAT(GAME_STOPPED) || intermission)
                return true;
        if(this.viewloc)
                return true;
@@ -961,7 +961,7 @@ void HUD_Crosshair(entity this)
 {
        float f, i, j;
        vector v;
-       if(!scoreboard_active && !camera_active && intermission != 2 && !STAT(GAMEOVER) &&
+       if(!scoreboard_active && !camera_active && intermission != 2 && !STAT(GAME_STOPPED) &&
                spectatee_status != -1 && !csqcplayer.viewloc && !MUTATOR_CALLHOOK(DrawCrosshair) &&
                !HUD_MinigameMenu_IsOpened() )
        {
@@ -993,7 +993,7 @@ void HUD_Crosshair(entity this)
                float shottype;
 
                // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
-               wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);
+               wcross_origin = project_3d_to_2d(view_origin + max_shot_distance * view_forward);
                wcross_origin.z = 0;
                if(autocvar_crosshair_hittest)
                {
@@ -1953,7 +1953,7 @@ void CSQC_UpdateView(entity this, float w, float h)
 
        if(autocvar_cl_reticle)
        {
-               string reticle_image = "";
+               string reticle_image = string_null;
                bool wep_zoomed = false;
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
@@ -1962,11 +1962,8 @@ void CSQC_UpdateView(entity this, float w, float h)
                        if(wep != WEP_Null && wep.wr_zoom)
                        {
                                bool do_zoom = wep.wr_zoom(wep, NULL);
-                               if(wep.w_reticle != "")
-                               {
+                               if(!reticle_image && wep.w_reticle && wep.w_reticle != "")
                                        reticle_image = wep.w_reticle;
-                                       break; // we can only draw 1 reticle
-                               }
                                wep_zoomed += do_zoom;
                        }
                }
@@ -1981,7 +1978,7 @@ void CSQC_UpdateView(entity this, float w, float h)
                }
                else if(wep_zoomed && autocvar_cl_reticle_weapon)
                {
-                       if(reticle_image != "") { reticle_type = 2; }
+                       if(reticle_image) { reticle_type = 2; }
                        else { reticle_type = 0; }
                }
                else if(button_zoom || zoomscript_caught)