From: Samual Lenks Date: Thu, 2 Jan 2014 00:51:50 +0000 (-0500) Subject: Use macro for WEP_NAME as well (get rid of W_Name) X-Git-Tag: xonotic-v0.8.0~152^2~171 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0d7a9455ff2952962ab9119c4a4960166ccefda0;p=xonotic%2Fxonotic-data.pk3dir.git Use macro for WEP_NAME as well (get rid of W_Name) --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 7af87c00d..3fc1ffe54 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -1168,7 +1168,7 @@ void Net_WeaponComplain() if(complain_weapon_name) strunzone(complain_weapon_name); - complain_weapon_name = strzone(W_Name(complain_weapon)); + complain_weapon_name = strzone(WEP_NAME(complain_weapon)); complain_weapon_type = ReadByte(); diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 7beb03d84..f9a69ee88 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -965,7 +965,7 @@ string arg_slot[NOTIF_MAX_ARGS]; ARG_CASE(ARG_CS_SV, "spree_inf", (autocvar_notification_show_sprees ? notif_arg_spree_inf(1, input, s2, f2) : "")) \ ARG_CASE(ARG_CS_SV, "spree_end", (autocvar_notification_show_sprees ? notif_arg_spree_inf(-1, "", "", f1) : "")) \ ARG_CASE(ARG_CS_SV, "spree_lost", (autocvar_notification_show_sprees ? notif_arg_spree_inf(-2, "", "", f1) : "")) \ - ARG_CASE(ARG_CS_SV, "item_wepname", W_Name(f1)) \ + ARG_CASE(ARG_CS_SV, "item_wepname", WEP_NAME(f1)) \ ARG_CASE(ARG_CS_SV, "item_wepammo", (s1 != "" ? sprintf(_(" with %s"), s1) : "")) \ ARG_CASE(ARG_DC, "item_centime", ftos(autocvar_notification_item_centerprinttime)) \ ARG_CASE(ARG_SV, "death_team", Team_ColoredFullName(f1)) \ diff --git a/qcsrc/common/weapons/config.qc b/qcsrc/common/weapons/config.qc index d447b1825..2537022f6 100644 --- a/qcsrc/common/weapons/config.qc +++ b/qcsrc/common/weapons/config.qc @@ -34,14 +34,14 @@ void Dump_Weapon_Settings(void) WEP_CONFIG_WRITETOFILE(sprintf( "// {{{ #%d: %s%s\n", i, - W_Name(i), + WEP_NAME(i), (((get_weaponinfo(i)).spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "") )) for(x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]) } WEP_CONFIG_WRITETOFILE("// }}}\n") // step 5: debug info - print(sprintf("#%d: %s: %d settings...\n", i, W_Name(i), WEP_CONFIG_COUNT)); + print(sprintf("#%d: %s: %d settings...\n", i, WEP_NAME(i), WEP_CONFIG_COUNT)); totalsettings += WEP_CONFIG_COUNT; } diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc index a5134d7b5..baf6adb61 100644 --- a/qcsrc/common/weapons/weapons.qc +++ b/qcsrc/common/weapons/weapons.qc @@ -249,11 +249,6 @@ void W_RandomWeapons(entity e, float n) e.weapons = result; } -string W_Name(float weaponid) // WEAPONTODO: make into a macro -{ - return (get_weaponinfo(weaponid)).message; -} - #ifdef CSQC .float GetAmmoFieldFromNum(float i) { diff --git a/qcsrc/common/weapons/weapons.qh b/qcsrc/common/weapons/weapons.qh index 3f45eb5a9..969407742 100644 --- a/qcsrc/common/weapons/weapons.qh +++ b/qcsrc/common/weapons/weapons.qh @@ -71,7 +71,6 @@ string W_FixWeaponOrder_BuildImpulseList(string o); string W_FixWeaponOrder_AllowIncomplete(string order); string W_FixWeaponOrder_ForceComplete(string order); void W_RandomWeapons(entity e, float n); -string W_Name(float weaponid); #ifdef CSQC .float GetAmmoFieldFromNum(float i); @@ -90,6 +89,7 @@ float GetAmmoStat(.float ammotype); // other useful macros #define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest) #define WEP_AMMO(wpn) ((get_weaponinfo(WEP_##wpn)).ammo_field) +#define WEP_NAME(wpn) ((get_weaponinfo(wpn)).message) // ====================== diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index 3467e2b39..14e9177c3 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -339,12 +339,12 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a shotspeedupward *= g_weaponspeedfactor; if (!shotspeed) { - dprint("bot_aim: WARNING: weapon ", W_Name(self.weapon), " shotspeed is zero!\n"); + dprint("bot_aim: WARNING: weapon ", WEP_NAME(self.weapon), " shotspeed is zero!\n"); shotspeed = 1000000; } if (!maxshottime) { - dprint("bot_aim: WARNING: weapon ", W_Name(self.weapon), " maxshottime is zero!\n"); + dprint("bot_aim: WARNING: weapon ", WEP_NAME(self.weapon), " maxshottime is zero!\n"); maxshottime = 1; } makevectors(self.v_angle); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 7634de649..b07aec818 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -286,12 +286,12 @@ string gamemode_name; float startitem_failed; -string W_Name(float weaponid); string W_Apply_Weaponreplace(string in); void FixIntermissionClient(entity e); void FixClientCvars(entity e); +// WEAPONTODO: remove this WepSet weaponsInMap; .float respawn_countdown; // next number to count diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 385e14e7c..eb3781647 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -353,7 +353,7 @@ string formatmessage(string msg) wep = self.switchweapon; if (!wep) wep = self.cnt; - replacement = W_Name(wep); + replacement = WEP_NAME(wep); } else if (escape == "W") { if (self.items & IT_SHELLS) replacement = "shells"; else if (self.items & IT_NAILS) replacement = "bullets"; diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 9ac6202fd..b4c46ca6f 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -892,7 +892,7 @@ void W_Reload(float sent_ammo_min, string sent_sound) if(IS_REAL_CLIENT(self) && self.reload_complain < time) { play2(self, "weapons/unavailable.wav"); - sprint(self, strcat("You don't have enough ammo to reload the ^2", W_Name(self.weapon), "\n")); + sprint(self, strcat("You don't have enough ammo to reload the ^2", WEP_NAME(self.weapon), "\n")); self.reload_complain = time + 1; } // switch away if the amount of ammo is not enough to keep using this weapon