Merge branch 'chatclose' into 'master'

Improved netgame chat input eating

See merge request kart-krew-dev/ring-racers!40
This commit is contained in:
Eidolon 2025-10-17 15:46:10 -05:00
commit 6fcfd452aa
7 changed files with 14 additions and 4 deletions

View file

@ -2247,7 +2247,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
I_lock_mutex(&k_menu_mutex); I_lock_mutex(&k_menu_mutex);
#endif #endif
M_UpdateMenuCMD(0, true); M_UpdateMenuCMD(0, true, false);
if (cl_mode == CL_CONFIRMCONNECT) if (cl_mode == CL_CONFIRMCONNECT)
{ {

View file

@ -343,7 +343,7 @@ void D_ProcessEvents(boolean callresponders)
// Update menu CMD // Update menu CMD
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
M_UpdateMenuCMD(i, false); M_UpdateMenuCMD(i, false, chat_keydown);
} }
} }

View file

@ -1413,6 +1413,7 @@ boolean G_Responder(event_t *ev)
if (HU_Responder(ev)) if (HU_Responder(ev))
{ {
hu_keystrokes = true; hu_keystrokes = true;
chat_keydown = true;
return true; // chat ate the event return true; // chat ate the event
} }
} }
@ -1522,6 +1523,7 @@ boolean G_Responder(event_t *ev)
return true; return true;
case ev_keyup: case ev_keyup:
chat_keydown = false; // prevents repeat inputs from inputs made with chat open
return false; // always let key up events filter down return false; // always let key up events filter down
case ev_mouse: case ev_mouse:

View file

@ -85,6 +85,7 @@ patch_t *frameslash; // framerate stuff. Used in screen.c
static player_t *plr; static player_t *plr;
boolean hu_keystrokes; // :) boolean hu_keystrokes; // :)
boolean chat_keydown;
boolean chat_on; // entering a chat message? boolean chat_on; // entering a chat message?
boolean g_voicepushtotalk_on; // holding PTT? boolean g_voicepushtotalk_on; // holding PTT?
static char w_chat[HU_MAXMSGLEN + 1]; static char w_chat[HU_MAXMSGLEN + 1];

View file

@ -124,6 +124,9 @@ typedef enum
// some functions // some functions
void HU_AddChatText(const char *text, boolean playsound); void HU_AddChatText(const char *text, boolean playsound);
// set true when key is pressed while chat is open
extern boolean chat_keydown;
// set true when entering a chat message // set true when entering a chat message
extern boolean chat_on; extern boolean chat_on;

View file

@ -748,7 +748,7 @@ void M_SetMenuDelay(UINT8 i);
void M_SortServerList(void); void M_SortServerList(void);
void M_UpdateMenuCMD(UINT8 i, boolean bailrequired); void M_UpdateMenuCMD(UINT8 i, boolean bailrequired, boolean chat_open);
boolean M_Responder(event_t *ev); boolean M_Responder(event_t *ev);
boolean M_MenuButtonPressed(UINT8 pid, UINT32 bt); boolean M_MenuButtonPressed(UINT8 pid, UINT32 bt);
boolean M_MenuButtonHeld(UINT8 pid, UINT32 bt); boolean M_MenuButtonHeld(UINT8 pid, UINT32 bt);

View file

@ -1084,7 +1084,7 @@ void M_SetMenuDelay(UINT8 i)
} }
} }
void M_UpdateMenuCMD(UINT8 i, boolean bailrequired) void M_UpdateMenuCMD(UINT8 i, boolean bailrequired, boolean chat_open)
{ {
UINT8 mp = max(1, setup_numplayers); UINT8 mp = max(1, setup_numplayers);
@ -1097,6 +1097,10 @@ void M_UpdateMenuCMD(UINT8 i, boolean bailrequired)
menucmd[i].buttonsHeld = menucmd[i].buttons; menucmd[i].buttonsHeld = menucmd[i].buttons;
menucmd[i].buttons = 0; menucmd[i].buttons = 0;
// Eat inputs made when chat is open
if (chat_open)
return;
if (G_PlayerInputDown(i, gc_screenshot, mp)) { menucmd[i].buttons |= MBT_SCREENSHOT; } if (G_PlayerInputDown(i, gc_screenshot, mp)) { menucmd[i].buttons |= MBT_SCREENSHOT; }
if (G_PlayerInputDown(i, gc_startmovie, mp)) { menucmd[i].buttons |= MBT_STARTMOVIE; } if (G_PlayerInputDown(i, gc_startmovie, mp)) { menucmd[i].buttons |= MBT_STARTMOVIE; }
if (G_PlayerInputDown(i, gc_startlossless, mp)) { menucmd[i].buttons |= MBT_STARTLOSSLESS; } if (G_PlayerInputDown(i, gc_startlossless, mp)) { menucmd[i].buttons |= MBT_STARTLOSSLESS; }