diff --git a/CONFIG/qt/MainDlg.cpp b/CONFIG/qt/MainDlg.cpp index 73a85ab3..1ef8683c 100644 --- a/CONFIG/qt/MainDlg.cpp +++ b/CONFIG/qt/MainDlg.cpp @@ -64,6 +64,7 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->musicCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxMusic); connect(m_ui->sound3DCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DSound); connect(m_ui->rumbleCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxRumble); + connect(m_ui->wasdCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxWasd); connect(m_ui->textureCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxTexture); connect(m_ui->customAssetsCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxCustomAssets); connect(m_ui->touchComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::TouchControlsChanged); @@ -306,6 +307,7 @@ void CMainDialog::UpdateInterface() } m_ui->musicCheckBox->setChecked(currentConfigApp->m_music); m_ui->rumbleCheckBox->setChecked(currentConfigApp->m_haptic); + m_ui->wasdCheckBox->setChecked(currentConfigApp->m_wasd); m_ui->touchComboBox->setCurrentIndex(currentConfigApp->m_touch_scheme); m_ui->transitionTypeComboBox->setCurrentIndex(currentConfigApp->m_transition_type); m_ui->dataPath->setText(QString::fromStdString(currentConfigApp->m_cd_path)); @@ -458,6 +460,13 @@ void CMainDialog::OnCheckboxRumble(bool checked) UpdateInterface(); } +void CMainDialog::OnCheckboxWasd(bool checked) +{ + currentConfigApp->m_wasd = checked; + m_modified = true; + UpdateInterface(); +} + void CMainDialog::OnCheckboxTexture(bool checked) { currentConfigApp->m_texture_load = checked; diff --git a/CONFIG/qt/MainDlg.h b/CONFIG/qt/MainDlg.h index 22cf7895..b5df132f 100644 --- a/CONFIG/qt/MainDlg.h +++ b/CONFIG/qt/MainDlg.h @@ -48,6 +48,7 @@ private slots: void OnRadioExclusiveFullscreen(bool checked); void OnCheckboxMusic(bool checked); void OnCheckboxRumble(bool checked); + void OnCheckboxWasd(bool checked); void OnCheckboxTexture(bool checked); void OnCheckboxCustomAssets(bool checked); void TouchControlsChanged(int index); diff --git a/CONFIG/qt/config.cpp b/CONFIG/qt/config.cpp index 4e9d414d..bef90ebc 100644 --- a/CONFIG/qt/config.cpp +++ b/CONFIG/qt/config.cpp @@ -87,6 +87,7 @@ bool CConfigApp::InitInstance() m_msaa = 1; m_anisotropy = 1; m_haptic = TRUE; + m_wasd = FALSE; m_touch_scheme = 2; m_texture_load = TRUE; m_texture_path = "textures/"; @@ -182,6 +183,7 @@ bool CConfigApp::ReadRegisterSettings() m_texture_quality = iniparser_getint(dict, "isle:Island Texture", m_texture_quality); m_use_joystick = iniparser_getboolean(dict, "isle:UseJoystick", m_use_joystick); m_haptic = iniparser_getboolean(dict, "isle:Haptic", m_haptic); + m_wasd = iniparser_getboolean(dict, "isle:WASD", m_wasd); m_music = iniparser_getboolean(dict, "isle:Music", m_music); m_joystick_index = iniparser_getint(dict, "isle:JoystickIndex", m_joystick_index); m_max_lod = iniparser_getdouble(dict, "isle:Max LOD", m_max_lod); @@ -392,6 +394,7 @@ void CConfigApp::WriteRegisterSettings() const SetIniBool(dict, "isle:3DSound", m_3d_sound); SetIniBool(dict, "isle:Music", m_music); SetIniBool(dict, "isle:Haptic", m_haptic); + SetIniBool(dict, "isle:WASD", m_wasd); SetIniBool(dict, "isle:UseJoystick", m_use_joystick); SetIniInt(dict, "isle:JoystickIndex", m_joystick_index); diff --git a/CONFIG/qt/config.h b/CONFIG/qt/config.h index 71e876f6..3639d773 100644 --- a/CONFIG/qt/config.h +++ b/CONFIG/qt/config.h @@ -82,6 +82,7 @@ class CConfigApp { bool m_draw_cursor; bool m_use_joystick; bool m_haptic; + bool m_wasd; int m_joystick_index; int m_model_quality; int m_texture_quality; diff --git a/CONFIG/qt/res/maindialog.ui b/CONFIG/qt/res/maindialog.ui index 99931197..86c41e27 100644 --- a/CONFIG/qt/res/maindialog.ui +++ b/CONFIG/qt/res/maindialog.ui @@ -1006,7 +1006,23 @@ The game will gradually increase the number of actors until this maximum is reac - + + + true + + + Use the WASD keys for navigation. + + + Use WASD + + + true + + + + + Qt::Orientation::Vertical @@ -1328,6 +1344,7 @@ Double-click a path to edit it. AFSlider touchComboBox rumbleCheckBox + wasdCheckBox scrollArea textureCheckBox texturePath diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 7983896f..8de26525 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -194,6 +194,7 @@ IsleApp::IsleApp() m_cursorSensitivity = 4; m_touchScheme = LegoInputManager::e_gamepad; m_haptic = TRUE; + m_wasd = FALSE; m_xRes = 640; m_yRes = 480; m_exclusiveXRes = m_xRes; @@ -1027,6 +1028,9 @@ MxResult IsleApp::SetupWindow() else { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Failed to get D3D device name and description"); } + if (LegoOmni::GetInstance()->GetInputManager()) { + LegoOmni::GetInstance()->GetInputManager()->SetWasd(m_wasd); + } } return SUCCESS; @@ -1118,6 +1122,7 @@ bool IsleApp::LoadConfig() iniparser_set(dict, "isle:Transition Type", SDL_itoa(m_transitionType, buf, 10)); iniparser_set(dict, "isle:Touch Scheme", SDL_itoa(m_touchScheme, buf, 10)); iniparser_set(dict, "isle:Haptic", m_haptic ? "true" : "false"); + iniparser_set(dict, "isle:WASD", m_wasd ? "true" : "false"); iniparser_set(dict, "isle:Horizontal Resolution", SDL_itoa(m_xRes, buf, 10)); iniparser_set(dict, "isle:Vertical Resolution", SDL_itoa(m_yRes, buf, 10)); iniparser_set(dict, "isle:Exclusive X Resolution", SDL_itoa(m_exclusiveXRes, buf, 10)); @@ -1197,6 +1202,7 @@ bool IsleApp::LoadConfig() (MxTransitionManager::TransitionType) iniparser_getint(dict, "isle:Transition Type", m_transitionType); m_touchScheme = (LegoInputManager::TouchScheme) iniparser_getint(dict, "isle:Touch Scheme", m_touchScheme); m_haptic = iniparser_getboolean(dict, "isle:Haptic", m_haptic); + m_wasd = iniparser_getboolean(dict, "isle:WASD", m_wasd); m_xRes = iniparser_getint(dict, "isle:Horizontal Resolution", m_xRes); m_yRes = iniparser_getint(dict, "isle:Vertical Resolution", m_yRes); m_exclusiveXRes = iniparser_getint(dict, "isle:Exclusive X Resolution", m_exclusiveXRes); diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 0e0700e8..38c0aecc 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -107,6 +107,7 @@ class IsleApp { MxTransitionManager::TransitionType m_transitionType; LegoInputManager::TouchScheme m_touchScheme; MxBool m_haptic; + MxBool m_wasd; MxS32 m_xRes; MxS32 m_yRes; MxS32 m_exclusiveXRes; diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index f8a4bb0a..b3733b8a 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -132,6 +132,8 @@ class LegoInputManager : public MxPresenter { void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; } void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; } + void SetWasd(MxBool p_wasd) { m_wasd = p_wasd; } + // FUNCTION: BETA10 0x1002e390 void DisableInputProcessing() { @@ -197,6 +199,7 @@ class LegoInputManager : public MxPresenter { MxBool m_unk0x335; // 0x335 MxBool m_unk0x336; // 0x336 + MxBool m_wasd; TouchScheme m_touchScheme = e_none; SDL_Point m_touchVirtualThumb = {0, 0}; SDL_FPoint m_touchVirtualThumbOrigin; diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 613e5b9f..aa631027 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -134,20 +134,39 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags) MxU32 keyFlags = 0; - if (m_keyboardState[SDL_SCANCODE_KP_8] || m_keyboardState[SDL_SCANCODE_UP]) { - keyFlags |= c_up; - } + if (!m_wasd) { + if (m_keyboardState[SDL_SCANCODE_KP_8] || m_keyboardState[SDL_SCANCODE_UP]) { + keyFlags |= c_up; + } - if ((m_keyboardState[SDL_SCANCODE_KP_2] || m_keyboardState[SDL_SCANCODE_DOWN])) { - keyFlags |= c_down; - } + if ((m_keyboardState[SDL_SCANCODE_KP_2] || m_keyboardState[SDL_SCANCODE_DOWN])) { + keyFlags |= c_down; + } - if ((m_keyboardState[SDL_SCANCODE_KP_4] || m_keyboardState[SDL_SCANCODE_LEFT])) { - keyFlags |= c_left; - } + if ((m_keyboardState[SDL_SCANCODE_KP_4] || m_keyboardState[SDL_SCANCODE_LEFT])) { + keyFlags |= c_left; + } - if ((m_keyboardState[SDL_SCANCODE_KP_6] || m_keyboardState[SDL_SCANCODE_RIGHT])) { - keyFlags |= c_right; + if ((m_keyboardState[SDL_SCANCODE_KP_6] || m_keyboardState[SDL_SCANCODE_RIGHT])) { + keyFlags |= c_right; + } + } + else { + if (m_keyboardState[SDL_SCANCODE_W]) { + keyFlags |= c_up; + } + + if (m_keyboardState[SDL_SCANCODE_S]) { + keyFlags |= c_down; + } + + if (m_keyboardState[SDL_SCANCODE_A]) { + keyFlags |= c_left; + } + + if (m_keyboardState[SDL_SCANCODE_D]) { + keyFlags |= c_right; + } } if (m_keyboardState[SDL_SCANCODE_LCTRL] || m_keyboardState[SDL_SCANCODE_RCTRL]) {