mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
🔧 feat: add mouse sensitivity config
This commit is contained in:
parent
f0cc1df214
commit
3df0496c6d
@ -148,6 +148,7 @@ IsleApp::IsleApp()
|
|||||||
m_maxLod = RealtimeView::GetUserMaxLOD();
|
m_maxLod = RealtimeView::GetUserMaxLOD();
|
||||||
m_maxAllowedExtras = m_islandQuality <= 1 ? 10 : 20;
|
m_maxAllowedExtras = m_islandQuality <= 1 ? 10 : 20;
|
||||||
m_transitionType = MxTransitionManager::e_mosaic;
|
m_transitionType = MxTransitionManager::e_mosaic;
|
||||||
|
m_mouseSensitivity = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: ISLE 0x4011a0
|
// FUNCTION: ISLE 0x4011a0
|
||||||
@ -494,10 +495,11 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
|||||||
}
|
}
|
||||||
case SDL_EVENT_JOYSTICK_AXIS_MOTION: {
|
case SDL_EVENT_JOYSTICK_AXIS_MOTION: {
|
||||||
if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_X) {
|
if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_X) {
|
||||||
g_lastJoystickMouseX = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * 4;
|
g_lastJoystickMouseX = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
||||||
}
|
}
|
||||||
else if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_Y) {
|
else if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_Y) {
|
||||||
g_lastJoystickMouseY = -((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * 4;
|
g_lastJoystickMouseY =
|
||||||
|
-((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
||||||
}
|
}
|
||||||
else if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_TRIGGER) {
|
else if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_TRIGGER) {
|
||||||
if (event->gaxis.value != SDL_JOYSTICK_AXIS_MIN) {
|
if (event->gaxis.value != SDL_JOYSTICK_AXIS_MIN) {
|
||||||
@ -902,6 +904,8 @@ bool IsleApp::LoadConfig()
|
|||||||
iniparser_set(dict, "isle:UseJoystick", m_useJoystick ? "true" : "false");
|
iniparser_set(dict, "isle:UseJoystick", m_useJoystick ? "true" : "false");
|
||||||
iniparser_set(dict, "isle:JoystickIndex", SDL_itoa(m_joystickIndex, buf, 10));
|
iniparser_set(dict, "isle:JoystickIndex", SDL_itoa(m_joystickIndex, buf, 10));
|
||||||
iniparser_set(dict, "isle:Draw Cursor", m_drawCursor ? "true" : "false");
|
iniparser_set(dict, "isle:Draw Cursor", m_drawCursor ? "true" : "false");
|
||||||
|
SDL_snprintf(buf, sizeof(buf), "%f", m_mouseSensitivity);
|
||||||
|
iniparser_set(dict, "isle:Mouse Sensitivity", buf);
|
||||||
|
|
||||||
iniparser_set(dict, "isle:Back Buffers in Video RAM", "-1");
|
iniparser_set(dict, "isle:Back Buffers in Video RAM", "-1");
|
||||||
|
|
||||||
@ -956,6 +960,7 @@ bool IsleApp::LoadConfig()
|
|||||||
m_useJoystick = iniparser_getboolean(dict, "isle:UseJoystick", m_useJoystick);
|
m_useJoystick = iniparser_getboolean(dict, "isle:UseJoystick", m_useJoystick);
|
||||||
m_joystickIndex = iniparser_getint(dict, "isle:JoystickIndex", m_joystickIndex);
|
m_joystickIndex = iniparser_getint(dict, "isle:JoystickIndex", m_joystickIndex);
|
||||||
m_drawCursor = iniparser_getboolean(dict, "isle:Draw Cursor", m_drawCursor);
|
m_drawCursor = iniparser_getboolean(dict, "isle:Draw Cursor", m_drawCursor);
|
||||||
|
m_mouseSensitivity = iniparser_getdouble(dict, "isle:Mouse Sensitivity", m_mouseSensitivity);
|
||||||
|
|
||||||
MxS32 backBuffersInVRAM = iniparser_getboolean(dict, "isle:Back Buffers in Video RAM", -1);
|
MxS32 backBuffersInVRAM = iniparser_getboolean(dict, "isle:Back Buffers in Video RAM", -1);
|
||||||
if (backBuffersInVRAM != -1) {
|
if (backBuffersInVRAM != -1) {
|
||||||
|
|||||||
@ -51,6 +51,7 @@ class IsleApp {
|
|||||||
SDL_Cursor* GetCursorNo() { return m_cursorNo; }
|
SDL_Cursor* GetCursorNo() { return m_cursorNo; }
|
||||||
MxS32 GetDrawCursor() { return m_drawCursor; }
|
MxS32 GetDrawCursor() { return m_drawCursor; }
|
||||||
MxS32 GetGameStarted() { return m_gameStarted; }
|
MxS32 GetGameStarted() { return m_gameStarted; }
|
||||||
|
MxFloat GetMouseSensitivity() { return m_mouseSensitivity; }
|
||||||
|
|
||||||
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
|
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
|
||||||
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
|
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
|
||||||
@ -88,6 +89,7 @@ class IsleApp {
|
|||||||
SDL_Cursor* m_cursorNo; // 0x84
|
SDL_Cursor* m_cursorNo; // 0x84
|
||||||
SDL_Cursor* m_cursorCurrent; // 0x88
|
SDL_Cursor* m_cursorCurrent; // 0x88
|
||||||
char* m_mediaPath;
|
char* m_mediaPath;
|
||||||
|
MxFloat m_mouseSensitivity;
|
||||||
|
|
||||||
char* m_iniPath;
|
char* m_iniPath;
|
||||||
MxFloat m_maxLod;
|
MxFloat m_maxLod;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user