home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / mhfsv22 / items.qc < prev    next >
Encoding:
Text File  |  1996-08-24  |  32.5 KB  |  1,532 lines

  1. void() W_SetCurrentAmmo;
  2. /* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
  3. BE .8 .3 .4 IN COLOR */
  4.  
  5.  
  6. void() SUB_regen =
  7. {
  8.     self.model = self.mdl;        // restore original model
  9.     self.solid = SOLID_TRIGGER;    // allow it to be touched again
  10.     sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);    // play respawn sound
  11.     setorigin (self, self.origin);
  12. };
  13.  
  14.  
  15.  
  16. /*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
  17. prints a warning message when spawned
  18. */
  19. void() noclass =
  20. {
  21.     dprint ("noclass spawned at");
  22.     dprint (vtos(self.origin));
  23.     dprint ("\n");
  24.     remove (self);
  25. };
  26.  
  27.  
  28.  
  29. /*
  30. ============
  31. PlaceItem
  32.  
  33. plants the object on the floor
  34. ============
  35. */
  36. void() PlaceItem =
  37. {
  38.     local float    oldz;
  39.  
  40.     self.mdl = self.model;        // so it can be restored on respawn
  41.     self.flags = FL_ITEM;        // make extra wide
  42.     self.solid = SOLID_TRIGGER;
  43.     self.movetype = MOVETYPE_TOSS;    
  44.     self.velocity = '0 0 0';
  45.     self.origin_z = self.origin_z + 6;
  46.     oldz = self.origin_z;
  47.     if (!droptofloor())
  48.     {
  49.         dprint ("Bonus item fell out of level at ");
  50.         dprint (vtos(self.origin));
  51.         dprint ("\n");
  52.         remove(self);
  53.         return;
  54.     }
  55. };
  56.  
  57. /*
  58. ============
  59. StartItem
  60.  
  61. Sets the clipping size and plants the object on the floor
  62. ============
  63. */
  64. void() StartItem =
  65. {
  66.     self.nextthink = time + 0.2;    // items start after other solids
  67.     self.think = PlaceItem;
  68. };
  69.  
  70. /*
  71. =========================================================================
  72.  
  73. HEALTH BOX
  74.  
  75. =========================================================================
  76. */
  77. //
  78. // T_Heal: add health to an entity, limiting health to max_health
  79. // "ignore" will ignore max_health limit
  80. //
  81. float (entity e, float healamount, float ignore) T_Heal =
  82. {
  83.     if (e.health <= 0)
  84.         return 0;
  85.     if ((!ignore) && (e.health >= other.max_health))
  86.         return 0;
  87.     healamount = ceil(healamount);
  88.  
  89.     e.health = e.health + healamount;
  90.     if ((!ignore) && (e.health >= other.max_health))
  91.         e.health = other.max_health;
  92.         
  93.     if (e.health > 250)
  94.         e.health = 250;
  95.     return 1;
  96. };
  97.  
  98. /*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth
  99. Health box. Normally gives 25 points.
  100. Rotten box heals 5-10 points,
  101. megahealth will add 100 health, then 
  102. rot you down to your maximum health limit, 
  103. one point per second.
  104. */
  105.  
  106. float    H_ROTTEN = 1;
  107. float    H_MEGA = 2;
  108. .float    healamount, healtype;
  109. void() health_touch;
  110. void() item_megahealth_rot;
  111.  
  112. void() item_health =
  113. {    
  114.     self.touch = health_touch;
  115.  
  116.     if (self.spawnflags & H_ROTTEN)
  117.     {
  118.         precache_model("maps/b_bh10.bsp");
  119.  
  120.         precache_sound("items/r_item1.wav");
  121.         setmodel(self, "maps/b_bh10.bsp");
  122.         self.noise = "items/r_item1.wav";
  123.         self.healamount = 15;
  124.         self.healtype = 0;
  125.     }
  126.     else
  127.     if (self.spawnflags & H_MEGA)
  128.     {
  129.         precache_model("maps/b_bh100.bsp");
  130.         precache_sound("items/r_item2.wav");
  131.         setmodel(self, "maps/b_bh100.bsp");
  132.         self.noise = "items/r_item2.wav";
  133.         self.healamount = 100;
  134.         self.healtype = 2;
  135.     }
  136.     else
  137.     {
  138.         precache_model("maps/b_bh25.bsp");
  139.         precache_sound("items/health1.wav");
  140.         setmodel(self, "maps/b_bh25.bsp");
  141.         self.noise = "items/health1.wav";
  142.         self.healamount = 25;
  143.         self.healtype = 1;
  144.     }
  145.     setsize (self, '0 0 0', '32 32 56');
  146.     StartItem ();
  147. };
  148.  
  149.  
  150. void() health_touch =
  151. {
  152.     local    float amount;
  153.     local    string    s;
  154.     
  155.     if (other.classname != "player")
  156.         return;
  157.     
  158.     if (self.healtype == 2) // Megahealth?  Ignore max_health...
  159.     {
  160.         if (other.health >= 250)
  161.             return;
  162.         if (!T_Heal(other, self.healamount, 1))
  163.             return;
  164.     }
  165.     else
  166.     {
  167.         if (!T_Heal(other, self.healamount, 0))
  168.             return;
  169.     }
  170.     
  171.     sprint(other, "You receive ");
  172.     s = ftos(self.healamount);
  173.     sprint(other, s);
  174.     sprint(other, " health\n");
  175.     
  176. // health touch sound
  177.     sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  178.  
  179.     stuffcmd (other, "bf\n");
  180.     
  181.     self.model = string_null;
  182.     self.solid = SOLID_NOT;
  183.  
  184.     // Megahealth = rot down the player's super health
  185.     if (self.healtype == 2)
  186.     {
  187.         other.items = other.items | IT_SUPERHEALTH;
  188.         self.nextthink = time + 5;
  189.         self.think = item_megahealth_rot;
  190.         self.owner = other;
  191.     }
  192.     else
  193.     {
  194.         if (deathmatch != 2)        // deathmatch 2 is the silly old rules
  195.         {
  196.             if (deathmatch)
  197.                 self.nextthink = time + health_respawn_time;
  198.             self.think = SUB_regen;
  199.         }
  200.     }
  201.     
  202.     activator = other;
  203.     SUB_UseTargets();                // fire all targets / killtargets
  204. };    
  205.  
  206. void() item_megahealth_rot =
  207. {
  208.     other = self.owner;
  209.     
  210.     if (other.health > other.max_health)
  211.     {
  212.         other.health = other.health - 1;
  213.         self.nextthink = time + 1;
  214.         return;
  215.     }
  216.  
  217. // it is possible for a player to die and respawn between rots, so don't
  218. // just blindly subtract the flag off
  219.     other.items = other.items - (other.items & IT_SUPERHEALTH);
  220.     
  221.     if (deathmatch == 1)    // deathmatch 2 is silly old rules
  222.     {
  223.         self.nextthink = time + power_respawn_time;
  224.         self.think = SUB_regen;
  225.     }
  226. };
  227.  
  228. /*
  229. ===============================================================================
  230.  
  231. ARMOR
  232.  
  233. ===============================================================================
  234. */
  235.  
  236. void() armor_touch;
  237.  
  238. void() armor_touch =
  239. {
  240.     local    float    type, value, bit;
  241.     
  242.     if (other.health <= 0)
  243.         return;
  244.     if (other.classname != "player")
  245.         return;
  246.  
  247.     if (self.classname == "item_armor1")
  248.     {
  249.         type = 0.3;
  250.         value = 100;
  251.         bit = IT_ARMOR1;
  252.     }
  253.     if (self.classname == "item_armor2")
  254.     {
  255.         type = 0.6;
  256.         value = 150;
  257.         bit = IT_ARMOR2;
  258.     }
  259.     if (self.classname == "item_armorInv")
  260.     {
  261.         type = 0.8;
  262.         value = 200;
  263.         bit = IT_ARMOR3;
  264.     }
  265.     if (other.armortype*other.armorvalue >= type*value)
  266.         return;
  267.         
  268.     other.armortype = type;
  269.     other.armorvalue = value;
  270.     other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
  271.  
  272.     self.solid = SOLID_NOT;
  273.     self.model = string_null;
  274.     if (deathmatch == 1)
  275.         self.nextthink = time + armor_respawn_time;
  276.     self.think = SUB_regen;
  277.  
  278.     sprint(other, "You got armor\n");
  279. // armor touch sound
  280.     sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
  281.     stuffcmd (other, "bf\n");
  282.     
  283.     activator = other;
  284.     SUB_UseTargets();                // fire all targets / killtargets
  285. };
  286.  
  287.  
  288. /*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
  289. */
  290.  
  291. void() item_armor1 =
  292. {
  293.     self.touch = armor_touch;
  294.     precache_model ("progs/armor.mdl");
  295.     setmodel (self, "progs/armor.mdl");
  296.     self.skin = 0;
  297.     setsize (self, '-16 -16 0', '16 16 56');
  298.     StartItem ();
  299. };
  300.  
  301. /*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
  302. */
  303.  
  304. void() item_armor2 =
  305. {
  306.     self.touch = armor_touch;
  307.     precache_model ("progs/armor.mdl");
  308.     setmodel (self, "progs/armor.mdl");
  309.     self.skin = 1;
  310.     setsize (self, '-16 -16 0', '16 16 56');
  311.     StartItem ();
  312. };
  313.  
  314. /*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
  315. */
  316.  
  317. void() item_armorInv =
  318. {
  319.     self.touch = armor_touch;
  320.     precache_model ("progs/armor.mdl");
  321.     setmodel (self, "progs/armor.mdl");
  322.     self.skin = 2;
  323.     setsize (self, '-16 -16 0', '16 16 56');
  324.     StartItem ();
  325. };
  326.  
  327. /*
  328. ===============================================================================
  329.  
  330. WEAPONS
  331.  
  332. ===============================================================================
  333. */
  334.  
  335. void() bound_other_ammo =
  336. {
  337.     if (other.ammo_shells > 200)
  338.         other.ammo_shells = 200;
  339.     if (other.ammo_nails > 200)
  340.         other.ammo_nails = 200;
  341.     if (other.ammo_rockets > 100)
  342.         other.ammo_rockets = 100;        
  343.     if (other.ammo_cells > 100)
  344.         other.ammo_cells = 100;        
  345. };
  346.  
  347.  
  348. float(float w) RankForWeapon =
  349. {
  350.     if (w == IT_LIGHTNING)
  351.         return 1;
  352.     if (w == IT_ROCKET_LAUNCHER)
  353.         return 2;
  354.     if (w == IT_ROCKET_OLD)
  355.         return 4;
  356.     if (w == IT_MISSILE_LAUNCHER)
  357.         return 3;
  358.     if (w == IT_SUPER_NAILGUN)
  359.         return 7;
  360.     if (w == IT_GRENADE_LAUNCHER)
  361.         return 6;
  362.     if (w == IT_PIPE_BOMBS)
  363.         return 5;
  364.     if (w == IT_SUPER_SHOTGUN)
  365.         return 9;
  366.     if (w == IT_NAILGUN)
  367.         return 8;
  368.     return 10;
  369. };
  370.  
  371. /*
  372. =============
  373. Deathmatch_Weapon
  374.  
  375. Deathmatch weapon change rules for picking up a weapon
  376.  
  377. .float        ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
  378. =============
  379. */
  380. void(float old, float new) Deathmatch_Weapon =
  381. {
  382.     local float or, nr;
  383.  
  384. // change self.weapon if desired
  385.     or = RankForWeapon (self.weapon);
  386.     nr = RankForWeapon (new);
  387.     if ( nr < or )
  388.         self.weapon = new;
  389. };
  390.  
  391. /*
  392. =============
  393. weapon_touch
  394. =============
  395. */
  396. float() W_BestWeapon;
  397.  
  398. void() weapon_touch =
  399. {
  400.     local    float    hadammo, best, new, old;
  401.     local    entity    stemp;
  402.     local    float    leave;
  403.  
  404.     if (!(other.flags & FL_CLIENT))
  405.         return;
  406.  
  407. // if the player was using his best weapon, change up to the new one if better        
  408.     stemp = self;
  409.     self = other;
  410.     best = W_BestWeapon();
  411.     self = stemp;
  412.  
  413.     if (deathmatch == 2 || coop)
  414.         leave = 1;
  415.     else
  416.         leave = 0;
  417.     
  418.     if (self.classname == "weapon_nailgun")
  419.     {
  420.         if (leave && (other.items & IT_NAILGUN) )
  421.             return;
  422.         hadammo = other.ammo_rockets;            
  423.         new = IT_NAILGUN;
  424.         other.ammo_shells = other.ammo_shells + 50;
  425.     }
  426.     else if (self.classname == "weapon_supernailgun")
  427.     {
  428.         if (leave && (other.items & IT_SUPER_NAILGUN) )
  429.             return;
  430.         hadammo = other.ammo_rockets;            
  431.         new = IT_SUPER_NAILGUN;
  432.         other.ammo_nails = other.ammo_nails + 50;
  433.     }
  434.     else if (self.classname == "weapon_supershotgun")
  435.     {
  436.         if (leave && (other.items & IT_SUPER_SHOTGUN) )
  437.             return;
  438.         hadammo = other.ammo_rockets;            
  439.         new = IT_SUPER_SHOTGUN;
  440. //        other.ammo_shells = other.ammo_shells + 5;
  441.     }
  442.     else if (self.classname == "weapon_rocketlauncher")
  443.     {
  444.         if (leave && (other.items & IT_ROCKET_LAUNCHER) )
  445.             return;
  446.         hadammo = other.ammo_rockets;            
  447.         new = IT_ROCKET_LAUNCHER;
  448.         other.ammo_rockets = other.ammo_rockets + 20;
  449.     }
  450.     else if (self.classname == "weapon_grenadelauncher")
  451.     {
  452.         if (leave && (other.items & IT_GRENADE_LAUNCHER) )
  453.             return;
  454.         hadammo = other.ammo_rockets;            
  455.         new = IT_GRENADE_LAUNCHER;
  456.         other.ammo_rockets = other.ammo_rockets + 10;
  457.     }
  458.     else if (self.classname == "weapon_lightning")
  459.     {
  460.         if (leave && (other.items & IT_LIGHTNING) )
  461.             return;
  462.         hadammo = other.ammo_rockets;            
  463.         new = IT_LIGHTNING;
  464.         other.ammo_cells = other.ammo_cells + 15;
  465.     }
  466.     else
  467.         objerror ("weapon_touch: unknown classname");
  468.  
  469.     sprint (other, "You got the ");
  470.     sprint (other, self.netname);
  471.     sprint (other, "\n");
  472. // weapon touch sound
  473.     sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
  474.     stuffcmd (other, "bf\n");
  475.  
  476.     bound_other_ammo ();
  477.  
  478. // change to the weapon
  479.     old = other.items;
  480.     other.items = other.items | new;
  481.     
  482.     stemp = self;
  483.     self = other;
  484.  
  485. //    if (!deathmatch)
  486. //        self.weapon = new;
  487. //    else
  488.     Deathmatch_Weapon (old, new);
  489.  
  490.     W_SetCurrentAmmo();
  491.  
  492.     self = stemp;
  493.  
  494.     if (leave)
  495.         return;
  496.  
  497. // remove it in single player, or setup for respawning in deathmatch
  498.     self.model = string_null;
  499.     self.solid = SOLID_NOT;
  500.     if (deathmatch == 1)
  501.         self.nextthink = time + weapon_respawn_time;
  502.     self.think = SUB_regen;
  503.     
  504.     activator = other;
  505.     SUB_UseTargets();                // fire all targets / killtargets
  506. };
  507.  
  508.  
  509. /*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32)
  510. */
  511.  
  512. void() weapon_supershotgun =
  513. {
  514.     precache_model ("progs/g_shot.mdl");
  515.     setmodel (self, "progs/g_shot.mdl");
  516.     self.weapon = IT_SUPER_SHOTGUN;
  517.     self.netname = "Double-barrelled Shotgun";
  518.     self.touch = weapon_touch;
  519.     setsize (self, '-16 -16 0', '16 16 56');
  520.     StartItem ();
  521. };
  522.  
  523. /*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32)
  524. */
  525.  
  526. void() weapon_nailgun =
  527. {
  528.     precache_model ("progs/g_nail.mdl");
  529.     setmodel (self, "progs/g_nail.mdl");
  530.     self.weapon = IT_NAILGUN;
  531.     self.netname = "Pulse Cannon";
  532.     self.touch = weapon_touch;
  533.     setsize (self, '-16 -16 0', '16 16 56');
  534.     StartItem ();
  535. };
  536.  
  537. /*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32)
  538. */
  539.  
  540. void() weapon_supernailgun =
  541. {
  542.     precache_model ("progs/g_nail2.mdl");
  543.     setmodel (self, "progs/g_nail2.mdl");
  544.     self.weapon = IT_SUPER_NAILGUN;
  545.     self.netname = "Super Nailgun";
  546.     self.touch = weapon_touch;
  547.     setsize (self, '-16 -16 0', '16 16 56');
  548.     StartItem ();
  549. };
  550.  
  551. /*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32)
  552. */
  553.  
  554. void() weapon_grenadelauncher =
  555. {
  556.     precache_model ("progs/g_rock.mdl");
  557.     setmodel (self, "progs/g_rock.mdl");
  558.     self.weapon = 3;
  559.     self.netname = "Grenade Launcher";
  560.     self.touch = weapon_touch;
  561.     setsize (self, '-16 -16 0', '16 16 56');
  562.     StartItem ();
  563. };
  564.  
  565. /*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32)
  566. */
  567.  
  568. void() weapon_rocketlauncher =
  569. {
  570.     precache_model ("progs/g_rock2.mdl");
  571.     setmodel (self, "progs/g_rock2.mdl");
  572.     self.weapon = 3;
  573.     self.netname = "Rocket Launcher";
  574.     self.touch = weapon_touch;
  575.     setsize (self, '-16 -16 0', '16 16 56');
  576.     StartItem ();
  577. };
  578.  
  579.  
  580. /*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32)
  581. */
  582.  
  583. void() weapon_lightning =
  584. {
  585.     precache_model ("progs/g_light.mdl");
  586.     setmodel (self, "progs/g_light.mdl");
  587.     self.weapon = 3;
  588.     self.netname = "Thunderbolt";
  589.     self.touch = weapon_touch;
  590.     setsize (self, '-16 -16 0', '16 16 56');
  591.     StartItem ();
  592. };
  593.  
  594.  
  595. /*
  596. ===============================================================================
  597.  
  598. AMMO
  599.  
  600. ===============================================================================
  601. */
  602.  
  603. void() ammo_touch =
  604. {
  605. local entity    stemp;
  606. local float        best;
  607.  
  608.     if (other.classname != "player")
  609.         return;
  610.     if (other.health <= 0)
  611.         return;
  612.  
  613. // if the player was using his best weapon, change up to the new one if better        
  614.     stemp = self;
  615.     self = other;
  616.     best = W_BestWeapon();
  617.     self = stemp;
  618.  
  619.  
  620. // shotgun
  621.     if (self.weapon == 1)
  622.     {
  623.         if (other.ammo_shells >= 200)
  624.             return;
  625.         other.ammo_shells = other.ammo_shells + self.aflag;
  626.     }
  627.  
  628. // spikes
  629.     if (self.weapon == 2)
  630.     {
  631.         if (other.ammo_nails >= 200)
  632.             return;
  633.         other.ammo_nails = other.ammo_nails + self.aflag;
  634.     }
  635.  
  636. //    rockets
  637.     if (self.weapon == 3)
  638.     {
  639.         if (other.ammo_rockets >= 100)
  640.             return;
  641.         other.ammo_rockets = other.ammo_rockets + self.aflag;
  642.     }
  643.  
  644. //    cells
  645.     if (self.weapon == 4)
  646.     {
  647.         if (other.ammo_cells >= 200)
  648.             return;
  649.         other.ammo_cells = other.ammo_cells + self.aflag;
  650.     }
  651.  
  652.     bound_other_ammo ();
  653.     
  654.     sprint (other, "You got the ");
  655.     sprint (other, self.netname);
  656.     sprint (other, "\n");
  657. // ammo touch sound
  658.     sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
  659.     stuffcmd (other, "bf\n");
  660.  
  661. // change to a better weapon if appropriate
  662.  
  663.     if ( other.weapon == best )
  664.     {
  665.         stemp = self;
  666.         self = other;
  667.         self.weapon = W_BestWeapon();
  668.         W_SetCurrentAmmo ();
  669.         self = stemp;
  670.     }
  671.  
  672. // if changed current ammo, update it
  673.     stemp = self;
  674.     self = other;
  675.     W_SetCurrentAmmo();
  676.     self = stemp;
  677.  
  678. // remove it in single player, or setup for respawning in deathmatch
  679.     self.model = string_null;
  680.     self.solid = SOLID_NOT;
  681.     if (deathmatch == 1)
  682.         self.nextthink = time + ammo_respawn_time;
  683.     
  684.     self.think = SUB_regen;
  685.  
  686.     activator = other;
  687.     SUB_UseTargets();                // fire all targets / killtargets
  688. };
  689.  
  690.  
  691.  
  692.  
  693. float WEAPON_BIG2 = 1;
  694.  
  695. /*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) big
  696. */
  697.  
  698. void() item_shells =
  699. {
  700.     self.touch = ammo_touch;
  701.  
  702.     if (self.spawnflags & WEAPON_BIG2)
  703.     {
  704.         precache_model ("maps/b_shell1.bsp");
  705.         setmodel (self, "maps/b_shell1.bsp");
  706.         self.aflag = 40;
  707.     }
  708.     else
  709.     {
  710.         precache_model ("maps/b_shell0.bsp");
  711.         setmodel (self, "maps/b_shell0.bsp");
  712.         self.aflag = 20;
  713.     }
  714.     self.weapon = 1;
  715.     self.netname = "pulse rounds";
  716.     setsize (self, '0 0 0', '32 32 56');
  717.     StartItem ();
  718. };
  719.  
  720. /*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) big
  721. */
  722.  
  723. void() item_spikes =
  724. {
  725.     self.touch = ammo_touch;
  726.  
  727.     if (self.spawnflags & WEAPON_BIG2)
  728.     {
  729.         precache_model ("maps/b_nail1.bsp");
  730.         setmodel (self, "maps/b_nail1.bsp");
  731.         self.aflag = 50;
  732.     }
  733.     else
  734.     {
  735.         precache_model ("maps/b_nail0.bsp");
  736.         setmodel (self, "maps/b_nail0.bsp");
  737.         self.aflag = 25;
  738.     }
  739.     self.weapon = 2;
  740.     self.netname = "nails";
  741.     setsize (self, '0 0 0', '32 32 56');
  742.     StartItem ();
  743. };
  744.  
  745. /*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) big
  746. */
  747.  
  748. void() item_rockets =
  749. {
  750.     self.touch = ammo_touch;
  751.  
  752.     if (self.spawnflags & WEAPON_BIG2)
  753.     {
  754.         precache_model ("maps/b_rock1.bsp");
  755.         setmodel (self, "maps/b_rock1.bsp");
  756.         self.aflag = 10;
  757.     }
  758.     else
  759.     {
  760.         precache_model ("maps/b_rock0.bsp");
  761.         setmodel (self, "maps/b_rock0.bsp");
  762.         self.aflag = 5;
  763.     }
  764.     self.weapon = 3;
  765.     self.netname = "rockets";
  766.     setsize (self, '0 0 0', '32 32 56');
  767.     StartItem ();
  768. };
  769.  
  770.  
  771. /*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) big
  772. */
  773.  
  774. void() item_cells =
  775. {
  776.     self.touch = ammo_touch;
  777.  
  778.     if (self.spawnflags & WEAPON_BIG2)
  779.     {
  780.         precache_model ("maps/b_batt1.bsp");
  781.         setmodel (self, "maps/b_batt1.bsp");
  782.         self.aflag = 12;
  783.     }
  784.     else
  785.     {
  786.         precache_model ("maps/b_batt0.bsp");
  787.         setmodel (self, "maps/b_batt0.bsp");
  788.         self.aflag = 6;
  789.     }
  790.     self.weapon = 4;
  791.     self.netname = "cells";
  792.     setsize (self, '0 0 0', '32 32 56');
  793.     StartItem ();
  794. };
  795.  
  796.  
  797. /*QUAKED item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big
  798. DO NOT USE THIS!!!! IT WILL BE REMOVED!
  799. */
  800.  
  801. float WEAPON_SHOTGUN = 1;
  802. float WEAPON_ROCKET = 2;
  803. float WEAPON_SPIKES = 4;
  804. float WEAPON_BIG = 8;
  805. void() item_weapon =
  806. {
  807.     self.touch = ammo_touch;
  808.  
  809.     if (self.spawnflags & WEAPON_SHOTGUN)
  810.     {
  811.         if (self.spawnflags & WEAPON_BIG)
  812.         {
  813.             precache_model ("maps/b_shell1.bsp");
  814.             setmodel (self, "maps/b_shell1.bsp");
  815.             self.aflag = 40;
  816.         }
  817.         else
  818.         {
  819.             precache_model ("maps/b_shell0.bsp");
  820.             setmodel (self, "maps/b_shell0.bsp");
  821.             self.aflag = 20;
  822.         }
  823.         self.weapon = 1;
  824.         self.netname = "pulse rounds";
  825.     }
  826.  
  827.     if (self.spawnflags & WEAPON_SPIKES)
  828.     {
  829.         if (self.spawnflags & WEAPON_BIG)
  830.         {
  831.             precache_model ("maps/b_nail1.bsp");
  832.             setmodel (self, "maps/b_nail1.bsp");
  833.             self.aflag = 40;
  834.         }
  835.         else
  836.         {
  837.             precache_model ("maps/b_nail0.bsp");
  838.             setmodel (self, "maps/b_nail0.bsp");
  839.             self.aflag = 20;
  840.         }
  841.         self.weapon = 2;
  842.         self.netname = "nails";
  843.     }
  844.  
  845.     if (self.spawnflags & WEAPON_ROCKET)
  846.     {
  847.         if (self.spawnflags & WEAPON_BIG)
  848.         {
  849.             precache_model ("maps/b_rock1.bsp");
  850.             setmodel (self, "maps/b_rock1.bsp");
  851.             self.aflag = 10;
  852.         }
  853.         else
  854.         {
  855.             precache_model ("maps/b_rock0.bsp");
  856.             setmodel (self, "maps/b_rock0.bsp");
  857.             self.aflag = 5;
  858.         }
  859.         self.weapon = 3;
  860.         self.netname = "rockets";
  861.     }
  862.     
  863.     setsize (self, '0 0 0', '32 32 56');
  864.     StartItem ();
  865. };
  866.  
  867.  
  868. /*
  869. ===============================================================================
  870.  
  871. KEYS
  872.  
  873. ===============================================================================
  874. */
  875.  
  876. void() key_touch =
  877. {
  878. local entity    stemp;
  879. local float        best;
  880.  
  881.     if (other.classname != "player")
  882.         return;
  883.     if (other.health <= 0)
  884.         return;
  885.     if (other.items & self.items)
  886.         return;
  887.  
  888.     sprint (other, "You got the ");
  889.     sprint (other, self.netname);
  890.     sprint (other,"\n");
  891.  
  892.     sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  893.     stuffcmd (other, "bf\n");
  894.     other.items = other.items | self.items;
  895.  
  896.     if (!coop)
  897.     {    
  898.         self.solid = SOLID_NOT;
  899.         self.model = string_null;
  900.     }
  901.  
  902.     activator = other;
  903.     SUB_UseTargets();                // fire all targets / killtargets
  904. };
  905.  
  906.  
  907. void() key_setsounds =
  908. {
  909.     if (world.worldtype == 0)
  910.     {
  911.         precache_sound ("misc/medkey.wav");
  912.         self.noise = "misc/medkey.wav";
  913.     }
  914.     if (world.worldtype == 1)
  915.     {
  916.         precache_sound ("misc/runekey.wav");
  917.         self.noise = "misc/runekey.wav";
  918.     }
  919.     if (world.worldtype == 2)
  920.     {
  921.         precache_sound2 ("misc/basekey.wav");
  922.         self.noise = "misc/basekey.wav";
  923.     }
  924. };
  925.  
  926. /*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32)
  927. SILVER key
  928. In order for keys to work
  929. you MUST set your maps
  930. worldtype to one of the
  931. following:
  932. 0: medieval
  933. 1: metal
  934. 2: base
  935. */
  936.  
  937. void() item_key1 =
  938. {
  939.     if (world.worldtype == 0)
  940.     {
  941.         precache_model ("progs/w_s_key.mdl");
  942.         setmodel (self, "progs/w_s_key.mdl");
  943.         self.netname = "silver key";
  944.     }
  945.     else if (world.worldtype == 1)
  946.     {
  947.         precache_model ("progs/m_s_key.mdl");
  948.         setmodel (self, "progs/m_s_key.mdl");
  949.         self.netname = "silver runekey";
  950.     }
  951.     else if (world.worldtype == 2)
  952.     {
  953.         precache_model2 ("progs/b_s_key.mdl");
  954.         setmodel (self, "progs/b_s_key.mdl");
  955.         self.netname = "silver keycard";
  956.     }
  957.     key_setsounds();
  958.     self.touch = key_touch;
  959.     self.items = IT_KEY1;
  960.     setsize (self, '-16 -16 -24', '16 16 32');
  961.     StartItem ();
  962. };
  963.  
  964. /*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32)
  965. GOLD key
  966. In order for keys to work
  967. you MUST set your maps
  968. worldtype to one of the
  969. following:
  970. 0: medieval
  971. 1: metal
  972. 2: base
  973. */
  974.  
  975. void() item_key2 =
  976. {
  977.     if (world.worldtype == 0)
  978.     {
  979.         precache_model ("progs/w_g_key.mdl");
  980.         setmodel (self, "progs/w_g_key.mdl");
  981.         self.netname = "gold key";
  982.     }
  983.     if (world.worldtype == 1)
  984.     {
  985.         precache_model ("progs/m_g_key.mdl");
  986.         setmodel (self, "progs/m_g_key.mdl");
  987.         self.netname = "gold runekey";
  988.     }
  989.     if (world.worldtype == 2)
  990.     {
  991.         precache_model2 ("progs/b_g_key.mdl");
  992.         setmodel (self, "progs/b_g_key.mdl");
  993.         self.netname = "gold keycard";
  994.     }
  995.     key_setsounds();
  996.     self.touch = key_touch;
  997.     self.items = IT_KEY2;
  998.     setsize (self, '-16 -16 -24', '16 16 32');
  999.     StartItem ();
  1000. };
  1001.  
  1002.  
  1003.  
  1004. /*
  1005. ===============================================================================
  1006.  
  1007. END OF LEVEL RUNES
  1008.  
  1009. ===============================================================================
  1010. */
  1011.  
  1012. void() sigil_touch =
  1013. {
  1014. local entity    stemp;
  1015. local float        best;
  1016.  
  1017.     if (other.classname != "player")
  1018.         return;
  1019.     if (other.health <= 0)
  1020.         return;
  1021.  
  1022.     centerprint (other, "You got the rune!");
  1023.  
  1024.     sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  1025.     stuffcmd (other, "bf\n");
  1026.     self.solid = SOLID_NOT;
  1027.     self.model = string_null;
  1028.     serverflags = serverflags | (self.spawnflags & 15);
  1029.     self.classname = "";        // so rune doors won't find it
  1030.     
  1031.     activator = other;
  1032.     SUB_UseTargets();                // fire all targets / killtargets
  1033. };
  1034.  
  1035.  
  1036. /*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4
  1037. End of level sigil, pick up to end episode and return to jrstart.
  1038. */
  1039.  
  1040. void() item_sigil =
  1041. {
  1042.     if (!self.spawnflags)
  1043.         objerror ("no spawnflags");
  1044.  
  1045.     precache_sound ("misc/runekey.wav");
  1046.     self.noise = "misc/runekey.wav";
  1047.  
  1048.     if (self.spawnflags & 1)
  1049.     {
  1050.         precache_model ("progs/end1.mdl");
  1051.         setmodel (self, "progs/end1.mdl");
  1052.     }
  1053.     if (self.spawnflags & 2)
  1054.     {
  1055.         precache_model2 ("progs/end2.mdl");
  1056.         setmodel (self, "progs/end2.mdl");
  1057.     }
  1058.     if (self.spawnflags & 4)
  1059.     {
  1060.         precache_model2 ("progs/end3.mdl");
  1061.         setmodel (self, "progs/end3.mdl");
  1062.     }
  1063.     if (self.spawnflags & 8)
  1064.     {
  1065.         precache_model2 ("progs/end4.mdl");
  1066.         setmodel (self, "progs/end4.mdl");
  1067.     }
  1068.     
  1069.     self.touch = sigil_touch;
  1070.     setsize (self, '-16 -16 -24', '16 16 32');
  1071.     StartItem ();
  1072. };
  1073.  
  1074. /*
  1075. ===============================================================================
  1076.  
  1077. POWERUPS
  1078.  
  1079. ===============================================================================
  1080. */
  1081.  
  1082. void() powerup_touch;
  1083.  
  1084.  
  1085. void() powerup_touch =
  1086. {
  1087. local entity    stemp;
  1088. local float        best;
  1089.  
  1090.     if (other.classname != "player")
  1091.         return;
  1092.     if (other.health <= 0)
  1093.         return;
  1094.  
  1095.     sprint (other, "You got the ");
  1096.     sprint (other, self.netname);
  1097.     sprint (other,"\n");
  1098.  
  1099.     if (deathmatch)
  1100.     {
  1101.         self.mdl = self.model;
  1102.         
  1103.         if ((self.classname == "item_artifact_invulnerability") ||
  1104.             (self.classname == "item_artifact_invisibility"))
  1105.             self.nextthink = time + power_respawn_time;
  1106.         else
  1107.             self.nextthink = time + power_respawn_time;
  1108.         
  1109.         self.think = SUB_regen;
  1110.     }    
  1111.  
  1112.     sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  1113.     stuffcmd (other, "bf\n");
  1114.     self.solid = SOLID_NOT;
  1115.     other.items = other.items | self.items;
  1116.     self.model = string_null;
  1117.  
  1118. // do the apropriate action
  1119.     if (self.classname == "item_artifact_envirosuit")
  1120.     {
  1121.         other.rad_time = 1;
  1122.         other.radsuit_finished = time + 30;
  1123.     }
  1124.     
  1125.     if (self.classname == "item_artifact_invulnerability")
  1126.     {
  1127.         other.invincible_time = 1;
  1128.         other.invincible_finished = time + 30;
  1129.     }
  1130.     
  1131.     if (self.classname == "item_artifact_invisibility")
  1132.     {
  1133.         other.invisible_time = 1;
  1134.         other.invisible_finished = time + 30;
  1135.     }
  1136.  
  1137.     if (self.classname == "item_artifact_super_damage")
  1138.     {
  1139.         other.super_time = 1;
  1140.         other.super_damage_finished = time + 30;
  1141.     }    
  1142.  
  1143.     activator = other;
  1144.     SUB_UseTargets();                // fire all targets / killtargets
  1145. };
  1146.  
  1147.  
  1148.  
  1149. /*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
  1150. Player is invulnerable for 30 seconds
  1151. */
  1152. void() item_artifact_invulnerability =
  1153. {
  1154.     self.touch = powerup_touch;
  1155.  
  1156.     precache_model ("progs/invulner.mdl");
  1157.     precache_sound ("items/protect.wav");
  1158.     precache_sound ("items/protect2.wav");
  1159.     precache_sound ("items/protect3.wav");
  1160.     self.noise = "items/protect.wav";
  1161.     setmodel (self, "progs/invulner.mdl");
  1162.     self.netname = "Pentagram of Protection";
  1163.     self.items = IT_INVULNERABILITY;
  1164.     setsize (self, '-16 -16 -24', '16 16 32');
  1165.     StartItem ();
  1166. };
  1167.  
  1168. /*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32)
  1169. Player takes no damage from water or slime for 30 seconds
  1170. */
  1171. void() item_artifact_envirosuit =
  1172. {
  1173.     self.touch = powerup_touch;
  1174.  
  1175.     precache_model ("progs/suit.mdl");
  1176.     precache_sound ("items/suit.wav");
  1177.     precache_sound ("items/suit2.wav");
  1178.     self.noise = "items/suit.wav";
  1179.     setmodel (self, "progs/suit.mdl");
  1180.     self.netname = "Biosuit";
  1181.     self.items = IT_SUIT;
  1182.     setsize (self, '-16 -16 -24', '16 16 32');
  1183.     StartItem ();
  1184. };
  1185.  
  1186.  
  1187. /*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32)
  1188. Player is invisible for 30 seconds
  1189. */
  1190. void() item_artifact_invisibility =
  1191. {
  1192.     self.touch = powerup_touch;
  1193.  
  1194.     precache_model ("progs/invisibl.mdl");
  1195.     precache_sound ("items/inv1.wav");
  1196.     precache_sound ("items/inv2.wav");
  1197.     precache_sound ("items/inv3.wav");
  1198.     self.noise = "items/inv1.wav";
  1199.     setmodel (self, "progs/invisibl.mdl");
  1200.     self.netname = "Ring of Shadows";
  1201.     self.items = IT_INVISIBILITY;
  1202.     setsize (self, '-16 -16 -24', '16 16 32');
  1203.     StartItem ();
  1204. };
  1205.  
  1206.  
  1207. /*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
  1208. The next attack from the player will do 4x damage
  1209. */
  1210. void() item_artifact_super_damage =
  1211. {
  1212.     self.touch = powerup_touch;
  1213.  
  1214.     precache_model ("progs/quaddama.mdl");
  1215.     precache_sound ("items/damage.wav");
  1216.     precache_sound ("items/damage2.wav");
  1217.     precache_sound ("items/damage3.wav");
  1218.     self.noise = "items/damage.wav";
  1219.     setmodel (self, "progs/quaddama.mdl");
  1220.     self.netname = "Quad Damage";
  1221.     self.items = IT_QUAD;
  1222.     setsize (self, '-16 -16 -24', '16 16 32');
  1223.     StartItem ();
  1224. };
  1225.  
  1226.  
  1227.  
  1228. /*
  1229. ===============================================================================
  1230.  
  1231. PLAYER BACKPACKS
  1232.  
  1233. ===============================================================================
  1234. */
  1235.  
  1236. void() BackpackTouch =
  1237. {
  1238.     local string    s;
  1239.     local    float    best;
  1240.     local        entity    stemp;
  1241.     
  1242.     if (other.classname != "player")
  1243.         return;
  1244.     if (other.health <= 0)
  1245.         return;
  1246.         
  1247. // if the player was using his best weapon, change up to the new one if better        
  1248.     stemp = self;
  1249.     self = other;
  1250.     best = W_BestWeapon();
  1251.     self = stemp;
  1252.  
  1253. // change weapons
  1254.     other.ammo_shells = other.ammo_shells + self.ammo_shells;
  1255.     other.ammo_nails = other.ammo_nails + self.ammo_nails;
  1256.     other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
  1257.     other.ammo_cells = other.ammo_cells + self.ammo_cells;
  1258.  
  1259.     other.items = other.items | self.items;
  1260.     
  1261.     bound_other_ammo ();
  1262.  
  1263.     sprint (other, "You get ");
  1264.  
  1265.     if (self.ammo_shells)
  1266.     {
  1267.         s = ftos(self.ammo_shells);
  1268.         sprint (other, s);
  1269.         sprint (other, " pulse rounds  ");
  1270.     }
  1271.     if (self.ammo_nails)
  1272.     {
  1273.         s = ftos(self.ammo_nails);
  1274.         sprint (other, s);
  1275.         sprint (other, " nails ");
  1276.     }
  1277.     if (self.ammo_rockets)
  1278.     {
  1279.         s = ftos(self.ammo_rockets);
  1280.         sprint (other, s);
  1281.         sprint (other, " rockets  ");
  1282.     }
  1283.     if (self.ammo_cells)
  1284.     {
  1285.         s = ftos(self.ammo_cells);
  1286.         sprint (other, s);
  1287.         sprint (other, " cells  ");
  1288.     }
  1289.     
  1290.     sprint (other, "\n");
  1291. // backpack touch sound
  1292.     sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
  1293.     stuffcmd (other, "bf\n");
  1294.  
  1295. // change to a better weapon if appropriate
  1296.     if ( other.weapon == best )
  1297.     {
  1298.         stemp = self;
  1299.         self = other;
  1300.         self.weapon = W_BestWeapon();
  1301.         self = stemp;
  1302.     }
  1303.  
  1304.     
  1305.     remove(self);
  1306.     
  1307.     self = other;
  1308.     W_SetCurrentAmmo ();
  1309. };
  1310.  
  1311. /*
  1312. ===============
  1313. DropBackpack
  1314. ===============
  1315. */
  1316. void() DropBackpack =
  1317. {
  1318.     local entity    item;
  1319.  
  1320.     if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells))
  1321.         return;    // nothing in it
  1322.  
  1323.     item = spawn();
  1324.     item.origin = self.origin - '0 0 24';
  1325.     
  1326.     item.items = item.items - (item.items & (IT_INVISIBILITY | IT_QUAD | IT_INVULNERABILITY | IT_SUIT));
  1327.  
  1328.     item.ammo_shells = self.ammo_shells;
  1329.     item.ammo_nails = self.ammo_nails;
  1330.     item.ammo_rockets = self.ammo_rockets;
  1331.     item.ammo_cells = self.ammo_cells;
  1332.  
  1333.     item.velocity_z = 300;
  1334.     item.velocity_x = -100 + (random() * 200);
  1335.     item.velocity_y = -100 + (random() * 200);
  1336.     
  1337.     item.flags = FL_ITEM;
  1338.     item.solid = SOLID_TRIGGER;
  1339.     item.movetype = MOVETYPE_TOSS;
  1340.     setmodel (item, "progs/backpack.mdl");
  1341.     setsize (item, '-16 -16 0', '16 16 56');
  1342.     item.touch = BackpackTouch;
  1343.     
  1344.     item.nextthink = time + 120;    // remove after 2 minutes
  1345.     item.think = SUB_Remove;
  1346. };
  1347.  
  1348. /*
  1349. ===============================================================================
  1350.  
  1351. Weapon Drops
  1352.  
  1353. ===============================================================================
  1354. */
  1355.  
  1356.  
  1357.  
  1358. /*
  1359. ===============
  1360. Drop Pulse Cannon
  1361. ===============
  1362. */
  1363. void() Drop_PulseCannon =
  1364. {
  1365.     local entity    item;
  1366.  
  1367.     item = spawn();
  1368.     item.origin = self.origin + v_forward*100;
  1369.     item.ammo_shells = 50;
  1370.     item.items = IT_NAILGUN;
  1371.     makevectors (self.v_angle);
  1372.     item.velocity = aim(self, 10000);
  1373.     item.velocity = item.velocity * 200;
  1374.     item.velocity_z = 200;    
  1375.  
  1376.     item.flags = FL_ITEM;
  1377.     item.solid = SOLID_TRIGGER;
  1378.     item.movetype = MOVETYPE_TOSS;
  1379.     setmodel (item, "progs/backpack.mdl");
  1380.     setsize (item, '-16 -16 0', '16 16 56');
  1381.     item.touch = BackpackTouch;
  1382.     
  1383.     item.nextthink = time + 300;    // remove after 5 minutes
  1384.     item.think = SUB_Remove;
  1385. };
  1386.  
  1387. /*
  1388. ===============
  1389. Drop Super Shotgun
  1390. ===============
  1391. */
  1392. void() Drop_SuperShotgun =
  1393. {
  1394.     local entity    item;
  1395.  
  1396.     item = spawn();
  1397.     item.origin = self.origin + v_forward*100;
  1398.     item.items = IT_SUPER_SHOTGUN;
  1399.     makevectors (self.v_angle);
  1400.     item.velocity = aim(self, 10000);
  1401.     item.velocity = item.velocity * 200;
  1402.     item.velocity_z = 200;    
  1403.  
  1404.     item.flags = FL_ITEM;
  1405.     item.solid = SOLID_TRIGGER;
  1406.     item.movetype = MOVETYPE_TOSS;
  1407.     setmodel (item, "progs/backpack.mdl");
  1408.     setsize (item, '-16 -16 0', '16 16 56');
  1409.     item.touch = BackpackTouch;
  1410.     
  1411.     item.nextthink = time + 300;    // remove after 5 minutes
  1412.     item.think = SUB_Remove;
  1413. };
  1414.  
  1415. /*
  1416. ===============
  1417. Drop Super Nailgun
  1418. ===============
  1419. */
  1420. void() Drop_SuperNailgun =
  1421. {
  1422.     local entity    item;
  1423.  
  1424.     item = spawn();
  1425.     item.origin = self.origin + v_forward*100;
  1426.     item.ammo_nails = 50;
  1427.     item.items = IT_SUPER_NAILGUN;
  1428.     makevectors (self.v_angle);
  1429.     item.velocity = aim(self, 10000);
  1430.     item.velocity = item.velocity * 200;
  1431.     item.velocity_z = 200;    
  1432.  
  1433.     item.flags = FL_ITEM;
  1434.     item.solid = SOLID_TRIGGER;
  1435.     item.movetype = MOVETYPE_TOSS;
  1436.     setmodel (item, "progs/backpack.mdl");
  1437.     setsize (item, '-16 -16 0', '16 16 56');
  1438.     item.touch = BackpackTouch;
  1439.     
  1440.     item.nextthink = time + 300;    // remove after 5 minutes
  1441.     item.think = SUB_Remove;
  1442. };
  1443.  
  1444. /*
  1445. ===============
  1446. Drop Grenade Launcher
  1447. ===============
  1448. */
  1449. void() Drop_GrenadeLauncher =
  1450. {
  1451.     local entity    item;
  1452.  
  1453.     item = spawn();
  1454.     item.origin = self.origin + v_forward*100;
  1455.     item.ammo_rockets = 10;
  1456.     item.items = IT_GRENADE_LAUNCHER;
  1457.     makevectors (self.v_angle);
  1458.     item.velocity = aim(self, 10000);
  1459.     item.velocity = item.velocity * 200;
  1460.     item.velocity_z = 200;    
  1461.  
  1462.     item.flags = FL_ITEM;
  1463.     item.solid = SOLID_TRIGGER;
  1464.     item.movetype = MOVETYPE_TOSS;
  1465.     setmodel (item, "progs/backpack.mdl");
  1466.     setsize (item, '-16 -16 0', '16 16 56');
  1467.     item.touch = BackpackTouch;
  1468.     
  1469.     item.nextthink = time + 300;    // remove after 5 minutes
  1470.     item.think = SUB_Remove;
  1471. };
  1472.  
  1473. /*
  1474. ===============
  1475. Drop Rocket Launcher
  1476. ===============
  1477. */
  1478. void() Drop_RocketLauncher =
  1479. {
  1480.     local entity    item;
  1481.  
  1482.     item = spawn();
  1483.     item.origin = self.origin + v_forward*100;
  1484.     item.ammo_rockets = 20;
  1485.     item.items = IT_ROCKET_LAUNCHER;
  1486.     makevectors (self.v_angle);
  1487.     item.velocity = aim(self, 10000);
  1488.     item.velocity = item.velocity * 200;
  1489.     item.velocity_z = 200;    
  1490.  
  1491.     item.flags = FL_ITEM;
  1492.     item.solid = SOLID_TRIGGER;
  1493.     item.movetype = MOVETYPE_TOSS;
  1494.     setmodel (item, "progs/backpack.mdl");
  1495.     setsize (item, '-16 -16 0', '16 16 56');
  1496.     item.touch = BackpackTouch;
  1497.     
  1498.     item.nextthink = time + 300;    // remove after 5 minutes
  1499.     item.think = SUB_Remove;
  1500. };
  1501.  
  1502. /*
  1503. ===============
  1504. Drop Lightning Gun
  1505. ===============
  1506. */
  1507. void() Drop_Thunderbolt =
  1508. {
  1509.     local entity    item;
  1510.  
  1511.     item = spawn();
  1512.     item.origin = self.origin + v_forward*100;
  1513.     item.ammo_cells = 15;
  1514.     item.items = IT_LIGHTNING;
  1515.     makevectors (self.v_angle);
  1516.     item.velocity = aim(self, 10000);
  1517.     item.velocity = item.velocity * 200;
  1518.     item.velocity_z = 200;    
  1519.  
  1520.     item.flags = FL_ITEM;
  1521.     item.solid = SOLID_TRIGGER;
  1522.     item.movetype = MOVETYPE_TOSS;
  1523.     setmodel (item, "progs/backpack.mdl");
  1524.     setsize (item, '-16 -16 0', '16 16 56');
  1525.     item.touch = BackpackTouch;
  1526.     
  1527.     item.nextthink = time + 300;    // remove after 5 minutes
  1528.     item.think = SUB_Remove;
  1529. };
  1530.  
  1531.  
  1532.