// --------------------------------------------------------------------------
//
//	Hitlers Buzzsaw
//
// --------------------------------------------------------------------------

ACTOR U_HitlersBuzzsaw : BaseWeapon replaces HitlersBuzzsaw
{
	Weapon.AmmoUse 0
	Weapon.AmmoGive 600
	Weapon.AmmoType "BuzzsawAmmoz"
	Weapon.SelectionOrder 50
	Inventory.PickupSound "BFGREADY"
	Inventory.PickupMessage "You got the Super Secret Weapon: Hitler's Buzzsaw."
	Obituary "%o was cut in half by %k's MG42."
	tag "Buzzsaw"
	Scale 0.8
	States
	{
	Spawn:
		HB0I A -1
		Stop
		
	Select:
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1010,10)==0, "PuristGun")
		TNT1 A 0 A_Giveinventory("MinigunSelected",1)
		TNT1 A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_Takeinventory("WeapSpecial",1)
		TNT1 A 0 A_Takeinventory("Taunting",1)
		TNT1 A 0 A_Takeinventory("IdleCounter",200)
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1025,1)==0, 2)
		TNT1 A 0 A_Giveinventory("BD21graphics",1)
		TNT1 A 5
		TNT1 A 0 A_Raise
		Wait

	Deselect:
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 7)
		HB1S ABCDE 1
		TNT1 A 0 A_Jump(256,6)
		HB2S ABCDE 1
		TNT1 A 1 A_TakeInventory("MinigunSelected", 1)
		TNT1 A 0 A_TakeInventory("BD21graphics",1)
		TNT1 A 0 A_Lower
		Wait
	
	Ready:
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		TNT1 A 0 A_PlaySound("BFGREADY")
	Ready1:
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 7)
		HB1S EDCBA 1
		TNT1 A 0 A_Jump(256,6)
		HB2S EDCBA 1
	Ready2:
        TNT1 A 0 A_JumpIfInventory("Kicking",1, "HBKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1, "TauntL")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("IdleCounter",200,"PlayerIsIdle")
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 2)
		HB1F A 1 A_WeaponReady
		Goto Ready2
		HB2F A 1 A_WeaponReady
		Goto Ready2
	
	PuristGun:
		TNT1 A 0 A_TakeInventory("U_HitlersBuzzsaw", 1)
		Goto Ready
		
// --------------------------------------------------------------------------
//
//	Fire
//
// --------------------------------------------------------------------------
		
	Fire:
        TNT1 A 0 A_JumpIfInventory("BuzzsawAmmoz",1,1)
        Goto DryFire
		TNT1 A 0 A_FireBullets (1, 1, 1, 18, "ExtremeBulletPuff")
        TNT1 A 0 A_FireCustomMissile("Tracer", frandom(-1,1), 0, -1, -12, 0, frandom(-1,1))
		TNT1 A 0 A_PlaySound("MP40", 1)
		TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",-5,0,0,0)
		TNT1 A 0 A_SetPitch(-1.0 + pitch)
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		TNT1 A 0 A_TakeInventory("BuzzsawAmmoz",1)
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 8)
		TNT1 A 0 A_JumpIfInventory("FireSeq", 1, 4)
		HB1F B 1 BRIGHT A_FireCustomMissile("ShakeYourAss", 0, 0, 0, 0)
		TNT1 A 0 A_GiveInventory("FireSeq", 1)
		TNT1 A 0 A_Jump(256,3)
		HB1F C 1 BRIGHT A_FireCustomMissile("ShakeYourAssMinor", 0, 0, 0, 0)
		TNT1 A 0 A_TakeInventory("FireSeq", 1)
		TNT1 A 0 A_Jump(256,7)
		TNT1 A 0 A_JumpIfInventory("FireSeq", 1, 4)
		HB2F B 1 BRIGHT A_FireCustomMissile("ShakeYourAss", 0, 0, 0, 0)
		TNT1 A 0 A_GiveInventory("FireSeq", 1)
		TNT1 A 0 A_Jump(256,3)
		HB2F C 1 BRIGHT A_FireCustomMissile("ShakeYourAssMinor", 0, 0, 0, 0)
		TNT1 A 0 A_TakeInventory("FireSeq", 1)
		TNT1 A 0 A_SetPitch(0.6 + pitch)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetAngle(frandom(2, -2) + angle)
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 3)
		HB1F A 1 A_FireCustomMissile("50CaseSpawn2",5,0,12,-14)
		TNT1 A 0 A_Jump(256,2)
		HB2F A 1 A_FireCustomMissile("50CaseSpawn2",5,0,12,-14)
		TNT1 A 0 A_Refire
		Goto Ready2

	DryFire:
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 2)
		HB1F A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		Goto Ready2
		HB2F A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		Goto Ready2

// --------------------------------------------------------------------------
//
//	End Stuff
//
// --------------------------------------------------------------------------

	KickFlash:
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 11)
		HB1K ABCD 1
		HB1K E 8
		HB1K DCBA 1
		HB1F A 1
		Stop
		HB2K ABCD 1
		HB2K E 8
		HB2K DCBA 1
		HB2F A 1
		Stop
		
	AirKickFlash:
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 11)
		HB1K ABCD 1
		HB1K E 10
		HB1K DCBA 1
		HB1F A 1
		Stop
		HB2K ABCD 1
		HB2K E 10
		HB2K DCBA 1
		HB2F A 1
		Stop
		
	TauntFlash:
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 12)
		HB1F A 2
		HB1K ABCD 1
		HB1K E 32
		HB1K DCBA 1
		HB1F A 2
		Stop
		HB2F A 2
		HB2K ABCD 1
		HB2K E 32
		HB2K DCBA 1
		HB2F A 2
		Stop
		
	GrenadeFlash:
		TNT1 A 0 A_JumpIfInventory("BD21graphics", 1, 6)
		HB1S ABCDE 1
		Stop
		HB2S ABCDE 1
		Stop

	HBKick:
		TNT1 A 0 A_JumpIf (momZ > 0, "HBAirKick")
		TNT1 A 0 A_JumpIf (momZ < 0, "HBAirKick")
		TNT1 A 0 A_GunFlash("KickFlash")
		TNT1 A 0 A_JumpIf (pitch > 32, "HBLowKickChecker1")
		Goto HBInitializeNormalKick
		
	HBLowKickChecker1:
	    TNT1 A 0 A_JumpIf (pitch > 90, "HBInitializeNormalKick")
		TNT1 A 0 A_FireCustomMissile("KickAttackDetectDowned", 0, 0, 0, 0)

	HBInitializeNormalKick:
        TNT1 A 0 A_jumpifinventory("PowerStrength",1,"HBBerserkerKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		KIC3 BCD 1
		TNT1 A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        KIC3 H 5
		TNT1 A 0 A_Takeinventory("Kicking",1)
		KIC3 IGFEDCBA 1
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Ready2")
		Goto Ready2

    HBBerserkerKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		KIC3 BCD 1
        TNT1 A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
        KIC3 H 5
		TNT1 A 0 A_Takeinventory("Kicking",1)
		KIC3 IGFEDCBA 1
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Ready2")
		Goto Ready2
	
	HBAirKick:
		TNT1 A 0 A_GunFlash("AirKickFlash")
	    TNT1 A 0 A_jumpifinventory("PowerStrength",1,"HBSuperAirKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil(-6)
		KLCK JKLMN 1
        TNT1 A 0 A_FireCustomMissile("AirKickAttack", 0, 0, 0, -31)
        KLCK O 3
		TNT1 A 0 A_Takeinventory("Kicking",1)
		KLCK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Ready2")
		Goto Ready2
		
	HBSuperAirKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil(-6)
		KLCK JKLMN 1
        TNT1 A 0 A_FireCustomMissile("SuperAirKickAttack", 0, 0, 0, -31)
        KLCK O 3
		TNT1 A 0 A_Takeinventory("Kicking",1)
		KLCK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Ready2")
		Goto Ready2
	}
}

ACTOR BuzzsawAmmoz : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 600
	Ammo.BackpackAmount 20
	Ammo.BackpackMaxAmount 600
	Inventory.Icon "HB0IB0"
	States
	{
	Spawn:
		HB0I B -1     
	}
}