mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
Merge e6837b52c0 into 3f974f7317
This commit is contained in:
commit
55601e2c23
@ -450,6 +450,7 @@ target_sources(lego1 PRIVATE
|
||||
LEGO1/lego/legoomni/src/entity/legoworld.cpp
|
||||
LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp
|
||||
LEGO1/lego/legoomni/src/input/legoinputmanager.cpp
|
||||
LEGO1/lego/legoomni/src/input/legokeymaps.cpp
|
||||
LEGO1/lego/legoomni/src/main/legomain.cpp
|
||||
LEGO1/lego/legoomni/src/main/scripts.cpp
|
||||
LEGO1/lego/legoomni/src/paths/legoanimactor.cpp
|
||||
@ -639,6 +640,7 @@ if (ISLE_BUILD_CONFIG)
|
||||
qt_add_executable(isle-config WIN32
|
||||
LEGO1/mxdirectx/mxdirectxinfo.cpp
|
||||
LEGO1/mxdirectx/legodxinfo.cpp
|
||||
LEGO1/lego/legoomni/src/input/legokeymaps.cpp
|
||||
CONFIG/config.cpp
|
||||
CONFIG/AboutDlg.cpp
|
||||
CONFIG/MainDlg.cpp
|
||||
@ -654,6 +656,7 @@ if (ISLE_BUILD_CONFIG)
|
||||
list(APPEND isle_targets isle-config)
|
||||
target_compile_definitions(isle-config PRIVATE _AFXDLL MXDIRECTX_FOR_CONFIG)
|
||||
target_include_directories(isle-config PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/LEGO1")
|
||||
target_include_directories(isle-config PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/LEGO1/lego/legoomni/include")
|
||||
target_include_directories(isle-config PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/util>")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
|
||||
target_link_libraries(isle-config PRIVATE DirectX5::DirectX5)
|
||||
|
||||
@ -73,6 +73,17 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent)
|
||||
connect(m_ui->cancelButton, &QPushButton::clicked, this, &CMainDialog::reject);
|
||||
connect(m_ui->launchButton, &QPushButton::clicked, this, &CMainDialog::launch);
|
||||
|
||||
connect(m_ui->keyForward_1, &QPushButton::clicked, this, &CMainDialog::ForwardKeyChanged);
|
||||
connect(m_ui->keyForward_2, &QPushButton::clicked, this, &CMainDialog::ForwardKeyChangedAlt);
|
||||
connect(m_ui->keyBack_1, &QPushButton::clicked, this, &CMainDialog::BackwardKeyChanged);
|
||||
connect(m_ui->keyBack_2, &QPushButton::clicked, this, &CMainDialog::BackwardKeyChangedAlt);
|
||||
connect(m_ui->keyLeft_1, &QPushButton::clicked, this, &CMainDialog::LeftKeyChanged);
|
||||
connect(m_ui->keyLeft_2, &QPushButton::clicked, this, &CMainDialog::LeftKeyChangedAlt);
|
||||
connect(m_ui->keyRight_1, &QPushButton::clicked, this, &CMainDialog::RightKeyChanged);
|
||||
connect(m_ui->keyRight_2, &QPushButton::clicked, this, &CMainDialog::RightKeyChangedAlt);
|
||||
connect(m_ui->keySprint_1, &QPushButton::clicked, this, &CMainDialog::SprintKeyChanged);
|
||||
connect(m_ui->keySprint_2, &QPushButton::clicked, this, &CMainDialog::SprintKeyChangedAlt);
|
||||
|
||||
connect(m_ui->dataPathOpen, &QPushButton::clicked, this, &CMainDialog::SelectDataPathDialog);
|
||||
connect(m_ui->savePathOpen, &QPushButton::clicked, this, &CMainDialog::SelectSavePathDialog);
|
||||
|
||||
@ -181,16 +192,18 @@ bool CMainDialog::OnInitDialog()
|
||||
m_ui->exFullResComboBox->clear();
|
||||
|
||||
int displayModeCount;
|
||||
displayModes = SDL_GetFullscreenDisplayModes(SDL_GetPrimaryDisplay(), &displayModeCount);
|
||||
m_displayModes = SDL_GetFullscreenDisplayModes(SDL_GetPrimaryDisplay(), &displayModeCount);
|
||||
|
||||
for (int i = 0; i < displayModeCount; ++i) {
|
||||
QString mode =
|
||||
QString("%1x%2 @ %3Hz").arg(displayModes[i]->w).arg(displayModes[i]->h).arg(displayModes[i]->refresh_rate);
|
||||
QString mode = QString("%1x%2 @ %3Hz")
|
||||
.arg(m_displayModes[i]->w)
|
||||
.arg(m_displayModes[i]->h)
|
||||
.arg(m_displayModes[i]->refresh_rate);
|
||||
m_ui->exFullResComboBox->addItem(mode);
|
||||
|
||||
if ((displayModes[i]->w == currentConfigApp->m_exf_x_res) &&
|
||||
(displayModes[i]->h == currentConfigApp->m_exf_y_res) &&
|
||||
(displayModes[i]->refresh_rate == currentConfigApp->m_exf_fps)) {
|
||||
if ((m_displayModes[i]->w == currentConfigApp->m_exf_x_res) &&
|
||||
(m_displayModes[i]->h == currentConfigApp->m_exf_y_res) &&
|
||||
(m_displayModes[i]->refresh_rate == currentConfigApp->m_exf_fps)) {
|
||||
m_ui->exFullResComboBox->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
@ -348,6 +361,22 @@ void CMainDialog::UpdateInterface()
|
||||
m_ui->msaaNum->setNum(currentConfigApp->m_msaa);
|
||||
m_ui->AFSlider->setValue(log2(currentConfigApp->m_anisotropy));
|
||||
m_ui->AFNum->setNum(currentConfigApp->m_anisotropy);
|
||||
|
||||
m_ui->keyForward_1->setText(GetKeyName(g_keyMaps.k_forward[0]));
|
||||
m_ui->keyForward_2->setText(GetKeyName(g_keyMaps.k_forward[1]));
|
||||
m_ui->keyBack_1->setText(GetKeyName(g_keyMaps.k_back[0]));
|
||||
m_ui->keyBack_2->setText(GetKeyName(g_keyMaps.k_back[1]));
|
||||
m_ui->keyLeft_1->setText(GetKeyName(g_keyMaps.k_left[0]));
|
||||
m_ui->keyLeft_2->setText(GetKeyName(g_keyMaps.k_left[1]));
|
||||
m_ui->keyRight_1->setText(GetKeyName(g_keyMaps.k_right[0]));
|
||||
m_ui->keyRight_2->setText(GetKeyName(g_keyMaps.k_right[1]));
|
||||
m_ui->keySprint_1->setText(GetKeyName(g_keyMaps.k_sprint[0]));
|
||||
m_ui->keySprint_2->setText(GetKeyName(g_keyMaps.k_sprint[1]));
|
||||
}
|
||||
|
||||
QString CMainDialog::GetKeyName(SDL_Scancode key)
|
||||
{
|
||||
return QString(SDL_GetKeyName(SDL_GetKeyFromScancode(key, 0, true)));
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004045e0
|
||||
@ -488,9 +517,9 @@ void CMainDialog::TransitionTypeChanged(int index)
|
||||
|
||||
void CMainDialog::ExclusiveResolutionChanged(int index)
|
||||
{
|
||||
currentConfigApp->m_exf_x_res = displayModes[index]->w;
|
||||
currentConfigApp->m_exf_y_res = displayModes[index]->h;
|
||||
currentConfigApp->m_exf_fps = displayModes[index]->refresh_rate;
|
||||
currentConfigApp->m_exf_x_res = m_displayModes[index]->w;
|
||||
currentConfigApp->m_exf_y_res = m_displayModes[index]->h;
|
||||
currentConfigApp->m_exf_fps = m_displayModes[index]->refresh_rate;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
@ -635,12 +664,8 @@ void CMainDialog::TexturePathEdited()
|
||||
void CMainDialog::AddCustomAssetPath()
|
||||
{
|
||||
QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path));
|
||||
QStringList new_files = QFileDialog::getOpenFileNames(
|
||||
this,
|
||||
"Select one or more files to open",
|
||||
data_path.absolutePath(),
|
||||
"Interleaf files (*.si)"
|
||||
);
|
||||
QStringList new_files =
|
||||
QFileDialog::getOpenFileNames(this, "Open File(s)", data_path.absolutePath(), "Interleaf files (*.si)");
|
||||
if (!new_files.isEmpty()) {
|
||||
for (QString& item : new_files) {
|
||||
item = data_path.relativeFilePath(item);
|
||||
@ -719,7 +744,10 @@ void CMainDialog::YResChanged(int i)
|
||||
|
||||
void CMainDialog::EnsureAspectRatio()
|
||||
{
|
||||
if (currentConfigApp->m_aspect_ratio != 3) {
|
||||
if (currentConfigApp->m_aspect_ratio == 3) {
|
||||
m_ui->xResSpinBox->setReadOnly(false);
|
||||
}
|
||||
else {
|
||||
m_ui->xResSpinBox->setReadOnly(true);
|
||||
switch (currentConfigApp->m_aspect_ratio) {
|
||||
case 0: {
|
||||
@ -738,9 +766,6 @@ void CMainDialog::EnsureAspectRatio()
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_ui->xResSpinBox->setReadOnly(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainDialog::FramerateChanged(int i)
|
||||
@ -749,3 +774,115 @@ void CMainDialog::FramerateChanged(int i)
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
void CMainDialog::ForwardKeyChanged()
|
||||
{
|
||||
RebindInput(m_ui->keyForward_1, g_keyMaps.k_forward[0]);
|
||||
}
|
||||
|
||||
void CMainDialog::ForwardKeyChangedAlt()
|
||||
{
|
||||
RebindInput(m_ui->keyForward_2, g_keyMaps.k_forward[1]);
|
||||
}
|
||||
|
||||
void CMainDialog::BackwardKeyChanged()
|
||||
{
|
||||
RebindInput(m_ui->keyBack_1, g_keyMaps.k_back[0]);
|
||||
}
|
||||
|
||||
void CMainDialog::BackwardKeyChangedAlt()
|
||||
{
|
||||
RebindInput(m_ui->keyBack_2, g_keyMaps.k_back[1]);
|
||||
}
|
||||
|
||||
void CMainDialog::LeftKeyChanged()
|
||||
{
|
||||
RebindInput(m_ui->keyLeft_1, g_keyMaps.k_left[0]);
|
||||
}
|
||||
|
||||
void CMainDialog::LeftKeyChangedAlt()
|
||||
{
|
||||
RebindInput(m_ui->keyLeft_2, g_keyMaps.k_left[1]);
|
||||
}
|
||||
|
||||
void CMainDialog::RightKeyChanged()
|
||||
{
|
||||
RebindInput(m_ui->keyRight_1, g_keyMaps.k_right[0]);
|
||||
}
|
||||
|
||||
void CMainDialog::RightKeyChangedAlt()
|
||||
{
|
||||
RebindInput(m_ui->keyRight_2, g_keyMaps.k_right[1]);
|
||||
}
|
||||
|
||||
void CMainDialog::SprintKeyChanged()
|
||||
{
|
||||
RebindInput(m_ui->keySprint_1, g_keyMaps.k_sprint[0]);
|
||||
}
|
||||
|
||||
void CMainDialog::SprintKeyChangedAlt()
|
||||
{
|
||||
RebindInput(m_ui->keySprint_2, g_keyMaps.k_sprint[1]);
|
||||
}
|
||||
|
||||
void CMainDialog::RebindInput(QPushButton*& button, SDL_Scancode& key)
|
||||
{
|
||||
SDL_InitSubSystem(SDL_INIT_EVENTS);
|
||||
button->setText(QString("Press a key..."));
|
||||
m_currentKeyBind = &key;
|
||||
|
||||
m_inputWindow = SDL_CreateWindow(
|
||||
"Press a key...",
|
||||
256,
|
||||
128,
|
||||
SDL_WINDOW_HIDDEN | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_UTILITY |
|
||||
SDL_WINDOW_KEYBOARD_GRABBED
|
||||
);
|
||||
#ifdef MINIWIN
|
||||
m_hWnd = reinterpret_cast<HWND>(m_inputWindow);
|
||||
#else
|
||||
m_hWnd =
|
||||
(HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(m_inputWindow), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
|
||||
#endif
|
||||
|
||||
inputTimeout.setSingleShot(false);
|
||||
inputTimeout.setInterval(1000);
|
||||
sdlPoller.setSingleShot(false);
|
||||
sdlPoller.setInterval(10);
|
||||
connect(&inputTimeout, &QTimer::timeout, this, &CMainDialog::RebindTimeout);
|
||||
connect(&sdlPoller, &QTimer::timeout, this, &CMainDialog::PollInputs);
|
||||
SDL_ShowWindow(m_inputWindow);
|
||||
SDL_RaiseWindow(m_inputWindow);
|
||||
timeoutCountdown = 3;
|
||||
sdlPoller.start();
|
||||
inputTimeout.start();
|
||||
}
|
||||
|
||||
void CMainDialog::PollInputs()
|
||||
{
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_EVENT_KEY_DOWN || event.type == SDL_EVENT_QUIT) {
|
||||
if (event.type == SDL_EVENT_KEY_DOWN && event.key.scancode != SDL_SCANCODE_ESCAPE) {
|
||||
SDL_Scancode sc = event.key.scancode;
|
||||
*m_currentKeyBind = sc;
|
||||
m_modified = true;
|
||||
}
|
||||
sdlPoller.disconnect();
|
||||
inputTimeout.disconnect();
|
||||
SDL_DestroyWindow(m_inputWindow);
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMainDialog::RebindTimeout()
|
||||
{
|
||||
timeoutCountdown -= 1;
|
||||
if (timeoutCountdown <= 0) {
|
||||
sdlPoller.disconnect();
|
||||
inputTimeout.disconnect();
|
||||
SDL_DestroyWindow(m_inputWindow);
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,8 +5,16 @@
|
||||
#include "decomp.h"
|
||||
#include "res/resource.h"
|
||||
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/d3d.h"
|
||||
#else
|
||||
#include <d3d.h>
|
||||
#endif
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
namespace Ui
|
||||
@ -31,10 +39,17 @@ class CMainDialog : public QDialog {
|
||||
bool m_advanced = false;
|
||||
QStringList assetPaths = QStringList();
|
||||
Ui::MainDialog* m_ui = nullptr;
|
||||
SDL_DisplayMode** displayModes;
|
||||
SDL_DisplayMode** m_displayModes;
|
||||
SDL_Window* m_inputWindow;
|
||||
HWND m_hWnd;
|
||||
QTimer sdlPoller;
|
||||
QTimer inputTimeout;
|
||||
int timeoutCountdown = 0;
|
||||
SDL_Scancode* m_currentKeyBind = nullptr;
|
||||
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
bool OnInitDialog();
|
||||
QString GetKeyName(SDL_Scancode key);
|
||||
private slots:
|
||||
void OnList3DevicesSelectionChanged(int row);
|
||||
void OnCheckbox3DSound(bool checked);
|
||||
@ -76,6 +91,19 @@ private slots:
|
||||
void AspectRatioChanged(int index);
|
||||
void EnsureAspectRatio();
|
||||
void FramerateChanged(int i);
|
||||
void RebindInput(QPushButton*& button, SDL_Scancode& key);
|
||||
void PollInputs();
|
||||
void RebindTimeout();
|
||||
void ForwardKeyChanged();
|
||||
void ForwardKeyChangedAlt();
|
||||
void BackwardKeyChanged();
|
||||
void BackwardKeyChangedAlt();
|
||||
void LeftKeyChanged();
|
||||
void LeftKeyChangedAlt();
|
||||
void RightKeyChanged();
|
||||
void RightKeyChangedAlt();
|
||||
void SprintKeyChanged();
|
||||
void SprintKeyChangedAlt();
|
||||
};
|
||||
|
||||
// SYNTHETIC: CONFIG 0x00403de0
|
||||
|
||||
@ -199,6 +199,18 @@ bool CConfigApp::ReadRegisterSettings()
|
||||
m_exf_y_res = iniparser_getint(dict, "isle:Exclusive Y Resolution", m_exf_y_res);
|
||||
m_exf_fps = iniparser_getdouble(dict, "isle:Exclusive Framerate", m_exf_fps);
|
||||
m_frame_delta = iniparser_getdouble(dict, "isle:Frame Delta", m_frame_delta);
|
||||
|
||||
g_keyMaps.k_forward[0] = (SDL_Scancode) iniparser_getint(dict, "input:Forward", g_keyMaps.k_forward[0]);
|
||||
g_keyMaps.k_forward[1] = (SDL_Scancode) iniparser_getint(dict, "input:Forward Alt", g_keyMaps.k_forward[1]);
|
||||
g_keyMaps.k_back[0] = (SDL_Scancode) iniparser_getint(dict, "input:Backward", g_keyMaps.k_back[0]);
|
||||
g_keyMaps.k_back[1] = (SDL_Scancode) iniparser_getint(dict, "input:Backward Alt", g_keyMaps.k_back[1]);
|
||||
g_keyMaps.k_left[0] = (SDL_Scancode) iniparser_getint(dict, "input:Left", g_keyMaps.k_left[0]);
|
||||
g_keyMaps.k_left[1] = (SDL_Scancode) iniparser_getint(dict, "input:Left Alt", g_keyMaps.k_left[1]);
|
||||
g_keyMaps.k_right[0] = (SDL_Scancode) iniparser_getint(dict, "input:Right", g_keyMaps.k_right[0]);
|
||||
g_keyMaps.k_right[1] = (SDL_Scancode) iniparser_getint(dict, "input:Right Alt", g_keyMaps.k_right[1]);
|
||||
g_keyMaps.k_sprint[0] = (SDL_Scancode) iniparser_getint(dict, "input:Sprint", g_keyMaps.k_sprint[0]);
|
||||
g_keyMaps.k_sprint[1] = (SDL_Scancode) iniparser_getint(dict, "input:Sprint Alt", g_keyMaps.k_sprint[1]);
|
||||
|
||||
iniparser_freedict(dict);
|
||||
return true;
|
||||
}
|
||||
@ -370,6 +382,7 @@ void CConfigApp::WriteRegisterSettings() const
|
||||
iniparser_set(dict, "extensions", NULL);
|
||||
iniparser_set(dict, "texture loader", NULL);
|
||||
iniparser_set(dict, "si loader", NULL);
|
||||
iniparser_set(dict, "input", NULL);
|
||||
|
||||
if (m_device_enumerator->FormatDeviceName(buffer, m_driver, m_device) >= 0) {
|
||||
iniparser_set(dict, "isle:3D Device ID", buffer);
|
||||
@ -419,6 +432,17 @@ void CConfigApp::WriteRegisterSettings() const
|
||||
iniparser_set(dict, "isle:Exclusive Framerate", std::to_string(m_exf_fps).c_str());
|
||||
iniparser_set(dict, "isle:Frame Delta", std::to_string(m_frame_delta).c_str());
|
||||
|
||||
SetIniInt(dict, "input:Forward", g_keyMaps.k_forward[0]);
|
||||
SetIniInt(dict, "input:Forward Alt", g_keyMaps.k_forward[1]);
|
||||
SetIniInt(dict, "input:Backward", g_keyMaps.k_back[0]);
|
||||
SetIniInt(dict, "input:Backward Alt", g_keyMaps.k_back[1]);
|
||||
SetIniInt(dict, "input:Left", g_keyMaps.k_left[0]);
|
||||
SetIniInt(dict, "input:Left Alt", g_keyMaps.k_left[1]);
|
||||
SetIniInt(dict, "input:Right", g_keyMaps.k_right[0]);
|
||||
SetIniInt(dict, "input:Right Alt", g_keyMaps.k_right[1]);
|
||||
SetIniInt(dict, "input:Sprint", g_keyMaps.k_sprint[0]);
|
||||
SetIniInt(dict, "input:Sprint Alt", g_keyMaps.k_sprint[1]);
|
||||
|
||||
#undef SetIniBool
|
||||
#undef SetIniInt
|
||||
|
||||
@ -481,6 +505,11 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
qInfo() << "INI path =" << QString::fromStdString(g_theApp.GetIniPath());
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_EVENTS) != true) {
|
||||
qDebug() << "SDL_Init Error:" << SDL_GetError();
|
||||
// return 1;
|
||||
}
|
||||
|
||||
int result = 1;
|
||||
if (g_theApp.InitInstance()) {
|
||||
CMainDialog main_dialog;
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "AboutDlg.h"
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
#include "legokeymaps.h"
|
||||
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/d3d.h"
|
||||
@ -11,6 +12,7 @@
|
||||
#include <d3d.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_scancode.h>
|
||||
#include <string>
|
||||
|
||||
class LegoDeviceEnumerate;
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
<height>502</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -955,6 +955,123 @@ The game will gradually increase the number of actors until this maximum is reac
|
||||
<string>Controls</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="keyMappings">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Keyboard Mappings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="forwardKeyLabel">
|
||||
<property name="text">
|
||||
<string>Forward</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="backKeyLabel">
|
||||
<property name="text">
|
||||
<string>Back</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="leftKeyLabel">
|
||||
<property name="text">
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="rightKeyLabel">
|
||||
<property name="text">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="sprintKeyLabel">
|
||||
<property name="text">
|
||||
<string>Sprint</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="keyForward_1">
|
||||
<property name="text">
|
||||
<string>Up</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="keyForward_2">
|
||||
<property name="text">
|
||||
<string>Numpad 8</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="keyBack_1">
|
||||
<property name="text">
|
||||
<string>Down</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="keyBack_2">
|
||||
<property name="text">
|
||||
<string>Numpad 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="keyLeft_1">
|
||||
<property name="text">
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="keyLeft_2">
|
||||
<property name="text">
|
||||
<string>Numpad 4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="keyRight_1">
|
||||
<property name="text">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="keyRight_2">
|
||||
<property name="text">
|
||||
<string>Numpad 6</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="keySprint_1">
|
||||
<property name="text">
|
||||
<string>Left Control</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="keySprint_2">
|
||||
<property name="text">
|
||||
<string>Right Control</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="touchControl">
|
||||
<property name="toolTip">
|
||||
@ -1036,7 +1153,7 @@ The game will gradually increase the number of actors until this maximum is reac
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>449</width>
|
||||
<height>369</height>
|
||||
<height>391</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
@ -1326,6 +1443,16 @@ Double-click a path to edit it.</string>
|
||||
<tabstop>exFullResComboBox</tabstop>
|
||||
<tabstop>msaaSlider</tabstop>
|
||||
<tabstop>AFSlider</tabstop>
|
||||
<tabstop>keyForward_1</tabstop>
|
||||
<tabstop>keyForward_2</tabstop>
|
||||
<tabstop>keyBack_1</tabstop>
|
||||
<tabstop>keyBack_2</tabstop>
|
||||
<tabstop>keyLeft_1</tabstop>
|
||||
<tabstop>keyLeft_2</tabstop>
|
||||
<tabstop>keyRight_1</tabstop>
|
||||
<tabstop>keyRight_2</tabstop>
|
||||
<tabstop>keySprint_1</tabstop>
|
||||
<tabstop>keySprint_2</tabstop>
|
||||
<tabstop>touchComboBox</tabstop>
|
||||
<tabstop>rumbleCheckBox</tabstop>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include "legobuildingmanager.h"
|
||||
#include "legogamestate.h"
|
||||
#include "legoinputmanager.h"
|
||||
#include "legokeymaps.h"
|
||||
#include "legomain.h"
|
||||
#include "legomodelpresenter.h"
|
||||
#include "legopartpresenter.h"
|
||||
@ -46,6 +47,7 @@
|
||||
#define SDL_MAIN_USE_CALLBACKS
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_scancode.h>
|
||||
#include <errno.h>
|
||||
#include <iniparser.h>
|
||||
#include <stdlib.h>
|
||||
@ -1090,6 +1092,18 @@ bool IsleApp::LoadConfig()
|
||||
iniparser_set(dict, "isle:MSAA", SDL_itoa(m_msaaSamples, buf, 10));
|
||||
iniparser_set(dict, "isle:Anisotropic", SDL_itoa(m_anisotropic, buf, 10));
|
||||
|
||||
iniparser_set(dict, "input", NULL);
|
||||
iniparser_set(dict, "input:Forward", SDL_itoa(g_keyMaps.k_forward[0], buf, 10));
|
||||
iniparser_set(dict, "input:Forward Alt", SDL_itoa(g_keyMaps.k_forward[1], buf, 10));
|
||||
iniparser_set(dict, "input:Backward", SDL_itoa(g_keyMaps.k_back[0], buf, 10));
|
||||
iniparser_set(dict, "input:Backward Alt", SDL_itoa(g_keyMaps.k_back[1], buf, 10));
|
||||
iniparser_set(dict, "input:Left", SDL_itoa(g_keyMaps.k_left[0], buf, 10));
|
||||
iniparser_set(dict, "input:Left Alt", SDL_itoa(g_keyMaps.k_left[1], buf, 10));
|
||||
iniparser_set(dict, "input:Right", SDL_itoa(g_keyMaps.k_right[0], buf, 10));
|
||||
iniparser_set(dict, "input:Right Alt", SDL_itoa(g_keyMaps.k_right[1], buf, 10));
|
||||
iniparser_set(dict, "input:Sprint", SDL_itoa(g_keyMaps.k_sprint[0], buf, 10));
|
||||
iniparser_set(dict, "input:Sprint Alt", SDL_itoa(g_keyMaps.k_sprint[1], buf, 10));
|
||||
|
||||
#ifdef EXTENSIONS
|
||||
iniparser_set(dict, "extensions", NULL);
|
||||
for (const char* key : Extensions::availableExtensions) {
|
||||
@ -1167,6 +1181,17 @@ bool IsleApp::LoadConfig()
|
||||
m_videoParam.SetMSAASamples((m_msaaSamples = iniparser_getint(dict, "isle:MSAA", m_msaaSamples)));
|
||||
m_videoParam.SetAnisotropic((m_anisotropic = iniparser_getdouble(dict, "isle:Anisotropic", m_anisotropic)));
|
||||
|
||||
g_keyMaps.k_forward[0] = (SDL_Scancode) iniparser_getint(dict, "input:Forward", g_keyMaps.k_forward[0]);
|
||||
g_keyMaps.k_forward[1] = (SDL_Scancode) iniparser_getint(dict, "input:Forward Alt", g_keyMaps.k_forward[1]);
|
||||
g_keyMaps.k_back[0] = (SDL_Scancode) iniparser_getint(dict, "input:Backward", g_keyMaps.k_back[0]);
|
||||
g_keyMaps.k_back[1] = (SDL_Scancode) iniparser_getint(dict, "input:Backward Alt", g_keyMaps.k_back[1]);
|
||||
g_keyMaps.k_left[0] = (SDL_Scancode) iniparser_getint(dict, "input:Left", g_keyMaps.k_left[0]);
|
||||
g_keyMaps.k_left[1] = (SDL_Scancode) iniparser_getint(dict, "input:Left Alt", g_keyMaps.k_left[1]);
|
||||
g_keyMaps.k_right[0] = (SDL_Scancode) iniparser_getint(dict, "input:Right", g_keyMaps.k_right[0]);
|
||||
g_keyMaps.k_right[1] = (SDL_Scancode) iniparser_getint(dict, "input:Right Alt", g_keyMaps.k_right[1]);
|
||||
g_keyMaps.k_sprint[0] = (SDL_Scancode) iniparser_getint(dict, "input:Sprint", g_keyMaps.k_sprint[0]);
|
||||
g_keyMaps.k_sprint[1] = (SDL_Scancode) iniparser_getint(dict, "input:Sprint Alt", g_keyMaps.k_sprint[1]);
|
||||
|
||||
const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL);
|
||||
if (deviceId != NULL) {
|
||||
m_deviceId = SDL_strdup(deviceId);
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "cursor.h"
|
||||
#include "lego1_export.h"
|
||||
#include "legoinputmanager.h"
|
||||
#include "legokeymaps.h"
|
||||
#include "legoutils.h"
|
||||
#include "mxtransitionmanager.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "decomp.h"
|
||||
#include "lego1_export.h"
|
||||
#include "legoeventnotificationparam.h"
|
||||
#include "legokeymaps.h"
|
||||
#include "mxlist.h"
|
||||
#include "mxpresenter.h"
|
||||
#include "mxqueue.h"
|
||||
@ -12,6 +13,7 @@
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <SDL3/SDL_keyboard.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL_scancode.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/windows.h"
|
||||
@ -87,7 +89,7 @@ class LegoInputManager : public MxPresenter {
|
||||
c_right = 0x02,
|
||||
c_up = 0x04,
|
||||
c_down = 0x08,
|
||||
c_ctrl = 0x10,
|
||||
c_sprint = 0x10,
|
||||
|
||||
c_leftOrRight = c_left | c_right,
|
||||
c_upOrDown = c_up | c_down
|
||||
|
||||
29
LEGO1/lego/legoomni/include/legokeymaps.h
Normal file
29
LEGO1/lego/legoomni/include/legokeymaps.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef LEGOKEYMAPS_H
|
||||
#define LEGOKEYMAPS_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "lego1_export.h"
|
||||
|
||||
#include <SDL3/SDL_keyboard.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL_scancode.h>
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/windows.h"
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <variant>
|
||||
|
||||
struct KeyMaps {
|
||||
SDL_Scancode k_forward[2];
|
||||
SDL_Scancode k_back[2];
|
||||
SDL_Scancode k_left[2];
|
||||
SDL_Scancode k_right[2];
|
||||
SDL_Scancode k_sprint[2];
|
||||
};
|
||||
|
||||
extern KeyMaps g_keyMaps;
|
||||
|
||||
#endif
|
||||
@ -623,8 +623,8 @@ MxResult LegoNavController::ProcessKeyboardInput()
|
||||
break;
|
||||
}
|
||||
|
||||
MxFloat maxAccelDivisor = keyFlags & LegoInputManager::c_ctrl ? 1.0f : 4.0f;
|
||||
MxFloat minAccelDivisor = keyFlags & LegoInputManager::c_ctrl ? 1.0f : 2.0f;
|
||||
MxFloat maxAccelDivisor = keyFlags & LegoInputManager::c_sprint ? 1.0f : 4.0f;
|
||||
MxFloat minAccelDivisor = keyFlags & LegoInputManager::c_sprint ? 1.0f : 2.0f;
|
||||
|
||||
if (!skipRotationVelAndAccelCalc) {
|
||||
m_targetRotationalVel = CalculateNewTargetVel(hMax, m_hMax / 2, m_maxRotationalVel);
|
||||
|
||||
@ -134,24 +134,24 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags)
|
||||
|
||||
MxU32 keyFlags = 0;
|
||||
|
||||
if (m_keyboardState[SDL_SCANCODE_KP_8] || m_keyboardState[SDL_SCANCODE_UP]) {
|
||||
if (m_keyboardState[g_keyMaps.k_forward[0]] || m_keyboardState[g_keyMaps.k_forward[1]]) {
|
||||
keyFlags |= c_up;
|
||||
}
|
||||
|
||||
if ((m_keyboardState[SDL_SCANCODE_KP_2] || m_keyboardState[SDL_SCANCODE_DOWN])) {
|
||||
if ((m_keyboardState[g_keyMaps.k_back[0]] || m_keyboardState[g_keyMaps.k_back[1]])) {
|
||||
keyFlags |= c_down;
|
||||
}
|
||||
|
||||
if ((m_keyboardState[SDL_SCANCODE_KP_4] || m_keyboardState[SDL_SCANCODE_LEFT])) {
|
||||
if ((m_keyboardState[g_keyMaps.k_left[0]] || m_keyboardState[g_keyMaps.k_left[1]])) {
|
||||
keyFlags |= c_left;
|
||||
}
|
||||
|
||||
if ((m_keyboardState[SDL_SCANCODE_KP_6] || m_keyboardState[SDL_SCANCODE_RIGHT])) {
|
||||
if ((m_keyboardState[g_keyMaps.k_right[0]] || m_keyboardState[g_keyMaps.k_right[1]])) {
|
||||
keyFlags |= c_right;
|
||||
}
|
||||
|
||||
if (m_keyboardState[SDL_SCANCODE_LCTRL] || m_keyboardState[SDL_SCANCODE_RCTRL]) {
|
||||
keyFlags |= c_ctrl;
|
||||
if (m_keyboardState[g_keyMaps.k_sprint[0]] || m_keyboardState[g_keyMaps.k_sprint[1]]) {
|
||||
keyFlags |= c_sprint;
|
||||
}
|
||||
|
||||
GetNavigationTouchStates(keyFlags);
|
||||
|
||||
11
LEGO1/lego/legoomni/src/input/legokeymaps.cpp
Normal file
11
LEGO1/lego/legoomni/src/input/legokeymaps.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include "legokeymaps.h"
|
||||
|
||||
#include <SDL3/SDL_scancode.h>
|
||||
|
||||
KeyMaps g_keyMaps = {
|
||||
{SDL_SCANCODE_UP, SDL_SCANCODE_KP_8},
|
||||
{SDL_SCANCODE_DOWN, SDL_SCANCODE_KP_2},
|
||||
{SDL_SCANCODE_LEFT, SDL_SCANCODE_KP_4},
|
||||
{SDL_SCANCODE_RIGHT, SDL_SCANCODE_KP_6},
|
||||
{SDL_SCANCODE_LCTRL, SDL_SCANCODE_RCTRL}
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user