g_items.c 45 KB

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