Dynamic weapon system - assign weapon IDs dynamically
authordiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Fri, 22 Jan 2010 19:46:17 +0000 (19:46 +0000)
committerdiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Fri, 22 Jan 2010 19:46:17 +0000 (19:46 +0000)
git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8522 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

24 files changed:
data/qcsrc/client/sbar.qc
data/qcsrc/common/items.qc
data/qcsrc/common/items.qh
data/qcsrc/common/util.qh
data/qcsrc/server/bot/bot.qh
data/qcsrc/server/defs.qh
data/qcsrc/server/progs.src
data/qcsrc/server/w_all.qc [new file with mode: 0644]
data/qcsrc/server/w_campingrifle.qc
data/qcsrc/server/w_crylink.qc
data/qcsrc/server/w_electro.qc
data/qcsrc/server/w_fireball.qc
data/qcsrc/server/w_grenadelauncher.qc
data/qcsrc/server/w_hagar.qc
data/qcsrc/server/w_hlac.qc
data/qcsrc/server/w_hook.qc
data/qcsrc/server/w_laser.qc
data/qcsrc/server/w_minstanex.qc
data/qcsrc/server/w_nex.qc
data/qcsrc/server/w_porto.qc
data/qcsrc/server/w_rocketlauncher.qc
data/qcsrc/server/w_shotgun.qc
data/qcsrc/server/w_tuba.qc
data/qcsrc/server/w_uzi.qc

index 4c207d4..208a6c5 100644 (file)
@@ -3,8 +3,8 @@ void drawstringcenter(vector, string, vector, vector, float, float);
 
 float teamnagger;
 
-float weapon_hits[WEP_COUNT];
-float weapon_fired[WEP_COUNT];
+float weapon_hits[WEP_MAXCOUNT];
+float weapon_fired[WEP_MAXCOUNT];
 float weapon_number;
 
 float last_weapon;
index f72cd11..d1714c9 100644 (file)
@@ -2,13 +2,13 @@
 entity weapon_info[24];
 entity dummy_weapon_info;
 
-void register_weapon_real(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname)
+void register_weapon(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname)
 {
        entity e;
        weapon_info[id - 1] = e = spawn();
        e.classname = "weapon_info";
        e.weapon = id;
-       e.weapons = power2of(id - 1);
+       e.weapons = power2of(id - WEP_FIRST);
        e.netname = shortname;
        e.message = wname;
        e.items = ammotype;
@@ -89,35 +89,3 @@ string W_FixWeaponOrder(string order, float complete)
 {
        return fixPriorityList(order, WEP_FIRST, WEP_LAST, 230 - WEP_FIRST, complete);
 }
-
-#ifdef SVQC
-#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
-       register_weapon_real(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname)
-#else
-// no weapon funcs here!
-#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
-       register_weapon_real(id,w_null,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname)
-#endif
-
-void RegisterWeapons()
-{
-       // %weaponaddpoint
-       register_weapon(WEP_LASER,            w_laser,        0,                1,  1, 1, WEP_TYPE_SPLASH,  0,                      "laser",        "laser",           "Laser");
-       register_weapon(WEP_SHOTGUN,          w_shotgun,      IT_SHELLS,        2,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_LOW,  "shotgun",      "shotgun",         "Shotgun");
-       register_weapon(WEP_UZI,              w_uzi,          IT_NAILS,         3,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID,  "uzi",          "uzi",             "Machine Gun");
-       register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher,    IT_ROCKETS,       4,  1, 1, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_MID,  "gl",           "grenadelauncher", "Mortar");
-       register_weapon(WEP_ELECTRO,          w_electro,      IT_CELLS,         5,  1, 0, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_MID,  "electro",      "electro",         "Electro");
-       register_weapon(WEP_CRYLINK,          w_crylink,      IT_CELLS,         6,  1, 0, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_MID,  "crylink",      "crylink",         "Crylink");
-       register_weapon(WEP_NEX,              w_nex,          IT_CELLS,         7,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "nex",          "nex",             "Nex");
-       register_weapon(WEP_HAGAR,            w_hagar,        IT_ROCKETS,       8,  1, 1, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_MID,  "hagar",        "hagar",           "Hagar");
-       register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher,    IT_ROCKETS,       9,  1, 1, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_HIGH, "rl",           "rocketlauncher",  "Rocket Launcher");
-       register_weapon(WEP_PORTO,            w_porto,        0,                0,  0, 0, WEP_TYPE_OTHER,   0,                      "porto" ,       "porto",           "Port-O-Launch");
-       register_weapon(WEP_MINSTANEX,        w_minstanex,    IT_CELLS,         7, -1, 1, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "minstanex",    "minstanex",       "MinstaNex");
-       register_weapon(WEP_HOOK,             w_hook,         IT_CELLS|IT_FUEL, 0,  0, 1, WEP_TYPE_SPLASH,  0,                      "hookgun",      "hook",            "Grappling Hook");
-       register_weapon(WEP_HLAC,             w_hlac,         IT_CELLS,         6,  1, 0, WEP_TYPE_SPLASH,  BOT_PICKUP_RATING_MID,  "hlac",         "hlac",            "Heavy Laser Assault Cannon");
-       register_weapon(WEP_TUBA,             w_tuba,         0,                1, -1, 0, WEP_TYPE_SPLASH,  BOT_PICKUP_RATING_MID,  "tuba",         "tuba",            "@!#%'n Tuba");
-       register_weapon(WEP_CAMPINGRIFLE,     w_campingrifle, IT_NAILS,         3,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID,  "campingrifle", "campingrifle",    "Rifle");
-       register_weapon(WEP_FIREBALL,         w_fireball,     IT_ROCKETS,       9,  0, 0, WEP_TYPE_SPLASH,  BOT_PICKUP_RATING_MID,  "fireball",     "fireball",        "Fireball");
-
-       register_weapons_done();
-}
index b3ad8dc..2bb10d4 100644 (file)
@@ -1,25 +1,3 @@
-// Weapon indexes
-// %weaponaddpoint
-float WEP_FIRST                                =  1;
-float WEP_LASER                                =  1; float WEPBIT_LASER                        = 1; // always: 2^(w-1)
-float WEP_SHOTGUN                      =  2; float WEPBIT_SHOTGUN                      = 2;
-float WEP_UZI                          =  3; float WEPBIT_UZI                          = 4;
-float WEP_GRENADE_LAUNCHER     =  4; float WEPBIT_GRENADE_LAUNCHER     = 8;
-float WEP_ELECTRO                      =  5; float WEPBIT_ELECTRO                      = 16;
-float WEP_CRYLINK                      =  6; float WEPBIT_CRYLINK                      = 32;
-float WEP_NEX                          =  7; float WEPBIT_NEX                          = 64;
-float WEP_HAGAR                                =  8; float WEPBIT_HAGAR                        = 128;
-float WEP_ROCKET_LAUNCHER      =  9; float WEPBIT_ROCKET_LAUNCHER      = 256;
-float WEP_PORTO                                = 10; float WEPBIT_PORTO                        = 512;
-float WEP_MINSTANEX                    = 11; float WEPBIT_MINSTANEX            = 1024;
-float WEP_HOOK                         = 12; float WEPBIT_HOOK                 = 2048;
-float WEP_HLAC                     = 13; float WEPBIT_HLAC                     = 4096;
-float WEP_TUBA             = 14; float WEPBIT_TUBA             = 8192;
-float WEP_CAMPINGRIFLE     = 15; float WEPBIT_CAMPINGRIFLE     = 16384;
-float WEP_FIREBALL          = 16; float WEPBIT_FIREBALL                    = 32768;
-float WEP_LAST                         = 16; float WEPBIT_ALL              = 65535;
-float WEP_COUNT             = 17;
-
 float BOT_PICKUP_RATING_LOW    = 2500;
 float BOT_PICKUP_RATING_MID    = 5000;
 float BOT_PICKUP_RATING_HIGH   = 10000;
@@ -74,7 +52,6 @@ string weaponpriority_hudselector_1;
 // functions:
 entity get_weaponinfo(float id);
 string W_FixWeaponOrder(string order, float complete);
-void RegisterWeapons();
 
 #define WEPSPAWNFLAG_NORMAL 1
 #define WEPSPAWNFLAG_CANCLIMB 2
@@ -94,3 +71,40 @@ void RegisterWeapons();
 .float weapon_type; // see WEP_TYPE_* constants
 .float bot_pickupbasevalue; // bot weapon priority
 .string model2; // wpn- sprite name
+
+
+
+// dynamic weapon adding
+float w_null(float dummy);
+void register_weapon(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname);
+void register_weapons_done();
+
+float WEP_COUNT;
+float WEP_FIRST = 1;
+float WEP_LAST;
+#define WEP_MAXCOUNT 24
+float WEPBIT_ALL;
+#define REGISTER_WEAPON_2(id,bit,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
+       float id; \
+       float bit; \
+       float func(float); \
+       void RegisterWeapons_##id() \
+       { \
+               WEP_LAST = (id = WEP_FIRST + WEP_COUNT); \
+               WEPBIT_ALL |= (bit = power2of(WEP_COUNT)); \
+               ++WEP_COUNT; \
+               register_weapon(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname); \
+       } \
+       ACCUMULATE_FUNCTION(RegisterWeapons, RegisterWeapons_##id)
+#ifdef SVQC
+#define REGISTER_WEAPON(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
+       REGISTER_WEAPON_2(WEP_##id,WEPBIT_##id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname)
+#else
+#define REGISTER_WEAPON(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
+       REGISTER_WEAPON_2(WEP_##id,WEPBIT_##id,w_null,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname)
+#endif
+
+#include "../server/w_all.qc"
+
+#undef REGISTER_WEAPON
+ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done)
index 3133458..8174cb7 100644 (file)
@@ -1,3 +1,12 @@
+#define ACCUMULATE_FUNCTION(func,otherfunc) \
+       #ifdef func \
+       void __merge__##otherfunc() { func(); otherfunc(); } \
+       #undef func \
+       #define func __merge__##otherfunc \
+       #else \
+       #define func otherfunc \
+       #endif
+
 // this returns a tempstring containing a copy of s with additional \n newlines added, it also replaces \n in the text with a real newline
 // NOTE: s IS allowed to be a tempstring
 string wordwrap(string s, float l);
index e7b0ef8..75619e1 100644 (file)
@@ -45,9 +45,9 @@ float bot_custom_weapon;
 float bot_distance_far;
 float bot_distance_close;
 
-float bot_weapons_far[WEP_LAST];
-float bot_weapons_mid[WEP_LAST];
-float bot_weapons_close[WEP_LAST];
+float bot_weapons_far[WEP_MAXCOUNT];
+float bot_weapons_mid[WEP_MAXCOUNT];
+float bot_weapons_close[WEP_MAXCOUNT];
 
 entity bot_list;
 entity player_list;
index 9727d1a..b8f9e65 100644 (file)
@@ -389,7 +389,7 @@ void centerprint(entity e, string s);
 
 float bot_waypoints_for_items;
 
-.float attack_finished_for[WEP_COUNT];
+.float attack_finished_for[WEP_MAXCOUNT];
 .float attack_finished_single;
 #ifdef INDEPENDENT_ATTACK_FINISHED
 #define ATTACK_FINISHED_FOR(ent,w) ((ent).(attack_finished_for[(w) - WEP_FIRST]))
@@ -602,8 +602,8 @@ string matchid;
 .float stat_fired;
 .float stat_count;
 
-.float stats_hit[WEP_LAST - WEP_FIRST + 1];  // for hitscan bullets hit
-.float stats_fired[WEP_LAST - WEP_FIRST + 1];  // for hitscan bullets fired
+.float stats_hit[WEP_MAXCOUNT];  // for hitscan bullets hit
+.float stats_fired[WEP_MAXCOUNT];  // for hitscan bullets fired
 
 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(stats_hit);
 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(stats_fired);
index 9a86c42..f81e731 100644 (file)
@@ -88,22 +88,7 @@ g_models.qc
 cl_weaponsystem.qc
 w_common.qc
 
-w_laser.qc
-w_shotgun.qc
-w_uzi.qc
-w_grenadelauncher.qc
-w_electro.qc
-w_crylink.qc
-w_nex.qc
-w_minstanex.qc
-w_hagar.qc
-w_rocketlauncher.qc
-w_porto.qc
-w_hook.qc
-w_hlac.qc
-w_campingrifle.qc
-w_tuba.qc
-w_fireball.qc
+w_all.qc
 
 t_items.qc
 cl_weapons.qc
diff --git a/data/qcsrc/server/w_all.qc b/data/qcsrc/server/w_all.qc
new file mode 100644 (file)
index 0000000..119548c
--- /dev/null
@@ -0,0 +1,18 @@
+// NOTE: the weapon priority lists in defaultNexuiz.cfg need to match the order
+// of the weapons in this file. Therefore, avoid reordering.
+#include "w_laser.qc" // 1
+#include "w_shotgun.qc" // 2
+#include "w_uzi.qc" // 3
+#include "w_grenadelauncher.qc" // 4
+#include "w_electro.qc" // 5
+#include "w_crylink.qc" // 6
+#include "w_nex.qc" // 7
+#include "w_hagar.qc" // 8
+#include "w_rocketlauncher.qc" // 9
+#include "w_porto.qc" // 10
+#include "w_minstanex.qc" // 11
+#include "w_hook.qc" // 12
+#include "w_hlac.qc" // 13
+#include "w_tuba.qc" // 14
+#include "w_campingrifle.qc" // 15
+#include "w_fireball.qc" // 16
index d83937f..fe56fca 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(CAMPINGRIFLE,     w_campingrifle, IT_NAILS,         3,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID,  "campingrifle", "campingrifle",    "Rifle");
+#else
 //Camping rifle Primary mode: manually operated bolt*, Secondary: full automatic**
 //* Manually operating the bolt means that all the power of the gas is used to propell the bullet. In this mode the bolt is prevented from moving backwards in response to the firing of the bullet.
 //** In fully automatic mode some of the gas is used to extract and reload the next cartrige, thus there is less power and range.
@@ -235,3 +238,4 @@ float w_campingrifle(float req)
        }
        return TRUE;
 };
+#endif
index 61d0f76..26abb61 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(CRYLINK,          w_crylink,      IT_CELLS,         6,  1, 0, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_MID,  "crylink",      "crylink",         "Crylink");
+#else
 .float gravity;
 
 .entity realowner;
@@ -249,3 +252,4 @@ float w_crylink(float req)
        }
        return TRUE;
 };
+#endif
index dd2cd12..d678423 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(ELECTRO,          w_electro,      IT_CELLS,         5,  1, 0, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_MID,  "electro",      "electro",         "Electro");
+#else
 .float electro_count;
 .float electro_secondarytime;
 
@@ -298,3 +301,4 @@ float w_electro(float req)
        }
        return TRUE;
 };
+#endif
index a32718f..5a63d66 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(FIREBALL,         w_fireball,     IT_ROCKETS,       9,  0, 0, WEP_TYPE_SPLASH,  BOT_PICKUP_RATING_MID,  "fireball",     "fireball",        "Fireball");
+#else
 .float bot_secondary_fireballmooth; // whatever a mooth is
 .vector fireball_impactvec;
 .float fireball_secondarytime;
@@ -389,3 +392,4 @@ float w_fireball(float req)
        }
        return TRUE;
 };
+#endif
index 14ef43d..217f5e5 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(GRENADE_LAUNCHER, w_glauncher,    IT_ROCKETS,       4,  1, 1, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_MID,  "gl",           "grenadelauncher", "Mortar");
+#else
 void W_Grenade_Explode (void)
 {
        if(other.takedamage == DAMAGE_AIM)
@@ -227,3 +230,4 @@ float w_glauncher(float req)
        }
        return TRUE;
 };
+#endif
index 968a744..fb114bc 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(HAGAR,            w_hagar,        IT_ROCKETS,       8,  1, 1, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_MID,  "hagar",        "hagar",           "Hagar");
+#else
 // NO bounce protection, as bounces are limited!
 void W_Hagar_Explode (void)
 {
@@ -158,3 +161,4 @@ float w_hagar(float req)
        }
        return TRUE;
 };
+#endif
index efc03d9..aea9ecb 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(HLAC,             w_hlac,         IT_CELLS,         6,  1, 0, WEP_TYPE_SPLASH,  BOT_PICKUP_RATING_MID,  "hlac",         "hlac",            "Heavy Laser Assault Cannon");
+#else
 .float HLAC_bulletcounter;
 void W_HLAC_Touch (void)
 {
@@ -210,3 +213,4 @@ float w_hlac(float req)
                w_deathtypestring = "was cut down by";
        return TRUE;
 };
+#endif
index 83a70b4..62e9746 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(HOOK,             w_hook,         IT_CELLS|IT_FUEL, 0,  0, 1, WEP_TYPE_SPLASH,  0,                      "hookgun",      "hook",            "Grappling Hook");
+#else
 .float dmg;
 .float dmg_edge;
 .float dmg_radius;
@@ -245,3 +248,4 @@ float w_hook(float req)
        }
        return TRUE;
 };
+#endif
index 0eff821..db61d7d 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(LASER,            w_laser,        0,                1,  1, 1, WEP_TYPE_SPLASH,  0,                      "laser",        "laser",           "Laser");
+#else
 void(float imp) W_SwitchWeapon;
 
 void W_Laser_Touch (void)
@@ -182,3 +185,4 @@ float w_laser(float req)
        }
        return TRUE;
 };
+#endif
index 61b448e..175a6ec 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(MINSTANEX,        w_minstanex,    IT_CELLS,         7, -1, 1, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "minstanex",    "minstanex",       "MinstaNex");
+#else
 .float minstanex_lasthit;
 
 void W_MinstaNex_Attack (void)
@@ -236,3 +239,4 @@ float w_minstanex(float req)
        }
        return TRUE;
 };
+#endif
index a9812cb..34b16ec 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(NEX,              w_nex,          IT_CELLS,         7,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "nex",          "nex",             "Nex");
+#else
 void SendCSQCNexBeamParticle() {
        WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
        WriteByte(MSG_BROADCAST, TE_CSQC_NEXGUNBEAMPARTICLE);
@@ -74,3 +77,4 @@ float w_nex(float req)
                w_deathtypestring = "has been vaporized by";
        return TRUE;
 };
+#endif
index 08c80d3..db11065 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(PORTO,            w_porto,        0,                0,  0, 0, WEP_TYPE_OTHER,   0,                      "porto" ,       "porto",           "Port-O-Launch");
+#else
 .entity porto_current;
 .vector porto_v_angle; // holds "held" view angles
 .float porto_v_angle_held;
@@ -275,3 +278,4 @@ float w_porto(float req)
        }
        return TRUE;
 };
+#endif
index d3cf3e1..e4996a6 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(ROCKET_LAUNCHER,  w_rlauncher,    IT_ROCKETS,       9,  1, 1, WEP_TYPE_SPLASH , BOT_PICKUP_RATING_HIGH, "rl",           "rocketlauncher",  "Rocket Launcher");
+#else
 .float rl_release;
 .float rl_detonate_later;
 
@@ -557,3 +560,4 @@ float w_rlauncher(float req)
        }
        return TRUE;
 };
+#endif
index 300a482..26d994e 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(SHOTGUN,          w_shotgun,      IT_SHELLS,        2,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_LOW,  "shotgun",      "shotgun",         "Shotgun");
+#else
 void W_Shotgun_Attack (void)
 {
        float   sc;
@@ -144,3 +147,4 @@ float w_shotgun(float req)
        }
        return TRUE;
 };
+#endif
index 0ebff4f..6a4e3b0 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(TUBA,             w_tuba,         0,                1, -1, 0, WEP_TYPE_SPLASH,  BOT_PICKUP_RATING_MID,  "tuba",         "tuba",            "@!#%'n Tuba");
+#else
 //#define TUBA_NOTE(n) strcat("weapons/tuba_note", ftos(n), ".wav")
 .float tuba_notecount;
 .entity tuba_note;
@@ -247,3 +250,4 @@ float w_tuba(float req)
        }
        return TRUE;
 };
+#endif
index 7cd3706..c81ad0d 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef REGISTER_WEAPON
+REGISTER_WEAPON(UZI,              w_uzi,          IT_NAILS,         3,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID,  "uzi",          "uzi",             "Machine Gun");
+#else
 // leilei's fancy muzzleflash stuff
 void W_Uzi_Flash_Go() {
        if (self.frame > 10){
@@ -133,3 +136,4 @@ float w_uzi(float req)
        }
        return TRUE;
 };
+#endif