From: Samual Lenks Date: Tue, 31 Dec 2013 16:34:21 +0000 (-0500) Subject: Proper naming for "ammo_field" X-Git-Tag: xonotic-v0.8.0~152^2~186 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8d4ff7dfca74f10e0dee1f2be457f98b8c15a59a;p=xonotic%2Fxonotic-data.pk3dir.git Proper naming for "ammo_field" --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 9b778b989..9c26e61a8 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -784,7 +784,7 @@ void HUD_Weapons(void) } // draw ammo status bar - if(autocvar_hud_panel_weapons_ammo && self.current_ammo != ammo_none) + if(autocvar_hud_panel_weapons_ammo && self.ammo_field != ammo_none) { a = 0; ammo_type = GetAmmoTypeForWep(self.weapon); diff --git a/qcsrc/common/weapons/w_blaster.qc b/qcsrc/common/weapons/w_blaster.qc index 7566d10ec..3d0fced42 100644 --- a/qcsrc/common/weapons/w_blaster.qc +++ b/qcsrc/common/weapons/w_blaster.qc @@ -228,7 +228,7 @@ float W_Blaster(float request) case WR_SETUP: { - self.current_ammo = ammo_none; + self.ammo_field = ammo_none; return TRUE; } diff --git a/qcsrc/common/weapons/w_fireball.qc b/qcsrc/common/weapons/w_fireball.qc index ad2e42625..07b137159 100644 --- a/qcsrc/common/weapons/w_fireball.qc +++ b/qcsrc/common/weapons/w_fireball.qc @@ -406,7 +406,7 @@ float W_Fireball(float req) } case WR_SETUP: { - self.current_ammo = ammo_none; + self.ammo_field = ammo_none; return TRUE; } case WR_CHECKAMMO1: diff --git a/qcsrc/common/weapons/w_porto.qc b/qcsrc/common/weapons/w_porto.qc index e0bf83ba4..c5b5585d8 100644 --- a/qcsrc/common/weapons/w_porto.qc +++ b/qcsrc/common/weapons/w_porto.qc @@ -379,7 +379,7 @@ float W_Porto(float req) } case WR_SETUP: { - self.current_ammo = ammo_none; + self.ammo_field = ammo_none; return TRUE; } case WR_RESETPLAYER: diff --git a/qcsrc/common/weapons/w_shotgun.qc b/qcsrc/common/weapons/w_shotgun.qc index bb20240af..4a678607d 100644 --- a/qcsrc/common/weapons/w_shotgun.qc +++ b/qcsrc/common/weapons/w_shotgun.qc @@ -249,7 +249,7 @@ float W_Shotgun(float req) } case WR_SETUP: { - self.current_ammo = ammo_none; + self.ammo_field = ammo_none; return TRUE; } case WR_CHECKAMMO1: diff --git a/qcsrc/common/weapons/w_tuba.qc b/qcsrc/common/weapons/w_tuba.qc index 7db2bd4e9..8adbcd024 100644 --- a/qcsrc/common/weapons/w_tuba.qc +++ b/qcsrc/common/weapons/w_tuba.qc @@ -419,7 +419,7 @@ float W_Tuba(float req) } case WR_SETUP: { - self.current_ammo = ammo_none; + self.ammo_field = ammo_none; self.tuba_instrument = 0; return TRUE; } diff --git a/qcsrc/common/weapons/w_vaporizer.qc b/qcsrc/common/weapons/w_vaporizer.qc index 63c9bb5cf..2af1be72a 100644 --- a/qcsrc/common/weapons/w_vaporizer.qc +++ b/qcsrc/common/weapons/w_vaporizer.qc @@ -196,7 +196,7 @@ float W_Vaporizer(float req) } case WR_SETUP: { - self.current_ammo = AMMO_VAL(WEP_VAPORIZER); + self.ammo_field = AMMO_VAL(WEP_VAPORIZER); self.vaporizer_lasthit = 0; return TRUE; } diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc index 121df37b2..7d33f1e82 100644 --- a/qcsrc/common/weapons/weapons.qc +++ b/qcsrc/common/weapons/weapons.qc @@ -92,7 +92,7 @@ void register_weapon(float id, WepSet bit, float(float) func, .float ammotype, f e.model2 = strzone(strcat("wpn-", ftos(id))); e.impulse = i; e.bot_pickupbasevalue = pickupbasevalue; - e.current_ammo = ammotype; + e.ammo_field = ammotype; #ifndef MENUQC func(WR_INIT); @@ -118,7 +118,7 @@ void register_weapons_done() dummy_weapon_info.model2 = ""; dummy_weapon_info.impulse = -1; dummy_weapon_info.bot_pickupbasevalue = 0; - dummy_weapon_info.current_ammo = ammo_none; + dummy_weapon_info.ammo_field = ammo_none; float i; weaponorder_byid = ""; diff --git a/qcsrc/common/weapons/weapons.qh b/qcsrc/common/weapons/weapons.qh index 732c51363..a506f4149 100644 --- a/qcsrc/common/weapons/weapons.qh +++ b/qcsrc/common/weapons/weapons.qh @@ -137,11 +137,11 @@ string W_Name(float weaponid); .float impulse; // weapon impulse .float bot_pickupbasevalue; // bot weapon priority .string model2; // wpn- sprite name -..float current_ammo; // main ammo field +..float ammo_field; // main ammo field // other useful macros #define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest) -#define AMMO_VAL(wpn) ((get_weaponinfo(wpn)).current_ammo) +#define AMMO_VAL(wpn) ((get_weaponinfo(wpn)).ammo_field) // ===================== // Weapon Registration diff --git a/qcsrc/server/mutators/mutator_nix.qc b/qcsrc/server/mutators/mutator_nix.qc index 29153f1a1..4603a1cca 100644 --- a/qcsrc/server/mutators/mutator_nix.qc +++ b/qcsrc/server/mutators/mutator_nix.qc @@ -68,7 +68,7 @@ void NIX_GiveCurrentWeapon() if(self.items & IT_UNLIMITED_WEAPON_AMMO) { - switch(e.current_ammo) + switch(e.ammo_field) { case ammo_shells: self.ammo_shells = autocvar_g_pickup_shells_max; break; case ammo_nails: self.ammo_nails = autocvar_g_pickup_nails_max; break; @@ -79,7 +79,7 @@ void NIX_GiveCurrentWeapon() } else { - switch(e.current_ammo) + switch(e.ammo_field) { case ammo_shells: self.ammo_shells = autocvar_g_balance_nix_ammo_shells; break; case ammo_nails: self.ammo_nails = autocvar_g_balance_nix_ammo_nails; break; @@ -121,7 +121,7 @@ void NIX_GiveCurrentWeapon() if(!(self.items & IT_UNLIMITED_WEAPON_AMMO) && time > self.nix_nextincr) { - switch(e.current_ammo) + switch(e.ammo_field) { case ammo_shells: self.ammo_shells += autocvar_g_balance_nix_ammoincr_shells; break; case ammo_nails: self.ammo_nails += autocvar_g_balance_nix_ammoincr_nails; break; diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index c51ea58d9..62dd374db 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -505,25 +505,25 @@ void Item_ScheduleInitialRespawn(entity e) Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e)); } -float Item_GiveAmmoTo(entity item, entity player, .float ammofield, float ammomax, float mode) +float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode) { - if (!item.ammofield) + if (!item.ammotype) return FALSE; if (item.spawnshieldtime) { - if ((player.ammofield < ammomax) || item.pickup_anyway) + if ((player.ammotype < ammomax) || item.pickup_anyway) { - player.ammofield = bound(player.ammofield, ammomax, player.ammofield + item.ammofield); + player.ammotype = bound(player.ammotype, ammomax, player.ammotype + item.ammotype); goto YEAH; } } else if(g_weapon_stay == 2) { - float mi = min(item.ammofield, ammomax); - if (player.ammofield < mi) + float mi = min(item.ammotype, ammomax); + if (player.ammotype < mi) { - player.ammofield = mi; + player.ammotype = mi; goto YEAH; } } diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index 2480e5f55..a30af11d2 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -67,7 +67,7 @@ float ITEM_MODE_NONE = 0; float ITEM_MODE_HEALTH = 1; float ITEM_MODE_ARMOR = 2; float ITEM_MODE_FUEL = 3; -float Item_GiveAmmoTo(entity item, entity player, .float ammofield, float ammomax, float mode); +float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode); float Item_GiveTo(entity item, entity player); diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index 94d6d2135..409dbfe07 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -131,9 +131,9 @@ void weapon_defaultspawnfunc(float wpn) self.superweapons_finished = autocvar_g_balance_superweapons_time; // if we don't already have ammo, give us some ammo - if(!self.(e.current_ammo)) + if(!self.(e.ammo_field)) { - switch(e.current_ammo) + switch(e.ammo_field) { case ammo_shells: self.ammo_shells = cvar("g_pickup_shells_weapon"); break; case ammo_nails: self.ammo_nails = cvar("g_pickup_nails_weapon"); break; @@ -150,9 +150,9 @@ void weapon_defaultspawnfunc(float wpn) { if(e.items & j) { - ammofield = Item_CounterField(j); - if(!self.ammofield) - self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon")); + ammotype = Item_CounterField(j); + if(!self.ammotype) + self.ammotype = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon")); } } } diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index 7ac461969..bf71da4c4 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -22,7 +22,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto entity oldself, wep; float thisammo, i; string s; - var .float ammofield = (get_weaponinfo(wpn)).current_ammo; + var .float ammotype = (get_weaponinfo(wpn)).ammo_field; wep = spawn(); @@ -74,7 +74,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto wep.pickup_anyway = TRUE; // these are ALWAYS pickable //wa = W_AmmoItemCode(wpn); - if(ammofield == ammo_none) + if(ammotype == ammo_none) { return ""; } @@ -87,26 +87,26 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto // if our weapon is loaded, give its load back to the player if(self.(weapon_load[self.weapon]) > 0) { - own.ammofield += self.(weapon_load[self.weapon]); + own.ammotype += self.(weapon_load[self.weapon]); self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading } - wep.ammofield = 0; + wep.ammotype = 0; } else if(doreduce) { // if our weapon is loaded, give its load back to the player if(self.(weapon_load[self.weapon]) > 0) { - own.ammofield += self.(weapon_load[self.weapon]); + own.ammotype += self.(weapon_load[self.weapon]); self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading } - thisammo = min(own.ammofield, wep.ammofield); - wep.ammofield = thisammo; - own.ammofield -= thisammo; + thisammo = min(own.ammotype, wep.ammotype); + wep.ammotype = thisammo; + own.ammotype -= thisammo; - switch(ammofield) + switch(ammotype) { case ammo_shells: s = sprintf("%s and %d shells", s, thisammo); break; case ammo_nails: s = sprintf("%s and %d nails", s, thisammo); break; @@ -139,7 +139,7 @@ float W_IsWeaponThrowable(float w) // start weapons that take no ammo can't be dropped (this prevents dropping the laser, as long as it continues to use no ammo) if(start_items & IT_UNLIMITED_WEAPON_AMMO) return 0; - if((get_weaponinfo(w)).current_ammo == ammo_none) + if((get_weaponinfo(w)).ammo_field == ammo_none) return 0; } diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index e5145927d..da98d7f1c 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -686,7 +686,7 @@ void W_WeaponFrame() self.weapon = self.switchweapon; self.weaponname = newwep.mdl; self.bulletcounter = 0; // WEAPONTODO - //self.current_ammo = newwep.current_ammo; + //self.ammo_field = newwep.ammo_field; WEP_ACTION(self.switchweapon, WR_SETUP); self.weaponentity.state = WS_RAISE; @@ -823,7 +823,7 @@ void W_DecreaseAmmo(float ammo_use) self.(weapon_load[self.weapon]) = self.clip_load; } else - self.(wep.current_ammo) -= ammo_use; + self.(wep.ammo_field) -= ammo_use; } // weapon reloading code @@ -839,14 +839,14 @@ void W_ReloadedAndReady() self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading // if the gun uses no ammo, max out weapon load, else decrease ammo as we increase weapon load - if(!self.reload_ammo_min || self.items & IT_UNLIMITED_WEAPON_AMMO || self.current_ammo == ammo_none) + if(!self.reload_ammo_min || self.items & IT_UNLIMITED_WEAPON_AMMO || self.ammo_field == ammo_none) self.clip_load = self.reload_ammo_amount; else { - while(self.clip_load < self.reload_ammo_amount && self.(self.current_ammo)) // make sure we don't add more ammo than we have + while(self.clip_load < self.reload_ammo_amount && self.(self.ammo_field)) // make sure we don't add more ammo than we have { self.clip_load += 1; - self.(self.current_ammo) -= 1; + self.(self.ammo_field) -= 1; } } self.(weapon_load[self.weapon]) = self.clip_load; @@ -887,8 +887,8 @@ void W_Reload(float sent_ammo_min, string sent_sound) return; // no ammo, so nothing to load - if(self.current_ammo != ammo_none) - if(!self.(self.current_ammo) && self.reload_ammo_min) + if(self.ammo_field != ammo_none) + if(!self.(self.ammo_field) && self.reload_ammo_min) if (!(self.items & IT_UNLIMITED_WEAPON_AMMO)) { if(IS_REAL_CLIENT(self) && self.reload_complain < time)