From c101a6f6bebe1377db23f0c3179e4f42ba62a522 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Fri, 5 Jul 2024 18:57:45 -0400 Subject: [PATCH] Minor improvements to first person camera --- src/game/first_person_cam.c | 3 ++- src/game/rendering_graph_node.c | 2 +- src/pc/controller/controller_sdl2.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/game/first_person_cam.c b/src/game/first_person_cam.c index 13f10a4c..07fb90da 100644 --- a/src/game/first_person_cam.c +++ b/src/game/first_person_cam.c @@ -37,10 +37,11 @@ bool first_person_check_cancels(struct MarioState *m) { if (m->action == ACT_FIRST_PERSON || m->action == ACT_IN_CANNON || m->action == ACT_READING_NPC_DIALOG || m->action == ACT_DISAPPEARED || m->action == ACT_FLYING) { return true; } + if (find_object_with_behavior(smlua_override_behavior(bhvActSelector)) != NULL) { return true; } if (gLuaLoadingMod != NULL) { return false; } - struct Object *bowser = find_object_with_behavior(bhvBowser); + struct Object *bowser = find_object_with_behavior(smlua_override_behavior(bhvBowser)); if ((gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2 || gCurrLevelNum == LEVEL_BOWSER_3) && bowser != NULL && (bowser->oAction == 5 || bowser->oAction == 6)) { diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c index f29ba326..400cf31b 100644 --- a/src/game/rendering_graph_node.c +++ b/src/game/rendering_graph_node.c @@ -1156,7 +1156,7 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) { // visibly pop in or out at the edge of the screen. // // Half of the fov in in-game angle units instead of degrees. - s16 halfFov = (not_zero(gCurGraphNodeCamFrustum->fov, gOverrideFOV) / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f; + s16 halfFov = (get_first_person_enabled() ? gFirstPersonCamera.fov : not_zero(gCurGraphNodeCamFrustum->fov, gOverrideFOV) / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f; f32 divisor = coss(halfFov); if (divisor == 0) { divisor = 1; } diff --git a/src/pc/controller/controller_sdl2.c b/src/pc/controller/controller_sdl2.c index 70145dda..4d3b458d 100644 --- a/src/pc/controller/controller_sdl2.c +++ b/src/pc/controller/controller_sdl2.c @@ -170,7 +170,7 @@ extern s16 gMenuMode; static void controller_sdl_read(OSContPad *pad) { if (!init_ok) { return; } - if ((newcam_mouse == 1 || gFirstPersonCamera.enabled || gDjuiHudLockMouse) && gMenuMode == -1 && !gDjuiInMainMenu && !gDjuiChatBoxFocus && !gDjuiConsoleFocus && WAPI.has_focus()) { + if ((newcam_mouse == 1 || get_first_person_enabled() || gDjuiHudLockMouse) && gMenuMode == -1 && !gDjuiInMainMenu && !gDjuiChatBoxFocus && !gDjuiConsoleFocus && WAPI.has_focus()) { controller_mouse_enter_relative(); } else { controller_mouse_leave_relative();