From 3b56c9b607cd997acb0bc6b44b7d31416f94a168 Mon Sep 17 00:00:00 2001 From: Ramen2X Date: Wed, 17 Dec 2025 20:20:02 -0500 Subject: [PATCH] fix WASD input conflict with debug mode (#743) --- .../lego/legoomni/include/legoinputmanager.h | 1 + .../legoomni/src/entity/legonavcontroller.cpp | 41 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index b3733b8a..6ddadec1 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -132,6 +132,7 @@ class LegoInputManager : public MxPresenter { void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; } void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; } + MxBool GetWasd() { return m_wasd; } void SetWasd(MxBool p_wasd) { m_wasd = p_wasd; } // FUNCTION: BETA10 0x1002e390 diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 4591fc88..9df6f79e 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -655,7 +655,44 @@ MxLong LegoNavController::Notify(MxParam& p_param) { if (((MxNotificationParam&) p_param).GetNotification() == c_notificationKeyPress) { m_unk0x5d = TRUE; - SDL_Keycode key = ((LegoEventNotificationParam&) p_param).GetKey(); + SDL_Keycode originKey = ((LegoEventNotificationParam&) p_param).GetKey(); + SDL_Keycode key = originKey; + + // This is necessary so any players using the WASD movement option can + // also use Debug Mode, which normally makes use of the WASD keys. + // + // For those players, we just swap the two and remap + // those conflicting debug keys to the arrow keys. + if (LegoOmni::GetInstance()->GetInputManager()->GetWasd()) { + switch (originKey) { + case SDLK_W: + key = SDLK_UP; + break; + case SDLK_A: + key = SDLK_LEFT; + break; + case SDLK_S: + key = SDLK_DOWN; + break; + case SDLK_D: + key = SDLK_RIGHT; + break; + case SDLK_UP: + key = SDLK_W; + break; + case SDLK_LEFT: + key = SDLK_A; + break; + case SDLK_DOWN: + key = SDLK_S; + break; + case SDLK_RIGHT: + key = SDLK_D; + break; + default: + break; + } + } switch (key) { case SDLK_PAUSE: // Pause game @@ -763,7 +800,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) // Check if the the key is part of the debug password if (!*g_currentInput) { // password "protected" debug shortcuts - switch (((LegoEventNotificationParam&) p_param).GetKey()) { + switch (key) { case SDLK_TAB: VideoManager()->ToggleFPS(g_fpsEnabled); if (g_fpsEnabled) {