[proximity chat] force disable for public lobbies

This commit is contained in:
Dominicentek 2026-05-31 17:26:46 +02:00
parent a17482e08c
commit ead4c58a48
3 changed files with 11 additions and 2 deletions

View file

@ -4,6 +4,8 @@
#include "audio_api.h"
#include "pc/proximity_chat.h"
static SDL_AudioDeviceID dev;
static SDL_AudioDeviceID capture_dev;
static AudioCaptureCallback capture_callback;
@ -43,6 +45,7 @@ static bool audio_sdl_init(void) {
.callback = audio_sdl_capture_callback
}, NULL, 0);
if (capture_dev == 0) {
proxchat_error[0] = PROXCHAT_ERR_NO_MICROPHONE;
fprintf(stderr, "SDL_OpenAudio capture error: %s\n", SDL_GetError());
return false;
}

View file

@ -45,6 +45,10 @@ static void djui_panel_host_player_text_change(struct DjuiBase* caller) {
configAmountOfPlayers = atoi(sPlayerAmount->buffer);
}
static bool is_public_coopnet_lobby() {
return configNetworkSystem == NS_COOPNET && configPassword[0] == 0;
}
void djui_panel_host_settings_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(HOST_SETTINGS, SETTINGS), false);
struct DjuiBase* body = djui_three_panel_get_body(panel);
@ -75,7 +79,9 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) {
struct DjuiCheckbox* chkDevMode = djui_checkbox_create(body, DLANG(HOST_SETTINGS, MOD_DEV_MODE), (configNetworkSystem == NS_SOCKET) ? &configModDevMode : &sFalse, NULL);
djui_base_set_enabled(&chkDevMode->base, configNetworkSystem == NS_SOCKET);
djui_checkbox_create(body, DLANG(HOST_SETTINGS, PROXIMITY_CHAT), &configProximityChat, NULL);
if (is_public_coopnet_lobby()) configProximityChat = false;
struct DjuiCheckbox* chkProxchat = djui_checkbox_create(body, DLANG(HOST_SETTINGS, PROXIMITY_CHAT), &configProximityChat, NULL);
djui_base_set_enabled(&chkProxchat->base, !is_public_coopnet_lobby());
struct DjuiRect* rect1 = djui_rect_container_create(body, 32);
{

View file

@ -135,7 +135,7 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) {
gServerSettings.enablePlayersInLevelDisplay = TRUE;
gServerSettings.enablePlayerList = TRUE;
gServerSettings.nametags = configNametags;
gServerSettings.proximityChat = configProximityChat;
gServerSettings.proximityChat = configProximityChat && !(configNetworkSystem == NS_COOPNET && configPassword[0] == 0);
gServerSettings.maxPlayers = configAmountOfPlayers;
gServerSettings.pauseAnywhere = configPauseAnywhere;
gServerSettings.pvpType = configPvpType;