From a4f25ecb28109c171c25a0fa5a67f21c2e064baa Mon Sep 17 00:00:00 2001 From: Nathan Mena <99214912+itssecretnate@users.noreply.github.com> Date: Tue, 12 May 2026 06:12:38 -0600 Subject: [PATCH] Fix map offset when toggling mirror mode (#938) Co-authored-by: Nathan Mena --- include/d/d_map.h | 3 +++ src/d/d_map.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/d/d_map.h b/include/d/d_map.h index 28786e4f94..1acc7e4519 100644 --- a/include/d/d_map.h +++ b/include/d/d_map.h @@ -223,6 +223,9 @@ private: /* 0x8F */ u8 field_0x8f; /* 0x90 */ u8 field_0x90; /* 0x91 */ u8 field_0x91; +#if TARGET_PC + bool previousMirror; +#endif }; // Size: 0x94 class dMap_HIO_list_c : public dMpath_HIO_n::hioList_c { diff --git a/src/d/d_map.cpp b/src/d/d_map.cpp index 25d792f309..fa9049fb00 100644 --- a/src/d/d_map.cpp +++ b/src/d/d_map.cpp @@ -1141,6 +1141,9 @@ dMap_c::dMap_c(int width, int height, int param_2, int param_3) { field_0x91 = 0; m_mySelfPointer = this; #endif +#if TARGET_PC + previousMirror = dusk::getSettings().game.enableMirrorMode; +#endif m_res = JKR_NEW_ARGS (0x20) dMap_prm_res_s; JUT_ASSERT(2559, m_res != NULL); @@ -1579,6 +1582,17 @@ bool dMap_c::isDrawRoomIcon(int param_0, int param_1) const { } void dMap_c::_move(f32 i_centerX, f32 i_centerZ, int i_roomNo, f32 param_3) { +#if TARGET_PC + bool currentMirror = dusk::getSettings().game.enableMirrorMode; + if (currentMirror != previousMirror) { + previousMirror = currentMirror; + if (currentMirror) { + mCenterX -= 2.0f * mPackX; + } else { + mCenterX += 2.0f * mPackX; + } + } +#endif if (mStayRoomNo == -1) { mStayRoomNo = i_roomNo; field_0x80 = mStayRoomNo;