diff --git a/include/config/config_movement.h b/include/config/config_movement.h index ae4e36cfb..882ae3b97 100644 --- a/include/config/config_movement.h +++ b/include/config/config_movement.h @@ -73,11 +73,6 @@ */ // #define PREVENT_CAP_LOSS -/** - * Enables Platform Displacement 2, also known as momentum patch. Makes Mario keep the momemtum from moving platforms. - */ -#define PLATFORM_DISPLACEMENT_2 - /** * Uses Shindou's pole behavior. */ @@ -136,3 +131,14 @@ */ // #define BUGFIX_DIALOG_TIME_STOP +/** + * Enables Platform Displacement 2, an upgrade to the physics involving moving platforms and how Mario interacts with them. + */ +#define PLATFORM_DISPLACEMENT_2 + +/** + * Inertia defines; allow Mario to preserve his momemtum when leaving moving platforms. + * These require Platform Displacement 2 to be enabled. + */ +#define MARIO_INERTIA_UPWARD +// #define MARIO_INERTIA_LATERAL diff --git a/src/game/platform_displacement.c b/src/game/platform_displacement.c index 4b43f7290..ae5053431 100644 --- a/src/game/platform_displacement.c +++ b/src/game/platform_displacement.c @@ -179,11 +179,16 @@ static u8 sInertiaFirstFrame = FALSE; * Apply inertia based on Mario's last platform. */ static void apply_mario_inertia(void) { +#ifdef MARIO_INERTIA_UPWARD // On the first frame of leaving the ground, boost Mario's y velocity if (sInertiaFirstFrame) { - gMarioState->vel[1] += sMarioAmountDisplaced[1]; + if (sMarioAmountDisplaced[1] > 0.0f) { + gMarioState->vel[1] += sMarioAmountDisplaced[1]; + } } +#endif +#ifdef MARIO_INERTIA_LATERAL // Apply sideways inertia gMarioState->pos[0] += sMarioAmountDisplaced[0]; gMarioState->pos[2] += sMarioAmountDisplaced[2]; @@ -191,6 +196,7 @@ static void apply_mario_inertia(void) { // Drag sMarioAmountDisplaced[0] *= 0.97f; sMarioAmountDisplaced[2] *= 0.97f; +#endif // Stop applying inertia once Mario has landed, or when ground pounding if (!(gMarioState->action & ACT_FLAG_AIR) || (gMarioState->action == ACT_GROUND_POUND)) {