mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
implement WASD control option
This commit is contained in:
parent
4a1fd5d2f2
commit
ba6dc07e44
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1006,7 +1006,23 @@ The game will gradually increase the number of actors until this maximum is reac
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<widget class="QCheckBox" name="wasdCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Use the WASD keys for navigation.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use WASD</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
@ -1328,6 +1344,7 @@ Double-click a path to edit it.</string>
|
||||
<tabstop>AFSlider</tabstop>
|
||||
<tabstop>touchComboBox</tabstop>
|
||||
<tabstop>rumbleCheckBox</tabstop>
|
||||
<tabstop>wasdCheckBox</tabstop>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
<tabstop>textureCheckBox</tabstop>
|
||||
<tabstop>texturePath</tabstop>
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -56,6 +56,7 @@ class IsleApp {
|
||||
MxFloat GetCursorSensitivity() { return m_cursorSensitivity; }
|
||||
LegoInputManager::TouchScheme GetTouchScheme() { return m_touchScheme; }
|
||||
MxBool GetHaptic() { return m_haptic; }
|
||||
MxBool GetWasd() { return m_wasd; }
|
||||
|
||||
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
|
||||
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
|
||||
@ -107,6 +108,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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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]) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user