actor SSTChainsaw : Chainsaw replaces chainsaw
{
  Game Doom
  SpawnID 32
  Weapon.Kickback 0
  Weapon.SelectionOrder 2199
  Weapon.UpSound "weapons/sawup"
  //Weapon.ReadySound "weapons/sawidle"
  Weapon.ReadySound "misc/null"
  //+WEAPON.READYSNDHALF
  Inventory.PickupMessage "$GOTCHAINSAW" // "A chainsaw!  Find some meat!"
  Obituary "%o was gutted by %k's chainsaw."
  +WEAPON.MELEEWEAPON	
  +Weapon.AXEBLOOD	
	+FORCEXYBILLBOARD
  //+Bloodsplatter
  //+EXTREMEDEATH //v1.4rc5
  Weapon.preferredSkin "ChainsawSkin"
  States
  {
  Ready:
    SAWG A 0 A_PlaySoundEx ("csawidl1", soundslot7, 1)
    SAWG C 0 A_Jump(64, "Ready1", "ready2", "ready3", "ready4", "ready5")
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    loop
  Ready1:
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    goto ready
  Ready2:
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    goto ready
  Ready3:
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    goto ready
  Ready4:
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    goto ready
  Ready5:
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG D 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    SAWG C 2 A_WeaponReady
    SAWG C 0 A_SpawnItemEx ("sawsound", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM,16)
    goto ready
  Deselect:
	SAWG A 0 A_StopsoundEx(soundslot7)
    SAWG D 0 ACS_ExecuteAlways(779,0, 4,0,0)
    SAWG A 0 A_Lower
    SAWG C 1 A_Lower
    SAWG A 0 A_Lower
    SAWG C 1 A_Lower
  DeselectLoop:
    SAWG A 1 A_Lower
    loop
  Select:
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "Ready")
	TNT1 A 0 Radius_Quake(3,4,0,1, 0)
    SAWG C 1 A_Raise
    loop
  Fire:
	TNT1 A 0 Radius_Quake(1,4,0,1, 0)
	MAVE A 0 A_StopsoundEx(soundslot7)
    //MAVE A 0 A_PlaySoundEx ("weapons/sawup", soundslot6) // meh. removed as of v1.3. You're welcome, Devilhunter. :P
    SAWG AB 2 A_Saw("", "weapons/sawhit", 2, "SawPuff")
    SAWG B 0 A_ReFire
    goto Ready
  Hold:
	TNT1 A 0 Radius_Quake(2,4,0,1, 0)
    MAVE A 0 A_PlaySoundEx ("weapons/sawhold", soundslot7, 1)
    SAWG AB 2 A_Saw("", "weapons/sawhit", 2, "SawPuff")
    SAWG B 0 A_ReFire
	MAVE A 0 A_StopsoundEx(soundslot7)
    MAVE A 0 A_PlaySoundEx ("weapons/sawdown", soundslot6)
    goto Ready
  Spawn:
    CSAW B -1
    stop
  }
}

ACTOR sawpuff : BulletPuff
{
damagetype "Chainsaw"
  States
  {
  Spawn:
    PUFF A 0 Bright
	NULL A 0 A_SpawnItemEx ("PuffEffectSpawner", 0,0,0, 0,0,0, 0, 160,32) 
    PUFF A 4 Bright
    PUFF B 4
    // Intentional fall-through
  Melee:
    PUFF CD 4
    Stop
  }
}

ACTOR sawsound
{
   Radius 1
   Height 1
   +NOBLOCKMAP
   +NOCLIP
   +ALLOWCLIENTSPAWN
   +RANDOMIZE
   +NOTIMEFREEZE
   States
   {
   Spawn:
      NULL A 0
      NULL A 0 A_Playsound ("weapons/sawidle")
      Stop
      NULL A 0
      NULL A 0
      Stop
   }
}
