diff --git a/mp2/compute_move.cc b/mp2/compute_move.cc index 3c2a9ed..9219ac1 100644 --- a/mp2/compute_move.cc +++ b/mp2/compute_move.cc @@ -48,6 +48,10 @@ float gravboost_force = 13000.f; float crouch_height = 1.5f; // Speed damping for crouching samus float crouch_max_speed_damp = 0.5f; +// Impulse to apply for each side dash +float side_dash_impulse = 10.f; +// Amount to reduce the height of the side dash by +float side_dash_jump_height_reduction = 0.5f; char debug_output[2048]; } @@ -329,7 +333,17 @@ void hooked_computemovement(CPlayer* player, CFinalInput* input, CStateManager& num_jumps == 2 && water_depth < 1.25f; const bool gravboost_jump = jump_this_tick && has_gravboost && num_jumps == 2; if (first_jump || second_jump) { - vel.z = jump_impulse * jump_restraint_table[static_cast(restraint)]; + float side_input = + get_analog_input(player->get_input_mask(), ECommands::TurnOrLookRight, input) - + get_analog_input(player->get_input_mask(), ECommands::TurnOrLookLeft, input); + if (player->get_orbit_state() != EPlayerOrbitState::NoOrbit && fabs(side_input) > 0.05) { + vec3 rt = player->get_transform().right() * side_input * side_dash_impulse; + vel += rt; + vel.z = jump_impulse * jump_restraint_table[static_cast(restraint)] * + side_dash_jump_height_reduction; + } else { + vel.z = jump_impulse * jump_restraint_table[static_cast(restraint)]; + } vel += half_grav; player->set_move_state(EPlayerMovementState::Jump, mgr); player->set_velocity_wr(vel); diff --git a/mp2/mpsdk/player.hh b/mp2/mpsdk/player.hh index 33881ce..3747c6d 100644 --- a/mp2/mpsdk/player.hh +++ b/mp2/mpsdk/player.hh @@ -12,6 +12,15 @@ enum class EPlayerMorphBallState { Unmorphed, Morphed, Morphing, Unmorphing }; // There's more of em, though for the most part they don't matter enum class ESurfaceRestraints { Normal, Air, Unk0, Unk1, Unk2, Water, DarkWater, TheWeeds }; +enum class EPlayerOrbitState { + NoOrbit, + OrbitObject, + OrbitPoint, + OrbitCarcass, + ForcedOrbitObject, // For CMetroidBeta attack + Grapple +}; + class CPlayer : public CPhysicsActor { public: EPlayerMovementState movement_state; // 2d0 @@ -41,11 +50,13 @@ public: aabox fp_bounds; // 36c uint8_t cplayer_unk4[0x8]; // 384 EPlayerMorphBallState morphball_state; // 38c - uint8_t cplayer_unk5[0xeb8]; // 390 + uint8_t cplayer_unk5[0x14]; // 390 + EPlayerOrbitState orbit_state; // 3a4 + uint8_t cplayer_unk6[0xea0]; // 3a8 float water_depth; // 1248 - uint8_t cplayer_unk6[0xc8]; // 124c + uint8_t cplayer_unk7[0xc8]; // 124c CPlayerState* player_state; // 1314 - uint8_t cplayer_unk7[0xb8]; // 1318 + uint8_t cplayer_unk8[0xb8]; // 1318 rstl::reserved_vector player_input_mask; // 13d0 public: @@ -57,6 +68,7 @@ public: void set_fpbounds_z(float z) { fp_bounds.maxes.z = z; } float get_fpbounds_z() { return fp_bounds.maxes.z; } void* get_collision_prim() { return &collision_primitive; } + EPlayerOrbitState get_orbit_state() { return orbit_state; } CPlayerState const* get_player_state() const { return player_state; } CPlayerState* get_player_state() { return player_state; } float get_water_depth() const { return water_depth; } diff --git a/mp2/source_movement_mp2.mmd b/mp2/source_movement_mp2.mmd index bf1ee35..6280046 100644 --- a/mp2/source_movement_mp2.mmd +++ b/mp2/source_movement_mp2.mmd @@ -25,6 +25,8 @@ rocket_jump_speed_falloff_max f32 rocket_jump_speed_falloff_min f32 rocket_jump_max_damage f32 + side_dash_impulse f32 + side_dash_jump_height_reduction f32 hooked_energyprojectile_think 803b2fe0 hooked_computemovement 801883ec _callgate_table _mod_dispatch_table _callgate_dispatch _trampoline_restore_table