mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-12 10:41:15 +00:00
Add ini option
This commit is contained in:
parent
b16414059c
commit
df681ea06e
@ -173,6 +173,7 @@ IsleApp::IsleApp()
|
||||
m_transitionType = MxTransitionManager::e_mosaic;
|
||||
m_cursorSensitivity = 4;
|
||||
m_touchScheme = LegoInputManager::e_gamepad;
|
||||
m_haptic = TRUE;
|
||||
}
|
||||
|
||||
// FUNCTION: ISLE 0x4011a0
|
||||
@ -791,7 +792,7 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
||||
SDL_Log("Game started");
|
||||
}
|
||||
}
|
||||
else if (event->user.type == g_legoSdlEvents.m_hitActor) {
|
||||
else if (event->user.type == g_legoSdlEvents.m_hitActor && g_isle->GetHaptic()) {
|
||||
if (InputManager()) {
|
||||
InputManager()->HandleRumbleEvent();
|
||||
}
|
||||
@ -1047,6 +1048,7 @@ bool IsleApp::LoadConfig()
|
||||
iniparser_set(dict, "isle:Max Allowed Extras", SDL_itoa(m_maxAllowedExtras, buf, 10));
|
||||
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");
|
||||
|
||||
#ifdef EXTENSIONS
|
||||
iniparser_set(dict, "extensions", NULL);
|
||||
@ -1118,6 +1120,7 @@ bool IsleApp::LoadConfig()
|
||||
m_transitionType =
|
||||
(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);
|
||||
|
||||
const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL);
|
||||
if (deviceId != NULL) {
|
||||
|
||||
@ -55,6 +55,7 @@ class IsleApp {
|
||||
MxS32 GetGameStarted() { return m_gameStarted; }
|
||||
MxFloat GetCursorSensitivity() { return m_cursorSensitivity; }
|
||||
LegoInputManager::TouchScheme GetTouchScheme() { return m_touchScheme; }
|
||||
MxBool GetHaptic() { return m_haptic; }
|
||||
|
||||
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
|
||||
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
|
||||
@ -105,6 +106,7 @@ class IsleApp {
|
||||
MxU32 m_maxAllowedExtras;
|
||||
MxTransitionManager::TransitionType m_transitionType;
|
||||
LegoInputManager::TouchScheme m_touchScheme;
|
||||
MxBool m_haptic;
|
||||
};
|
||||
|
||||
extern IsleApp* g_isle;
|
||||
|
||||
@ -153,7 +153,7 @@ class LegoInputManager : public MxPresenter {
|
||||
MxResult GetNavigationKeyStates(MxU32& p_keyFlags);
|
||||
MxResult GetNavigationTouchStates(MxU32& p_keyFlags);
|
||||
LEGO1_EXPORT MxBool HandleTouchEvent(SDL_Event* p_event, TouchScheme p_touchScheme);
|
||||
LEGO1_EXPORT void HandleRumbleEvent();
|
||||
LEGO1_EXPORT MxBool HandleRumbleEvent();
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1005b8d0
|
||||
// LegoInputManager::`scalar deleting destructor'
|
||||
|
||||
@ -627,13 +627,17 @@ MxBool LegoInputManager::HandleTouchEvent(SDL_Event* p_event, TouchScheme p_touc
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LegoInputManager::HandleRumbleEvent()
|
||||
MxBool LegoInputManager::HandleRumbleEvent()
|
||||
{
|
||||
if (m_joystick != NULL && SDL_GamepadConnected(m_joystick) == TRUE) {
|
||||
const Uint16 frequency = 65535 / 3;
|
||||
const Uint32 durationMs = 1000;
|
||||
const Uint16 frequency = 65535 / 2;
|
||||
const Uint32 durationMs = 700;
|
||||
SDL_RumbleGamepad(m_joystick, frequency, frequency, durationMs);
|
||||
}
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Add support for SDL Haptic API
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user