SHARE
TWEET

Untitled

a guest May 19th, 2016 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. ============
  3. W_ChangeWeapon
  4.  
  5. ============
  6. */
  7. //MED 10/18/96 added hipweapons
  8. void() W_ChangeWeapon =
  9. {
  10.     local   float   it, am, fl;
  11.    local float oldimpulse;
  12.  
  13.     it = self.items;
  14.     am = 0;
  15.  
  16. //MED
  17.     if (self.impulse == 1)
  18.     {
  19.       fl = IT_AXE;
  20.    }
  21.     else if (self.impulse == 2)
  22.     {
  23.         fl = IT_SHOTGUN;
  24.         if (self.ammo_shells < 1)
  25.             am = 1;
  26.     }
  27.     else if (self.impulse == 3)
  28.     {
  29.         fl = IT_SUPER_SHOTGUN;
  30.         if (self.ammo_shells < 2)
  31.             am = 1;
  32.     }
  33.     else if (self.impulse == 4)
  34.     {
  35.         fl = IT_NAILGUN;
  36.         if (self.ammo_nails < 1)
  37.             am = 1;
  38.     }
  39. //MED
  40.     else if (self.impulse == 5)
  41.     {
  42.       fl = IT_SUPER_NAILGUN;
  43.       if (self.ammo_nails < 2)
  44.          am = 1;
  45.  
  46.     }
  47. //MED
  48.     else if (self.impulse == 6)
  49.     {
  50.       if (self.weapon == IT_GRENADE_LAUNCHER)
  51.          {
  52.          fl = IT_PROXIMITY_GUN;
  53.          }
  54.       else
  55.          {
  56.          fl = IT_GRENADE_LAUNCHER;
  57.          }
  58.         if (self.ammo_rockets < 1)
  59.             am = 1;
  60.     }
  61.     else if (self.impulse == 7)
  62.     {
  63.         fl = IT_ROCKET_LAUNCHER;
  64.         if (self.ammo_rockets < 1)
  65.             am = 1;
  66.     }
  67. //MED
  68.     else if (self.impulse == 8)
  69.     {
  70.       fl = IT_LIGHTNING;
  71.       if (self.ammo_cells < 1)
  72.          am = 1;
  73.    }
  74.    else if (self.impulse == 225)
  75.     {
  76.       fl = IT_LASER_CANNON;
  77.       if (self.ammo_cells < 1)
  78.          am = 1;
  79.    }
  80.    else if (self.impulse == 226)
  81.     {
  82.       fl = IT_MJOLNIR;
  83.    }
  84.  
  85. //MED
  86.    oldimpulse = self.impulse;
  87.     self.impulse = 0;
  88.  
  89.     if (!(self.items & fl))
  90.       {
  91. //MED
  92.       if (fl == IT_GRENADE_LAUNCHER)
  93.          {
  94.          fl = IT_PROXIMITY_GUN;
  95.          if (!(self.items & fl))
  96.             {
  97.             sprint (self, "no weapon.\n");
  98.             return;
  99.             }
  100.          if (self.ammo_rockets < 1)
  101.             am = 1;
  102.          else
  103.             am = 0;
  104.          }
  105.       else
  106.          {
  107.          sprint (self, "no weapon.\n");
  108.          return;
  109.          }
  110.       }
  111.  
  112.     if (am)
  113.     {   // don't have the ammo
  114.         sprint (self, "not enough ammo.\n");
  115.         return;
  116.     }
  117.  
  118. //
  119. // set weapon, set ammo
  120. //
  121.    self.weapon = fl;
  122.     W_SetCurrentAmmo ();
  123. };
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top