diff --git a/mods/character-movesets.lua b/mods/character-movesets.lua index f33cf7c8..c582e2e5 100644 --- a/mods/character-movesets.lua +++ b/mods/character-movesets.lua @@ -18,10 +18,107 @@ end gEventTable = {} + +ACT_SPIN_POUND_LAND = (0x037 | ACT_FLAG_STATIONARY | ACT_FLAG_ATTACKING) +ACT_SPIN_POUND = (0x08F | ACT_FLAG_AIR | ACT_FLAG_ATTACKING) + ----------- -- luigi -- ----------- +function act_spin_pound(m) + local e = gStateExtras[m.playerIndex] + if m.actionTimer == 0 then + m.actionState = m.actionArg + end + + local spinDirFactor = 1 -- negative for clockwise, positive for counter-clockwise + if m.actionState == 1 then spinDirFactor = -1 end + + set_mario_animation(m, MARIO_ANIM_TWIRL) + + if (m.input & INPUT_B_PRESSED) ~= 0 then + mario_set_forward_vel(m, 10.0) + m.vel.y = 35 + set_mario_action(m, ACT_DIVE, 0) + end + + local stepResult = perform_air_step(m, 0) + if stepResult == AIR_STEP_LANDED then + if should_get_stuck_in_ground(m) ~= 0 then + queue_rumble_data_mario(m, 5, 80) + play_sound(SOUND_MARIO_OOOF2, m.marioObj.header.gfx.cameraToObject) + m.particleFlags = m.particleFlags | PARTICLE_MIST_CIRCLE + set_mario_action(m, ACT_BUTT_STUCK_IN_GROUND, 0) + else + play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_HEAVY_LANDING) + if check_fall_damage(m, ACT_HARD_BACKWARD_GROUND_KB) == 0 then + m.particleFlags = m.particleFlags | PARTICLE_MIST_CIRCLE | PARTICLE_HORIZONTAL_STAR + set_mario_action(m, ACT_SPIN_POUND_LAND, 0) + end + end + set_camera_shake_from_hit(SHAKE_GROUND_POUND) + elseif stepResult == AIR_STEP_HIT_WALL then + mario_set_forward_vel(m, -16.0) + if m.vel.y > 0.0 then + m.vel.y = 0.0 + end + + m.particleFlags = m.particleFlags | PARTICLE_VERTICAL_STAR + set_mario_action(m, ACT_BACKWARD_AIR_KB, 0) + end + + -- set facing direction + -- not part of original Extended Moveset + local yawDiff = m.faceAngle.y - m.intendedYaw + e.rotAngle = e.rotAngle + yawDiff + m.faceAngle.y = m.intendedYaw + + e.rotAngle = e.rotAngle + 0x3053 + if e.rotAngle > 0x10000 then e.rotAngle = e.rotAngle - 0x10000 end + if e.rotAngle < -0x10000 then e.rotAngle = e.rotAngle + 0x10000 end + m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y + e.rotAngle * spinDirFactor + + m.actionTimer = m.actionTimer + 1 + + return 0 +end + +function act_spin_pound_land(m) + m.actionState = 1 + + if m.actionTimer <= 8 then + if (m.input & INPUT_UNKNOWN_10) ~= 0 then + return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0) + end + + if (m.input & INPUT_OFF_FLOOR) ~= 0 then + return set_mario_action(m, ACT_FREEFALL, 0) + end + + if (m.input & INPUT_ABOVE_SLIDE) ~= 0 then + return set_mario_action(m, ACT_BUTT_SLIDE, 0) + end + + stationary_ground_step(m) + set_mario_animation(m, MARIO_ANIM_LAND_FROM_DOUBLE_JUMP) + else + if (m.input & INPUT_UNKNOWN_10) ~= 0 then + return set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0) + end + + if (m.input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE)) ~= 0 then + return check_common_action_exits(m) + end + + stopping_step(m, MARIO_ANIM_LAND_FROM_DOUBLE_JUMP, ACT_IDLE) + end + + m.actionTimer = m.actionTimer + 1 + + return 0 +end + function luigi_before_phys_step(m) local e = gStateExtras[m.playerIndex] @@ -44,7 +141,11 @@ function luigi_before_phys_step(m) hScale = hScale * 0.9 end end - m.forwardVel = m.forwardVel * 0.99 + + -- slower ground movement + if (m.action & ACT_FLAG_MOVING) ~= 0 then + hScale = hScale * 0.99 + end m.vel.x = m.vel.x * hScale m.vel.y = m.vel.y * vScale @@ -81,8 +182,12 @@ function luigi_update(m) -- air scuttle e.scuttle = 0 - if m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP then - if (m.controller.buttonDown & A_BUTTON) ~= 0 and m.vel.y < -5 then + local shouldScuttle = (m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP) and ((m.controller.buttonDown & A_BUTTON) ~= 0 and m.vel.y < -5) + if shouldScuttle then + -- prevent wing flutter from glitching out while scuttling + if (m.flags & MARIO_WING_CAP) ~= 0 then + m.vel.y = m.vel.y + 1 + else m.vel.y = m.vel.y + 3 set_mario_animation(m, MARIO_ANIM_RUNNING_UNUSED) set_anim_to_frame(m, e.animFrame) @@ -94,6 +199,11 @@ function luigi_update(m) end end + -- twirl pound + if m.action == ACT_TWIRLING and (m.input & INPUT_Z_PRESSED) ~= 0 then + set_mario_action(m, ACT_SPIN_POUND, 0) + end + -- backflip turns into twirl if m.action == ACT_BACKFLIP and m.marioObj.header.gfx.animInfo.animFrame > 18 then m.angleVel.y = 0x1800 @@ -152,8 +262,20 @@ function toad_on_set_action(m) end -- less height on jumps - if m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP or m.action == ACT_TRIPLE_JUMP or m.action == ACT_SPECIAL_TRIPLE_JUMP or m.action == ACT_STEEP_JUMP or m.action == ACT_SIDE_FLIP or m.action == ACT_RIDING_SHELL_JUMP or m.action == ACT_BACKFLIP or m.action == ACT_WALL_KICK_AIR or m.action == ACT_LONG_JUMP then + if m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP or m.action == ACT_TRIPLE_JUMP or m.action == ACT_SPECIAL_TRIPLE_JUMP or m.action == ACT_STEEP_JUMP or m.action == ACT_RIDING_SHELL_JUMP or m.action == ACT_BACKFLIP or m.action == ACT_WALL_KICK_AIR or m.action == ACT_LONG_JUMP then m.vel.y = m.vel.y * 0.8 + + -- prevent from getting stuck on platform + if m.marioObj.platform ~= nil then + m.pos.y = m.pos.y + 10 + end + elseif m.action == ACT_SIDE_FLIP then + m.vel.y = m.vel.y * 0.86 + + -- prevent from getting stuck on platform + if m.marioObj.platform ~= nil then + m.pos.y = m.pos.y + 10 + end end e.lastAction = action @@ -357,3 +479,5 @@ hook_event(HOOK_ON_SET_MARIO_ACTION, mario_on_set_action) hook_event(HOOK_BEFORE_PHYS_STEP, mario_before_phys_step) hook_mario_action(ACT_WALL_SLIDE, act_wall_slide) +hook_mario_action(ACT_SPIN_POUND, act_spin_pound) +hook_mario_action(ACT_SPIN_POUND_LAND, act_spin_pound_land)