From 1d2ec19c6e768d12c69d4fb31764f2211984028f Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Wed, 27 Aug 2025 21:55:46 -0400 Subject: [PATCH] Voice menu fixups, apply tempmutes to guest/spectator --- src/d_clisrv.c | 13 +++++++++++-- src/k_serverstats.c | 13 +++++++++---- src/menus/options-sound.cpp | 19 ++++++++++++++++--- src/menus/options-voice.cpp | 4 ++++ 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c2dc256cf..afbdb83ae 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -234,6 +234,8 @@ static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL}; static tic_t stop_spamming[MAXPLAYERS]; +static boolean IsPlayerGuest(UINT8 player); + // Generate a message for an authenticating client to sign, with some guarantees about who we are. void GenerateChallenge(uint8_t *buf) { @@ -3825,6 +3827,7 @@ static void Got_AddPlayer(const UINT8 **p, INT32 playernum) } HU_AddChatText(joinmsg, false); + SV_UpdateTempMutes(); } @@ -3934,7 +3937,13 @@ static void Got_ServerTempMutePlayer(const UINT8 **p, INT32 playernum) { players[forplayer].pflags2 |= PF2_SERVERTEMPMUTE; if (P_IsMachineLocalPlayer(&players[forplayer])) - HU_AddChatText(va("\x82* You are temporarily muted until you finish more rounds."), false); + { + if (IsPlayerGuest(playernum)) + HU_AddChatText(va("\x82* GUESTs cannot use chat on this server. Create a profile to join in!"), false); + else + HU_AddChatText(va("\x82* You are temporarily muted until you finish more rounds."), false); + } + } else if (!muted && players[forplayer].pflags2 & PF2_SERVERTEMPMUTE) { @@ -4343,7 +4352,7 @@ static size_t TotalTextCmdPerTic(tic_t tic) } #endif -static boolean IsPlayerGuest(int player) +static boolean IsPlayerGuest(UINT8 player) { return PR_IsKeyGuest(players[player].public_key); } diff --git a/src/k_serverstats.c b/src/k_serverstats.c index 32564da9d..5a29dc313 100644 --- a/src/k_serverstats.c +++ b/src/k_serverstats.c @@ -332,13 +332,18 @@ void SV_UpdateTempMutes(void) { if (!playeringame[i]) continue; - if (players[i].spectator) - continue; - if (PR_IsKeyGuest(players[i].public_key)) - continue; player_t *player = &players[i]; + if (PR_IsKeyGuest(player->public_key)) + { + if (cv_gamestochat.value && !(player->pflags2 & PF2_SERVERTEMPMUTE)) + SV_UpdateTempMute(player, false); + continue; + } + + + serverplayer_t *stat = SV_GetStatsByPlayerIndex(i); if (i == serverplayer || IsPlayerAdmin(i)) diff --git a/src/menus/options-sound.cpp b/src/menus/options-sound.cpp index 3d1c29d22..35dc448ac 100644 --- a/src/menus/options-sound.cpp +++ b/src/menus/options-sound.cpp @@ -63,8 +63,11 @@ struct Slider arrows.x(-10 - ofs).text("\x1C"); arrows.x(kWidth + 2 + ofs).text("\x1D"); - Draw::TextElement tx = Draw::TextElement().parse(""); - h.xy(kWidth + 9, -2).text(tx.string()); + if (&volume_ != &cv_voicevolume) + { + Draw::TextElement tx = Draw::TextElement().parse(""); + h.xy(kWidth + 9, -2).text(tx.string()); + } } h = h.y(1); @@ -85,7 +88,7 @@ struct Slider n = std::atoi(volume_.defaultvalue); h.x(1 + shake_ + n + (n / 10)).size(1, 7).fill(35); - if (!toggle_(false)) + if (!toggle_(false) && &volume_ != &cv_voicevolume) { h .x(kWidth / 2) @@ -94,6 +97,16 @@ struct Slider .flags(V_40TRANS) .text("S I L E N T"); } + else if (!toggle_(false)) + { + h + .x(kWidth / 2) + .y(-1) + .font(Draw::Font::kThin) + .align(Draw::Align::kCenter) + .flags(V_20TRANS) + .text("DEAFENED (Voice Options)"); + } } void input(INT32 c) diff --git a/src/menus/options-voice.cpp b/src/menus/options-voice.cpp index 3e7d74d8d..f4be45c30 100644 --- a/src/menus/options-voice.cpp +++ b/src/menus/options-voice.cpp @@ -60,6 +60,10 @@ static void draw_routine() V_DrawFill(x, y, range + 2, 10, 31); V_DrawFill(x + 1, y + 1, (int) last_peak, 8, color); + if (!detected) + V_DrawThinString(x+1, y+1, V_20TRANS, "Not transmitting..."); + else + V_DrawThinString(x+1, y+1, V_20TRANS|V_GREENMAP, "Transmitting"); } static void tick_routine()