properly init numcontrollers

This commit is contained in:
Alug committed 2025-02-17 21:34:09 +01:00
1 parent 70a985e274
commit b4269cba3e
2 files changed
+10 -9

No files matched your search

+5 -7
View File
@@ -1172,21 +1172,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);
@@ -1194,7 +1194,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);
@@ -1399,8 +1399,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
@@ -1243,8 +1243,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++)
@@ -1254,6 +1252,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)
@@ -1313,6 +1313,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;