g_items.c 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. #include "g_local.h"
  4. qboolean Pickup_Weapon (edict_t *ent, edict_t *other);
  5. void Use_Weapon (edict_t *ent, gitem_t *inv);
  6. void Drop_Weapon (edict_t *ent, gitem_t *inv);
  7. void Weapon_Blaster (edict_t *ent);
  8. void Weapon_Shotgun (edict_t *ent);
  9. void Weapon_SuperShotgun (edict_t *ent);
  10. void Weapon_Machinegun (edict_t *ent);
  11. void Weapon_Chaingun (edict_t *ent);
  12. void Weapon_HyperBlaster (edict_t *ent);
  13. void Weapon_RocketLauncher (edict_t *ent);
  14. void Weapon_Grenade (edict_t *ent);
  15. void Weapon_GrenadeLauncher (edict_t *ent);
  16. void Weapon_Railgun (edict_t *ent);
  17. void Weapon_BFG (edict_t *ent);
  18. //=========
  19. //Rogue Weapons
  20. void Weapon_ChainFist (edict_t *ent);
  21. void Weapon_Disintegrator (edict_t *ent);
  22. void Weapon_ETF_Rifle (edict_t *ent);
  23. void Weapon_Heatbeam (edict_t *ent);
  24. void Weapon_Prox (edict_t *ent);
  25. void Weapon_Tesla (edict_t *ent);
  26. void Weapon_ProxLauncher (edict_t *ent);
  27. //void Weapon_Nuke (edict_t *ent);
  28. //Rogue Weapons
  29. //=========
  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. //=====
  108. //ROGUE
  109. if(randomrespawn && randomrespawn->value)
  110. {
  111. edict_t *newEnt;
  112. newEnt = DoRandomRespawn (ent);
  113. // if we've changed entities, then do some sleight of hand.
  114. // otherwise, the old entity will respawn
  115. if(newEnt)
  116. {
  117. G_FreeEdict (ent);
  118. ent = newEnt;
  119. }
  120. }
  121. //ROGUE
  122. //=====
  123. ent->svflags &= ~SVF_NOCLIENT;
  124. ent->solid = SOLID_TRIGGER;
  125. gi.linkentity (ent);
  126. // send an effect
  127. ent->s.event = EV_ITEM_RESPAWN;
  128. }
  129. void SetRespawn (edict_t *ent, float delay)
  130. {
  131. ent->flags |= FL_RESPAWN;
  132. ent->svflags |= SVF_NOCLIENT;
  133. ent->solid = SOLID_NOT;
  134. ent->nextthink = level.time + delay;
  135. ent->think = DoRespawn;
  136. gi.linkentity (ent);
  137. }
  138. //======================================================================
  139. qboolean Pickup_Powerup (edict_t *ent, edict_t *other)
  140. {
  141. int quantity;
  142. quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  143. if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
  144. return false;
  145. if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
  146. return false;
  147. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  148. if (deathmatch->value)
  149. {
  150. if (!(ent->spawnflags & DROPPED_ITEM) )
  151. SetRespawn (ent, ent->item->quantity);
  152. if (((int)dmflags->value & DF_INSTANT_ITEMS) || ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM)))
  153. {
  154. if ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM))
  155. quad_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME;
  156. //PGM
  157. if(ent->item->use)
  158. ent->item->use (other, ent->item);
  159. else
  160. gi.dprintf("Powerup has no use function!\n");
  161. //PGM
  162. }
  163. }
  164. return true;
  165. }
  166. void Drop_General (edict_t *ent, gitem_t *item)
  167. {
  168. Drop_Item (ent, item);
  169. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  170. ValidateSelectedItem (ent);
  171. }
  172. //======================================================================
  173. qboolean Pickup_Adrenaline (edict_t *ent, edict_t *other)
  174. {
  175. if (!deathmatch->value)
  176. other->max_health += 1;
  177. if (other->health < other->max_health)
  178. other->health = other->max_health;
  179. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  180. SetRespawn (ent, ent->item->quantity);
  181. return true;
  182. }
  183. qboolean Pickup_AncientHead (edict_t *ent, edict_t *other)
  184. {
  185. other->max_health += 2;
  186. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  187. SetRespawn (ent, ent->item->quantity);
  188. return true;
  189. }
  190. qboolean Pickup_Bandolier (edict_t *ent, edict_t *other)
  191. {
  192. gitem_t *item;
  193. int index;
  194. if (other->client->pers.max_bullets < 250)
  195. other->client->pers.max_bullets = 250;
  196. if (other->client->pers.max_shells < 150)
  197. other->client->pers.max_shells = 150;
  198. if (other->client->pers.max_cells < 250)
  199. other->client->pers.max_cells = 250;
  200. if (other->client->pers.max_slugs < 75)
  201. other->client->pers.max_slugs = 75;
  202. //PMM
  203. if (other->client->pers.max_flechettes < 250)
  204. other->client->pers.max_flechettes = 250;
  205. #ifndef KILL_DISRUPTOR
  206. if (other->client->pers.max_rounds < 150)
  207. other->client->pers.max_rounds = 150;
  208. #endif
  209. //pmm
  210. item = FindItem("Bullets");
  211. if (item)
  212. {
  213. index = ITEM_INDEX(item);
  214. other->client->pers.inventory[index] += item->quantity;
  215. if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
  216. other->client->pers.inventory[index] = other->client->pers.max_bullets;
  217. }
  218. item = FindItem("Shells");
  219. if (item)
  220. {
  221. index = ITEM_INDEX(item);
  222. other->client->pers.inventory[index] += item->quantity;
  223. if (other->client->pers.inventory[index] > other->client->pers.max_shells)
  224. other->client->pers.inventory[index] = other->client->pers.max_shells;
  225. }
  226. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  227. SetRespawn (ent, ent->item->quantity);
  228. return true;
  229. }
  230. qboolean Pickup_Pack (edict_t *ent, edict_t *other)
  231. {
  232. gitem_t *item;
  233. int index;
  234. if (other->client->pers.max_bullets < 300)
  235. other->client->pers.max_bullets = 300;
  236. if (other->client->pers.max_shells < 200)
  237. other->client->pers.max_shells = 200;
  238. if (other->client->pers.max_rockets < 100)
  239. other->client->pers.max_rockets = 100;
  240. if (other->client->pers.max_grenades < 100)
  241. other->client->pers.max_grenades = 100;
  242. if (other->client->pers.max_cells < 300)
  243. other->client->pers.max_cells = 300;
  244. if (other->client->pers.max_slugs < 100)
  245. other->client->pers.max_slugs = 100;
  246. //PMM
  247. if (other->client->pers.max_flechettes < 200)
  248. other->client->pers.max_flechettes = 200;
  249. #ifndef KILL_DISRUPTOR
  250. if (other->client->pers.max_rounds < 200)
  251. other->client->pers.max_rounds = 200;
  252. #endif
  253. //pmm
  254. item = FindItem("Bullets");
  255. if (item)
  256. {
  257. index = ITEM_INDEX(item);
  258. other->client->pers.inventory[index] += item->quantity;
  259. if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
  260. other->client->pers.inventory[index] = other->client->pers.max_bullets;
  261. }
  262. item = FindItem("Shells");
  263. if (item)
  264. {
  265. index = ITEM_INDEX(item);
  266. other->client->pers.inventory[index] += item->quantity;
  267. if (other->client->pers.inventory[index] > other->client->pers.max_shells)
  268. other->client->pers.inventory[index] = other->client->pers.max_shells;
  269. }
  270. item = FindItem("Cells");
  271. if (item)
  272. {
  273. index = ITEM_INDEX(item);
  274. other->client->pers.inventory[index] += item->quantity;
  275. if (other->client->pers.inventory[index] > other->client->pers.max_cells)
  276. other->client->pers.inventory[index] = other->client->pers.max_cells;
  277. }
  278. item = FindItem("Grenades");
  279. if (item)
  280. {
  281. index = ITEM_INDEX(item);
  282. other->client->pers.inventory[index] += item->quantity;
  283. if (other->client->pers.inventory[index] > other->client->pers.max_grenades)
  284. other->client->pers.inventory[index] = other->client->pers.max_grenades;
  285. }
  286. item = FindItem("Rockets");
  287. if (item)
  288. {
  289. index = ITEM_INDEX(item);
  290. other->client->pers.inventory[index] += item->quantity;
  291. if (other->client->pers.inventory[index] > other->client->pers.max_rockets)
  292. other->client->pers.inventory[index] = other->client->pers.max_rockets;
  293. }
  294. item = FindItem("Slugs");
  295. if (item)
  296. {
  297. index = ITEM_INDEX(item);
  298. other->client->pers.inventory[index] += item->quantity;
  299. if (other->client->pers.inventory[index] > other->client->pers.max_slugs)
  300. other->client->pers.inventory[index] = other->client->pers.max_slugs;
  301. }
  302. //PMM
  303. item = FindItem("Flechettes");
  304. if (item)
  305. {
  306. index = ITEM_INDEX(item);
  307. other->client->pers.inventory[index] += item->quantity;
  308. if (other->client->pers.inventory[index] > other->client->pers.max_flechettes)
  309. other->client->pers.inventory[index] = other->client->pers.max_flechettes;
  310. }
  311. #ifndef KILL_DISRUPTOR
  312. item = FindItem("Rounds");
  313. if (item)
  314. {
  315. index = ITEM_INDEX(item);
  316. other->client->pers.inventory[index] += item->quantity;
  317. if (other->client->pers.inventory[index] > other->client->pers.max_rounds)
  318. other->client->pers.inventory[index] = other->client->pers.max_rounds;
  319. }
  320. #endif
  321. //pmm
  322. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  323. SetRespawn (ent, ent->item->quantity);
  324. return true;
  325. }
  326. // ================
  327. // PMM
  328. qboolean Pickup_Nuke (edict_t *ent, edict_t *other)
  329. {
  330. int quantity;
  331. // if (!deathmatch->value)
  332. // return;
  333. quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  334. // if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
  335. // return false;
  336. if (quantity >= 1)
  337. return false;
  338. if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
  339. return false;
  340. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  341. if (deathmatch->value)
  342. {
  343. if (!(ent->spawnflags & DROPPED_ITEM) )
  344. SetRespawn (ent, ent->item->quantity);
  345. }
  346. return true;
  347. }
  348. // ================
  349. // PGM
  350. void Use_IR (edict_t *ent, gitem_t *item)
  351. {
  352. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  353. ValidateSelectedItem (ent);
  354. if (ent->client->ir_framenum > level.framenum)
  355. ent->client->ir_framenum += 600;
  356. else
  357. ent->client->ir_framenum = level.framenum + 600;
  358. gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/ir_start.wav"), 1, ATTN_NORM, 0);
  359. }
  360. void Use_Double (edict_t *ent, gitem_t *item)
  361. {
  362. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  363. ValidateSelectedItem (ent);
  364. if (ent->client->double_framenum > level.framenum)
  365. ent->client->double_framenum += 300;
  366. else
  367. ent->client->double_framenum = level.framenum + 300;
  368. gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/ddamage1.wav"), 1, ATTN_NORM, 0);
  369. }
  370. /*
  371. void Use_Torch (edict_t *ent, gitem_t *item)
  372. {
  373. ent->client->torch_framenum = level.framenum + 600;
  374. }
  375. */
  376. void Use_Compass (edict_t *ent, gitem_t *item)
  377. {
  378. int ang;
  379. ang = (int)(ent->client->v_angle[1]);
  380. if(ang<0)
  381. ang += 360;
  382. gi.cprintf(ent, PRINT_HIGH, "Origin: %0.0f,%0.0f,%0.0f Dir: %d\n", ent->s.origin[0], ent->s.origin[1],
  383. ent->s.origin[2], ang);
  384. }
  385. void Use_Nuke (edict_t *ent, gitem_t *item)
  386. {
  387. vec3_t forward, right, start;
  388. float speed;
  389. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  390. ValidateSelectedItem (ent);
  391. AngleVectors (ent->client->v_angle, forward, right, NULL);
  392. VectorCopy (ent->s.origin, start);
  393. speed = 100;
  394. fire_nuke (ent, start, forward, speed);
  395. }
  396. void Use_Doppleganger (edict_t *ent, gitem_t *item)
  397. {
  398. vec3_t forward, right;
  399. vec3_t createPt, spawnPt;
  400. vec3_t ang;
  401. VectorClear(ang);
  402. ang[YAW] = ent->client->v_angle[YAW];
  403. AngleVectors (ang, forward, right, NULL);
  404. VectorMA(ent->s.origin, 48, forward, createPt);
  405. if(!FindSpawnPoint(createPt, ent->mins, ent->maxs, spawnPt, 32))
  406. return;
  407. if(!CheckGroundSpawnPoint(spawnPt, ent->mins, ent->maxs, 64, -1))
  408. return;
  409. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  410. ValidateSelectedItem (ent);
  411. SpawnGrow_Spawn (spawnPt, 0);
  412. fire_doppleganger (ent, spawnPt, forward);
  413. }
  414. qboolean Pickup_Doppleganger (edict_t *ent, edict_t *other)
  415. {
  416. int quantity;
  417. if(!(deathmatch->value)) // item is DM only
  418. return false;
  419. quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  420. if (quantity >= 1) // FIXME - apply max to dopplegangers
  421. return false;
  422. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  423. if (!(ent->spawnflags & DROPPED_ITEM) )
  424. SetRespawn (ent, ent->item->quantity);
  425. return true;
  426. }
  427. qboolean Pickup_Sphere (edict_t *ent, edict_t *other)
  428. {
  429. int quantity;
  430. if(other->client && other->client->owned_sphere)
  431. {
  432. // gi.cprintf(other, PRINT_HIGH, "Only one sphere to a customer!\n");
  433. return false;
  434. }
  435. quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  436. if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
  437. return false;
  438. if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
  439. return false;
  440. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  441. if (deathmatch->value)
  442. {
  443. if (!(ent->spawnflags & DROPPED_ITEM) )
  444. SetRespawn (ent, ent->item->quantity);
  445. if (((int)dmflags->value & DF_INSTANT_ITEMS))
  446. {
  447. //PGM
  448. if(ent->item->use)
  449. ent->item->use (other, ent->item);
  450. else
  451. gi.dprintf("Powerup has no use function!\n");
  452. //PGM
  453. }
  454. }
  455. return true;
  456. }
  457. void Use_Defender (edict_t *ent, gitem_t *item)
  458. {
  459. if(ent->client && ent->client->owned_sphere)
  460. {
  461. gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n");
  462. return;
  463. }
  464. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  465. ValidateSelectedItem (ent);
  466. Defender_Launch (ent);
  467. }
  468. void Use_Hunter (edict_t *ent, gitem_t *item)
  469. {
  470. if(ent->client && ent->client->owned_sphere)
  471. {
  472. gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n");
  473. return;
  474. }
  475. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  476. ValidateSelectedItem (ent);
  477. Hunter_Launch (ent);
  478. }
  479. void Use_Vengeance (edict_t *ent, gitem_t *item)
  480. {
  481. if(ent->client && ent->client->owned_sphere)
  482. {
  483. gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n");
  484. return;
  485. }
  486. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  487. ValidateSelectedItem (ent);
  488. Vengeance_Launch (ent);
  489. }
  490. // PGM
  491. // ================
  492. //======================================================================
  493. void Use_Quad (edict_t *ent, gitem_t *item)
  494. {
  495. int timeout;
  496. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  497. ValidateSelectedItem (ent);
  498. if (quad_drop_timeout_hack)
  499. {
  500. timeout = quad_drop_timeout_hack;
  501. quad_drop_timeout_hack = 0;
  502. }
  503. else
  504. {
  505. timeout = 300;
  506. }
  507. if (ent->client->quad_framenum > level.framenum)
  508. ent->client->quad_framenum += timeout;
  509. else
  510. ent->client->quad_framenum = level.framenum + timeout;
  511. gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
  512. }
  513. //======================================================================
  514. void Use_Breather (edict_t *ent, gitem_t *item)
  515. {
  516. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  517. ValidateSelectedItem (ent);
  518. if (ent->client->breather_framenum > level.framenum)
  519. ent->client->breather_framenum += 300;
  520. else
  521. ent->client->breather_framenum = level.framenum + 300;
  522. // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
  523. }
  524. //======================================================================
  525. void Use_Envirosuit (edict_t *ent, gitem_t *item)
  526. {
  527. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  528. ValidateSelectedItem (ent);
  529. if (ent->client->enviro_framenum > level.framenum)
  530. ent->client->enviro_framenum += 300;
  531. else
  532. ent->client->enviro_framenum = level.framenum + 300;
  533. // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
  534. }
  535. //======================================================================
  536. void Use_Invulnerability (edict_t *ent, gitem_t *item)
  537. {
  538. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  539. ValidateSelectedItem (ent);
  540. if (ent->client->invincible_framenum > level.framenum)
  541. ent->client->invincible_framenum += 300;
  542. else
  543. ent->client->invincible_framenum = level.framenum + 300;
  544. gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0);
  545. }
  546. //======================================================================
  547. void Use_Silencer (edict_t *ent, gitem_t *item)
  548. {
  549. ent->client->pers.inventory[ITEM_INDEX(item)]--;
  550. ValidateSelectedItem (ent);
  551. ent->client->silencer_shots += 30;
  552. // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
  553. }
  554. //======================================================================
  555. qboolean Pickup_Key (edict_t *ent, edict_t *other)
  556. {
  557. if (coop->value)
  558. {
  559. if (strcmp(ent->classname, "key_power_cube") == 0)
  560. {
  561. if (other->client->pers.power_cubes & ((ent->spawnflags & 0x0000ff00)>> 8))
  562. return false;
  563. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  564. other->client->pers.power_cubes |= ((ent->spawnflags & 0x0000ff00) >> 8);
  565. }
  566. else
  567. {
  568. if (other->client->pers.inventory[ITEM_INDEX(ent->item)])
  569. return false;
  570. other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1;
  571. }
  572. return true;
  573. }
  574. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  575. return true;
  576. }
  577. //======================================================================
  578. qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count)
  579. {
  580. int index;
  581. int max;
  582. if (!ent->client)
  583. return false;
  584. if (item->tag == AMMO_BULLETS)
  585. max = ent->client->pers.max_bullets;
  586. else if (item->tag == AMMO_SHELLS)
  587. max = ent->client->pers.max_shells;
  588. else if (item->tag == AMMO_ROCKETS)
  589. max = ent->client->pers.max_rockets;
  590. else if (item->tag == AMMO_GRENADES)
  591. max = ent->client->pers.max_grenades;
  592. else if (item->tag == AMMO_CELLS)
  593. max = ent->client->pers.max_cells;
  594. else if (item->tag == AMMO_SLUGS)
  595. max = ent->client->pers.max_slugs;
  596. // ROGUE
  597. // else if (item->tag == AMMO_MINES)
  598. // max = ent->client->pers.max_mines;
  599. else if (item->tag == AMMO_FLECHETTES)
  600. max = ent->client->pers.max_flechettes;
  601. else if (item->tag == AMMO_PROX)
  602. max = ent->client->pers.max_prox;
  603. else if (item->tag == AMMO_TESLA)
  604. max = ent->client->pers.max_tesla;
  605. #ifndef KILL_DISRUPTOR
  606. else if (item->tag == AMMO_DISRUPTOR)
  607. max = ent->client->pers.max_rounds;
  608. #endif
  609. // ROGUE
  610. else
  611. {
  612. gi.dprintf("undefined ammo type\n");
  613. return false;
  614. }
  615. index = ITEM_INDEX(item);
  616. if (ent->client->pers.inventory[index] == max)
  617. return false;
  618. ent->client->pers.inventory[index] += count;
  619. if (ent->client->pers.inventory[index] > max)
  620. ent->client->pers.inventory[index] = max;
  621. return true;
  622. }
  623. qboolean Pickup_Ammo (edict_t *ent, edict_t *other)
  624. {
  625. int oldcount;
  626. int count;
  627. qboolean weapon;
  628. weapon = (ent->item->flags & IT_WEAPON);
  629. if ( (weapon) && ( (int)dmflags->value & DF_INFINITE_AMMO ) )
  630. count = 1000;
  631. else if (ent->count)
  632. count = ent->count;
  633. else
  634. count = ent->item->quantity;
  635. oldcount = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  636. if (!Add_Ammo (other, ent->item, count))
  637. return false;
  638. if (weapon && !oldcount)
  639. {
  640. // don't switch to tesla
  641. if (other->client->pers.weapon != ent->item
  642. && ( !deathmatch->value || other->client->pers.weapon == FindItem("blaster"))
  643. && (strcmp(ent->classname, "ammo_tesla")) )
  644. other->client->newweapon = ent->item;
  645. }
  646. if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (deathmatch->value))
  647. SetRespawn (ent, 30);
  648. return true;
  649. }
  650. void Drop_Ammo (edict_t *ent, gitem_t *item)
  651. {
  652. edict_t *dropped;
  653. int index;
  654. index = ITEM_INDEX(item);
  655. dropped = Drop_Item (ent, item);
  656. if (ent->client->pers.inventory[index] >= item->quantity)
  657. dropped->count = item->quantity;
  658. else
  659. dropped->count = ent->client->pers.inventory[index];
  660. if (ent->client->pers.weapon &&
  661. ent->client->pers.weapon->tag == AMMO_GRENADES &&
  662. item->tag == AMMO_GRENADES &&
  663. ent->client->pers.inventory[index] - dropped->count <= 0) {
  664. gi.cprintf (ent, PRINT_HIGH, "Can't drop current weapon\n");
  665. G_FreeEdict(dropped);
  666. return;
  667. }
  668. ent->client->pers.inventory[index] -= dropped->count;
  669. ValidateSelectedItem (ent);
  670. }
  671. //======================================================================
  672. void MegaHealth_think (edict_t *self)
  673. {
  674. if (self->owner->health > self->owner->max_health)
  675. {
  676. self->nextthink = level.time + 1;
  677. self->owner->health -= 1;
  678. return;
  679. }
  680. if (!(self->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  681. SetRespawn (self, 20);
  682. else
  683. G_FreeEdict (self);
  684. }
  685. qboolean Pickup_Health (edict_t *ent, edict_t *other)
  686. {
  687. if (!(ent->style & HEALTH_IGNORE_MAX))
  688. if (other->health >= other->max_health)
  689. return false;
  690. other->health += ent->count;
  691. // PMM - health sound fix
  692. /*
  693. if (ent->count == 2)
  694. ent->item->pickup_sound = "items/s_health.wav";
  695. else if (ent->count == 10)
  696. ent->item->pickup_sound = "items/n_health.wav";
  697. else if (ent->count == 25)
  698. ent->item->pickup_sound = "items/l_health.wav";
  699. else // (ent->count == 100)
  700. ent->item->pickup_sound = "items/m_health.wav";
  701. */
  702. if (!(ent->style & HEALTH_IGNORE_MAX))
  703. {
  704. if (other->health > other->max_health)
  705. other->health = other->max_health;
  706. }
  707. if (ent->style & HEALTH_TIMED)
  708. {
  709. ent->think = MegaHealth_think;
  710. ent->nextthink = level.time + 5;
  711. ent->owner = other;
  712. ent->flags |= FL_RESPAWN;
  713. ent->svflags |= SVF_NOCLIENT;
  714. ent->solid = SOLID_NOT;
  715. }
  716. else
  717. {
  718. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  719. SetRespawn (ent, 30);
  720. }
  721. return true;
  722. }
  723. //======================================================================
  724. int ArmorIndex (edict_t *ent)
  725. {
  726. if (!ent->client)
  727. return 0;
  728. if (ent->client->pers.inventory[jacket_armor_index] > 0)
  729. return jacket_armor_index;
  730. if (ent->client->pers.inventory[combat_armor_index] > 0)
  731. return combat_armor_index;
  732. if (ent->client->pers.inventory[body_armor_index] > 0)
  733. return body_armor_index;
  734. return 0;
  735. }
  736. qboolean Pickup_Armor (edict_t *ent, edict_t *other)
  737. {
  738. int old_armor_index;
  739. gitem_armor_t *oldinfo;
  740. gitem_armor_t *newinfo;
  741. int newcount;
  742. float salvage;
  743. int salvagecount;
  744. // get info on new armor
  745. newinfo = (gitem_armor_t *)ent->item->info;
  746. old_armor_index = ArmorIndex (other);
  747. // handle armor shards specially
  748. if (ent->item->tag == ARMOR_SHARD)
  749. {
  750. if (!old_armor_index)
  751. other->client->pers.inventory[jacket_armor_index] = 2;
  752. else
  753. other->client->pers.inventory[old_armor_index] += 2;
  754. }
  755. // if player has no armor, just use it
  756. else if (!old_armor_index)
  757. {
  758. other->client->pers.inventory[ITEM_INDEX(ent->item)] = newinfo->base_count;
  759. }
  760. // use the better armor
  761. else
  762. {
  763. // get info on old armor
  764. if (old_armor_index == jacket_armor_index)
  765. oldinfo = &jacketarmor_info;
  766. else if (old_armor_index == combat_armor_index)
  767. oldinfo = &combatarmor_info;
  768. else // (old_armor_index == body_armor_index)
  769. oldinfo = &bodyarmor_info;
  770. if (newinfo->normal_protection > oldinfo->normal_protection)
  771. {
  772. // calc new armor values
  773. salvage = oldinfo->normal_protection / newinfo->normal_protection;
  774. salvagecount = salvage * other->client->pers.inventory[old_armor_index];
  775. newcount = newinfo->base_count + salvagecount;
  776. if (newcount > newinfo->max_count)
  777. newcount = newinfo->max_count;
  778. // zero count of old armor so it goes away
  779. other->client->pers.inventory[old_armor_index] = 0;
  780. // change armor to new item with computed value
  781. other->client->pers.inventory[ITEM_INDEX(ent->item)] = newcount;
  782. }
  783. else
  784. {
  785. // calc new armor values
  786. salvage = newinfo->normal_protection / oldinfo->normal_protection;
  787. salvagecount = salvage * newinfo->base_count;
  788. newcount = other->client->pers.inventory[old_armor_index] + salvagecount;
  789. if (newcount > oldinfo->max_count)
  790. newcount = oldinfo->max_count;
  791. // if we're already maxed out then we don't need the new armor
  792. if (other->client->pers.inventory[old_armor_index] >= newcount)
  793. return false;
  794. // update current armor value
  795. other->client->pers.inventory[old_armor_index] = newcount;
  796. }
  797. }
  798. if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
  799. SetRespawn (ent, 20);
  800. return true;
  801. }
  802. //======================================================================
  803. int PowerArmorType (edict_t *ent)
  804. {
  805. if (!ent->client)
  806. return POWER_ARMOR_NONE;
  807. if (!(ent->flags & FL_POWER_ARMOR))
  808. return POWER_ARMOR_NONE;
  809. if (ent->client->pers.inventory[power_shield_index] > 0)
  810. return POWER_ARMOR_SHIELD;
  811. if (ent->client->pers.inventory[power_screen_index] > 0)
  812. return POWER_ARMOR_SCREEN;
  813. return POWER_ARMOR_NONE;
  814. }
  815. void Use_PowerArmor (edict_t *ent, gitem_t *item)
  816. {
  817. int index;
  818. if (ent->flags & FL_POWER_ARMOR)
  819. {
  820. ent->flags &= ~FL_POWER_ARMOR;
  821. gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
  822. }
  823. else
  824. {
  825. index = ITEM_INDEX(FindItem("cells"));
  826. if (!ent->client->pers.inventory[index])
  827. {
  828. gi.cprintf (ent, PRINT_HIGH, "No cells for power armor.\n");
  829. return;
  830. }
  831. ent->flags |= FL_POWER_ARMOR;
  832. gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power1.wav"), 1, ATTN_NORM, 0);
  833. }
  834. }
  835. qboolean Pickup_PowerArmor (edict_t *ent, edict_t *other)
  836. {
  837. int quantity;
  838. quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
  839. other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
  840. if (deathmatch->value)
  841. {
  842. if (!(ent->spawnflags & DROPPED_ITEM) )
  843. SetRespawn (ent, ent->item->quantity);
  844. // auto-use for DM only if we didn't already have one
  845. if (!quantity)
  846. ent->item->use (other, ent->item);
  847. }
  848. return true;
  849. }
  850. void Drop_PowerArmor (edict_t *ent, gitem_t *item)
  851. {
  852. if ((ent->flags & FL_POWER_ARMOR) && (ent->client->pers.inventory[ITEM_INDEX(item)] == 1))
  853. Use_PowerArmor (ent, item);
  854. Drop_General (ent, item);
  855. }
  856. //======================================================================
  857. /*
  858. ===============
  859. Touch_Item
  860. ===============
  861. */
  862. void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
  863. {
  864. qboolean taken;
  865. if (!other->client)
  866. return;
  867. if (other->health < 1)
  868. return; // dead people can't pickup
  869. if (!ent->item->pickup)
  870. return; // not a grabbable item?
  871. taken = ent->item->pickup(ent, other);
  872. if (taken)
  873. {
  874. // flash the screen
  875. other->client->bonus_alpha = 0.25;
  876. // show icon and name on status bar
  877. other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
  878. other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
  879. other->client->pickup_msg_time = level.time + 3.0;
  880. // change selected item
  881. if (ent->item->use)
  882. other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX(ent->item);
  883. // PMM - health sound fix
  884. if (ent->item->pickup == Pickup_Health)
  885. {
  886. if (ent->count == 2)
  887. gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
  888. else if (ent->count == 10)
  889. gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
  890. else if (ent->count == 25)
  891. gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
  892. else // (ent->count == 100)
  893. gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
  894. }
  895. else if (ent->item->pickup_sound) // PGM - paranoia
  896. {
  897. //
  898. gi.sound(other, CHAN_ITEM, gi.soundindex(ent->item->pickup_sound), 1, ATTN_NORM, 0);
  899. }
  900. }
  901. if (!(ent->spawnflags & ITEM_TARGETS_USED))
  902. {
  903. G_UseTargets (ent, other);
  904. ent->spawnflags |= ITEM_TARGETS_USED;
  905. }
  906. if (!taken)
  907. return;
  908. if (!((coop->value) && (ent->item->flags & IT_STAY_COOP)) || (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)))
  909. {
  910. if (ent->flags & FL_RESPAWN)
  911. ent->flags &= ~FL_RESPAWN;
  912. else
  913. G_FreeEdict (ent);
  914. }
  915. }
  916. //======================================================================
  917. static void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
  918. {
  919. if (other == ent->owner)
  920. return;
  921. Touch_Item (ent, other, plane, surf);
  922. }
  923. static void drop_make_touchable (edict_t *ent)
  924. {
  925. ent->touch = Touch_Item;
  926. if (deathmatch->value)
  927. {
  928. ent->nextthink = level.time + 29;
  929. ent->think = G_FreeEdict;
  930. }
  931. }
  932. edict_t *Drop_Item (edict_t *ent, gitem_t *item)
  933. {
  934. edict_t *dropped;
  935. vec3_t forward, right;
  936. vec3_t offset;
  937. dropped = G_Spawn();
  938. dropped->classname = item->classname;
  939. dropped->item = item;
  940. dropped->spawnflags = DROPPED_ITEM;
  941. dropped->s.effects = item->world_model_flags;
  942. dropped->s.renderfx = RF_GLOW | RF_IR_VISIBLE; // PGM
  943. VectorSet (dropped->mins, -15, -15, -15);
  944. VectorSet (dropped->maxs, 15, 15, 15);
  945. gi.setmodel (dropped, dropped->item->world_model);
  946. dropped->solid = SOLID_TRIGGER;
  947. dropped->movetype = MOVETYPE_TOSS;
  948. dropped->touch = drop_temp_touch;
  949. dropped->owner = ent;
  950. if (ent->client)
  951. {
  952. trace_t trace;
  953. AngleVectors (ent->client->v_angle, forward, right, NULL);
  954. VectorSet(offset, 24, 0, -16);
  955. G_ProjectSource (ent->s.origin, offset, forward, right, dropped->s.origin);
  956. trace = gi.trace (ent->s.origin, dropped->mins, dropped->maxs,
  957. dropped->s.origin, ent, CONTENTS_SOLID);
  958. VectorCopy (trace.endpos, dropped->s.origin);
  959. }
  960. else
  961. {
  962. AngleVectors (ent->s.angles, forward, right, NULL);
  963. VectorCopy (ent->s.origin, dropped->s.origin);
  964. }
  965. VectorScale (forward, 100, dropped->velocity);
  966. dropped->velocity[2] = 300;
  967. dropped->think = drop_make_touchable;
  968. dropped->nextthink = level.time + 1;
  969. gi.linkentity (dropped);
  970. return dropped;
  971. }
  972. void Use_Item (edict_t *ent, edict_t *other, edict_t *activator)
  973. {
  974. ent->svflags &= ~SVF_NOCLIENT;
  975. ent->use = NULL;
  976. if (ent->spawnflags & ITEM_NO_TOUCH)
  977. {
  978. ent->solid = SOLID_BBOX;
  979. ent->touch = NULL;
  980. }
  981. else
  982. {
  983. ent->solid = SOLID_TRIGGER;
  984. ent->touch = Touch_Item;
  985. }
  986. gi.linkentity (ent);
  987. }
  988. //======================================================================
  989. /*
  990. ================
  991. droptofloor
  992. ================
  993. */
  994. void droptofloor (edict_t *ent)
  995. {
  996. trace_t tr;
  997. vec3_t dest;
  998. float *v;
  999. v = tv(-15,-15,-15);
  1000. VectorCopy (v, ent->mins);
  1001. v = tv(15,15,15);
  1002. VectorCopy (v, ent->maxs);
  1003. if (ent->model)
  1004. gi.setmodel (ent, ent->model);
  1005. else if (ent->item->world_model) // PGM we shouldn't need this check, but paranoia...
  1006. gi.setmodel (ent, ent->item->world_model);
  1007. ent->solid = SOLID_TRIGGER;
  1008. ent->movetype = MOVETYPE_TOSS;
  1009. ent->touch = Touch_Item;
  1010. v = tv(0,0,-128);
  1011. VectorAdd (ent->s.origin, v, dest);
  1012. tr = gi.trace (ent->s.origin, ent->mins, ent->maxs, dest, ent, MASK_SOLID);
  1013. if (tr.startsolid)
  1014. {
  1015. gi.dprintf ("droptofloor: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin));
  1016. G_FreeEdict (ent);
  1017. return;
  1018. }
  1019. VectorCopy (tr.endpos, ent->s.origin);
  1020. if (ent->team)
  1021. {
  1022. ent->flags &= ~FL_TEAMSLAVE;
  1023. ent->chain = ent->teamchain;
  1024. ent->teamchain = NULL;
  1025. ent->svflags |= SVF_NOCLIENT;
  1026. ent->solid = SOLID_NOT;
  1027. if (ent == ent->teammaster)
  1028. {
  1029. ent->nextthink = level.time + FRAMETIME;
  1030. ent->think = DoRespawn;
  1031. }
  1032. }
  1033. if (ent->spawnflags & ITEM_NO_TOUCH)
  1034. {
  1035. ent->solid = SOLID_BBOX;
  1036. ent->touch = NULL;
  1037. ent->s.effects &= ~EF_ROTATE;
  1038. ent->s.renderfx &= ~RF_GLOW;
  1039. }
  1040. if (ent->spawnflags & ITEM_TRIGGER_SPAWN)
  1041. {
  1042. ent->svflags |= SVF_NOCLIENT;
  1043. ent->solid = SOLID_NOT;
  1044. ent->use = Use_Item;
  1045. }
  1046. gi.linkentity (ent);
  1047. }
  1048. /*
  1049. ===============
  1050. PrecacheItem
  1051. Precaches all data needed for a given item.
  1052. This will be called for each item spawned in a level,
  1053. and for each item in each client's inventory.
  1054. ===============
  1055. */
  1056. void PrecacheItem (gitem_t *it)
  1057. {
  1058. char *s, *start;
  1059. char data[MAX_QPATH];
  1060. int len;
  1061. gitem_t *ammo;
  1062. if (!it)
  1063. return;
  1064. if (it->pickup_sound)
  1065. gi.soundindex (it->pickup_sound);
  1066. if (it->world_model)
  1067. gi.modelindex (it->world_model);
  1068. if (it->view_model)
  1069. gi.modelindex (it->view_model);
  1070. if (it->icon)
  1071. gi.imageindex (it->icon);
  1072. // parse everything for its ammo
  1073. if (it->ammo && it->ammo[0])
  1074. {
  1075. ammo = FindItem (it->ammo);
  1076. if (ammo != it)
  1077. PrecacheItem (ammo);
  1078. }
  1079. // parse the space seperated precache string for other items
  1080. s = it->precaches;
  1081. if (!s || !s[0])
  1082. return;
  1083. while (*s)
  1084. {
  1085. start = s;
  1086. while (*s && *s != ' ')
  1087. s++;
  1088. len = s-start;
  1089. if (len >= MAX_QPATH || len < 5)
  1090. gi.error ("PrecacheItem: %s has bad precache string", it->classname);
  1091. memcpy (data, start, len);
  1092. data[len] = 0;
  1093. if (*s)
  1094. s++;
  1095. // determine type based on extension
  1096. if (!strcmp(data+len-3, "md2"))
  1097. gi.modelindex (data);
  1098. else if (!strcmp(data+len-3, "sp2"))
  1099. gi.modelindex (data);
  1100. else if (!strcmp(data+len-3, "wav"))
  1101. gi.soundindex (data);
  1102. if (!strcmp(data+len-3, "pcx"))
  1103. gi.imageindex (data);
  1104. }
  1105. }
  1106. //=================
  1107. // Item_TriggeredSpawn - create the item marked for spawn creation
  1108. //=================
  1109. void Item_TriggeredSpawn (edict_t *self, edict_t *other, edict_t *activator)
  1110. {
  1111. // self->nextthink = level.time + 2 * FRAMETIME; // items start after other solids
  1112. // self->think = droptofloor;
  1113. self->svflags &= ~SVF_NOCLIENT;
  1114. self->use = NULL;
  1115. if(strcmp(self->classname, "key_power_cube")) // leave them be on key_power_cube..
  1116. self->spawnflags = 0;
  1117. droptofloor (self);
  1118. }
  1119. //=================
  1120. // SetTriggeredSpawn - set up an item to spawn in later.
  1121. //=================
  1122. void SetTriggeredSpawn (edict_t *ent)
  1123. {
  1124. // don't do anything on key_power_cubes.
  1125. if(!strcmp(ent->classname, "key_power_cube"))
  1126. return;
  1127. ent->think = NULL;
  1128. ent->nextthink = 0;
  1129. ent->use = Item_TriggeredSpawn;
  1130. ent->svflags |= SVF_NOCLIENT;
  1131. ent->solid = SOLID_NOT;
  1132. }
  1133. /*
  1134. ============
  1135. SpawnItem
  1136. Sets the clipping size and plants the object on the floor.
  1137. Items can't be immediately dropped to floor, because they might
  1138. be on an entity that hasn't spawned yet.
  1139. ============
  1140. */
  1141. void SpawnItem (edict_t *ent, gitem_t *item)
  1142. {
  1143. #if KILL_DISRUPTOR
  1144. if ((!strcmp(ent->classname, "ammo_disruptor")) || (!strcmp(ent->classname, "weapon_disintegrator")))
  1145. {
  1146. G_FreeEdict (ent);
  1147. return;
  1148. }
  1149. #endif
  1150. // PGM - since the item may be freed by the following rules, go ahead
  1151. // and move the precache until AFTER the following rules have been checked.
  1152. // keep an eye on this.
  1153. // PrecacheItem (item);
  1154. if (ent->spawnflags > 1) // PGM
  1155. {
  1156. if (strcmp(ent->classname, "key_power_cube") != 0)
  1157. {
  1158. ent->spawnflags = 0;
  1159. gi.dprintf("%s at %s has invalid spawnflags set\n", ent->classname, vtos(ent->s.origin));
  1160. }
  1161. }
  1162. // some items will be prevented in deathmatch
  1163. if (deathmatch->value)
  1164. {
  1165. if ( (int)dmflags->value & DF_NO_ARMOR )
  1166. {
  1167. if (item->pickup == Pickup_Armor || item->pickup == Pickup_PowerArmor)
  1168. {
  1169. G_FreeEdict (ent);
  1170. return;
  1171. }
  1172. }
  1173. if ( (int)dmflags->value & DF_NO_ITEMS )
  1174. {
  1175. if (item->pickup == Pickup_Powerup)
  1176. {
  1177. G_FreeEdict (ent);
  1178. return;
  1179. }
  1180. //=====
  1181. //ROGUE
  1182. if (item->pickup == Pickup_Sphere)
  1183. {
  1184. G_FreeEdict (ent);
  1185. return;
  1186. }
  1187. if (item->pickup == Pickup_Doppleganger)
  1188. {
  1189. G_FreeEdict (ent);
  1190. return;
  1191. }
  1192. //ROGUE
  1193. //=====
  1194. }
  1195. if ( (int)dmflags->value & DF_NO_HEALTH )
  1196. {
  1197. if (item->pickup == Pickup_Health || item->pickup == Pickup_Adrenaline || item->pickup == Pickup_AncientHead)
  1198. {
  1199. G_FreeEdict (ent);
  1200. return;
  1201. }
  1202. }
  1203. if ( (int)dmflags->value & DF_INFINITE_AMMO )
  1204. {
  1205. if ( (item->flags == IT_AMMO) || (strcmp(ent->classname, "weapon_bfg") == 0) )
  1206. {
  1207. G_FreeEdict (ent);
  1208. return;
  1209. }
  1210. }
  1211. //==========
  1212. //ROGUE
  1213. if ( (int)dmflags->value & DF_NO_MINES )
  1214. {
  1215. if ( !strcmp(ent->classname, "ammo_prox") ||
  1216. !strcmp(ent->classname, "ammo_tesla") )
  1217. {
  1218. G_FreeEdict (ent);
  1219. return;
  1220. }
  1221. }
  1222. if ( (int)dmflags->value & DF_NO_NUKES )
  1223. {
  1224. if ( !strcmp(ent->classname, "ammo_nuke") )
  1225. {
  1226. G_FreeEdict (ent);
  1227. return;
  1228. }
  1229. }
  1230. if ( (int)dmflags->value & DF_NO_SPHERES )
  1231. {
  1232. if (item->pickup == Pickup_Sphere)
  1233. {
  1234. G_FreeEdict (ent);
  1235. return;
  1236. }
  1237. }
  1238. //ROGUE
  1239. //==========
  1240. }
  1241. //==========
  1242. //ROGUE
  1243. // DM only items
  1244. if (!deathmatch->value)
  1245. {
  1246. if (item->pickup == Pickup_Doppleganger || item->pickup == Pickup_Nuke)
  1247. {
  1248. G_FreeEdict (ent);
  1249. return;
  1250. }
  1251. if ((item->use == Use_Vengeance) || (item->use == Use_Hunter))
  1252. {
  1253. G_FreeEdict (ent);
  1254. return;
  1255. }
  1256. }
  1257. //ROGUE
  1258. //==========
  1259. //PGM
  1260. PrecacheItem (item);
  1261. //PGM
  1262. if (coop->value && (strcmp(ent->classname, "key_power_cube") == 0))
  1263. {
  1264. ent->spawnflags |= (1 << (8 + level.power_cubes));
  1265. level.power_cubes++;
  1266. }
  1267. // don't let them drop items that stay in a coop game
  1268. if ((coop->value) && (item->flags & IT_STAY_COOP))
  1269. {
  1270. item->drop = NULL;
  1271. }
  1272. ent->item = item;
  1273. ent->nextthink = level.time + 2 * FRAMETIME; // items start after other solids
  1274. ent->think = droptofloor;
  1275. ent->s.effects = item->world_model_flags;
  1276. ent->s.renderfx = RF_GLOW;
  1277. if (ent->model)
  1278. gi.modelindex (ent->model);
  1279. if (ent->spawnflags & 1)
  1280. SetTriggeredSpawn (ent);
  1281. }
  1282. //======================================================================
  1283. gitem_t itemlist[] =
  1284. {
  1285. {
  1286. NULL
  1287. }, // leave index 0 alone
  1288. //
  1289. // ARMOR
  1290. //
  1291. /*QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1292. */
  1293. {
  1294. "item_armor_body",
  1295. Pickup_Armor,
  1296. NULL,
  1297. NULL,
  1298. NULL,
  1299. "misc/ar1_pkup.wav",
  1300. "models/items/armor/body/tris.md2", EF_ROTATE,
  1301. NULL,
  1302. /* icon */ "i_bodyarmor",
  1303. /* pickup */ "Body Armor",
  1304. /* width */ 3,
  1305. 0,
  1306. NULL,
  1307. IT_ARMOR,
  1308. 0,
  1309. &bodyarmor_info,
  1310. ARMOR_BODY,
  1311. /* precache */ ""
  1312. },
  1313. /*QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1314. */
  1315. {
  1316. "item_armor_combat",
  1317. Pickup_Armor,
  1318. NULL,
  1319. NULL,
  1320. NULL,
  1321. "misc/ar1_pkup.wav",
  1322. "models/items/armor/combat/tris.md2", EF_ROTATE,
  1323. NULL,
  1324. /* icon */ "i_combatarmor",
  1325. /* pickup */ "Combat Armor",
  1326. /* width */ 3,
  1327. 0,
  1328. NULL,
  1329. IT_ARMOR,
  1330. 0,
  1331. &combatarmor_info,
  1332. ARMOR_COMBAT,
  1333. /* precache */ ""
  1334. },
  1335. /*QUAKED item_armor_jacket (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1336. */
  1337. {
  1338. "item_armor_jacket",
  1339. Pickup_Armor,
  1340. NULL,
  1341. NULL,
  1342. NULL,
  1343. "misc/ar1_pkup.wav",
  1344. "models/items/armor/jacket/tris.md2", EF_ROTATE,
  1345. NULL,
  1346. /* icon */ "i_jacketarmor",
  1347. /* pickup */ "Jacket Armor",
  1348. /* width */ 3,
  1349. 0,
  1350. NULL,
  1351. IT_ARMOR,
  1352. 0,
  1353. &jacketarmor_info,
  1354. ARMOR_JACKET,
  1355. /* precache */ ""
  1356. },
  1357. /*QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1358. */
  1359. {
  1360. "item_armor_shard",
  1361. Pickup_Armor,
  1362. NULL,
  1363. NULL,
  1364. NULL,
  1365. "misc/ar2_pkup.wav",
  1366. "models/items/armor/shard/tris.md2", EF_ROTATE,
  1367. NULL,
  1368. /* icon */ "i_jacketarmor",
  1369. /* pickup */ "Armor Shard",
  1370. /* width */ 3,
  1371. 0,
  1372. NULL,
  1373. IT_ARMOR,
  1374. 0,
  1375. NULL,
  1376. ARMOR_SHARD,
  1377. /* precache */ ""
  1378. },
  1379. /*QUAKED item_power_screen (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1380. */
  1381. {
  1382. "item_power_screen",
  1383. Pickup_PowerArmor,
  1384. Use_PowerArmor,
  1385. Drop_PowerArmor,
  1386. NULL,
  1387. "misc/ar3_pkup.wav",
  1388. "models/items/armor/screen/tris.md2", EF_ROTATE,
  1389. NULL,
  1390. /* icon */ "i_powerscreen",
  1391. /* pickup */ "Power Screen",
  1392. /* width */ 0,
  1393. 60,
  1394. NULL,
  1395. IT_ARMOR,
  1396. 0,
  1397. NULL,
  1398. 0,
  1399. /* precache */ ""
  1400. },
  1401. /*QUAKED item_power_shield (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1402. */
  1403. {
  1404. "item_power_shield",
  1405. Pickup_PowerArmor,
  1406. Use_PowerArmor,
  1407. Drop_PowerArmor,
  1408. NULL,
  1409. "misc/ar3_pkup.wav",
  1410. "models/items/armor/shield/tris.md2", EF_ROTATE,
  1411. NULL,
  1412. /* icon */ "i_powershield",
  1413. /* pickup */ "Power Shield",
  1414. /* width */ 0,
  1415. 60,
  1416. NULL,
  1417. IT_ARMOR,
  1418. 0,
  1419. NULL,
  1420. 0,
  1421. /* precache */ "misc/power2.wav misc/power1.wav"
  1422. },
  1423. //
  1424. // WEAPONS
  1425. //
  1426. /* weapon_blaster (.3 .3 1) (-16 -16 -16) (16 16 16)
  1427. always owned, never in the world
  1428. */
  1429. {
  1430. "weapon_blaster",
  1431. NULL,
  1432. Use_Weapon,
  1433. NULL,
  1434. Weapon_Blaster,
  1435. "misc/w_pkup.wav",
  1436. NULL, 0,
  1437. "models/weapons/v_blast/tris.md2",
  1438. /* icon */ "w_blaster",
  1439. /* pickup */ "Blaster",
  1440. 0,
  1441. 0,
  1442. NULL,
  1443. IT_WEAPON|IT_STAY_COOP,
  1444. WEAP_BLASTER,
  1445. NULL,
  1446. 0,
  1447. /* precache */ "weapons/blastf1a.wav misc/lasfly.wav"
  1448. },
  1449. /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1450. */
  1451. {
  1452. "weapon_shotgun",
  1453. Pickup_Weapon,
  1454. Use_Weapon,
  1455. Drop_Weapon,
  1456. Weapon_Shotgun,
  1457. "misc/w_pkup.wav",
  1458. "models/weapons/g_shotg/tris.md2", EF_ROTATE,
  1459. "models/weapons/v_shotg/tris.md2",
  1460. /* icon */ "w_shotgun",
  1461. /* pickup */ "Shotgun",
  1462. 0,
  1463. 1,
  1464. "Shells",
  1465. IT_WEAPON|IT_STAY_COOP,
  1466. WEAP_SHOTGUN,
  1467. NULL,
  1468. 0,
  1469. /* precache */ "weapons/shotgf1b.wav weapons/shotgr1b.wav"
  1470. },
  1471. /*QUAKED weapon_supershotgun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1472. */
  1473. {
  1474. "weapon_supershotgun",
  1475. Pickup_Weapon,
  1476. Use_Weapon,
  1477. Drop_Weapon,
  1478. Weapon_SuperShotgun,
  1479. "misc/w_pkup.wav",
  1480. "models/weapons/g_shotg2/tris.md2", EF_ROTATE,
  1481. "models/weapons/v_shotg2/tris.md2",
  1482. /* icon */ "w_sshotgun",
  1483. /* pickup */ "Super Shotgun",
  1484. 0,
  1485. 2,
  1486. "Shells",
  1487. IT_WEAPON|IT_STAY_COOP,
  1488. WEAP_SUPERSHOTGUN,
  1489. NULL,
  1490. 0,
  1491. /* precache */ "weapons/sshotf1b.wav"
  1492. },
  1493. /*QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1494. */
  1495. {
  1496. "weapon_machinegun",
  1497. Pickup_Weapon,
  1498. Use_Weapon,
  1499. Drop_Weapon,
  1500. Weapon_Machinegun,
  1501. "misc/w_pkup.wav",
  1502. "models/weapons/g_machn/tris.md2", EF_ROTATE,
  1503. "models/weapons/v_machn/tris.md2",
  1504. /* icon */ "w_machinegun",
  1505. /* pickup */ "Machinegun",
  1506. 0,
  1507. 1,
  1508. "Bullets",
  1509. IT_WEAPON|IT_STAY_COOP,
  1510. WEAP_MACHINEGUN,
  1511. NULL,
  1512. 0,
  1513. /* precache */ "weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf4b.wav weapons/machgf5b.wav"
  1514. },
  1515. /*QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1516. */
  1517. {
  1518. "weapon_chaingun",
  1519. Pickup_Weapon,
  1520. Use_Weapon,
  1521. Drop_Weapon,
  1522. Weapon_Chaingun,
  1523. "misc/w_pkup.wav",
  1524. "models/weapons/g_chain/tris.md2", EF_ROTATE,
  1525. "models/weapons/v_chain/tris.md2",
  1526. /* icon */ "w_chaingun",
  1527. /* pickup */ "Chaingun",
  1528. 0,
  1529. 1,
  1530. "Bullets",
  1531. IT_WEAPON|IT_STAY_COOP,
  1532. WEAP_CHAINGUN,
  1533. NULL,
  1534. 0,
  1535. /* precache */ "weapons/chngnu1a.wav weapons/chngnl1a.wav weapons/machgf3b.wav` weapons/chngnd1a.wav"
  1536. },
  1537. // ROGUE
  1538. /*QUAKED weapon_etf_rifle (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1539. */
  1540. {
  1541. "weapon_etf_rifle", // classname
  1542. Pickup_Weapon, // pickup function
  1543. Use_Weapon, // use function
  1544. Drop_Weapon, // drop function
  1545. Weapon_ETF_Rifle, // weapon think function
  1546. "misc/w_pkup.wav", // pick up sound
  1547. "models/weapons/g_etf_rifle/tris.md2", EF_ROTATE, // world model, world model flags
  1548. "models/weapons/v_etf_rifle/tris.md2", // view model
  1549. "w_etf_rifle", // icon
  1550. "ETF Rifle", // name printed when picked up
  1551. 0, // number of digits for statusbar
  1552. 1, // amount used / contained
  1553. "Flechettes", // ammo type used
  1554. IT_WEAPON, // inventory flags
  1555. WEAP_ETFRIFLE, // visible weapon
  1556. NULL, // info (void *)
  1557. 0, // tag
  1558. "weapons/nail1.wav models/proj/flechette/tris.md2", // precaches
  1559. },
  1560. // rogue
  1561. /*QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1562. */
  1563. {
  1564. "ammo_grenades",
  1565. Pickup_Ammo,
  1566. Use_Weapon,
  1567. Drop_Ammo,
  1568. Weapon_Grenade,
  1569. "misc/am_pkup.wav",
  1570. "models/items/ammo/grenades/medium/tris.md2", 0,
  1571. "models/weapons/v_handgr/tris.md2",
  1572. /* icon */ "a_grenades",
  1573. /* pickup */ "Grenades",
  1574. /* width */ 3,
  1575. 5,
  1576. "grenades",
  1577. IT_AMMO|IT_WEAPON,
  1578. WEAP_GRENADES,
  1579. NULL,
  1580. AMMO_GRENADES,
  1581. /* precache */ "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
  1582. },
  1583. /*QUAKED weapon_grenadelauncher (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1584. */
  1585. {
  1586. "weapon_grenadelauncher",
  1587. Pickup_Weapon,
  1588. Use_Weapon,
  1589. Drop_Weapon,
  1590. Weapon_GrenadeLauncher,
  1591. "misc/w_pkup.wav",
  1592. "models/weapons/g_launch/tris.md2", EF_ROTATE,
  1593. "models/weapons/v_launch/tris.md2",
  1594. /* icon */ "w_glauncher",
  1595. /* pickup */ "Grenade Launcher",
  1596. 0,
  1597. 1,
  1598. "Grenades",
  1599. IT_WEAPON|IT_STAY_COOP,
  1600. WEAP_GRENADELAUNCHER,
  1601. NULL,
  1602. 0,
  1603. /* precache */ "models/objects/grenade/tris.md2 weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav"
  1604. },
  1605. // ROGUE
  1606. /*QUAKED weapon_proxlauncher (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1607. */
  1608. {
  1609. "weapon_proxlauncher", // classname
  1610. Pickup_Weapon, // pickup
  1611. Use_Weapon, // use
  1612. Drop_Weapon, // drop
  1613. Weapon_ProxLauncher, // weapon think
  1614. "misc/w_pkup.wav", // pick up sound
  1615. "models/weapons/g_plaunch/tris.md2", EF_ROTATE, // world model, world model flags
  1616. "models/weapons/v_plaunch/tris.md2", // view model
  1617. "w_proxlaunch", // icon
  1618. "Prox Launcher", // name printed when picked up
  1619. 0, // number of digits for statusbar
  1620. 1, // amount used
  1621. "Prox", // ammo type used
  1622. IT_WEAPON, // inventory flags
  1623. WEAP_PROXLAUNCH, // visible weapon
  1624. NULL, // info (void *)
  1625. AMMO_PROX, // tag
  1626. "weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav weapons/proxwarn.wav weapons/proxopen.wav",
  1627. },
  1628. // rogue
  1629. /*QUAKED weapon_rocketlauncher (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1630. */
  1631. {
  1632. "weapon_rocketlauncher",
  1633. Pickup_Weapon,
  1634. Use_Weapon,
  1635. Drop_Weapon,
  1636. Weapon_RocketLauncher,
  1637. "misc/w_pkup.wav",
  1638. "models/weapons/g_rocket/tris.md2", EF_ROTATE,
  1639. "models/weapons/v_rocket/tris.md2",
  1640. /* icon */ "w_rlauncher",
  1641. /* pickup */ "Rocket Launcher",
  1642. 0,
  1643. 1,
  1644. "Rockets",
  1645. IT_WEAPON|IT_STAY_COOP,
  1646. WEAP_ROCKETLAUNCHER,
  1647. NULL,
  1648. 0,
  1649. /* precache */ "models/objects/rocket/tris.md2 weapons/rockfly.wav weapons/rocklf1a.wav weapons/rocklr1b.wav models/objects/debris2/tris.md2"
  1650. },
  1651. /*QUAKED weapon_hyperblaster (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1652. */
  1653. {
  1654. "weapon_hyperblaster",
  1655. Pickup_Weapon,
  1656. Use_Weapon,
  1657. Drop_Weapon,
  1658. Weapon_HyperBlaster,
  1659. "misc/w_pkup.wav",
  1660. "models/weapons/g_hyperb/tris.md2", EF_ROTATE,
  1661. "models/weapons/v_hyperb/tris.md2",
  1662. /* icon */ "w_hyperblaster",
  1663. /* pickup */ "HyperBlaster",
  1664. 0,
  1665. 1,
  1666. "Cells",
  1667. IT_WEAPON|IT_STAY_COOP,
  1668. WEAP_HYPERBLASTER,
  1669. NULL,
  1670. 0,
  1671. /* precache */ "weapons/hyprbu1a.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav weapons/hyprbd1a.wav misc/lasfly.wav"
  1672. },
  1673. // ROGUE
  1674. /*QUAKED weapon_plasmabeam (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1675. */
  1676. {
  1677. "weapon_plasmabeam", // classname
  1678. Pickup_Weapon, // pickup function
  1679. Use_Weapon, // use function
  1680. Drop_Weapon, // drop function
  1681. Weapon_Heatbeam, // weapon think function
  1682. "misc/w_pkup.wav", // pick up sound
  1683. "models/weapons/g_beamer/tris.md2", EF_ROTATE, // world model, world model flags
  1684. "models/weapons/v_beamer/tris.md2", // view model
  1685. "w_heatbeam", // icon
  1686. "Plasma Beam", // name printed when picked up
  1687. 0, // number of digits for statusbar
  1688. // FIXME - if this changes, change it in NoAmmoWeaponChange as well
  1689. 2, // amount used / contained
  1690. "Cells", // ammo type used
  1691. IT_WEAPON, // inventory flags
  1692. WEAP_PLASMA, // visible weapon
  1693. NULL, // info (void *)
  1694. 0, // tag
  1695. "models/weapons/v_beamer2/tris.md2 weapons/bfg__l1a.wav", // precaches
  1696. },
  1697. //rogue
  1698. /*QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1699. */
  1700. {
  1701. "weapon_railgun",
  1702. Pickup_Weapon,
  1703. Use_Weapon,
  1704. Drop_Weapon,
  1705. Weapon_Railgun,
  1706. "misc/w_pkup.wav",
  1707. "models/weapons/g_rail/tris.md2", EF_ROTATE,
  1708. "models/weapons/v_rail/tris.md2",
  1709. /* icon */ "w_railgun",
  1710. /* pickup */ "Railgun",
  1711. 0,
  1712. 1,
  1713. "Slugs",
  1714. IT_WEAPON|IT_STAY_COOP,
  1715. WEAP_RAILGUN,
  1716. NULL,
  1717. 0,
  1718. /* precache */ "weapons/rg_hum.wav"
  1719. },
  1720. /*QUAKED weapon_bfg (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1721. */
  1722. {
  1723. "weapon_bfg",
  1724. Pickup_Weapon,
  1725. Use_Weapon,
  1726. Drop_Weapon,
  1727. Weapon_BFG,
  1728. "misc/w_pkup.wav",
  1729. "models/weapons/g_bfg/tris.md2", EF_ROTATE,
  1730. "models/weapons/v_bfg/tris.md2",
  1731. /* icon */ "w_bfg",
  1732. /* pickup */ "BFG10K",
  1733. 0,
  1734. 50,
  1735. "Cells",
  1736. IT_WEAPON|IT_STAY_COOP,
  1737. WEAP_BFG,
  1738. NULL,
  1739. 0,
  1740. /* 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"
  1741. },
  1742. // =========================
  1743. // ROGUE WEAPONS
  1744. /*QUAKED weapon_chainfist (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1745. */
  1746. {
  1747. "weapon_chainfist", // classname
  1748. Pickup_Weapon, // pickup function
  1749. Use_Weapon, // use function
  1750. Drop_Weapon, // drop function
  1751. Weapon_ChainFist, // weapon think function
  1752. "misc/w_pkup.wav", // pick up sound
  1753. "models/weapons/g_chainf/tris.md2", EF_ROTATE, // world model, world model flags
  1754. "models/weapons/v_chainf/tris.md2", // view model
  1755. "w_chainfist", // icon
  1756. "Chainfist", // name printed when picked up
  1757. 0, // number of digits for statusbar
  1758. 0, // amount used / contained
  1759. NULL, // ammo type used
  1760. IT_WEAPON | IT_MELEE, // inventory flags
  1761. WEAP_CHAINFIST, // visible weapon
  1762. NULL, // info (void *)
  1763. 1, // tag
  1764. "weapons/sawidle.wav weapons/sawhit.wav", // precaches
  1765. },
  1766. /*QUAKED weapon_disintegrator (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1767. */
  1768. {
  1769. "weapon_disintegrator", // classname
  1770. Pickup_Weapon, // pickup function
  1771. Use_Weapon, // use function
  1772. Drop_Weapon, // drop function
  1773. Weapon_Disintegrator, // weapon think function
  1774. "misc/w_pkup.wav", // pick up sound
  1775. "models/weapons/g_dist/tris.md2", EF_ROTATE, // world model, world model flags
  1776. "models/weapons/v_dist/tris.md2", // view model
  1777. "w_disintegrator", // icon
  1778. "Disruptor", // name printed when picked up
  1779. 0, // number of digits for statusbar
  1780. 1, // amount used / contained
  1781. "Rounds", // ammo type used
  1782. #ifdef KILL_DISRUPTOR
  1783. IT_NOT_GIVEABLE,
  1784. #else
  1785. IT_WEAPON, // inventory flags
  1786. #endif
  1787. WEAP_DISRUPTOR, // visible weapon
  1788. NULL, // info (void *)
  1789. 1, // tag
  1790. "models/items/spawngro/tris.md2 models/proj/disintegrator/tris.md2 weapons/disrupt.wav weapons/disint2.wav weapons/disrupthit.wav", // precaches
  1791. },
  1792. // ROGUE WEAPONS
  1793. // =========================
  1794. //
  1795. // AMMO ITEMS
  1796. //
  1797. /*QUAKED ammo_shells (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1798. */
  1799. {
  1800. "ammo_shells",
  1801. Pickup_Ammo,
  1802. NULL,
  1803. Drop_Ammo,
  1804. NULL,
  1805. "misc/am_pkup.wav",
  1806. "models/items/ammo/shells/medium/tris.md2", 0,
  1807. NULL,
  1808. /* icon */ "a_shells",
  1809. /* pickup */ "Shells",
  1810. /* width */ 3,
  1811. 10,
  1812. NULL,
  1813. IT_AMMO,
  1814. 0,
  1815. NULL,
  1816. AMMO_SHELLS,
  1817. /* precache */ ""
  1818. },
  1819. /*QUAKED ammo_bullets (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1820. */
  1821. {
  1822. "ammo_bullets",
  1823. Pickup_Ammo,
  1824. NULL,
  1825. Drop_Ammo,
  1826. NULL,
  1827. "misc/am_pkup.wav",
  1828. "models/items/ammo/bullets/medium/tris.md2", 0,
  1829. NULL,
  1830. /* icon */ "a_bullets",
  1831. /* pickup */ "Bullets",
  1832. /* width */ 3,
  1833. 50,
  1834. NULL,
  1835. IT_AMMO,
  1836. 0,
  1837. NULL,
  1838. AMMO_BULLETS,
  1839. /* precache */ ""
  1840. },
  1841. /*QUAKED ammo_cells (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1842. */
  1843. {
  1844. "ammo_cells",
  1845. Pickup_Ammo,
  1846. NULL,
  1847. Drop_Ammo,
  1848. NULL,
  1849. "misc/am_pkup.wav",
  1850. "models/items/ammo/cells/medium/tris.md2", 0,
  1851. NULL,
  1852. /* icon */ "a_cells",
  1853. /* pickup */ "Cells",
  1854. /* width */ 3,
  1855. 50,
  1856. NULL,
  1857. IT_AMMO,
  1858. 0,
  1859. NULL,
  1860. AMMO_CELLS,
  1861. /* precache */ ""
  1862. },
  1863. /*QUAKED ammo_rockets (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1864. */
  1865. {
  1866. "ammo_rockets",
  1867. Pickup_Ammo,
  1868. NULL,
  1869. Drop_Ammo,
  1870. NULL,
  1871. "misc/am_pkup.wav",
  1872. "models/items/ammo/rockets/medium/tris.md2", 0,
  1873. NULL,
  1874. /* icon */ "a_rockets",
  1875. /* pickup */ "Rockets",
  1876. /* width */ 3,
  1877. 5,
  1878. NULL,
  1879. IT_AMMO,
  1880. 0,
  1881. NULL,
  1882. AMMO_ROCKETS,
  1883. /* precache */ ""
  1884. },
  1885. /*QUAKED ammo_slugs (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1886. */
  1887. {
  1888. "ammo_slugs",
  1889. Pickup_Ammo,
  1890. NULL,
  1891. Drop_Ammo,
  1892. NULL,
  1893. "misc/am_pkup.wav",
  1894. "models/items/ammo/slugs/medium/tris.md2", 0,
  1895. NULL,
  1896. /* icon */ "a_slugs",
  1897. /* pickup */ "Slugs",
  1898. /* width */ 3,
  1899. 10,
  1900. NULL,
  1901. IT_AMMO,
  1902. 0,
  1903. NULL,
  1904. AMMO_SLUGS,
  1905. /* precache */ ""
  1906. },
  1907. // =======================================
  1908. // ROGUE AMMO
  1909. /*QUAKED ammo_flechettes (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1910. */
  1911. {
  1912. "ammo_flechettes",
  1913. Pickup_Ammo,
  1914. NULL,
  1915. Drop_Ammo,
  1916. NULL,
  1917. "misc/am_pkup.wav",
  1918. "models/ammo/am_flechette/tris.md2", 0,
  1919. NULL,
  1920. "a_flechettes",
  1921. "Flechettes",
  1922. 3,
  1923. 50,
  1924. NULL,
  1925. IT_AMMO,
  1926. 0,
  1927. NULL,
  1928. AMMO_FLECHETTES
  1929. },
  1930. /*QUAKED ammo_prox (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1931. */
  1932. {
  1933. "ammo_prox", // Classname
  1934. Pickup_Ammo, // pickup function
  1935. NULL, // use function
  1936. Drop_Ammo, // drop function
  1937. NULL, // weapon think function
  1938. "misc/am_pkup.wav", // pickup sound
  1939. "models/ammo/am_prox/tris.md2", 0, // world model, world model flags
  1940. NULL, // view model
  1941. "a_prox", // icon
  1942. "Prox", // Name printed when picked up
  1943. 3, // number of digits for status bar
  1944. 5, // amount contained
  1945. NULL, // ammo type used
  1946. IT_AMMO, // inventory flags
  1947. 0, // vwep index
  1948. NULL, // info (void *)
  1949. AMMO_PROX, // tag
  1950. "models/weapons/g_prox/tris.md2 weapons/proxwarn.wav" // precaches
  1951. },
  1952. /*QUAKED ammo_tesla (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1953. */
  1954. {
  1955. "ammo_tesla",
  1956. Pickup_Ammo,
  1957. Use_Weapon, // PGM
  1958. Drop_Ammo,
  1959. Weapon_Tesla, // PGM
  1960. "misc/am_pkup.wav",
  1961. // "models/weapons/g_tesla/tris.md2", 0,
  1962. "models/ammo/am_tesl/tris.md2", 0,
  1963. "models/weapons/v_tesla/tris.md2",
  1964. "a_tesla",
  1965. "Tesla",
  1966. 3,
  1967. 5,
  1968. "Tesla", // PGM
  1969. IT_AMMO | IT_WEAPON, // inventory flags
  1970. 0,
  1971. NULL, // info (void *)
  1972. AMMO_TESLA, // tag
  1973. "models/weapons/v_tesla2/tris.md2 weapons/teslaopen.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav models/weapons/g_tesla/tris.md2" // precache
  1974. },
  1975. /*QUAKED ammo_nuke (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1976. */
  1977. {
  1978. "ammo_nuke",
  1979. Pickup_Nuke,
  1980. Use_Nuke, // PMM
  1981. Drop_Ammo,
  1982. NULL, // PMM
  1983. "misc/am_pkup.wav",
  1984. "models/weapons/g_nuke/tris.md2", EF_ROTATE,
  1985. NULL,
  1986. /* icon */ "p_nuke",
  1987. /* pickup */ "A-M Bomb",
  1988. /* width */ 3,
  1989. 300, /* quantity (used for respawn time) */
  1990. "A-M Bomb",
  1991. IT_POWERUP,
  1992. 0,
  1993. NULL,
  1994. 0,
  1995. "weapons/nukewarn2.wav world/rumble.wav"
  1996. },
  1997. /*QUAKED ammo_disruptor (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  1998. */
  1999. {
  2000. "ammo_disruptor",
  2001. Pickup_Ammo,
  2002. NULL,
  2003. Drop_Ammo,
  2004. NULL,
  2005. "misc/am_pkup.wav",
  2006. "models/ammo/am_disr/tris.md2", 0,
  2007. NULL,
  2008. "a_disruptor",
  2009. "Rounds", // FIXME
  2010. 3,
  2011. 15,
  2012. NULL,
  2013. #ifdef KILL_DISRUPTOR
  2014. IT_NOT_GIVEABLE,
  2015. #else
  2016. IT_AMMO, // inventory flags
  2017. #endif
  2018. 0,
  2019. NULL,
  2020. #ifdef KILL_DISRUPTOR
  2021. 0,
  2022. #else
  2023. AMMO_DISRUPTOR,
  2024. #endif
  2025. },
  2026. // ROGUE AMMO
  2027. // =======================================
  2028. //
  2029. // POWERUP ITEMS
  2030. //
  2031. /*QUAKED item_quad (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2032. */
  2033. {
  2034. "item_quad",
  2035. Pickup_Powerup,
  2036. Use_Quad,
  2037. Drop_General,
  2038. NULL,
  2039. "items/pkup.wav",
  2040. "models/items/quaddama/tris.md2", EF_ROTATE,
  2041. NULL,
  2042. /* icon */ "p_quad",
  2043. /* pickup */ "Quad Damage",
  2044. /* width */ 2,
  2045. 60,
  2046. NULL,
  2047. IT_POWERUP,
  2048. 0,
  2049. NULL,
  2050. 0,
  2051. /* precache */ "items/damage.wav items/damage2.wav items/damage3.wav"
  2052. },
  2053. /*QUAKED item_invulnerability (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2054. */
  2055. {
  2056. "item_invulnerability",
  2057. Pickup_Powerup,
  2058. Use_Invulnerability,
  2059. Drop_General,
  2060. NULL,
  2061. "items/pkup.wav",
  2062. "models/items/invulner/tris.md2", EF_ROTATE,
  2063. NULL,
  2064. /* icon */ "p_invulnerability",
  2065. /* pickup */ "Invulnerability",
  2066. /* width */ 2,
  2067. 300,
  2068. NULL,
  2069. IT_POWERUP,
  2070. 0,
  2071. NULL,
  2072. 0,
  2073. /* precache */ "items/protect.wav items/protect2.wav items/protect4.wav"
  2074. },
  2075. /*QUAKED item_silencer (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2076. */
  2077. {
  2078. "item_silencer",
  2079. Pickup_Powerup,
  2080. Use_Silencer,
  2081. Drop_General,
  2082. NULL,
  2083. "items/pkup.wav",
  2084. "models/items/silencer/tris.md2", EF_ROTATE,
  2085. NULL,
  2086. /* icon */ "p_silencer",
  2087. /* pickup */ "Silencer",
  2088. /* width */ 2,
  2089. 60,
  2090. NULL,
  2091. IT_POWERUP,
  2092. 0,
  2093. NULL,
  2094. 0,
  2095. /* precache */ ""
  2096. },
  2097. /*QUAKED item_breather (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2098. */
  2099. {
  2100. "item_breather",
  2101. Pickup_Powerup,
  2102. Use_Breather,
  2103. Drop_General,
  2104. NULL,
  2105. "items/pkup.wav",
  2106. "models/items/breather/tris.md2", EF_ROTATE,
  2107. NULL,
  2108. /* icon */ "p_rebreather",
  2109. /* pickup */ "Rebreather",
  2110. /* width */ 2,
  2111. 60,
  2112. NULL,
  2113. IT_STAY_COOP|IT_POWERUP,
  2114. 0,
  2115. NULL,
  2116. 0,
  2117. /* precache */ "items/airout.wav"
  2118. },
  2119. /*QUAKED item_enviro (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2120. */
  2121. {
  2122. "item_enviro",
  2123. Pickup_Powerup,
  2124. Use_Envirosuit,
  2125. Drop_General,
  2126. NULL,
  2127. "items/pkup.wav",
  2128. "models/items/enviro/tris.md2", EF_ROTATE,
  2129. NULL,
  2130. /* icon */ "p_envirosuit",
  2131. /* pickup */ "Environment Suit",
  2132. /* width */ 2,
  2133. 60,
  2134. NULL,
  2135. IT_STAY_COOP|IT_POWERUP,
  2136. 0,
  2137. NULL,
  2138. 0,
  2139. /* precache */ "items/airout.wav"
  2140. },
  2141. /*QUAKED item_ancient_head (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2142. Special item that gives +2 to maximum health
  2143. */
  2144. {
  2145. "item_ancient_head",
  2146. Pickup_AncientHead,
  2147. NULL,
  2148. NULL,
  2149. NULL,
  2150. "items/pkup.wav",
  2151. "models/items/c_head/tris.md2", EF_ROTATE,
  2152. NULL,
  2153. /* icon */ "i_fixme",
  2154. /* pickup */ "Ancient Head",
  2155. /* width */ 2,
  2156. 60,
  2157. NULL,
  2158. 0,
  2159. 0,
  2160. NULL,
  2161. 0,
  2162. /* precache */ ""
  2163. },
  2164. /*QUAKED item_adrenaline (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2165. gives +1 to maximum health
  2166. */
  2167. {
  2168. "item_adrenaline",
  2169. Pickup_Adrenaline,
  2170. NULL,
  2171. NULL,
  2172. NULL,
  2173. "items/pkup.wav",
  2174. "models/items/adrenal/tris.md2", EF_ROTATE,
  2175. NULL,
  2176. /* icon */ "p_adrenaline",
  2177. /* pickup */ "Adrenaline",
  2178. /* width */ 2,
  2179. 60,
  2180. NULL,
  2181. 0,
  2182. 0,
  2183. NULL,
  2184. 0,
  2185. /* precache */ ""
  2186. },
  2187. /*QUAKED item_bandolier (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2188. */
  2189. {
  2190. "item_bandolier",
  2191. Pickup_Bandolier,
  2192. NULL,
  2193. NULL,
  2194. NULL,
  2195. "items/pkup.wav",
  2196. "models/items/band/tris.md2", EF_ROTATE,
  2197. NULL,
  2198. /* icon */ "p_bandolier",
  2199. /* pickup */ "Bandolier",
  2200. /* width */ 2,
  2201. 60,
  2202. NULL,
  2203. 0,
  2204. 0,
  2205. NULL,
  2206. 0,
  2207. /* precache */ ""
  2208. },
  2209. /*QUAKED item_pack (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2210. */
  2211. {
  2212. "item_pack",
  2213. Pickup_Pack,
  2214. NULL,
  2215. NULL,
  2216. NULL,
  2217. "items/pkup.wav",
  2218. "models/items/pack/tris.md2", EF_ROTATE,
  2219. NULL,
  2220. /* icon */ "i_pack",
  2221. /* pickup */ "Ammo Pack",
  2222. /* width */ 2,
  2223. 180,
  2224. NULL,
  2225. 0,
  2226. 0,
  2227. NULL,
  2228. 0,
  2229. /* precache */ ""
  2230. },
  2231. // ======================================
  2232. // PGM
  2233. /*QUAKED item_ir_goggles (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2234. gives +1 to maximum health
  2235. */
  2236. {
  2237. "item_ir_goggles",
  2238. Pickup_Powerup,
  2239. Use_IR,
  2240. Drop_General,
  2241. NULL,
  2242. "items/pkup.wav",
  2243. "models/items/goggles/tris.md2", EF_ROTATE,
  2244. NULL,
  2245. /* icon */ "p_ir",
  2246. /* pickup */ "IR Goggles",
  2247. /* width */ 2,
  2248. 60,
  2249. NULL,
  2250. IT_POWERUP,
  2251. 0,
  2252. NULL,
  2253. 0,
  2254. /* precache */ "misc/ir_start.wav"
  2255. },
  2256. /*QUAKED item_double (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2257. */
  2258. {
  2259. "item_double",
  2260. Pickup_Powerup,
  2261. Use_Double,
  2262. Drop_General,
  2263. NULL,
  2264. "items/pkup.wav",
  2265. "models/items/ddamage/tris.md2", EF_ROTATE,
  2266. NULL,
  2267. /* icon */ "p_double",
  2268. /* pickup */ "Double Damage",
  2269. /* width */ 2,
  2270. 60,
  2271. NULL,
  2272. IT_POWERUP,
  2273. 0,
  2274. NULL,
  2275. 0,
  2276. /* precache */ "misc/ddamage1.wav misc/ddamage2.wav misc/ddamage3.wav"
  2277. },
  2278. /*Q U A K E D item_torch (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2279. */
  2280. /*
  2281. {
  2282. "item_torch",
  2283. Pickup_Powerup,
  2284. Use_Torch,
  2285. Drop_General,
  2286. NULL,
  2287. "items/pkup.wav",
  2288. "models/objects/fire/tris.md2", EF_ROTATE,
  2289. NULL,
  2290. "p_torch",
  2291. "torch",
  2292. 2,
  2293. 60,
  2294. NULL,
  2295. IT_POWERUP,
  2296. 0,
  2297. NULL,
  2298. 0,
  2299. },
  2300. */
  2301. /*QUAKED item_compass (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2302. */
  2303. {
  2304. "item_compass",
  2305. Pickup_Powerup,
  2306. Use_Compass,
  2307. NULL,
  2308. NULL,
  2309. "items/pkup.wav",
  2310. "models/objects/fire/tris.md2", EF_ROTATE,
  2311. NULL,
  2312. /* icon */ "p_compass",
  2313. /* pickup */ "compass",
  2314. /* width */ 2,
  2315. 60,
  2316. NULL,
  2317. IT_POWERUP,
  2318. 0,
  2319. NULL,
  2320. 0,
  2321. },
  2322. /*QUAKED item_sphere_vengeance (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2323. */
  2324. {
  2325. "item_sphere_vengeance",
  2326. Pickup_Sphere,
  2327. Use_Vengeance,
  2328. NULL,
  2329. NULL,
  2330. "items/pkup.wav",
  2331. "models/items/vengnce/tris.md2", EF_ROTATE,
  2332. NULL,
  2333. /* icon */ "p_vengeance",
  2334. /* pickup */ "vengeance sphere",
  2335. /* width */ 2,
  2336. 60,
  2337. NULL,
  2338. IT_POWERUP,
  2339. 0,
  2340. NULL,
  2341. 0,
  2342. "spheres/v_idle.wav" //precache
  2343. },
  2344. /*QUAKED item_sphere_hunter (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2345. */
  2346. {
  2347. "item_sphere_hunter",
  2348. Pickup_Sphere,
  2349. Use_Hunter,
  2350. NULL,
  2351. NULL,
  2352. "items/pkup.wav",
  2353. "models/items/hunter/tris.md2", EF_ROTATE,
  2354. NULL,
  2355. /* icon */ "p_hunter",
  2356. /* pickup */ "hunter sphere",
  2357. /* width */ 2,
  2358. 120,
  2359. NULL,
  2360. IT_POWERUP,
  2361. 0,
  2362. NULL,
  2363. 0,
  2364. "spheres/h_idle.wav spheres/h_active.wav spheres/h_lurk.wav" //precache
  2365. },
  2366. /*QUAKED item_sphere_defender (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2367. */
  2368. {
  2369. "item_sphere_defender",
  2370. Pickup_Sphere,
  2371. Use_Defender,
  2372. NULL,
  2373. NULL,
  2374. "items/pkup.wav",
  2375. "models/items/defender/tris.md2", EF_ROTATE,
  2376. NULL,
  2377. /* icon */ "p_defender",
  2378. /* pickup */ "defender sphere",
  2379. /* width */ 2,
  2380. 60, // respawn time
  2381. NULL, // ammo type used
  2382. IT_POWERUP, // inventory flags
  2383. 0,
  2384. NULL, // info (void *)
  2385. 0, // tag
  2386. "models/proj/laser2/tris.md2 models/items/shell/tris.md2 spheres/d_idle.wav" // precache
  2387. },
  2388. /*QUAKED item_doppleganger (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2389. */
  2390. {
  2391. "item_doppleganger", // classname
  2392. Pickup_Doppleganger, // pickup function
  2393. Use_Doppleganger, // use function
  2394. Drop_General, // drop function
  2395. NULL, // weapon think function
  2396. "items/pkup.wav", // pick up sound
  2397. "models/items/dopple/tris.md2", // world model
  2398. EF_ROTATE, // world model flags
  2399. NULL, // view model
  2400. "p_doppleganger", // icon
  2401. "Doppleganger", // name printed when picked up
  2402. 0, // number of digits for statusbar
  2403. 90, // respawn time
  2404. NULL, // ammo type used
  2405. IT_POWERUP, // inventory flags
  2406. 0,
  2407. NULL, // info (void *)
  2408. 0, // tag
  2409. "models/objects/dopplebase/tris.md2 models/items/spawngro2/tris.md2 models/items/hunter/tris.md2 models/items/vengnce/tris.md2", // precaches
  2410. },
  2411. {
  2412. // "dm_tag_token", // classname
  2413. NULL, // classname
  2414. Tag_PickupToken, // pickup function
  2415. NULL, // use function
  2416. NULL, // drop function
  2417. NULL, // weapon think function
  2418. "items/pkup.wav", // pick up sound
  2419. "models/items/tagtoken/tris.md2", // world model
  2420. EF_ROTATE | EF_TAGTRAIL, // world model flags
  2421. NULL, // view model
  2422. "i_tagtoken", // icon
  2423. "Tag Token", // name printed when picked up
  2424. 0, // number of digits for statusbar
  2425. 0, // amount used / contained
  2426. NULL, // ammo type used
  2427. IT_POWERUP | IT_NOT_GIVEABLE, // inventory flags
  2428. 0,
  2429. NULL, // info (void *)
  2430. 1, // tag
  2431. NULL, // precaches
  2432. },
  2433. // PGM
  2434. // ======================================
  2435. //
  2436. // KEYS
  2437. //
  2438. /*QUAKED key_data_cd (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2439. key for computer centers
  2440. */
  2441. {
  2442. "key_data_cd",
  2443. Pickup_Key,
  2444. NULL,
  2445. Drop_General,
  2446. NULL,
  2447. "items/pkup.wav",
  2448. "models/items/keys/data_cd/tris.md2", EF_ROTATE,
  2449. NULL,
  2450. "k_datacd",
  2451. "Data CD",
  2452. 2,
  2453. 0,
  2454. NULL,
  2455. IT_STAY_COOP|IT_KEY,
  2456. 0,
  2457. NULL,
  2458. 0,
  2459. /* precache */ ""
  2460. },
  2461. /*QUAKED key_power_cube (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN NO_TOUCH
  2462. warehouse circuits
  2463. */
  2464. {
  2465. "key_power_cube",
  2466. Pickup_Key,
  2467. NULL,
  2468. Drop_General,
  2469. NULL,
  2470. "items/pkup.wav",
  2471. "models/items/keys/power/tris.md2", EF_ROTATE,
  2472. NULL,
  2473. "k_powercube",
  2474. "Power Cube",
  2475. 2,
  2476. 0,
  2477. NULL,
  2478. IT_STAY_COOP|IT_KEY,
  2479. 0,
  2480. NULL,
  2481. 0,
  2482. /* precache */ ""
  2483. },
  2484. /*QUAKED key_pyramid (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2485. key for the entrance of jail3
  2486. */
  2487. {
  2488. "key_pyramid",
  2489. Pickup_Key,
  2490. NULL,
  2491. Drop_General,
  2492. NULL,
  2493. "items/pkup.wav",
  2494. "models/items/keys/pyramid/tris.md2", EF_ROTATE,
  2495. NULL,
  2496. "k_pyramid",
  2497. "Pyramid Key",
  2498. 2,
  2499. 0,
  2500. NULL,
  2501. IT_STAY_COOP|IT_KEY,
  2502. 0,
  2503. NULL,
  2504. 0,
  2505. /* precache */ ""
  2506. },
  2507. /*QUAKED key_data_spinner (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2508. key for the city computer
  2509. */
  2510. {
  2511. "key_data_spinner",
  2512. Pickup_Key,
  2513. NULL,
  2514. Drop_General,
  2515. NULL,
  2516. "items/pkup.wav",
  2517. "models/items/keys/spinner/tris.md2", EF_ROTATE,
  2518. NULL,
  2519. "k_dataspin",
  2520. "Data Spinner",
  2521. 2,
  2522. 0,
  2523. NULL,
  2524. IT_STAY_COOP|IT_KEY,
  2525. 0,
  2526. NULL,
  2527. 0,
  2528. /* precache */ ""
  2529. },
  2530. /*QUAKED key_pass (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2531. security pass for the security level
  2532. */
  2533. {
  2534. "key_pass",
  2535. Pickup_Key,
  2536. NULL,
  2537. Drop_General,
  2538. NULL,
  2539. "items/pkup.wav",
  2540. "models/items/keys/pass/tris.md2", EF_ROTATE,
  2541. NULL,
  2542. "k_security",
  2543. "Security Pass",
  2544. 2,
  2545. 0,
  2546. NULL,
  2547. IT_STAY_COOP|IT_KEY,
  2548. 0,
  2549. NULL,
  2550. 0,
  2551. /* precache */ ""
  2552. },
  2553. /*QUAKED key_blue_key (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2554. normal door key - blue
  2555. */
  2556. {
  2557. "key_blue_key",
  2558. Pickup_Key,
  2559. NULL,
  2560. Drop_General,
  2561. NULL,
  2562. "items/pkup.wav",
  2563. "models/items/keys/key/tris.md2", EF_ROTATE,
  2564. NULL,
  2565. "k_bluekey",
  2566. "Blue Key",
  2567. 2,
  2568. 0,
  2569. NULL,
  2570. IT_STAY_COOP|IT_KEY,
  2571. 0,
  2572. NULL,
  2573. 0,
  2574. /* precache */ ""
  2575. },
  2576. /*QUAKED key_red_key (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2577. normal door key - red
  2578. */
  2579. {
  2580. "key_red_key",
  2581. Pickup_Key,
  2582. NULL,
  2583. Drop_General,
  2584. NULL,
  2585. "items/pkup.wav",
  2586. "models/items/keys/red_key/tris.md2", EF_ROTATE,
  2587. NULL,
  2588. "k_redkey",
  2589. "Red Key",
  2590. 2,
  2591. 0,
  2592. NULL,
  2593. IT_STAY_COOP|IT_KEY,
  2594. 0,
  2595. NULL,
  2596. 0,
  2597. /* precache */ ""
  2598. },
  2599. /*QUAKED key_commander_head (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2600. tank commander's head
  2601. */
  2602. {
  2603. "key_commander_head",
  2604. Pickup_Key,
  2605. NULL,
  2606. Drop_General,
  2607. NULL,
  2608. "items/pkup.wav",
  2609. "models/monsters/commandr/head/tris.md2", EF_GIB,
  2610. NULL,
  2611. /* icon */ "k_comhead",
  2612. /* pickup */ "Commander's Head",
  2613. /* width */ 2,
  2614. 0,
  2615. NULL,
  2616. IT_STAY_COOP|IT_KEY,
  2617. 0,
  2618. NULL,
  2619. 0,
  2620. /* precache */ ""
  2621. },
  2622. /*QUAKED key_airstrike_target (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2623. tank commander's head
  2624. */
  2625. {
  2626. "key_airstrike_target",
  2627. Pickup_Key,
  2628. NULL,
  2629. Drop_General,
  2630. NULL,
  2631. "items/pkup.wav",
  2632. "models/items/keys/target/tris.md2", EF_ROTATE,
  2633. NULL,
  2634. /* icon */ "i_airstrike",
  2635. /* pickup */ "Airstrike Marker",
  2636. /* width */ 2,
  2637. 0,
  2638. NULL,
  2639. IT_STAY_COOP|IT_KEY,
  2640. 0,
  2641. NULL,
  2642. 0,
  2643. /* precache */ ""
  2644. },
  2645. // ======================================
  2646. // PGM
  2647. /*QUAKED key_nuke_container (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2648. */
  2649. {
  2650. "key_nuke_container", // classname
  2651. Pickup_Key, // pickup function
  2652. NULL, // use function
  2653. Drop_General, // drop function
  2654. NULL, // weapon think function
  2655. "items/pkup.wav", // pick up sound
  2656. "models/weapons/g_nuke/tris.md2", // world model
  2657. EF_ROTATE, // world model flags
  2658. NULL, // view model
  2659. "i_contain", // icon
  2660. "Antimatter Pod", // name printed when picked up
  2661. 2, // number of digits for statusbar
  2662. 0, // respawn time
  2663. NULL, // ammo type used
  2664. IT_STAY_COOP|IT_KEY, // inventory flags
  2665. 0,
  2666. NULL, // info (void *)
  2667. 0, // tag
  2668. NULL, // precaches
  2669. },
  2670. /*QUAKED key_nuke (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2671. */
  2672. {
  2673. "key_nuke", // classname
  2674. Pickup_Key, // pickup function
  2675. NULL, // use function
  2676. Drop_General, // drop function
  2677. NULL, // weapon think function
  2678. "items/pkup.wav", // pick up sound
  2679. "models/weapons/g_nuke/tris.md2", // world model
  2680. EF_ROTATE, // world model flags
  2681. NULL, // view model
  2682. "i_nuke", // icon
  2683. "Antimatter Bomb", // name printed when picked up
  2684. 2, // number of digits for statusbar
  2685. 0, // respawn time
  2686. NULL, // ammo type used
  2687. IT_STAY_COOP|IT_KEY, // inventory flags
  2688. 0,
  2689. NULL, // info (void *)
  2690. 0, // tag
  2691. NULL, // precaches
  2692. },
  2693. // PGM
  2694. // ======================================
  2695. {
  2696. NULL,
  2697. Pickup_Health,
  2698. NULL,
  2699. NULL,
  2700. NULL,
  2701. "items/pkup.wav",
  2702. NULL, 0,
  2703. NULL,
  2704. /* icon */ "i_health",
  2705. /* pickup */ "Health",
  2706. /* width */ 3,
  2707. 0,
  2708. NULL,
  2709. 0,
  2710. 0,
  2711. NULL,
  2712. 0,
  2713. /* precache */ "items/s_health.wav items/n_health.wav items/l_health.wav items/m_health.wav" // PMM - health sound fix
  2714. },
  2715. // end of list marker
  2716. {NULL}
  2717. };
  2718. /*QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2719. */
  2720. void SP_item_health (edict_t *self)
  2721. {
  2722. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2723. {
  2724. G_FreeEdict (self);
  2725. return;
  2726. }
  2727. self->model = "models/items/healing/medium/tris.md2";
  2728. self->count = 10;
  2729. SpawnItem (self, FindItem ("Health"));
  2730. gi.soundindex ("items/n_health.wav");
  2731. }
  2732. /*QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2733. */
  2734. void SP_item_health_small (edict_t *self)
  2735. {
  2736. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2737. {
  2738. G_FreeEdict (self);
  2739. return;
  2740. }
  2741. self->model = "models/items/healing/stimpack/tris.md2";
  2742. self->count = 2;
  2743. SpawnItem (self, FindItem ("Health"));
  2744. self->style = HEALTH_IGNORE_MAX;
  2745. gi.soundindex ("items/s_health.wav");
  2746. }
  2747. /*QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2748. */
  2749. void SP_item_health_large (edict_t *self)
  2750. {
  2751. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2752. {
  2753. G_FreeEdict (self);
  2754. return;
  2755. }
  2756. self->model = "models/items/healing/large/tris.md2";
  2757. self->count = 25;
  2758. SpawnItem (self, FindItem ("Health"));
  2759. gi.soundindex ("items/l_health.wav");
  2760. }
  2761. /*QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
  2762. */
  2763. void SP_item_health_mega (edict_t *self)
  2764. {
  2765. if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
  2766. {
  2767. G_FreeEdict (self);
  2768. return;
  2769. }
  2770. self->model = "models/items/mega_h/tris.md2";
  2771. self->count = 100;
  2772. SpawnItem (self, FindItem ("Health"));
  2773. gi.soundindex ("items/m_health.wav");
  2774. self->style = HEALTH_IGNORE_MAX|HEALTH_TIMED;
  2775. }
  2776. void InitItems (void)
  2777. {
  2778. game.num_items = sizeof(itemlist)/sizeof(itemlist[0]) - 1;
  2779. }
  2780. /*
  2781. ===============
  2782. SetItemNames
  2783. Called by worldspawn
  2784. ===============
  2785. */
  2786. void SetItemNames (void)
  2787. {
  2788. int i;
  2789. gitem_t *it;
  2790. for (i=0 ; i<game.num_items ; i++)
  2791. {
  2792. it = &itemlist[i];
  2793. gi.configstring (CS_ITEMS+i, it->pickup_name);
  2794. }
  2795. jacket_armor_index = ITEM_INDEX(FindItem("Jacket Armor"));
  2796. combat_armor_index = ITEM_INDEX(FindItem("Combat Armor"));
  2797. body_armor_index = ITEM_INDEX(FindItem("Body Armor"));
  2798. power_screen_index = ITEM_INDEX(FindItem("Power Screen"));
  2799. power_shield_index = ITEM_INDEX(FindItem("Power Shield"));
  2800. }
  2801. //===============
  2802. //ROGUE
  2803. void SP_xatrix_item (edict_t *self)
  2804. {
  2805. gitem_t *item;
  2806. int i;
  2807. char *spawnClass;
  2808. if(!self->classname)
  2809. return;
  2810. if(!strcmp(self->classname, "ammo_magslug"))
  2811. spawnClass = "ammo_flechettes";
  2812. else if(!strcmp(self->classname, "ammo_trap"))
  2813. spawnClass = "weapon_proxlauncher";
  2814. else if(!strcmp(self->classname, "item_quadfire"))
  2815. {
  2816. float chance;
  2817. chance = random();
  2818. if(chance < 0.2)
  2819. spawnClass = "item_sphere_hunter";
  2820. else if (chance < 0.6)
  2821. spawnClass = "item_sphere_vengeance";
  2822. else
  2823. spawnClass = "item_sphere_defender";
  2824. }
  2825. else if(!strcmp(self->classname, "weapon_boomer"))
  2826. spawnClass = "weapon_etf_rifle";
  2827. else if(!strcmp(self->classname, "weapon_phalanx"))
  2828. spawnClass = "weapon_plasmabeam";
  2829. // check item spawn functions
  2830. for (i=0,item=itemlist ; i<game.num_items ; i++,item++)
  2831. {
  2832. if (!item->classname)
  2833. continue;
  2834. if (!strcmp(item->classname, spawnClass))
  2835. { // found it
  2836. SpawnItem (self, item);
  2837. return;
  2838. }
  2839. }
  2840. }
  2841. //ROGUE
  2842. //===============