From 4bb0c3913381832c09a4a4793ec7b46eff161c64 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sun, 5 Mar 2023 16:07:17 -0600 Subject: [PATCH] Fix controller delay in menus M_UpdateMenuCMD only needs to be called once per tick per player. It was being called for every event, which really mangled the repeat delays as more attached controllers sent axis events. --- src/d_main.c | 7 +++++++ src/k_menu.h | 1 + src/k_menufunc.c | 8 +------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 18acb191d..53ae4d86c 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -178,6 +178,7 @@ boolean capslock = 0; // gee i wonder what this does. void D_ProcessEvents(void) { event_t *ev; + int i; boolean eaten; boolean menuresponse = false; @@ -251,6 +252,12 @@ void D_ProcessEvents(void) { M_MapMenuControls(NULL); } + + // Update menu CMD + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + M_UpdateMenuCMD(i); + } } // diff --git a/src/k_menu.h b/src/k_menu.h index fb41a64a2..2271ab7b1 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -571,6 +571,7 @@ void Addons_option_Onchange(void); void M_SortServerList(void); void M_MapMenuControls(event_t *ev); +void M_UpdateMenuCMD(UINT8 i); boolean M_Responder(event_t *ev); boolean M_MenuButtonPressed(UINT8 pid, UINT32 bt); boolean M_MenuButtonHeld(UINT8 pid, UINT32 bt); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index ce9b07e2f..899099f12 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -691,7 +691,7 @@ void M_SetMenuDelay(UINT8 i) } } -static void M_UpdateMenuCMD(UINT8 i) +void M_UpdateMenuCMD(UINT8 i) { UINT8 mp = max(1, setup_numplayers); @@ -734,12 +734,6 @@ void M_MapMenuControls(event_t *ev) // update keys current state G_MapEventsToControls(ev); } - - // Update menu CMD - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) - { - M_UpdateMenuCMD(i); - } } boolean M_MenuButtonPressed(UINT8 pid, UINT32 bt)