]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make the crosshair ring properly display ammo based on the clip size of the weapon...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 21 Jan 2011 17:51:16 +0000 (19:51 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 21 Jan 2011 17:51:16 +0000 (19:51 +0200)
balanceXonotic.cfg
qcsrc/client/Defs.qc
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/common/constants.qh
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/w_sniperrifle.qc

index d722dd720f85d17878ed5acc68b68ecec191d01a..284ae42f3a3adc554bafe8c06b746ee7171302c4 100644 (file)
@@ -642,7 +642,7 @@ set g_balance_sniperrifle_secondary_ammo 10
 set g_balance_sniperrifle_secondary_bulletconstant 110 // 15.5qu
 set g_balance_sniperrifle_secondary_burstcost 0
 set g_balance_sniperrifle_secondary_bullethail 0 // empty magazine on shot
-set g_balance_sniperrifle_reload_ammo 40
+set g_balance_sniperrifle_reload_ammo 60
 set g_balance_sniperrifle_reload_time 2
 // }}}
 // {{{ tuba
index 3d15295942e21b6cefc40c52386f5f7ea3e8d6f0..eef29cdd551bd1fc3a3db1e1f402be9f8929feb3 100644 (file)
@@ -261,8 +261,6 @@ vector w_org, w_backoff;
 float sniperrifle_scope;
 float nex_scope;
 
-float cr_maxbullets;
-
 float bgmtime;
 
 string weaponorder_byimpulse;
index f87538a9eebf76e80d1483d714b88e9a2ca1c378..710c7f7433a7b687a3dab1fa027c675e8795a005 100644 (file)
@@ -1092,8 +1092,6 @@ void Ent_Init()
 
        serverflags = ReadByte();
 
-       cr_maxbullets = ReadByte();
-
        g_trueaim_minrange = ReadCoord();
 
        if(!postinit)
index 8f64e8d866e5a5b2824d2658f7e8c45c9ae48d63..1535d8bad51ad1f76d37391e49e7c91cb5c31d77 100644 (file)
@@ -850,7 +850,7 @@ void CSQC_UpdateView(float w, float h)
 
                        // TrueAim check
                        float shottype;
-                       float bullets, ring_scale;
+                       float bullets, bullets_max, 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;
@@ -996,10 +996,11 @@ void CSQC_UpdateView(float w, float h)
                                nex_charge_movingavg = nex_charge;
 
                        // ring around crosshair representing bullets left in camping rifle clip
-                       if (cr_maxbullets)
+                       bullets = getstati(STAT_BULLETS_LOADED);
+                       if (bullets)
                        {
-                               bullets = getstati(STAT_BULLETS_LOADED);
-                               f = bound(0, bullets / cr_maxbullets, 1);
+                               bullets_max = getstati(STAT_BULLETS_MAX);
+                               f = bound(0, bullets / bullets_max, 1);
 
                                a = autocvar_crosshair_ring_sniperrifle_alpha;
                                DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", f, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE);
index 90376b5b96bf9691c69ed98057e403282e7cec3c..5bf221560caad2e1b177a47c8fa9a93f7d55a78d 100644 (file)
@@ -62,7 +62,6 @@ const float TE_CSQC_TARGET_MUSIC = 111;
 const float TE_CSQC_NOTIFY = 112;
 const float TE_CSQC_WEAPONCOMPLAIN = 113;
 const float TE_CSQC_NEX_SCOPE = 116;
-const float TE_CSQC_CR_MAXBULLETS = 117;
 
 const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
 const float RACE_NET_CHECKPOINT_CLEAR = 1;
@@ -309,10 +308,11 @@ const float STAT_NB_METERSTART = 45;
 const float STAT_SHOTORG = 46; // compressShotOrigin
 const float STAT_LEADLIMIT = 47;
 const float STAT_BULLETS_LOADED = 48;
-const float STAT_NEX_CHARGE = 49;
-const float STAT_LAST_PICKUP = 50;
-const float STAT_HUD = 51;
-const float STAT_NEX_CHARGEPOOL = 52;
+const float STAT_BULLETS_MAX = 49;
+const float STAT_NEX_CHARGE = 50;
+const float STAT_LAST_PICKUP = 51;
+const float STAT_HUD = 52;
+const float STAT_NEX_CHARGEPOOL = 53;
 
 // see DP source, quakedef.h
 const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222;
index d0b7a0d2334cb095357720e14d2dad2c1542b3fc..5522eb805eb01d28e7dd569610b041361a35988b 100644 (file)
@@ -1111,7 +1111,6 @@ float ClientInit_SendEntity(entity to, float sf)
        WriteByte(MSG_ENTITY, autocvar_g_balance_nex_secondary); // client has to know if it should zoom or not
        WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_secondary); // client has to know if it should zoom or not
        WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not
-       WriteByte(MSG_ENTITY, 8); // rifle max bullets  // TO BE FIXED WITH NEW STAT!
        WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
        return TRUE;
 }
index a6374e46d8ee3e85f3f5f7c09a9aadc2ee86c87a..691df58851a5e9affff04431d3137213f003ce73 100644 (file)
@@ -614,6 +614,7 @@ float client_cefc_accumulatortime;
 
 .float ammo_counter;
 .float old_ammo_counter;
+.float ammo_max;
 .float wish_reload;
 
 #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
index a859d321186a894b46d6c5b669fd69ad863e438a..29330651a8922de6a55542f9ac11ff471a7eb08a 100644 (file)
@@ -819,6 +819,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_SHOTORG, AS_INT, stat_shotorg);
        addstat(STAT_LEADLIMIT, AS_FLOAT, stat_leadlimit);
        addstat(STAT_BULLETS_LOADED, AS_INT, ammo_counter);
+       addstat(STAT_BULLETS_MAX, AS_INT, ammo_max);
        addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);
 
        addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge);
index 4f443b24acf201a8b7afed93c1a8070684c94759..bf742871a6003a2553398cc2339f5a253d883024 100644 (file)
@@ -11,7 +11,10 @@ void W_Shotgun_SetAmmoCounter()
        if(!autocvar_g_balance_shotgun_reload_ammo)
                self.ammo_counter = 0; // also keeps crosshair ammo from displaying
        else
+       {
                self.ammo_counter = self.shotgun_load;
+               self.ammo_max = autocvar_g_balance_shotgun_reload_ammo; // for the crosshair ammo display
+       }
 }
 
 void W_Shotgun_ReloadedAndReady()
index eb6efb86f6d4ee6891b43b69dbfd501c8d0eb93c..e591a0076d3f94b2d4bf7da882c1b9c3972aa5e3 100644 (file)
@@ -15,7 +15,10 @@ void W_SniperRifle_SetAmmoCounter()
        if(!autocvar_g_balance_sniperrifle_reload_ammo)
                self.ammo_counter = 0; // also keeps crosshair ammo from displaying
        else
+       {
                self.ammo_counter = self.sniperrifle_load;
+               self.ammo_max = autocvar_g_balance_sniperrifle_reload_ammo; // for the crosshair ammo display
+       }
 }
 
 void W_SniperRifle_ReloadedAndReady()