diff --git a/src/g_input.c b/src/g_input.c index 3177da488..105e84532 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -948,10 +948,10 @@ static void G_ResetPlayerDeviceRumble(INT32 player) return; } - I_GamepadRumble(device_id, 0, 0); + I_GamepadRumble(device_id, 0, 0, 0); } -void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength) +void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration) { INT32 device_id; @@ -967,7 +967,7 @@ void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strengt return; } - I_GamepadRumble(device_id, low_strength, high_strength); + I_GamepadRumble(device_id, low_strength, high_strength, duration); } // diff --git a/src/g_input.h b/src/g_input.h index dac5bd3f8..92444cccc 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -133,7 +133,7 @@ extern INT32 gamecontrol4[num_gamecontrols][2]; // check a gamecontrol being active or not void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color); -void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength); +void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration); // remaps the input event to a game control. void G_MapEventsToControls(event_t *ev); diff --git a/src/i_system.h b/src/i_system.h index 8239bade8..f49bca4a1 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -230,7 +230,7 @@ INT32 I_NumJoys(void); */ const char *I_GetJoyName(INT32 joyindex); -void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength); +void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength, UINT32 duration); void I_SetGamepadIndicatorColor(INT32 device_id, UINT8 red, UINT8 green, UINT8 blue); #ifndef NOMUMBLE diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 3ce53fad1..381e20e79 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3031,8 +3031,9 @@ static int lib_gPlayerDeviceRumble(lua_State *L) { INT32 player = -1; player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player - UINT16 low_strength = (INT32)luaL_checkinteger(L, 2); - UINT16 high_strength = (INT32)luaL_checkinteger(L, 3); + UINT16 low_strength = (INT32)luaL_checkinteger(L, 2); // low frequency rumble motor strenght + UINT16 high_strength = (INT32)luaL_checkinteger(L, 3); // high frequency rumble motor strenght + UINT32 duration = (INT32)luaL_checkinteger(L, 4); // duration of rumble in ms for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i) { @@ -3046,7 +3047,7 @@ static int lib_gPlayerDeviceRumble(lua_State *L) // Not a local player if (player == -1) return 0; - G_PlayerDeviceRumble(player, low_strength, high_strength); + G_PlayerDeviceRumble(player, low_strength, high_strength, duration); return 0; } diff --git a/src/p_tick.c b/src/p_tick.c index 0d98a0d59..0c99660d8 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -356,7 +356,7 @@ static inline void P_DeviceRumbleTick(void) } } - G_PlayerDeviceRumble(i, low, high); + G_PlayerDeviceRumble(i, low, high, 0); } } diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 454c1e295..eabe017c4 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2666,7 +2666,7 @@ const char *I_GetJoyName(INT32 joyindex) return joyname; } -void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength) +void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength, UINT32 duration) { #if !(SDL_VERSION_ATLEAST(2,0,14)) (void)device_id; @@ -2681,7 +2681,7 @@ void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength) return; } - SDL_GameControllerRumble(controller, low_strength, high_strength, 0); + SDL_GameControllerRumble(controller, low_strength, high_strength, duration); #endif }