diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 87c1da33..c3035de6 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -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) { diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 3322427e..180c2252 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -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; diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index f850f9e3..ee87b50a 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -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' diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 4cbd6d93..7c80e78e 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -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; }