diff --git a/src/d_clisrv.c b/src/d_clisrv.c index d5d5cbcca..f91b15f58 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3276,6 +3276,7 @@ void CL_Reset(void) curl_running = false; http_source[0] = '\0'; #endif + G_ResetAllDeviceRumbles(); // D_StartTitle should get done now, but the calling function will handle it } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index c565ae13d..be73c8dd7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3122,6 +3122,8 @@ static void Got_Pause(UINT8 **cp, INT32 playernum) else S_ResumeAudio(); } + + G_ResetAllDeviceRumbles(); } static void Command_ReplayMarker(void) diff --git a/src/g_game.c b/src/g_game.c index 2258a6fba..502fb4e02 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1599,6 +1599,8 @@ void G_DoLoadLevel(boolean resetplayer) // clear hud messages remains (usually from game startup) CON_ClearHUD(); + + G_ResetAllDeviceRumbles(); } static INT32 pausedelay = 0; @@ -3017,6 +3019,8 @@ void G_AddPlayer(INT32 playernum) void G_ExitLevel(void) { + G_ResetAllDeviceRumbles(); + if (gamestate == GS_LEVEL) { gameaction = ga_completed; diff --git a/src/g_input.c b/src/g_input.c index a4046350d..ad7758a7a 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1013,6 +1013,21 @@ static void G_ResetPlayerDeviceRumble(INT32 player) I_GamepadRumble(device_id, 0, 0, 0); } +void G_ResetAllDeviceRumbles(void) +{ + int i; + int devices; + + devices = I_NumJoys(); + + for (i = 0; i < devices; i++) + { + INT32 device_id = G_GetDeviceForPlayer(i); + + I_GamepadRumble(device_id, 0, 0, 0); + } +} + void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration) { INT32 device_id; diff --git a/src/g_input.h b/src/g_input.h index 6799f6ca0..18fff51a4 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -138,6 +138,7 @@ UINT16 G_GetSkinColor(INT32 player); INT32 G_GetDeviceForPlayer(INT32 player); void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color); void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration); +void G_ResetAllDeviceRumbles(void); // remaps the input event to a game control. void G_MapEventsToControls(event_t *ev);