You've already forked HackerSM64
mirror of
https://github.com/HackerN64/HackerSM64.git
synced 2026-01-21 10:35:32 -08:00
Add functional changes to inertia to support only specific directions specified in the config (#671)
* Add functional changes to inertia to support only specific directions specified in the config (needs cleanup) * Reduce number of inertia defines * Update Platform Displacement 2 define description * comment adjustments
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user