//Player definitions

actor msx_player : DoomPlayer
{
  Species "Player"

  mass 700
  gravity 0.75
  
  health 200
  Player.MaxHealth 200
  
  Player.ForwardMove 1.9, 0.95
  Player.SideMove 1.9, 0.95
  Player.ViewHeight 43
  Player.AttackZOffset 10
  Player.JumpZ 0
  //Player.FallingScreamSpeed 25.0, 50.0
  
  //Player.CrouchSprite "PLYC"
  
  Player.StartItem "shield_state", 1
  
  Player.StartItem "GolamPistol"
  Player.StartItem "RegularFists"
  Player.StartItem "Grenade_Toss"
  Player.StartItem "pistol_ammo", 36
  Player.StartItem "golamclip", 9
  Player.StartItem "fullshield"
  Player.StartItem "Action_Reload"
  Player.StartItem "Action_ReloadCancel"
  Player.StartItem "Action_Nade"
  Player.StartItem "Action_NadeCancel"
  Player.StartItem "Action_Melee"
  Player.StartItem "Action_MeleeCancel"
  Player.StartItem "Action_AltFunc"
  Player.StartItem "Action_AltFuncCancel"
  Player.StartItem "Action_Cooldown"
  Player.StartItem "Action_CooldownCancel"
  Player.StartItem "ArmorRechargeSound"
  Player.StartItem "ARechargeSound_Cancel"
  Player.StartItem "hydraclip", 16
  Player.StartItem "raptorchamber", 4
  Player.StartItem "barraclip", 60
  Player.StartItem "cannonmag", 30
  Player.StartItem "criflecell", 80
  Player.StartItem "sgaussmag", 5 
  Player.StartItem "grenades", 3
  Player.StartItem "PlayerStamina", 100
  player.maxhealth 100
  Player.DamageScreenColor "00 00 00"//, 0.0
  damagefactor "frag_explosion", 0.3
  damagefactor "concussion_blast", 0.6
  damagefactor "MeleeAttack", 0.0
  +NOBLOOD
  +SLIDESONWALLS
  
  //var int user_rdmH;
  //var int user_rdmV;
  
  states{
  /*
		spawn: 
			TNT1 A 0
			TNT1 A 0 
			TNT1 A 0 //ACS_NamedExecute("pmsx_Player-Respawn",0,0,0,0)
			PLAY A -1
			loop
		see:	
			PLAY ABCD 3 
			loop
	*/
  Spawn:
    PLAY A -1
    Loop
  See:
    PLAY ABCD 4 
    Loop
  Missile:
    PLAY E 12 
    Goto Spawn
  Melee:
    PLAY F 6 BRIGHT
    Goto Missile

		shield_on:
			TNT1 A 0	
			TNT1 A 0 A_ChangeFlag(NOBLOOD, 1)
			goto see
		
		shield_off:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag(NOBLOOD, 0)
			goto see
			
		pain:
			TNT1 A 0 
			TNT1 A 0 A_Pain
			TNT1 A 0 ACS_ExecuteAlways(pmsx_PlayerPainFlash,0,0,0,0)
			TNT1 A 1 ACS_ExecuteAlways(Weapon_Recoil,0,-20,0,0)//A_SetPitch(-1)
			TNT1 A 1 ACS_ExecuteAlways(Weapon_Recoil,0,20,0,0)//A_Setpitch(1)
			goto see
		
		
		pain.StrongMelee:
			TNT1 A 0 
			TNT1 A 0 A_Pain
			TNT1 A 0 ACS_ExecuteAlways(pmsx_PlayerPainFlash,0,1,0,0)
			TNT1 A 1  ACS_ExecuteAlways(Weapon_Recoil,0,-60,0,0)
			TNT1 A 1  ACS_ExecuteAlways(Weapon_Recoil,0,60,0,0)
			goto see
		pain.LightMelee:
			TNT1 A 0 
			TNT1 A 0 A_Pain
			TNT1 A 0 ACS_ExecuteAlways(pmsx_PlayerPainFlash,0,2,0,0)
			TNT1 A 1  ACS_ExecuteAlways(Weapon_Recoil,0,-40,0,0)//A_SetPitch(-1)
			TNT1 A 1  ACS_ExecuteAlways(Weapon_Recoil,0,40,0,0)//A_Setpitch(1)
			goto see
			
		Death:
			TNT1 A 0 A_TakeInventory("IsXDeath", 1)
			Goto GenericDeath//DropItems
		XDeath:
			TNT1 A 0 A_GiveInventory("IsXDeath", 1)
			Goto GenericDeath//DropItems
			
		DropItems:
			Goto Drop_HealthStims
		Drop_HealthStims:
			TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(healthstim_count) == 0, "GenericDeath")
			TNT1 A 0 A_TakeInventory("healthstim", 1)
			TNT1 A 0 //A_SpawnItem("healthstim")
			TNT1 A 1
			Loop
			
		/*
		Drop_ShieldBoosters:
			TNT1 A 0 A_JumpIfInventory("shieldbooster", 1, 1)
			Goto GenericDeath
			TNT1 A 0 A_TakeInventory("shieldbooster", 1)
			TNT1 A 0 A_SpawnItem("shieldbooster")
			Loop
		*/
			
		GenericDeath:
			TNT1 A 0 A_JumpIfInventory("IsXDeath", 1, "Actual_XDeath")
			PLAY H 10 //ACS_NamedExecute("pmsx_Player-Death",0,0,0,0)
			PLAY I 10 A_PlayerScream
			PLAY J 10 A_NoBlocking
			PLAY KLM 10
			PLAY N -1
			Stop
		Actual_XDeath:
			PLAY O 7 //ACS_NamedExecute("pmsx_Player-Death",0,0,0,0)
			PLAY P 7 A_XScream
			PLAY Q 7 A_NoBlocking
			PLAY RSTUV 7
			PLAY W -1
			Stop  		
  } 
}

Actor IsXDeath : Inventory 
{
	Inventory.MaxAmount 1
}


actor PlayerShieldDamage : Inventory {
	Inventory.Amount 1
	Inventory.MaxAmount 350	
}


actor PlayerStamina : Inventory {
	Inventory.Amount 1
	Inventory.MaxAmount 100
}


actor ArmorRechargeSound : CustomInventory {
	Inventory.Amount 1
   	Inventory.MaxAmount 1
    -INVBAR
	states {
		Use:
			TNT1 A 0
			TNT1 A 0 A_PlaySound("sfx/shieldrecharge", 5)
			fail
	}
}

actor ARechargeSound_Cancel : CustomInventory {
	Inventory.Amount 1
   	Inventory.MaxAmount 1
    -INVBAR
	states {
		Use:
			TNT1 A 0
			TNT1 A 0 A_StopSound(5)
			stop
	}
}

actor SuitPowerDefense : PowerupGiver {
	inventory.maxamount 0
	//powerup.color "255 132 0"
	powerup.color "0 0 0",0.0
	powerup.type SuitPowDefense
	powerup.duration 0x7FFFFFFF
	+AUTOACTIVATE
	states {
		spawn:
			TNT1 AA 0
			stop
	}

}

actor PowerSuitPowDefense : PowerProtection
{
	damagefactor "normal", 0.5
	//inventory.icon "MEGAA0" 
}