1 // WEAPON PLUGIN SYSTEM
2 entity weapon_info[24];
3 entity dummy_weapon_info;
5 void register_weapon_real(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float pickupbasevalue, string modelname, string shortname, string wname)
8 weapon_info[id - 1] = e = spawn();
9 e.classname = "weapon_info";
11 e.weapons = power2of(id - 1);
12 e.netname = shortname;
17 e.model = strzone(strcat("models/weapons/g_", modelname, ".md3"));
20 e.spawnflags |= WEPSPAWNFLAG_NORMAL;
22 e.spawnflags |= WEPSPAWNFLAG_CANCLIMB;
24 e.bot_pickupbasevalue = pickupbasevalue;
26 float w_null(float dummy)
30 void register_weapons_done()
34 dummy_weapon_info = spawn();
35 dummy_weapon_info.classname = "weapon_info";
36 dummy_weapon_info.weapon = 0;
37 dummy_weapon_info.weapons = 0;
38 dummy_weapon_info.netname = "@!#%'n Tuba";
39 dummy_weapon_info.items = 0;
40 dummy_weapon_info.weapon_func = w_null;
41 dummy_weapon_info.mdl = "";
42 dummy_weapon_info.model = "";
43 dummy_weapon_info.spawnflags = 0;
44 dummy_weapon_info.impulse = -1;
45 dummy_weapon_info.bot_pickupbasevalue = 0;
48 weaponpriority_hudselector_0 = "";
49 for(i = 24; i >= 1; --i)
51 weaponpriority_hudselector_0 = strcat(weaponpriority_hudselector_0, " ", ftos(i));
54 weaponpriority_hudselector_1 = "";
55 for(i = 1; i <= 24; ++i)
57 wi = weapon_info[i-1];
58 if(wi && wi.impulse == 0)
59 weaponpriority_hudselector_1 = strcat(weaponpriority_hudselector_1, " ", ftos(i));
61 for(imp = 9; imp > 0; --imp)
62 for(i = 1; i <= 24; ++i)
64 wi = weapon_info[i-1];
65 if(wi && wi.impulse == imp)
66 weaponpriority_hudselector_1 = strcat(weaponpriority_hudselector_1, " ", ftos(i));
69 weaponpriority_hudselector_0 = strzone(substring(weaponpriority_hudselector_0, 1, strlen(weaponpriority_hudselector_0) - 1));
70 weaponpriority_hudselector_1 = strzone(substring(weaponpriority_hudselector_1, 1, strlen(weaponpriority_hudselector_1) - 1));
72 entity get_weaponinfo(float id)
75 if(id < WEP_FIRST || id > WEP_LAST)
76 return dummy_weapon_info;
77 w = weapon_info[id - 1];
80 return dummy_weapon_info;
82 string W_FixWeaponOrder(string order, float complete)
84 return fixPriorityList(order, WEP_FIRST, WEP_LAST, complete);
87 // FTEQCC SUCKS // #ifdef SVQC
88 // FTEQCC SUCKS // #define register_weapon(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname) \
89 // FTEQCC SUCKS // register_weapon_real(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname)
90 // FTEQCC SUCKS // #else
91 // FTEQCC SUCKS // // no weapon funcs here!
92 // FTEQCC SUCKS // #define register_weapon(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname) \
93 // FTEQCC SUCKS // register_weapon_real(id,w_null,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname)
94 // FTEQCC SUCKS // #endif
95 // put this code back in if fteqcc gets fixed
97 #define register_weapon register_weapon_real
99 float(float) w_shotgun;
101 float(float) w_glauncher;
102 float(float) w_electro;
103 float(float) w_crylink;
105 float(float) w_hagar;
106 float(float) w_rlauncher;
107 float(float) w_porto;
108 float(float) w_minstanex;
110 float(float) w_seeker;
112 // I know this causes lots of warnings, but well, alternative code is above - use that code if fteqcc got fixed
114 void RegisterWeapons()
117 register_weapon(WEP_LASER, w_laser, 0, 1, 1, 1, 0, "laser", "laser", "Laser");
118 register_weapon(WEP_SHOTGUN, w_shotgun, IT_SHELLS, 2, 1, 0, 2500, "shotgun", "shotgun", "Shotgun");
119 register_weapon(WEP_UZI, w_uzi, IT_NAILS, 3, 1, 0, 5000, "uzi", "uzi", "Machine Gun");
120 register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher, IT_ROCKETS, 4, 1, 1, 5000, "gl", "grenadelauncher", "Mortar");
121 register_weapon(WEP_ELECTRO, w_electro, IT_CELLS, 5, 1, 0, 5000, "electro", "electro", "Electro");
122 register_weapon(WEP_CRYLINK, w_crylink, IT_CELLS, 6, 1, 0, 5000, "crylink", "crylink", "Crylink");
123 register_weapon(WEP_NEX, w_nex, IT_CELLS, 7, 1, 0, 10000, "nex", "nex", "Nex");
124 register_weapon(WEP_HAGAR, w_hagar, IT_ROCKETS, 8, 1, 1, 5000, "hagar", "hagar", "Hagar");
125 register_weapon(WEP_ROCKET_LAUNCHER, w_rlauncher, IT_ROCKETS, 9, 1, 1, 10000, "rl", "rocketlauncher", "Rocket Launcher");
126 register_weapon(WEP_PORTO, w_porto, IT_SUPERWEAPON, 0, 0, 0, 0, "porto" , "porto", "Port-O-Launch");
127 register_weapon(WEP_MINSTANEX, w_minstanex, IT_CELLS, 7, 0, 1, 10000, "minstanex", "minstanex", "MinstaNex");
128 register_weapon(WEP_HOOK, w_hook, IT_CELLS, 0, 0, 1, 0, "hookgun", "hook", "Grappling Hook");
129 register_weapon(WEP_SEEKER, w_seeker, IT_ROCKETS, 8, 1, 0, 0, "seeker", "seeker", "T.A.G. Seeker");
130 register_weapon(WEP_HLAC, w_hlac, IT_CELLS, 6, 1, 0, 0, "hlac", "hlac", "Heavy Laser Assault Cannon");
132 register_weapons_done();