From 945d1efe91f37ef0c8f6ee82f53a574a42bb1a44 Mon Sep 17 00:00:00 2001 From: Sunk <69110309+Sunketchupm@users.noreply.github.com> Date: Mon, 11 Nov 2024 00:12:25 -0500 Subject: [PATCH] Move camera down if ceiling hanging with romhack camera (#407) --- src/game/camera.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/game/camera.c b/src/game/camera.c index 95bf0e4e..bf86209e 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -12337,6 +12337,22 @@ void mode_rom_hack_camera(struct Camera *c) { pos[1] = mPos[1] + desiredHeight; pos[2] = mPos[2] + sins(sRomHackYaw) * desiredDist; + // Move camera down for hangable ceilings + if (sMarioCamState->action & ACT_FLAG_HANGING) { + f32 marioCeilHeight = sMarioGeometry.currCeilHeight; + f32 marioFloorHeight = sMarioGeometry.currFloorHeight; + + if (marioFloorHeight < marioCeilHeight - 400.f) { + marioFloorHeight = marioCeilHeight - 400.f; + } + + f32 goalHeight = marioFloorHeight + (marioCeilHeight - marioFloorHeight) * 0.4f; + + if (pos[1] - 400 > goalHeight) { + pos[1] -= 400; + } + } + if (rom_hack_cam_can_see_mario(pos)) { // we can see mario, no need to adjust c->pos[0] = pos[0];