]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
Merge branch 'master' into mirceakitsune/universal_reload_system
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index 6746cfe6ba6bf77d8f2bae5f5a2479db3556c65e..40c3b957a12eb65bd33d9616c5c2f489b3cccf0e 100644 (file)
@@ -866,6 +866,9 @@ void CSQC_UpdateView(float w, float h)
 
                        // TrueAim check
                        float shottype;
+
+                       float weapon_clipload, weapon_clipsize, ring_scale;
+
                        // 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_z = 0;
@@ -1079,12 +1082,14 @@ void CSQC_UpdateView(float w, float h)
                                
                                if(nex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
                                        nex_charge_movingavg = nex_charge;
-                               
-                               if (activeweapon == WEP_SNIPERRIFLE && cr_maxbullets && autocvar_crosshair_ring_sniperrifle) // ring around crosshair representing bullets left in camping rifle clip
-                               { 
-                                       ring_value = bound(0, getstati(STAT_BULLETS_LOADED) / cr_maxbullets, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
-                                       ring_alpha = wcross_alpha * autocvar_crosshair_ring_sniperrifle_alpha;
-                                       ring_image = "gfx/crosshair_ring_sniperrifle.tga";
+
+                               weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD);
+                               if (weapon_clipload) // ring around crosshair representing ammo left in weapon clip
+                               {
+                                       weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE);
+                                       ring_value = bound(0, weapon_clipload / weapon_clipsize, 1);
+                                       ring_alpha = autocvar_crosshair_ring_sniperrifle_alpha;
+                                       ring_image = "gfx/crosshair_ring.tga";
                                        ring_rgb = wcross_color;
                                }
                                else if (activeweapon == WEP_NEX && nex_charge && autocvar_crosshair_ring_nex) // ring around crosshair representing velocity-dependent damage for the nex