properly init numcontrollers

This commit is contained in:
Alug committed 2025-02-17 21:30:36 +01:00
1 parent 31dabda1db
commit ceff2e9be6
2 files changed
+10 -9

No files matched your search

+5 -7
View File
@@ -1176,21 +1176,21 @@ void I_ShutdownJoystick(UINT8 index)
{
INT32 i;
event_t event;
event.type=ev_keyup;
event.type = ev_keyup;
event.data2 = 0;
event.data3 = 0;
lastjoybuttons[index] = lastjoyhats[index] = 0;
// emulate the up of all joystick buttons
for (i=0;i<JOYBUTTONS;i++)
for (i = 0; i < JOYBUTTONS; i++)
{
event.data1=KEY_JOY1+i;
event.data1=KEY_JOY1 + i;
D_PostEvent(&event);
}
// emulate the up of all joystick hats
for (i=0;i<JOYHATS*4;i++)
for (i = 0; i < JOYHATS*4; i++)
{
event.data1=KEY_HAT1+i;
D_PostEvent(&event);
@@ -1198,7 +1198,7 @@ void I_ShutdownJoystick(UINT8 index)
// reset joystick position
event.type = ev_joystick;
for (i=0;i<JOYAXISSET; i++)
for (i = 0; i < JOYAXISSET; i++)
{
event.data1 = i;
D_PostEvent(&event);
@@ -1409,8 +1409,6 @@ void I_InitJoystick(UINT8 index)
joystick_started[index] = 0;
}
numcontrollers = I_NumJoys();
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (JoyInfo[i].dev == newcontroller)
+5 -2
View File
@@ -1260,8 +1260,6 @@ void I_GetEvent(void)
G_SetPlayerGamepadIndicatorColor(i, G_GetSkinColor(i)); // gotta update the controller led again on reconnect
}
numcontrollers = I_NumJoys();
////////////////////////////////////////////////////////////
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
@@ -1271,6 +1269,8 @@ void I_GetEvent(void)
if (currentMenu == &OP_JoystickSetDef)
M_SetupJoystickMenu(0);
numcontrollers = I_NumJoys();
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (JoyInfo[i].dev == newcontroller)
@@ -1330,6 +1330,9 @@ void I_GetEvent(void)
// update the menu
if (currentMenu == &OP_JoystickSetDef)
M_SetupJoystickMenu(0);
numcontrollers = I_NumJoys();
break;
case SDL_DROPFILE:
dropped_filedir = evt.drop.file;