add duration field to G_PlayerDeviceRumble

duration is in ms
This commit is contained in:
Alug committed 2024-08-03 17:42:35 +02:00
1 parent acad230daa
commit 2afa18bbdd
6 files changed
+12 -11

No files matched your search

+3 -3
View File
@@ -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);
}
//
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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
+4 -3
View File
@@ -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;
}
+1 -1
View File
@@ -356,7 +356,7 @@ static inline void P_DeviceRumbleTick(void)
}
}
G_PlayerDeviceRumble(i, low, high);
G_PlayerDeviceRumble(i, low, high, 0);
}
}
+2 -2
View File
@@ -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
}