00001 // Copyright (C) 2001-2002 Raven Software 00002 // 00003 // bg_weapons.c -- part of bg_pmove functionality 00004 00005 #include "q_shared.h" 00006 #include "bg_public.h" 00007 #include "bg_local.h" 00008 00009 // Muzzle point table... 00010 vec3_t WP_MuzzlePoint[WP_NUM_WEAPONS] = 00011 {// Fwd, right, up. 00012 {0, 0, 0 }, // WP_NONE, 00013 {0 , 8, 0 }, // WP_STUN_BATON, 00014 {0 , 8, 0 }, // WP_MELEE, 00015 {8 , 16, 0 }, // WP_SABER, 00016 {12, 6, -6 }, // WP_BRYAR_PISTOL, 00017 {12, 6, -6 }, // WP_BLASTER, 00018 {12, 6, -6 }, // WP_DISRUPTOR, 00019 {12, 2, -6 }, // WP_BOWCASTER, 00020 {12, 4.5, -6 }, // WP_REPEATER, 00021 {12, 6, -6 }, // WP_DEMP2, 00022 {12, 6, -6 }, // WP_FLECHETTE, 00023 {12, 8, -4 }, // WP_ROCKET_LAUNCHER, 00024 {12, 0, -4 }, // WP_THERMAL, 00025 {12, 0, -10 }, // WP_TRIP_MINE, 00026 {12, 0, -4 }, // WP_DET_PACK, 00027 {12, 6, -6 }, // WP_CONCUSSION 00028 {12, 6, -6 }, // WP_BRYAR_OLD, 00029 }; 00030 00031 weaponData_t weaponData[WP_NUM_WEAPONS] = 00032 { 00033 { // WP_NONE 00034 // "No Weapon", // char classname[32]; // Spawning name 00035 AMMO_NONE, // int ammoIndex; // Index to proper ammo slot 00036 0, // int ammoLow; // Count when ammo is low 00037 0, // int energyPerShot; // Amount of energy used per shot 00038 0, // int fireTime; // Amount of time between firings 00039 0, // int range; // Range of weapon 00040 0, // int altEnergyPerShot; // Amount of energy used for alt-fire 00041 0, // int altFireTime; // Amount of time between alt-firings 00042 0, // int altRange; // Range of alt-fire 00043 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00044 0, // int altChargeSubTime; // above for secondary 00045 0, // int chargeSub; // amount to subtract during charge on each interval 00046 0, //int altChargeSub; // above for secondary 00047 0, // int maxCharge; // stop subtracting once charged for this many ms 00048 0 // int altMaxCharge; // above for secondary 00049 }, 00050 { // WP_STUN_BATON 00051 // "Stun Baton", // char classname[32]; // Spawning name 00052 AMMO_NONE, // int ammoIndex; // Index to proper ammo slot 00053 5, // int ammoLow; // Count when ammo is low 00054 0, // int energyPerShot; // Amount of energy used per shot 00055 400, // int fireTime; // Amount of time between firings 00056 8192, // int range; // Range of weapon 00057 0, // int altEnergyPerShot; // Amount of energy used for alt-fire 00058 400, // int altFireTime; // Amount of time between alt-firings 00059 8192, // int altRange; // Range of alt-fire 00060 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00061 0, // int altChargeSubTime; // above for secondary 00062 0, // int chargeSub; // amount to subtract during charge on each interval 00063 0, //int altChargeSub; // above for secondary 00064 0, // int maxCharge; // stop subtracting once charged for this many ms 00065 0 // int altMaxCharge; // above for secondary 00066 }, 00067 { // WP_MELEE 00068 // "Melee", // char classname[32]; // Spawning name 00069 AMMO_NONE, // int ammoIndex; // Index to proper ammo slot 00070 5, // int ammoLow; // Count when ammo is low 00071 0, // int energyPerShot; // Amount of energy used per shot 00072 400, // int fireTime; // Amount of time between firings 00073 8192, // int range; // Range of weapon 00074 0, // int altEnergyPerShot; // Amount of energy used for alt-fire 00075 400, // int altFireTime; // Amount of time between alt-firings 00076 8192, // int altRange; // Range of alt-fire 00077 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00078 0, // int altChargeSubTime; // above for secondary 00079 0, // int chargeSub; // amount to subtract during charge on each interval 00080 0, //int altChargeSub; // above for secondary 00081 0, // int maxCharge; // stop subtracting once charged for this many ms 00082 0 // int altMaxCharge; // above for secondary 00083 }, 00084 { // WP_SABER, 00085 // "Lightsaber", // char classname[32]; // Spawning name 00086 AMMO_NONE, // int ammoIndex; // Index to proper ammo slot 00087 5, // int ammoLow; // Count when ammo is low 00088 0, // int energyPerShot; // Amount of energy used per shot 00089 100, // int fireTime; // Amount of time between firings 00090 8192, // int range; // Range of weapon 00091 0, // int altEnergyPerShot; // Amount of energy used for alt-fire 00092 100, // int altFireTime; // Amount of time between alt-firings 00093 8192, // int altRange; // Range of alt-fire 00094 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00095 0, // int altChargeSubTime; // above for secondary 00096 0, // int chargeSub; // amount to subtract during charge on each interval 00097 0, //int altChargeSub; // above for secondary 00098 0, // int maxCharge; // stop subtracting once charged for this many ms 00099 0 // int altMaxCharge; // above for secondary 00100 }, 00101 { // WP_BRYAR_PISTOL, 00102 // "Bryar Pistol", // char classname[32]; // Spawning name 00103 AMMO_BLASTER, // int ammoIndex; // Index to proper ammo slot 00104 0,//15, // int ammoLow; // Count when ammo is low 00105 0,//2, // int energyPerShot; // Amount of energy used per shot 00106 800,//400, // int fireTime; // Amount of time between firings 00107 8192, // int range; // Range of weapon 00108 0,//2, // int altEnergyPerShot; // Amount of energy used for alt-fire 00109 800,//400, // int altFireTime; // Amount of time between alt-firings 00110 8192, // int altRange; // Range of alt-fire 00111 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00112 0,//200, // int altChargeSubTime; // above for secondary 00113 0, // int chargeSub; // amount to subtract during charge on each interval 00114 0,//1, //int altChargeSub; // above for secondary 00115 0, // int maxCharge; // stop subtracting once charged for this many ms 00116 0,//1500 // int altMaxCharge; // above for secondary 00117 }, 00118 { // WP_BLASTER 00119 // "E11 Blaster Rifle", // char classname[32]; // Spawning name 00120 AMMO_BLASTER, // int ammoIndex; // Index to proper ammo slot 00121 5, // int ammoLow; // Count when ammo is low 00122 2, // int energyPerShot; // Amount of energy used per shot 00123 350, // int fireTime; // Amount of time between firings 00124 8192, // int range; // Range of weapon 00125 3, // int altEnergyPerShot; // Amount of energy used for alt-fire 00126 150, // int altFireTime; // Amount of time between alt-firings 00127 8192, // int altRange; // Range of alt-fire 00128 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00129 0, // int altChargeSubTime; // above for secondary 00130 0, // int chargeSub; // amount to subtract during charge on each interval 00131 0, //int altChargeSub; // above for secondary 00132 0, // int maxCharge; // stop subtracting once charged for this many ms 00133 0 // int altMaxCharge; // above for secondary 00134 }, 00135 { // WP_DISRUPTOR 00136 // "Tenloss Disruptor Rifle",// char classname[32]; // Spawning name 00137 AMMO_POWERCELL, // int ammoIndex; // Index to proper ammo slot 00138 5, // int ammoLow; // Count when ammo is low 00139 5, // int energyPerShot; // Amount of energy used per shot 00140 600, // int fireTime; // Amount of time between firings 00141 8192, // int range; // Range of weapon 00142 6, // int altEnergyPerShot; // Amount of energy used for alt-fire 00143 1300, // int altFireTime; // Amount of time between alt-firings 00144 8192, // int altRange; // Range of alt-fire 00145 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00146 200, // int altChargeSubTime; // above for secondary 00147 0, // int chargeSub; // amount to subtract during charge on each interval 00148 3, //int altChargeSub; // above for secondary 00149 0, // int maxCharge; // stop subtracting once charged for this many ms 00150 1700 // int altMaxCharge; // above for secondary 00151 }, 00152 { // WP_BOWCASTER 00153 // "Wookiee Bowcaster", // char classname[32]; // Spawning name 00154 AMMO_POWERCELL, // int ammoIndex; // Index to proper ammo slot 00155 5, // int ammoLow; // Count when ammo is low 00156 5, // int energyPerShot; // Amount of energy used per shot 00157 1000, // int fireTime; // Amount of time between firings 00158 8192, // int range; // Range of weapon 00159 5, // int altEnergyPerShot; // Amount of energy used for alt-fire 00160 750, // int altFireTime; // Amount of time between alt-firings 00161 8192, // int altRange; // Range of alt-fire 00162 400, // int chargeSubTime; // ms interval for subtracting ammo during charge 00163 0, // int altChargeSubTime; // above for secondary 00164 5, // int chargeSub; // amount to subtract during charge on each interval 00165 0, //int altChargeSub; // above for secondary 00166 1700, // int maxCharge; // stop subtracting once charged for this many ms 00167 0 // int altMaxCharge; // above for secondary 00168 }, 00169 { // WP_REPEATER 00170 // "Imperial Heavy Repeater",// char classname[32]; // Spawning name 00171 AMMO_METAL_BOLTS, // int ammoIndex; // Index to proper ammo slot 00172 5, // int ammoLow; // Count when ammo is low 00173 1, // int energyPerShot; // Amount of energy used per shot 00174 100, // int fireTime; // Amount of time between firings 00175 8192, // int range; // Range of weapon 00176 15, // int altEnergyPerShot; // Amount of energy used for alt-fire 00177 800, // int altFireTime; // Amount of time between alt-firings 00178 8192, // int altRange; // Range of alt-fire 00179 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00180 0, // int altChargeSubTime; // above for secondary 00181 0, // int chargeSub; // amount to subtract during charge on each interval 00182 0, //int altChargeSub; // above for secondary 00183 0, // int maxCharge; // stop subtracting once charged for this many ms 00184 0 // int altMaxCharge; // above for secondary 00185 }, 00186 { // WP_DEMP2 00187 // "DEMP2", // char classname[32]; // Spawning name 00188 AMMO_POWERCELL, // int ammoIndex; // Index to proper ammo slot 00189 5, // int ammoLow; // Count when ammo is low 00190 8, // int energyPerShot; // Amount of energy used per shot 00191 500, // int fireTime; // Amount of time between firings 00192 8192, // int range; // Range of weapon 00193 6, // int altEnergyPerShot; // Amount of energy used for alt-fire 00194 900, // int altFireTime; // Amount of time between alt-firings 00195 8192, // int altRange; // Range of alt-fire 00196 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00197 250, // int altChargeSubTime; // above for secondary 00198 0, // int chargeSub; // amount to subtract during charge on each interval 00199 3, // int altChargeSub; // above for secondary 00200 0, // int maxCharge; // stop subtracting once charged for this many ms 00201 2100 // int altMaxCharge; // above for secondary 00202 }, 00203 { // WP_FLECHETTE 00204 // "Golan Arms Flechette", // char classname[32]; // Spawning name 00205 AMMO_METAL_BOLTS, // int ammoIndex; // Index to proper ammo slot 00206 5, // int ammoLow; // Count when ammo is low 00207 10, // int energyPerShot; // Amount of energy used per shot 00208 700, // int fireTime; // Amount of time between firings 00209 8192, // int range; // Range of weapon 00210 15, // int altEnergyPerShot; // Amount of energy used for alt-fire 00211 800, // int altFireTime; // Amount of time between alt-firings 00212 8192, // int altRange; // Range of alt-fire 00213 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00214 0, // int altChargeSubTime; // above for secondary 00215 0, // int chargeSub; // amount to subtract during charge on each interval 00216 0, //int altChargeSub; // above for secondary 00217 0, // int maxCharge; // stop subtracting once charged for this many ms 00218 0 // int altMaxCharge; // above for secondary 00219 }, 00220 { // WP_ROCKET_LAUNCHER 00221 // "Merr-Sonn Missile System", // char classname[32]; // Spawning name 00222 AMMO_ROCKETS, // int ammoIndex; // Index to proper ammo slot 00223 5, // int ammoLow; // Count when ammo is low 00224 1, // int energyPerShot; // Amount of energy used per shot 00225 900, // int fireTime; // Amount of time between firings 00226 8192, // int range; // Range of weapon 00227 2, // int altEnergyPerShot; // Amount of energy used for alt-fire 00228 1200, // int altFireTime; // Amount of time between alt-firings 00229 8192, // int altRange; // Range of alt-fire 00230 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00231 0, // int altChargeSubTime; // above for secondary 00232 0, // int chargeSub; // amount to subtract during charge on each interval 00233 0, //int altChargeSub; // above for secondary 00234 0, // int maxCharge; // stop subtracting once charged for this many ms 00235 0 // int altMaxCharge; // above for secondary 00236 }, 00237 { // WP_THERMAL 00238 // "Thermal Detonator", // char classname[32]; // Spawning name 00239 AMMO_THERMAL, // int ammoIndex; // Index to proper ammo slot 00240 0, // int ammoLow; // Count when ammo is low 00241 1, // int energyPerShot; // Amount of energy used per shot 00242 800, // int fireTime; // Amount of time between firings 00243 8192, // int range; // Range of weapon 00244 1, // int altEnergyPerShot; // Amount of energy used for alt-fire 00245 400, // int altFireTime; // Amount of time between alt-firings 00246 8192, // int altRange; // Range of alt-fire 00247 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00248 0, // int altChargeSubTime; // above for secondary 00249 0, // int chargeSub; // amount to subtract during charge on each interval 00250 0, //int altChargeSub; // above for secondary 00251 0, // int maxCharge; // stop subtracting once charged for this many ms 00252 0 // int altMaxCharge; // above for secondary 00253 }, 00254 { // WP_TRIP_MINE 00255 // "Trip Mine", // char classname[32]; // Spawning name 00256 AMMO_TRIPMINE, // int ammoIndex; // Index to proper ammo slot 00257 0, // int ammoLow; // Count when ammo is low 00258 1, // int energyPerShot; // Amount of energy used per shot 00259 800, // int fireTime; // Amount of time between firings 00260 8192, // int range; // Range of weapon 00261 1, // int altEnergyPerShot; // Amount of energy used for alt-fire 00262 400, // int altFireTime; // Amount of time between alt-firings 00263 8192, // int altRange; // Range of alt-fire 00264 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00265 0, // int altChargeSubTime; // above for secondary 00266 0, // int chargeSub; // amount to subtract during charge on each interval 00267 0, //int altChargeSub; // above for secondary 00268 0, // int maxCharge; // stop subtracting once charged for this many ms 00269 0 // int altMaxCharge; // above for secondary 00270 }, 00271 { // WP_DET_PACK 00272 // "Det Pack", // char classname[32]; // Spawning name 00273 AMMO_DETPACK, // int ammoIndex; // Index to proper ammo slot 00274 0, // int ammoLow; // Count when ammo is low 00275 1, // int energyPerShot; // Amount of energy used per shot 00276 800, // int fireTime; // Amount of time between firings 00277 8192, // int range; // Range of weapon 00278 0, // int altEnergyPerShot; // Amount of energy used for alt-fire 00279 400, // int altFireTime; // Amount of time between alt-firings 00280 8192, // int altRange; // Range of alt-fire 00281 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00282 0, // int altChargeSubTime; // above for secondary 00283 0, // int chargeSub; // amount to subtract during charge on each interval 00284 0, //int altChargeSub; // above for secondary 00285 0, // int maxCharge; // stop subtracting once charged for this many ms 00286 0 // int altMaxCharge; // above for secondary 00287 }, 00288 { // WP_CONCUSSION 00289 // "Concussion Rifle", // char classname[32]; // Spawning name 00290 AMMO_METAL_BOLTS, // int ammoIndex; // Index to proper ammo slot 00291 40, // int ammoLow; // Count when ammo is low 00292 40, // int energyPerShot; // Amount of energy used per shot 00293 800, // int fireTime; // Amount of time between firings 00294 8192, // int range; // Range of weapon 00295 50, // int altEnergyPerShot; // Amount of energy used for alt-fire 00296 1200, // int altFireTime; // Amount of time between alt-firings 00297 8192, // int altRange; // Range of alt-fire 00298 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00299 0, // int altChargeSubTime; // above for secondary 00300 0, // int chargeSub; // amount to subtract during charge on each interval 00301 0, // int altChargeSub; // above for secondary 00302 0, // int maxCharge; // stop subtracting once charged for this many ms 00303 0 // int altMaxCharge; // above for secondary 00304 }, 00305 { // WP_BRYAR_OLD, 00306 // "Bryar Pistol", // char classname[32]; // Spawning name 00307 AMMO_BLASTER, // int ammoIndex; // Index to proper ammo slot 00308 15, // int ammoLow; // Count when ammo is low 00309 2, // int energyPerShot; // Amount of energy used per shot 00310 400, // int fireTime; // Amount of time between firings 00311 8192, // int range; // Range of weapon 00312 2, // int altEnergyPerShot; // Amount of energy used for alt-fire 00313 400, // int altFireTime; // Amount of time between alt-firings 00314 8192, // int altRange; // Range of alt-fire 00315 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00316 200, // int altChargeSubTime; // above for secondary 00317 0, // int chargeSub; // amount to subtract during charge on each interval 00318 1, //int altChargeSub; // above for secondary 00319 0, // int maxCharge; // stop subtracting once charged for this many ms 00320 1500 // int altMaxCharge; // above for secondary 00321 }, 00322 { // WP_EMPLCACED_GUN 00323 // "Emplaced Gun", // char classname[32]; // Spawning name 00324 /*AMMO_BLASTER*/0, // int ammoIndex; // Index to proper ammo slot 00325 /*5*/0, // int ammoLow; // Count when ammo is low 00326 /*2*/0, // int energyPerShot; // Amount of energy used per shot 00327 100, // int fireTime; // Amount of time between firings 00328 8192, // int range; // Range of weapon 00329 /*3*/0, // int altEnergyPerShot; // Amount of energy used for alt-fire 00330 100, // int altFireTime; // Amount of time between alt-firings 00331 8192, // int altRange; // Range of alt-fire 00332 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00333 0, // int altChargeSubTime; // above for secondary 00334 0, // int chargeSub; // amount to subtract during charge on each interval 00335 0, //int altChargeSub; // above for secondary 00336 0, // int maxCharge; // stop subtracting once charged for this many ms 00337 0 // int altMaxCharge; // above for secondary 00338 }, 00339 { // WP_TURRET - NOTE NOT ACTUALLY USEABLE BY PLAYER! 00340 // "Emplaced Gun", // char classname[32]; // Spawning name 00341 /*AMMO_BLASTER*/0, // int ammoIndex; // Index to proper ammo slot 00342 /*5*/0, // int ammoLow; // Count when ammo is low 00343 /*2*/0, // int energyPerShot; // Amount of energy used per shot 00344 0, // int fireTime; // Amount of time between firings 00345 0, // int range; // Range of weapon 00346 /*3*/0, // int altEnergyPerShot; // Amount of energy used for alt-fire 00347 0, // int altFireTime; // Amount of time between alt-firings 00348 0, // int altRange; // Range of alt-fire 00349 0, // int chargeSubTime; // ms interval for subtracting ammo during charge 00350 0, // int altChargeSubTime; // above for secondary 00351 0, // int chargeSub; // amount to subtract during charge on each interval 00352 0, //int altChargeSub; // above for secondary 00353 0, // int maxCharge; // stop subtracting once charged for this many ms 00354 0 // int altMaxCharge; // above for secondary 00355 } 00356 }; 00357 00358 ammoData_t ammoData[AMMO_MAX] = 00359 { 00360 { // AMMO_NONE 00361 // "", // char icon[32]; // Name of ammo icon file 00362 0 // int max; // Max amount player can hold of ammo 00363 }, 00364 { // AMMO_FORCE 00365 // "", // char icon[32]; // Name of ammo icon file 00366 100 // int max; // Max amount player can hold of ammo 00367 }, 00368 { // AMMO_BLASTER 00369 // "", // char icon[32]; // Name of ammo icon file 00370 300 // int max; // Max amount player can hold of ammo 00371 }, 00372 { // AMMO_POWERCELL 00373 // "", // char icon[32]; // Name of ammo icon file 00374 300 // int max; // Max amount player can hold of ammo 00375 }, 00376 { // AMMO_METAL_BOLTS 00377 // "", // char icon[32]; // Name of ammo icon file 00378 300 // int max; // Max amount player can hold of ammo 00379 }, 00380 { // AMMO_ROCKETS 00381 // "", // char icon[32]; // Name of ammo icon file 00382 25 // int max; // Max amount player can hold of ammo 00383 }, 00384 { // AMMO_EMPLACED 00385 // "", // char icon[32]; // Name of ammo icon file 00386 800 // int max; // Max amount player can hold of ammo 00387 }, 00388 { // AMMO_THERMAL 00389 // "", // char icon[32]; // Name of ammo icon file 00390 10 // int max; // Max amount player can hold of ammo 00391 }, 00392 { // AMMO_TRIPMINE 00393 // "", // char icon[32]; // Name of ammo icon file 00394 10 // int max; // Max amount player can hold of ammo 00395 }, 00396 { // AMMO_DETPACK 00397 // "", // char icon[32]; // Name of ammo icon file 00398 10 // int max; // Max amount player can hold of ammo 00399 } 00400 }; 00401 00402