12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212 |
- // Copyright (c) ZeniMax Media Inc.
- // Licensed under the GNU General Public License 2.0.
- #include "g_local.h"
- qboolean Pickup_Weapon (edict_t *ent, edict_t *other);
- void Use_Weapon (edict_t *ent, gitem_t *inv);
- void Drop_Weapon (edict_t *ent, gitem_t *inv);
- void Weapon_Blaster (edict_t *ent);
- void Weapon_Shotgun (edict_t *ent);
- void Weapon_SuperShotgun (edict_t *ent);
- void Weapon_Machinegun (edict_t *ent);
- void Weapon_Chaingun (edict_t *ent);
- void Weapon_HyperBlaster (edict_t *ent);
- void Weapon_RocketLauncher (edict_t *ent);
- void Weapon_Grenade (edict_t *ent);
- void Weapon_GrenadeLauncher (edict_t *ent);
- void Weapon_Railgun (edict_t *ent);
- void Weapon_BFG (edict_t *ent);
- //=========
- //Rogue Weapons
- void Weapon_ChainFist (edict_t *ent);
- void Weapon_Disintegrator (edict_t *ent);
- void Weapon_ETF_Rifle (edict_t *ent);
- void Weapon_Heatbeam (edict_t *ent);
- void Weapon_Prox (edict_t *ent);
- void Weapon_Tesla (edict_t *ent);
- void Weapon_ProxLauncher (edict_t *ent);
- //void Weapon_Nuke (edict_t *ent);
- //Rogue Weapons
- //=========
- gitem_armor_t jacketarmor_info = { 25, 50, .30, .00, ARMOR_JACKET};
- gitem_armor_t combatarmor_info = { 50, 100, .60, .30, ARMOR_COMBAT};
- gitem_armor_t bodyarmor_info = {100, 200, .80, .60, ARMOR_BODY};
- static int jacket_armor_index;
- static int combat_armor_index;
- static int body_armor_index;
- static int power_screen_index;
- static int power_shield_index;
- #define HEALTH_IGNORE_MAX 1
- #define HEALTH_TIMED 2
- void Use_Quad (edict_t *ent, gitem_t *item);
- static int quad_drop_timeout_hack;
- //======================================================================
- /*
- ===============
- GetItemByIndex
- ===============
- */
- gitem_t *GetItemByIndex (int index)
- {
- if (index == 0 || index >= game.num_items)
- return NULL;
- return &itemlist[index];
- }
- /*
- ===============
- FindItemByClassname
- ===============
- */
- gitem_t *FindItemByClassname (char *classname)
- {
- int i;
- gitem_t *it;
- it = itemlist;
- for (i=0 ; i<game.num_items ; i++, it++)
- {
- if (!it->classname)
- continue;
- if (!Q_stricmp(it->classname, classname))
- return it;
- }
- return NULL;
- }
- /*
- ===============
- FindItem
- ===============
- */
- gitem_t *FindItem (char *pickup_name)
- {
- int i;
- gitem_t *it;
- it = itemlist;
- for (i=0 ; i<game.num_items ; i++, it++)
- {
- if (!it->pickup_name)
- continue;
- if (!Q_stricmp(it->pickup_name, pickup_name))
- return it;
- }
- return NULL;
- }
- //======================================================================
- void DoRespawn (edict_t *ent)
- {
- if (ent->team)
- {
- edict_t *master;
- int count;
- int choice;
- master = ent->teammaster;
- for (count = 0, ent = master; ent; ent = ent->chain, count++)
- ;
- choice = rand() % count;
- for (count = 0, ent = master; count < choice; ent = ent->chain, count++)
- ;
- }
- //=====
- //ROGUE
- if(randomrespawn && randomrespawn->value)
- {
- edict_t *newEnt;
- newEnt = DoRandomRespawn (ent);
-
- // if we've changed entities, then do some sleight of hand.
- // otherwise, the old entity will respawn
- if(newEnt)
- {
- G_FreeEdict (ent);
- ent = newEnt;
- }
- }
- //ROGUE
- //=====
- ent->svflags &= ~SVF_NOCLIENT;
- ent->solid = SOLID_TRIGGER;
- gi.linkentity (ent);
- // send an effect
- ent->s.event = EV_ITEM_RESPAWN;
- }
- void SetRespawn (edict_t *ent, float delay)
- {
- ent->flags |= FL_RESPAWN;
- ent->svflags |= SVF_NOCLIENT;
- ent->solid = SOLID_NOT;
- ent->nextthink = level.time + delay;
- ent->think = DoRespawn;
- gi.linkentity (ent);
- }
- //======================================================================
- qboolean Pickup_Powerup (edict_t *ent, edict_t *other)
- {
- int quantity;
- quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
- if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
- return false;
- if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
- return false;
- other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
- if (deathmatch->value)
- {
- if (!(ent->spawnflags & DROPPED_ITEM) )
- SetRespawn (ent, ent->item->quantity);
- if (((int)dmflags->value & DF_INSTANT_ITEMS) || ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM)))
- {
- if ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM))
- quad_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME;
- //PGM
- if(ent->item->use)
- ent->item->use (other, ent->item);
- else
- gi.dprintf("Powerup has no use function!\n");
- //PGM
- }
- }
- return true;
- }
- void Drop_General (edict_t *ent, gitem_t *item)
- {
- Drop_Item (ent, item);
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- }
- //======================================================================
- qboolean Pickup_Adrenaline (edict_t *ent, edict_t *other)
- {
- if (!deathmatch->value)
- other->max_health += 1;
- if (other->health < other->max_health)
- other->health = other->max_health;
- if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
- SetRespawn (ent, ent->item->quantity);
- return true;
- }
- qboolean Pickup_AncientHead (edict_t *ent, edict_t *other)
- {
- other->max_health += 2;
- if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
- SetRespawn (ent, ent->item->quantity);
- return true;
- }
- qboolean Pickup_Bandolier (edict_t *ent, edict_t *other)
- {
- gitem_t *item;
- int index;
- if (other->client->pers.max_bullets < 250)
- other->client->pers.max_bullets = 250;
- if (other->client->pers.max_shells < 150)
- other->client->pers.max_shells = 150;
- if (other->client->pers.max_cells < 250)
- other->client->pers.max_cells = 250;
- if (other->client->pers.max_slugs < 75)
- other->client->pers.max_slugs = 75;
- //PMM
- if (other->client->pers.max_flechettes < 250)
- other->client->pers.max_flechettes = 250;
- #ifndef KILL_DISRUPTOR
- if (other->client->pers.max_rounds < 150)
- other->client->pers.max_rounds = 150;
- #endif
- //pmm
- item = FindItem("Bullets");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
- other->client->pers.inventory[index] = other->client->pers.max_bullets;
- }
- item = FindItem("Shells");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_shells)
- other->client->pers.inventory[index] = other->client->pers.max_shells;
- }
- if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
- SetRespawn (ent, ent->item->quantity);
- return true;
- }
- qboolean Pickup_Pack (edict_t *ent, edict_t *other)
- {
- gitem_t *item;
- int index;
- if (other->client->pers.max_bullets < 300)
- other->client->pers.max_bullets = 300;
- if (other->client->pers.max_shells < 200)
- other->client->pers.max_shells = 200;
- if (other->client->pers.max_rockets < 100)
- other->client->pers.max_rockets = 100;
- if (other->client->pers.max_grenades < 100)
- other->client->pers.max_grenades = 100;
- if (other->client->pers.max_cells < 300)
- other->client->pers.max_cells = 300;
- if (other->client->pers.max_slugs < 100)
- other->client->pers.max_slugs = 100;
- //PMM
- if (other->client->pers.max_flechettes < 200)
- other->client->pers.max_flechettes = 200;
- #ifndef KILL_DISRUPTOR
- if (other->client->pers.max_rounds < 200)
- other->client->pers.max_rounds = 200;
- #endif
- //pmm
- item = FindItem("Bullets");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
- other->client->pers.inventory[index] = other->client->pers.max_bullets;
- }
- item = FindItem("Shells");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_shells)
- other->client->pers.inventory[index] = other->client->pers.max_shells;
- }
- item = FindItem("Cells");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_cells)
- other->client->pers.inventory[index] = other->client->pers.max_cells;
- }
- item = FindItem("Grenades");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_grenades)
- other->client->pers.inventory[index] = other->client->pers.max_grenades;
- }
- item = FindItem("Rockets");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_rockets)
- other->client->pers.inventory[index] = other->client->pers.max_rockets;
- }
- item = FindItem("Slugs");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_slugs)
- other->client->pers.inventory[index] = other->client->pers.max_slugs;
- }
- //PMM
- item = FindItem("Flechettes");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_flechettes)
- other->client->pers.inventory[index] = other->client->pers.max_flechettes;
- }
- #ifndef KILL_DISRUPTOR
- item = FindItem("Rounds");
- if (item)
- {
- index = ITEM_INDEX(item);
- other->client->pers.inventory[index] += item->quantity;
- if (other->client->pers.inventory[index] > other->client->pers.max_rounds)
- other->client->pers.inventory[index] = other->client->pers.max_rounds;
- }
- #endif
- //pmm
- if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
- SetRespawn (ent, ent->item->quantity);
- return true;
- }
- // ================
- // PMM
- qboolean Pickup_Nuke (edict_t *ent, edict_t *other)
- {
- int quantity;
- // if (!deathmatch->value)
- // return;
- quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
- // if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
- // return false;
- if (quantity >= 1)
- return false;
- if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
- return false;
- other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
- if (deathmatch->value)
- {
- if (!(ent->spawnflags & DROPPED_ITEM) )
- SetRespawn (ent, ent->item->quantity);
- }
- return true;
- }
- // ================
- // PGM
- void Use_IR (edict_t *ent, gitem_t *item)
- {
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- if (ent->client->ir_framenum > level.framenum)
- ent->client->ir_framenum += 600;
- else
- ent->client->ir_framenum = level.framenum + 600;
- gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/ir_start.wav"), 1, ATTN_NORM, 0);
- }
- void Use_Double (edict_t *ent, gitem_t *item)
- {
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- if (ent->client->double_framenum > level.framenum)
- ent->client->double_framenum += 300;
- else
- ent->client->double_framenum = level.framenum + 300;
- gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/ddamage1.wav"), 1, ATTN_NORM, 0);
- }
- /*
- void Use_Torch (edict_t *ent, gitem_t *item)
- {
- ent->client->torch_framenum = level.framenum + 600;
- }
- */
- void Use_Compass (edict_t *ent, gitem_t *item)
- {
- int ang;
- ang = (int)(ent->client->v_angle[1]);
- if(ang<0)
- ang += 360;
- gi.cprintf(ent, PRINT_HIGH, "Origin: %0.0f,%0.0f,%0.0f Dir: %d\n", ent->s.origin[0], ent->s.origin[1],
- ent->s.origin[2], ang);
- }
- void Use_Nuke (edict_t *ent, gitem_t *item)
- {
- vec3_t forward, right, start;
- float speed;
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- AngleVectors (ent->client->v_angle, forward, right, NULL);
- VectorCopy (ent->s.origin, start);
- speed = 100;
- fire_nuke (ent, start, forward, speed);
- }
- void Use_Doppleganger (edict_t *ent, gitem_t *item)
- {
- vec3_t forward, right;
- vec3_t createPt, spawnPt;
- vec3_t ang;
- VectorClear(ang);
- ang[YAW] = ent->client->v_angle[YAW];
- AngleVectors (ang, forward, right, NULL);
- VectorMA(ent->s.origin, 48, forward, createPt);
- if(!FindSpawnPoint(createPt, ent->mins, ent->maxs, spawnPt, 32))
- return;
- if(!CheckGroundSpawnPoint(spawnPt, ent->mins, ent->maxs, 64, -1))
- return;
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- SpawnGrow_Spawn (spawnPt, 0);
- fire_doppleganger (ent, spawnPt, forward);
- }
- qboolean Pickup_Doppleganger (edict_t *ent, edict_t *other)
- {
- int quantity;
- if(!(deathmatch->value)) // item is DM only
- return false;
- quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
- if (quantity >= 1) // FIXME - apply max to dopplegangers
- return false;
- other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
- if (!(ent->spawnflags & DROPPED_ITEM) )
- SetRespawn (ent, ent->item->quantity);
- return true;
- }
- qboolean Pickup_Sphere (edict_t *ent, edict_t *other)
- {
- int quantity;
- if(other->client && other->client->owned_sphere)
- {
- // gi.cprintf(other, PRINT_HIGH, "Only one sphere to a customer!\n");
- return false;
- }
- quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
- if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
- return false;
- if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
- return false;
- other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
- if (deathmatch->value)
- {
- if (!(ent->spawnflags & DROPPED_ITEM) )
- SetRespawn (ent, ent->item->quantity);
- if (((int)dmflags->value & DF_INSTANT_ITEMS))
- {
- //PGM
- if(ent->item->use)
- ent->item->use (other, ent->item);
- else
- gi.dprintf("Powerup has no use function!\n");
- //PGM
- }
- }
- return true;
- }
- void Use_Defender (edict_t *ent, gitem_t *item)
- {
- if(ent->client && ent->client->owned_sphere)
- {
- gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n");
- return;
- }
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- Defender_Launch (ent);
- }
- void Use_Hunter (edict_t *ent, gitem_t *item)
- {
- if(ent->client && ent->client->owned_sphere)
- {
- gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n");
- return;
- }
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- Hunter_Launch (ent);
- }
- void Use_Vengeance (edict_t *ent, gitem_t *item)
- {
- if(ent->client && ent->client->owned_sphere)
- {
- gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n");
- return;
- }
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- Vengeance_Launch (ent);
- }
- // PGM
- // ================
- //======================================================================
- void Use_Quad (edict_t *ent, gitem_t *item)
- {
- int timeout;
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- if (quad_drop_timeout_hack)
- {
- timeout = quad_drop_timeout_hack;
- quad_drop_timeout_hack = 0;
- }
- else
- {
- timeout = 300;
- }
- if (ent->client->quad_framenum > level.framenum)
- ent->client->quad_framenum += timeout;
- else
- ent->client->quad_framenum = level.framenum + timeout;
- gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
- }
- //======================================================================
- void Use_Breather (edict_t *ent, gitem_t *item)
- {
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- if (ent->client->breather_framenum > level.framenum)
- ent->client->breather_framenum += 300;
- else
- ent->client->breather_framenum = level.framenum + 300;
- // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
- }
- //======================================================================
- void Use_Envirosuit (edict_t *ent, gitem_t *item)
- {
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- if (ent->client->enviro_framenum > level.framenum)
- ent->client->enviro_framenum += 300;
- else
- ent->client->enviro_framenum = level.framenum + 300;
- // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
- }
- //======================================================================
- void Use_Invulnerability (edict_t *ent, gitem_t *item)
- {
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- if (ent->client->invincible_framenum > level.framenum)
- ent->client->invincible_framenum += 300;
- else
- ent->client->invincible_framenum = level.framenum + 300;
- gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0);
- }
- //======================================================================
- void Use_Silencer (edict_t *ent, gitem_t *item)
- {
- ent->client->pers.inventory[ITEM_INDEX(item)]--;
- ValidateSelectedItem (ent);
- ent->client->silencer_shots += 30;
- // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
- }
- //======================================================================
- qboolean Pickup_Key (edict_t *ent, edict_t *other)
- {
- if (coop->value)
- {
- if (strcmp(ent->classname, "key_power_cube") == 0)
- {
- if (other->client->pers.power_cubes & ((ent->spawnflags & 0x0000ff00)>> 8))
- return false;
- other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
- other->client->pers.power_cubes |= ((ent->spawnflags & 0x0000ff00) >> 8);
- }
- else
- {
- if (other->client->pers.inventory[ITEM_INDEX(ent->item)])
- return false;
- other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1;
- }
- return true;
- }
- other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
- return true;
- }
- //======================================================================
- qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count)
- {
- int index;
- int max;
- if (!ent->client)
- return false;
- if (item->tag == AMMO_BULLETS)
- max = ent->client->pers.max_bullets;
- else if (item->tag == AMMO_SHELLS)
- max = ent->client->pers.max_shells;
- else if (item->tag == AMMO_ROCKETS)
- max = ent->client->pers.max_rockets;
- else if (item->tag == AMMO_GRENADES)
- max = ent->client->pers.max_grenades;
- else if (item->tag == AMMO_CELLS)
- max = ent->client->pers.max_cells;
- else if (item->tag == AMMO_SLUGS)
- max = ent->client->pers.max_slugs;
- // ROGUE
- // else if (item->tag == AMMO_MINES)
- // max = ent->client->pers.max_mines;
- else if (item->tag == AMMO_FLECHETTES)
- max = ent->client->pers.max_flechettes;
- else if (item->tag == AMMO_PROX)
- max = ent->client->pers.max_prox;
- else if (item->tag == AMMO_TESLA)
- max = ent->client->pers.max_tesla;
- #ifndef KILL_DISRUPTOR
- else if (item->tag == AMMO_DISRUPTOR)
- max = ent->client->pers.max_rounds;
- #endif
- // ROGUE
- else
- {
- gi.dprintf("undefined ammo type\n");
- return false;
- }
- index = ITEM_INDEX(item);
- if (ent->client->pers.inventory[index] == max)
- return false;
- ent->client->pers.inventory[index] += count;
- if (ent->client->pers.inventory[index] > max)
- ent->client->pers.inventory[index] = max;
- return true;
- }
- qboolean Pickup_Ammo (edict_t *ent, edict_t *other)
- {
- int oldcount;
- int count;
- qboolean weapon;
- weapon = (ent->item->flags & IT_WEAPON);
- if ( (weapon) && ( (int)dmflags->value & DF_INFINITE_AMMO ) )
- count = 1000;
- else if (ent->count)
- count = ent->count;
- else
- count = ent->item->quantity;
- oldcount = other->client->pers.inventory[ITEM_INDEX(ent->item)];
- if (!Add_Ammo (other, ent->item, count))
- return false;
- if (weapon && !oldcount)
- {
- // don't switch to tesla
- if (other->client->pers.weapon != ent->item
- && ( !deathmatch->value || other->client->pers.weapon == FindItem("blaster"))
- && (strcmp(ent->classname, "ammo_tesla")) )
- other->client->newweapon = ent->item;
- }
- if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (deathmatch->value))
- SetRespawn (ent, 30);
- return true;
- }
- void Drop_Ammo (edict_t *ent, gitem_t *item)
- {
- edict_t *dropped;
- int index;
- index = ITEM_INDEX(item);
- dropped = Drop_Item (ent, item);
- if (ent->client->pers.inventory[index] >= item->quantity)
- dropped->count = item->quantity;
- else
- dropped->count = ent->client->pers.inventory[index];
- if (ent->client->pers.weapon &&
- ent->client->pers.weapon->tag == AMMO_GRENADES &&
- item->tag == AMMO_GRENADES &&
- ent->client->pers.inventory[index] - dropped->count <= 0) {
- gi.cprintf (ent, PRINT_HIGH, "Can't drop current weapon\n");
- G_FreeEdict(dropped);
- return;
- }
- ent->client->pers.inventory[index] -= dropped->count;
- ValidateSelectedItem (ent);
- }
- //======================================================================
- void MegaHealth_think (edict_t *self)
- {
- if (self->owner->health > self->owner->max_health)
- {
- self->nextthink = level.time + 1;
- self->owner->health -= 1;
- return;
- }
- if (!(self->spawnflags & DROPPED_ITEM) && (deathmatch->value))
- SetRespawn (self, 20);
- else
- G_FreeEdict (self);
- }
- qboolean Pickup_Health (edict_t *ent, edict_t *other)
- {
- if (!(ent->style & HEALTH_IGNORE_MAX))
- if (other->health >= other->max_health)
- return false;
- other->health += ent->count;
- // PMM - health sound fix
- /*
- if (ent->count == 2)
- ent->item->pickup_sound = "items/s_health.wav";
- else if (ent->count == 10)
- ent->item->pickup_sound = "items/n_health.wav";
- else if (ent->count == 25)
- ent->item->pickup_sound = "items/l_health.wav";
- else // (ent->count == 100)
- ent->item->pickup_sound = "items/m_health.wav";
- */
- if (!(ent->style & HEALTH_IGNORE_MAX))
- {
- if (other->health > other->max_health)
- other->health = other->max_health;
- }
- if (ent->style & HEALTH_TIMED)
- {
- ent->think = MegaHealth_think;
- ent->nextthink = level.time + 5;
- ent->owner = other;
- ent->flags |= FL_RESPAWN;
- ent->svflags |= SVF_NOCLIENT;
- ent->solid = SOLID_NOT;
- }
- else
- {
- if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
- SetRespawn (ent, 30);
- }
- return true;
- }
- //======================================================================
- int ArmorIndex (edict_t *ent)
- {
- if (!ent->client)
- return 0;
- if (ent->client->pers.inventory[jacket_armor_index] > 0)
- return jacket_armor_index;
- if (ent->client->pers.inventory[combat_armor_index] > 0)
- return combat_armor_index;
- if (ent->client->pers.inventory[body_armor_index] > 0)
- return body_armor_index;
- return 0;
- }
- qboolean Pickup_Armor (edict_t *ent, edict_t *other)
- {
- int old_armor_index;
- gitem_armor_t *oldinfo;
- gitem_armor_t *newinfo;
- int newcount;
- float salvage;
- int salvagecount;
- // get info on new armor
- newinfo = (gitem_armor_t *)ent->item->info;
- old_armor_index = ArmorIndex (other);
- // handle armor shards specially
- if (ent->item->tag == ARMOR_SHARD)
- {
- if (!old_armor_index)
- other->client->pers.inventory[jacket_armor_index] = 2;
- else
- other->client->pers.inventory[old_armor_index] += 2;
- }
- // if player has no armor, just use it
- else if (!old_armor_index)
- {
- other->client->pers.inventory[ITEM_INDEX(ent->item)] = newinfo->base_count;
- }
- // use the better armor
- else
- {
- // get info on old armor
- if (old_armor_index == jacket_armor_index)
- oldinfo = &jacketarmor_info;
- else if (old_armor_index == combat_armor_index)
- oldinfo = &combatarmor_info;
- else // (old_armor_index == body_armor_index)
- oldinfo = &bodyarmor_info;
- if (newinfo->normal_protection > oldinfo->normal_protection)
- {
- // calc new armor values
- salvage = oldinfo->normal_protection / newinfo->normal_protection;
- salvagecount = salvage * other->client->pers.inventory[old_armor_index];
- newcount = newinfo->base_count + salvagecount;
- if (newcount > newinfo->max_count)
- newcount = newinfo->max_count;
- // zero count of old armor so it goes away
- other->client->pers.inventory[old_armor_index] = 0;
- // change armor to new item with computed value
- other->client->pers.inventory[ITEM_INDEX(ent->item)] = newcount;
- }
- else
- {
- // calc new armor values
- salvage = newinfo->normal_protection / oldinfo->normal_protection;
- salvagecount = salvage * newinfo->base_count;
- newcount = other->client->pers.inventory[old_armor_index] + salvagecount;
- if (newcount > oldinfo->max_count)
- newcount = oldinfo->max_count;
- // if we're already maxed out then we don't need the new armor
- if (other->client->pers.inventory[old_armor_index] >= newcount)
- return false;
- // update current armor value
- other->client->pers.inventory[old_armor_index] = newcount;
- }
- }
- if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
- SetRespawn (ent, 20);
- return true;
- }
- //======================================================================
- int PowerArmorType (edict_t *ent)
- {
- if (!ent->client)
- return POWER_ARMOR_NONE;
- if (!(ent->flags & FL_POWER_ARMOR))
- return POWER_ARMOR_NONE;
- if (ent->client->pers.inventory[power_shield_index] > 0)
- return POWER_ARMOR_SHIELD;
- if (ent->client->pers.inventory[power_screen_index] > 0)
- return POWER_ARMOR_SCREEN;
- return POWER_ARMOR_NONE;
- }
- void Use_PowerArmor (edict_t *ent, gitem_t *item)
- {
- int index;
- if (ent->flags & FL_POWER_ARMOR)
- {
- ent->flags &= ~FL_POWER_ARMOR;
- gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
- }
- else
- {
- index = ITEM_INDEX(FindItem("cells"));
- if (!ent->client->pers.inventory[index])
- {
- gi.cprintf (ent, PRINT_HIGH, "No cells for power armor.\n");
- return;
- }
- ent->flags |= FL_POWER_ARMOR;
- gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power1.wav"), 1, ATTN_NORM, 0);
- }
- }
- qboolean Pickup_PowerArmor (edict_t *ent, edict_t *other)
- {
- int quantity;
- quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
- other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
- if (deathmatch->value)
- {
- if (!(ent->spawnflags & DROPPED_ITEM) )
- SetRespawn (ent, ent->item->quantity);
- // auto-use for DM only if we didn't already have one
- if (!quantity)
- ent->item->use (other, ent->item);
- }
- return true;
- }
- void Drop_PowerArmor (edict_t *ent, gitem_t *item)
- {
- if ((ent->flags & FL_POWER_ARMOR) && (ent->client->pers.inventory[ITEM_INDEX(item)] == 1))
- Use_PowerArmor (ent, item);
- Drop_General (ent, item);
- }
- //======================================================================
- /*
- ===============
- Touch_Item
- ===============
- */
- void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
- {
- qboolean taken;
- if (!other->client)
- return;
- if (other->health < 1)
- return; // dead people can't pickup
- if (!ent->item->pickup)
- return; // not a grabbable item?
- taken = ent->item->pickup(ent, other);
- if (taken)
- {
- // flash the screen
- other->client->bonus_alpha = 0.25;
- // show icon and name on status bar
- other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
- other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
- other->client->pickup_msg_time = level.time + 3.0;
- // change selected item
- if (ent->item->use)
- other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX(ent->item);
- // PMM - health sound fix
- if (ent->item->pickup == Pickup_Health)
- {
- if (ent->count == 2)
- gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
- else if (ent->count == 10)
- gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
- else if (ent->count == 25)
- gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
- else // (ent->count == 100)
- gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
- }
- else if (ent->item->pickup_sound) // PGM - paranoia
- {
- //
- gi.sound(other, CHAN_ITEM, gi.soundindex(ent->item->pickup_sound), 1, ATTN_NORM, 0);
- }
- }
- if (!(ent->spawnflags & ITEM_TARGETS_USED))
- {
- G_UseTargets (ent, other);
- ent->spawnflags |= ITEM_TARGETS_USED;
- }
- if (!taken)
- return;
- if (!((coop->value) && (ent->item->flags & IT_STAY_COOP)) || (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)))
- {
- if (ent->flags & FL_RESPAWN)
- ent->flags &= ~FL_RESPAWN;
- else
- G_FreeEdict (ent);
- }
- }
- //======================================================================
- static void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
- {
- if (other == ent->owner)
- return;
- Touch_Item (ent, other, plane, surf);
- }
- static void drop_make_touchable (edict_t *ent)
- {
- ent->touch = Touch_Item;
- if (deathmatch->value)
- {
- ent->nextthink = level.time + 29;
- ent->think = G_FreeEdict;
- }
- }
- edict_t *Drop_Item (edict_t *ent, gitem_t *item)
- {
- edict_t *dropped;
- vec3_t forward, right;
- vec3_t offset;
- dropped = G_Spawn();
- dropped->classname = item->classname;
- dropped->item = item;
- dropped->spawnflags = DROPPED_ITEM;
- dropped->s.effects = item->world_model_flags;
- dropped->s.renderfx = RF_GLOW | RF_IR_VISIBLE; // PGM
- VectorSet (dropped->mins, -15, -15, -15);
- VectorSet (dropped->maxs, 15, 15, 15);
- gi.setmodel (dropped, dropped->item->world_model);
- dropped->solid = SOLID_TRIGGER;
- dropped->movetype = MOVETYPE_TOSS;
- dropped->touch = drop_temp_touch;
- dropped->owner = ent;
- if (ent->client)
- {
- trace_t trace;
- AngleVectors (ent->client->v_angle, forward, right, NULL);
- VectorSet(offset, 24, 0, -16);
- G_ProjectSource (ent->s.origin, offset, forward, right, dropped->s.origin);
- trace = gi.trace (ent->s.origin, dropped->mins, dropped->maxs,
- dropped->s.origin, ent, CONTENTS_SOLID);
- VectorCopy (trace.endpos, dropped->s.origin);
- }
- else
- {
- AngleVectors (ent->s.angles, forward, right, NULL);
- VectorCopy (ent->s.origin, dropped->s.origin);
- }
- VectorScale (forward, 100, dropped->velocity);
- dropped->velocity[2] = 300;
- dropped->think = drop_make_touchable;
- dropped->nextthink = level.time + 1;
- gi.linkentity (dropped);
- return dropped;
- }
- void Use_Item (edict_t *ent, edict_t *other, edict_t *activator)
- {
- ent->svflags &= ~SVF_NOCLIENT;
- ent->use = NULL;
- if (ent->spawnflags & ITEM_NO_TOUCH)
- {
- ent->solid = SOLID_BBOX;
- ent->touch = NULL;
- }
- else
- {
- ent->solid = SOLID_TRIGGER;
- ent->touch = Touch_Item;
- }
- gi.linkentity (ent);
- }
- //======================================================================
- /*
- ================
- droptofloor
- ================
- */
- void droptofloor (edict_t *ent)
- {
- trace_t tr;
- vec3_t dest;
- float *v;
- v = tv(-15,-15,-15);
- VectorCopy (v, ent->mins);
- v = tv(15,15,15);
- VectorCopy (v, ent->maxs);
- if (ent->model)
- gi.setmodel (ent, ent->model);
- else if (ent->item->world_model) // PGM we shouldn't need this check, but paranoia...
- gi.setmodel (ent, ent->item->world_model);
- ent->solid = SOLID_TRIGGER;
- ent->movetype = MOVETYPE_TOSS;
- ent->touch = Touch_Item;
- v = tv(0,0,-128);
- VectorAdd (ent->s.origin, v, dest);
- tr = gi.trace (ent->s.origin, ent->mins, ent->maxs, dest, ent, MASK_SOLID);
- if (tr.startsolid)
- {
- gi.dprintf ("droptofloor: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin));
- G_FreeEdict (ent);
- return;
- }
- VectorCopy (tr.endpos, ent->s.origin);
- if (ent->team)
- {
- ent->flags &= ~FL_TEAMSLAVE;
- ent->chain = ent->teamchain;
- ent->teamchain = NULL;
- ent->svflags |= SVF_NOCLIENT;
- ent->solid = SOLID_NOT;
- if (ent == ent->teammaster)
- {
- ent->nextthink = level.time + FRAMETIME;
- ent->think = DoRespawn;
- }
- }
- if (ent->spawnflags & ITEM_NO_TOUCH)
- {
- ent->solid = SOLID_BBOX;
- ent->touch = NULL;
- ent->s.effects &= ~EF_ROTATE;
- ent->s.renderfx &= ~RF_GLOW;
- }
- if (ent->spawnflags & ITEM_TRIGGER_SPAWN)
- {
- ent->svflags |= SVF_NOCLIENT;
- ent->solid = SOLID_NOT;
- ent->use = Use_Item;
- }
- gi.linkentity (ent);
- }
- /*
- ===============
- PrecacheItem
- Precaches all data needed for a given item.
- This will be called for each item spawned in a level,
- and for each item in each client's inventory.
- ===============
- */
- void PrecacheItem (gitem_t *it)
- {
- char *s, *start;
- char data[MAX_QPATH];
- int len;
- gitem_t *ammo;
- if (!it)
- return;
- if (it->pickup_sound)
- gi.soundindex (it->pickup_sound);
- if (it->world_model)
- gi.modelindex (it->world_model);
- if (it->view_model)
- gi.modelindex (it->view_model);
- if (it->icon)
- gi.imageindex (it->icon);
- // parse everything for its ammo
- if (it->ammo && it->ammo[0])
- {
- ammo = FindItem (it->ammo);
- if (ammo != it)
- PrecacheItem (ammo);
- }
- // parse the space seperated precache string for other items
- s = it->precaches;
- if (!s || !s[0])
- return;
- while (*s)
- {
- start = s;
- while (*s && *s != ' ')
- s++;
- len = s-start;
- if (len >= MAX_QPATH || len < 5)
- gi.error ("PrecacheItem: %s has bad precache string", it->classname);
- memcpy (data, start, len);
- data[len] = 0;
- if (*s)
- s++;
- // determine type based on extension
- if (!strcmp(data+len-3, "md2"))
- gi.modelindex (data);
- else if (!strcmp(data+len-3, "sp2"))
- gi.modelindex (data);
- else if (!strcmp(data+len-3, "wav"))
- gi.soundindex (data);
- if (!strcmp(data+len-3, "pcx"))
- gi.imageindex (data);
- }
- }
- //=================
- // Item_TriggeredSpawn - create the item marked for spawn creation
- //=================
- void Item_TriggeredSpawn (edict_t *self, edict_t *other, edict_t *activator)
- {
- // self->nextthink = level.time + 2 * FRAMETIME; // items start after other solids
- // self->think = droptofloor;
- self->svflags &= ~SVF_NOCLIENT;
- self->use = NULL;
- if(strcmp(self->classname, "key_power_cube")) // leave them be on key_power_cube..
- self->spawnflags = 0;
- droptofloor (self);
- }
- //=================
- // SetTriggeredSpawn - set up an item to spawn in later.
- //=================
- void SetTriggeredSpawn (edict_t *ent)
- {
- // don't do anything on key_power_cubes.
- if(!strcmp(ent->classname, "key_power_cube"))
- return;
- ent->think = NULL;
- ent->nextthink = 0;
- ent->use = Item_TriggeredSpawn;
- ent->svflags |= SVF_NOCLIENT;
- ent->solid = SOLID_NOT;
- }
- /*
- ============
- SpawnItem
- Sets the clipping size and plants the object on the floor.
- Items can't be immediately dropped to floor, because they might
- be on an entity that hasn't spawned yet.
- ============
- */
- void SpawnItem (edict_t *ent, gitem_t *item)
- {
- #if KILL_DISRUPTOR
- if ((!strcmp(ent->classname, "ammo_disruptor")) || (!strcmp(ent->classname, "weapon_disintegrator")))
- {
- G_FreeEdict (ent);
- return;
- }
- #endif
- // PGM - since the item may be freed by the following rules, go ahead
- // and move the precache until AFTER the following rules have been checked.
- // keep an eye on this.
- // PrecacheItem (item);
- if (ent->spawnflags > 1) // PGM
- {
- if (strcmp(ent->classname, "key_power_cube") != 0)
- {
- ent->spawnflags = 0;
- gi.dprintf("%s at %s has invalid spawnflags set\n", ent->classname, vtos(ent->s.origin));
- }
- }
- // some items will be prevented in deathmatch
- if (deathmatch->value)
- {
- if ( (int)dmflags->value & DF_NO_ARMOR )
- {
- if (item->pickup == Pickup_Armor || item->pickup == Pickup_PowerArmor)
- {
- G_FreeEdict (ent);
- return;
- }
- }
- if ( (int)dmflags->value & DF_NO_ITEMS )
- {
- if (item->pickup == Pickup_Powerup)
- {
- G_FreeEdict (ent);
- return;
- }
- //=====
- //ROGUE
- if (item->pickup == Pickup_Sphere)
- {
- G_FreeEdict (ent);
- return;
- }
- if (item->pickup == Pickup_Doppleganger)
- {
- G_FreeEdict (ent);
- return;
- }
- //ROGUE
- //=====
- }
- if ( (int)dmflags->value & DF_NO_HEALTH )
- {
- if (item->pickup == Pickup_Health || item->pickup == Pickup_Adrenaline || item->pickup == Pickup_AncientHead)
- {
- G_FreeEdict (ent);
- return;
- }
- }
- if ( (int)dmflags->value & DF_INFINITE_AMMO )
- {
- if ( (item->flags == IT_AMMO) || (strcmp(ent->classname, "weapon_bfg") == 0) )
- {
- G_FreeEdict (ent);
- return;
- }
- }
- //==========
- //ROGUE
- if ( (int)dmflags->value & DF_NO_MINES )
- {
- if ( !strcmp(ent->classname, "ammo_prox") ||
- !strcmp(ent->classname, "ammo_tesla") )
- {
- G_FreeEdict (ent);
- return;
- }
- }
- if ( (int)dmflags->value & DF_NO_NUKES )
- {
- if ( !strcmp(ent->classname, "ammo_nuke") )
- {
- G_FreeEdict (ent);
- return;
- }
- }
- if ( (int)dmflags->value & DF_NO_SPHERES )
- {
- if (item->pickup == Pickup_Sphere)
- {
- G_FreeEdict (ent);
- return;
- }
- }
- //ROGUE
- //==========
- }
- //==========
- //ROGUE
- // DM only items
- if (!deathmatch->value)
- {
- if (item->pickup == Pickup_Doppleganger || item->pickup == Pickup_Nuke)
- {
- G_FreeEdict (ent);
- return;
- }
- if ((item->use == Use_Vengeance) || (item->use == Use_Hunter))
- {
- G_FreeEdict (ent);
- return;
- }
- }
- //ROGUE
- //==========
- //PGM
- PrecacheItem (item);
- //PGM
- if (coop->value && (strcmp(ent->classname, "key_power_cube") == 0))
- {
- ent->spawnflags |= (1 << (8 + level.power_cubes));
- level.power_cubes++;
- }
- // don't let them drop items that stay in a coop game
- if ((coop->value) && (item->flags & IT_STAY_COOP))
- {
- item->drop = NULL;
- }
- ent->item = item;
- ent->nextthink = level.time + 2 * FRAMETIME; // items start after other solids
- ent->think = droptofloor;
- ent->s.effects = item->world_model_flags;
- ent->s.renderfx = RF_GLOW;
- if (ent->model)
- gi.modelindex (ent->model);
- if (ent->spawnflags & 1)
- SetTriggeredSpawn (ent);
- }
- //======================================================================
- gitem_t itemlist[] =
- {
- {
- NULL
- }, // leave index 0 alone
- //
- // ARMOR
- //
- /*QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_armor_body",
- Pickup_Armor,
- NULL,
- NULL,
- NULL,
- "misc/ar1_pkup.wav",
- "models/items/armor/body/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_bodyarmor",
- /* pickup */ "Body Armor",
- /* width */ 3,
- 0,
- NULL,
- IT_ARMOR,
- 0,
- &bodyarmor_info,
- ARMOR_BODY,
- /* precache */ ""
- },
- /*QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_armor_combat",
- Pickup_Armor,
- NULL,
- NULL,
- NULL,
- "misc/ar1_pkup.wav",
- "models/items/armor/combat/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_combatarmor",
- /* pickup */ "Combat Armor",
- /* width */ 3,
- 0,
- NULL,
- IT_ARMOR,
- 0,
- &combatarmor_info,
- ARMOR_COMBAT,
- /* precache */ ""
- },
- /*QUAKED item_armor_jacket (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_armor_jacket",
- Pickup_Armor,
- NULL,
- NULL,
- NULL,
- "misc/ar1_pkup.wav",
- "models/items/armor/jacket/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_jacketarmor",
- /* pickup */ "Jacket Armor",
- /* width */ 3,
- 0,
- NULL,
- IT_ARMOR,
- 0,
- &jacketarmor_info,
- ARMOR_JACKET,
- /* precache */ ""
- },
- /*QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_armor_shard",
- Pickup_Armor,
- NULL,
- NULL,
- NULL,
- "misc/ar2_pkup.wav",
- "models/items/armor/shard/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_jacketarmor",
- /* pickup */ "Armor Shard",
- /* width */ 3,
- 0,
- NULL,
- IT_ARMOR,
- 0,
- NULL,
- ARMOR_SHARD,
- /* precache */ ""
- },
- /*QUAKED item_power_screen (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_power_screen",
- Pickup_PowerArmor,
- Use_PowerArmor,
- Drop_PowerArmor,
- NULL,
- "misc/ar3_pkup.wav",
- "models/items/armor/screen/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_powerscreen",
- /* pickup */ "Power Screen",
- /* width */ 0,
- 60,
- NULL,
- IT_ARMOR,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED item_power_shield (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_power_shield",
- Pickup_PowerArmor,
- Use_PowerArmor,
- Drop_PowerArmor,
- NULL,
- "misc/ar3_pkup.wav",
- "models/items/armor/shield/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_powershield",
- /* pickup */ "Power Shield",
- /* width */ 0,
- 60,
- NULL,
- IT_ARMOR,
- 0,
- NULL,
- 0,
- /* precache */ "misc/power2.wav misc/power1.wav"
- },
- //
- // WEAPONS
- //
- /* weapon_blaster (.3 .3 1) (-16 -16 -16) (16 16 16)
- always owned, never in the world
- */
- {
- "weapon_blaster",
- NULL,
- Use_Weapon,
- NULL,
- Weapon_Blaster,
- "misc/w_pkup.wav",
- NULL, 0,
- "models/weapons/v_blast/tris.md2",
- /* icon */ "w_blaster",
- /* pickup */ "Blaster",
- 0,
- 0,
- NULL,
- IT_WEAPON|IT_STAY_COOP,
- WEAP_BLASTER,
- NULL,
- 0,
- /* precache */ "weapons/blastf1a.wav misc/lasfly.wav"
- },
- /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_shotgun",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_Shotgun,
- "misc/w_pkup.wav",
- "models/weapons/g_shotg/tris.md2", EF_ROTATE,
- "models/weapons/v_shotg/tris.md2",
- /* icon */ "w_shotgun",
- /* pickup */ "Shotgun",
- 0,
- 1,
- "Shells",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_SHOTGUN,
- NULL,
- 0,
- /* precache */ "weapons/shotgf1b.wav weapons/shotgr1b.wav"
- },
- /*QUAKED weapon_supershotgun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_supershotgun",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_SuperShotgun,
- "misc/w_pkup.wav",
- "models/weapons/g_shotg2/tris.md2", EF_ROTATE,
- "models/weapons/v_shotg2/tris.md2",
- /* icon */ "w_sshotgun",
- /* pickup */ "Super Shotgun",
- 0,
- 2,
- "Shells",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_SUPERSHOTGUN,
- NULL,
- 0,
- /* precache */ "weapons/sshotf1b.wav"
- },
- /*QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_machinegun",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_Machinegun,
- "misc/w_pkup.wav",
- "models/weapons/g_machn/tris.md2", EF_ROTATE,
- "models/weapons/v_machn/tris.md2",
- /* icon */ "w_machinegun",
- /* pickup */ "Machinegun",
- 0,
- 1,
- "Bullets",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_MACHINEGUN,
- NULL,
- 0,
- /* precache */ "weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf4b.wav weapons/machgf5b.wav"
- },
- /*QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_chaingun",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_Chaingun,
- "misc/w_pkup.wav",
- "models/weapons/g_chain/tris.md2", EF_ROTATE,
- "models/weapons/v_chain/tris.md2",
- /* icon */ "w_chaingun",
- /* pickup */ "Chaingun",
- 0,
- 1,
- "Bullets",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_CHAINGUN,
- NULL,
- 0,
- /* precache */ "weapons/chngnu1a.wav weapons/chngnl1a.wav weapons/machgf3b.wav` weapons/chngnd1a.wav"
- },
- // ROGUE
- /*QUAKED weapon_etf_rifle (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_etf_rifle", // classname
- Pickup_Weapon, // pickup function
- Use_Weapon, // use function
- Drop_Weapon, // drop function
- Weapon_ETF_Rifle, // weapon think function
- "misc/w_pkup.wav", // pick up sound
- "models/weapons/g_etf_rifle/tris.md2", EF_ROTATE, // world model, world model flags
- "models/weapons/v_etf_rifle/tris.md2", // view model
- "w_etf_rifle", // icon
- "ETF Rifle", // name printed when picked up
- 0, // number of digits for statusbar
- 1, // amount used / contained
- "Flechettes", // ammo type used
- IT_WEAPON, // inventory flags
- WEAP_ETFRIFLE, // visible weapon
- NULL, // info (void *)
- 0, // tag
- "weapons/nail1.wav models/proj/flechette/tris.md2", // precaches
- },
- // rogue
- /*QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_grenades",
- Pickup_Ammo,
- Use_Weapon,
- Drop_Ammo,
- Weapon_Grenade,
- "misc/am_pkup.wav",
- "models/items/ammo/grenades/medium/tris.md2", 0,
- "models/weapons/v_handgr/tris.md2",
- /* icon */ "a_grenades",
- /* pickup */ "Grenades",
- /* width */ 3,
- 5,
- "grenades",
- IT_AMMO|IT_WEAPON,
- WEAP_GRENADES,
- NULL,
- AMMO_GRENADES,
- /* precache */ "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
- },
- /*QUAKED weapon_grenadelauncher (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_grenadelauncher",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_GrenadeLauncher,
- "misc/w_pkup.wav",
- "models/weapons/g_launch/tris.md2", EF_ROTATE,
- "models/weapons/v_launch/tris.md2",
- /* icon */ "w_glauncher",
- /* pickup */ "Grenade Launcher",
- 0,
- 1,
- "Grenades",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_GRENADELAUNCHER,
- NULL,
- 0,
- /* precache */ "models/objects/grenade/tris.md2 weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav"
- },
- // ROGUE
- /*QUAKED weapon_proxlauncher (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_proxlauncher", // classname
- Pickup_Weapon, // pickup
- Use_Weapon, // use
- Drop_Weapon, // drop
- Weapon_ProxLauncher, // weapon think
- "misc/w_pkup.wav", // pick up sound
- "models/weapons/g_plaunch/tris.md2", EF_ROTATE, // world model, world model flags
- "models/weapons/v_plaunch/tris.md2", // view model
- "w_proxlaunch", // icon
- "Prox Launcher", // name printed when picked up
- 0, // number of digits for statusbar
- 1, // amount used
- "Prox", // ammo type used
- IT_WEAPON, // inventory flags
- WEAP_PROXLAUNCH, // visible weapon
- NULL, // info (void *)
- AMMO_PROX, // tag
- "weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav weapons/proxwarn.wav weapons/proxopen.wav",
- },
- // rogue
- /*QUAKED weapon_rocketlauncher (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_rocketlauncher",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_RocketLauncher,
- "misc/w_pkup.wav",
- "models/weapons/g_rocket/tris.md2", EF_ROTATE,
- "models/weapons/v_rocket/tris.md2",
- /* icon */ "w_rlauncher",
- /* pickup */ "Rocket Launcher",
- 0,
- 1,
- "Rockets",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_ROCKETLAUNCHER,
- NULL,
- 0,
- /* precache */ "models/objects/rocket/tris.md2 weapons/rockfly.wav weapons/rocklf1a.wav weapons/rocklr1b.wav models/objects/debris2/tris.md2"
- },
- /*QUAKED weapon_hyperblaster (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_hyperblaster",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_HyperBlaster,
- "misc/w_pkup.wav",
- "models/weapons/g_hyperb/tris.md2", EF_ROTATE,
- "models/weapons/v_hyperb/tris.md2",
- /* icon */ "w_hyperblaster",
- /* pickup */ "HyperBlaster",
- 0,
- 1,
- "Cells",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_HYPERBLASTER,
- NULL,
- 0,
- /* precache */ "weapons/hyprbu1a.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav weapons/hyprbd1a.wav misc/lasfly.wav"
- },
- // ROGUE
- /*QUAKED weapon_plasmabeam (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_plasmabeam", // classname
- Pickup_Weapon, // pickup function
- Use_Weapon, // use function
- Drop_Weapon, // drop function
- Weapon_Heatbeam, // weapon think function
- "misc/w_pkup.wav", // pick up sound
- "models/weapons/g_beamer/tris.md2", EF_ROTATE, // world model, world model flags
- "models/weapons/v_beamer/tris.md2", // view model
- "w_heatbeam", // icon
- "Plasma Beam", // name printed when picked up
- 0, // number of digits for statusbar
- // FIXME - if this changes, change it in NoAmmoWeaponChange as well
- 2, // amount used / contained
- "Cells", // ammo type used
- IT_WEAPON, // inventory flags
- WEAP_PLASMA, // visible weapon
- NULL, // info (void *)
- 0, // tag
- "models/weapons/v_beamer2/tris.md2 weapons/bfg__l1a.wav", // precaches
- },
- //rogue
- /*QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_railgun",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_Railgun,
- "misc/w_pkup.wav",
- "models/weapons/g_rail/tris.md2", EF_ROTATE,
- "models/weapons/v_rail/tris.md2",
- /* icon */ "w_railgun",
- /* pickup */ "Railgun",
- 0,
- 1,
- "Slugs",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_RAILGUN,
- NULL,
- 0,
- /* precache */ "weapons/rg_hum.wav"
- },
- /*QUAKED weapon_bfg (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_bfg",
- Pickup_Weapon,
- Use_Weapon,
- Drop_Weapon,
- Weapon_BFG,
- "misc/w_pkup.wav",
- "models/weapons/g_bfg/tris.md2", EF_ROTATE,
- "models/weapons/v_bfg/tris.md2",
- /* icon */ "w_bfg",
- /* pickup */ "BFG10K",
- 0,
- 50,
- "Cells",
- IT_WEAPON|IT_STAY_COOP,
- WEAP_BFG,
- NULL,
- 0,
- /* 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"
- },
- // =========================
- // ROGUE WEAPONS
- /*QUAKED weapon_chainfist (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_chainfist", // classname
- Pickup_Weapon, // pickup function
- Use_Weapon, // use function
- Drop_Weapon, // drop function
- Weapon_ChainFist, // weapon think function
- "misc/w_pkup.wav", // pick up sound
- "models/weapons/g_chainf/tris.md2", EF_ROTATE, // world model, world model flags
- "models/weapons/v_chainf/tris.md2", // view model
- "w_chainfist", // icon
- "Chainfist", // name printed when picked up
- 0, // number of digits for statusbar
- 0, // amount used / contained
- NULL, // ammo type used
- IT_WEAPON | IT_MELEE, // inventory flags
- WEAP_CHAINFIST, // visible weapon
- NULL, // info (void *)
- 1, // tag
- "weapons/sawidle.wav weapons/sawhit.wav", // precaches
- },
- /*QUAKED weapon_disintegrator (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "weapon_disintegrator", // classname
- Pickup_Weapon, // pickup function
- Use_Weapon, // use function
- Drop_Weapon, // drop function
- Weapon_Disintegrator, // weapon think function
- "misc/w_pkup.wav", // pick up sound
- "models/weapons/g_dist/tris.md2", EF_ROTATE, // world model, world model flags
- "models/weapons/v_dist/tris.md2", // view model
- "w_disintegrator", // icon
- "Disruptor", // name printed when picked up
- 0, // number of digits for statusbar
- 1, // amount used / contained
- "Rounds", // ammo type used
- #ifdef KILL_DISRUPTOR
- IT_NOT_GIVEABLE,
- #else
- IT_WEAPON, // inventory flags
- #endif
- WEAP_DISRUPTOR, // visible weapon
- NULL, // info (void *)
- 1, // tag
- "models/items/spawngro/tris.md2 models/proj/disintegrator/tris.md2 weapons/disrupt.wav weapons/disint2.wav weapons/disrupthit.wav", // precaches
- },
- // ROGUE WEAPONS
- // =========================
- //
- // AMMO ITEMS
- //
- /*QUAKED ammo_shells (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_shells",
- Pickup_Ammo,
- NULL,
- Drop_Ammo,
- NULL,
- "misc/am_pkup.wav",
- "models/items/ammo/shells/medium/tris.md2", 0,
- NULL,
- /* icon */ "a_shells",
- /* pickup */ "Shells",
- /* width */ 3,
- 10,
- NULL,
- IT_AMMO,
- 0,
- NULL,
- AMMO_SHELLS,
- /* precache */ ""
- },
- /*QUAKED ammo_bullets (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_bullets",
- Pickup_Ammo,
- NULL,
- Drop_Ammo,
- NULL,
- "misc/am_pkup.wav",
- "models/items/ammo/bullets/medium/tris.md2", 0,
- NULL,
- /* icon */ "a_bullets",
- /* pickup */ "Bullets",
- /* width */ 3,
- 50,
- NULL,
- IT_AMMO,
- 0,
- NULL,
- AMMO_BULLETS,
- /* precache */ ""
- },
- /*QUAKED ammo_cells (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_cells",
- Pickup_Ammo,
- NULL,
- Drop_Ammo,
- NULL,
- "misc/am_pkup.wav",
- "models/items/ammo/cells/medium/tris.md2", 0,
- NULL,
- /* icon */ "a_cells",
- /* pickup */ "Cells",
- /* width */ 3,
- 50,
- NULL,
- IT_AMMO,
- 0,
- NULL,
- AMMO_CELLS,
- /* precache */ ""
- },
- /*QUAKED ammo_rockets (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_rockets",
- Pickup_Ammo,
- NULL,
- Drop_Ammo,
- NULL,
- "misc/am_pkup.wav",
- "models/items/ammo/rockets/medium/tris.md2", 0,
- NULL,
- /* icon */ "a_rockets",
- /* pickup */ "Rockets",
- /* width */ 3,
- 5,
- NULL,
- IT_AMMO,
- 0,
- NULL,
- AMMO_ROCKETS,
- /* precache */ ""
- },
- /*QUAKED ammo_slugs (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_slugs",
- Pickup_Ammo,
- NULL,
- Drop_Ammo,
- NULL,
- "misc/am_pkup.wav",
- "models/items/ammo/slugs/medium/tris.md2", 0,
- NULL,
- /* icon */ "a_slugs",
- /* pickup */ "Slugs",
- /* width */ 3,
- 10,
- NULL,
- IT_AMMO,
- 0,
- NULL,
- AMMO_SLUGS,
- /* precache */ ""
- },
- // =======================================
- // ROGUE AMMO
- /*QUAKED ammo_flechettes (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_flechettes",
- Pickup_Ammo,
- NULL,
- Drop_Ammo,
- NULL,
- "misc/am_pkup.wav",
- "models/ammo/am_flechette/tris.md2", 0,
- NULL,
- "a_flechettes",
- "Flechettes",
- 3,
- 50,
- NULL,
- IT_AMMO,
- 0,
- NULL,
- AMMO_FLECHETTES
- },
- /*QUAKED ammo_prox (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_prox", // Classname
- Pickup_Ammo, // pickup function
- NULL, // use function
- Drop_Ammo, // drop function
- NULL, // weapon think function
- "misc/am_pkup.wav", // pickup sound
- "models/ammo/am_prox/tris.md2", 0, // world model, world model flags
- NULL, // view model
- "a_prox", // icon
- "Prox", // Name printed when picked up
- 3, // number of digits for status bar
- 5, // amount contained
- NULL, // ammo type used
- IT_AMMO, // inventory flags
- 0, // vwep index
- NULL, // info (void *)
- AMMO_PROX, // tag
- "models/weapons/g_prox/tris.md2 weapons/proxwarn.wav" // precaches
- },
- /*QUAKED ammo_tesla (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_tesla",
- Pickup_Ammo,
- Use_Weapon, // PGM
- Drop_Ammo,
- Weapon_Tesla, // PGM
- "misc/am_pkup.wav",
- // "models/weapons/g_tesla/tris.md2", 0,
- "models/ammo/am_tesl/tris.md2", 0,
- "models/weapons/v_tesla/tris.md2",
- "a_tesla",
- "Tesla",
- 3,
- 5,
- "Tesla", // PGM
- IT_AMMO | IT_WEAPON, // inventory flags
- 0,
- NULL, // info (void *)
- AMMO_TESLA, // tag
- "models/weapons/v_tesla2/tris.md2 weapons/teslaopen.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav models/weapons/g_tesla/tris.md2" // precache
- },
- /*QUAKED ammo_nuke (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_nuke",
- Pickup_Nuke,
- Use_Nuke, // PMM
- Drop_Ammo,
- NULL, // PMM
- "misc/am_pkup.wav",
- "models/weapons/g_nuke/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_nuke",
- /* pickup */ "A-M Bomb",
- /* width */ 3,
- 300, /* quantity (used for respawn time) */
- "A-M Bomb",
- IT_POWERUP,
- 0,
- NULL,
- 0,
- "weapons/nukewarn2.wav world/rumble.wav"
- },
- /*QUAKED ammo_disruptor (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "ammo_disruptor",
- Pickup_Ammo,
- NULL,
- Drop_Ammo,
- NULL,
- "misc/am_pkup.wav",
- "models/ammo/am_disr/tris.md2", 0,
- NULL,
- "a_disruptor",
- "Rounds", // FIXME
- 3,
- 15,
- NULL,
- #ifdef KILL_DISRUPTOR
- IT_NOT_GIVEABLE,
- #else
- IT_AMMO, // inventory flags
- #endif
- 0,
- NULL,
- #ifdef KILL_DISRUPTOR
- 0,
- #else
- AMMO_DISRUPTOR,
- #endif
- },
- // ROGUE AMMO
- // =======================================
- //
- // POWERUP ITEMS
- //
- /*QUAKED item_quad (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_quad",
- Pickup_Powerup,
- Use_Quad,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/quaddama/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_quad",
- /* pickup */ "Quad Damage",
- /* width */ 2,
- 60,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- /* precache */ "items/damage.wav items/damage2.wav items/damage3.wav"
- },
- /*QUAKED item_invulnerability (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_invulnerability",
- Pickup_Powerup,
- Use_Invulnerability,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/invulner/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_invulnerability",
- /* pickup */ "Invulnerability",
- /* width */ 2,
- 300,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- /* precache */ "items/protect.wav items/protect2.wav items/protect4.wav"
- },
- /*QUAKED item_silencer (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_silencer",
- Pickup_Powerup,
- Use_Silencer,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/silencer/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_silencer",
- /* pickup */ "Silencer",
- /* width */ 2,
- 60,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED item_breather (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_breather",
- Pickup_Powerup,
- Use_Breather,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/breather/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_rebreather",
- /* pickup */ "Rebreather",
- /* width */ 2,
- 60,
- NULL,
- IT_STAY_COOP|IT_POWERUP,
- 0,
- NULL,
- 0,
- /* precache */ "items/airout.wav"
- },
- /*QUAKED item_enviro (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_enviro",
- Pickup_Powerup,
- Use_Envirosuit,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/enviro/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_envirosuit",
- /* pickup */ "Environment Suit",
- /* width */ 2,
- 60,
- NULL,
- IT_STAY_COOP|IT_POWERUP,
- 0,
- NULL,
- 0,
- /* precache */ "items/airout.wav"
- },
- /*QUAKED item_ancient_head (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- Special item that gives +2 to maximum health
- */
- {
- "item_ancient_head",
- Pickup_AncientHead,
- NULL,
- NULL,
- NULL,
- "items/pkup.wav",
- "models/items/c_head/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_fixme",
- /* pickup */ "Ancient Head",
- /* width */ 2,
- 60,
- NULL,
- 0,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED item_adrenaline (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- gives +1 to maximum health
- */
- {
- "item_adrenaline",
- Pickup_Adrenaline,
- NULL,
- NULL,
- NULL,
- "items/pkup.wav",
- "models/items/adrenal/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_adrenaline",
- /* pickup */ "Adrenaline",
- /* width */ 2,
- 60,
- NULL,
- 0,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED item_bandolier (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_bandolier",
- Pickup_Bandolier,
- NULL,
- NULL,
- NULL,
- "items/pkup.wav",
- "models/items/band/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_bandolier",
- /* pickup */ "Bandolier",
- /* width */ 2,
- 60,
- NULL,
- 0,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED item_pack (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_pack",
- Pickup_Pack,
- NULL,
- NULL,
- NULL,
- "items/pkup.wav",
- "models/items/pack/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_pack",
- /* pickup */ "Ammo Pack",
- /* width */ 2,
- 180,
- NULL,
- 0,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- // ======================================
- // PGM
- /*QUAKED item_ir_goggles (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- gives +1 to maximum health
- */
- {
- "item_ir_goggles",
- Pickup_Powerup,
- Use_IR,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/goggles/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_ir",
- /* pickup */ "IR Goggles",
- /* width */ 2,
- 60,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- /* precache */ "misc/ir_start.wav"
- },
- /*QUAKED item_double (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_double",
- Pickup_Powerup,
- Use_Double,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/ddamage/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_double",
- /* pickup */ "Double Damage",
- /* width */ 2,
- 60,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- /* precache */ "misc/ddamage1.wav misc/ddamage2.wav misc/ddamage3.wav"
- },
- /*Q U A K E D item_torch (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- /*
- {
- "item_torch",
- Pickup_Powerup,
- Use_Torch,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/objects/fire/tris.md2", EF_ROTATE,
- NULL,
- "p_torch",
- "torch",
- 2,
- 60,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- },
- */
- /*QUAKED item_compass (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_compass",
- Pickup_Powerup,
- Use_Compass,
- NULL,
- NULL,
- "items/pkup.wav",
- "models/objects/fire/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_compass",
- /* pickup */ "compass",
- /* width */ 2,
- 60,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- },
- /*QUAKED item_sphere_vengeance (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_sphere_vengeance",
- Pickup_Sphere,
- Use_Vengeance,
- NULL,
- NULL,
- "items/pkup.wav",
- "models/items/vengnce/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_vengeance",
- /* pickup */ "vengeance sphere",
- /* width */ 2,
- 60,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- "spheres/v_idle.wav" //precache
- },
- /*QUAKED item_sphere_hunter (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_sphere_hunter",
- Pickup_Sphere,
- Use_Hunter,
- NULL,
- NULL,
- "items/pkup.wav",
- "models/items/hunter/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_hunter",
- /* pickup */ "hunter sphere",
- /* width */ 2,
- 120,
- NULL,
- IT_POWERUP,
- 0,
- NULL,
- 0,
- "spheres/h_idle.wav spheres/h_active.wav spheres/h_lurk.wav" //precache
- },
- /*QUAKED item_sphere_defender (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_sphere_defender",
- Pickup_Sphere,
- Use_Defender,
- NULL,
- NULL,
- "items/pkup.wav",
- "models/items/defender/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "p_defender",
- /* pickup */ "defender sphere",
- /* width */ 2,
- 60, // respawn time
- NULL, // ammo type used
- IT_POWERUP, // inventory flags
- 0,
- NULL, // info (void *)
- 0, // tag
- "models/proj/laser2/tris.md2 models/items/shell/tris.md2 spheres/d_idle.wav" // precache
- },
- /*QUAKED item_doppleganger (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "item_doppleganger", // classname
- Pickup_Doppleganger, // pickup function
- Use_Doppleganger, // use function
- Drop_General, // drop function
- NULL, // weapon think function
- "items/pkup.wav", // pick up sound
- "models/items/dopple/tris.md2", // world model
- EF_ROTATE, // world model flags
- NULL, // view model
- "p_doppleganger", // icon
- "Doppleganger", // name printed when picked up
- 0, // number of digits for statusbar
- 90, // respawn time
- NULL, // ammo type used
- IT_POWERUP, // inventory flags
- 0,
- NULL, // info (void *)
- 0, // tag
- "models/objects/dopplebase/tris.md2 models/items/spawngro2/tris.md2 models/items/hunter/tris.md2 models/items/vengnce/tris.md2", // precaches
- },
- {
- // "dm_tag_token", // classname
- NULL, // classname
- Tag_PickupToken, // pickup function
- NULL, // use function
- NULL, // drop function
- NULL, // weapon think function
- "items/pkup.wav", // pick up sound
- "models/items/tagtoken/tris.md2", // world model
- EF_ROTATE | EF_TAGTRAIL, // world model flags
- NULL, // view model
- "i_tagtoken", // icon
- "Tag Token", // name printed when picked up
- 0, // number of digits for statusbar
- 0, // amount used / contained
- NULL, // ammo type used
- IT_POWERUP | IT_NOT_GIVEABLE, // inventory flags
- 0,
- NULL, // info (void *)
- 1, // tag
- NULL, // precaches
- },
- // PGM
- // ======================================
- //
- // KEYS
- //
- /*QUAKED key_data_cd (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- key for computer centers
- */
- {
- "key_data_cd",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/keys/data_cd/tris.md2", EF_ROTATE,
- NULL,
- "k_datacd",
- "Data CD",
- 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED key_power_cube (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN NO_TOUCH
- warehouse circuits
- */
- {
- "key_power_cube",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/keys/power/tris.md2", EF_ROTATE,
- NULL,
- "k_powercube",
- "Power Cube",
- 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED key_pyramid (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- key for the entrance of jail3
- */
- {
- "key_pyramid",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/keys/pyramid/tris.md2", EF_ROTATE,
- NULL,
- "k_pyramid",
- "Pyramid Key",
- 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED key_data_spinner (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- key for the city computer
- */
- {
- "key_data_spinner",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/keys/spinner/tris.md2", EF_ROTATE,
- NULL,
- "k_dataspin",
- "Data Spinner",
- 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED key_pass (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- security pass for the security level
- */
- {
- "key_pass",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/keys/pass/tris.md2", EF_ROTATE,
- NULL,
- "k_security",
- "Security Pass",
- 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED key_blue_key (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- normal door key - blue
- */
- {
- "key_blue_key",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/keys/key/tris.md2", EF_ROTATE,
- NULL,
- "k_bluekey",
- "Blue Key",
- 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED key_red_key (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- normal door key - red
- */
- {
- "key_red_key",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/keys/red_key/tris.md2", EF_ROTATE,
- NULL,
- "k_redkey",
- "Red Key",
- 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED key_commander_head (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- tank commander's head
- */
- {
- "key_commander_head",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/monsters/commandr/head/tris.md2", EF_GIB,
- NULL,
- /* icon */ "k_comhead",
- /* pickup */ "Commander's Head",
- /* width */ 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- /*QUAKED key_airstrike_target (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- tank commander's head
- */
- {
- "key_airstrike_target",
- Pickup_Key,
- NULL,
- Drop_General,
- NULL,
- "items/pkup.wav",
- "models/items/keys/target/tris.md2", EF_ROTATE,
- NULL,
- /* icon */ "i_airstrike",
- /* pickup */ "Airstrike Marker",
- /* width */ 2,
- 0,
- NULL,
- IT_STAY_COOP|IT_KEY,
- 0,
- NULL,
- 0,
- /* precache */ ""
- },
- // ======================================
- // PGM
- /*QUAKED key_nuke_container (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "key_nuke_container", // classname
- Pickup_Key, // pickup function
- NULL, // use function
- Drop_General, // drop function
- NULL, // weapon think function
- "items/pkup.wav", // pick up sound
- "models/weapons/g_nuke/tris.md2", // world model
- EF_ROTATE, // world model flags
- NULL, // view model
- "i_contain", // icon
- "Antimatter Pod", // name printed when picked up
- 2, // number of digits for statusbar
- 0, // respawn time
- NULL, // ammo type used
- IT_STAY_COOP|IT_KEY, // inventory flags
- 0,
- NULL, // info (void *)
- 0, // tag
- NULL, // precaches
- },
- /*QUAKED key_nuke (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- {
- "key_nuke", // classname
- Pickup_Key, // pickup function
- NULL, // use function
- Drop_General, // drop function
- NULL, // weapon think function
- "items/pkup.wav", // pick up sound
- "models/weapons/g_nuke/tris.md2", // world model
- EF_ROTATE, // world model flags
- NULL, // view model
- "i_nuke", // icon
- "Antimatter Bomb", // name printed when picked up
- 2, // number of digits for statusbar
- 0, // respawn time
- NULL, // ammo type used
- IT_STAY_COOP|IT_KEY, // inventory flags
- 0,
- NULL, // info (void *)
- 0, // tag
- NULL, // precaches
- },
- // PGM
- // ======================================
- {
- NULL,
- Pickup_Health,
- NULL,
- NULL,
- NULL,
- "items/pkup.wav",
- NULL, 0,
- NULL,
- /* icon */ "i_health",
- /* pickup */ "Health",
- /* width */ 3,
- 0,
- NULL,
- 0,
- 0,
- NULL,
- 0,
- /* precache */ "items/s_health.wav items/n_health.wav items/l_health.wav items/m_health.wav" // PMM - health sound fix
- },
- // end of list marker
- {NULL}
- };
- /*QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- void SP_item_health (edict_t *self)
- {
- if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
- {
- G_FreeEdict (self);
- return;
- }
- self->model = "models/items/healing/medium/tris.md2";
- self->count = 10;
- SpawnItem (self, FindItem ("Health"));
- gi.soundindex ("items/n_health.wav");
- }
- /*QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- void SP_item_health_small (edict_t *self)
- {
- if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
- {
- G_FreeEdict (self);
- return;
- }
- self->model = "models/items/healing/stimpack/tris.md2";
- self->count = 2;
- SpawnItem (self, FindItem ("Health"));
- self->style = HEALTH_IGNORE_MAX;
- gi.soundindex ("items/s_health.wav");
- }
- /*QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- void SP_item_health_large (edict_t *self)
- {
- if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
- {
- G_FreeEdict (self);
- return;
- }
- self->model = "models/items/healing/large/tris.md2";
- self->count = 25;
- SpawnItem (self, FindItem ("Health"));
- gi.soundindex ("items/l_health.wav");
- }
- /*QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN
- */
- void SP_item_health_mega (edict_t *self)
- {
- if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
- {
- G_FreeEdict (self);
- return;
- }
- self->model = "models/items/mega_h/tris.md2";
- self->count = 100;
- SpawnItem (self, FindItem ("Health"));
- gi.soundindex ("items/m_health.wav");
- self->style = HEALTH_IGNORE_MAX|HEALTH_TIMED;
- }
- void InitItems (void)
- {
- game.num_items = sizeof(itemlist)/sizeof(itemlist[0]) - 1;
- }
- /*
- ===============
- SetItemNames
- Called by worldspawn
- ===============
- */
- void SetItemNames (void)
- {
- int i;
- gitem_t *it;
- for (i=0 ; i<game.num_items ; i++)
- {
- it = &itemlist[i];
- gi.configstring (CS_ITEMS+i, it->pickup_name);
- }
- jacket_armor_index = ITEM_INDEX(FindItem("Jacket Armor"));
- combat_armor_index = ITEM_INDEX(FindItem("Combat Armor"));
- body_armor_index = ITEM_INDEX(FindItem("Body Armor"));
- power_screen_index = ITEM_INDEX(FindItem("Power Screen"));
- power_shield_index = ITEM_INDEX(FindItem("Power Shield"));
- }
- //===============
- //ROGUE
- void SP_xatrix_item (edict_t *self)
- {
- gitem_t *item;
- int i;
- char *spawnClass;
- if(!self->classname)
- return;
- if(!strcmp(self->classname, "ammo_magslug"))
- spawnClass = "ammo_flechettes";
- else if(!strcmp(self->classname, "ammo_trap"))
- spawnClass = "weapon_proxlauncher";
- else if(!strcmp(self->classname, "item_quadfire"))
- {
- float chance;
- chance = random();
- if(chance < 0.2)
- spawnClass = "item_sphere_hunter";
- else if (chance < 0.6)
- spawnClass = "item_sphere_vengeance";
- else
- spawnClass = "item_sphere_defender";
- }
- else if(!strcmp(self->classname, "weapon_boomer"))
- spawnClass = "weapon_etf_rifle";
- else if(!strcmp(self->classname, "weapon_phalanx"))
- spawnClass = "weapon_plasmabeam";
- // check item spawn functions
- for (i=0,item=itemlist ; i<game.num_items ; i++,item++)
- {
- if (!item->classname)
- continue;
- if (!strcmp(item->classname, spawnClass))
- { // found it
- SpawnItem (self, item);
- return;
- }
- }
- }
- //ROGUE
- //===============
|