summaryrefslogtreecommitdiff
path: root/mm/src/code
diff options
context:
space:
mode:
authorGarrett Cox <garrettjcox@gmail.com>2025-02-06 13:55:06 -0600
committerGarrett Cox <garrettjcox@gmail.com>2025-02-06 13:55:06 -0600
commitcf71dfe5b5cae9065f986a3a130a18af19898e69 (patch)
tree982056b43f79f71aa7890f638e6e01baf17228ba /mm/src/code
parent0ee2080c61c1a521c41bcf5f3f16ab56fb0fef82 (diff)
parent856aa2612b61c800675e9b1f6249dfe60fba0e52 (diff)
Merge branch 'develop' of garrettjoecox.github.com:HarbourMasters/2ship2harkinian into develop-rando
Diffstat (limited to 'mm/src/code')
-rw-r--r--mm/src/code/z_camera.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mm/src/code/z_camera.c b/mm/src/code/z_camera.c
index 238e0afd1..fab7a7f10 100644
--- a/mm/src/code/z_camera.c
+++ b/mm/src/code/z_camera.c
@@ -50,6 +50,10 @@
#include "z64view.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
+#include "2s2h/BenPort.h"
+#include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h"
+#include "2s2h/GameInteractor/GameInteractor.h"
+
void func_800DDFE0(Camera* camera);
s32 Camera_ChangeMode(Camera* camera, s16 mode);
s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags);
@@ -62,8 +66,6 @@ SwingAnimation D_801EDC30[4];
Vec3f D_801EDDD0;
Vec3f D_801EDDE0;
Vec3f D_801EDDF0;
-#include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h"
-#include "2s2h/GameInteractor/GameInteractor.h"
// Camera will reload its paramData. Usually that means setting the read-only data from what is stored in
// CameraModeValue arrays. Although sometimes some read-write data is reset as well
@@ -565,6 +567,13 @@ s32 func_800CBC84(Camera* camera, Vec3f* from, CameraCollision* to, s32 arg3) {
toNewPos.y += 5.0f;
if ((arg3 != 0) && func_800CB7CC(camera)) {
+ // 2S2H [Port] Remote hookshot hookslide in Great Bay Temple can lead to a crash when the player is over a
+ // void due to the floor poly for the player being NULL.
+ // We check for NULL and handle the crash appropriately, with safe fallback using a goto into the else path.
+ if (camera->focalActor->floorPoly == NULL) {
+ Ship_HandleConsoleCrashAsReset();
+ goto SkipFocalActorFloorPoly;
+ }
to->poly = camera->focalActor->floorPoly;
floorBgId = camera->focalActor->floorBgId;
to->norm.x = COLPOLY_GET_NORMAL(to->poly->normal.x);
@@ -579,6 +588,7 @@ s32 func_800CBC84(Camera* camera, Vec3f* from, CameraCollision* to, s32 arg3) {
floorPolyY = to->pos.y;
}
} else {
+ SkipFocalActorFloorPoly: // 2S2H [Port] Safe crash handling
floorPolyY = BgCheck_CameraRaycastFloor2(colCtx, floorPoly, &floorBgId, &toNewPos);
}