1 //void Item_ClearRespawnEffect (void) {
2 // self.effects = self.effects - (self.effects & EF_STARDUST);
7 void Item_Respawn (void)
9 self.model = self.mdl; // restore original model
10 self.solid = SOLID_TRIGGER; // allow it to be touched again
11 sound (self, CHAN_VOICE, "misc/itemrespawn.wav", 1, ATTN_NORM); // play respawn sound
12 setorigin (self, self.origin);
14 // LordHavoc: replaced respawn stardust effect with a custom te_wizspike
15 te_wizspike(self.origin + self.mins_z * '0 0 1' + '0 0 48');
16 //// Savage: Add simple Respawn effect and make sure it gets removed
17 //self.effects = self.effects | EF_STARDUST;
18 //self.think = Item_ClearRespawnEffect;
19 //self.nextthink = time + 0.1;
22 void Item_Touch (void)
25 local float _switchweapon;
29 // remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
30 if (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
35 if (other.classname != "player")
39 if (self.solid != SOLID_TRIGGER)
41 if (self.owner == other)
44 // if nothing happens to other, just return without taking the item
46 _switchweapon = FALSE;
54 // play some cool sounds ;)
55 centerprint(other, "\n");
57 announce(other, "announcer/robotic/lastsecond.ogg");
58 else if(other.health < 50)
59 announce(other, "announcer/robotic/narrowly.ogg");
60 // sound not available
61 // else if(self.items == IT_CELLS)
62 // play2(other, "announce/robotic/ammo.ogg");
64 if (self.items & IT_NEX)
65 W_GiveWeapon (other, IT_NEX, "Nex");
67 other.ammo_cells = min (other.ammo_cells + cvar("g_minstagib_ammo_drop"), 999);
75 // sound not available
76 // play2(other, "announce/robotic/extra.ogg\nplay2 announce/robotic/_lives.ogg");
77 other.armorvalue = other.armorvalue + cvar("g_minstagib_extralives");
78 sprint(other, "^3You picked up some extra lives\n");
82 if (self.strength_finished)
85 // sound not available
86 // play2(other, "announce/robotic/invisible.ogg");
87 other.strength_finished = max(other.strength_finished, time) + cvar("g_balance_powerup_strength_time");
91 if (self.invincible_finished)
94 // sound not available
95 // play2(other, "announce/robotic/speed.ogg");
96 other.invincible_finished = max(other.invincible_finished, time) + cvar("g_balance_powerup_strength_time");
101 if (cvar("deathmatch") == 2 || cvar("g_weapon_stay"))
103 if (self.flags & FL_WEAPON && other.items & self.items && self.classname != "droppedweapon")
105 if (other.items & self.items && self.flags & FL_TOSSED) // don't let players stack ammo by tossing weapons
109 // in case the player has autoswitch enabled do the following:
110 // if the player is using their best weapon before items are given, they
111 // probably want to switch to an even better weapon after items are given
112 if (other.autoswitch)
113 if (other.switchweapon == w_getbestweapon(other))
114 _switchweapon = TRUE;
116 if (self.ammo_shells)
117 if (other.ammo_shells < g_pickup_shells_max)
120 other.ammo_shells = min (other.ammo_shells + self.ammo_shells, g_pickup_shells_max);
123 if (other.ammo_nails < g_pickup_nails_max)
126 other.ammo_nails = min (other.ammo_nails + self.ammo_nails, g_pickup_nails_max);
128 if (self.ammo_rockets)
129 if (other.ammo_rockets < g_pickup_rockets_max)
132 other.ammo_rockets = min (other.ammo_rockets + self.ammo_rockets, g_pickup_rockets_max);
135 if (other.ammo_cells < g_pickup_cells_max)
138 other.ammo_cells = min (other.ammo_cells + self.ammo_cells, g_pickup_cells_max);
141 if (self.flags & FL_WEAPON)
142 if ((it = self.items - (self.items & other.items)))
145 if (it & IT_UZI) W_GiveWeapon (other, IT_UZI, self.netname);
146 if (it & IT_SHOTGUN) W_GiveWeapon (other, IT_SHOTGUN, self.netname);
147 if (it & IT_GRENADE_LAUNCHER) W_GiveWeapon (other, IT_GRENADE_LAUNCHER, self.netname);
148 if (it & IT_ELECTRO) W_GiveWeapon (other, IT_ELECTRO, self.netname);
149 if (it & IT_NEX) W_GiveWeapon (other, IT_NEX, self.netname);
150 if (it & IT_HAGAR) W_GiveWeapon (other, IT_HAGAR, self.netname);
151 if (it & IT_ROCKET_LAUNCHER) W_GiveWeapon (other, IT_ROCKET_LAUNCHER, self.netname);
152 if (it & IT_CRYLINK) W_GiveWeapon (other, IT_CRYLINK, self.netname);
155 if (self.strength_finished)
158 other.strength_finished = max(other.strength_finished, time) + cvar("g_balance_powerup_strength_time");
160 if (self.invincible_finished)
163 other.invincible_finished = max(other.invincible_finished, time) + cvar("g_balance_powerup_invincible_time");
165 //if (self.speed_finished)
168 // other.speed_finished = max(other.speed_finished, time) + cvar("g_balance_powerup_speed_time");
170 //if (self.slowmo_finished)
173 // other.slowmo_finished = max(other.slowmo_finished, time) + (cvar("g_balance_powerup_slowmo_time") * cvar("g_balance_powerup_slowmo_speed"));
177 if (other.health < self.max_health)
180 other.health = min(other.health + self.health, self.max_health);
181 other.pauserothealth_finished = max(other.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));
184 if (other.armorvalue < self.max_armorvalue)
187 other.armorvalue = min(other.armorvalue + self.armorvalue, self.max_armorvalue);
188 other.pauserotarmor_finished = max(other.pauserotarmor_finished, time + cvar("g_balance_pause_armor_rot"));
195 // Savage: Remove the respawn effect if still present
196 self.effects = self.effects - (self.effects & EF_STARDUST);
198 sound (self, CHAN_BODY, self.noise, 1, ATTN_NORM);
199 sound (other, CHAN_AUTO, self.item_pickupsound, 1, ATTN_NORM);
205 self.switchweapon = w_getbestweapon(self);
206 if (self.switchweapon != self.weapon)
207 self.cnt = self.weapon;
211 if (self.classname == "droppedweapon")
213 else if(self.flags & FL_WEAPON && (cvar("deathmatch") == 2 || cvar("g_weapon_stay")))
217 self.solid = SOLID_NOT;
218 self.model = string_null;
219 self.nextthink = time + self.respawntime;
220 self.think = Item_Respawn;
221 setorigin (self, self.origin);
225 // Savage: used for item garbage-collection
226 // TODO: perhaps nice special effect?
227 void RemoveItem(void) = {
231 // pickup evaluation functions
232 // these functions decide how desirable an item is to the bots
234 float(entity player, entity item) generic_pickupevalfunc = {return item.bot_pickupbasevalue;};
236 float(entity player, entity item) weapon_pickupevalfunc =
238 // if we already have the weapon, rate it 1/5th normal value
239 if ((player.items & item.items) == item.items)
240 return item.bot_pickupbasevalue * 0.2;
241 return item.bot_pickupbasevalue;
244 float(entity player, entity item) commodity_pickupevalfunc =
248 // TODO: figure out if the player even has the weapon this ammo is for?
249 // may not affect strategy much though...
250 // find out how much more ammo/armor/health the player can hold
251 if (item.ammo_shells)
252 if (player.ammo_shells < g_pickup_shells_max)
253 c = c + 1 - min(player.ammo_shells / g_pickup_shells_max, 1);
255 if (player.ammo_nails < g_pickup_nails_max)
256 c = c + 1 - min(player.ammo_nails / g_pickup_nails_max, 1);
257 if (item.ammo_rockets)
258 if (player.ammo_rockets < g_pickup_rockets_max)
259 c = c + 1 - min(player.ammo_rockets / g_pickup_rockets_max, 1);
261 if (player.ammo_cells < g_pickup_cells_max)
262 c = c + 1 - min(player.ammo_cells / g_pickup_cells_max, 1);
264 if (player.armorvalue < item.max_armorvalue)
265 c = c + 1 - min(player.armorvalue / item.max_armorvalue, 1);
267 if (player.health < item.max_health)
268 c = c + 1 - min(player.health / item.max_health, 1);
270 if (cvar("deathmatch") == 2) // weapon stay is on, so weapons the player already has are of no interest
271 if (item.flags & FL_WEAPON)
272 if (self.items & item.items)
273 if (item.classname != "droppedweapon")
276 return item.bot_pickupbasevalue * c;
281 void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, string itemname, float itemid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue)
283 startitem_failed = FALSE;
285 if (self.classname != "droppedweapon")
291 print("removed non-teamplay ", self.classname, "\n");
292 startitem_failed = TRUE;
301 print("removed non-FFA ", self.classname, "\n");
302 startitem_failed = TRUE;
310 // target_give not yet supported; maybe later
311 print("removed targeted ", self.classname, "\n");
312 startitem_failed = TRUE;
317 if(cvar("spawn_debug") >= 2)
320 for(otheritem = findradius(self.origin, 3); otheritem; otheritem = otheritem.chain)
322 if(otheritem.is_item)
324 dprint("XXX Found duplicated item: ", itemname, vtos(self.origin));
325 dprint(" vs ", otheritem.netname, vtos(otheritem.origin), "\n");
326 error("Mapper sucks.");
332 waypoint_spawnforitem(self);
334 itemsInMap |= itemid;
337 if (!(cvar("g_pickup_items") && !g_nixnex) && !g_minstagib &&
338 itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH)
340 startitem_failed = TRUE;
347 // don't remove dropped items and powerups
348 if (self.classname != "droppedweapon" &&
349 self.classname != "minstagib")
351 startitem_failed = TRUE;
357 if(g_lms && (self.classname != "droppedweapon"))
359 startitem_failed = TRUE;
364 if(g_instagib || g_rocketarena)
366 startitem_failed = TRUE;
371 if (self.classname == "droppedweapon")
373 // don't drop if in a NODROP zone (such as lava)
374 traceline(self.origin, self.origin, MOVE_NORMAL, self);
375 if (trace_dpstartcontents & DPCONTENTS_NODROP)
377 startitem_failed = TRUE;
383 if (self.classname != "droppedweapon")
385 precache_model (itemmodel);
386 precache_sound (pickupsound);
387 precache_sound ("misc/itemrespawn.wav");
390 if(itemid & (IT_STRENGTH | IT_INVINCIBLE | IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2 |
391 IT_ROCKET_LAUNCHER | IT_HAGAR | IT_NEX | IT_CRYLINK | IT_ELECTRO |
392 IT_GRENADE_LAUNCHER | IT_UZI | IT_SHOTGUN | IT_LASER) && self.classname != "droppedweapon")
394 self.target = "###item###"; // for finding the nearest item using find()
396 self.bot_pickup = TRUE;
397 self.bot_pickupevalfunc = pickupevalfunc;
398 self.bot_pickupbasevalue = pickupbasevalue;
399 self.mdl = itemmodel;
400 //self.noise = pickupsound;
401 self.item_pickupsound = pickupsound;
402 // let mappers override respawntime
403 if (!self.respawntime)
404 self.respawntime = defaultrespawntime;
405 self.netname = itemname;
407 self.flags = FL_ITEM | itemflags;
408 if(self.spawnflags & 1)
411 self.movetype = MOVETYPE_NONE;
413 self.movetype = MOVETYPE_TOSS;
414 self.solid = SOLID_TRIGGER;
415 self.touch = Item_Touch;
416 setmodel (self, self.mdl); // precision set below
417 self.effects |= EF_LOWPRECISION;
418 if((itemflags & FL_POWERUP) || self.health || self.armorvalue)
419 setsize (self, '-16 -16 0', '16 16 48');
421 setsize (self, '-16 -16 0', '16 16 32');
422 if (itemflags & FL_WEAPON)
424 // neutral team color for pickup weapons
425 self.colormap = 160 * 1024 + 160;
428 // Savage: remove thrown items after a certain period of time ("garbage collection")
429 if (self.classname == "droppedweapon")
431 self.think = RemoveItem;
432 self.nextthink = time + 60;
434 else if (!self.noalign)
436 // first nudge it off the floor a little bit to avoid math errors
437 setorigin(self, self.origin + '0 0 1');
438 // note droptofloor returns FALSE if stuck/or would fall too far
442 if (cvar("g_fullbrightitems"))
443 self.effects = self.effects | EF_FULLBRIGHT;
446 /* replace items in minstagib
447 * IT_STRENGTH = invisibility
448 * IT_NAILS = extra lives
449 * IT_INVINCIBLE = speed
451 void minstagib_items (float itemid)
453 // we don't want to replace dropped weapons ;)
454 if (self.classname == "droppedweapon")
456 self.ammo_cells = 25;
457 StartItem ("models/weapons/g_nex.md3",
458 "weapons/weaponpickup.wav", 15,
459 "Nex Gun", IT_NEX, FL_WEAPON, generic_pickupevalfunc, 1000);
464 self.classname = "minstagib";
466 // replace rocket launchers and nex guns with ammo cells
467 if (itemid == IT_CELLS)
470 StartItem ("models/items/a_cells.md3",
471 "misc/itempickup.wav", 45,
472 "Nex Ammo", IT_CELLS, 0, generic_pickupevalfunc, 100);
479 itemid = IT_STRENGTH;
483 itemid = IT_INVINCIBLE;
485 // replace with invis
486 if (itemid == IT_STRENGTH)
488 self.effects = EF_ADDITIVE;
489 self.strength_finished = 30;
490 StartItem ("models/items/g_strength.md3",
491 "misc/powerup.wav", 120,
492 "Invisibility", IT_STRENGTH, FL_POWERUP, generic_pickupevalfunc, 1000);
494 // replace with extra lives
495 if (itemid == IT_NAILS)
498 StartItem ("models/items/g_h100.md3",
499 "misc/megahealth.wav", 120,
500 "Extralife", IT_NAILS, FL_POWERUP, generic_pickupevalfunc, 1000);
503 // replace with speed
504 if (itemid == IT_INVINCIBLE)
506 self.effects = EF_ADDITIVE;
507 self.invincible_finished = 30;
508 StartItem ("models/items/g_invincible.md3",
509 "misc/powerup_shield.wav", 120,
510 "Speed", IT_INVINCIBLE, FL_POWERUP, generic_pickupevalfunc, 1000);
515 float minst_no_auto_cells;
516 void minst_remove_item (void) {
517 if(minst_no_auto_cells)
521 void weapon_uzi (void) {
523 self.ammo_nails = cvar("g_pickup_nails");
524 StartItem ("models/weapons/g_uzi.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_UZI), IT_UZI, FL_WEAPON, weapon_pickupevalfunc, 1000);
525 if (self.modelindex) // don't precache if self was removed
526 weapon_action(WEP_UZI, WR_PRECACHE);
529 void weapon_shotgun (void) {
530 if(!self.ammo_shells)
531 self.ammo_shells = cvar("g_pickup_shells");
532 StartItem ("models/weapons/g_shotgun.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_SHOTGUN), IT_SHOTGUN, FL_WEAPON, weapon_pickupevalfunc, 1000);
533 if (self.modelindex) // don't precache if self was removed
534 weapon_action(WEP_SHOTGUN, WR_PRECACHE);
537 void weapon_grenadelauncher (void)
539 if(!self.ammo_rockets)
540 self.ammo_rockets = cvar("g_pickup_rockets");
541 StartItem ("models/weapons/g_gl.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_GRENADE_LAUNCHER), IT_GRENADE_LAUNCHER, FL_WEAPON, weapon_pickupevalfunc, 1000);
542 if (self.modelindex) // don't precache if self was removed
543 weapon_action(WEP_GRENADE_LAUNCHER, WR_PRECACHE);
546 void weapon_electro (void)
549 self.ammo_cells = cvar("g_pickup_cells");
550 StartItem ("models/weapons/g_electro.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_ELECTRO), IT_ELECTRO, FL_WEAPON, weapon_pickupevalfunc, 1000);
551 if (self.modelindex) // don't precache if self was removed
552 weapon_action(WEP_ELECTRO, WR_PRECACHE);
555 void weapon_crylink (void)
558 self.ammo_cells = cvar("g_pickup_cells");
559 StartItem ("models/weapons/g_crylink.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_CRYLINK), IT_CRYLINK, FL_WEAPON, weapon_pickupevalfunc, 1000);
560 if (self.modelindex) // don't precache if self was removed
561 weapon_action(WEP_CRYLINK, WR_PRECACHE);
564 void weapon_nex (void)
569 minstagib_items(IT_CELLS);
570 self.think = minst_remove_item;
571 self.nextthink = time + cvar("sys_ticrate");
575 self.ammo_cells = cvar("g_pickup_cells");
576 nextime = cvar("g_balance_nex_respawntime_modifier");
578 nextime = 15 * nextime;
581 StartItem ("models/weapons/g_nex.md3", "weapons/weaponpickup.wav", nextime, W_Name(WEP_NEX), IT_NEX, FL_WEAPON, weapon_pickupevalfunc, 1000);
582 if (self.modelindex) // don't precache if self was removed
583 weapon_action(WEP_NEX, WR_PRECACHE);
586 void weapon_hagar (void)
588 if(!self.ammo_rockets)
589 self.ammo_rockets = cvar("g_pickup_rockets");
590 StartItem ("models/weapons/g_hagar.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_HAGAR), IT_HAGAR, FL_WEAPON, weapon_pickupevalfunc, 1000);
591 if (self.modelindex) // don't precache if self was removed
592 weapon_action(WEP_HAGAR, WR_PRECACHE);
595 void weapon_rocketlauncher (void)
599 minstagib_items(IT_CELLS);
600 self.think = minst_remove_item;
601 self.nextthink = time + cvar("sys_ticrate");
604 if(!self.ammo_rockets)
605 self.ammo_rockets = g_pickup_rockets;
606 StartItem ("models/weapons/g_rl.md3", "weapons/weaponpickup.wav", 15, W_Name(WEP_ROCKET_LAUNCHER), IT_ROCKET_LAUNCHER, FL_WEAPON, weapon_pickupevalfunc, 1000);
607 if (self.modelindex) // don't precache if self was removed
608 weapon_action(WEP_ROCKET_LAUNCHER, WR_PRECACHE);
611 void item_rockets (void) {
612 if(!self.ammo_rockets)
613 self.ammo_rockets = g_pickup_rockets;
614 StartItem ("models/items/a_rockets.md3", "misc/itempickup.wav", 15, "rockets", IT_ROCKETS, 0, commodity_pickupevalfunc, 100);
617 void item_bullets (void) {
619 self.ammo_nails = g_pickup_nails;
620 StartItem ("models/items/a_bullets.mdl", "misc/itempickup.wav", 15, "bullets", IT_NAILS, 0, commodity_pickupevalfunc, 100);
623 void item_cells (void) {
625 self.ammo_cells = g_pickup_cells;
626 StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", 15, "cells", IT_CELLS, 0, commodity_pickupevalfunc, 100);
629 void item_shells (void) {
630 if(!self.ammo_shells)
631 self.ammo_shells = g_pickup_shells;
632 StartItem ("models/items/a_shells.md3", "misc/itempickup.wav", 15, "shells", IT_SHELLS, 0, commodity_pickupevalfunc, 100);
635 void item_armor_small (void) {
637 self.armorvalue = g_pickup_armorsmall;
638 if(!self.max_armorvalue)
639 self.max_armorvalue = g_pickup_armorsmall_max;
640 StartItem ("models/items/g_a1.md3", "misc/armor1.wav", 15, "Armor Shard", IT_ARMOR_SHARD, 0, commodity_pickupevalfunc, 100);
643 void item_armor_medium (void) {
645 self.armorvalue = g_pickup_armormedium;
646 if(!self.max_armorvalue)
647 self.max_armorvalue = g_pickup_armormedium_max;
648 self.skin = 1; // "weaker" skin
649 StartItem ("models/items/g_a25.md3", "misc/armor25.wav", 30, "Armor", IT_ARMOR, 0, commodity_pickupevalfunc, 2000);
652 void item_armor_large (void) {
654 self.armorvalue = g_pickup_armorlarge;
655 if(!self.max_armorvalue)
656 self.max_armorvalue = g_pickup_armorlarge_max;
657 StartItem ("models/items/g_a25.md3", "misc/armor25.wav", 30, "Armor", IT_ARMOR, 0, commodity_pickupevalfunc, 2000);
660 void item_health_small (void) {
662 self.max_health = g_pickup_healthsmall_max;
664 self.health = g_pickup_healthsmall;
665 StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", 15, "5 Health", IT_5HP, 0, commodity_pickupevalfunc, 100);
668 void item_health_medium (void) {
670 self.max_health = g_pickup_healthmedium_max;
672 self.health = g_pickup_healthmedium;
673 StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", 15, "25 Health", IT_25HP, 0, commodity_pickupevalfunc, 500);
676 void item_health_large (void) {
678 self.max_health = g_pickup_healthlarge_max;
680 self.health = g_pickup_healthlarge;
681 self.skin = 1; // "stronger" skin
682 StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", 15, "25 Health", IT_25HP, 0, commodity_pickupevalfunc, 500);
685 void item_health_mega (void) {
686 if(!cvar("g_powerup_superhealth"))
689 if(g_arena && !cvar("g_arena_powerups"))
693 minstagib_items(IT_NAILS);
696 self.max_health = g_pickup_healthmega_max;
698 self.health = g_pickup_healthmega;
699 StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", 30, "100 Health", IT_HEALTH, 0, commodity_pickupevalfunc, 2000);
703 // support old misnamed entities
704 void item_armor1() { item_armor_small(); }
705 void item_armor25() { item_armor_large(); }
706 void item_health1() { item_health_small(); }
707 void item_health25() { item_health_medium(); }
708 void item_health100() { item_health_mega(); }
710 void item_strength (void) {
711 if(!cvar("g_powerup_strength"))
714 if(g_arena && !cvar("g_arena_powerups"))
718 minstagib_items(IT_STRENGTH);
720 precache_sound("weapons/strength_fire.wav");
721 self.strength_finished = 30;
722 self.effects = EF_ADDITIVE;StartItem ("models/items/g_strength.md3", "misc/powerup.wav", 120, "Strength Powerup", IT_STRENGTH, FL_POWERUP, generic_pickupevalfunc, 10000);
726 void item_invincible (void) {
727 if(!cvar("g_powerup_shield"))
730 if(g_arena && !cvar("g_arena_powerups"))
734 minstagib_items(IT_INVINCIBLE);
736 self.invincible_finished = 30;
737 self.effects = EF_ADDITIVE;
738 StartItem ("models/items/g_invincible.md3", "misc/powerup_shield.wav", 120, "Invulnerability", IT_INVINCIBLE, FL_POWERUP, generic_pickupevalfunc, 10000);
741 //void item_speed (void) {self.speed_finished = 30;StartItem ("models/items/g_speed.md3", "misc/powerup.wav", 120, "Speed Powerup", IT_SPEED, FL_POWERUP, generic_pickupevalfunc, 10000);}
742 //void item_slowmo (void) {self.slowmo_finished = 30;StartItem ("models/items/g_slowmo.md3", "misc/powerup.wav", 120, "Slow Motion", IT_SLOWMO, FL_POWERUP, generic_pickupevalfunc, 10000);}
744 void item_minst_cells (void) {
747 minst_no_auto_cells = 1;
748 minstagib_items(IT_CELLS);
755 void item_quad (void) {self.classname = "item_strength";item_strength();}
757 void misc_models (void)
759 precache_model (self.model);
760 setmodel (self, self.model); // precision set by mapper
761 setsize (self, self.mins, self.maxs);
768 floatfield Item_CounterField(float it)
772 case IT_SHELLS: return ammo_shells;
773 case IT_NAILS: return ammo_nails;
774 case IT_ROCKETS: return ammo_rockets;
775 case IT_CELLS: return ammo_cells;
776 case IT_5HP: return health;
777 case IT_25HP: return health;
778 case IT_HEALTH: return health;
779 case IT_ARMOR_SHARD: return armorvalue;
780 case IT_ARMOR: return armorvalue;
781 // add more things here (health, armor)
782 default: error("requested item has no counter field");
786 float Item_WeaponCode(float it)
790 case IT_LASER: return WEP_LASER;
791 case IT_SHOTGUN: return WEP_SHOTGUN;
792 case IT_UZI: return WEP_UZI;
793 case IT_GRENADE_LAUNCHER: return WEP_GRENADE_LAUNCHER;
794 case IT_ELECTRO: return WEP_ELECTRO;
795 case IT_CRYLINK: return WEP_CRYLINK;
796 case IT_NEX: return WEP_NEX;
797 case IT_HAGAR: return WEP_HAGAR;
798 case IT_ROCKET_LAUNCHER: return WEP_ROCKET_LAUNCHER;
803 void Item_SpawnByItemCode(float it)
807 case IT_SHOTGUN: weapon_shotgun(); break;
808 case IT_UZI: weapon_uzi(); break;
809 case IT_GRENADE_LAUNCHER: weapon_grenadelauncher(); break;
810 case IT_ELECTRO: weapon_electro(); break;
811 case IT_CRYLINK: weapon_crylink(); break;
812 case IT_NEX: weapon_nex(); break;
813 case IT_HAGAR: weapon_hagar(); break;
814 case IT_ROCKET_LAUNCHER: weapon_rocketlauncher(); break;
815 // add all other item spawn functions here
817 error("requested item can't be spawned");