
ACTOR DemonDog
{
  Game Doom
  Health 50
  PainChance 200
  Speed 10
  Radius 20
  Height 32
  Mass 75
  Meleedamage 3
  Meleerange 40
  Meleesound "dog/attack"
  Maxtargetrange 192
  Meleethreshold 96
  Monster
  +FLOORCLIP
  +FASTER
  +FASTMELEE
  SeeSound "dog/sight"
  PainSound "dog/pain"
  DeathSound "dog/death"
  ActiveSound "dog/active"
  AttackSound "dog/attack"
  Obituary "%o was mauled by a Rottweiler."
  States
  {
   Idle:
   SpawnLook:
	ROTD AABBCCDD 4 A_Wander
    ROTD A 0 A_Look
	ROTD AABBCCDD 4 A_Wander
    ROTD A 0 A_Look
	ROTD AABBCCDD 4 A_Wander
    ROTD A 0 A_Look
	ROTD AABBCCDD 4 A_Wander
    ROTD A 0 A_Look
	ROTD AABBCCDD 4 A_Wander
    ROTD A 0 A_Look
	ROTD AABBCCDD 4 A_Wander
    ROTD A 0 A_Look
	ROTD AABBCCDD 4 A_Wander
    ROTD A 0 A_Look
	ROTD AABBCCDD 4 A_Wander
    ROTD A 0 A_Look
	ROTD A 0 A_CheckSight("Remove")
    loop
  See:
 	//Randomly decide to attack your base or not
	TNT1 A 0 A_Jump(200, 2) //200/256 chance of not changing state
	TNT1 A 0 ACS_ExecuteAlways(502, 0)
	//Only check to remove ourselves and change attack modes every 6 seconds
    ROTD AABBCCDD 4 A_Chase
    ROTD AABBCCDD 4 A_Chase
    ROTD AABBCCDD 4 A_Chase
    ROTD AABBCCDD 4 A_Chase
    ROTD AABBCCDD 4 A_Chase
    ROTD AABBCCDD 4 A_Chase
	ROTD A 0 A_CheckSight("Remove")
    loop
  Missile:
    ROTD A 2 A_FaceTarget
    ROTD A 0 A_PlaySound ("dog/attack")
    ROTD A 0 ThrustThingZ (0, 24, 0, 0)
    ROTD A 0 ThrustThing (angle*256/360, 12, 0, 0)
  JumpUp:
    ROTD B 8
  JumpDown:
    ROTD C 1 A_CheckFloor ("Land")
    loop
  Land:
    ROTD D 2 A_Stop
    goto See
  Melee:
    ROTD EF 4 A_FaceTarget
    ROTD G 4 A_MeleeAttack
    ROTD FE 4 A_FaceTarget
    Goto See
  Pain:
    ROTD A 2
    ROTD A 2 A_Pain
    Goto See
  Death:
    ROTD H 4 A_Scream
    ROTD I 4 A_NoBlocking
    ROTD J 4
    ROTD K -1
    Stop
  Raise:
    ROTD KJIH 4
    Goto See
  }
}

ACTOR DoomZDemonDog : DemonDog
{
  Health 40
  
  States
  {
  Spawn:
	TNT1 A 0 //dummy frame
	TNT1 A 35 //Let the monster drop to the ground since we spawn
			  //them way above ground level so they don't get stuck
			  //in the floor.
	TNT1 A 0 A_SetTranslucent(0.0, 2)
	ROTD K 6 A_SetTranslucent(0.2, 2)
	ROTD K 6 A_SetTranslucent(0.4, 2)
	ROTD K 6 A_SetTranslucent(0.6, 2)
	ROTD K 6 A_SetTranslucent(0.8, 2)
	ROTD K 6 A_SetTranslucent(1.0, 0) //opaque
	ROTD KJIH 7 //Play death animation in reverse so it looks
	              //like it's coming out of the ground
 	//Randomly make some badguys decide to attack your base:
	TNT1 A 0 ACS_ExecuteAlways(502, 0)
  SpawnLook:
    ROTI A 10 A_LookEx(0, 0, 2000.0, 3000.0, 0, "See")
	ROTI A 5 A_CheckSight("Remove")
    Loop
  See:
    ROTD AABBCCDD 2 A_Chase
    ROTD AABBCCDD 2 A_Chase
    ROTD AABBCCDD 2 A_Chase
    ROTD AABBCCDD 2 A_Chase
    ROTD AABBCCDD 2 A_Chase
    ROTD AABBCCDD 2 A_Chase
    ROTD AABBCCDD 2 A_Chase
	ROTD A 0 A_CheckSight("SpawnLook")
    Loop
  Missile:
    ROTD A 2 A_FaceTarget
    ROTD A 0 A_PlaySound ("dog/attack")
    ROTD A 0 ThrustThingZ (0, 24, 0, 0)
    ROTD A 0 ThrustThing (angle*256/360, 14, 0, 0)
  JumpUp:
    ROTD B 8
  JumpDown:
    ROTD C 1 A_CheckFloor ("Land")
    loop
  Land:
    ROTD D 2 A_Stop
    goto See
  Melee:
    ROTD EF 4 A_FaceTarget
    ROTD G 4 A_MeleeAttack
    ROTD FE 4 A_FaceTarget
    Goto See
  Pain:
    ROTD A 2
    ROTD A 2 A_Pain
    Goto See
  Death:
	TNT1 A 0 A_GiveToTarget("DemonDogKillXP", 1)
  Death.NoXP:
  Death.SentryTurret:
    ROTD H 4 A_Scream
    ROTD I 4 A_NoBlocking
	TNT1 A 0 A_SpawnItemEx("DemonDogLoot", 0, 32, 0, 0, 0, 0, 0, 0, 0)
    ROTD J 4
    ROTD K 2100
	ROTD K 0 ACS_ExecuteAlways(501, 0)
    Stop
  Raise:
    ROTD KJIH 4
    Goto See
   Remove:
    TNT1 A 1 
    //Remove ourselves if we're too far from the player frustrum.
    TNT1 A 5 ACS_ExecuteAlways(501, 0)
	Stop
  }
}
