ACTOR CannonAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 4
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 4
}

// --------------------------------------------------------------------------
// (originally by Logan, brutalised by Flammable4444, and kickass sounds found by me from Brutal Doom v016b and the Shambler's Castle mod for Doom 3)
// Super Canon Shotgun
//
// --------------------------------------------------------------------------

ACTOR Cannon_Shotgun : DoomWeapon
{
	Game Doom
	Weapon.SelectionOrder 1300
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive1 4
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "Shell"
	Weapon.AmmoType2 "CannonAmmo"
	Weapon.AmmoGive 8
	Weapon.BobRangeX 0.3
	Weapon.BobRangeY 1.0
	Weapon.BobStyle Alpha
	Weapon.BobSpeed 2.0
  Inventory.PickupSound "misc/w_pkup"
  Tag "Cannon_Shotgun "
  Inventory.Pickupmessage "Cannon_Shotgun "
  Obituary "%k [Cannon Shotgun] %o"
    AttackSound "None"
    +WEAPON.NOALERT
    +WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	States
	{

Steady:
	TNT1 A 1
	Goto Ready
Ready:
        TNT1 AAAA 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        TNT1 A 0 A_PlaySound("CLIPINSS")
		TNT1 AAA 0 
		LCSU IJK 2 A_JumpIfInventory("GoFatality", 1, "Steady")
		LRSU DCB 1
        TNT1 AAAAAAA 0
        TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		LRSU A 1 A_WeaponReady
		Goto Ready+14

		Deselect:
		TNT1 A 1 A_Lower
		Wait
	
Select:
	TNT1 A 0 A_Takeinventory("FistsSelected",1)
	TNT1 A 0 A_Takeinventory("SawSelected",1)
	TNT1 A 0 A_Takeinventory("ShotgunSelected",1)
	TNT1 A 0 A_Giveinventory("SSGSelected",1)
	TNT1 A 0 A_Takeinventory("MinigunSelected",1)
	TNT1 A 0 A_Takeinventory("PlasmaGunSelected",1)
	TNT1 A 0 A_Takeinventory("RocketLauncherSelected",1)
    TNT1 A 0 A_Takeinventory("GrenadeLauncherSelected",1)
	TNT1 A 0 A_Takeinventory("BFGSelected",1)
	TNT1 A 0 A_Takeinventory("BFG10kSelected",1)
	TNT1 A 0 A_Takeinventory("RailGunSelected",1)
	TNT1 A 0 A_Takeinventory("SubMachineGunSelected",1)
	TNT1 A 0 A_Takeinventory("RevenantLauncherSelected",1)
	TNT1 A 0 A_Takeinventory("LostSoulSelected",1)
	TNT1 A 0 A_Takeinventory("FlameCannonSelected",1)
	TNT1 A 0 A_Takeinventory("HasBarrel",1)
		TNT1 A 0 A_Raise
		Wait
Fire:
        TNT1 A 0 A_Takeinventory("Reloading",1)
        TNT1 A 0 A_JumpIfInventory("cannonAmmo",1,2)
        Goto Reload
        TNT1 AAAA 0
        //TNT1 AA 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
        TNT1 A 0 A_AlertMonsters
        TNT1 A 0 A_PlaySound("weapons/canSG", 3)
        TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)		
		//TNT1 AAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-10,10), 0, -1, random(-10,10))
		TNT1 AAAAA 0 A_FireCustomMissile("Tracer", random(-5,5), 0, -1, random(-5,5))
        //TNT1 A 0 ACS_Execute(374, 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("ShakeYourAss", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("cannonAmmo",1)
        LCSG X 1 BRIGHT
		LCSG Y 1 BRIGHT A_FireBullets (10, 10, 10, 10, "ShotgunPuff")
		LSEL EFGH 1 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_setpitch(pitch-0.75)
        LRSU A 1
        LRSU A 0 A_Refire
		Goto Ready+14

ALTFire:
TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"BigShot")
TNT1 A 0 A_JumpIfInventory("cannonAmmo",1,"Reload")

BigShot:
TNT1 A 0 A_TakeInventory("Reloading",1)
TNT1 A 0 A_JumpIfInventory("cannonAmmo",1,3)
Goto Reload
        TNT1 AAAAA 0
        //TNT1 AAA 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
        TNT1 A 0 A_Recoil(5)
		LCSG X 1 BRIGHT A_playsound("SSHFIRE", 5)
        LCSG X 1 BRIGHT A_firebullets (0,0,1,30,"shotpuff",1,120)
		LCSG X 0 BRIGHT A_firebullets (0,0,1,30,"shotpuff",1,120)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
        TNT1 AAAAAAAAAAA 0 A_FireCustomMissile("Tracer", random(-7,7), 0, -1, random(-7,7))
		TNT1 AAAAAAAAAAA 0 A_FireCustomMissile("Tracer", random(-7,7), 0, -1, random(-7,7))
		TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",15,0,0,0)
		TNT1 A 0 A_FireBullets (15, 15, 20, 9, "ShotgunPuff")
		TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",-15,0,0,0)
		TNT1 A 0 A_FireBullets (15, 15, 20, 9, "ShotgunPuff")
	    TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",-15,0,0,0)
	    LCSG Y 1 BRIGHT
		TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",15,0,0,0)
		TNT1 A 0 A_setpitch(pitch-5.75)
		LCSG Z 1 BRIGHT
		TNT1 A 0 A_TakeInventory("cannonAmmo",4)
		TNT1 A 0 ACS_Execute(375, 0, 0, 0, 0)
		TNT1 A 0 ACS_Execute(375, 0, 0, 0, 0)
		//TNT1 A 0 A_FireCustomMissile("ShakeYourAssQuad", 0, 0, 0, 0)
		LSEL HD 1
		LSEL ABCDEFGH 1
		LCSU K 1 
		TNT1 A 0 A_TakeInventory("Reloading",1)
		LRSU AA 1
		TNT1 A 0 A_ReFire
        Goto Ready+23
	
Spawn:
		LICO A -1
		Stop
DoKick:
	    TNT1 A 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		NULL A 0 A_JumpIf (momZ > 0, "AirKick")
		NULL A 0 A_JumpIf (momZ < 0, "AirKick")
		
        TNT1 A 0 A_jumpifinventory("PowerStrength",1,"BerserkerKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		KICK BCD 1
		RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        KICK H 4
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK IGFEDCBA 1 
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+14
		
BerserkerKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		KICK ABCDEFG 1
        RIFF A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
        KICK H 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK IGFEDCBA 1 
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+14
	
AirKick:
	    TNT1 A 0 A_jumpifinventory("PowerStrength",1,"SuperAirKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KICK JKLMN 1
        RIFF A 0 A_FireCustomMissile("AirKickAttack", 0, 0, 0, -31)
        KICK O 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+14
		
SuperAirKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KICK JKLMN 1
        RIFF A 0 A_FireCustomMissile("SuperAirKickAttack", 0, 0, 0, -31)
        KICK O 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+14
/*Taunt:
		TNT1 A 0 A_JumpIfInventory("IsPostal",1,"FlipOff1")
		TNT1 A 0 A_JumpIfInventory("IsQuaker540",1,"FlipOff2")
		TNT1 A 0 A_JumpIfInventory("IsNikolai",1,"FlipOff3")
		TNT1 A 0 A_JumpIfInventory("IsSgtDoomguy5th",1,"FlipOff4")
		TNT1 A 0 A_JumpIfInventory("IsCommander",1,"FlipOff5")
		TNT1 A 0 A_JumpIfInventory("IsDukeNukem",1,"FlipOff6")
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		Goto Ready+14
	FlipOff1:
		TNT1 A 0 A_ZoomFactor(1.0)
        TNT1 A 5
		FUCK A 2
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK B 2 A_PlaySound("PFUCK", 1)
        FUCK C 2 A_AlertMonsters
		FUCK D 15 A_Takeinventory("Taunting",1)
        FUCK CBA 5
        TNT1 A 5
		Goto Ready+14
	FlipOff2:
		TNT1 A 0 A_ZoomFactor(1.0)
        TNT1 A 5
		FUCK A 2
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK B 2 A_PlaySound("DFUCK", 1)
        FUCK C 2 A_AlertMonsters
		FUCK D 15 A_Takeinventory("Taunting",1)
        FUCK CBA 5
        TNT1 A 5
		Goto Ready+14
	FlipOff3:
		TNT1 A 0 A_ZoomFactor(1.0)
        TNT1 A 5
		FUCK A 2
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK B 2 A_PlaySound("NFUCK", 1)
        FUCK C 2 A_AlertMonsters
		FUCK D 15 A_Takeinventory("Taunting",1)
        FUCK CBA 5
        TNT1 A 5
		Goto Ready+14
	FlipOff4:
		TNT1 A 0 A_ZoomFactor(1.0)
        TNT1 A 5
		FUCK A 2
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK B 2 A_PlaySound("5FUCK", 1)
        FUCK C 2 A_AlertMonsters
		FUCK D 15 A_Takeinventory("Taunting",1)
        FUCK CBA 5
        TNT1 A 5
		Goto Ready+14
	FlipOff5:
		TNT1 A 0 A_ZoomFactor(1.0)
        TNT1 A 5
		FUCK A 2
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK B 2 A_PlaySound("TFUCK", 1)
        FUCK C 2 A_AlertMonsters
		FUCK D 15 A_Takeinventory("Taunting",1)
        FUCK CBA 5
        TNT1 A 5
		Goto Ready+14
	FlipOff6:
		TNT1 A 0 A_ZoomFactor(1.0)
        TNT1 A 5
		FUCK A 2
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK B 2 A_PlaySound("NUCK", 1)
        FUCK C 2 A_AlertMonsters
		FUCK D 15 A_Takeinventory("Taunting",1)
        FUCK CBA 5
        TNT1 A 5
		Goto Ready+14
Salute:
	    TNT1 A 0 SetPlayerProperty(0,1,0)
		TNT1 A 0 A_ALertMonsters
		SALU ABCDEDCDEDCDEDCBA 4
		TNT1 A 0 A_TakeInventory("Salute1",1)
		TNT1 A 0 A_TakeInventory("Salute2",1)
		TNT1 A 0 SetPlayerProperty(0,0,0)
		Goto Ready+14*/
Idle:
			TNT1 A 0 A_PlaySound("SSOPEN", 1)
			LCSG ABCD 3
			LCSG E 25
			LCSG DCBA 2
			TNT1 A 0 A_PlaySound("SSCLOSE", 1)
			TNT1 A 0 A_Takeinventory("Reloading",1)
		Goto Ready+14
Reload:
		TNT1 A 0 A_JumpIfNoAmmo("NoAmmo")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Idle")
		TNT1 A 0 A_JumpIfInventory("Shell",4,"Reload4S")
		TNT1 A 0 A_JumpIfInventory("Shell",3,"Reload3S")
		TNT1 A 0 A_JumpIfInventory("Shell",2,"Reload2S")
		TNT1 A 0 A_JumpIfInventory("Shell",1,"Reload1S")

NoAmmo:
		TNT1 A 0 A_TakeInventory("Reloading",1) 
        LRSU A 4 A_PlaySound("weapons/empty")
		Goto Ready+14

Reload4S:
		LRSU A 1 A_WeaponReady
        TNT1 A 0 A_JumpIfInventory("Shell",1,4)
        Goto Ready+14
		TNT1 AAAA 0
		TNT1 A 0 A_PlaySound("SSOPEN", 1)
		
		LCSG ABCDEFGHIJK 1

		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		Goto Reload2
		
Reload3S:
		LRSU A 1 A_WeaponReady
        TNT1 A 0 A_JumpIfInventory("Shell",1,4)
        Goto Ready+14
		TNT1 AAAA 0
		TNT1 A 0 A_PlaySound("SSOPEN", 1)
		
		LCSG ABCDEFGHIJK 1

		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		Goto Reload2
		
Reload2S:
		LRSU A 1 A_WeaponReady
        TNT1 A 0 A_JumpIfInventory("Shell",1,4)
        Goto Ready+14
		TNT1 AAAA 0
		TNT1 A 0 A_PlaySound("SSLOAD", 1)
		
		LCSG ABCDEFGHIJK 1
		
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		Goto Reload2

Reload1S:
		LRSU A 1 A_WeaponReady
        TNT1 A 0 A_JumpIfInventory("Shell",1,4)
        Goto Ready+14
		TNT1 AAAA 0
		TNT1 A 0 A_PlaySound("SSOPEN", 1)
		
		LCSG ABCDEFGHIJK 1
		
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_Giveinventory("cannonAmmo",1)
		TNT1 A 0 A_FireCustomMissile("CanCaseSpawn",0,0,-4,-18)
		TNT1 A 5 A_PlaySound("SSLOAD")
		TNT1 A 0 A_JumpIfInventory("cannonAmmo",4,"Reload2")
		
		Goto Reload2

Reload2:
        TNT1 AAAAA 0
		TNT1 A 0 A_JumpIfInventory("Shell",1,2)
        TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 AAAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
        TNT1 AAAA 0
		LCSG K 1
		LCSG JIHGFEDCBA 1
		TNT1 A 0 A_PlaySound("SSCLOSE", 1)
		Goto Ready+23
		}
}

ACTOR CanCaseSpawn
{
	Speed 20
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 1 A_CustomMissile("CannonCasing",0,0,random(-40,-50),2,random(20,30))
		Stop
	}
} 

ACTOR CannonCasing
{
   Height 12
   Radius 9
   Speed 6
   Scale 0.15
   -DOOMBOUNCE
   - NOGRAVITY
   +WINDTHRUST
   +CLIENTSIDEONLY
   +MOVEWITHSECTOR
   +MISSILE
   +NOBLOCKMAP
   -DROPOFF
   +NOTELEPORT
   +FORCEXYBILLBOARD
   +NOTDMATCH
   +GHOST
   Mass 1
   SeeSound "weapons/shell"
   States
   {
    Spawn:
      CAS2 ABCDEFGH 3
      Loop
   Death:
   Death:
      LCPJ A 0 A_Jump(256,"Rest1","Rest2","Rest3","Rest4","Rest5","Rest6","Rest7","Rest8")
      Goto Rest1
    Rest1:
      CAS2 I 250
      TNT1 A 0 A_CheckSight("Vanish")
    Loop
    Rest2:
      CAS2 J 250
      TNT1 A 0 A_CheckSight("Vanish")
    Loop
    Rest3:
      CAS2 K 250
      TNT1 A 0 A_CheckSight("Vanish")
    Loop
    Rest4:
      CAS2 L 250
      TNT1 A 0 A_CheckSight("Vanish")
    Loop
    Rest5:
      CAS2 M 250
      TNT1 A 0 A_CheckSight("Vanish")
    Loop
    Rest6:
      CAS2 I 250
      TNT1 A 0 A_CheckSight("Vanish")
    Loop
    Rest7:
      CAS2 J 250
      TNT1 A 0 A_CheckSight("Vanish")
    Loop
    Rest8:
      TNT1 A 0 A_CheckSight("Vanish")
      CAS2 K 250
    Loop
     Vanish:
     TNT1 A 0
     Stop

   }
}
