diff --git a/src/d_main.c b/src/d_main.c index 16b7d5fb7..ccce30fb3 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -218,7 +218,7 @@ static void D_DeviceLEDTick(void) UINT16 color[MAXSPLITSCREENPLAYERS]; UINT16 curcolor[MAXSPLITSCREENPLAYERS]; - if (dedicated || I_NumJoys() == 0) + if (dedicated || numcontrollers == 0) { return; } diff --git a/src/i_system.h b/src/i_system.h index 1f5226fee..10cd0529b 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -230,6 +230,8 @@ void I_InitJoystick4(void); */ INT32 I_NumJoys(void); +extern INT32 numcontrollers; + /** \brief The *I_GetJoyName function \param joyindex which joystick diff --git a/src/p_tick.c b/src/p_tick.c index 0364e30b1..8204095d1 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -368,7 +368,7 @@ static void P_DeviceRumbleTick(void) { UINT8 i; - if (dedicated || I_NumJoys() == 0 || gamestate != GS_LEVEL) + if (dedicated || numcontrollers == 0 || gamestate != GS_LEVEL) { return; } diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 026f0c317..96a601c76 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -205,6 +205,8 @@ static char returnWadPath[256]; #include "../byteptr.h" #endif +INT32 numcontrollers = 0; + #ifdef HAVE_LIBBACKTRACE #include // TODO - move this to some header file instead @@ -1407,6 +1409,8 @@ void I_InitJoystick(UINT8 index) joystick_started[index] = 0; } + numcontrollers = I_NumJoys(); + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { if (JoyInfo[i].dev == newcontroller) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index f60ae4eee..a5af143cc 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1260,6 +1260,8 @@ 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++)