mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Pause local games if a player's gamepad disconnects
This commit is contained in:
parent
fa5e8a5537
commit
1a6d27897e
1 changed files with 10 additions and 3 deletions
|
|
@ -227,11 +227,9 @@ static void HandleGamepadDeviceRemoved(event_t *ev)
|
|||
int i = 0;
|
||||
I_Assert(ev != NULL);
|
||||
I_Assert(ev->type == ev_gamepad_device_removed);
|
||||
|
||||
G_UnregisterAvailableGamepad(ev->device);
|
||||
CONS_Alert(CONS_NOTICE, "Gamepad device %d disconnected\n", ev->device);
|
||||
|
||||
// Downstream responders need to update player gamepad assignments, pause, etc
|
||||
boolean playerinterrupted = false;
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
|
|
@ -239,8 +237,17 @@ static void HandleGamepadDeviceRemoved(event_t *ev)
|
|||
if (device == ev->device)
|
||||
{
|
||||
G_SetDeviceForPlayer(i, -1);
|
||||
playerinterrupted = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Downstream responders need to update player gamepad assignments, pause, etc
|
||||
G_UnregisterAvailableGamepad(ev->device);
|
||||
|
||||
if (playerinterrupted && Playing() && !netgame && !demo.playback)
|
||||
{
|
||||
M_StartControlPanel();
|
||||
}
|
||||
}
|
||||
|
||||
/// Respond to added/removed device events, for bookkeeping available gamepads.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue