g_items.c 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. #include "g_local.h"
  4. qboolean Pickup_Weapon (edict_t *ent, edict_t *other);
  5. void Use_Weapon (edict_t *ent, gitem_t *inv);
  6. void Use_Weapon2 (edict_t *ent, gitem_t *inv);
  7. void Drop_Weapon (edict_t *ent, gitem_t *inv);
  8. void Weapon_Blaster (edict_t *ent);
  9. void Weapon_Shotgun (edict_t *ent);
  10. void Weapon_SuperShotgun (edict_t *ent);
  11. void Weapon_Machinegun (edict_t *ent);
  12. void Weapon_Chaingun (edict_t *ent);
  13. void Weapon_HyperBlaster (edict_t *ent);
  14. void Weapon_RocketLauncher (edict_t *ent);
  15. void Weapon_Grenade (edict_t *ent);
  16. void Weapon_GrenadeLauncher (edict_t *ent);
  17. void Weapon_Railgun (edict_t *ent);
  18. void Weapon_BFG (edict_t *ent);
  19. // RAFAEL
  20. void Weapon_Ionripper (edict_t *ent);
  21. void Weapon_Phalanx (edict_t *ent);
  22. void Weapon_Trap (edict_t *ent);
  23. gitem_armor_t jacketarmor_info = { 25, 50, .30, .00, ARMOR_JACKET};
  24. gitem_armor_t combatarmor_info = { 50, 100, .60, .30, ARMOR_COMBAT};
  25. gitem_armor_t bodyarmor_info = {100, 200, .80, .60, ARMOR_BODY};
  26. static int jacket_armor_index;
  27. static int combat_armor_index;
  28. static int body_armor_index;
  29. static int power_screen_index;
  30. static int power_shield_index;
  31. #define HEALTH_IGNORE_MAX 1
  32. #define HEALTH_TIMED 2
  33. void Use_Quad (edict_t *ent, gitem_t *item);
  34. // RAFAEL
  35. void Use_QuadFire (edict_t *ent, gitem_t *item);
  36. static int quad_drop_timeout_hack;
  37. // RAFAEL
  38. static int quad_fire_drop_timeout_hack;
  39. //======================================================================
  40. /*
  41. ===============
  42. GetItemByIndex
  43. ===============
  44. */
  45. gitem_t *GetItemByIndex (int index)
  46. {
  47. if (index == 0 || index >= game.num_items)
  48. return NULL;
  49. return &itemlist[index];
  50. }
  51. /*
  52. ===============
  53. FindItemByClassname
  54. ===============
  55. */
  56. gitem_t *FindItemByClassname (char *classname)
  57. {
  58. int i;
  59. gitem_t *it;
  60. it = itemlist;
  61. for (i=0 ; i<game.num_items ; i++, it++)
  62. {
  63. if (!it->classname)
  64. continue;
  65. if (!Q_stricmp(it->classname, classname))
  66. return it;
  67. }
  68. return NULL;
  69. }
  70. /*
  71. ===============
  72. FindItem
  73. ===============
  74. */
  75. gitem_t *FindItem (char *pickup_name)
  76. {
  77. int i;
  78. gitem_t *it;
  79. it = itemlist;
  80. for (i=0 ; i<game.num_items ; i++, it++)
  81. {
  82. if (!it->pickup_name)
  83. continue;
  84. if (!Q_stricmp(it->pickup_name, pickup_name))
  85. return it;
  86. }
  87. return NULL;
  88. }
  89. //======================================================================
  90. void DoRespawn (edict_t *ent)
  91. {
  92. if (ent->team)
  93. {
  94. edict_t *master;
  95. int count;
  96. int choice;
  97. master = ent->teammaster;
  98. for (count = 0, ent = master; ent; ent = ent->chain, count++)
  99. ;
  100. choice = rand() % count;
  101. for (count = 0, ent = master; count < choice; ent = ent->chain, count++)
  102. ;
  103. }
  104. ent->svflags &= ~SVF_NOCLIENT;
  105. ent->solid = SOLID_TRIGGER;
  106. gi.linkentity (ent);
  107. // send an effect
  108. ent->s.event = EV_ITEM_RESPAWN;
  109. }
  110. void SetRespawn (edict_t *ent, float delay)
  111. {
  112. ent->flags |= FL_RESPAWN;
  113. ent->svflags |= SVF_NOCLIENT;
  114. ent->solid = SOLID_NOT;
  115. ent->nextthink = level.time + delay;
  116. ent->think = DoRespawn;
  117. gi.linkentity (ent);
  118. }
  119. //======================================================================
  120. qboolean Pickup_Powerup (edict_t *ent, edict_t *other)
  121. {
  122. int quantity;
  123. quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  124. if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
  125. return false;
  126. if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
  127. return false;
  128. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  129. if (deathmatch->value)
  130. {
  131. if (!(ent->spawnflags & DROPPED_ITEM) )
  132. SetRespawn (ent, ent->item->quantity);
  133. if (((int)dmflags->value & DF_INSTANT_ITEMS) || ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM)))
  134. {
  135. if ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM))
  136. quad_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME;
  137. ent->item->use (other, ent->item);
  138. }
  139. // RAFAEL
  140. else if (((int)dmflags->value & DF_INSTANT_ITEMS) || ((ent->item->use == Use_QuadFire) && (ent->spawnflags & DROPPED_PLAYER_ITEM)))
  141. {
  142. if ((ent->item->use == Use_QuadFire) && (ent->spawnflags & DROPPED_PLAYER_ITEM))
  143. quad_fire_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME;
  144. ent->item->use (other, ent->item);
  145. }
  146. }
  147. return true;
  148. }
  149. void Drop_General (edict_t *ent, gitem_t *item)
  150. {
  151. Drop_Item (ent, item);
  152. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  153. ValidateSelectedItem (ent);
  154. }
  155. //======================================================================
  156. qboolean Pickup_Adrenaline (edict_t *ent, edict_t *other)
  157. {
  158. if (!deathmatch->value)
  159. other->max_health += 1;
  160. if (other->health < other->max_health)
  161. other->health = other->max_health;
  162. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  163. SetRespawn (ent, ent->item->quantity);
  164. return true;
  165. }
  166. qboolean Pickup_AncientHead (edict_t *ent, edict_t *other)
  167. {
  168. other->max_health += 2;
  169. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  170. SetRespawn (ent, ent->item->quantity);
  171. return true;
  172. }
  173. qboolean Pickup_Bandolier (edict_t *ent, edict_t *other)
  174. {
  175. gitem_t *item;
  176. int index;
  177. if (other->client->pers.max_bullets < 250)
  178. other->client->pers.max_bullets = 250;
  179. if (other->client->pers.max_shells < 150)
  180. other->client->pers.max_shells = 150;
  181. if (other->client->pers.max_cells < 250)
  182. other->client->pers.max_cells = 250;
  183. if (other->client->pers.max_slugs < 75)
  184. other->client->pers.max_slugs = 75;
  185. // RAFAEL
  186. if (other->client->pers.max_magslug < 75)
  187. other->client->pers.max_magslug = 75;
  188. item = FindItem("Bullets");
  189. if (item)
  190. {
  191. index = ITEM_INDEX(item);
  192. other->client->pers.inventory[index] += item->quantity;
  193. if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
  194. other->client->pers.inventory[index] = other->client->pers.max_bullets;
  195. }
  196. item = FindItem("Shells");
  197. if (item)
  198. {
  199. index = ITEM_INDEX(item);
  200. other->client->pers.inventory[index] += item->quantity;
  201. if (other->client->pers.inventory[index] > other->client->pers.max_shells)
  202. other->client->pers.inventory[index] = other->client->pers.max_shells;
  203. }
  204. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  205. SetRespawn (ent, ent->item->quantity);
  206. return true;
  207. }
  208. qboolean Pickup_Pack (edict_t *ent, edict_t *other)
  209. {
  210. gitem_t *item;
  211. int index;
  212. if (other->client->pers.max_bullets < 300)
  213. other->client->pers.max_bullets = 300;
  214. if (other->client->pers.max_shells < 200)
  215. other->client->pers.max_shells = 200;
  216. if (other->client->pers.max_rockets < 100)
  217. other->client->pers.max_rockets = 100;
  218. if (other->client->pers.max_grenades < 100)
  219. other->client->pers.max_grenades = 100;
  220. if (other->client->pers.max_cells < 300)
  221. other->client->pers.max_cells = 300;
  222. if (other->client->pers.max_slugs < 100)
  223. other->client->pers.max_slugs = 100;
  224. // RAFAEL
  225. if (other->client->pers.max_magslug < 100)
  226. other->client->pers.max_magslug = 100;
  227. item = FindItem("Bullets");
  228. if (item)
  229. {
  230. index = ITEM_INDEX(item);
  231. other->client->pers.inventory[index] += item->quantity;
  232. if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
  233. other->client->pers.inventory[index] = other->client->pers.max_bullets;
  234. }
  235. item = FindItem("Shells");
  236. if (item)
  237. {
  238. index = ITEM_INDEX(item);
  239. other->client->pers.inventory[index] += item->quantity;
  240. if (other->client->pers.inventory[index] > other->client->pers.max_shells)
  241. other->client->pers.inventory[index] = other->client->pers.max_shells;
  242. }
  243. item = FindItem("Cells");
  244. if (item)
  245. {
  246. index = ITEM_INDEX(item);
  247. other->client->pers.inventory[index] += item->quantity;
  248. if (other->client->pers.inventory[index] > other->client->pers.max_cells)
  249. other->client->pers.inventory[index] = other->client->pers.max_cells;
  250. }
  251. item = FindItem("Grenades");
  252. if (item)
  253. {
  254. index = ITEM_INDEX(item);
  255. other->client->pers.inventory[index] += item->quantity;
  256. if (other->client->pers.inventory[index] > other->client->pers.max_grenades)
  257. other->client->pers.inventory[index] = other->client->pers.max_grenades;
  258. }
  259. item = FindItem("Rockets");
  260. if (item)
  261. {
  262. index = ITEM_INDEX(item);
  263. other->client->pers.inventory[index] += item->quantity;
  264. if (other->client->pers.inventory[index] > other->client->pers.max_rockets)
  265. other->client->pers.inventory[index] = other->client->pers.max_rockets;
  266. }
  267. item = FindItem("Slugs");
  268. if (item)
  269. {
  270. index = ITEM_INDEX(item);
  271. other->client->pers.inventory[index] += item->quantity;
  272. if (other->client->pers.inventory[index] > other->client->pers.max_slugs)
  273. other->client->pers.inventory[index] = other->client->pers.max_slugs;
  274. }
  275. // RAFAEL
  276. item = FindItem ("Mag Slug");
  277. if (item)
  278. {
  279. index = ITEM_INDEX(item);
  280. other->client->pers.inventory[index] += item->quantity;
  281. if (other->client->pers.inventory[index] > other->client->pers.max_magslug)
  282. other->client->pers.inventory[index] = other->client->pers.max_magslug;
  283. }
  284. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  285. SetRespawn (ent, ent->item->quantity);
  286. return true;
  287. }
  288. //======================================================================
  289. void Use_Quad (edict_t *ent, gitem_t *item)
  290. {
  291. int timeout;
  292. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  293. ValidateSelectedItem (ent);
  294. if (quad_drop_timeout_hack)
  295. {
  296. timeout = quad_drop_timeout_hack;
  297. quad_drop_timeout_hack = 0;
  298. }
  299. else
  300. {
  301. timeout = 300;
  302. }
  303. if (ent->client->quad_framenum > level.framenum)
  304. ent->client->quad_framenum += timeout;
  305. else
  306. ent->client->quad_framenum = level.framenum + timeout;
  307. gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
  308. }
  309. // =====================================================================
  310. // RAFAEL
  311. void Use_QuadFire (edict_t *ent, gitem_t *item)
  312. {
  313. int timeout;
  314. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  315. ValidateSelectedItem (ent);
  316. if (quad_fire_drop_timeout_hack)
  317. {
  318. timeout = quad_fire_drop_timeout_hack;
  319. quad_fire_drop_timeout_hack = 0;
  320. }
  321. else
  322. {
  323. timeout = 300;
  324. }
  325. if (ent->client->quadfire_framenum > level.framenum)
  326. ent->client->quadfire_framenum += timeout;
  327. else
  328. ent->client->quadfire_framenum = level.framenum + timeout;
  329. gi.sound(ent, CHAN_ITEM, gi.soundindex("items/quadfire1.wav"), 1, ATTN_NORM, 0);
  330. }
  331. //======================================================================
  332. void Use_Breather (edict_t *ent, gitem_t *item)
  333. {
  334. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  335. ValidateSelectedItem (ent);
  336. if (ent->client->breather_framenum > level.framenum)
  337. ent->client->breather_framenum += 300;
  338. else
  339. ent->client->breather_framenum = level.framenum + 300;
  340. // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
  341. }
  342. //======================================================================
  343. void Use_Envirosuit (edict_t *ent, gitem_t *item)
  344. {
  345. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  346. ValidateSelectedItem (ent);
  347. if (ent->client->enviro_framenum > level.framenum)
  348. ent->client->enviro_framenum += 300;
  349. else
  350. ent->client->enviro_framenum = level.framenum + 300;
  351. // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
  352. }
  353. //======================================================================
  354. void Use_Invulnerability (edict_t *ent, gitem_t *item)
  355. {
  356. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  357. ValidateSelectedItem (ent);
  358. if (ent->client->invincible_framenum > level.framenum)
  359. ent->client->invincible_framenum += 300;
  360. else
  361. ent->client->invincible_framenum = level.framenum + 300;
  362. gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0);
  363. }
  364. //======================================================================
  365. void Use_Silencer (edict_t *ent, gitem_t *item)
  366. {
  367. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  368. ValidateSelectedItem (ent);
  369. ent->client->silencer_shots += 30;
  370. // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
  371. }
  372. //======================================================================
  373. qboolean Pickup_Key (edict_t *ent, edict_t *other)
  374. {
  375. if (coop->value)
  376. {
  377. if (strcmp(ent->classname, "key_power_cube") == 0)
  378. {
  379. if (other->client->pers.power_cubes & ((ent->spawnflags & 0x0000ff00)>> 8))
  380. return false;
  381. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  382. other->client->pers.power_cubes |= ((ent->spawnflags & 0x0000ff00) >> 8);
  383. }
  384. else
  385. {
  386. if (other->client->pers.inventory[ITEM_INDEX(ent->item)])
  387. return false;
  388. other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1;
  389. }
  390. return true;
  391. }
  392. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  393. return true;
  394. }
  395. //======================================================================
  396. qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count)
  397. {
  398. int index;
  399. int max;
  400. if (!ent->client)
  401. return false;
  402. if (item->tag == AMMO_BULLETS)
  403. max = ent->client->pers.max_bullets;
  404. else if (item->tag == AMMO_SHELLS)
  405. max = ent->client->pers.max_shells;
  406. else if (item->tag == AMMO_ROCKETS)
  407. max = ent->client->pers.max_rockets;
  408. else if (item->tag == AMMO_GRENADES)
  409. max = ent->client->pers.max_grenades;
  410. else if (item->tag == AMMO_CELLS)
  411. max = ent->client->pers.max_cells;
  412. else if (item->tag == AMMO_SLUGS)
  413. max = ent->client->pers.max_slugs;
  414. // RAFAEL
  415. else if (item->tag == AMMO_MAGSLUG)
  416. max = ent->client->pers.max_magslug;
  417. // RAFAEL
  418. else if (item->tag == AMMO_TRAP)
  419. max = ent->client->pers.max_trap;
  420. else
  421. return false;
  422. index = ITEM_INDEX(item);
  423. if (ent->client->pers.inventory[index] == max)
  424. return false;
  425. ent->client->pers.inventory[index] += count;
  426. if (ent->client->pers.inventory[index] > max)
  427. ent->client->pers.inventory[index] = max;
  428. return true;
  429. }
  430. qboolean Pickup_Ammo (edict_t *ent, edict_t *other)
  431. {
  432. int oldcount;
  433. int count;
  434. qboolean weapon;
  435. weapon = (ent->item->flags & IT_WEAPON);
  436. if ( (weapon) && ( (int)dmflags->value & DF_INFINITE_AMMO ) )
  437. count = 1000;
  438. else if (ent->count)
  439. count = ent->count;
  440. else
  441. count = ent->item->quantity;
  442. oldcount = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  443. if (!Add_Ammo (other, ent->item, count))
  444. return false;
  445. if (weapon && !oldcount)
  446. {
  447. if (other->client->pers.weapon != ent->item && ( !deathmatch->value || other->client->pers.weapon == FindItem("blaster") ) )
  448. other->client->newweapon = ent->item;
  449. }
  450. if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (deathmatch->value))
  451. SetRespawn (ent, 30);
  452. return true;
  453. }
  454. void Drop_Ammo (edict_t *ent, gitem_t *item)
  455. {
  456. edict_t *dropped;
  457. int index;
  458. index = ITEM_INDEX(item);
  459. dropped = Drop_Item (ent, item);
  460. if (ent->client->pers.inventory[index] >= item->quantity)
  461. dropped->count = item->quantity;
  462. else
  463. dropped->count = ent->client->pers.inventory[index];
  464. if (ent->client->pers.weapon &&
  465. ent->client->pers.weapon->tag == AMMO_GRENADES &&
  466. item->tag == AMMO_GRENADES &&
  467. ent->client->pers.inventory[index] - dropped->count <= 0) {
  468. gi.cprintf (ent, PRINT_HIGH, "Can't drop current weapon\n");
  469. G_FreeEdict(dropped);
  470. return;
  471. }
  472. ent->client->pers.inventory[index] -= dropped->count;
  473. ValidateSelectedItem (ent);
  474. }
  475. //======================================================================
  476. void MegaHealth_think (edict_t *self)
  477. {
  478. if (self->owner->health > self->owner->max_health)
  479. {
  480. self->nextthink = level.time + 1;
  481. self->owner->health -= 1;
  482. return;
  483. }
  484. if (!(self->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  485. SetRespawn (self, 20);
  486. else
  487. G_FreeEdict (self);
  488. }
  489. qboolean Pickup_Health (edict_t *ent, edict_t *other)
  490. {
  491. if (!(ent->style & HEALTH_IGNORE_MAX))
  492. if (other->health >= other->max_health)
  493. return false;
  494. other->health += ent->count;
  495. if (!(ent->style & HEALTH_IGNORE_MAX))
  496. {
  497. if (other->health > other->max_health)
  498. other->health = other->max_health;
  499. }
  500. if (ent->style & HEALTH_TIMED)
  501. {
  502. ent->think = MegaHealth_think;
  503. ent->nextthink = level.time + 5;
  504. ent->owner = other;
  505. ent->flags |= FL_RESPAWN;
  506. ent->svflags |= SVF_NOCLIENT;
  507. ent->solid = SOLID_NOT;
  508. }
  509. else
  510. {
  511. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  512. SetRespawn (ent, 30);
  513. }
  514. return true;
  515. }
  516. //======================================================================
  517. int ArmorIndex (edict_t *ent)
  518. {
  519. if (!ent->client)
  520. return 0;
  521. if (ent->client->pers.inventory[jacket_armor_index] > 0)
  522. return jacket_armor_index;
  523. if (ent->client->pers.inventory[combat_armor_index] > 0)
  524. return combat_armor_index;
  525. if (ent->client->pers.inventory[body_armor_index] > 0)
  526. return body_armor_index;
  527. return 0;
  528. }
  529. qboolean Pickup_Armor (edict_t *ent, edict_t *other)
  530. {
  531. int old_armor_index;
  532. gitem_armor_t *oldinfo;
  533. gitem_armor_t *newinfo;
  534. int newcount;
  535. float salvage;
  536. int salvagecount;
  537. // get info on new armor
  538. newinfo = (gitem_armor_t *)ent->item->info;
  539. old_armor_index = ArmorIndex (other);
  540. // handle armor shards specially
  541. if (ent->item->tag == ARMOR_SHARD)
  542. {
  543. if (!old_armor_index)
  544. other->client->pers.inventory[jacket_armor_index] = 2;
  545. else
  546. other->client->pers.inventory[old_armor_index] += 2;
  547. }
  548. // if player has no armor, just use it
  549. else if (!old_armor_index)
  550. {
  551. other->client->pers.inventory[ITEM_INDEX(ent->item)] = newinfo->base_count;
  552. }
  553. // use the better armor
  554. else
  555. {
  556. // get info on old armor
  557. if (old_armor_index == jacket_armor_index)
  558. oldinfo = &jacketarmor_info;
  559. else if (old_armor_index == combat_armor_index)
  560. oldinfo = &combatarmor_info;
  561. else // (old_armor_index == body_armor_index)
  562. oldinfo = &bodyarmor_info;
  563. if (newinfo->normal_protection > oldinfo->normal_protection)
  564. {
  565. // calc new armor values
  566. salvage = oldinfo->normal_protection / newinfo->normal_protection;
  567. salvagecount = salvage * other->client->pers.inventory[old_armor_index];
  568. newcount = newinfo->base_count + salvagecount;
  569. if (newcount > newinfo->max_count)
  570. newcount = newinfo->max_count;
  571. // zero count of old armor so it goes away
  572. other->client->pers.inventory[old_armor_index] = 0;
  573. // change armor to new item with computed value
  574. other->client->pers.inventory[ITEM_INDEX(ent->item)] = newcount;
  575. }
  576. else
  577. {
  578. // calc new armor values
  579. salvage = newinfo->normal_protection / oldinfo->normal_protection;
  580. salvagecount = salvage * newinfo->base_count;
  581. newcount = other->client->pers.inventory[old_armor_index] + salvagecount;
  582. if (newcount > oldinfo->max_count)
  583. newcount = oldinfo->max_count;
  584. // if we're already maxed out then we don't need the new armor
  585. if (other->client->pers.inventory[old_armor_index] >= newcount)
  586. return false;
  587. // update current armor value
  588. other->client->pers.inventory[old_armor_index] = newcount;
  589. }
  590. }
  591. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  592. SetRespawn (ent, 20);
  593. return true;
  594. }
  595. //======================================================================
  596. int PowerArmorType (edict_t *ent)
  597. {
  598. if (!ent->client)
  599. return POWER_ARMOR_NONE;
  600. if (!(ent->flags & FL_POWER_ARMOR))
  601. return POWER_ARMOR_NONE;
  602. if (ent->client->pers.inventory[power_shield_index] > 0)
  603. return POWER_ARMOR_SHIELD;
  604. if (ent->client->pers.inventory[power_screen_index] > 0)
  605. return POWER_ARMOR_SCREEN;
  606. return POWER_ARMOR_NONE;
  607. }
  608. void Use_PowerArmor (edict_t *ent, gitem_t *item)
  609. {
  610. int index;
  611. if (ent->flags & FL_POWER_ARMOR)
  612. {
  613. ent->flags &= ~FL_POWER_ARMOR;
  614. gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
  615. }
  616. else
  617. {
  618. index = ITEM_INDEX(FindItem("cells"));
  619. if (!ent->client->pers.inventory[index])
  620. {
  621. gi.cprintf (ent, PRINT_HIGH, "No cells for power armor.\n");
  622. return;
  623. }
  624. ent->flags |= FL_POWER_ARMOR;
  625. gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power1.wav"), 1, ATTN_NORM, 0);
  626. }
  627. }
  628. qboolean Pickup_PowerArmor (edict_t *ent, edict_t *other)
  629. {
  630. int quantity;
  631. quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  632. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  633. if (deathmatch->value)
  634. {
  635. if (!(ent->spawnflags & DROPPED_ITEM) )
  636. SetRespawn (ent, ent->item->quantity);
  637. // auto-use for DM only if we didn't already have one
  638. if (!quantity)
  639. ent->item->use (other, ent->item);
  640. }
  641. return true;
  642. }
  643. void Drop_PowerArmor (edict_t *ent, gitem_t *item)
  644. {
  645. if ((ent->flags & FL_POWER_ARMOR) && (ent->client->pers.inventory[ITEM_INDEX(item)] == 1))
  646. Use_PowerArmor (ent, item);
  647. Drop_General (ent, item);
  648. }
  649. //======================================================================
  650. /*
  651. ===============
  652. Touch_Item
  653. ===============
  654. */
  655. void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
  656. {
  657. qboolean taken;
  658. if (!other->client)
  659. return;
  660. if (other->health < 1)
  661. return; // dead people can't pickup
  662. if (!ent->item->pickup)
  663. return; // not a grabbable item?
  664. taken = ent->item->pickup(ent, other);
  665. if (taken)
  666. {
  667. // flash the screen
  668. other->client->bonus_alpha = 0.25;
  669. // show icon and name on status bar
  670. other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
  671. other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
  672. other->client->pickup_msg_time = level.time + 3.0;
  673. // change selected item
  674. if (ent->item->use)
  675. other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX(ent->item);
  676. if (ent->item->pickup == Pickup_Health)
  677. {
  678. if (ent->count == 2)
  679. gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
  680. else if (ent->count == 10)
  681. gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
  682. else if (ent->count == 25)
  683. gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
  684. else // (ent->count == 100)
  685. gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
  686. }
  687. else if (ent->item->pickup_sound)
  688. {
  689. gi.sound(other, CHAN_ITEM, gi.soundindex(ent->item->pickup_sound), 1, ATTN_NORM, 0);
  690. }
  691. }
  692. if (!(ent->spawnflags & ITEM_TARGETS_USED))
  693. {
  694. G_UseTargets (ent, other);
  695. ent->spawnflags |= ITEM_TARGETS_USED;
  696. }
  697. if (!taken)
  698. return;
  699. if (!((coop->value) && (ent->item->flags & IT_STAY_COOP)) || (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)))
  700. {
  701. if (ent->flags & FL_RESPAWN)
  702. ent->flags &= ~FL_RESPAWN;
  703. else
  704. G_FreeEdict (ent);
  705. }
  706. }
  707. //======================================================================
  708. static void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
  709. {
  710. if (other == ent->owner)
  711. return;
  712. Touch_Item (ent, other, plane, surf);
  713. }
  714. static void drop_make_touchable (edict_t *ent)
  715. {
  716. ent->touch = Touch_Item;
  717. if (deathmatch->value)
  718. {
  719. ent->nextthink = level.time + 29;
  720. ent->think = G_FreeEdict;
  721. }
  722. }
  723. edict_t *Drop_Item (edict_t *ent, gitem_t *item)
  724. {
  725. edict_t *dropped;
  726. vec3_t forward, right;
  727. vec3_t offset;
  728. dropped = G_Spawn();
  729. dropped->classname = item->classname;
  730. dropped->item = item;
  731. dropped->spawnflags = DROPPED_ITEM;
  732. dropped->s.effects = item->world_model_flags;
  733. dropped->s.renderfx = RF_GLOW;
  734. VectorSet (dropped->mins, -15, -15, -15);
  735. VectorSet (dropped->maxs, 15, 15, 15);
  736. gi.setmodel (dropped, dropped->item->world_model);
  737. dropped->solid = SOLID_TRIGGER;
  738. dropped->movetype = MOVETYPE_TOSS;
  739. dropped->touch = drop_temp_touch;
  740. dropped->owner = ent;
  741. if (ent->client)
  742. {
  743. trace_t trace;
  744. AngleVectors (ent->client->v_angle, forward, right, NULL);
  745. VectorSet(offset, 24, 0, -16);
  746. G_ProjectSource (ent->s.origin, offset, forward, right, dropped->s.origin);
  747. trace = gi.trace (ent->s.origin, dropped->mins, dropped->maxs,
  748. dropped->s.origin, ent, CONTENTS_SOLID);
  749. VectorCopy (trace.endpos, dropped->s.origin);
  750. }
  751. else
  752. {
  753. AngleVectors (ent->s.angles, forward, right, NULL);
  754. VectorCopy (ent->s.origin, dropped->s.origin);
  755. }
  756. VectorScale (forward, 100, dropped->velocity);
  757. dropped->velocity[2] = 300;
  758. dropped->think = drop_make_touchable;
  759. dropped->nextthink = level.time + 1;
  760. gi.linkentity (dropped);
  761. return dropped;
  762. }
  763. void Use_Item (edict_t *ent, edict_t *other, edict_t *activator)
  764. {
  765. ent->svflags &= ~SVF_NOCLIENT;
  766. ent->use = NULL;
  767. if (ent->spawnflags & ITEM_NO_TOUCH)
  768. {
  769. ent->solid = SOLID_BBOX;
  770. ent->touch = NULL;
  771. }
  772. else
  773. {
  774. ent->solid = SOLID_TRIGGER;
  775. ent->touch = Touch_Item;
  776. }
  777. gi.linkentity (ent);
  778. }
  779. //======================================================================
  780. /*
  781. ================
  782. droptofloor
  783. ================
  784. */
  785. void droptofloor (edict_t *ent)
  786. {
  787. trace_t tr;
  788. vec3_t dest;
  789. float *v;
  790. v = tv(-15,-15,-15);
  791. VectorCopy (v, ent->mins);
  792. v = tv(15,15,15);
  793. VectorCopy (v, ent->maxs);
  794. if (ent->model)
  795. gi.setmodel (ent, ent->model);
  796. else
  797. gi.setmodel (ent, ent->item->world_model);
  798. ent->solid = SOLID_TRIGGER;
  799. ent->movetype = MOVETYPE_TOSS;
  800. ent->touch = Touch_Item;
  801. v = tv(0,0,-128);
  802. VectorAdd (ent->s.origin, v, dest);
  803. tr = gi.trace (ent->s.origin, ent->mins, ent->maxs, dest, ent, MASK_SOLID);
  804. if (tr.startsolid)
  805. {
  806. // RAFAEL
  807. if (strcmp (ent->classname, "foodcube") == 0)
  808. {
  809. VectorCopy (ent->s.origin, tr.endpos);
  810. ent->velocity[2] = 0;
  811. }
  812. else
  813. {
  814. gi.dprintf ("droptofloor: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin));
  815. G_FreeEdict (ent);
  816. return;
  817. }
  818. }
  819. VectorCopy (tr.endpos, ent->s.origin);
  820. if (ent->team)
  821. {
  822. ent->flags &= ~FL_TEAMSLAVE;
  823. ent->chain = ent->teamchain;
  824. ent->teamchain = NULL;
  825. ent->svflags |= SVF_NOCLIENT;
  826. ent->solid = SOLID_NOT;
  827. if (ent == ent->teammaster)
  828. {
  829. ent->nextthink = level.time + FRAMETIME;
  830. ent->think = DoRespawn;
  831. }
  832. }
  833. if (ent->spawnflags & ITEM_NO_TOUCH)
  834. {
  835. ent->solid = SOLID_BBOX;
  836. ent->touch = NULL;
  837. ent->s.effects &= ~EF_ROTATE;
  838. ent->s.renderfx &= ~RF_GLOW;
  839. }
  840. if (ent->spawnflags & ITEM_TRIGGER_SPAWN)
  841. {
  842. ent->svflags |= SVF_NOCLIENT;
  843. ent->solid = SOLID_NOT;
  844. ent->use = Use_Item;
  845. }
  846. gi.linkentity (ent);
  847. }
  848. /*
  849. ===============
  850. PrecacheItem
  851. Precaches all data needed for a given item.
  852. This will be called for each item spawned in a level,
  853. and for each item in each client's inventory.
  854. ===============
  855. */
  856. void PrecacheItem (gitem_t *it)
  857. {
  858. char *s, *start;
  859. char data[MAX_QPATH];
  860. int len;
  861. gitem_t *ammo;
  862. if (!it)
  863. return;
  864. if (it->pickup_sound)
  865. gi.soundindex (it->pickup_sound);
  866. if (it->world_model)
  867. gi.modelindex (it->world_model);
  868. if (it->view_model)
  869. gi.modelindex (it->view_model);
  870. if (it->icon)
  871. gi.imageindex (it->icon);
  872. // parse everything for its ammo
  873. if (it->ammo && it->ammo[0])
  874. {
  875. ammo = FindItem (it->ammo);
  876. if (ammo != it)
  877. PrecacheItem (ammo);
  878. }
  879. // parse the space seperated precache string for other items
  880. s = it->precaches;
  881. if (!s || !s[0])
  882. return;
  883. while (*s)
  884. {
  885. start = s;
  886. while (*s && *s != ' ')
  887. s++;
  888. len = s-start;
  889. if (len >= MAX_QPATH || len < 5)
  890. gi.error ("PrecacheItem: %s has bad precache string", it->classname);
  891. memcpy (data, start, len);
  892. data[len] = 0;
  893. if (*s)
  894. s++;
  895. // determine type based on extension
  896. if (!strcmp(data+len-3, "md2"))
  897. gi.modelindex (data);
  898. else if (!strcmp(data+len-3, "sp2"))
  899. gi.modelindex (data);
  900. else if (!strcmp(data+len-3, "wav"))
  901. gi.soundindex (data);
  902. if (!strcmp(data+len-3, "pcx"))
  903. gi.imageindex (data);
  904. }
  905. }
  906. /*
  907. ============
  908. SpawnItem
  909. Sets the clipping size and plants the object on the floor.
  910. Items can't be immediately dropped to floor, because they might
  911. be on an entity that hasn't spawned yet.
  912. ============
  913. */
  914. void SpawnItem (edict_t *ent, gitem_t *item)
  915. {
  916. PrecacheItem (item);
  917. if (ent->spawnflags)
  918. {
  919. if (strcmp(ent->classname, "key_power_cube") != 0)
  920. {
  921. ent->spawnflags = 0;
  922. gi.dprintf("%s at %s has invalid spawnflags set\n", ent->classname, vtos(ent->s.origin));
  923. }
  924. }
  925. // some items will be prevented in deathmatch
  926. if (deathmatch->value)
  927. {
  928. if ( (int)dmflags->value & DF_NO_ARMOR )
  929. {
  930. if (item->pickup == Pickup_Armor || item->pickup == Pickup_PowerArmor)
  931. {
  932. G_FreeEdict (ent);
  933. return;
  934. }
  935. }
  936. if ( (int)dmflags->value & DF_NO_ITEMS )
  937. {
  938. if (item->pickup == Pickup_Powerup)
  939. {
  940. G_FreeEdict (ent);
  941. return;
  942. }
  943. }
  944. if ( (int)dmflags->value & DF_NO_HEALTH )
  945. {
  946. if (item->pickup == Pickup_Health || item->pickup == Pickup_Adrenaline || item->pickup == Pickup_AncientHead)
  947. {
  948. G_FreeEdict (ent);
  949. return;
  950. }
  951. }
  952. if ( (int)dmflags->value & DF_INFINITE_AMMO )
  953. {
  954. if ( (item->flags == IT_AMMO) || (strcmp(ent->classname, "weapon_bfg") == 0) )
  955. {
  956. G_FreeEdict (ent);
  957. return;
  958. }
  959. }
  960. }
  961. if (coop->value && (strcmp(ent->classname, "key_power_cube") == 0))
  962. {
  963. ent->spawnflags |= (1 << (8 + level.power_cubes));
  964. level.power_cubes++;
  965. }
  966. // don't let them drop items that stay in a coop game
  967. if ((coop->value) && (item->flags & IT_STAY_COOP))
  968. {
  969. item->drop = NULL;
  970. }
  971. ent->item = item;
  972. ent->nextthink = level.time + 2 * FRAMETIME; // items start after other solids
  973. ent->think = droptofloor;
  974. ent->s.effects = item->world_model_flags;
  975. ent->s.renderfx = RF_GLOW;
  976. if (ent->model)
  977. gi.modelindex (ent->model);
  978. }
  979. //======================================================================
  980. gitem_t itemlist[] =
  981. {
  982. {
  983. NULL
  984. }, // leave index 0 alone
  985. //
  986. // ARMOR
  987. //
  988. /*QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16)
  989. */
  990. {
  991. "item_armor_body",
  992. Pickup_Armor,
  993. NULL,
  994. NULL,
  995. NULL,
  996. "misc/ar1_pkup.wav",
  997. "models/items/armor/body/tris.md2", EF_ROTATE,
  998. NULL,
  999. /* icon */ "i_bodyarmor",
  1000. /* pickup */ "Body Armor",
  1001. /* width */ 3,
  1002. 0,
  1003. NULL,
  1004. IT_ARMOR,
  1005. 0,
  1006. &bodyarmor_info,
  1007. ARMOR_BODY,
  1008. /* precache */ ""
  1009. },
  1010. /*QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16)
  1011. */
  1012. {
  1013. "item_armor_combat",
  1014. Pickup_Armor,
  1015. NULL,
  1016. NULL,
  1017. NULL,
  1018. "misc/ar1_pkup.wav",
  1019. "models/items/armor/combat/tris.md2", EF_ROTATE,
  1020. NULL,
  1021. /* icon */ "i_combatarmor",
  1022. /* pickup */ "Combat Armor",
  1023. /* width */ 3,
  1024. 0,
  1025. NULL,
  1026. IT_ARMOR,
  1027. 0,
  1028. &combatarmor_info,
  1029. ARMOR_COMBAT,
  1030. /* precache */ ""
  1031. },
  1032. /*QUAKED item_armor_jacket (.3 .3 1) (-16 -16 -16) (16 16 16)
  1033. */
  1034. {
  1035. "item_armor_jacket",
  1036. Pickup_Armor,
  1037. NULL,
  1038. NULL,
  1039. NULL,
  1040. "misc/ar1_pkup.wav",
  1041. "models/items/armor/jacket/tris.md2", EF_ROTATE,
  1042. NULL,
  1043. /* icon */ "i_jacketarmor",
  1044. /* pickup */ "Jacket Armor",
  1045. /* width */ 3,
  1046. 0,
  1047. NULL,
  1048. IT_ARMOR,
  1049. 0,
  1050. &jacketarmor_info,
  1051. ARMOR_JACKET,
  1052. /* precache */ ""
  1053. },
  1054. /*QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16)
  1055. */
  1056. {
  1057. "item_armor_shard",
  1058. Pickup_Armor,
  1059. NULL,
  1060. NULL,
  1061. NULL,
  1062. "misc/ar2_pkup.wav",
  1063. "models/items/armor/shard/tris.md2", EF_ROTATE,
  1064. NULL,
  1065. /* icon */ "i_jacketarmor",
  1066. /* pickup */ "Armor Shard",
  1067. /* width */ 3,
  1068. 0,
  1069. NULL,
  1070. IT_ARMOR,
  1071. 0,
  1072. NULL,
  1073. ARMOR_SHARD,
  1074. /* precache */ ""
  1075. },
  1076. /*QUAKED item_power_screen (.3 .3 1) (-16 -16 -16) (16 16 16)
  1077. */
  1078. {
  1079. "item_power_screen",
  1080. Pickup_PowerArmor,
  1081. Use_PowerArmor,
  1082. Drop_PowerArmor,
  1083. NULL,
  1084. "misc/ar3_pkup.wav",
  1085. "models/items/armor/screen/tris.md2", EF_ROTATE,
  1086. NULL,
  1087. /* icon */ "i_powerscreen",
  1088. /* pickup */ "Power Screen",
  1089. /* width */ 0,
  1090. 60,
  1091. NULL,
  1092. IT_ARMOR,
  1093. 0,
  1094. NULL,
  1095. 0,
  1096. /* precache */ ""
  1097. },
  1098. /*QUAKED item_power_shield (.3 .3 1) (-16 -16 -16) (16 16 16)
  1099. */
  1100. {
  1101. "item_power_shield",
  1102. Pickup_PowerArmor,
  1103. Use_PowerArmor,
  1104. Drop_PowerArmor,
  1105. NULL,
  1106. "misc/ar3_pkup.wav",
  1107. "models/items/armor/shield/tris.md2", EF_ROTATE,
  1108. NULL,
  1109. /* icon */ "i_powershield",
  1110. /* pickup */ "Power Shield",
  1111. /* width */ 0,
  1112. 60,
  1113. NULL,
  1114. IT_ARMOR,
  1115. 0,
  1116. NULL,
  1117. 0,
  1118. /* precache */ "misc/power2.wav misc/power1.wav"
  1119. },
  1120. //
  1121. // WEAPONS
  1122. //
  1123. /* weapon_blaster (.3 .3 1) (-16 -16 -16) (16 16 16)
  1124. always owned, never in the world
  1125. */
  1126. {
  1127. "weapon_blaster",
  1128. NULL,
  1129. Use_Weapon,
  1130. NULL,
  1131. Weapon_Blaster,
  1132. "misc/w_pkup.wav",
  1133. NULL, 0,
  1134. "models/weapons/v_blast/tris.md2",
  1135. /* icon */ "w_blaster",
  1136. /* pickup */ "Blaster",
  1137. 0,
  1138. 0,
  1139. NULL,
  1140. IT_WEAPON|IT_STAY_COOP,
  1141. WEAP_BLASTER,
  1142. NULL,
  1143. 0,
  1144. /* precache */ "weapons/blastf1a.wav misc/lasfly.wav"
  1145. },
  1146. /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16)
  1147. */
  1148. {
  1149. "weapon_shotgun",
  1150. Pickup_Weapon,
  1151. Use_Weapon,
  1152. Drop_Weapon,
  1153. Weapon_Shotgun,
  1154. "misc/w_pkup.wav",
  1155. "models/weapons/g_shotg/tris.md2", EF_ROTATE,
  1156. "models/weapons/v_shotg/tris.md2",
  1157. /* icon */ "w_shotgun",
  1158. /* pickup */ "Shotgun",
  1159. 0,
  1160. 1,
  1161. "Shells",
  1162. IT_WEAPON|IT_STAY_COOP,
  1163. WEAP_SHOTGUN,
  1164. NULL,
  1165. 0,
  1166. /* precache */ "weapons/shotgf1b.wav weapons/shotgr1b.wav"
  1167. },
  1168. /*QUAKED weapon_supershotgun (.3 .3 1) (-16 -16 -16) (16 16 16)
  1169. */
  1170. {
  1171. "weapon_supershotgun",
  1172. Pickup_Weapon,
  1173. Use_Weapon,
  1174. Drop_Weapon,
  1175. Weapon_SuperShotgun,
  1176. "misc/w_pkup.wav",
  1177. "models/weapons/g_shotg2/tris.md2", EF_ROTATE,
  1178. "models/weapons/v_shotg2/tris.md2",
  1179. /* icon */ "w_sshotgun",
  1180. /* pickup */ "Super Shotgun",
  1181. 0,
  1182. 2,
  1183. "Shells",
  1184. IT_WEAPON|IT_STAY_COOP,
  1185. WEAP_SUPERSHOTGUN,
  1186. NULL,
  1187. 0,
  1188. /* precache */ "weapons/sshotf1b.wav"
  1189. },
  1190. /*QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16)
  1191. */
  1192. {
  1193. "weapon_machinegun",
  1194. Pickup_Weapon,
  1195. Use_Weapon,
  1196. Drop_Weapon,
  1197. Weapon_Machinegun,
  1198. "misc/w_pkup.wav",
  1199. "models/weapons/g_machn/tris.md2", EF_ROTATE,
  1200. "models/weapons/v_machn/tris.md2",
  1201. /* icon */ "w_machinegun",
  1202. /* pickup */ "Machinegun",
  1203. 0,
  1204. 1,
  1205. "Bullets",
  1206. IT_WEAPON|IT_STAY_COOP,
  1207. WEAP_MACHINEGUN,
  1208. NULL,
  1209. 0,
  1210. /* precache */ "weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf4b.wav weapons/machgf5b.wav"
  1211. },
  1212. /*QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16)
  1213. */
  1214. {
  1215. "weapon_chaingun",
  1216. Pickup_Weapon,
  1217. Use_Weapon,
  1218. Drop_Weapon,
  1219. Weapon_Chaingun,
  1220. "misc/w_pkup.wav",
  1221. "models/weapons/g_chain/tris.md2", EF_ROTATE,
  1222. "models/weapons/v_chain/tris.md2",
  1223. /* icon */ "w_chaingun",
  1224. /* pickup */ "Chaingun",
  1225. 0,
  1226. 1,
  1227. "Bullets",
  1228. IT_WEAPON|IT_STAY_COOP,
  1229. WEAP_CHAINGUN,
  1230. NULL,
  1231. 0,
  1232. /* precache */ "weapons/chngnu1a.wav weapons/chngnl1a.wav weapons/machgf3b.wav` weapons/chngnd1a.wav"
  1233. },
  1234. /*QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16)
  1235. */
  1236. {
  1237. "ammo_grenades",
  1238. Pickup_Ammo,
  1239. Use_Weapon,
  1240. Drop_Ammo,
  1241. Weapon_Grenade,
  1242. "misc/am_pkup.wav",
  1243. "models/items/ammo/grenades/medium/tris.md2", 0,
  1244. "models/weapons/v_handgr/tris.md2",
  1245. /* icon */ "a_grenades",
  1246. /* pickup */ "Grenades",
  1247. /* width */ 3,
  1248. 5,
  1249. "grenades",
  1250. IT_AMMO|IT_WEAPON,
  1251. WEAP_GRENADES,
  1252. NULL,
  1253. AMMO_GRENADES,
  1254. /* precache */ "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
  1255. },
  1256. /*QUAKED ammo_trap (.3 .3 1) (-16 -16 -16) (16 16 16)
  1257. */
  1258. {
  1259. "ammo_trap",
  1260. Pickup_Ammo,
  1261. Use_Weapon,
  1262. Drop_Ammo,
  1263. Weapon_Trap,
  1264. "misc/am_pkup.wav",
  1265. "models/weapons/g_trap/tris.md2", EF_ROTATE,
  1266. "models/weapons/v_trap/tris.md2",
  1267. /* icon */ "a_trap",
  1268. /* pickup */ "Trap",
  1269. /* width */ 3,
  1270. 1,
  1271. "trap",
  1272. IT_AMMO|IT_WEAPON,
  1273. 0,
  1274. NULL,
  1275. AMMO_TRAP,
  1276. /* precache */ "weapons/trapcock.wav weapons/traploop.wav weapons/trapsuck.wav weapons/trapdown.wav"
  1277. // "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
  1278. },
  1279. /*QUAKED weapon_grenadelauncher (.3 .3 1) (-16 -16 -16) (16 16 16)
  1280. */
  1281. {
  1282. "weapon_grenadelauncher",
  1283. Pickup_Weapon,
  1284. Use_Weapon,
  1285. Drop_Weapon,
  1286. Weapon_GrenadeLauncher,
  1287. "misc/w_pkup.wav",
  1288. "models/weapons/g_launch/tris.md2", EF_ROTATE,
  1289. "models/weapons/v_launch/tris.md2",
  1290. /* icon */ "w_glauncher",
  1291. /* pickup */ "Grenade Launcher",
  1292. 0,
  1293. 1,
  1294. "Grenades",
  1295. IT_WEAPON|IT_STAY_COOP,
  1296. WEAP_GRENADELAUNCHER,
  1297. NULL,
  1298. 0,
  1299. /* precache */ "models/objects/grenade/tris.md2 weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav"
  1300. },
  1301. /*QUAKED weapon_rocketlauncher (.3 .3 1) (-16 -16 -16) (16 16 16)
  1302. */
  1303. {
  1304. "weapon_rocketlauncher",
  1305. Pickup_Weapon,
  1306. Use_Weapon,
  1307. Drop_Weapon,
  1308. Weapon_RocketLauncher,
  1309. "misc/w_pkup.wav",
  1310. "models/weapons/g_rocket/tris.md2", EF_ROTATE,
  1311. "models/weapons/v_rocket/tris.md2",
  1312. /* icon */ "w_rlauncher",
  1313. /* pickup */ "Rocket Launcher",
  1314. 0,
  1315. 1,
  1316. "Rockets",
  1317. IT_WEAPON|IT_STAY_COOP,
  1318. WEAP_ROCKETLAUNCHER,
  1319. NULL,
  1320. 0,
  1321. /* precache */ "models/objects/rocket/tris.md2 weapons/rockfly.wav weapons/rocklf1a.wav weapons/rocklr1b.wav models/objects/debris2/tris.md2"
  1322. },
  1323. /*QUAKED weapon_hyperblaster (.3 .3 1) (-16 -16 -16) (16 16 16)
  1324. */
  1325. {
  1326. "weapon_hyperblaster",
  1327. Pickup_Weapon,
  1328. // RAFAEL
  1329. Use_Weapon2,
  1330. Drop_Weapon,
  1331. Weapon_HyperBlaster,
  1332. "misc/w_pkup.wav",
  1333. "models/weapons/g_hyperb/tris.md2", EF_ROTATE,
  1334. "models/weapons/v_hyperb/tris.md2",
  1335. /* icon */ "w_hyperblaster",
  1336. /* pickup */ "HyperBlaster",
  1337. 0,
  1338. 1,
  1339. "Cells",
  1340. IT_WEAPON|IT_STAY_COOP,
  1341. WEAP_HYPERBLASTER,
  1342. NULL,
  1343. 0,
  1344. /* precache */ "weapons/hyprbu1a.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav weapons/hyprbd1a.wav misc/lasfly.wav"
  1345. },
  1346. /*QUAKED weapon_boomer (.3 .3 1) (-16 -16 -16) (16 16 16)
  1347. */
  1348. {
  1349. "weapon_boomer",
  1350. Pickup_Weapon,
  1351. Use_Weapon,
  1352. Drop_Weapon,
  1353. Weapon_Ionripper,
  1354. "misc/w_pkup.wav",
  1355. "models/weapons/g_boom/tris.md2", EF_ROTATE,
  1356. "models/weapons/v_boomer/tris.md2",
  1357. /* icon */ "w_ripper",
  1358. /* pickup */ "Ionripper",
  1359. 0,
  1360. 2,
  1361. "Cells",
  1362. IT_WEAPON,
  1363. WEAP_BOOMER,
  1364. NULL,
  1365. 0,
  1366. /* precache */ "weapons/rg_hum.wav weapons/rippfire.wav"
  1367. },
  1368. // END 14-APR-98
  1369. /*QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16)
  1370. */
  1371. {
  1372. "weapon_railgun",
  1373. Pickup_Weapon,
  1374. // RAFAEL
  1375. Use_Weapon2,
  1376. Drop_Weapon,
  1377. Weapon_Railgun,
  1378. "misc/w_pkup.wav",
  1379. "models/weapons/g_rail/tris.md2", EF_ROTATE,
  1380. "models/weapons/v_rail/tris.md2",
  1381. /* icon */ "w_railgun",
  1382. /* pickup */ "Railgun",
  1383. 0,
  1384. 1,
  1385. "Slugs",
  1386. IT_WEAPON|IT_STAY_COOP,
  1387. WEAP_RAILGUN,
  1388. NULL,
  1389. 0,
  1390. /* precache */ "weapons/rg_hum.wav"
  1391. },
  1392. // RAFAEL 14-APR-98
  1393. /*QUAKED weapon_phalanx (.3 .3 1) (-16 -16 -16) (16 16 16)
  1394. */
  1395. {
  1396. "weapon_phalanx",
  1397. Pickup_Weapon,
  1398. Use_Weapon,
  1399. Drop_Weapon,
  1400. Weapon_Phalanx,
  1401. "misc/w_pkup.wav",
  1402. "models/weapons/g_shotx/tris.md2", EF_ROTATE,
  1403. "models/weapons/v_shotx/tris.md2",
  1404. /* icon */ "w_phallanx",
  1405. /* pickup */ "Phalanx",
  1406. 0,
  1407. 1,
  1408. "Mag Slug",
  1409. IT_WEAPON,
  1410. WEAP_PHALANX,
  1411. NULL,
  1412. 0,
  1413. /* precache */ "weapons/plasshot.wav"
  1414. },
  1415. /*QUAKED weapon_bfg (.3 .3 1) (-16 -16 -16) (16 16 16)
  1416. */
  1417. {
  1418. "weapon_bfg",
  1419. Pickup_Weapon,
  1420. Use_Weapon,
  1421. Drop_Weapon,
  1422. Weapon_BFG,
  1423. "misc/w_pkup.wav",
  1424. "models/weapons/g_bfg/tris.md2", EF_ROTATE,
  1425. "models/weapons/v_bfg/tris.md2",
  1426. /* icon */ "w_bfg",
  1427. /* pickup */ "BFG10K",
  1428. 0,
  1429. 50,
  1430. "Cells",
  1431. IT_WEAPON|IT_STAY_COOP,
  1432. WEAP_BFG,
  1433. NULL,
  1434. 0,
  1435. /* precache */ "sprites/s_bfg1.sp2 sprites/s_bfg2.sp2 sprites/s_bfg3.sp2 weapons/bfg__f1y.wav weapons/bfg__l1a.wav weapons/bfg__x1b.wav weapons/bfg_hum.wav"
  1436. },
  1437. //
  1438. // AMMO ITEMS
  1439. //
  1440. /*QUAKED ammo_shells (.3 .3 1) (-16 -16 -16) (16 16 16)
  1441. */
  1442. {
  1443. "ammo_shells",
  1444. Pickup_Ammo,
  1445. NULL,
  1446. Drop_Ammo,
  1447. NULL,
  1448. "misc/am_pkup.wav",
  1449. "models/items/ammo/shells/medium/tris.md2", 0,
  1450. NULL,
  1451. /* icon */ "a_shells",
  1452. /* pickup */ "Shells",
  1453. /* width */ 3,
  1454. 10,
  1455. NULL,
  1456. IT_AMMO,
  1457. 0,
  1458. NULL,
  1459. AMMO_SHELLS,
  1460. /* precache */ ""
  1461. },
  1462. /*QUAKED ammo_bullets (.3 .3 1) (-16 -16 -16) (16 16 16)
  1463. */
  1464. {
  1465. "ammo_bullets",
  1466. Pickup_Ammo,
  1467. NULL,
  1468. Drop_Ammo,
  1469. NULL,
  1470. "misc/am_pkup.wav",
  1471. "models/items/ammo/bullets/medium/tris.md2", 0,
  1472. NULL,
  1473. /* icon */ "a_bullets",
  1474. /* pickup */ "Bullets",
  1475. /* width */ 3,
  1476. 50,
  1477. NULL,
  1478. IT_AMMO,
  1479. 0,
  1480. NULL,
  1481. AMMO_BULLETS,
  1482. /* precache */ ""
  1483. },
  1484. /*QUAKED ammo_cells (.3 .3 1) (-16 -16 -16) (16 16 16)
  1485. */
  1486. {
  1487. "ammo_cells",
  1488. Pickup_Ammo,
  1489. NULL,
  1490. Drop_Ammo,
  1491. NULL,
  1492. "misc/am_pkup.wav",
  1493. "models/items/ammo/cells/medium/tris.md2", 0,
  1494. NULL,
  1495. /* icon */ "a_cells",
  1496. /* pickup */ "Cells",
  1497. /* width */ 3,
  1498. 50,
  1499. NULL,
  1500. IT_AMMO,
  1501. 0,
  1502. NULL,
  1503. AMMO_CELLS,
  1504. /* precache */ ""
  1505. },
  1506. /*QUAKED ammo_rockets (.3 .3 1) (-16 -16 -16) (16 16 16)
  1507. */
  1508. {
  1509. "ammo_rockets",
  1510. Pickup_Ammo,
  1511. NULL,
  1512. Drop_Ammo,
  1513. NULL,
  1514. "misc/am_pkup.wav",
  1515. "models/items/ammo/rockets/medium/tris.md2", 0,
  1516. NULL,
  1517. /* icon */ "a_rockets",
  1518. /* pickup */ "Rockets",
  1519. /* width */ 3,
  1520. 5,
  1521. NULL,
  1522. IT_AMMO,
  1523. 0,
  1524. NULL,
  1525. AMMO_ROCKETS,
  1526. /* precache */ ""
  1527. },
  1528. /*QUAKED ammo_slugs (.3 .3 1) (-16 -16 -16) (16 16 16)
  1529. */
  1530. {
  1531. "ammo_slugs",
  1532. Pickup_Ammo,
  1533. NULL,
  1534. Drop_Ammo,
  1535. NULL,
  1536. "misc/am_pkup.wav",
  1537. "models/items/ammo/slugs/medium/tris.md2", 0,
  1538. NULL,
  1539. /* icon */ "a_slugs",
  1540. /* pickup */ "Slugs",
  1541. /* width */ 3,
  1542. 10,
  1543. NULL,
  1544. IT_AMMO,
  1545. 0,
  1546. NULL,
  1547. AMMO_SLUGS,
  1548. /* precache */ ""
  1549. },
  1550. /*QUAKED ammo_magslug (.3 .3 1) (-16 -16 -16) (16 16 16)
  1551. */
  1552. {
  1553. "ammo_magslug",
  1554. Pickup_Ammo,
  1555. NULL,
  1556. Drop_Ammo,
  1557. NULL,
  1558. "misc/am_pkup.wav",
  1559. "models/objects/ammo/tris.md2", 0,
  1560. NULL,
  1561. /* icon */ "a_mslugs",
  1562. /* pickup */ "Mag Slug",
  1563. /* width */ 3,
  1564. 10,
  1565. NULL,
  1566. IT_AMMO,
  1567. 0,
  1568. NULL,
  1569. AMMO_MAGSLUG,
  1570. /* precache */ ""
  1571. },
  1572. //
  1573. // POWERUP ITEMS
  1574. //
  1575. /*QUAKED item_quad (.3 .3 1) (-16 -16 -16) (16 16 16)
  1576. */
  1577. {
  1578. "item_quad",
  1579. Pickup_Powerup,
  1580. Use_Quad,
  1581. Drop_General,
  1582. NULL,
  1583. "items/pkup.wav",
  1584. "models/items/quaddama/tris.md2", EF_ROTATE,
  1585. NULL,
  1586. /* icon */ "p_quad",
  1587. /* pickup */ "Quad Damage",
  1588. /* width */ 2,
  1589. 60,
  1590. NULL,
  1591. IT_POWERUP,
  1592. 0,
  1593. NULL,
  1594. 0,
  1595. /* precache */ "items/damage.wav items/damage2.wav items/damage3.wav"
  1596. },
  1597. /*QUAKED item_quadfire (.3 .3 1) (-16 -16 -16) (16 16 16)
  1598. */
  1599. {
  1600. "item_quadfire",
  1601. Pickup_Powerup,
  1602. Use_QuadFire,
  1603. Drop_General,
  1604. NULL,
  1605. "items/pkup.wav",
  1606. "models/items/quadfire/tris.md2", EF_ROTATE,
  1607. NULL,
  1608. /* icon */ "p_quadfire",
  1609. /* pickup */ "DualFire Damage",
  1610. /* width */ 2,
  1611. 60,
  1612. NULL,
  1613. IT_POWERUP,
  1614. 0,
  1615. NULL,
  1616. 0,
  1617. /* precache */ "items/quadfire1.wav items/quadfire2.wav items/quadfire3.wav"
  1618. },
  1619. /*QUAKED item_invulnerability (.3 .3 1) (-16 -16 -16) (16 16 16)
  1620. */
  1621. {
  1622. "item_invulnerability",
  1623. Pickup_Powerup,
  1624. Use_Invulnerability,
  1625. Drop_General,
  1626. NULL,
  1627. "items/pkup.wav",
  1628. "models/items/invulner/tris.md2", EF_ROTATE,
  1629. NULL,
  1630. /* icon */ "p_invulnerability",
  1631. /* pickup */ "Invulnerability",
  1632. /* width */ 2,
  1633. 300,
  1634. NULL,
  1635. IT_POWERUP,
  1636. 0,
  1637. NULL,
  1638. 0,
  1639. /* precache */ "items/protect.wav items/protect2.wav items/protect4.wav"
  1640. },
  1641. /*QUAKED item_silencer (.3 .3 1) (-16 -16 -16) (16 16 16)
  1642. */
  1643. {
  1644. "item_silencer",
  1645. Pickup_Powerup,
  1646. Use_Silencer,
  1647. Drop_General,
  1648. NULL,
  1649. "items/pkup.wav",
  1650. "models/items/silencer/tris.md2", EF_ROTATE,
  1651. NULL,
  1652. /* icon */ "p_silencer",
  1653. /* pickup */ "Silencer",
  1654. /* width */ 2,
  1655. 60,
  1656. NULL,
  1657. IT_POWERUP,
  1658. 0,
  1659. NULL,
  1660. 0,
  1661. /* precache */ ""
  1662. },
  1663. /*QUAKED item_breather (.3 .3 1) (-16 -16 -16) (16 16 16)
  1664. */
  1665. {
  1666. "item_breather",
  1667. Pickup_Powerup,
  1668. Use_Breather,
  1669. Drop_General,
  1670. NULL,
  1671. "items/pkup.wav",
  1672. "models/items/breather/tris.md2", EF_ROTATE,
  1673. NULL,
  1674. /* icon */ "p_rebreather",
  1675. /* pickup */ "Rebreather",
  1676. /* width */ 2,
  1677. 60,
  1678. NULL,
  1679. IT_STAY_COOP|IT_POWERUP,
  1680. 0,
  1681. NULL,
  1682. 0,
  1683. /* precache */ "items/airout.wav"
  1684. },
  1685. /*QUAKED item_enviro (.3 .3 1) (-16 -16 -16) (16 16 16)
  1686. */
  1687. {
  1688. "item_enviro",
  1689. Pickup_Powerup,
  1690. Use_Envirosuit,
  1691. Drop_General,
  1692. NULL,
  1693. "items/pkup.wav",
  1694. "models/items/enviro/tris.md2", EF_ROTATE,
  1695. NULL,
  1696. /* icon */ "p_envirosuit",
  1697. /* pickup */ "Environment Suit",
  1698. /* width */ 2,
  1699. 60,
  1700. NULL,
  1701. IT_STAY_COOP|IT_POWERUP,
  1702. 0,
  1703. NULL,
  1704. 0,
  1705. /* precache */ "items/airout.wav"
  1706. },
  1707. /*QUAKED item_ancient_head (.3 .3 1) (-16 -16 -16) (16 16 16)
  1708. Special item that gives +2 to maximum health
  1709. */
  1710. {
  1711. "item_ancient_head",
  1712. Pickup_AncientHead,
  1713. NULL,
  1714. NULL,
  1715. NULL,
  1716. "items/pkup.wav",
  1717. "models/items/c_head/tris.md2", EF_ROTATE,
  1718. NULL,
  1719. /* icon */ "i_fixme",
  1720. /* pickup */ "Ancient Head",
  1721. /* width */ 2,
  1722. 60,
  1723. NULL,
  1724. 0,
  1725. 0,
  1726. NULL,
  1727. 0,
  1728. /* precache */ ""
  1729. },
  1730. /*QUAKED item_adrenaline (.3 .3 1) (-16 -16 -16) (16 16 16)
  1731. gives +1 to maximum health
  1732. */
  1733. {
  1734. "item_adrenaline",
  1735. Pickup_Adrenaline,
  1736. NULL,
  1737. NULL,
  1738. NULL,
  1739. "items/pkup.wav",
  1740. "models/items/adrenal/tris.md2", EF_ROTATE,
  1741. NULL,
  1742. /* icon */ "p_adrenaline",
  1743. /* pickup */ "Adrenaline",
  1744. /* width */ 2,
  1745. 60,
  1746. NULL,
  1747. 0,
  1748. 0,
  1749. NULL,
  1750. 0,
  1751. /* precache */ ""
  1752. },
  1753. /*QUAKED item_bandolier (.3 .3 1) (-16 -16 -16) (16 16 16)
  1754. */
  1755. {
  1756. "item_bandolier",
  1757. Pickup_Bandolier,
  1758. NULL,
  1759. NULL,
  1760. NULL,
  1761. "items/pkup.wav",
  1762. "models/items/band/tris.md2", EF_ROTATE,
  1763. NULL,
  1764. /* icon */ "p_bandolier",
  1765. /* pickup */ "Bandolier",
  1766. /* width */ 2,
  1767. 60,
  1768. NULL,
  1769. 0,
  1770. 0,
  1771. NULL,
  1772. 0,
  1773. /* precache */ ""
  1774. },
  1775. /*QUAKED item_pack (.3 .3 1) (-16 -16 -16) (16 16 16)
  1776. */
  1777. {
  1778. "item_pack",
  1779. Pickup_Pack,
  1780. NULL,
  1781. NULL,
  1782. NULL,
  1783. "items/pkup.wav",
  1784. "models/items/pack/tris.md2", EF_ROTATE,
  1785. NULL,
  1786. /* icon */ "i_pack",
  1787. /* pickup */ "Ammo Pack",
  1788. /* width */ 2,
  1789. 180,
  1790. NULL,
  1791. 0,
  1792. 0,
  1793. NULL,
  1794. 0,
  1795. /* precache */ ""
  1796. },
  1797. //
  1798. // KEYS
  1799. //
  1800. /*QUAKED key_data_cd (0 .5 .8) (-16 -16 -16) (16 16 16)
  1801. key for computer centers
  1802. */
  1803. {
  1804. "key_data_cd",
  1805. Pickup_Key,
  1806. NULL,
  1807. Drop_General,
  1808. NULL,
  1809. "items/pkup.wav",
  1810. "models/items/keys/data_cd/tris.md2", EF_ROTATE,
  1811. NULL,
  1812. "k_datacd",
  1813. "Data CD",
  1814. 2,
  1815. 0,
  1816. NULL,
  1817. IT_STAY_COOP|IT_KEY,
  1818. 0,
  1819. NULL,
  1820. 0,
  1821. /* precache */ ""
  1822. },
  1823. /*QUAKED key_power_cube (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN NO_TOUCH
  1824. warehouse circuits
  1825. */
  1826. {
  1827. "key_power_cube",
  1828. Pickup_Key,
  1829. NULL,
  1830. Drop_General,
  1831. NULL,
  1832. "items/pkup.wav",
  1833. "models/items/keys/power/tris.md2", EF_ROTATE,
  1834. NULL,
  1835. "k_powercube",
  1836. "Power Cube",
  1837. 2,
  1838. 0,
  1839. NULL,
  1840. IT_STAY_COOP|IT_KEY,
  1841. 0,
  1842. NULL,
  1843. 0,
  1844. /* precache */ ""
  1845. },
  1846. /*QUAKED key_pyramid (0 .5 .8) (-16 -16 -16) (16 16 16)
  1847. key for the entrance of jail3
  1848. */
  1849. {
  1850. "key_pyramid",
  1851. Pickup_Key,
  1852. NULL,
  1853. Drop_General,
  1854. NULL,
  1855. "items/pkup.wav",
  1856. "models/items/keys/pyramid/tris.md2", EF_ROTATE,
  1857. NULL,
  1858. "k_pyramid",
  1859. "Pyramid Key",
  1860. 2,
  1861. 0,
  1862. NULL,
  1863. IT_STAY_COOP|IT_KEY,
  1864. 0,
  1865. NULL,
  1866. 0,
  1867. /* precache */ ""
  1868. },
  1869. /*QUAKED key_data_spinner (0 .5 .8) (-16 -16 -16) (16 16 16)
  1870. key for the city computer
  1871. */
  1872. {
  1873. "key_data_spinner",
  1874. Pickup_Key,
  1875. NULL,
  1876. Drop_General,
  1877. NULL,
  1878. "items/pkup.wav",
  1879. "models/items/keys/spinner/tris.md2", EF_ROTATE,
  1880. NULL,
  1881. "k_dataspin",
  1882. "Data Spinner",
  1883. 2,
  1884. 0,
  1885. NULL,
  1886. IT_STAY_COOP|IT_KEY,
  1887. 0,
  1888. NULL,
  1889. 0,
  1890. /* precache */ ""
  1891. },
  1892. /*QUAKED key_pass (0 .5 .8) (-16 -16 -16) (16 16 16)
  1893. security pass for the security level
  1894. */
  1895. {
  1896. "key_pass",
  1897. Pickup_Key,
  1898. NULL,
  1899. Drop_General,
  1900. NULL,
  1901. "items/pkup.wav",
  1902. "models/items/keys/pass/tris.md2", EF_ROTATE,
  1903. NULL,
  1904. "k_security",
  1905. "Security Pass",
  1906. 2,
  1907. 0,
  1908. NULL,
  1909. IT_STAY_COOP|IT_KEY,
  1910. 0,
  1911. NULL,
  1912. 0,
  1913. /* precache */ ""
  1914. },
  1915. /*QUAKED key_blue_key (0 .5 .8) (-16 -16 -16) (16 16 16)
  1916. normal door key - blue
  1917. */
  1918. {
  1919. "key_blue_key",
  1920. Pickup_Key,
  1921. NULL,
  1922. Drop_General,
  1923. NULL,
  1924. "items/pkup.wav",
  1925. "models/items/keys/key/tris.md2", EF_ROTATE,
  1926. NULL,
  1927. "k_bluekey",
  1928. "Blue Key",
  1929. 2,
  1930. 0,
  1931. NULL,
  1932. IT_STAY_COOP|IT_KEY,
  1933. 0,
  1934. NULL,
  1935. 0,
  1936. /* precache */ ""
  1937. },
  1938. /*QUAKED key_red_key (0 .5 .8) (-16 -16 -16) (16 16 16)
  1939. normal door key - red
  1940. */
  1941. {
  1942. "key_red_key",
  1943. Pickup_Key,
  1944. NULL,
  1945. Drop_General,
  1946. NULL,
  1947. "items/pkup.wav",
  1948. "models/items/keys/red_key/tris.md2", EF_ROTATE,
  1949. NULL,
  1950. "k_redkey",
  1951. "Red Key",
  1952. 2,
  1953. 0,
  1954. NULL,
  1955. IT_STAY_COOP|IT_KEY,
  1956. 0,
  1957. NULL,
  1958. 0,
  1959. /* precache */ ""
  1960. },
  1961. // RAFAEL
  1962. /*QUAKED key_green_key (0 .5 .8) (-16 -16 -16) (16 16 16)
  1963. normal door key - blue
  1964. */
  1965. {
  1966. "key_green_key",
  1967. Pickup_Key,
  1968. NULL,
  1969. Drop_General,
  1970. NULL,
  1971. "items/pkup.wav",
  1972. "models/items/keys/green_key/tris.md2", EF_ROTATE,
  1973. NULL,
  1974. "k_green",
  1975. "Green Key",
  1976. 2,
  1977. 0,
  1978. NULL,
  1979. IT_STAY_COOP|IT_KEY,
  1980. 0,
  1981. NULL,
  1982. 0,
  1983. /* precache */ ""
  1984. },
  1985. /*QUAKED key_commander_head (0 .5 .8) (-16 -16 -16) (16 16 16)
  1986. tank commander's head
  1987. */
  1988. {
  1989. "key_commander_head",
  1990. Pickup_Key,
  1991. NULL,
  1992. Drop_General,
  1993. NULL,
  1994. "items/pkup.wav",
  1995. "models/monsters/commandr/head/tris.md2", EF_GIB,
  1996. NULL,
  1997. /* icon */ "k_comhead",
  1998. /* pickup */ "Commander's Head",
  1999. /* width */ 2,
  2000. 0,
  2001. NULL,
  2002. IT_STAY_COOP|IT_KEY,
  2003. 0,
  2004. NULL,
  2005. 0,
  2006. /* precache */ ""
  2007. },
  2008. /*QUAKED key_airstrike_target (0 .5 .8) (-16 -16 -16) (16 16 16)
  2009. tank commander's head
  2010. */
  2011. {
  2012. "key_airstrike_target",
  2013. Pickup_Key,
  2014. NULL,
  2015. Drop_General,
  2016. NULL,
  2017. "items/pkup.wav",
  2018. "models/items/keys/target/tris.md2", EF_ROTATE,
  2019. NULL,
  2020. /* icon */ "i_airstrike",
  2021. /* pickup */ "Airstrike Marker",
  2022. /* width */ 2,
  2023. 0,
  2024. NULL,
  2025. IT_STAY_COOP|IT_KEY,
  2026. 0,
  2027. NULL,
  2028. 0,
  2029. /* precache */ ""
  2030. },
  2031. {
  2032. NULL,
  2033. Pickup_Health,
  2034. NULL,
  2035. NULL,
  2036. NULL,
  2037. "items/pkup.wav",
  2038. NULL, 0,
  2039. NULL,
  2040. /* icon */ "i_health",
  2041. /* pickup */ "Health",
  2042. /* width */ 3,
  2043. 0,
  2044. NULL,
  2045. 0,
  2046. 0,
  2047. NULL,
  2048. 0,
  2049. /* precache */ "items/s_health.wav items/n_health.wav items/l_health.wav items/m_health.wav"
  2050. },
  2051. // end of list marker
  2052. {NULL}
  2053. };
  2054. /*QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16)
  2055. */
  2056. void SP_item_health (edict_t *self)
  2057. {
  2058. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2059. {
  2060. G_FreeEdict (self);
  2061. return;
  2062. }
  2063. self->model = "models/items/healing/medium/tris.md2";
  2064. self->count = 10;
  2065. SpawnItem (self, FindItem ("Health"));
  2066. gi.soundindex ("items/n_health.wav");
  2067. }
  2068. /*QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16)
  2069. */
  2070. void SP_item_health_small (edict_t *self)
  2071. {
  2072. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2073. {
  2074. G_FreeEdict (self);
  2075. return;
  2076. }
  2077. self->model = "models/items/healing/stimpack/tris.md2";
  2078. self->count = 2;
  2079. SpawnItem (self, FindItem ("Health"));
  2080. self->style = HEALTH_IGNORE_MAX;
  2081. gi.soundindex ("items/s_health.wav");
  2082. }
  2083. /*QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16)
  2084. */
  2085. void SP_item_health_large (edict_t *self)
  2086. {
  2087. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2088. {
  2089. G_FreeEdict (self);
  2090. return;
  2091. }
  2092. self->model = "models/items/healing/large/tris.md2";
  2093. self->count = 25;
  2094. SpawnItem (self, FindItem ("Health"));
  2095. gi.soundindex ("items/l_health.wav");
  2096. }
  2097. /*QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16)
  2098. */
  2099. void SP_item_health_mega (edict_t *self)
  2100. {
  2101. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2102. {
  2103. G_FreeEdict (self);
  2104. return;
  2105. }
  2106. self->model = "models/items/mega_h/tris.md2";
  2107. self->count = 100;
  2108. SpawnItem (self, FindItem ("Health"));
  2109. gi.soundindex ("items/m_health.wav");
  2110. self->style = HEALTH_IGNORE_MAX|HEALTH_TIMED;
  2111. }
  2112. // RAFAEL
  2113. void SP_item_foodcube (edict_t *self)
  2114. {
  2115. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2116. {
  2117. G_FreeEdict (self);
  2118. return;
  2119. }
  2120. self->model = "models/objects/trapfx/tris.md2";
  2121. SpawnItem (self, FindItem ("Health"));
  2122. self->spawnflags |= DROPPED_ITEM;
  2123. self->style = HEALTH_IGNORE_MAX;
  2124. gi.soundindex ("items/s_health.wav");
  2125. self->classname = "foodcube";
  2126. }
  2127. void InitItems (void)
  2128. {
  2129. game.num_items = sizeof(itemlist)/sizeof(itemlist[0]) - 1;
  2130. }
  2131. /*
  2132. ===============
  2133. SetItemNames
  2134. Called by worldspawn
  2135. ===============
  2136. */
  2137. void SetItemNames (void)
  2138. {
  2139. int i;
  2140. gitem_t *it;
  2141. for (i=0 ; i<game.num_items ; i++)
  2142. {
  2143. it = &itemlist[i];
  2144. gi.configstring (CS_ITEMS+i, it->pickup_name);
  2145. }
  2146. jacket_armor_index = ITEM_INDEX(FindItem("Jacket Armor"));
  2147. combat_armor_index = ITEM_INDEX(FindItem("Combat Armor"));
  2148. body_armor_index = ITEM_INDEX(FindItem("Body Armor"));
  2149. power_screen_index = ITEM_INDEX(FindItem("Power Screen"));
  2150. power_shield_index = ITEM_INDEX(FindItem("Power Shield"));
  2151. }