/*
CREDITS:

Sprites - ID Software (Original source - Rage), Sinael (Rip), Zrrion the Insect (Edit), Me (Just a liiiittle recolor)

Up, Impact, Add - ID (Quake 4, Doom 3)
Fire - Mashup (Surely ID, as there is a bit of Reznor's sound, Quake 4 missile launcher, and something else... can't point it out.)
Flight - Valve (Half Life 2)

*/

ACTOR Matchstick : Weapon
{
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "You got the ''Matchstick'' flare handcannon! Did your mamushka never told you to stop playing with matches? (2)"
  Obituary "%o got fucked with fire by %k's ''Matchstick''."
  Weapon.UpSound "Matchstick/Up"
  Weapon.SelectionOrder 6
  Weapon.AmmoGive 0
  Weapon.AmmoType "Boolet"
  Weapon.AmmoUse 2
  Weapon.AmmoGive2 0
  Weapon.AmmoType2 "Boolet"
  Weapon.AmmoUse2 12
  Weapon.Kickback 5
  Weapon.SlotNumber 2
  Weapon.BobStyle InverseSmooth
  Weapon.BobSpeed 1.6
  Weapon.BobRangeY 0.6
  Weapon.BobRangeX 1.2
  //+NOAUTOFIRE
  +WEAPON.CHEATNOTWEAPON
  States
  {
  //SINGLE PISTLO
  
   Ready:
      TNT1 A 0 A_JumpIfInventory("BasicUpgrade",1,"ZweiReady")
      MSTG A 1 A_WeaponReady
      Loop
   Deselect:
      TNT1 A 0 A_ZoomFactor(1)
      TNT1 A 0 A_JumpIfInventory("BasicUpgrade",1,"ZweiDeselect")
      MSTG A 1 A_Lower
      MSTG A 0 A_Lower
      Loop
   Select:
      TNT1 A 0 A_Jump(214,2)
      TNT1 A 0 A_PlaySound("Matchstick/Zapalki",2,0.9)
   LoopdaWhoop:
      TNT1 A 0 A_JumpIfInventory("BasicUpgrade",1,"ZweiSelect")
      MSTG A 1 A_Raise
      MSTG A 0 A_Raise
      Loop
   Fire:
      TNT1 A 0 A_GiveInventory("BooletCasing",2)
      TNT1 A 0 A_PlaySound("Matchstick/Add",6,0.8)
      TNT1 A 0 A_PlaySound("Matchstick/Fire",1,0.9)
      TNT1 A 0 A_AlertMonsters
      TNT1 A 0 A_FireCustomMissile("MatchProjectile",0,1,12,0)
   Rest:
      MSTG A 0 A_SetAngle(Angle-0.8)
      MSTG A 0 A_SetPitch(Pitch-0.8)
      MSTF A 1 Bright A_ZoomFactor(0.98)
      MSTG A 0 A_SetAngle(Angle-0.4)
      MSTG A 0 A_SetPitch(Pitch-0.4)
      MSTR A 1 A_ZoomFactor(0.985)
      MSTG A 0 A_SetAngle(Angle-0.2)
      MSTG A 0 A_SetPitch(Pitch-0.2)
      MSTR B 1 A_ZoomFactor(0.99)
      MSTR C 1 A_ZoomFactor(0.995)
      MSTR D 1 A_ZoomFactor(0.9975)
      MSTR E 1 A_ZoomFactor(1)
      MSTR FGHIJK 1
      MSTG A 5
      Goto Ready
   AltFire:
      TNT1 A 0 A_GiveInventory("BooletCasing",5)
      TNT1 A 0 A_PlaySound("Matchstick/Add",6,0.8)
      TNT1 A 0 A_PlaySound("Matchstick/Fire",1,0.9)
      TNT1 A 0 A_AlertMonsters
      TNT1 A 0 A_FireCustomMissile("MatchFlareProjectile",0,1,12,0)
   Rest:
      MSTG A 0 A_SetPitch(Pitch-0.8)
      MSTG A 0 A_SetAngle(Angle-0.8)
      MSTF A 1 Bright A_ZoomFactor(0.98)
      MSTG A 0 A_SetPitch(Pitch-0.4)
      MSTG A 0 A_SetAngle(Angle-0.4)
      MSTR A 1 A_ZoomFactor(0.985)
      MSTG A 0 A_SetPitch(Pitch-0.2)
      MSTG A 0 A_SetAngle(Angle-0.2)
      MSTR B 1 A_ZoomFactor(0.99)
      MSTR C 1 A_ZoomFactor(0.995)
      MSTR D 1 A_ZoomFactor(0.9975)
      MSTR E 1 A_ZoomFactor(1)
      MSTR FGHIJK 1
      MSTG A 15
      Goto Ready
   Reload:
	  MSTG A 0 A_JumpIfInventory("BasicUpgrade",1,"YESH")
	  MSTG A 0 A_WeaponReady(WRF_NOFIRE)
	  Goto Ready
   YESH:
	  MSTG A 0 A_GiveInventory("SynthReload",1)
	  Goto LIdle
   Zoom:
	  MSTG A 0 A_JumpIfInventory("BasicUpgrade",1,"YESH2")
	  MSTG A 0 A_WeaponReady(WRF_NOFIRE)
	  Goto Ready
   YESH2:
	  MSTG A 0 A_GiveInventory("SynthZoom",1)
	  Goto LIdle
  
  //DOUBLE PISTLO
  
  ZweiSelect:
    MS3G A 0 A_Raise
	MS3G A 1 A_Raise
    Loop
  ZweiDeselect:
	TNT1 A 0 A_TakeInventory("SynthFireActive",1)
	TNT1 A 0 A_TakeInventory("SynthFireLeft",1)
	TNT1 A 0 A_TakeInventory("SynthFireRight",1)
  Zweihander:
    MS3G A 0 A_Lower
    MS3G A 1 A_Lower
	Loop
  ZweiReady:
  	MS3G A 0 A_GiveInventory("SynthFireActive",1)
	MS3G A 0 ACS_NamedExecuteAlways("SynthLeft")
	MS3G A 0 ACS_NamedExecuteAlways("SynthRight")
	MS3G A 0 A_Gunflash
	Goto LIdle
	
  //LEFT PISTLO
  
  LIdle:
	MS2G A 0 A_JumpIfInventory("SynthFireLeft",1,"LFire")
	MS2G A 0 A_JumpIfInventory("SynthReload",1,"LAltFire")
    MS2G A 1 A_WeaponReady(WRF_NOFIRE|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
	Loop
  LFire:
    MS2G A 1 A_JumpIfInventory("Boolet",2,1)
	Goto LIdle
    TNT1 A 0 A_TakeInventory("Boolet",2)
    TNT1 A 0 A_GiveInventory("BooletCasing",2)
    TNT1 A 0 A_PlaySound("Matchstick/Add",6,0.8)
    TNT1 A 0 A_PlaySound("Matchstick/Fire",1,0.9)
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_FireCustomMissile("MatchProjectile",0,0,-12,0)
  LRest:
    MS2G A 0 A_SetPitch(Pitch-0.8)
    MS2G A 0 A_SetAngle(Angle+0.8)
    MS2F A 1 Bright A_ZoomFactor(0.98)
    MS2G A 0 A_SetPitch(Pitch-0.4)
    MS2G A 0 A_SetAngle(Angle+0.4)
    MS2R A 1 A_ZoomFactor(0.985)
    MS2G A 0 A_SetPitch(Pitch-0.2)
    MS2G A 0 A_SetAngle(Angle+0.2)
    MS2R B 1 A_ZoomFactor(0.99)
    MS2R C 1 A_ZoomFactor(0.995)
    MS2R D 1 A_ZoomFactor(0.9975)
    MS2R E 1 A_ZoomFactor(1)
    MS2R FGHIJK 1
    MS2G A 5
	MS2G A 0 A_JumpIfInventory("SynthFireLeft",1,"LFire")
    Goto LIdle
	
  LAltFire:
    MS2G A 0 A_TakeInventory("SynthReload",1)
    MS2G A 1 A_JumpIfInventory("Boolet",12,1)
	Goto LIdle
    TNT1 A 0 A_TakeInventory("Boolet",12)
    TNT1 A 0 A_GiveInventory("BooletCasing",12)
    TNT1 A 0 A_PlaySound("Matchstick/Add",6,0.8)
    TNT1 A 0 A_PlaySound("Matchstick/Fire",1,0.9)
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_FireCustomMissile("MatchFlareProjectile",0,0,-12,0)

    MS2G A 0 A_SetPitch(Pitch-0.8)
    MS2G A 0 A_SetAngle(Angle+0.8)
    MS2F A 1 Bright A_ZoomFactor(0.98)
    MS2G A 0 A_SetPitch(Pitch-0.4)
    MS2G A 0 A_SetAngle(Angle+0.4)
    MS2R A 1 A_ZoomFactor(0.985)
    MS2G A 0 A_SetPitch(Pitch-0.2)
    MS2G A 0 A_SetAngle(Angle+0.2)
    MS2R C 1 A_ZoomFactor(0.995)
    MS2R D 1 A_ZoomFactor(0.9975)
    MS2R E 1 A_ZoomFactor(1)
    MS2R FGHIJK 1
    MS2G A 15
    Goto LIdle
  
  //RIGHT PISTLO
  
  Flash:
	TNT1 A 0 A_Light0 //I guess you put here the equal amount of time to the tics of select animation
  RIdle:
	MSTG A 0 A_JumpIfInventory("SynthFireRight",1,"RFire")
	MSTG A 0 A_JumpIfInventory("SynthZoom",1,"RAltFire")
    MSTG A 1 //A_WeaponReady(WRF_NOFIRE) I'd put it here as well, but then the deselect screws up.
	Loop
  RFire:
    MSTG A 1 A_JumpIfInventory("Boolet",2,1)
	Goto RIdle
  RRest:
    TNT1 A 0 A_TakeInventory("Boolet",2)
    TNT1 A 0 A_GiveInventory("BooletCasing",2)
    TNT1 A 0 A_PlaySound("Matchstick/Add",6,0.8)
    TNT1 A 0 A_PlaySound("Matchstick/Fire",1,0.9)
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_FireCustomMissile("MatchProjectile",0,0,12,0)
   Rest:
    MSTG A 0 A_SetPitch(Pitch-0.8)
    MSTG A 0 A_SetAngle(Angle-0.8)
    MSTF A 1 Bright A_ZoomFactor(0.98)
    MSTG A 0 A_SetPitch(Pitch-0.4)
    MSTG A 0 A_SetAngle(Angle-0.4)
    MSTR A 1 A_ZoomFactor(0.985)
    MSTG A 0 A_SetPitch(Pitch-0.2)
    MSTG A 0 A_SetAngle(Angle-0.2)
    MSTR B 1 A_ZoomFactor(0.99)
    MSTR C 1 A_ZoomFactor(0.995)
    MSTR D 1 A_ZoomFactor(0.9975)
    MSTR E 1 A_ZoomFactor(1)
    MSTR FGHIJK 1
    MSTG A 5
	MS2G A 0 A_JumpIfInventory("SynthFireRight",1,"RFire")
	Goto RIdle
	
  RAltFire:
    MSTG A 0 A_TakeInventory("SynthZoom",1)
    MSTG A 1 A_JumpIfInventory("Boolet",12,1)
	Goto RIdle
    TNT1 A 0 A_TakeInventory("Boolet",12)
    TNT1 A 0 A_GiveInventory("BooletCasing",12)
    TNT1 A 0 A_PlaySound("Matchstick/Add",6,0.8)
    TNT1 A 0 A_PlaySound("Matchstick/Fire",1,0.9)
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_FireCustomMissile("MatchFlareProjectile",0,0,12,0)

    MSTG A 0 A_SetPitch(Pitch-0.8)
    MSTG A 0 A_SetAngle(Angle-0.8)
    MSTF A 1 Bright A_ZoomFactor(0.98)
    MSTG A 0 A_SetPitch(Pitch-0.4)
    MSTG A 0 A_SetAngle(Angle-0.4)
    MSTR A 1 A_ZoomFactor(0.985)
    MSTG A 0 A_SetPitch(Pitch-0.2)
    MSTG A 0 A_SetAngle(Angle-0.2)
    MSTR B 1 A_ZoomFactor(0.99)
    MSTR C 1 A_ZoomFactor(0.995)
    MSTR D 1 A_ZoomFactor(0.9975)
    MSTR E 1 A_ZoomFactor(1)
    MSTR FGHIJK 1
    MSTG A 15
    MSTG A 0 A_TakeInventory("SynthZoom",1)
	Goto RIdle
  Spawn:
    TNT1 A -1
    Stop
	}
}