Add G_ functions to rumble a player's device

This commit is contained in:
Eidolon 2023-03-25 21:25:15 -05:00 committed by toaster
parent 769ce2ef65
commit 17daf1aeba
2 changed files with 33 additions and 0 deletions

View file

@ -208,6 +208,8 @@ void G_SetDeviceForPlayer(INT32 player, INT32 device)
if (device > 0) if (device > 0)
{ {
I_SetGamepadPlayerIndex(device, -1); I_SetGamepadPlayerIndex(device, -1);
I_GamepadRumble(device, 0, 0);
I_GamepadRumbleTriggers(device, 0, 0);
} }
} }
} }
@ -327,6 +329,34 @@ void G_ResetAllDeviceResponding(void)
} }
} }
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength)
{
INT32 device_id;
device_id = G_GetDeviceForPlayer(player);
if (device_id < 1)
{
return;
}
I_GamepadRumble(device_id, low_strength, high_strength);
}
void G_PlayerDeviceRumbleTriggers(INT32 player, UINT16 left_strength, UINT16 right_strength)
{
INT32 device_id;
device_id = G_GetDeviceForPlayer(player);
if (device_id < 1)
{
return;
}
I_GamepadRumbleTriggers(device_id, left_strength, right_strength);
}
static boolean AutomaticControllerReassignmentIsAllowed(INT32 device) static boolean AutomaticControllerReassignmentIsAllowed(INT32 device)
{ {
boolean device_is_gamepad = device > 0; boolean device_is_gamepad = device > 0;

View file

@ -159,6 +159,9 @@ void G_SetDeviceForPlayer(INT32 player, INT32 device);
void G_SetPlayerGamepadIndicatorToPlayerColor(INT32 player); void G_SetPlayerGamepadIndicatorToPlayerColor(INT32 player);
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength);
void G_PlayerDeviceRumbleTriggers(INT32 player, UINT16 left_strength, UINT16 right_strength);
/// Get the gamekeydown array (NUMINPUTS values) for the given device, or NULL if the device id is invalid. /// Get the gamekeydown array (NUMINPUTS values) for the given device, or NULL if the device id is invalid.
INT32* G_GetDeviceGameKeyDownArray(INT32 device); INT32* G_GetDeviceGameKeyDownArray(INT32 device);