dont check number of controllers every frame

This commit is contained in:
Alug committed 2025-02-17 21:16:12 +01:00
1 parent 15f97ab8a4
commit 72322e5f42
5 files changed
+10 -2

No files matched your search

+1 -1
View File
@@ -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;
}
+2
View File
@@ -230,6 +230,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
@@ -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;
}
+4
View File
@@ -205,6 +205,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
@@ -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)
+2
View File
@@ -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++)