//Freeslots
freeslot("S_PLAY_VMLEAP", "S_PLAY_VMHAMMERSTOMP", "S_PLAY_VMHAMMERJUMP")
states[S_PLAY_VMLEAP] = {
	sprite = SPR_PLAY,
	frame = SPR2_RUN_,
	tics = -1,
	nextstate = S_PLAY_VMLEAP
}
states[S_PLAY_VMHAMMERSTOMP] = {
	sprite = SPR_PLAY,
	frame = SPR2_BNCE|FF_ANIMATE,
	var1 = 8,
	var2 = 1,
	tics = -1,
	nextstate = S_PLAY_VMHAMMERSTOMP
}
states[S_PLAY_VMHAMMERJUMP] = {
	sprite = SPR_PLAY,
	frame = SPR2_ROLL|FF_ANIMATE,
	var1 = 4,
	var2 = 1,
	tics = 16,
	nextstate = S_PLAY_SPRING
}

//Hammer Jump
addHook ("PlayerThink",function(player)
if player.mo.skin == "vmamy"
and not player.exiting
and P_IsObjectOnGround(player.mo)
and not (P_PlayerInPain(player) or (player.playerstate == PST_DEAD))
and player.speed >= 30*FRACUNIT
and player.mo.state == S_PLAY_MELEE_LANDING

player.mo.state = S_PLAY_VMHAMMERJUMP
P_SetObjectMomZ(player.mo, 20*FRACUNIT, false)
end
end)

//Leap
addHook ("PlayerThink",function(player)
if player.mo.skin == "vmamy"
and not player.exiting
and P_IsObjectOnGround(player.mo)
and not (P_PlayerInPain(player) or (player.playerstate == PST_DEAD))
and player.mo.state != S_PLAY_VMLEAP
and player.mo.state != S_PLAY_MELEE
and player.mo.state != S_PLAY_MELEE_FINISH
and player.cmd.buttons & BT_CUSTOM1
and not player.vmamyc1

player.mo.state = S_PLAY_VMLEAP
player.cmd.forwardmove = 60
P_Thrust(player.mo,player.mo.angle,20*FRACUNIT)
P_SetObjectMomZ(player.mo,4*FRACUNIT,false)
S_StartSound(player.mo,sfx_jump)
end
end)

addHook ("PlayerThink",function(player)
if player.mo.skin == "vmamy"
and player.mo.state == S_PLAY_VMLEAP

player.mo.frame = A
end
end)

//Hammer Whirl
addHook ("PlayerThink",function(player)
if player.mo.skin == "vmamy"
and not P_IsObjectOnGround(player.mo)
and not player.vmwhirl
and player.cmd.buttons & BT_CUSTOM1
and not (P_PlayerInPain(player) or (player.playerstate == PST_DEAD))
and not player.vmamyc1

S_StartSound(player.mo, sfx_zoom)
P_SetObjectMomZ(player.mo,-30*FRACUNIT,true)
P_InstaThrust(player.mo, 0, 0)
player.pflags = $|PF_JUMPED
player.pflags = $|PF_THOKKED
player.pflags = $|PF_NOJUMPDAMAGE
player.vmwhirl = true
player.mo.state = S_PLAY_VMHAMMERSTOMP
end
end)

addHook ("PlayerThink",function(player)
if player.mo.skin == "vmamy"
and player.vmwhirl
and (P_IsObjectOnGround(player.mo) or (player.mo.eflags & MFE_GOOWATER) or (player.mo.eflags & MFE_SPRUNG))

player.vmwhirl = false
end
end)

local function hammerwhirlghosts(p)
	if p.mo.skin == "vmamy"
	and p.vmwhirl
		local thokghost = P_SpawnGhostMobj(p.mo)
		thokghost.colorized = true
		thokghost.fuse = 5
		thokghost.color = p.mo.color
		thokghost.blendmode = AST_ADD
	end
end

addHook ("PlayerThink",function(player)
if player.mo.skin == "vmamy"
and player.vmwhirl

hammerwhirlghosts(player)
player.powers[pw_strong] = $|STR_ANIM|STR_SPRING|STR_STOMP|STR_FLOOR
end
end)

addHook ("PlayerThink",function(player)
if player.mo.skin == "vmamy"
and player.cmd.buttons & BT_CUSTOM1

player.vmamyc1 = true
else
player.vmamyc1 = false
end
end)