actor SSTGrenadeLauncher : GrenadeLauncher replaces Grenadelauncher
{
  Tag "Grenade Launcher"
  //Game Doom
  Weapon.SelectionOrder 2499
  Weapon.AmmoUse 1
  Weapon.AmmoGive 2
  Weapon.AmmoType "RocketAmmo"
  +WEAPON.NOAUTOFIRE
  Inventory.PickupMessage "You got the Grenade Launcher!"
  Obituary "%o caught %k's grenade."
  Weapon.preferredSkin "GLSkin"
  Weapon.ViewPitchStyle Full
  Weapon.ViewPitchOffset 20
	+FORCEXYBILLBOARD
  States
  {
  Ready:
    GRLG A 1 A_WeaponReady
    Loop
  Deselect:
    TNT1 A 0 ACS_ExecuteAlways(779,0, 2,0,0)
    TNT1 A 0
    GRLG A 1 A_Lower
    Goto DeSelect+2
  Select:
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "Ready")
    TNT1 A 0 ACS_ExecuteAlways(779,0, 12,0,0)
    TNT1 A 0
    GRLG A 1 A_Raise
    Goto Select+3
  Fire:
    GRLG B 2 A_GunFlash
    GRLG B 0 A_PlayWeaponSound("weapons/grenlf2")
    GRLG B 0 A_FireCustomMissile ("SSTGrenade", 0, 1, 0, random(8,11)) 
    GRLG B 1 A_ZoomFactor(0.96)
    GRLG B 1 A_ZoomFactor(0.98)
    GRLG C 1 A_ZoomFactor(1)
    GRLG C 3
	GRLG D 4
    GRLG D 1 A_WeaponReady
    GRLG A 6 A_WeaponReady
    GRLG A 0 A_ReFire
    Goto Ready
  AltFire:
    GRLG E 0 A_JumpIfInventory("RocketAmmo", 1, 1)
	Goto Ready
    GRLG B 2 A_GunFlash
    GRLG B 0 A_PlayWeaponSound("weapons/grenlf2")
    GRLG B 0 A_FireCustomMissile ("SSTGrenade2", 0, 1, 0, random(8,11)) 
    GRLG F 0 A_TakeInventory("RocketAmmo", 1)
    GRLG B 1 A_ZoomFactor(0.96)
    GRLG B 1 A_ZoomFactor(0.98)
    GRLG C 1 A_ZoomFactor(1)
    GRLG C 3
	GRLG D 4
    GRLG D 1 A_WeaponReady
    GRLG A 6 A_WeaponReady
    GRLG A 0 A_ReFire
    Goto Ready

  Flash:
    GRLF A 2 Bright A_Light2
    GRLF B 2 Bright A_Light1
    TNT1 A 0 ACS_ExecuteAlways(925,0, 400,0,0)
    GRLF CD 4 Bright A_Light0
    Goto LightDone
  Spawn:
    GLAP A -1
    Stop
  }
}

actor SSTGrenade : grenade replaces grenade
{
  Game Doom
  SpawnID 216
  Radius 8
  Height 8
  Speed 25
  Damage 1//20
  Projectile
  -NOGRAVITY
  +RANDOMIZE
  +DEHEXPLOSION
  -GRENADETRAIL
  //BounceType "Doom"
  Gravity 0.25
  SeeSound "weapons/grbnce"
  //SeeSound "weapons/grenlf"
  DeathSound "world/barrelx"//"weapons/grenlx"
  //BounceSound "weapons/grbnce"
  Obituary "$OB_GRENADE" // "%o caught %k's grenade."
  +CANBOUNCEWATER
  damagetype "Rocket"
  States
  {
  Spawn:
    SGRN A 1 Bright A_SpawnItemEx ("SSTGrenadeSmokeTrail", 0, 0, 0, 0, 0, 0, 0, 160) 
    Loop
  Crash:
  Death:
    MISL B 1 Bright A_Explode
	NULL A 0 A_SpawnItemEx ("PowEffectSpawner", 0, 0, 0, 0, 0, 0, 0, 160) 
    NULL A 0 A_SpawnItemEx ("rocketEcho", 0,0,0, 0,0,0, 0, 160)
    MISL B 6 Bright A_SpawnItemEx("rocketflare", 0,0,0, 0,0,0, 0, 160)
    MISL C 5 Bright
    MISL D 3 Bright
    Stop
  Detonate:
    MISL B 1 Bright A_Explode
	NULL A 0 A_SpawnItemEx ("PowEffectSpawner", 0, 0, 0, 0, 0, 0, 0, 160) 
    NULL A 0 A_SpawnItemEx ("rocketEcho", 0,0,0, 0,0,0, 0, 160)
    MISL B 6 Bright A_SpawnItemEx("rocketflare", 0,0,0, 0,0,0, 0, 160)
    MISL C 5 Bright
    MISL D 3 Bright
    Stop
  Mushroom:
    MISL B 1 Bright A_Explode
	NULL A 0 A_SpawnItemEx ("PowEffectSpawner", 0, 0, 0, 0, 0, 0, 0, 160) 
    NULL A 0 A_SpawnItemEx ("rocketEcho", 0,0,0, 0,0,0, 0, 160)
    MISL B 6 Bright A_SpawnItemEx("rocketflare", 0,0,0, 0,0,0, 0, 160)
    MISL C 5 Bright
    MISL D 3 Bright
    Stop
	/*
  Grenade:
    MISL A 1000 A_Die
    Wait
  Detonate:
    MISL B 4 A_Scream
    MISL C 6 A_Detonate
    MISL D 10
    Stop
  Mushroom:
    MISL B 8 A_Mushroom
    Goto Death+1
	*/
  }
}

ACTOR SSTGrenadeSmokeTrail
{
   Radius 1
   Height 1
   PROJECTILE
   +NOCLIP
	+FORCEXYBILLBOARD
   Scale 0.18//0.13
   Speed 0
   RENDERSTYLE ADD
   ALPHA 0.35//5
   States
   {
   Spawn:
    SMOK A 0
    SMOK A 0 Thing_ChangeTID (0, 1330) 
    TNT1 A 1
      SMOK AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQ 1 BRIGHT A_Fadeout(0.01)
      Stop
   }
}

actor SSTGrenade2 : SSTGrenade
{
  -NOTELEPORT
  -TELESTOMP
  BounceType Hexen
  BounceFactor 0.3
  BounceCount 5
  Speed 14
  Gravity 0.5
}