From bb3414d603313d6468c413e0ee6847a7a05fa447 Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 21 Mar 2026 23:10:48 +0300 Subject: [PATCH 1/3] Fix /pm and emote suggestions overlapping --- src/hu_stuff.c | 126 ++++++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 60 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 6ede89fc6..72203c8fe 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -97,7 +97,6 @@ static textinput_t w_chat; static boolean headsupactive = false; boolean hu_showscores = false; // draw rankings static char hu_tick; -static tic_t hu_emoteanim = 0; emote_autocomplete_t emote_autocomplete = {0}; static huddrawlist_h luahuddrawlist_scores = NULL; @@ -1095,7 +1094,6 @@ void HU_Ticker(void) return; hu_tick++; - hu_emoteanim++; hu_tick &= 7; // currently only to blink chat input cursor if (PLAYER1INPUTDOWN(gc_scores)) @@ -1810,6 +1808,7 @@ static void HU_DrawChat(void) INT32 t = 0, c = 0, y = chaty - (typelines*charheight); UINT32 i = 0, saylen = strlen(w_chat_buf); // You learn new things everyday! INT32 cflag = 0; + INT32 pm_offset = 0; // for cases when you type emote while also doing /pm size_t select_start = 0, select_end = 0; const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; @@ -1921,64 +1920,6 @@ static void HU_DrawChat(void) } } - if (emote_autocomplete.emotestart != -1 && (emote_autocomplete.complete[0] || (w_chat.cursor - emote_autocomplete.emotestart) > 1)) - { - emote_t *suggest; - int skip = 0; - - const char *complete; - int complete_len; - - if (emote_autocomplete.complete[0]) - { - complete = emote_autocomplete.complete; - complete_len = strlen(complete); - } - else - { - complete = &w_chat_buf[emote_autocomplete.emotestart]; - complete_len = w_chat.cursor - emote_autocomplete.emotestart; - } - - // A bit of copy-paste from /pm code :p - INT32 suggesty = chaty - charheight - 1; - size_t longest_suggestion_length = 0; - - while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL) - { - longest_suggestion_length = max(longest_suggestion_length, strlen(suggest->name)); - ++skip; - } - - skip = 0; - -#ifdef NETSPLITSCREEN - if (splitscreen) - { - suggesty -= BASEVIDHEIGHT/2; - if (splitscreen > 1) - suggesty += 16; - } - else -#endif - suggesty -= (cv_kartspeedometer.value ? 16 : 0); - - while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL) - { - V_DrawFillConsoleMap(chatx + boxw + 2, suggesty - (7*skip), (longest_suggestion_length+2)*4 + EMOTEWIDTH, 6, V_SNAPTOBOTTOM|V_SNAPTOLEFT); - - // Highlight currently suggested emote - int hlflag = 0; - if (skip == emote_autocomplete.skip && emote_autocomplete.complete[0]) - hlflag = V_YELLOWMAP; - - V_DrawSmallString(chatx + boxw + 4 + EMOTEWIDTH, suggesty - (7*skip), hlflag|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", suggest->name)); - M_DrawEmote(chatx + boxw + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT); - - ++skip; - } - } - // handle /pm list. It's messy, horrible and I don't care. if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai { @@ -2059,9 +2000,74 @@ static void HU_DrawChat(void) if (count == 0) // no results. { + pm_offset = 48 + 2; V_DrawFillConsoleMap(chatx + boxw + 2, p_dispy - (6*count), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud. V_DrawSmallString(chatx + boxw + 4, p_dispy - (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, "NO RESULT."); } + else + { + pm_offset = (longest_name_length+4)*4 + 2; + } + } + + if (emote_autocomplete.emotestart != -1 && (emote_autocomplete.complete[0] || (w_chat.cursor - emote_autocomplete.emotestart) > 1)) + { + emote_t *suggest; + int skip = 0; + + const char *complete; + int complete_len; + + if (emote_autocomplete.complete[0]) + { + complete = emote_autocomplete.complete; + complete_len = strlen(complete); + } + else + { + complete = &w_chat_buf[emote_autocomplete.emotestart]; + complete_len = w_chat.cursor - emote_autocomplete.emotestart; + } + + // A bit of copy-paste from /pm code :p + INT32 suggesty = chaty - charheight - 1; + size_t longest_suggestion_length = 0; + + while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL) + { + longest_suggestion_length = max(longest_suggestion_length, strlen(suggest->name)); + ++skip; + } + + INT32 emote_suggest_boxw = (longest_suggestion_length+2)*4 + EMOTEWIDTH; + + skip = 0; + +#ifdef NETSPLITSCREEN + if (splitscreen) + { + suggesty -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + suggesty += 16; + } + else +#endif + suggesty -= (cv_kartspeedometer.value ? 16 : 0); + + while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL) + { + V_DrawFillConsoleMap(chatx + boxw + pm_offset + 2, suggesty - (7*skip), emote_suggest_boxw, 6, V_SNAPTOBOTTOM|V_SNAPTOLEFT); + + // Highlight currently suggested emote + int hlflag = 0; + if (skip == emote_autocomplete.skip && emote_autocomplete.complete[0]) + hlflag = V_YELLOWMAP; + + V_DrawSmallString(chatx + boxw + pm_offset + 4 + EMOTEWIDTH, suggesty - (7*skip), hlflag|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", suggest->name)); + M_DrawEmote(chatx + boxw + pm_offset + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT); + + ++skip; + } } HU_drawChatLog(typelines - 1); // typelines is the # of lines we're typing. If there's more than 1 then the log should scroll up to give us more space. From 6721f534ccdd5c2950bfc67c3c1d31dc8cad164d Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 22 Mar 2026 22:16:55 +0300 Subject: [PATCH 2/3] Fix Got_Saycmd not skipping null terminator when message has maximum length --- src/hu_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 72203c8fe..91f9ca7d1 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -906,7 +906,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum) target = READSINT8(*p); flags = READUINT8(*p); msg = buf; - READSTRINGL(*p, msg, HU_MAXMSGLEN + 1); + READSTRINGN(*p, msg, HU_MAXMSGLEN + 1); if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum))) { From 1c74b3702610ed030cc68a729719c04a7b6c03f8 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 22 Mar 2026 22:13:37 +0100 Subject: [PATCH 3/3] unify console shift handling both the non AZERTY and AZERTY functions basically did the exact same thing so can just get rid of one also simplify some checks --- src/console.c | 56 +++++++---------------------------------------- src/console.h | 1 - src/d_main.c | 2 +- src/m_menu.c | 2 +- src/m_textinput.c | 4 ++-- 5 files changed, 12 insertions(+), 53 deletions(-) diff --git a/src/console.c b/src/console.c index 7276b59c8..d185858f9 100644 --- a/src/console.c +++ b/src/console.c @@ -638,68 +638,28 @@ INT32 CON_ShiftChar(INT32 ch) if (I_UseNativeKeyboard()) return ch; - if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) - { - if (cv_keyboardlayout.value == 3) - { - if (shiftdown ^ capslock) - ch = shiftxform[ch]; - else if (altdown & 0x2) - ch = french_altgrxform[ch]; - else - ch = HU_FallBackFrSpecialLetter(ch); - } - else - { - if (shiftdown ^ capslock) - ch = shiftxform[ch]; - } - } - else // if we're holding shift we should still shift non letter symbols - { - if (cv_keyboardlayout.value == 3) - { - if (shiftdown) - ch = shiftxform[ch]; - else if (altdown & 0x2) - ch = french_altgrxform[ch]; - else - ch = HU_FallBackFrSpecialLetter(ch); - } - else - { - if (shiftdown) - ch = shiftxform[ch]; - } - } - - return ch; -} - -INT32 CON_ShitAndAltGrChar(INT32 ch) -{ if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { if (shiftdown ^ capslock) ch = shiftxform[ch]; } - else // if we're holding shift we should still shift non letter symbols + else // if we're holding shift we should still shift non letter symbols { if (shiftdown) ch = shiftxform[ch]; - else if (altdown & 0x2) + else if (cv_keyboardlayout.value == 3) { - ch = french_altgrxform[ch]; - } - else - { - ch = HU_FallBackFrSpecialLetter(ch); + if (altdown & 0x2) + ch = french_altgrxform[ch]; + else + ch = HU_FallBackFrSpecialLetter(ch); } } return ch; } + // Clear time of console heads up messages // void CON_ClearHUD(void) @@ -892,7 +852,7 @@ boolean CON_Responder(event_t *ev) return true; // ctrl modifier -- changes behavior, adds shortcuts - if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown)) + if (ctrldown && (cv_keyboardlayout.value != 3 || (cv_keyboardlayout.value == 3 && !altdown))) { // show all cvars/commands that match what we have inputted if (key == KEY_TAB) diff --git a/src/console.h b/src/console.h index 3292bc6e3..abb506609 100644 --- a/src/console.h +++ b/src/console.h @@ -49,7 +49,6 @@ extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *or extern UINT8 *consolebgmap; INT32 CON_ShiftChar(INT32 ch); -INT32 CON_ShitAndAltGrChar(INT32 ch); void CON_SetupBackColormap(void); void CON_ClearHUD(void); // clear heads up messages diff --git a/src/d_main.c b/src/d_main.c index 0ecce2047..ccfa61f4e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1208,7 +1208,7 @@ void D_AddPostloadFiles(void) static boolean AddIWAD(const char * file, const char *dir) { - char * path = va(pandf, dir, file); + char *path = va(pandf, dir, file); if (FIL_ReadFileOK(path)) { diff --git a/src/m_menu.c b/src/m_menu.c index 26b7213ab..3128b1e15 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7950,7 +7950,7 @@ static void M_DrawSetupMultiPlayerMenu(void) patch_t *statbg = (patch_t *)W_CachePatchName("K_STATBG", PU_PATCH); patch_t *statlr = (patch_t *)W_CachePatchName("K_STATLR", PU_PATCH); patch_t *statud = (patch_t *)W_CachePatchName("K_STATUD", PU_PATCH); - patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0", PU_PATCH); + patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0" , PU_PATCH); patch_t *patch; UINT8 frame; UINT8 speed; diff --git a/src/m_textinput.c b/src/m_textinput.c index 7d050dfc7..c49294094 100644 --- a/src/m_textinput.c +++ b/src/m_textinput.c @@ -256,7 +256,7 @@ static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emot return true; } - if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown)) + if (ctrldown && (cv_keyboardlayout.value != 3 || (cv_keyboardlayout.value == 3 && !altdown))) { if (key == 'x' || key == 'X') { @@ -392,7 +392,7 @@ static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emot key = '/'; // same capslock code as hu_stuff.c's HU_responder. Check there for details. - key = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(key) : CON_ShiftChar(key); + key = CON_ShiftChar(key); // enter a char into the command prompt if (key < 32 || key > 127)