//Sprites: Clay, Thorir
//Sounds: Thorir
//Code : SgtMarkIV, Thorir

ACTOR Peacemaker : BrutalWeapon
{
	Game Doom
	SpawnID 27
	Weapon.SelectionOrder 1300
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive1 6
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "Clip1"
	Weapon.AmmoType2 "PMAmmo"
	Inventory.PickupMessage "You Got the Colt Peacemaker!"
    Inventory.PickupSound "TGCOCK"
	Obituary "%o was shot down by %k's Colt."
    AttackSound "None"
    +WEAPON.NOALERT
    +WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Scale 0.36
	Tag "Single-Action Colt Peacemaker"
	States
	{
		
    Spawn:
		COLT A -1
		Stop
    	
	Select:
		PCMK A 0 A_Giveinventory("GoSpecial",1)
		PCMK A 0 A_Takeinventory("FistsSelected",1)
		PCMK A 0 A_Takeinventory("SawSelected",1)
		PCMK A 0 A_Giveinventory("ShotgunSelected",1)
		PCMK A 0 A_Takeinventory("SSGSelected",1)
		PCMK A 0 A_Takeinventory("MinigunSelected",1)
		PCMK A 0 A_Takeinventory("PlasmaGunSelected",1)
		PCMK A 0 A_Takeinventory("RocketLauncherSelected",1)
		PCMK A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		PCMK A 0 A_Takeinventory("BFGSelected",1)
		PCMK A 0 A_Takeinventory("BFG10kSelected",1)
		PCMK A 0 A_Takeinventory("RailGunSelected",1)
		PCMK A 0 A_Takeinventory("SubMachineGunSelected",1)
		PCMK A 0 A_Takeinventory("RevenantLauncherSelected",1)
		PCMK A 0 A_Takeinventory("LostSoulSelected",1)
		PCMK A 0 A_Takeinventory("FlameCannonSelected",1)
		PCMK A 0 A_Takeinventory("HasBarrel",1)
		PCMK A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 AAAAAAAAA 0 A_Raise
		TNT1 AAAA 1 A_Raise

	SelectAnimation:
        TNT1 AAAA 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		PCMK A 1
        PMRR A 1 A_JumpIfInventory("GoFatality", 1, "Steady")
		PMRR B 1 A_PlaySound("TGCOCK", 3)
		PCMC G 1
		PCMK A 0 A_GunFlash

	Ready3:
	Ready:
		PCMK A 0 A_ZoomFactor(1.0)
		PCMK A 1 A_WeaponReady(WRF_ALLOWRELOAD)
        PCMK A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        PCMK A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		PCMK A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		PCMK A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        PCMK A 0 A_JumpIfInventory("Reloading",1,"Reload")
		PCMK A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		PCMK A 0 A_JumpIfInventory("Unloading",1,"Unload")
		PCMK A 0 A_Takeinventory("PistolFireAnimation1",1)
		PCMK A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		Loop
	
	Deselect:
		PCMK A 0
		PCMK A 0 A_Takeinventory("Zoomed",1)
		PCMK A 0 A_TakeInventory("TossGrenade", 1)
		PCMK A 0 A_Takeinventory("ADSmode",1)
        PCMK A 0 A_ZoomFactor(1.0)
		PCMC G 1
		PMRR A 1
		PMRR B 1
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait

    Fire:
        TNT1 A 0 A_JumpIfInventory("PMAmmo",1,3)
		PCMF C 2 A_PlaySound("weapons/empty", 4)
        Goto Pump1
		TNT1 A 0
        TNT1 A 0 A_PlaySound("REVOFIR")
		PIST F 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		GLKF A 0 A_ZoomFactor(0.95)
		PCMF A 1 BRIGHT A_FireBullets (2, 1, -1, 80, "HitPuff", FBF_NORANDOM)	
        TNT1 A 0 A_FireCustomMissile("Tracer", random(-2,2), 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-12,12), 0, -1, 0, 0, random(-9,9))
		//TNT1 A 0 A_FireCustomMissile("ShakeYourAssMinor", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("PMAmmo",1)
        PCMF BC 1
		TNT1 A 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 0, -5, 0, 0)
		RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
		RIFG A 0 A_SetPitch(pitch-1.33)
		RIFG A 0 A_Giveinventory("RevolverCasing",1)
		PCMK A 0 A_JumpIfInventory("Reloading",1,"Reload")
		PCMK A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		PCMK A 0 A_WeaponReady(WRF_NOBOB | WRF_ALLOWRELOAD)
		PCMK A 0 A_JumpIfInventory("Reloading",1,"Reload")
		PCMK A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		PCMK A 0 A_WeaponReady(WRF_NOBOB | WRF_ALLOWRELOAD)
		PCMK A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		PCMF C 1 A_ZoomFactor(1.0)
		PCMF D 1 A_ClearReFire
		Goto Pump1
		
   Pump1:
	   TNT1 A 0
	   PCMF D 3
	   PCMC B 1 A_PlaySound("TGCOCK", 3)
	   PCMC D 2 
	   RIFG A 0 A_SetPitch(pitch-0.5)
	   PCMC E 3
	   PCMC FG 1 
	   PCMK A 1
	   PCMK A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
	   TNT1 A 0 A_JumpIfInventory("PMAmmo",1,2)
	   Goto NoAmmo
	   PCMK A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
	   TNT1 A 0 A_ClearReFire
	   Goto Ready3
	   
	AltFire:
		PCMK A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_JumpIfInventory("PMAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		TNT1 A 0
        TNT1 A 0 A_PlaySound("REVOFIR")
		PIST F 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		GLKF A 0 A_ZoomFactor(0.95)
		PCMF A 1 BRIGHT A_FireBullets (2, 3, -1, 80, "HitPuff", FBF_NORANDOM)	
        TNT1 A 0 A_FireCustomMissile("Tracer", random(-2,2), 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-12,12), 0, -1, 0, 0, random(-9,9))
		//TNT1 A 0 A_FireCustomMissile("ShakeYourAssMinor", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("PMAmmo",1)
        PCMF B 1 
		PCMF C 1 A_ZoomFactor(1.0)
		TNT1 A 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 0, -5, 0, 0)
		RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
		RIFG A 0 A_SetPitch(pitch-1.75)
		RIFG A 0 A_Giveinventory("RevolverCasing",1)
		GLCK A 0 A_JumpIfInventory("Reloading",1,"Reload")
		GLCK A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		GLCK A 0 A_WeaponReady(WRF_NOBOB | WRF_ALLOWRELOAD)
		GLCK A 0 A_JumpIfInventory("Reloading",1,"Reload")
		GLCK A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		GLCK A 0 A_WeaponReady(WRF_NOBOB | WRF_ALLOWRELOAD)
		TNT1 A 0 A_JumpIfInventory("PMAmmo",1,2)
	    PMFN AB 1
	    FMFN C 1 A_PlaySound("TGCOCK", 3)
	    PMFN D 1 A_SetPitch(pitch-2.5)
	    PMFN E 1
	    PCMK A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
	    PMFN F 1
		TNT1 A 0 A_Refire
		Goto Ready3
			
	CheckSprint:
		PCMK A 1 A_WeaponReady(WRF_NOFIRE)
		PCMK A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		PCMK A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		PCMK A 1 A_WeaponReady(WRF_NOFIRE)
		PCMK A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		PCMK A 0
		PCMK A 0 A_JumpIfInventory("Accelerate", 1, 1)
		Goto Ready3
		PCMK A 0 offset(-9,32) 
		PCMK A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		PCMK A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		PCMK A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		PCMK A 0 offset(-9,32) A_GiveInventory("UsedStamina", 3)
		PCMK A 0 offset(-9,32)
		PMRR A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		PMRR A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		PMRR A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		PMRR A 1 offset(0,38) A_SetPitch(pitch -0.5)
		PMRR A 1 offset(3,36) A_SetPitch(pitch -0.5)
		PMRR A 1 offset(6,34) A_SetPitch(pitch -0.5)
		PMRR A 1 offset(9,32) A_SetPitch(pitch -0.5)
		PCMK A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		PCMK A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        PCMK A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        PCMK A 0 A_JumpIfInventory("Reloading",1,"Reload")
		PCMK A 0 offset(-9,32) A_GiveInventory("UsedStamina", 3)
		PCMK A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		PMRR A 1 offset(9,34) A_SetPitch(pitch +0.5)
		PMRR A 1 offset(6,36) A_SetPitch(pitch +0.5)
		PMRR A 1 offset(3,38) A_SetPitch(pitch +0.5)
		PMRR A 1 offset(0,38) A_SetPitch(pitch +0.5)
		PMRR A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		PMRR A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		PMRR A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		PCMK A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		PCMK A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint
		
	StopSprintTired:
		PCMK A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		PCMK A 0 A_PlaySound("Tired", 2)
		PCMK A 0 A_TakeInventory("UsedStamina", 2)
		PCMK A 5 A_WeaponReady
		PCMK A 0 A_TakeInventory("UsedStamina", 2)
		PCMK A 5 A_WeaponReady
		PCMK A 0 A_TakeInventory("UsedStamina", 2)
		PCMK A 5 A_WeaponReady
		PCMK A 0 A_TakeInventory("UsedStamina", 2)
		PCMK A 5 A_WeaponReady
		PCMK A 0 A_TakeInventory("UsedStamina", 2)
		PCMK A 5 A_WeaponReady
		Goto Ready
		
	StopSprint:
		PCMK A 1
		GLCK A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready
	
    Reload:
	    PCMK A 0
		PCMK A 0 A_TakeInventory("Reloading", 1)
		PCMK A 0 A_JumpIfInventory("Clip1", 1, 2)
		Goto NoAmmo
		PCMK A 0
	    PCMK A 0 A_Takeinventory("Zoomed",1)
        PCMK A 0 A_ZoomFactor(1.0)
		PCMK A 1 A_WeaponReady
		PCMK A 0 A_JumpIfInventory("PMAmmo",6,"Ready")
		PCMF D 1
		PMRR A 1
		
	RemoveCasings:
	    TNT1 A 0 A_JumpIfInventory("RevolverCasing",1,2)
		goto NoCasing
		TNT1 A 0
		PMRE AB 1
		PMRE C 5
		
	CasingAnimation:
		PMRE D 3 A_PlaySound("insertshell")
		PMRE C 3 A_SpawnItemEx("PistolCaseSpawn",-4,0,0,-9)
		TNT1 A 0 A_Takeinventory("RevolverCasing",1)
		PCMK A 0 A_JumpIfInventory("RevolverCasing",1,"CasingAnimation")
		
	NoCasing:
		PMRR AB 1
		DGLO A 0 A_Giveinventory("HasUnloaded",1)
        
	 InsertingBulls:
		PCMK A 0
		PCMK A 0 A_JumpIfInventory("Clip1",1,2)
        Goto NoAmmo
		PCMK A 0
		TRER A 0 A_TakeInventory("HasUnloaded", 1)
        PCMK A 0 A_JumpIfInventory("PMAmmo",6,"Ready")
        PCMK A 0 A_Giveinventory("PMAmmo",1)
		PCMK A 0 A_Takeinventory("Clip1",1)
		DGLO A 0 A_Takeinventory("HasUnloaded",1)
        
	InsertBullAnimation:	
		PCMK A 0
		PMRR C 3
		PMRR DEGJ 1
		PMRR K 1 A_PlaySound("insertshell")
	    PMRR M 3
        PMRR NOPQRS 1
		PMRR T 2 
		PMRR UV 1
		PMRR W 2 A_WeaponReady(WRF_NOBOB)
		PCMK A 0 A_JumpIfInventory("PMAmmo",6,"FinishedInsertingBulls")
		PMR2 A 2 A_WeaponReady(WRF_NOBOB)
		PMR2 B 2 A_WeaponReady(WRF_NOBOB)
		PMR2 C 1 A_WeaponReady(WRF_NOBOB)
		PCMK A 0 A_JumpIfInventory("Kicking",1,"DoKickReloading")
		PCMK A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		PCMK A 0 A_JumpIfInventory("PMAmmo",6,"FinishedInsertingBulls")
		PMRR C 1 
        Goto InsertingBulls
		
	CheckIfFinishReload:
		TNT1 A 0
		PCMK A 0 A_JumpIfInventory("RevolverWasEmpty", 1, "FinishedInsertingBulls")
		PCMK A 0 A_JumpIfInventory("Clip1",1,1)
        Goto Ready3
		PCMK A 0 A_Giveinventory("PMAmmo",1)
		PCMK A 0 A_Takeinventory("Clip1",1)
        Goto InsertBullAnimation
		
	FinishedInsertingBulls:
		PMRR TBA 1 A_Takeinventory("Reloading",1)
		Goto Ready3
		
	 TurboReload:
		SHSS BC 0
		PCMK A 0 A_Takeinventory("RevolverCasing",6)
	TurboBullets:	
		PCMK A 0
		PCMK A 0 A_JumpIfInventory("PMAmmo",6,"FinishTurboReload")
        PCMK A 0 A_JumpIfInventory("Clip1",1,3)
        Goto FinishTurboReload
        TNT1 AAAA 0
        PCMK A 0 A_Giveinventory("PMAmmo",1)
		PCMK A 0 A_Takeinventory("Clip1",1)
		Goto TurboBullets
	FinishTurboReload:
		PCMK A 1
		Goto Ready3
	
	Unload:
		PCMF D 1 A_WeaponReady
		DGLO A 0 A_Takeinventory("RevolverCasing",6)
		DGLO A 0 A_Takeinventory("Unloading",1)
		DGLO A 0 A_Takeinventory("ADSmode",1)
		DGLO A 0 A_JumpIfInventory("PMAmmo",1,3)
        Goto NoAmmo
        TNT1 AAA 0
		DGLO A 0 A_Takeinventory("Zoomed",1)
        DGLO A 0 A_ZoomFactor(1.0)
		DGLO A 0 A_GiveInventory ("Pumping", 1)
		DGLO A 0 A_Takeinventory("Reloading",1)
        PCMF D 2
		PMRR A 1
		PMRR B 1 A_PlaySound("GLMAGOUT")
		PMRE C 3
		PMRE D 4
		DGLO A 0 A_Giveinventory("HasUnloaded",1)
		DGLO A 0 A_JumpIfInventory("GlockAmmo",1,"RemoveBullets")

	RemoveBullets:
		TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("PMAmmo",1,3)
		Goto FinishUnload
        TNT1 AAAAAA 0
		TNT1 A 0 A_Takeinventory("PMAmmo",1)
		TNT1 A 0 A_Giveinventory("Clip1",1)
		Goto RemoveBullets
	
	FInishUnload:
		PMRE D 1
		PMRE C 1
		PMRR BA 1
		PCMF D 2
		TNT1 A 0 A_PlaySound("DryFire")
		TNT1 A 0 A_GiveInventory("HasUnloaded", 1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		Goto Ready+6
		
		
	DoKickReloading:
		NULL A 0 A_JumpIf (momZ > 0, "AirKick")
		NULL A 0 A_JumpIf (momZ < 0, "AirKick")
        PCMK A 0 A_PlaySound("KICK")
		PCMK A 0 SetPlayerProperty(0,1,0)
		KICK BCD 1
		RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        KICK H 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK I 1
		KICK GFEDCBA 1 
		RIBA A 0 A_Takeinventory("Kicking",1)
		PCMK A 0 SetPlayerProperty(0,0,0)
		Goto InsertingBulls
		
	Steady:
		TNT1 A 1
		Goto Ready
		
	NoAmmo:
		RIFG A 0
		RIFG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_Takeinventory("Zoomed",1)
		RIFG A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
	NoAmmo2:
		RIFG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
	    RIFG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		RIFG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		RIFG A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PCMK A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOFIRE)
		RIFG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "Ready3")
		RIFG A 0 A_JumpIfInventory("Clip1",1,"Reload")
		RIFG A 0 A_JumpIfInventory("FiredPrimary",1,"NoAmmo2")
		Goto Ready3
			
	}
}

ACTOR PMAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 6
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 6
   Inventory.Icon "COLTB0"
}



Actor RevolverWasEmpty : Inventory
{
inventory.maxamount 1
}

Actor RevolverCasing : Inventory
{
inventory.maxamount 6
}