diff --git a/src/d_main.c b/src/d_main.c index 7e5843916..0ec8bd8dc 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -215,10 +215,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 460f21899..f0121f37d 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -895,20 +895,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 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 81897936e..92b6a1089 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 0353d1b70..391cd215d 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 @@ -1173,21 +1175,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