diff --git a/src/d_main.c b/src/d_main.c index 0bfda85a2..b167bc60a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -214,10 +214,10 @@ static void D_GamePadMenuScrollTicker(void) static void D_DeviceLEDTick(void) { UINT8 i; - UINT16 color[MAXSPLITSCREENPLAYERS]; - UINT16 curcolor[MAXSPLITSCREENPLAYERS]; + static UINT16 color[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0}; + static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0}; - if (dedicated || I_NumJoys() == 0) + if (dedicated || numcontrollers == 0) { return; } diff --git a/src/g_input.c b/src/g_input.c index 168d51bf3..6f9d77cca 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -928,20 +928,17 @@ UINT16 G_GetSkinColor(INT32 playernum) { case 0: return cv_playercolor.value; - break; case 1: return cv_playercolor2.value; - break; case 2: return cv_playercolor3.value; - break; case 3: return cv_playercolor4.value; - break; default: return 0; - break; } + + return 0; } void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color) diff --git a/src/i_system.h b/src/i_system.h index 81cd80b68..2154d5db0 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -226,6 +226,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 5a55d23e3..717bffdc0 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -373,7 +373,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 65239b6a4..353fd0f82 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -201,6 +201,8 @@ static char returnWadPath[256]; #include "../byteptr.h" #endif +INT32 numcontrollers = 0; + #ifdef HAVE_LIBBACKTRACE #include // TODO - move this to some header file instead @@ -1170,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