From 8788ad9aa0bd63569e664f656bbd748bbb9147a8 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 12 Sep 2025 21:08:05 +0200 Subject: [PATCH] reset our gamepad colour in some cases to account for mappalettes properly --- src/d_main.c | 9 ++++++++- src/d_main.h | 2 ++ src/p_setup.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 016c6ea0d..1505f7a5a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -220,11 +220,12 @@ static void D_GamePadMenuScrollTicker(void) } #undef SCROLLDELAY +static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0}; + static void D_DeviceLEDTick(void) { UINT8 i; static UINT16 color[MAXSPLITSCREENPLAYERS] = {0}; - static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0}; if (numcontrollers == 0) { @@ -246,6 +247,11 @@ static void D_DeviceLEDTick(void) } } +void D_ResetDeviceLED(void) +{ + memset(curcolor, 0, sizeof(curcolor)); +} + // // D_ProcessEvents // Send all the events of the given timestamp down the responder chain @@ -1081,6 +1087,7 @@ void D_StartTitle(void) D_ClearState(); M_ClearMenus(true); F_StartTitleScreen(); + D_ResetDeviceLED(); } // diff --git a/src/d_main.h b/src/d_main.h index 787e298ab..fe904e15a 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -87,6 +87,8 @@ void D_ProcessEvents(void); const char *D_Home(void); +void D_ResetDeviceLED(void); + // // BASE LEVEL // diff --git a/src/p_setup.c b/src/p_setup.c index 6301eaadb..b17586ea6 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3039,6 +3039,8 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate) if (!reloadinggamestate) K_LoadExtraVFX(); + D_ResetDeviceLED(); + return true; }