Voice menu fixups, apply tempmutes to guest/spectator

This commit is contained in:
Antonio Martinez 2025-08-27 21:55:46 -04:00
parent 8a87f0ed7d
commit 1d2ec19c6e
4 changed files with 40 additions and 9 deletions

View file

@ -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);
}

View file

@ -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))

View file

@ -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("<z_animated>");
h.xy(kWidth + 9, -2).text(tx.string());
if (&volume_ != &cv_voicevolume)
{
Draw::TextElement tx = Draw::TextElement().parse("<z_animated>");
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)

View file

@ -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()