// --------------------------------------------------------------------------
//
// UAC-Combat Shotgun
//
// --------------------------------------------------------------------------

Actor D64Shotgun: D64Weapon Replaces Shotgun
{
  Weapon.AmmoType "Shell2"
  Weapon.AmmoUse 1
  Weapon.AmmoGive 8
  Inventory.PickupMessage "You got the UAC-Combat Shotgun!"
  Inventory.PickUpSound "Weapons/PickUp"
  Obituary "%o was blown open by %k's UAC-Combat Shotgun."
  Tag "UAC-Combat Shotgun"
  +WEAPON.AMMO_OPTIONAL
  +WEAPON.NOAUTOFIRE
  
  States
  {
 Select:
	TNT1 A 0 A_PlaySound("Weapons/Shotgun/Up",5)
	SHT1 A 1 Offset(67, 100)
	SHT1 A 1 Offset(54, 81)
	SHT1 A 1 Offset(32, 69)
	SHT1 A 1 Offset(22, 58)
	SHT1 A 1 Offset(10, 47)
	SHT1 A 1 Offset(7, 39)
	SHT1 A 1 Offset(2, 34) 
    SHT1 A 1 A_Raise
    Wait
 Ready:
	TNT1 A 0 A_PlaySound("Weapons/Shotgun/Idle", 7, 3, 1)
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
    SHT1 A 2 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
	SHT1 B 2 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
	SHT1 C 2 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsGrenading",1,"ThrowGrenade")
	TNT1 A 0 A_JumpIfInventory("IsKicking", 1, "DoKick")
    Loop
 Deselect:
	TNT1 A 0 A_PlaySound("weapons/weaponholster",3)
	TNT1 A 0 A_StopSound(1)
	TNT1 A 0 A_StopSound(5)
	TNT1 A 0 A_StopSound(7)
	SHT1 A 1 Offset(2, 34)
	SHT1 A 1 Offset(7, 39)
	SHT1 A 1 Offset(10, 47)
	SHT1 A 1 Offset(22, 58)
	SHT1 A 1 Offset(32, 69)
	SHT1 A 1 Offset(54, 81)
	SHT1 A 1 Offset(67, 100)
    SHT1 A 1 A_Lower
    Wait 
	
	Fire:
		TNT1 A 0 A_JumpIfInventory("Shell2",1,1)
		Goto DryFire
		TNT1 A 0 A_StopSound(1)
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_StopSound(7)
		TNT1 A 0 A_Playsound("Weapons/Shotgun/Fire",6)
		TNT1 A 0 A_FireBullets(3.6, 3.6, 10, 6,"Shot_Puff")
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Gunflash
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		SHTF A 2 BRIGHT
		TNT1 A 0 Radius_Quake(1, 2, 0, 1, 0)
		TNT1 A 0 A_SetPitch(pitch -2.0)
		SHTF B 2 Offset(0,34)
		SHT1 A 1 Offset(0,39)
		SHT1 A 1 Offset(0,37)
		SHT1 A 1 Offset(0,36)
		SHT1 A 1 Offset(0,34)
		SHT1 A 1 Offset(0,32)
		SHTG BBC 1
		TNT1 A 0 A_Playsound("Weapons/Shotgun/Pump",7)
		SHTG DDEEFFGGHH 1
		TNT1 A 0 A_FireCustomMissile("ShotCaseSpawn",-6,0,-19,-20,-14)
		SHTG GGG 1
		SHTG FEDCB 2
		SHT1 A 1 A_ReFire
		Goto Ready
	AltFire:
		TNT1 A 0 A_JumpIfInventory("Shell2",1,1)
		Goto DryFire
		TNT1 A 0 A_StopSound(7)
		TNT1 A 0 A_PlaySound("Weapons/Plasma/Alt1",1,1)
		SHFF A 1 Offset(0,34) A_GunFlash
		SHFF B 1 Offset(0,38) A_AlertMonsters
		SHFF A 1 Offset(0,43)
		TNT1 A 0 A_FireCustomMissile("Flame2",0,1,0,-2,0)
		TNT1 A 0 A_TakeInventory("Shell2",1,TIF_NOTAKEINFINITE)
		SHFF AB 1 BRIGHT
		TNT1 A 0 Radius_Quake (2, 1, 0, 1, 0)
		TNT1 A 0 A_SetPitch(pitch -0.2)
		TNT1 A 0 A_ReFire
		SHFF A 1 Offset(0,41)A_PlaySound("Weapons/Plasma/Alt3",1)
		SHFF B 1 Offset(0,37)
		SHFF A 1 Offset(0,33)
		Goto Ready
	AltHold:
		TNT1 A 0 A_JumpIfInventory("Shell2",1,1)
		Goto DryFire
		TNT1 A 0 A_PlaySound("Weapons/Plasma/Alt2",5,1,1)
		SHFF A 1 BRIGHT Offset(-3,44) A_FireCustomMissile("Flame2",0,1,0,0,0)
		SHFF B 1 BRIGHT Offset(4,46) A_FireCustomMissile("Flame2",0,1,0,0,0)
		SHFF A 1 BRIGHT Offset(1,45) A_FireCustomMissile("Flame2",0,1,0,0,0)
		SHFF B 1 BRIGHT Offset(-2,43) A_FireCustomMissile("Flame2",0,1,0,0,0)
		TNT1 A 0 A_TakeInventory("Shell2",1,TIF_NOTAKEINFINITE)
		TNT1 A 0 Radius_Quake (2, 1, 0, 1, 0)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetPitch(pitch -0.2)
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_ReFire
		TNT1 A 0 A_StopSound(5)
		SHFF A 1 Offset(0,41)
		SHFF B 1 Offset(0,37)
		SHFF A 1 Offset(0,33)
		Goto Ready
		DryFire:
		TNT1 A 0 A_StopSound(1)
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_StopSound(7)
		TNT1 A 0 A_Print("No ammunition. Go find more.",1)
		Goto Ready

//Kick
	DoKick:
		TNT1 A 0 A_JumpIf (momZ > 0, "AirBorne")
		TNT1 A 0 A_JumpIf (momZ < 0, "AirBorne")
		TNT1 A 0 A_JumpIfInventory("BerserkStrength",1,"BerserkKick")
		KICK A 1 Offset(0,32)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK B 1 A_ZoomFactor(0.99)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK C 1 A_ZoomFactor(0.98)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK D 1 A_ZoomFactor(0.97)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK E 1 A_ZoomFactor(0.96)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK F 1 A_ZoomFactor(0.95)
		TNT1 A 0 A_CustomPunch(3 * random(5, 10),0,0,"KickPuff") 
		Goto FireEnd
		BerserkKick:
		KICK A 1 Offset(0,32)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK B 1 A_ZoomFactor(0.99)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK C 1 A_ZoomFactor(0.98)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK D 1 A_ZoomFactor(0.97)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK E 1 A_ZoomFactor(0.96)
		TNT1 A 0 A_SetPitch(Pitch-1)
		KICK F 1 A_ZoomFactor(0.95)
		TNT1 A 0 A_CustomPunch(20 * random(5, 10),0,0,"KickPuff")
		Goto FireEnd
		FireEnd:
		KICK GHIH 1
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK G 1 A_ZoomFactor(0.96)
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK F 1 A_ZoomFactor(0.97)
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK E 1 A_ZoomFactor(0.98)
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK D 1 A_ZoomFactor(0.99)
		TNT1 A 0 A_SetPitch(Pitch+1)
		KICK C 1 A_ZoomFactor(1.00)
		TNT1 A 3
		KICK BA 1
		Goto Ready
		AirBorne:
		TNT1 A 0 A_JumpIfInventory("BerserkStrength",1,"AirBerserk")
		TNT1 A 0 Offset(-1,32)
		KIKK ABCDE 1 A_Recoil(-2)
		KIKK F 3 A_CustomPunch (15,0,0,"KickPuff") 
		Goto EndFire
		AirBerserk:
		TNT1 A 0 Offset(-1,32)
		KIKK ABCDE 1 A_Recoil(-2)
		KIKK F 3 A_CustomPunch (25 * random(5, 10),0,0,"KickPuff")
		Goto EndFire
		EndFire:
		KIKK GHIJK 2 
		Goto Ready
		
//Throw Grenade
	ThrowGrenade:
		TNT1 A 0 A_JumpIf(waterlevel>2,"DryFire")
		TNT1 A 0 A_JumpIfInventory("GrenadeAmmo",1,1)
		Goto Dryfire
		TNT1 A 0 A_StopSound(1)
		TNT1 A 0 Offset(-20,32)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND B 1 Offset(0,24)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND C 1 Offset(0,23)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND D 1 Offset(0,26) A_PlaySound("weapons/SHG/throw")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND D 1 Offset(0,28)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_SpawnItemEx("RealGrenade",0,1,24,cos(pitch)*40,0,sin(-pitch)*40,3,SXF_TRANSFERPITCH|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_TakeInventory("GrenadeAmmo",1)
		MAND E 1 Offset(-3,30)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND E 1 Offset(-6,31)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND F 1 Offset(-9,32)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MAND F 1 Offset(-12,33)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_TakeInventory("GetOnWithIt", 100)
		TNT1 A 0 A_JumpIfNoAmmo("DryFire")
		TNT1 A 7 Offset (75, 152)
		TNT1 A 1 Offset (6, 42)
		Goto Ready

		Flash:
		TNT1 A 4 Bright A_Light1
		TNT1 A 3 Bright A_Light2
		Goto LightDone
	
  Spawn:
    SHTP A -1
    Loop
  }
}

ACTOR Flame2
{
	Speed 35
	Height 11
	Radius 6
	Mass 10
	Damage 12
	DamageType Fire
	ReactionTime 7
	Projectile
	+NOGRAVITY
	+STRIFEDAMAGE
	+FIREDAMAGE
	+NOBLOOD
	+BLOODLESSIMPACT
	MaxStepHeight 4
	RenderStyle Add
	Alpha 1.5
	SeeSound ""
	Decal "Revenantscorch"
	Obituary "%o was scorched clean by %k's UAC-Onibi Underbarrel Flamethrower."
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_SetScale(0.5)
		PYFL A 1 Bright A_Countdown
		Loop
	Death:
		PYFL BCDEFGHIJKLMNOP 1 BRIGHT
		TNT1 A 0 A_Fadeout(0.5)
		Stop
	}
}