]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
Merge remote-tracking branch 'origin/terencehill/cvar_desc'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index 97ed6df284809647fa59e019753068024a355553..cb077390c3bead6dc6c3b35ce000594d07bd5334 100644 (file)
@@ -348,6 +348,7 @@ void CSQC_RAPTOR_HUD();
 vector freeze_org, freeze_ang;
 entity nightvision_noise, nightvision_noise2;
 
+#define MAX_TIME_DIFF 5
 float pickup_crosshair_time, pickup_crosshair_size;
 float hit_time, typehit_time;
 float nextsound_hit_time, nextsound_typehit_time;
@@ -957,13 +958,17 @@ void CSQC_UpdateView(float w, float h)
        hit_time = getstatf(STAT_HIT_TIME);
        if(hit_time > nextsound_hit_time && autocvar_cl_hitsound)
        {
-               sound(world, CH_INFO, "misc/hit.wav", VOL_BASE, ATTN_NONE);
+               if(time - hit_time < MAX_TIME_DIFF) // don't play the sound if it's too old.
+                       sound(world, CH_INFO, "misc/hit.wav", VOL_BASE, ATTN_NONE);
+                       
                nextsound_hit_time = time + autocvar_cl_hitsound_antispam_time;
        }
        typehit_time = getstatf(STAT_TYPEHIT_TIME);
-       if(typehit_time > nextsound_typehit_time)
+       if(typehit_time > nextsound_typehit_time) 
        {
-               sound(world, CH_INFO, "misc/typehit.wav", VOL_BASE, ATTN_NONE);
+               if(time - typehit_time < MAX_TIME_DIFF) // don't play the sound if it's too old.
+                       sound(world, CH_INFO, "misc/typehit.wav", VOL_BASE, ATTN_NONE);
+                       
                nextsound_typehit_time = time + autocvar_cl_hitsound_antispam_time;
        }
 
@@ -1110,10 +1115,14 @@ void CSQC_UpdateView(float w, float h)
 
                        if(autocvar_crosshair_pickup)
                        {
-                               if(pickup_crosshair_time < getstatf(STAT_LAST_PICKUP))
+                               float stat_pickup_time = getstatf(STAT_LAST_PICKUP);
+                               
+                               if(pickup_crosshair_time < stat_pickup_time)
                                {
-                                       pickup_crosshair_size = 1;
-                                       pickup_crosshair_time = getstatf(STAT_LAST_PICKUP);
+                                       if(time - stat_pickup_time < MAX_TIME_DIFF) // don't trigger the animation if it's too old
+                                               pickup_crosshair_size = 1;
+                                               
+                                       pickup_crosshair_time = stat_pickup_time;
                                }
 
                                if(pickup_crosshair_size > 0)
@@ -1124,13 +1133,14 @@ void CSQC_UpdateView(float w, float h)
                                wcross_scale += sin(pickup_crosshair_size) * autocvar_crosshair_pickup;
                        }
 
-                       vector hitindication_color;
                        if(autocvar_crosshair_hitindication)
                        {
-                               hitindication_color = stov(autocvar_crosshair_hitindication_color);
+                               vector hitindication_color = stov(autocvar_crosshair_hitindication_color);
                                if(hitindication_crosshair_time < hit_time)
                                {
-                                       hitindication_crosshair_size = 1;
+                                       if(time - hit_time < MAX_TIME_DIFF) // don't trigger the animation if it's too old
+                                               hitindication_crosshair_size = 1;
+                                               
                                        hitindication_crosshair_time = hit_time;
                                }
 
@@ -1433,24 +1443,12 @@ void CSQC_common_hud(void)
     HUD_DrawScoreboard();
 
     if (scoreboard_active) // scoreboard/accuracy
-    {
         HUD_Reset();
-        // HUD_DrawScoreboard takes care of centerprint_start
-    }
     else if (intermission == 2) // map voting screen
     {
         HUD_FinaleOverlay();
         HUD_Reset();
-
-        centerprint_start_x = 0;
-        centerprint_start_y = autocvar_scr_centerpos * vid_conheight;
-    }
-    else // hud
-    {
-        centerprint_start_x = 0;
-        centerprint_start_y = autocvar_scr_centerpos * vid_conheight;
     }
-
        /*
        switch(hud)
        {
@@ -1467,9 +1465,6 @@ void CSQC_common_hud(void)
             break;
        }
        */
-       
-    HUD_DrawCenterPrint();
-    
 }