dont check number of controllers every frame

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

No files matched your search

+1 -1
View File
@@ -217,7 +217,7 @@ static void D_DeviceLEDTick(void)
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;
}
+2
View File
@@ -226,6 +226,8 @@ void I_InitJoystick4(void);
*/
INT32 I_NumJoys(void);
extern INT32 numcontrollers;
/** \brief The *I_GetJoyName function
\param joyindex which joystick
+1 -1
View File
@@ -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;
}
+4
View File
@@ -201,6 +201,8 @@ static char returnWadPath[256];
#include "../byteptr.h"
#endif
INT32 numcontrollers = 0;
#ifdef HAVE_LIBBACKTRACE
#include <backtrace.h>
// TODO - move this to some header file instead
@@ -1397,6 +1399,8 @@ void I_InitJoystick(UINT8 index)
joystick_started[index] = 0;
}
numcontrollers = I_NumJoys();
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (JoyInfo[i].dev == newcontroller)
+2
View File
@@ -1243,6 +1243,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++)