
// Spray paint.
// by Aenima

ACTOR SSTSprayPaint : DoomWeapon 20606
{
 //$Category Weapons
  Tag "SprayPaint"
Scale .75
+NOALERT
//Inventory.PickupSound "weapons/grabup"
Inventory.PickupMessage "Got a can of spraypaint! Go tag something!"
Obituary "%o was killed by %k during a tragic painting accident."
Weapon.Kickback 0
weapon.selectionorder 4000
+NOAUTOFIRE
+NOAUTOAIM
+WEAPON.NO_AUTO_SWITCH
//+WEAPON.NOAUTOSWITCHTO

  Weapon.preferredSkin "FistSkin"
  Weapon.SelectionOrder 9998
  Weapon.ViewPitchStyle Full
  Weapon.ViewPitchOffset 32
States
	{
	Spawn:
		SYPT A -1
		Loop
	Ready:
		SYPT B 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SYPT C 0 A_StopSoundEx("voice")
		Loop
	Deselect:
		NULL A 0 A_TakeInventory("IsCycling",1)
		SYPT B 1 A_Lower
		SYPT B 0 A_Lower
		SYPT C 0 A_StopSoundEx("voice")
		Loop
	Select:
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "Ready")
                NULL AAAAAAAAAAAAAAA 0 A_Raise
		SYPT BBBBBBB 0 A_Lower
		SYPT CCC 1 A_Raise
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "Ready")
		SYPT CCC 0 A_Raise
		SYPT C 0 A_PlayweaponSound("spraypaint/shake")
		SYPT CCC 1 A_Lower
		SYPT CCC 0 A_Lower
		//SHT3 I 0 A_Playsoundex ("weapons/M500load", voice)
		SYPT CCC 1 A_Raise
		SYPT CCC 0 A_Raise
		//SYPT C 0 A_PlayweaponSound("Weapons/M3ShtShell")
		SYPT CCC 1 A_Lower
		SYPT CCC 0 A_Lower
		NULL A 0 A_JumpIfInventory("Spraycolor",7,"sayblack")
		NULL A 0 A_JumpIfInventory("Spraycolor",6,"saywhite")
		NULL A 0 A_JumpIfInventory("Spraycolor",5,"saypurple")
		NULL A 0 A_JumpIfInventory("Spraycolor",4,"sayblue")
		NULL A 0 A_JumpIfInventory("Spraycolor",3,"saygreen")
		NULL A 0 A_JumpIfInventory("Spraycolor",2,"sayyellow")
		NULL A 0 A_JumpIfInventory("Spraycolor",1,"sayorange")
		Goto SayRed
	Reload:
		SYPT C 0 A_StopSoundEx("voice")
		NULL A 0 A_GiveInventory("IsCycling",1)
		SYPT B 1
		SYPT B 1 A_WeaponReady(WRF_ALLOWRELOAD)
		
		NULL A 0 A_TakeInventory("IsCycling",1)
		Goto Ready
		
	CycleColorBackward:
		NULL A 0 A_JumpIfInventory("SprayColor",1,2)
		NULL A 0 A_GiveInventory("Spraycolor",7)
		Goto CycleDone
		
		NULL A 0 A_TakeInventory("Spraycolor",1)
		NULL A 0 A_JumpIfInventory("SprayColor",1,"CycleDone")
		NULL A 0 A_GiveInventory("Spraycolor",8)
		Goto CycleDone
	AltFire:
		NULL A 0 A_JumpIfInventory("IsCycling",1,"CycleColorForward")
		SYPT B 3
		SYPT BBBBBBB 0 A_Lower
		SYPT CCC 1 A_Raise
		SYPT CCC 0 A_Raise
		SYPT C 0 A_PlayweaponSound("spraypaint/shake")
		SYPT CCC 1 A_Lower
		SYPT CCC 0 A_Lower
		//SHT3 I 0 A_Playsoundex ("weapons/M500load", voice)
		SYPT CCC 1 A_Raise
		SYPT CCC 0 A_Raise
		//SYPT C 0 A_PlayweaponSound("Weapons/M3ShtShell")
		SYPT CCC 1 A_Lower
		SYPT CCC 0 A_Lower
		
	CycleColorForward:
		NULL A 0 A_GiveInventory("Spraycolor",1)
	CycleDone:
		NULL A 0 A_JumpIfInventory("Spraycolor",8,"changeback")
		NULL A 0 A_JumpIfInventory("Spraycolor",7,"sayblack")
		NULL A 0 A_JumpIfInventory("Spraycolor",6,"saywhite")
		NULL A 0 A_JumpIfInventory("Spraycolor",5,"saypurple")
		NULL A 0 A_JumpIfInventory("Spraycolor",4,"sayblue")
		NULL A 0 A_JumpIfInventory("Spraycolor",3,"saygreen")
		NULL A 0 A_JumpIfInventory("Spraycolor",2,"sayyellow")
		NULL A 0 A_JumpIfInventory("Spraycolor",1,"sayorange")
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	changeback:
		NULL A 0 A_TakeInventory("Spraycolor",8)
	sayred:
		NULL A 0 ACS_ExecuteAlways(927,0, 0,0,0)
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	sayorange:
		NULL A 0 ACS_ExecuteAlways(927,0, 1,0,0)
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	sayyellow:
		NULL A 0 ACS_ExecuteAlways(927,0, 2,0,0)
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	saygreen:
		NULL A 0 ACS_ExecuteAlways(927,0, 3,0,0)
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	sayblue:
		NULL A 0 ACS_ExecuteAlways(927,0, 4,0,0)
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	saypurple:
		NULL A 0 ACS_ExecuteAlways(927,0, 5,0,0)
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	saywhite:
		NULL A 0 ACS_ExecuteAlways(927,0, 6,0,0)
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	sayblack:
		NULL A 0 ACS_ExecuteAlways(927,0, 7,0,0)
		SYPT CCCCCCC 0 A_Raise
		Goto Ready
	Fire:
		NULL A 0 A_JumpIfInventory("IsCycling",1,"CycleColorBackward")
		SYPT C 0 A_PlaySoundEx("spraypaint/spray","voice",1)
	Hold:
		NULL A 0 A_JumpIfInventory("Spraycolor",7,"black")
		NULL A 0 A_JumpIfInventory("Spraycolor",6,"white")
		NULL A 0 A_JumpIfInventory("Spraycolor",5,"purple")
		NULL A 0 A_JumpIfInventory("Spraycolor",4,"blue")
		NULL A 0 A_JumpIfInventory("Spraycolor",3,"green")
		NULL A 0 A_JumpIfInventory("Spraycolor",2,"yellow")
		NULL A 0 A_JumpIfInventory("Spraycolor",1,"orange")
	Red:
		SYPT C 2 A_FireCustomMissile("PaintMist2", 0, 0, 1, 4)
		SYPT C 0 A_ReFire
		Goto Ready   
	Blue:
		SYPT C 2 A_FireCustomMissile("PaintMist", 0, 0, 1, 4)
		SYPT C 0 A_ReFire
		Goto Ready  
	Green:
		SYPT C 2 A_FireCustomMissile("PaintMist3", 0, 0, 1, 4)
		SYPT C 0 A_ReFire
		Goto Ready  
	Orange:
		SYPT C 2 A_FireCustomMissile("PaintMist4", 0, 0, 1, 4)
		SYPT C 0 A_ReFire
		Goto Ready  
	Purple:
		SYPT C 2 A_FireCustomMissile("PaintMist5", 0, 0, 1, 4)
		SYPT C 0 A_ReFire
		Goto Ready  
	Yellow:
		SYPT C 2 A_FireCustomMissile("PaintMist7", 0, 0, 1, 4)
		SYPT C 0 A_ReFire
		Goto Ready  
	White:
		SYPT C 2 A_FireCustomMissile("PaintMist6", 0, 0, 1, 4)
		SYPT C 0 A_ReFire
		Goto Ready 
	Black:
		SYPT C 2 A_FireCustomMissile("PaintMist8", 0, 0, 1, 4)
		SYPT C 0 A_ReFire
		Goto Ready 
	}
}


ACTOR PaintMist
{
   Scale .35
   Radius 3
   Height 4
   Damage 1//0
   Speed 10//8
   PROJECTILE
	+FORCEXYBILLBOARD
   +DONTSPLASH
+BLOODLESSIMPACT
+NOBLOOD
   //+STRIFEDAMAGE
   //+FORCEPAIN //doesn't work?
   DamageType "BluePaint"
   RENDERSTYLE Translucent
   Alpha 0.35
   States
   {
   Spawn:
      TNT1 A 0
      TNT1 A 1
      PTMT ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_FadeOut(0.01)
      Goto Death
   Death:
      TNT1 A 1
      Stop
   }
}


Actor PaintMist2 : PaintMist
{
  DamageType "RedPaint"
  Translation "192:207=172:191"
}

Actor PaintMist3 : PaintMist
{
  DamageType "GreenPaint"
  Translation "192:207=112:127"
}

Actor PaintMist4 : PaintMist
{
  DamageType "OrangePaint"
  Translation "192:207=211:223"
}

Actor PaintMist5 : PaintMist
{
  DamageType "PurplePaint"
  Translation "192:207=250:254"
}

Actor PaintMist6 : PaintMist
{
  DamageType "WhitePaint"
  Translation "192:207=64:79"
}

Actor PaintMist7 : PaintMist
{
  DamageType "YellowPaint"
  Translation "192:207=160:167"
}

Actor PaintMist8 : PaintMist
{
  DamageType "BlackPaint"
  Translation "192:207=103:111"
}

ACTOR SprayColor : Inventory
{
   Inventory.Amount 1
   Inventory.MaxAmount 8
}

ACTOR IsCycling : Inventory
{
   Inventory.Amount 1
   Inventory.MaxAmount 1
}