From 78e1a05aef41d1ba264e14d4fb520fd3e0a52f37 Mon Sep 17 00:00:00 2001 From: Irastris Date: Sun, 24 May 2026 14:31:04 -0400 Subject: [PATCH] Various mirror mode fixes (#1725) * Fix mirror mode stage map scrolling * Fix Link's arrow rotation on fullscreen map * Fix fishing in mirror mode * Fix cucco controls in mirror mode * Only stick_x is necessary --------- Co-authored-by: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Co-authored-by: Luke Street --- src/d/actor/d_a_mg_rod.cpp | 43 +++++++++++++++++++++++++++++++------ src/d/actor/d_a_ni.cpp | 5 +++++ src/d/d_menu_fmap2D.cpp | 5 +++++ src/d/d_menu_map_common.cpp | 13 +++++++++++ 4 files changed, 59 insertions(+), 7 deletions(-) diff --git a/src/d/actor/d_a_mg_rod.cpp b/src/d/actor/d_a_mg_rod.cpp index 956a9e3cff..3471cd342a 100644 --- a/src/d/actor/d_a_mg_rod.cpp +++ b/src/d/actor/d_a_mg_rod.cpp @@ -25,7 +25,10 @@ #include #include +#if TARGET_PC +#include "dusk/settings.h" #include "dusk/version.hpp" +#endif class dmg_rod_HIO_c : public JORReflexible { public: @@ -1137,8 +1140,14 @@ static int lure_standby(dmg_rod_class* i_this) { dComIfGp_setDoStatusForce(42, 0); } - i_this->rod_stick_x = mDoCPd_c::getStickX3D(PAD_1) * mDoCPd_c::getStickX3D(PAD_1); - if (mDoCPd_c::getStickX3D(PAD_1) < 0.0f) { + f32 stick_x = mDoCPd_c::getStickX3D(PAD_1); +#if TARGET_PC + if (dusk::getSettings().game.enableMirrorMode) { + stick_x = -stick_x; + } +#endif + i_this->rod_stick_x = stick_x * stick_x; + if (stick_x < 0.0f) { i_this->rod_stick_x *= -1.0f; } @@ -3671,7 +3680,13 @@ static void uki_standby(dmg_rod_class* i_this) { cLib_addCalc2(&i_this->field_0x150c, substickX, 0.5f, 0.2f); if (i_this->field_0x1508 > 0.3f && i_this->play_cam_mode < 5) { - ANGLE_ADD(i_this->field_0x1418, (-500.0f + VREG_F(3)) * mDoCPd_c::getStickX3D(PAD_1)); + f32 stick_x = mDoCPd_c::getStickX3D(PAD_1); +#if TARGET_PC + if (dusk::getSettings().game.enableMirrorMode) { + stick_x = -stick_x; + } +#endif + ANGLE_ADD(i_this->field_0x1418, (-500.0f + VREG_F(3)) * stick_x); } cMtx_YrotS(*calc_mtx, i_this->field_0x1418); @@ -5043,8 +5058,15 @@ static void play_camera(dmg_rod_class* i_this) { static f32 old_stick_x = 0.0f; static f32 old_stick_sx = 0.0f; + f32 stick_x = mDoCPd_c::getStickX3D(PAD_1); +#if TARGET_PC + if (dusk::getSettings().game.enableMirrorMode) { + stick_x = -stick_x; + } +#endif + if ( - (mDoCPd_c::getStickX3D(PAD_1) >= 0.8f && old_stick_x < 0.8f) || (mDoCPd_c::getStickX3D(PAD_1) <= -0.8f && old_stick_x > -0.8f) + (stick_x >= 0.8f && old_stick_x < 0.8f) || (stick_x <= -0.8f && old_stick_x > -0.8f) #if VERSION != VERSION_SHIELD_DEBUG || (mDoCPd_c::getSubStickX3D(PAD_1) >= 0.8f && old_stick_sx < 0.8f) || (mDoCPd_c::getSubStickX3D(PAD_1) <= -0.8f && old_stick_sx > -0.8f) #endif @@ -5060,7 +5082,7 @@ static void play_camera(dmg_rod_class* i_this) { } if (i_this->play_cam_timer >= 15) { - if (mDoCPd_c::getStickX3D(PAD_1) >= 0.5f + if (stick_x >= 0.5f #if VERSION != VERSION_SHIELD_DEBUG || mDoCPd_c::getSubStickX3D(PAD_1) >= 0.5f #endif @@ -5082,8 +5104,8 @@ static void play_camera(dmg_rod_class* i_this) { } } - old_stick_x = mDoCPd_c::getStickX3D(PAD_1); - old_stick_sx = mDoCPd_c::getSubStickX(PAD_1); + old_stick_x = stick_x; + old_stick_sx = mDoCPd_c::getSubStickX3D(PAD_1); if (i_this->play_cam_timer == 1) { if (i_this->field_0xf81 == 0) { @@ -5788,7 +5810,14 @@ static int dmg_rod_Execute(dmg_rod_class* i_this) { i_this->rod_stick_x = mDoCPd_c::getStickX3D(PAD_1); i_this->rod_stick_y = mDoCPd_c::getStickY(PAD_1); +#if TARGET_PC + if (dusk::getSettings().game.enableMirrorMode) { + i_this->rod_stick_x = -i_this->rod_stick_x; + } + i_this->rod_substick_x = mDoCPd_c::getSubStickX3D(PAD_1); +#else i_this->rod_substick_x = mDoCPd_c::getSubStickX(PAD_1); +#endif i_this->prev_rod_substick_y = i_this->rod_substick_y; i_this->rod_substick_y = mDoCPd_c::getSubStickY(PAD_1); diff --git a/src/d/actor/d_a_ni.cpp b/src/d/actor/d_a_ni.cpp index 8d97925078..b569b28e04 100644 --- a/src/d/actor/d_a_ni.cpp +++ b/src/d/actor/d_a_ni.cpp @@ -943,6 +943,11 @@ static int ni_play(ni_class* i_this) { s16 var_r28 = 0x4000; i_this->mPadMainStickX = mDoCPd_c::getStickX3D(PAD_1); +#if TARGET_PC + if (dusk::getSettings().game.enableMirrorMode) { + i_this->mPadMainStickX = -i_this->mPadMainStickX; + } +#endif i_this->mPadMainStickY = mDoCPd_c::getStickY(PAD_1); i_this->mPadSubStickY = mDoCPd_c::getSubStickY(PAD_1); i_this->mPadSubStickX = mDoCPd_c::getSubStickX(PAD_1); diff --git a/src/d/d_menu_fmap2D.cpp b/src/d/d_menu_fmap2D.cpp index 0d3114172e..cbfffc3fc2 100644 --- a/src/d/d_menu_fmap2D.cpp +++ b/src/d/d_menu_fmap2D.cpp @@ -1973,6 +1973,11 @@ void dMenu_Fmap2DBack_c::stageMapMove(STControl* i_stick, u8 param_1, bool param if (stick_value >= slow_bound && param_2 && field_0x1238 != 2) { bVar6 = true; s16 angle = i_stick->getAngleStick(); +#if TARGET_PC + if (dusk::getSettings().game.enableMirrorMode) { + angle = -angle; + } +#endif f32 local_68 = mTexMaxX - mTexMinX; f32 spot_zoom = getSpotMapZoomRate(); f32 region_zoom = getRegionMapZoomRate(mRegionCursor); diff --git a/src/d/d_menu_map_common.cpp b/src/d/d_menu_map_common.cpp index 4168673704..5ae820931a 100644 --- a/src/d/d_menu_map_common.cpp +++ b/src/d/d_menu_map_common.cpp @@ -394,8 +394,21 @@ void dMenuMapCommon_c::drawIcon(f32 i_posX, f32 i_posY, f32 param_3, f32 param_4 icon_size_y *= _c7c; } +#if TARGET_PC + f32 rotation = mIconInfo[info_idx].rotation; + if (dusk::getSettings().game.enableMirrorMode && + (mIconInfo[info_idx].icon_no == ICON_LINK_e || + mIconInfo[info_idx].icon_no == ICON_LINK_ENTER_e)) + { + rotation = -rotation; + } + + mPictures[mIconInfo[info_idx].icon_no]->rotate(icon_size_x / 2, icon_size_y / 2, ROTATE_Z, + rotation); +#else mPictures[mIconInfo[info_idx].icon_no]->rotate(icon_size_x / 2, icon_size_y / 2, ROTATE_Z, mIconInfo[info_idx].rotation); +#endif if (mIconInfo[info_idx].icon_no == ICON_LIGHT_DROP_e) { mPictures[mIconInfo[info_idx].icon_no]->setAlpha((180.0f * _c80) / 255.0f);