g_items.c 49 KB

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