From 25341d14d18e88d7bc42ada22d445d49de605941 Mon Sep 17 00:00:00 2001 From: Reonu Date: Fri, 6 Aug 2021 02:20:12 +0100 Subject: [PATCH] fixed treadmills with PD2 and made it default again --- include/config.h | 4 ++-- src/game/platform_displacement.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/config.h b/include/config.h index 9e26e408c..2ca416052 100644 --- a/include/config.h +++ b/include/config.h @@ -84,8 +84,8 @@ //#define NO_FALL_DAMAGE_SOUND // Number of coins to spawn the "100 coin" star. If you remove the define altogether, then there won't be a 100 coin star at all. #define X_COIN_STAR 100 -// Platform displacement 2 also known as momentum patch. Makes Mario keep the momemtum from moving platforms. Breaks treadmills. -//#define PLATFORM_DISPLACEMENT_2 +// Platform displacement 2 also known as momentum patch. Makes Mario keep the momemtum from moving platforms. Doesn't break treadmills anymore! +#define PLATFORM_DISPLACEMENT_2 // Stars don't kick you out of the level // #define NON_STOP_STARS // Uncomment this if you want global star IDs (useful for creating an open world hack ala MVC) diff --git a/src/game/platform_displacement.c b/src/game/platform_displacement.c index e42f4829c..392f4fe01 100644 --- a/src/game/platform_displacement.c +++ b/src/game/platform_displacement.c @@ -144,6 +144,14 @@ void apply_platform_displacement(struct PlatformDisplacementInfo *displaceInfo, vec3f_sub(pos, platformPos); } + if (platformPos[0] == platform->oPosX + && platformPos[1] == platform->oPosY + && platformPos[2] == platform->oPosZ) { + pos[0] += platform->oVelX; + pos[1] += platform->oVelY; + pos[2] += platform->oVelZ; + } + // Transform from world positions to relative positions for use next frame linear_mtxf_transpose_mul_vec3f(*platform->header.gfx.throwMatrix, scaledPos, pos); scale_vec3f(displaceInfo->prevTransformedPos, scaledPos, platform->header.gfx.scale, TRUE);