Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ============
- W_ChangeWeapon
- ============
- */
- void() W_ChangeWeapon =
- {
- local float it, am, fl;
- local float oldimpulse;
- it = self.items;
- am = 0;
- if (self.impulse == 1)
- {
- fl = IT_AXE;
- }
- else if (self.impulse == 2)
- {
- fl = IT_SHOTGUN;
- if (self.ammo_shells < 1)
- am = 1;
- }
- else if (self.impulse == 3)
- {
- fl = IT_SUPER_SHOTGUN;
- if (self.ammo_shells < 2)
- am = 1;
- }
- else if (self.impulse == 4)
- {
- if (self.weapon == IT_NAILGUN)
- {
- fl = IT_INFANTRY_GUN;
- }
- else
- {
- fl = IT_NAILGUN;
- }
- if (self.ammo_nails < 1)
- am = 1;
- }
- //else if (self.impulse == 4)
- //{
- // if (self.weapon == IT_NAILGUN)
- // {
- // fl = IT_INFANTRY_GUN;
- // }
- //
- // if (self.weapon == IT_INFANTRY_GUN)
- // {
- // fl = IT_NAILGUN;
- // }
- //
- // if (self.weapon != IT_NAILGUN)
- // {
- // fl = IT_NAILGUN;
- // }
- //
- // if (self.weapon != IT_INFANTRY_GUN)
- // {
- // fl = IT_INFANTRY_GUN;
- // }
- //
- // if (self.ammo_nails < 1)
- // am = 1;
- //
- // }
- else if (self.impulse == 5)
- {
- if (self.weapon == IT_SUPER_NAILGUN)
- {
- fl = IT_GATLING_GUN;
- if (self.ammo_nails < 1)
- am = 1;
- }
- else
- {
- fl = IT_SUPER_NAILGUN;
- if (self.ammo_nails < 2)
- am = 1;
- }
- }
- //else if (self.impulse == 5)
- //{
- // if (self.weapon == IT_SUPER_NAILGUN)
- // {
- // fl = IT_GATLING_GUN;
- // }
- //
- // if (self.weapon == IT_GATLING_GUN)
- // {
- // fl = IT_SUPER_NAILGUN;
- // }
- //
- // if (self.weapon != IT_SUPER_NAILGUN)
- // {
- // fl = IT_SUPER_NAILGUN;
- // }
- //
- // if (self.weapon != IT_GATLING_GUN)
- // {
- // fl = IT_GATLING_GUN;
- // }
- //
- // if (self.ammo_nails < 1)
- // am = 1; // < 2
- // }
- else if (self.impulse == 6)
- {
- fl = IT_GRENADE_LAUNCHER;
- if (self.ammo_rockets < 1)
- am = 1;
- }
- else if (self.impulse == 7)
- {
- fl = IT_ROCKET_LAUNCHER;
- if (self.ammo_rockets < 1)
- am = 1;
- }
- else if (self.impulse == 8)
- {
- if (self.weapon == IT_LIGHTNING)
- {
- fl = IT_BFG9500;
- if (self.ammo_cells < 30)
- am = 1;;
- }
- else
- {
- fl = IT_LIGHTNING;
- if (self.ammo_cells < 1)
- am = 1;
- }
- }
- //else if (self.impulse == 8)
- //{
- // if (self.weapon == IT_LIGHTNING)
- // {
- // fl = IT_BFG9500;
- // if (self.ammo_cells < 30)
- // am = 1;
- // }
- //
- // if (self.weapon == IT_BFG9500)
- // {
- // fl = IT_LIGHTNING;
- // if (self.ammo_cells < 1)
- // am = 1;
- // }
- //
- // if (self.weapon != IT_LIGHTNING)
- // {
- // fl = IT_LIGHTNING;
- // if (self.ammo_cells < 1)
- // am = 1;
- // }
- //
- // if (self.weapon != IT_BFG9500)
- // {
- // fl = IT_BFG9500;
- // if (self.ammo_cells < 30)
- // am = 1;
- // }
- }
- //else if (self.impulse == 9)
- //{
- //fl = IT_BFG9500;
- //if (self.ammo_cells < 30)
- //am = 1;
- //}
- //MED
- oldimpulse = self.impulse;
- self.impulse = 0;
- if (!(self.items & fl))
- {
- //MED
- if (fl == IT_NAILGUN)
- {
- fl = IT_INFANTRY_GUN;
- if (!(self.items & fl))
- {
- sprint (self, "no weapon.\n");
- sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
- return;
- }
- if (self.ammo_nails < 1)
- am = 1;
- else
- am = 0;
- }
- else
- {
- sprint (self, "no weapon.\n");
- sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
- return;
- }
- if (fl == IT_SUPER_NAILGUN)
- {
- fl = IT_GATLING_GUN;
- if (!(self.items & fl))
- {
- sprint (self, "no weapon.\n");
- sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
- return;
- }
- if (self.ammo_nails < 1)
- am = 1;
- else
- am = 0;
- }
- else
- {
- sprint (self, "no weapon.\n");
- sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
- return;
- }
- if (fl == IT_LIGHTNING)
- {
- fl = IT_BFG9500;
- if (self.ammo_cells < 30)
- am = 1;
- if (!(self.items & fl))
- {
- sprint (self, "no weapon.\n");
- sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
- return;
- }
- if (self.ammo_cells < 1)
- am = 1;
- else
- am = 0;
- }
- else
- {
- sprint (self, "no weapon.\n");
- return;
- }
- }
- if (!(self.items & fl))
- { // don't have the weapon or the ammo
- sprint (self, "no weapon.\n");
- sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
- return;
- }
- if (am)
- { // don't have the ammo
- sprint (self, "not enough ammo.\n");
- sound (self, CHAN_WEAPON, "weapons/noammo.wav", 1, ATTN_NORM);
- return;
- }
- //
- // set weapon, set ammo
- //
- self.weapon = fl;
- W_SetCurrentAmmo ();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement