From: Mircea Kitsune Date: Fri, 21 Jan 2011 17:51:16 +0000 (+0200) Subject: Make the crosshair ring properly display ammo based on the clip size of the weapon... X-Git-Tag: xonotic-v0.5.0~309^2~7^2~148 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=918d02b566cfb1263a596c57047ff208d2399f66;p=xonotic%2Fxonotic-data.pk3dir.git Make the crosshair ring properly display ammo based on the clip size of the weapon we're holding. --- diff --git a/balanceXonotic.cfg b/balanceXonotic.cfg index d722dd720..284ae42f3 100644 --- a/balanceXonotic.cfg +++ b/balanceXonotic.cfg @@ -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 diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc index 3d1529594..eef29cdd5 100644 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@ -261,8 +261,6 @@ vector w_org, w_backoff; float sniperrifle_scope; float nex_scope; -float cr_maxbullets; - float bgmtime; string weaponorder_byimpulse; diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index f87538a9e..710c7f743 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -1092,8 +1092,6 @@ void Ent_Init() serverflags = ReadByte(); - cr_maxbullets = ReadByte(); - g_trueaim_minrange = ReadCoord(); if(!postinit) diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 8f64e8d86..1535d8bad 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -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); diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 90376b5b9..5bf221560 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -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; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index d0b7a0d23..5522eb805 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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; } diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index a6374e46d..691df5885 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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 diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index a859d3211..29330651a 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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); diff --git a/qcsrc/server/w_shotgun.qc b/qcsrc/server/w_shotgun.qc index 4f443b24a..bf742871a 100644 --- a/qcsrc/server/w_shotgun.qc +++ b/qcsrc/server/w_shotgun.qc @@ -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() diff --git a/qcsrc/server/w_sniperrifle.qc b/qcsrc/server/w_sniperrifle.qc index eb6efb86f..e591a0076 100644 --- a/qcsrc/server/w_sniperrifle.qc +++ b/qcsrc/server/w_sniperrifle.qc @@ -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()