]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Mario/item_wepammo_fix' into 'master'
authorMario <zacjardine@y7mail.com>
Fri, 7 Sep 2018 22:48:19 +0000 (22:48 +0000)
committerMario <zacjardine@y7mail.com>
Fri, 7 Sep 2018 22:48:19 +0000 (22:48 +0000)
Merge branch Mario/item_wepammo_fix (S merge request)

Closes #1920

See merge request xonotic/xonotic-data.pk3dir!587

16 files changed:
qcsrc/common/items/item/ammo.qh
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/items/item/jetpack.qh
qcsrc/common/items/item/powerup.qh
qcsrc/common/mutators/mutator/buffs/all.inc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/buffs/buffs.qh
qcsrc/common/mutators/mutator/buffs/cl_buffs.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/instagib/items.qh
qcsrc/common/notifications/all.inc
qcsrc/common/notifications/all.qh
qcsrc/server/miscfunctions.qh
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/throwing.qh

index 4c37464ad83c8de28d6a6f706d8f264ff26727f9..3249f07bca6caf6be0d76ae1b49ad4542c255c4c 100644 (file)
@@ -63,7 +63,7 @@ REGISTER_ITEM(Bullets, Bullets) {
     this.m_model    =   MDL_Bullets_ITEM;
 #endif
     this.netname    =   "bullets";
-    this.m_name     =   "bullets";
+    this.m_name     =   _("bullets");
     this.m_icon     =   "ammo_bullets";
 #ifdef SVQC
     this.m_botvalue =   1500;
@@ -93,7 +93,7 @@ REGISTER_ITEM(Cells, Ammo) {
     this.m_model    =   MDL_Cells_ITEM;
 #endif
     this.netname    =   "cells";
-    this.m_name     =   "cells";
+    this.m_name     =   _("cells");
     this.m_icon     =   "ammo_cells";
 #ifdef SVQC
     this.m_botvalue =   1500;
@@ -123,7 +123,7 @@ REGISTER_ITEM(Plasma, Ammo) {
     this.m_model    =   MDL_Plasma_ITEM;
 #endif
     this.netname    =   "plasma";
-    this.m_name     =   "plasma";
+    this.m_name     =   _("plasma");
     this.m_icon     =   "ammo_plasma";
 #ifdef SVQC
     this.m_botvalue =   1500;
@@ -153,7 +153,7 @@ REGISTER_ITEM(Rockets, Ammo) {
     this.m_model    =   MDL_Rockets_ITEM;
 #endif
     this.netname    =   "rockets";
-    this.m_name     =   "rockets";
+    this.m_name     =   _("rockets");
     this.m_icon     =   "ammo_rockets";
 #ifdef SVQC
     this.m_botvalue =   1500;
@@ -187,7 +187,7 @@ REGISTER_ITEM(Shells, Shells) {
     this.m_model    =   MDL_Shells_ITEM;
 #endif
     this.netname    =   "shells";
-    this.m_name     =   "shells";
+    this.m_name     =   _("shells");
     this.m_icon     =   "ammo_shells";
 #ifdef SVQC
     this.m_botvalue =   1000;
index ee39aa59242111771347d38005fe0d3c89113e4c..2ecd8355714c950f1089cc7d03bbcbc1c8a2850a 100644 (file)
@@ -39,7 +39,7 @@ REGISTER_ITEM(ArmorSmall, Armor) {
     this.m_sound                =   SND_ArmorSmall;
 #endif
     this.netname                =   "armor_small";
-    this.m_name                 =   "5 Armor";
+    this.m_name                 =   _("Small armor");
     this.m_icon                 =   "armor";
 #ifdef SVQC
     this.m_itemid               =   IT_ARMOR_SHARD;
@@ -77,7 +77,7 @@ REGISTER_ITEM(ArmorMedium, Armor) {
     this.m_sound                =   SND_ArmorMedium;
 #endif
     this.netname                =   "armor_medium";
-    this.m_name                 =   "25 Armor";
+    this.m_name                 =   _("Medium armor");
     this.m_icon                 =   "armor";
 #ifdef SVQC
     this.m_itemid               =   IT_ARMOR;
@@ -115,7 +115,7 @@ REGISTER_ITEM(ArmorBig, Armor) {
     this.m_sound                =   SND_ArmorBig;
 #endif
     this.netname                =   "armor_big";
-    this.m_name                 =   "50 Armor";
+    this.m_name                 =   _("Big armor");
     this.m_icon                 =   "armor";
     this.m_color                =   '0 1 0';
     this.m_waypoint             =   _("Big armor");
@@ -155,7 +155,7 @@ REGISTER_ITEM(ArmorMega, Armor) {
     this.m_sound                =   SND_ArmorMega;
 #endif
     this.netname                =   "armor_mega";
-    this.m_name                 =   "100 Armor";
+    this.m_name                 =   _("Mega armor");
     this.m_icon                 =   "item_large_armor";
     this.m_color                =   '0 1 0';
     this.m_waypoint             =   _("Mega armor");
index bf515fe4dd7f7c167d31c7f85b6eb3bc9e409fb3..e6a9dd9883589f13776384d823e207beae250357 100644 (file)
@@ -39,7 +39,7 @@ REGISTER_ITEM(HealthSmall, Health) {
     this.m_sound                =   SND_HealthSmall;
 #endif
     this.netname                =   "health_small";
-    this.m_name                 =   "5 Health";
+    this.m_name                 =   _("Small health");
     this.m_icon                 =   "health";
 #ifdef SVQC
     this.m_itemid               =   IT_5HP;
@@ -77,7 +77,7 @@ REGISTER_ITEM(HealthMedium, Health) {
     this.m_sound                =   SND_HealthMedium;
 #endif
     this.netname                =   "health_medium";
-    this.m_name                 =   "25 Health";
+    this.m_name                 =   _("Medium health");
     this.m_icon                 =   "health";
 #ifdef SVQC
     this.m_itemid               =   IT_25HP;
@@ -115,7 +115,7 @@ REGISTER_ITEM(HealthBig, Health) {
     this.m_sound                =   SND_HealthBig;
 #endif
     this.netname                =   "health_big";
-    this.m_name                 =   "50 Health";
+    this.m_name                 =   _("Big health");
     this.m_icon                 =   "health";
     this.m_color                =   '1 0 0';
     this.m_waypoint             =   _("Big health");
@@ -155,7 +155,7 @@ REGISTER_ITEM(HealthMega, Health) {
     this.m_sound                =   SND_HealthMega;
 #endif
     this.netname                =   "health_mega";
-    this.m_name                 =   "100 Health";
+    this.m_name                 =   _("Mega health");
     this.m_icon                 =   "item_mega_health";
     this.m_color                =   '1 0 0';
     this.m_waypoint             =   _("Mega health");
index 760033861a7db8377342bc6ff7dbd6bef1901b4b..24d040d56b403753c50f12f4ddcee7869a7f9cff 100644 (file)
@@ -35,7 +35,7 @@ REGISTER_ITEM(Jetpack, Powerup) {
     this.m_itemid               =   IT_JETPACK;
 #endif
     this.netname                =   "jetpack";
-    this.m_name                 =   "Jetpack";
+    this.m_name                 =   _("Jetpack");
     this.m_icon                 =   "jetpack";
     this.m_color                =   '0.5 0.5 0.5';
     this.m_waypoint             =   _("Jetpack");
@@ -68,7 +68,7 @@ REGISTER_ITEM(JetpackFuel, Ammo) {
     this.m_model    =   MDL_JetpackFuel_ITEM;
 #endif
     this.netname    =   "fuel";
-    this.m_name     =   "Fuel";
+    this.m_name     =   _("fuel");
     this.m_icon     =   "ammo_fuel";
 #ifdef SVQC
     this.m_botvalue =   2000;
@@ -93,7 +93,7 @@ REGISTER_ITEM(JetpackRegen, JetpackRegen) {
     this.m_model                =   MDL_JetpackRegen_ITEM;
 #endif
     this.netname                =   "fuel_regen";
-    this.m_name                 =   "Fuel regenerator";
+    this.m_name                 =   _("Fuel regenerator");
     this.m_icon                 =   "fuelregen";
     this.m_color                =   '1 0.5 0';
     this.m_waypoint             =   _("Fuel regen");
index 9de1235361787678286474044f004ddbc8e4c31c..43414b3d06f68af39afcb97f5eb0ebb7f2cf43ee 100644 (file)
@@ -40,7 +40,7 @@ REGISTER_ITEM(Strength, Powerup) {
     this.m_respawnsound     =   SND_STRENGTH_RESPAWN;
 #endif
     this.netname            =   "strength";
-    this.m_name             =   "Strength Powerup";
+    this.m_name             =   _("Strength");
     this.m_icon             =   "strength";
     this.m_color            =   '0 0 1';
     this.m_waypoint         =   _("Strength");
@@ -76,7 +76,7 @@ REGISTER_ITEM(Shield, Powerup) {
     this.m_respawnsound     =   SND_SHIELD_RESPAWN;
 #endif
     this.netname            =   "invincible";
-    this.m_name             =   "Shield";
+    this.m_name             =   _("Shield");
     this.m_icon             =   "shield";
     this.m_color            =   '1 0 1';
     this.m_waypoint         =   _("Shield");
index 877d5c4eac2630e6a55caf1d4a541d7726a7d60a..0c9b8890189c7337f774db335c7555c5d40eaea2 100644 (file)
@@ -12,8 +12,8 @@ string Buff_UndeprecateName(string buffname)
 }
 
 REGISTER_BUFF(AMMO) {
-    this.m_prettyName = _("Ammo");
-    this.m_name = "ammo";
+    this.m_name = _("Ammo");
+    this.netname = "ammo";
     this.m_skin = 3;
     this.m_color = '0.76 1 0.1';
 }
@@ -21,8 +21,8 @@ BUFF_SPAWNFUNCS(ammo, BUFF_AMMO)
 BUFF_SPAWNFUNC_Q3TA_COMPAT(ammoregen, BUFF_AMMO)
 
 REGISTER_BUFF(RESISTANCE) {
-    this.m_prettyName = _("Resistance");
-    this.m_name = "resistance";
+    this.m_name = _("Resistance");
+    this.netname = "resistance";
     this.m_skin = 0;
     this.m_color = '0.36 1 0.07';
 }
@@ -30,8 +30,8 @@ BUFF_SPAWNFUNCS(resistance, BUFF_RESISTANCE)
 BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
 
 REGISTER_BUFF(SPEED) {
-    this.m_prettyName = _("Speed");
-    this.m_name = "speed";
+    this.m_name = _("Speed");
+    this.netname = "speed";
     this.m_skin = 9;
     this.m_color = '0.1 1 0.84';
 }
@@ -40,8 +40,8 @@ BUFF_SPAWNFUNC_Q3TA_COMPAT(haste, BUFF_SPEED)
 BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_SPEED)
 
 REGISTER_BUFF(MEDIC) {
-    this.m_prettyName = _("Medic");
-    this.m_name = "medic";
+    this.m_name = _("Medic");
+    this.netname = "medic";
     this.m_skin = 1;
     this.m_color = '1 0.12 0';
 }
@@ -51,40 +51,40 @@ BUFF_SPAWNFUNC_Q3TA_COMPAT(regen, BUFF_MEDIC)
 BUFF_SPAWNFUNC_Q3TA_COMPAT(revival, BUFF_MEDIC)
 
 REGISTER_BUFF(BASH) {
-    this.m_prettyName = _("Bash");
-    this.m_name = "bash";
+    this.m_name = _("Bash");
+    this.netname = "bash";
     this.m_skin = 5;
     this.m_color = '1 0.39 0';
 }
 BUFF_SPAWNFUNCS(bash, BUFF_BASH)
 
 REGISTER_BUFF(VAMPIRE) {
-    this.m_prettyName = _("Vampire");
-    this.m_name = "vampire";
+    this.m_name = _("Vampire");
+    this.netname = "vampire";
     this.m_skin = 2;
     this.m_color = '1 0 0.24';
 }
 BUFF_SPAWNFUNCS(vampire, BUFF_VAMPIRE)
 
 REGISTER_BUFF(DISABILITY) {
-    this.m_prettyName = _("Disability");
-    this.m_name = "disability";
+    this.m_name = _("Disability");
+    this.netname = "disability";
     this.m_skin = 7;
     this.m_color = '0.94 0.3 1';
 }
 BUFF_SPAWNFUNCS(disability, BUFF_DISABILITY)
 
 REGISTER_BUFF(VENGEANCE) {
-    this.m_prettyName = _("Vengeance");
-    this.m_name = "vengeance";
+    this.m_name = _("Vengeance");
+    this.netname = "vengeance";
     this.m_skin = 15;
     this.m_color = '1 0.23 0.61';
 }
 BUFF_SPAWNFUNCS(vengeance, BUFF_VENGEANCE)
 
 REGISTER_BUFF(JUMP) {
-    this.m_prettyName = _("Jump");
-    this.m_name = "jump";
+    this.m_name = _("Jump");
+    this.netname = "jump";
     this.m_skin = 10;
     this.m_color = '0.24 0.78 1';
 }
@@ -92,8 +92,8 @@ BUFF_SPAWNFUNCS(jump, BUFF_JUMP)
 BUFF_SPAWNFUNC_Q3TA_COMPAT(jumper, BUFF_JUMP)
 
 REGISTER_BUFF(INVISIBLE) {
-    this.m_prettyName = _("Invisible");
-    this.m_name = "invisible";
+    this.m_name = _("Invisible");
+    this.netname = "invisible";
     this.m_skin = 12;
     this.m_color = '0.5 0.5 1';
 }
@@ -101,40 +101,40 @@ BUFF_SPAWNFUNCS(invisible, BUFF_INVISIBLE)
 BUFF_SPAWNFUNC_Q3TA_COMPAT(invis, BUFF_INVISIBLE)
 
 REGISTER_BUFF(INFERNO) {
-    this.m_prettyName = _("Inferno");
-    this.m_name = "inferno";
+    this.m_name = _("Inferno");
+    this.netname = "inferno";
     this.m_skin = 16;
     this.m_color = '1 0.62 0';
 }
 BUFF_SPAWNFUNCS(inferno, BUFF_INFERNO)
 
 REGISTER_BUFF(SWAPPER) {
-    this.m_prettyName = _("Swapper");
-    this.m_name = "swapper";
+    this.m_name = _("Swapper");
+    this.netname = "swapper";
     this.m_skin = 17;
     this.m_color = '0.63 0.36 1';
 }
 BUFF_SPAWNFUNCS(swapper, BUFF_SWAPPER)
 
 REGISTER_BUFF(MAGNET) {
-    this.m_prettyName = _("Magnet");
-    this.m_name = "magnet";
+    this.m_name = _("Magnet");
+    this.netname = "magnet";
     this.m_skin = 18;
     this.m_color = '1 0.95 0.18';
 }
 BUFF_SPAWNFUNCS(magnet, BUFF_MAGNET)
 
 REGISTER_BUFF(LUCK) {
-    this.m_prettyName = _("Luck");
-    this.m_name = "luck";
+    this.m_name = _("Luck");
+    this.netname = "luck";
     this.m_skin = 19;
     this.m_color = '1 0.23 0.44';
 }
 BUFF_SPAWNFUNCS(luck, BUFF_LUCK)
 
 REGISTER_BUFF(FLIGHT) {
-    this.m_prettyName = _("Flight");
-    this.m_name = "flight";
+    this.m_name = _("Flight");
+    this.netname = "flight";
     this.m_skin = 11;
     this.m_color = '0.23 0.44 1';
 }
index 8ef69aad982f45e49e646d960143f2afb5900d09..4a5dcc82aaa1ded918115799619f366f321b3d87 100644 (file)
@@ -3,7 +3,7 @@
 string BUFF_NAME(int i)
 {
     Buff b = Buffs_from(i);
-    return strcat(rgb_to_hexcolor(b.m_color), b.m_prettyName);
+    return strcat(rgb_to_hexcolor(b.m_color), b.m_name);
 }
 
 entity buff_FirstFromFlags(int _buffs)
index 35005e7a8fea65285d869afd82a8f247da833f78..7d4e583675b812169ee16ebc076b57f3973ee7e3 100644 (file)
@@ -20,13 +20,13 @@ REGISTRY_CHECK(Buffs)
 CLASS(Buff, Pickup)
        /** bit index */
        ATTRIB(Buff, m_itemid, int, 0);
-       ATTRIB(Buff, m_name, string, "buff");
+       ATTRIB(Buff, netname, string, "buff");
        ATTRIB(Buff, m_color, vector, '1 1 1');
-       ATTRIB(Buff, m_prettyName, string, "Buff");
+       ATTRIB(Buff, m_name, string, "Buff");
        ATTRIB(Buff, m_skin, int, 0);
        ATTRIB(Buff, m_sprite, string, "");
        METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) {
-               returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
+               returns(this.m_name, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.netname));
        }
 #ifdef SVQC
        METHOD(Buff, m_time, float(Buff this))
@@ -36,9 +36,8 @@ ENDCLASS(Buff)
 
 STATIC_INIT(REGISTER_BUFFS) {
     FOREACH(Buffs, true, {
-        it.netname = it.m_name; \
         it.m_itemid = BIT(it.m_id - 1); \
-        it.m_sprite = strzone(strcat("buff-", it.m_name)); \
+        it.m_sprite = strzone(strcat("buff-", it.netname)); \
     });
 }
 
index f751eecff091ff08e775bde798813d748fdb0b2f..790a10a86b8f16da4b5f0f0f65900d1813ca89a2 100644 (file)
@@ -5,7 +5,7 @@ MUTATOR_HOOKFUNCTION(cl_buffs, HUD_Powerups_add)
 {
     int allBuffs = STAT(BUFFS);
     FOREACH(Buffs, it.m_itemid & allBuffs, {
-               addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, STAT(BUFF_TIME) - time, 99), 60);
+               addPowerupItem(it.m_name, strcat("buff_", it.netname), it.m_color, bound(0, STAT(BUFF_TIME) - time, 99), 60);
        });
 }
 MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
@@ -16,8 +16,8 @@ MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
     {
         Buff b = Buffs_from(this.wp_extra);
         M_ARGV(2, vector) = b.m_color;
-        M_ARGV(3, string) = b.m_prettyName;
-        M_ARGV(4, string) = strcat("buff_", b.m_name);
+        M_ARGV(3, string) = b.m_name;
+        M_ARGV(4, string) = strcat("buff_", b.netname);
         return true;
     }
 }
index 27f71b56c24ee02f88798ed51e214c15a5b05127..b7cdbf05b83c171ad278e61a3eb7e9c021ff78d6 100644 (file)
@@ -210,7 +210,7 @@ float buff_Available(entity buff)
                return false;
        if (buff == BUFF_VAMPIRE && cvar("g_vampire"))
                return false;
-       return cvar(strcat("g_buffs_", buff.m_name));
+       return cvar(strcat("g_buffs_", buff.netname));
 }
 
 .int buff_seencount;
index 3f8d087166353715a224acd0d7bbf4383cdb2154..42e3adbd73b74c6fa8eb1d23abfcde0c8e086145 100644 (file)
@@ -30,7 +30,7 @@ REGISTER_ITEM(VaporizerCells, Ammo) {
     this.m_sound                =   SND_VaporizerCells;
 #endif
     this.netname                =   "vaporizer_cells";
-    this.m_name                 =   "Vaporizer Ammo";
+    this.m_name                 =   _("Vaporizer ammo");
     this.m_icon                 =   "ammo_supercells";
 #ifdef SVQC
     this.m_botvalue             =   2000;
@@ -56,7 +56,7 @@ REGISTER_ITEM(ExtraLife, Powerup) {
     this.m_sound                =   SND_ExtraLife;
 #endif
     this.netname                =   "extralife";
-    this.m_name                 =   "Extra life";
+    this.m_name                 =   _("Extra life");
     this.m_icon                 =   "item_mega_health";
     this.m_color                =   '1 0 0';
     this.m_waypoint             =   _("Extra life");
@@ -88,7 +88,7 @@ REGISTER_ITEM(Invisibility, Powerup) {
     this.m_respawnsound     =   SND_STRENGTH_RESPAWN;
 #endif
     this.netname            =   "invisibility";
-    this.m_name             =   "Invisibility";
+    this.m_name             =   _("Invisibility");
     this.m_icon             =   "strength";
     this.m_color            =   '0 0 1';
     this.m_waypoint         =   _("Invisibility");
@@ -123,7 +123,7 @@ REGISTER_ITEM(Speed, Powerup) {
     this.m_respawnsound     =   SND_SHIELD_RESPAWN;
 #endif
     this.netname            =   "speed";
-    this.m_name             =   "Speed";
+    this.m_name             =   _("Speed");
     this.m_icon             =   "shield";
     this.m_color            =   '1 0 1';
     this.m_waypoint         =   _("Speed");
index 53675d9a19294b6a780ed3295741eaca537b3950..7cb218412f8897dec276c561b06ce5bbd0b188bf 100644 (file)
     MSG_INFO_NOTIF(ITEM_BUFF_GOT,                           N_CONSOLE,  0, 1, "item_buffname", "",          "",     _("^BGYou got the %s^BG buff!"), "")
 
     MSG_INFO_NOTIF(ITEM_WEAPON_DONTHAVE,                    N_DISABLE,  0, 1, "item_wepname", "",                           "",     _("^BGYou do not have the ^F1%s"), "")
-    MSG_INFO_NOTIF(ITEM_WEAPON_DROP,                        N_DISABLE,  1, 1, "item_wepname item_wepammo", "",              "",     _("^BGYou dropped the ^F1%s^BG%s"), "")
+    MSG_INFO_NOTIF(ITEM_WEAPON_DROP,                        N_DISABLE,  0, 2, "item_wepname item_wepammo", "",              "",     _("^BGYou dropped the ^F1%s^BG%s"), "")
     MSG_INFO_NOTIF(ITEM_WEAPON_GOT,                         N_DISABLE,  0, 1, "item_wepname", "",                           "",     _("^BGYou got the ^F1%s"), "")
     MSG_INFO_NOTIF(ITEM_WEAPON_NOAMMO,                      N_DISABLE,  0, 1, "item_wepname", "",                           "",     _("^BGYou don't have enough ammo for the ^F1%s"), "")
     MSG_INFO_NOTIF(ITEM_WEAPON_PRIMORSEC,                   N_DISABLE,  0, 3, "item_wepname f2primsec f3primsec", "",       "",     _("^F1%s %s^BG is unable to fire, but its ^F1%s^BG can"), "")
     MSG_CENTER_NOTIF(ITEM_FUELREGEN_GOT,                N_ENABLE,    0, 0, "",                                   CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1Fuel regenerator"), "")
     MSG_CENTER_NOTIF(ITEM_JETPACK_GOT,                  N_ENABLE,    0, 0, "",                                   CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1Jetpack"), "")
     MSG_CENTER_NOTIF(ITEM_WEAPON_DONTHAVE,              N_ENABLE,    0, 1, "item_wepname",                       CPID_ITEM, "item_centime 0", _("^BGYou do not have the ^F1%s"), "")
-    MSG_CENTER_NOTIF(ITEM_WEAPON_DROP,                  N_ENABLE,    1, 1, "item_wepname item_wepammo",          CPID_ITEM, "item_centime 0", _("^BGYou dropped the ^F1%s^BG%s"), "")
+    MSG_CENTER_NOTIF(ITEM_WEAPON_DROP,                  N_ENABLE,    0, 2, "item_wepname item_wepammo",          CPID_ITEM, "item_centime 0", _("^BGYou dropped the ^F1%s^BG%s"), "")
     MSG_CENTER_NOTIF(ITEM_WEAPON_GOT,                   N_ENABLE,    0, 1, "item_wepname",                       CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1%s"), "")
     MSG_CENTER_NOTIF(ITEM_WEAPON_NOAMMO,                N_ENABLE,    0, 1, "item_wepname",                       CPID_ITEM, "item_centime 0", _("^BGYou don't have enough ammo for the ^F1%s"), "")
     MSG_CENTER_NOTIF(ITEM_WEAPON_PRIMORSEC,             N_ENABLE,    0, 3, "item_wepname f2primsec f3primsec",   CPID_ITEM, "item_centime 0", _("^F1%s %s^BG is unable to fire, but its ^F1%s^BG can"), "")
index 7982ee01f73acfc3348bed12334f125d60af494e..6cbf91cc9b3fe185cb1b728b75dc8d273435e612 100644 (file)
@@ -6,6 +6,7 @@
 #include <common/teams.qh>
 #include <common/util.qh>
 #include <common/sounds/sound.qh>
+#include <common/weapons/all.qh>
 
 #ifdef CSQC
 #include <client/autocvars.qh>
@@ -370,7 +371,7 @@ float autocvar_notification_show_sprees_center_specialonly = true;
        spree_end: placed at the end of murder messages to show ending of sprees
        spree_lost: placed at the end of suicide messages to show losing of sprees
        item_wepname: return full name of a weapon from weaponid
-       item_wepammo: ammo display for weapon from string
+       item_wepammo: ammo display for weapon from f1 and f2
        item_centime: amount of time to display weapon message in centerprint
        item_buffname: return full name of a buff from buffid
        death_team: show the full name of the team a player is switching from
@@ -433,7 +434,7 @@ string BUFF_NAME(int i);
        ARG_CASE(ARG_CS_SV,     "item_wepname",  Weapons_from(f1).m_name) \
        ARG_CASE(ARG_CS_SV,     "item_buffname", BUFF_NAME(f1)) \
        ARG_CASE(ARG_CS_SV,     "f3buffname",    BUFF_NAME(f3)) \
-       ARG_CASE(ARG_CS_SV,     "item_wepammo",  (s1 != "" ? sprintf(_(" with %s"), s1) : "")) \
+       ARG_CASE(ARG_CS_SV,     "item_wepammo",  (f2 > 0 ? notif_arg_item_wepammo(f1, f2) : "")) \
        ARG_CASE(ARG_DC,        "item_centime",  ftos(autocvar_notification_item_centerprinttime)) \
        ARG_CASE(ARG_SV,        "death_team",    Team_ColoredFullName(f1)) \
        ARG_CASE(ARG_CS,        "death_team",    Team_ColoredFullName(f1 - 1)) \
@@ -624,6 +625,23 @@ string notif_arg_spree_inf(float type, string input, string player, float spree)
        return "";
 }
 
+string notif_arg_item_wepammo(float f1, float f2)
+{
+       string ammoitems = "";
+       Weapon wep = Weapons_from(f1);
+       switch (wep.ammo_type)
+       {
+               case RESOURCE_SHELLS:  ammoitems = ITEM_Shells.m_name;      break;
+               case RESOURCE_BULLETS: ammoitems = ITEM_Bullets.m_name;     break;
+               case RESOURCE_ROCKETS: ammoitems = ITEM_Rockets.m_name;     break;
+               case RESOURCE_CELLS:   ammoitems = ITEM_Cells.m_name;       break;
+               case RESOURCE_PLASMA:  ammoitems = ITEM_Plasma.m_name;      break;
+               case RESOURCE_FUEL:    ammoitems = ITEM_JetpackFuel.m_name; break;
+               default: return ""; // doesn't use ammo
+       }
+       return sprintf(_(" with %d %s"), f2, ammoitems);
+}
+
 
 // ====================================
 //  Initialization/Create Declarations
index ff62cd1674b3487185903df618d3198459817beb..2374b4869bc6c5415c08c319a162850ca9871440 100644 (file)
@@ -96,6 +96,8 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
 
 string NearestLocation(vector p);
 
+string AmmoNameFromWeaponentity(Weapon wep);
+
 void play2(entity e, string filename);
 
 string playername(entity p, bool team_colorize);
index 462af14d8e0ca151f366f9daa611f1caf3c00cc7..9aaabb05bfafa8075ea63466e89ab0996ffe53b5 100644 (file)
@@ -33,11 +33,9 @@ void thrown_wep_think(entity this)
                SUB_VanishOrRemove(this);
 }
 
-// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
-string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity)
+// returns amount of ammo used, or -1 for failure, or 0 for no ammo count
+float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity)
 {
-       float thisammo;
-       string s;
        Weapon info = Weapons_from(wpn);
        int ammotype = info.ammo_type;
 
@@ -84,7 +82,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
 
        weapon_defaultspawnfunc(wep, info);
        if(startitem_failed)
-               return string_null;
+               return -1;
        setthink(wep, thrown_wep_think);
        wep.savenextthink = wep.nextthink;
        wep.nextthink = min(wep.nextthink, time + 0.5);
@@ -93,12 +91,10 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
        //wa = W_AmmoItemCode(wpn);
        if(ammotype == RESOURCE_NONE)
        {
-               return "";
+               return 0;
        }
        else
        {
-               s = "";
-
                if(doreduce && g_weapon_stay == 2)
                {
                        // if our weapon is loaded, give its load back to the player
@@ -121,23 +117,13 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                        }
 
                        float ownderammo = GetResourceAmount(own, ammotype);
-                       thisammo = min(ownderammo, GetResourceAmount(wep, ammotype));
+                       float thisammo = min(ownderammo, GetResourceAmount(wep, ammotype));
                        SetResourceAmount(wep, ammotype, thisammo);
                        SetResourceAmount(own, ammotype, ownderammo - thisammo);
 
-                       switch (ammotype)
-                       {
-                               case RESOURCE_SHELLS:  s = sprintf("%s and %d shells", s, thisammo);  break;
-                               case RESOURCE_BULLETS: s = sprintf("%s and %d nails", s, thisammo);   break;
-                               case RESOURCE_ROCKETS: s = sprintf("%s and %d rockets", s, thisammo); break;
-                               case RESOURCE_CELLS:   s = sprintf("%s and %d cells", s, thisammo);   break;
-                               case RESOURCE_PLASMA:  s = sprintf("%s and %d plasma", s, thisammo);  break;
-                               case RESOURCE_FUEL:    s = sprintf("%s and %d fuel", s, thisammo);    break;
-                       }
-
-                       s = substring(s, 5, -1);
+                       return thisammo;
                }
-               return s;
+               return 0;
        }
 }
 
@@ -175,10 +161,10 @@ void W_ThrowWeapon(entity this, .entity weaponentity, vector velo, vector delta,
        STAT(WEAPONS, this) &= ~set;
 
        W_SwitchWeapon_Force(this, w_getbestweapon(this, weaponentity), weaponentity);
-       string a = W_ThrowNewWeapon(this, w.m_id, doreduce, this.origin + delta, velo, weaponentity);
+       float a = W_ThrowNewWeapon(this, w.m_id, doreduce, this.origin + delta, velo, weaponentity);
 
-       if(!a) return;
-       Send_Notification(NOTIF_ONE, this, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id);
+       if(a < 0) return;
+       Send_Notification(NOTIF_ONE, this, MSG_MULTI, ITEM_WEAPON_DROP, w.m_id, a);
 }
 
 void SpawnThrownWeapon(entity this, vector org, Weapon wep, .entity weaponentity)
index 9ea5e5cb8e442c930f628f47f1e93ff29ef150de..20732753e4fe66f11c1fdd802df01eda300fc658 100644 (file)
@@ -6,8 +6,8 @@
 .float savenextthink;
 void thrown_wep_think(entity this);
 
-// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
-string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity);
+// returns amount of ammo used, or -1 for failure, or 0 for no ammo count
+float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity);
 
 bool W_IsWeaponThrowable(entity this, int w);