/*
CREDITS:
Sprites - Xatrix (Redneck Rampage)
Pickup - WildWeasel

Sounds:
Up - Epic Games (UT2004)
Idle, Fire, flinged saw impact - Croteam (Serious Sam 2)
Saw flesh - Croteam (Serious Sam: SE)
Saw wall - ID (Doom 3)
Alt-Fire - Epic Games (Unreal)
2nd part of impact - ?
*/

ACTOR Razorjack : Weapon 24514
{ 
	//$Category Weapons
	//$Title Razorjack
	//$Sprite RAZGX0
	Inventory.PickupSound "misc/w_pkup" 
	Inventory.PickupMessage "Picked up yer good old pal' ''Perestroika'' razorjack! Hold on your hats kids, here comes the threadcutter! (1)"
	Obituary "%o was ''hello, I'm a lumberjack!'' 'd by %k's rotating blade."
	Weapon.UpSound "Weapons/RazorjackGun"
	Weapon.SelectionOrder 7
	Weapon.Kickback 10
	Weapon.SlotNumber 1
	States 
   { 
   Spawn: 
       RAZG X -1 
       Loop
   Ready:
       RAZG A 0 A_TakeInventory("RazorjackEmpower",1)
       RAZG A 0 A_PlaySoundEx("Weapons/RazorjackIdle","Soundslot6",1)
       RAZG A 0 A_StopSoundEx("SoundSlot5")
       RAZG A 1 A_WeaponReady 
       Loop
   Deselect:
       RAZG A 0 A_PlaySoundEx("Weapons/RazorjackIEnd","Soundslot6")
   Looper:
       RAZG A 0 A_Lower
       RAZG A 1 A_Lower
       Loop 
   Select:
       RAZG A 0 A_Raise
       RAZG A 1 A_Raise
       Loop
   Fire:
       RAZG A 0 A_GiveInventory("RazorjackEmpower",1)
       RAZG A 0 A_PlaySoundEx("Weapons/RazorjackIEnd","Soundslot6")
       RAZE A 0 A_PlayWeaponSound("Weapons/RazorjackUp")
       RAZE ABABAB 2
       RAZG A 0 A_StopSoundEx("Weapon")
       RAZE A 0 A_PlaySoundEx("Weapons/RazorjackLoop","Soundslot5",1)
       RAZE A 1 A_CustomPunch(15, 0, 0, "RazorPuff", 75+random(15,-5))
       RAZE A 0 A_WeaponReady(WRF_NOBOB|WRF_NOPRIMARY|WRF_NOSWITCH)
       RAZE B 1 A_CustomPunch(15, 0, 0, "SilentRazPuff", 75+random(5,-5))
       RAZE A 0 A_WeaponReady(WRF_NOBOB|WRF_NOPRIMARY|WRF_NOSWITCH)
       RAZE A 1 A_CustomPunch(15, 0, 0, "RazorPuff", 75+random(15,-5))
       RAZE A 0 A_WeaponReady(WRF_NOBOB|WRF_NOPRIMARY|WRF_NOSWITCH)
       RAZE B 1 A_CustomPunch(15, 0, 0, "SilentRazPuff", 75+random(5,-5))
       RAZE A 0 A_WeaponReady(WRF_NOBOB|WRF_NOPRIMARY|WRF_NOSWITCH)
       RAZE A 0 A_ReFire
       RAZG A 0 A_StopSoundEx("SoundSlot5")
       RAZE A 0 A_PlayWeaponSound("Weapons/RazorjackDown")
       RAZE AB 2
       RAZE ABAB 3 A_WeaponReady(WRF_NOSWITCH)
       RAZG A 0 A_PlaySoundEx("Weapons/RazorjackIdle","Soundslot6",1)
       RAZE AB 4
       Goto ready
    Hold:
       RAZG A 0 A_GiveInventory("RazorjackEmpower",1)
       RAZE A 0 A_PlaySoundEx("Weapons/RazorjackLoop","Soundslot5",1)
       RAZE A 1 A_CustomPunch(15, 0, 0, "RazorPuff", 75+random(15,-5))
       RAZE A 0 A_WeaponReady(WRF_NOBOB|WRF_NOPRIMARY|WRF_NOSWITCH)
       RAZE B 1 A_CustomPunch(15, 0, 0, "SilentRazPuff", 75+random(5,-5))
       RAZE A 0 A_WeaponReady(WRF_NOBOB|WRF_NOPRIMARY|WRF_NOSWITCH)
       RAZE A 1 A_CustomPunch(15, 0, 0, "RazorPuff", 75+random(15,-5))
       RAZE A 0 A_WeaponReady(WRF_NOBOB|WRF_NOPRIMARY|WRF_NOSWITCH)
       RAZE B 1 A_CustomPunch(15, 0, 0, "SilentRazPuff", 75+random(5,-5))
       RAZE A 0 A_WeaponReady(WRF_NOBOB|WRF_NOPRIMARY|WRF_NOSWITCH)
       RAZE A 0 A_ReFire
       RAZG A 0 A_StopSoundEx("SoundSlot5")
       RAZE A 0 A_PlayWeaponSound("Weapons/RazorjackDown")
       RAZE AB 2
       RAZE ABAB 3 A_WeaponReady(WRF_NOSWITCH)
       RAZG A 0 A_PlaySoundEx("Weapons/RazorjackIdle","Soundslot6",1)
       RAZE AB 4
       Goto ready
    AltFire:
       RAZE A 0 A_StopSoundEx("Soundslot5")
       RAZG A 0 A_JumpIfInventory("RazorjackEmpower",1,"EmpowerAltFire")
       RAZG A 0 A_PlaySoundEx("Weapons/RazorjackIEnd","Soundslot6")
       RAZG A 0 A_PlaySound("Weapons/RazorjackFire",1,0.8)
       RAZF AB 2
       RAZF C 0 A_FireCustomMissile("Razorblade",frandom(1.5,-1.5),1,7,-2,0,frandom(1.5,-1.5))
       RAZF CD 2
       RAZR AB 2
       RAZG A 4
       RAZG A 2 A_ReFire
       Goto ready
    AltHold:
       RAZE A 0 A_StopSoundEx("Soundslot5")
       RAZG A 0 A_JumpIfInventory("RazorjackEmpower",1,"EmpowerAltFire")
       RAZG A 0 A_PlaySound("Weapons/RazorjackFire",1,0.8)
       RAZF AB 2
       RAZF C 0 A_FireCustomMissile("Razorblade",frandom(1.5,-1.5),1,7,-2,0,frandom(1.5,-1.5))
       RAZF CD 2
       RAZR AB 2
       RAZG A 4
       RAZG A 2 A_ReFire
       Goto ready
    EmpowerAltFire:
       RAZG A 0 A_TakeInventory("RazorjackEmpower",1)
       RAZG A 0 A_PlaySoundEx("Weapons/RazorjackIEnd","Soundslot6")
       RAZG A 0 A_PlaySound("Weapons/RazorjackFire",1,0.8)
       RAZF AB 2
       RAZF C 0 A_FireCustomMissile("EmpoweredRazorblade",0,1,7,-2,0,0)
       RAZF CD 2
       RAZR AB 2
       RAZG A 4
       RAZG A 2 A_ReFire
       Goto ready
   } 
}

ACTOR RazorPuff : PunchPuff
{ 
   SeeSound ""
   States
   {
   Spawn:
    TNT1 A 0 A_PlaySound("weapons/razorjackhit",0,0.7)
    PUFF AAABBBCCCDDD 1 A_FadeOut(0.05)
    stop
   Crash:
    TNT1 A 0 A_PlaySound("weapons/razorjackhit",0,0.7)
    PUFF AAABBBCCCDDD 1 A_FadeOut(0.05)
    stop
   Melee:
    TNT1 A 0 A_PlaySound("weapons/razorjackflesh")
    stop
   }
}

ACTOR SilentRazPuff : PunchPuff
{ 
   SeeSound ""
   States
   {
   Spawn:
    PUFF AAABBBCCCDDD 1 A_FadeOut(0.05)
    stop
   Crash:
    PUFF AAABBBCCCDDD 1 A_FadeOut(0.05)
    stop
   Melee:
    TNT1 A 0
    stop
   }
}

Actor Razorblade
{
  radius 6
  height 8
  Scale 0.8
  speed 50
  damage 30
  seesound ""
  deathsound ""
  Obituary "%o's guts was shredded by %k's flying blade."
  Gravity 0.35
  PROJECTILE
  +RIPPER
  -NOGRAVITY
  states
  {
  Spawn:
    SAWS A 0
    SAWS A 0 A_SpawnItemEx("RazorbladeTrail",0,0,0,0,0,0,0,128)
    SAWS A 1
    Loop
  Death:
	TNT1 A 0 A_NoGravity
    TNT1 A 0 A_PlaySound("weapons/razorbladewall")
    //TNT1 A 1 A_SpawnItemEx("RazorbladeStruck",0,0,0,0,0,0,0,128)
    SAWS A 70
	SAWS A 1 A_FadeOut(0.1)
    Wait
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_PlaySound("Weapons/PainsawFlesh")
    BLUD AB 4
    BLUD C 8
    Stop
  }
}

ACTOR RazorbladeTrail
{
	radius 6
	height 8
	Scale 0.8
	Alpha 0.8
	+NOCLIP
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Translucent
	States
	{
	Spawn:
	SAWS AAAAAAA 1 A_FadeOut(0.15)
	Stop
	}
}

//

Actor RazorjackEmpower : Inventory
{
  Inventory.MaxAmount 1
}

Actor EmpoweredRazorblade : Razorblade
{
  speed 65
  damage 50
  Obituary "%o's guts was shredded even more painfully by %k's overclocked flying blade."
  states
  {
  Spawn:
    SAWS A 0
    SAWS A 1 A_SpawnItemEx("RazorbladeTrailA",0,0,0,0,0,0,0,128)
    SAWS B 1 A_SpawnItemEx("RazorbladeTrailB",0,0,0,0,0,0,0,128)
    SAWS C 1 A_SpawnItemEx("RazorbladeTrailC",0,0,0,0,0,0,0,128)
    SAWS D 1 A_SpawnItemEx("RazorbladeTrailD",0,0,0,0,0,0,0,128)
    SAWS E 1 A_SpawnItemEx("RazorbladeTrailE",0,0,0,0,0,0,0,128)
    SAWS F 1 A_SpawnItemEx("RazorbladeTrailF",0,0,0,0,0,0,0,128)
    SAWS G 1 A_SpawnItemEx("RazorbladeTrailG",0,0,0,0,0,0,0,128)
    SAWS H 1 A_SpawnItemEx("RazorbladeTrailH",0,0,0,0,0,0,0,128)
    Loop
  Death:
    "####" "#" 0 A_NoGravity
    "####" "#" 0 A_PlaySound("weapons/razorbladewall")
    //"####" "#" 0 A_SpawnItemEx("RazorbladeStruck",0,0,0,0,0,0,0,128)
    "####" "#" 70
    "####" "#" 1 A_FadeOut(0.1)
	Wait
  }
}

ACTOR RazorbladeTrailA : RazorbladeTrail
{
	Alpha 1
	States
	{
	Spawn:
	SAWS A 1 A_FadeOut(0.1)
	Wait
	}
}

ACTOR RazorbladeTrailB : RazorbladeTrail
{
	Alpha 1
	States
	{
	Spawn:
	SAWS B 1 A_FadeOut(0.1)
	Wait
	}
}

ACTOR RazorbladeTrailC : RazorbladeTrail
{
	Alpha 1
	States
	{
	Spawn:
	SAWS C 1 A_FadeOut(0.1)
	Wait
	}
}

ACTOR RazorbladeTrailD : RazorbladeTrail
{
	Alpha 1
	States
	{
	Spawn:
	SAWS D 1 A_FadeOut(0.1)
	Wait
	}
}

ACTOR RazorbladeTrailE : RazorbladeTrail
{
	Alpha 1
	States
	{
	Spawn:
	SAWS E 1 A_FadeOut(0.1)
	Wait
	}
}

ACTOR RazorbladeTrailF : RazorbladeTrail
{
	Alpha 1
	States
	{
	Spawn:
	SAWS F 1 A_FadeOut(0.1)
	Wait
	}
}

ACTOR RazorbladeTrailG : RazorbladeTrail
{
	Alpha 1
	States
	{
	Spawn:
	SAWS G 1 A_FadeOut(0.1)
	Wait
	}
}

ACTOR RazorbladeTrailH : RazorbladeTrail
{
	Alpha 1
	States
	{
	Spawn:
	SAWS H 1 A_FadeOut(0.1)
	Wait
	}
}
