"Deafen" and "Server Voice Chat" now have new variables

cv_voice_chat -> cv_voice_selfdeafen & cv_voice_servermute -> cv_voice_allowservervoice
This commit is contained in:
VelocitOni 2025-07-24 22:54:43 -04:00
parent 283e010301
commit 29d1dcef2d
10 changed files with 25 additions and 25 deletions

View file

@ -1371,7 +1371,7 @@ consvar_t cv_consolechat = Player("chatmode", "Yes").values({{0, "Yes"}, {2, "No
// When off, inbound voice packets are ignored // When off, inbound voice packets are ignored
void VoiceChat_OnChange(void); void VoiceChat_OnChange(void);
consvar_t cv_voice_chat = Player("voice_chat", "On") consvar_t cv_voice_selfdeafen = Player("voice_chat", "On")
.on_off() .on_off()
.onchange(VoiceChat_OnChange) .onchange(VoiceChat_OnChange)
.description("Whether voice chat is played or not. Shown as self-deafen to others."); .description("Whether voice chat is played or not. Shown as self-deafen to others.");
@ -1432,11 +1432,11 @@ consvar_t cv_voice_concurrentattenuation_max = NetVar("voice_concurrentattenuati
.description("Maximum concurrent speakers at which full global attenuation is applied"); .description("Maximum concurrent speakers at which full global attenuation is applied");
void Mute_OnChange(void); void Mute_OnChange(void);
void VoiceMute_OnChange(void); void AllowServerVC_OnChange(void);
consvar_t cv_mute = UnsavedNetVar("mute", "Off").on_off().onchange(Mute_OnChange); consvar_t cv_mute = UnsavedNetVar("mute", "Off").on_off().onchange(Mute_OnChange);
consvar_t cv_voice_servermute = NetVar("voice_servermute", "Off") consvar_t cv_voice_allowservervoice = NetVar("voice_allowservervoice", "Off")
.on_off() .on_off()
.onchange(VoiceMute_OnChange) .onchange(AllowServerVC_OnChange)
.description("If Off, the server will not broadcast voice chat to clients"); .description("If Off, the server will not broadcast voice chat to clients");

View file

@ -1088,7 +1088,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
netbuffer->u.serverinfo.kartvars = (UINT8) ( netbuffer->u.serverinfo.kartvars = (UINT8) (
(gamespeed & SV_SPEEDMASK) | (gamespeed & SV_SPEEDMASK) |
(dedicated ? SV_DEDICATED : 0) | (dedicated ? SV_DEDICATED : 0) |
(!cv_voice_servermute.value ? SV_VOICEENABLED : 1) (!cv_voice_allowservervoice.value ? SV_VOICEENABLED : 1)
); );
D_ParseCarets(netbuffer->u.serverinfo.servername, cv_servername.string, MAXSERVERNAME); D_ParseCarets(netbuffer->u.serverinfo.servername, cv_servername.string, MAXSERVERNAME);
@ -5275,7 +5275,7 @@ static void PT_HandleVoiceClient(SINT8 node, boolean isserver)
{ {
continue; continue;
} }
if (cv_voice_chat.value != 1 && playernum != g_localplayers[0]) if (cv_voice_selfdeafen.value != 1 && playernum != g_localplayers[0])
{ {
S_QueueVoiceFrameFromPlayer(playernum, (void*)decoded_out, decoded_samples * sizeof(float), false); S_QueueVoiceFrameFromPlayer(playernum, (void*)decoded_out, decoded_samples * sizeof(float), false);
} }
@ -5289,7 +5289,7 @@ static void PT_HandleVoiceClient(SINT8 node, boolean isserver)
return; return;
} }
if (cv_voice_chat.value != 1 && playernum != g_localplayers[0]) if (cv_voice_selfdeafen.value != 1 && playernum != g_localplayers[0])
{ {
S_QueueVoiceFrameFromPlayer(playernum, (void*)decoded_out, decoded_samples * sizeof(float), terminal); S_QueueVoiceFrameFromPlayer(playernum, (void*)decoded_out, decoded_samples * sizeof(float), terminal);
} }
@ -5306,9 +5306,9 @@ static void PT_HandleVoiceServer(SINT8 node)
int playernum = -1; int playernum = -1;
player_t *player; player_t *player;
if (cv_voice_servermute.value != 0) if (cv_voice_allowservervoice.value != 0)
{ {
// Don't even relay voice packets if voice_servermute is on // Don't even relay voice packets if voice_allowservervoice is on
return; return;
} }
@ -7474,7 +7474,7 @@ void NetVoiceUpdate(void)
continue; continue;
} }
if (cv_voice_chat.value == 1) if (cv_voice_selfdeafen.value == 1)
{ {
g_local_voice_buffer_len = 0; g_local_voice_buffer_len = 0;
continue; continue;

View file

@ -1224,7 +1224,7 @@ void WeaponPref_Send(UINT8 ssplayer)
if (cv_voice_selfmute.value) if (cv_voice_selfmute.value)
prefs |= WP_SELFMUTE; prefs |= WP_SELFMUTE;
if (!cv_voice_chat.value) if (!cv_voice_selfdeafen.value)
prefs |= WP_SELFDEAFEN; prefs |= WP_SELFDEAFEN;
} }
@ -7103,13 +7103,13 @@ void Mute_OnChange(void)
HU_AddChatText(M_GetText("\x82*Chat is no longer muted."), false); HU_AddChatText(M_GetText("\x82*Chat is no longer muted."), false);
} }
void VoiceMute_OnChange(void); void AllowServerVC_OnChange(void);
void VoiceMute_OnChange(void) void AllowServerVC_OnChange(void)
{ {
if (leveltime <= 1) if (leveltime <= 1)
return; // avoid having this notification put in our console / log when we boot the server. return; // avoid having this notification put in our console / log when we boot the server.
if (cv_voice_servermute.value) if (cv_voice_allowservervoice.value)
HU_AddChatText(M_GetText("\x82*Voice chat is no longer muted."), false); HU_AddChatText(M_GetText("\x82*Voice chat is no longer muted."), false);
else else
HU_AddChatText(M_GetText("\x82*Voice chat has been muted."), false); HU_AddChatText(M_GetText("\x82*Voice chat has been muted."), false);

View file

@ -62,7 +62,7 @@ extern consvar_t cv_netstat;
extern consvar_t cv_countdowntime; extern consvar_t cv_countdowntime;
extern consvar_t cv_mute; extern consvar_t cv_mute;
extern consvar_t cv_voice_servermute; extern consvar_t cv_voice_allowservervoice;
extern consvar_t cv_pause; extern consvar_t cv_pause;
extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_maxplayers, cv_shuffleloser; extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_maxplayers, cv_shuffleloser;

View file

@ -2967,7 +2967,7 @@ void PositionFacesInfo::draw_1p()
} }
// Voice speaking indicator // Voice speaking indicator
if (netgame && !players[rankplayer[i]].bot && cv_voice_servermute.value == 0) if (netgame && !players[rankplayer[i]].bot && cv_voice_allowservervoice.value == 0)
{ {
patch_t *voxmic; patch_t *voxmic;
if (S_IsPlayerVoiceActive(rankplayer[i])) if (S_IsPlayerVoiceActive(rankplayer[i]))
@ -8081,7 +8081,7 @@ void K_drawKartHUD(void)
} }
} }
if (netgame && cv_voice_servermute.value == 1) if (netgame && cv_voice_allowservervoice.value == 1)
{ {
if (players[consoleplayer].pflags2 & (PF2_SELFMUTE | PF2_SERVERMUTE | PF2_SELFDEAFEN | PF2_SERVERDEAFEN)) if (players[consoleplayer].pflags2 & (PF2_SELFMUTE | PF2_SERVERMUTE | PF2_SELFDEAFEN | PF2_SERVERDEAFEN))
{ {

View file

@ -90,7 +90,7 @@ menuitem_t OPTIONS_Server[] =
NULL, {NULL}, 0, 0}, NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Server Voice Chat", "All voice chat will be disabled on your server.", {IT_STRING | IT_CVAR, "Server Voice Chat", "All voice chat will be disabled on your server.",
NULL, {.cvar = &cv_voice_servermute}, 0, 0}, NULL, {.cvar = &cv_voice_allowservervoice}, 0, 0},
{IT_STRING | IT_CVAR, "Proximity Effects", "Player voices will be adjusted relative to you.", {IT_STRING | IT_CVAR, "Proximity Effects", "Player voices will be adjusted relative to you.",
NULL, {.cvar = &cv_voice_proximity}, 0, 0}, NULL, {.cvar = &cv_voice_proximity}, 0, 0},

View file

@ -121,7 +121,7 @@ std::array<Slider, Slider::kNumSliders> sliders{{
n = !n; n = !n;
CV_SetValue(&cv_gamedigimusic, n); CV_SetValue(&cv_gamedigimusic, n);
CV_SetValue(&cv_gamesounds, n); CV_SetValue(&cv_gamesounds, n);
CV_SetValue(&cv_voice_chat, n); CV_SetValue(&cv_voice_selfdeafen, n);
} }
return n; return n;
@ -157,7 +157,7 @@ std::array<Slider, Slider::kNumSliders> sliders{{
{ {
if (toggle) if (toggle)
{ {
CV_AddValue(&cv_voice_chat, 0); CV_AddValue(&cv_voice_selfdeafen, 0);
} }
return !S_VoiceDisabled(); return !S_VoiceDisabled();

View file

@ -20,7 +20,7 @@ menuitem_t OPTIONS_Voice[] =
NULL, {.cvar = &cv_voice_selfmute}, 0, 0}, NULL, {.cvar = &cv_voice_selfmute}, 0, 0},
{IT_STRING | IT_CVAR, "Deafen Self", "Choose to opt-in to voice chat at all, for yourself.", {IT_STRING | IT_CVAR, "Deafen Self", "Choose to opt-in to voice chat at all, for yourself.",
NULL, {.cvar = &cv_voice_chat}, 0, 0}, NULL, {.cvar = &cv_voice_selfdeafen}, 0, 0},
{IT_STRING | IT_CVAR, "Input Mode", "When to transmit your own voice.", {IT_STRING | IT_CVAR, "Input Mode", "When to transmit your own voice.",
NULL, {.cvar = &cv_voice_mode}, 0, 0}, NULL, {.cvar = &cv_voice_mode}, 0, 0},
@ -41,7 +41,7 @@ menuitem_t OPTIONS_Voice[] =
NULL, {NULL}, 0, 0}, NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Server Voice Chat", "All voice chat will be disabled on your server.", {IT_STRING | IT_CVAR, "Server Voice Chat", "All voice chat will be disabled on your server.",
NULL, {.cvar = &cv_voice_servermute}, 0, 0}, NULL, {.cvar = &cv_voice_allowservervoice}, 0, 0},
{IT_STRING | IT_CVAR, "Proximity Effects", "Player voices will be adjusted relative to you.", {IT_STRING | IT_CVAR, "Proximity Effects", "Player voices will be adjusted relative to you.",
NULL, {.cvar = &cv_voice_proximity}, 0, 0}, NULL, {.cvar = &cv_voice_proximity}, 0, 0},

View file

@ -2832,7 +2832,7 @@ void VoiceChat_OnChange(void)
if (M_CheckParm("-novoice") || M_CheckParm("-noaudio")) if (M_CheckParm("-novoice") || M_CheckParm("-noaudio"))
return; return;
g_voice_disabled = !cv_voice_chat.value; g_voice_disabled = !cv_voice_selfdeafen.value;
weaponPrefChange(0); weaponPrefChange(0);
} }
@ -2879,7 +2879,7 @@ void S_QueueVoiceFrameFromPlayer(INT32 playernum, void *data, UINT32 len, boolea
{ {
return; return;
} }
if (cv_voice_chat.value != 1) if (cv_voice_selfdeafen.value != 1)
{ {
I_QueueVoiceFrameFromPlayer(playernum, data, len, terminal); I_QueueVoiceFrameFromPlayer(playernum, data, len, terminal);
} }

View file

@ -48,7 +48,7 @@ extern consvar_t cv_gamesounds;
extern consvar_t cv_bgaudio; extern consvar_t cv_bgaudio;
extern consvar_t cv_streamersafemusic; extern consvar_t cv_streamersafemusic;
extern consvar_t cv_voice_chat; extern consvar_t cv_voice_selfdeafen;
extern consvar_t cv_voice_mode; extern consvar_t cv_voice_mode;
extern consvar_t cv_voice_selfmute; extern consvar_t cv_voice_selfmute;
extern consvar_t cv_voice_loopback; extern consvar_t cv_voice_loopback;