diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 5d0336617..2c8b31271 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3367,7 +3367,7 @@ void CL_Init(void) { cl_voipSend = Cvar_Get("cl_voipSend", "0", 0); cl_voipSendTarget = Cvar_Get("cl_voipSendTarget", "spatial", 0); cl_voipGainDuringCapture = Cvar_Get("cl_voipGainDuringCapture", "0.2", CVAR_ARCHIVE); - cl_voipCaptureMult = Cvar_Get("cl_voipCaptureMult", "4.0", CVAR_ARCHIVE); + cl_voipCaptureMult = Cvar_Get("cl_voipCaptureMult", "2.0", CVAR_ARCHIVE); cl_voipUseVAD = Cvar_Get("cl_voipUseVAD", "0", CVAR_ARCHIVE); cl_voipVADThreshold = Cvar_Get("cl_voipVADThreshold", "0.25", CVAR_ARCHIVE); cl_voipShowMeter = Cvar_Get("cl_voipShowMeter", "1", CVAR_ARCHIVE); diff --git a/code/ui/ui_display.c b/code/ui/ui_display.c index 8561df5ae..4689e4a1f 100644 --- a/code/ui/ui_display.c +++ b/code/ui/ui_display.c @@ -33,13 +33,13 @@ DISPLAY OPTIONS MENU #define BACK0 "menu/buttons/back0" #define BACK1 "menu/buttons/back1" #define GRAPHICS0 "menu/buttons/graphics0" -#define GRASHICS1 "menu/buttons/graphics1" +#define GRAPHICS1 "menu/buttons/graphics1" #define DISPLAY0 "menu/buttons/display0" #define DISPLAY1 "menu/buttons/display1" #define SOUND0 "menu/buttons/sound0" #define SOUND1 "menu/buttons/sound1" -#define NETWORK0 "menu/buttons/network0" -#define NETWORK1 "menu/buttons/network1" +#define NETWORK0 "menu/buttons/netvoip0" +#define NETWORK1 "menu/buttons/netvoip1" #define ACCEPT0 "menu/buttons/accept" #define ACCEPT1 "menu/buttons/accept" @@ -235,7 +235,7 @@ static void UI_DisplayOptionsMenu_Init(void) { displayOptionsInfo.graphics.generic.y = 37; displayOptionsInfo.graphics.width = 160; displayOptionsInfo.graphics.height = 40; - displayOptionsInfo.graphics.focuspic = GRASHICS1; + displayOptionsInfo.graphics.focuspic = GRAPHICS1; displayOptionsInfo.graphics.focuspicinstead = qtrue; displayOptionsInfo.display.generic.type = MTYPE_BITMAP; @@ -484,7 +484,7 @@ void UI_DisplayOptionsMenu_Cache(void) { trap_R_RegisterShaderNoMip(BACK0); trap_R_RegisterShaderNoMip(BACK1); trap_R_RegisterShaderNoMip(GRAPHICS0); - trap_R_RegisterShaderNoMip(GRASHICS1); + trap_R_RegisterShaderNoMip(GRAPHICS1); trap_R_RegisterShaderNoMip(DISPLAY0); trap_R_RegisterShaderNoMip(DISPLAY1); trap_R_RegisterShaderNoMip(SOUND0); diff --git a/code/ui/ui_local.h b/code/ui/ui_local.h index 95bb26085..9864f3f0b 100644 --- a/code/ui/ui_local.h +++ b/code/ui/ui_local.h @@ -307,6 +307,7 @@ extern void Menu_SetCursor(menuframework_s *s, int cursor); extern void Menu_SetCursorToItem(menuframework_s *m, void *ptr); extern sfxHandle_t Menu_DefaultKey(menuframework_s *s, int key); extern sfxHandle_t ScrollList_Key(menulist_s *l, int key); +extern void SpinControl_Init(menulist_s *s); extern sfxHandle_t menu_move_sound; extern sfxHandle_t menu_switch_sound; diff --git a/code/ui/ui_network.c b/code/ui/ui_network.c index 29b14eb4f..cc4f71f54 100644 --- a/code/ui/ui_network.c +++ b/code/ui/ui_network.c @@ -33,25 +33,38 @@ NETWORK OPTIONS MENU #define BACK0 "menu/buttons/back0" #define BACK1 "menu/buttons/back1" #define GRAPHICS0 "menu/buttons/graphics0" -#define GRASHICS1 "menu/buttons/graphics1" +#define GRAPHICS1 "menu/buttons/graphics1" #define DISPLAY0 "menu/buttons/display0" #define DISPLAY1 "menu/buttons/display1" #define SOUND0 "menu/buttons/sound0" #define SOUND1 "menu/buttons/sound1" -#define NETWORK0 "menu/buttons/network0" -#define NETWORK1 "menu/buttons/network1" +#define NETWORK0 "menu/buttons/netvoip0" +#define NETWORK1 "menu/buttons/netvoip1" + +#define ID_GRAPHICS 100 +#define ID_DISPLAY 101 +#define ID_SOUND 102 +#define ID_NETWORK 103 +#define ID_BACK 104 + +#define ID_RATE 10 +#define ID_ALLOWDOWNLOAD 11 +#define ID_VOIPMODE 12 +#define ID_VOIPVADMODE 13 +#define ID_VOIPVADTHRESHOLD 14 +#define ID_VOIPCAPTUREGAIN 15 +#define ID_VOIPCAPTUREMULT 16 +#define ID_VOIPSENDTARGET 17 +#define ID_MUMBLESCALE 18 -#define ID_GRAPHICS 10 -#define ID_DISPLAY 11 -#define ID_SOUND 12 -#define ID_NETWORK 13 -#define ID_RATE 14 -#define ID_ALLOWDOWNLOAD 15 -#define ID_BACK 16 #define XPOSITION 180 -static const char *rate_items[] = {"Modem", "ISDN", "LAN/Cable/xDSL", 0}; +static const char *rate_items[] = {"Modem", "ISDN", "LAN/Cable/xDSL", NULL}; +static const char *voipMode_items[] = {"Off", "Built-in", "Mumble", NULL}; +static const char *capture_items[] = {"Push to Talk", "Automatic", NULL}; +static const char *sendTarget_items[] = {"all", "none", "attacker", "crosshair", "spatial", NULL}; +static const char *sendTarget_custom[] = {"Custom Setting", NULL}; typedef struct { menuframework_s menu; @@ -62,13 +75,120 @@ typedef struct { menubitmap_s network; menulist_s rate; - menuradiobutton_s allowdownload; - + menuradiobutton_s allowDownload; + menutext_s voipHint; + menulist_s voipMode; + menulist_s voipVADmode; + menuslider_s voipVADthreshold; + menuslider_s voipGainDuringCapture; + menuslider_s voipCaptureMult; + menulist_s voipSendTarget; + menuslider_s mumbleScale; + menubitmap_s back; + + qboolean voipCustomSendTarget; + } networkOptionsInfo_t; static networkOptionsInfo_t networkOptionsInfo; +/* +================= +UI_NetworkOptionsMenu_SendTargetUpdate +================= +*/ +static void UI_NetworkOptionsMenu_SendTargetUpdate(void) { + int i; + const char **s; + char voipSendTarget[MAX_CVAR_VALUE_STRING]; + + trap_Cvar_VariableStringBuffer("cl_voipSendTarget", voipSendTarget, sizeof(voipSendTarget)); + + for (i = 0, s = sendTarget_items; *s != NULL; ++s, ++i) { + if (!strcmp(*s, voipSendTarget)) { + networkOptionsInfo.voipCustomSendTarget = qfalse; + networkOptionsInfo.voipSendTarget.curvalue = i; + networkOptionsInfo.voipSendTarget.generic.flags &= ~QMF_GRAYED; + networkOptionsInfo.voipSendTarget.itemnames = sendTarget_items; + networkOptionsInfo.voipSendTarget.generic.toolTip = + "'All' to broadcast to everyone. " + "'None' to send to no one. " + "'Attacker' to send to the last person that hit you. " + "'Crosshair' to send to the people currently in your crosshair. " + "'Spatial' to talk to all people in hearing range. " + "NOTE: See ingame VoIP chat menu for more options."; + SpinControl_Init(&networkOptionsInfo.voipSendTarget); + return; + } + } + networkOptionsInfo.voipSendTarget.itemnames = sendTarget_custom; + networkOptionsInfo.voipSendTarget.generic.flags |= QMF_GRAYED; + networkOptionsInfo.voipCustomSendTarget = qtrue; + SpinControl_Init(&networkOptionsInfo.voipSendTarget); +} + +/* +================= +UI_NetworkOptionsMenu_Update +================= +*/ +static void UI_NetworkOptionsMenu_Update(void) { + + // high rate enabled is condition for all voip settings + if (trap_Cvar_VariableValue("rate") < 25000) { + trap_Cvar_SetValue("cl_voip", 0); + trap_Cvar_SetValue("cl_useMumble", 0); + networkOptionsInfo.voipMode.curvalue = 0; + networkOptionsInfo.voipHint.generic.flags &= ~QMF_HIDDEN; + networkOptionsInfo.voipMode.generic.flags |= QMF_GRAYED; + networkOptionsInfo.voipVADmode.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipVADthreshold.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipGainDuringCapture.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipCaptureMult.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipSendTarget.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.mumbleScale.generic.flags |= QMF_HIDDEN; + } else { + networkOptionsInfo.voipHint.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipMode.generic.flags &= ~QMF_GRAYED; + + // voipMode is set to Mumble + if (!trap_Cvar_VariableValue("cl_voip") && trap_Cvar_VariableValue("cl_useMumble")) { + networkOptionsInfo.voipVADmode.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipVADthreshold.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipGainDuringCapture.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipCaptureMult.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipSendTarget.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.mumbleScale.generic.flags &= ~(QMF_HIDDEN | QMF_INACTIVE); + + // voipMode is set to Built-in + } else if (trap_Cvar_VariableValue("cl_voip") && !trap_Cvar_VariableValue("cl_useMumble")) { + networkOptionsInfo.voipVADmode.generic.flags &= ~QMF_HIDDEN; + networkOptionsInfo.voipVADthreshold.generic.flags &= ~QMF_HIDDEN; + networkOptionsInfo.voipGainDuringCapture.generic.flags &= ~QMF_HIDDEN; + networkOptionsInfo.voipCaptureMult.generic.flags &= ~QMF_HIDDEN; + networkOptionsInfo.voipSendTarget.generic.flags &= ~QMF_HIDDEN; + networkOptionsInfo.mumbleScale.generic.flags |= (QMF_HIDDEN | QMF_INACTIVE); + + // automatic recording enabled is a condition for voip vad threshold + if (networkOptionsInfo.voipVADmode.curvalue == 0) { + networkOptionsInfo.voipVADthreshold.generic.flags |= QMF_GRAYED; + } else { + networkOptionsInfo.voipVADthreshold.generic.flags &= ~QMF_GRAYED; + } + UI_NetworkOptionsMenu_SendTargetUpdate(); + } else { + // voipMode is set to off + networkOptionsInfo.voipVADmode.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipVADthreshold.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipGainDuringCapture.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipCaptureMult.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.voipSendTarget.generic.flags |= QMF_HIDDEN; + networkOptionsInfo.mumbleScale.generic.flags |= (QMF_HIDDEN | QMF_INACTIVE); + } + } +} + /* ================= UI_NetworkOptionsMenu_Event @@ -109,13 +229,54 @@ static void UI_NetworkOptionsMenu_Event(void *ptr, int event) { break; case ID_ALLOWDOWNLOAD: - trap_Cvar_SetValue("cl_allowDownload", networkOptionsInfo.allowdownload.curvalue); + trap_Cvar_SetValue("cl_allowDownload", networkOptionsInfo.allowDownload.curvalue); + break; + + case ID_VOIPMODE: + if (networkOptionsInfo.voipMode.curvalue == 0) { + trap_Cvar_SetValue("cl_voip", 0); + trap_Cvar_SetValue("cl_useMumble", 0); + } else if (networkOptionsInfo.voipMode.curvalue == 1) { + trap_Cvar_SetValue("cl_voip", 1); + trap_Cvar_SetValue("cl_useMumble", 0); + } else if (networkOptionsInfo.voipMode.curvalue == 2) { + trap_Cvar_SetValue("cl_voip", 0); + trap_Cvar_SetValue("cl_useMumble", 1); + } + break; + + case ID_VOIPVADMODE: + trap_Cvar_SetValue("cl_voipUseVAD", (float)networkOptionsInfo.voipVADmode.curvalue); + break; + + case ID_VOIPVADTHRESHOLD: + trap_Cvar_SetValue("cl_voipVADThreshold", networkOptionsInfo.voipVADthreshold.curvalue / 100); + break; + + case ID_VOIPCAPTUREGAIN: + trap_Cvar_SetValue("cl_voipGainDuringCapture", networkOptionsInfo.voipGainDuringCapture.curvalue / 100); + break; + + case ID_VOIPCAPTUREMULT: + trap_Cvar_SetValue("cl_voipCaptureMult", networkOptionsInfo.voipCaptureMult.curvalue); + break; + + case ID_VOIPSENDTARGET: + if (!networkOptionsInfo.voipCustomSendTarget) { + trap_Cvar_Set("cl_voipSendTarget", sendTarget_items[networkOptionsInfo.voipSendTarget.curvalue]); + } + break; + + case ID_MUMBLESCALE: + trap_Cvar_SetValue("cl_mumbleScale", networkOptionsInfo.mumbleScale.curvalue / 1000); break; case ID_BACK: UI_PopMenu(); break; } + + UI_NetworkOptionsMenu_Update(); } /* @@ -143,7 +304,7 @@ static void UI_NetworkOptionsMenu_Init(void) { networkOptionsInfo.graphics.generic.y = 37; networkOptionsInfo.graphics.width = 160; networkOptionsInfo.graphics.height = 40; - networkOptionsInfo.graphics.focuspic = GRASHICS1; + networkOptionsInfo.graphics.focuspic = GRAPHICS1; networkOptionsInfo.graphics.focuspicinstead = qtrue; networkOptionsInfo.display.generic.type = MTYPE_BITMAP; @@ -191,19 +352,128 @@ static void UI_NetworkOptionsMenu_Init(void) { networkOptionsInfo.rate.generic.x = XPOSITION; networkOptionsInfo.rate.generic.y = y; networkOptionsInfo.rate.itemnames = rate_items; + networkOptionsInfo.rate.generic.toolTip = + "Please select your internet connection data rate, default is LAN/Cable/xDSL, the maximum. " + "NOTE: This default setting is required for Voice over IP chat to work."; + + y += (BIGCHAR_HEIGHT + 2); + networkOptionsInfo.allowDownload.generic.type = MTYPE_RADIOBUTTON; + networkOptionsInfo.allowDownload.generic.name = "Auto Download:"; + networkOptionsInfo.allowDownload.generic.flags = QMF_SMALLFONT; + networkOptionsInfo.allowDownload.generic.callback = UI_NetworkOptionsMenu_Event; + networkOptionsInfo.allowDownload.generic.id = ID_ALLOWDOWNLOAD; + networkOptionsInfo.allowDownload.generic.x = XPOSITION; + networkOptionsInfo.allowDownload.generic.y = y; + networkOptionsInfo.allowDownload.generic.toolTip = + "Enable this to automatically download custom files needed to play on modified servers, default is off. " + "NOTE: Custom files may interfere with original game files. Only connect to trusted servers with this enabled."; y += (BIGCHAR_HEIGHT + 2); - networkOptionsInfo.allowdownload.generic.type = MTYPE_RADIOBUTTON; - networkOptionsInfo.allowdownload.generic.name = "Auto Download:"; - networkOptionsInfo.allowdownload.generic.flags = QMF_SMALLFONT; - networkOptionsInfo.allowdownload.generic.callback = UI_NetworkOptionsMenu_Event; - networkOptionsInfo.allowdownload.generic.id = ID_ALLOWDOWNLOAD; - networkOptionsInfo.allowdownload.generic.x = XPOSITION; - networkOptionsInfo.allowdownload.generic.y = y; - networkOptionsInfo.allowdownload.generic.toolTip = - "Enable to automatically download custom maps / custom files needed to play on modified servers. NOTE: Custom " - "game files may interfere with normal game files. Only connect to trusted servers with this enabled."; + networkOptionsInfo.voipHint.generic.type = MTYPE_TEXT; + networkOptionsInfo.voipHint.generic.flags = QMF_PULSE; + networkOptionsInfo.voipHint.generic.x = XPOSITION - 25; + networkOptionsInfo.voipHint.generic.y = y; + networkOptionsInfo.voipHint.string = "VoIP needs LAN/Cable/xDSL data rate!"; + networkOptionsInfo.voipHint.style = UI_CENTER | UI_SMALLFONT; + networkOptionsInfo.voipHint.color = menu_text_color; + y += (BIGCHAR_HEIGHT + 2); + networkOptionsInfo.voipMode.generic.type = MTYPE_SPINCONTROL; + networkOptionsInfo.voipMode.generic.name = "VoIP Chat:"; + networkOptionsInfo.voipMode.generic.flags = QMF_SMALLFONT; + networkOptionsInfo.voipMode.generic.callback = UI_NetworkOptionsMenu_Event; + networkOptionsInfo.voipMode.generic.id = ID_VOIPMODE; + networkOptionsInfo.voipMode.generic.x = XPOSITION; + networkOptionsInfo.voipMode.generic.y = y; + networkOptionsInfo.voipMode.itemnames = voipMode_items; + networkOptionsInfo.voipMode.generic.toolTip = + "Set this to off to completely disable the VoIP chat. You will neither be able to transmit voice nor hear other " + "people talking. The Default setting is the built-in VoiP support. When you set to Mumble, you can link Mumble " + "as an external program but you must start it before starting WoP."; + + y += (BIGCHAR_HEIGHT + 2); + networkOptionsInfo.voipVADmode.generic.type = MTYPE_SPINCONTROL; + networkOptionsInfo.voipVADmode.generic.name = "Capture Mode:"; + networkOptionsInfo.voipVADmode.generic.flags = QMF_SMALLFONT; + networkOptionsInfo.voipVADmode.generic.callback = UI_NetworkOptionsMenu_Event; + networkOptionsInfo.voipVADmode.generic.id = ID_VOIPVADMODE; + networkOptionsInfo.voipVADmode.generic.x = XPOSITION; + networkOptionsInfo.voipVADmode.generic.y = y; + networkOptionsInfo.voipVADmode.itemnames = capture_items; + networkOptionsInfo.voipVADmode.generic.toolTip = + "Set this to push to talk, the default, to use a key to start the transmission manually. See the chat " + "page of the controls menu for key binding. When set to automatic, audio is sent when the game thinks " + "you are talking."; + + networkOptionsInfo.mumbleScale.generic.type = MTYPE_SLIDER; + networkOptionsInfo.mumbleScale.generic.name = "Distance Scale:"; + networkOptionsInfo.mumbleScale.generic.flags = QMF_SMALLFONT; + networkOptionsInfo.mumbleScale.generic.callback = UI_NetworkOptionsMenu_Event; + networkOptionsInfo.mumbleScale.generic.id = ID_VOIPCAPTUREMULT; + networkOptionsInfo.mumbleScale.generic.x = XPOSITION; + networkOptionsInfo.mumbleScale.generic.y = y; + networkOptionsInfo.mumbleScale.minvalue = 0; + networkOptionsInfo.mumbleScale.maxvalue = 200; + networkOptionsInfo.mumbleScale.generic.toolTip = + "Use this to adjust the distance scale. The Mumble link support supplies it with your in-game position, " + "but everything else is whatever features Mumble offers outside of the game."; + + y += (BIGCHAR_HEIGHT + 2); + networkOptionsInfo.voipVADthreshold.generic.type = MTYPE_SLIDER; + networkOptionsInfo.voipVADthreshold.generic.name = "Capture Threshold:"; + networkOptionsInfo.voipVADthreshold.generic.flags = QMF_SMALLFONT; + networkOptionsInfo.voipVADthreshold.generic.callback = UI_NetworkOptionsMenu_Event; + networkOptionsInfo.voipVADthreshold.generic.id = ID_VOIPVADTHRESHOLD; + networkOptionsInfo.voipVADthreshold.generic.x = XPOSITION; + networkOptionsInfo.voipVADthreshold.generic.y = y; + networkOptionsInfo.voipVADthreshold.minvalue = 0; + networkOptionsInfo.voipVADthreshold.maxvalue = 100; + networkOptionsInfo.voipVADthreshold.generic.toolTip = + "This signifies the volume of recorded audio that the game considers to be speech. You can use this " + "to trim out background noise. You will have to experiment to find the setting that works best. The " + "default is 25, with 0 being silence and 100 being pretty loud."; + + y += (BIGCHAR_HEIGHT + 2); + networkOptionsInfo.voipGainDuringCapture.generic.type = MTYPE_SLIDER; + networkOptionsInfo.voipGainDuringCapture.generic.name = "Speakers Volume:"; + networkOptionsInfo.voipGainDuringCapture.generic.flags = QMF_SMALLFONT; + networkOptionsInfo.voipGainDuringCapture.generic.callback = UI_NetworkOptionsMenu_Event; + networkOptionsInfo.voipGainDuringCapture.generic.id = ID_VOIPCAPTUREGAIN; + networkOptionsInfo.voipGainDuringCapture.generic.x = XPOSITION; + networkOptionsInfo.voipGainDuringCapture.generic.y = y; + networkOptionsInfo.voipGainDuringCapture.minvalue = 0; + networkOptionsInfo.voipGainDuringCapture.maxvalue = 100; + networkOptionsInfo.voipGainDuringCapture.generic.toolTip = + "This is the volume of audio coming out of your speakers while you are recording sound for transmission. " + "Defaults to 20 percent of normal volume. This prevents audio feedback and echo. If you're using headphones, " + "you don't need to turn this down."; + + y += (BIGCHAR_HEIGHT + 2); + networkOptionsInfo.voipCaptureMult.generic.type = MTYPE_SLIDER; + networkOptionsInfo.voipCaptureMult.generic.name = "Voice Amplifier:"; + networkOptionsInfo.voipCaptureMult.generic.flags = QMF_SMALLFONT; + networkOptionsInfo.voipCaptureMult.generic.callback = UI_NetworkOptionsMenu_Event; + networkOptionsInfo.voipCaptureMult.generic.id = ID_VOIPCAPTUREMULT; + networkOptionsInfo.voipCaptureMult.generic.x = XPOSITION; + networkOptionsInfo.voipCaptureMult.generic.y = y; + networkOptionsInfo.voipCaptureMult.minvalue = 0; + networkOptionsInfo.voipCaptureMult.maxvalue = 5; + networkOptionsInfo.voipCaptureMult.generic.toolTip = + "This multiplies recorded audio by the set value after denoising. Defaults to 2 to double the volume of " + "your voice. This is to make you more audible if denoising eats away too much data. Set this to 1.0 to " + "get no change, less to be quieter."; + + + y += BIGCHAR_HEIGHT + 2; + networkOptionsInfo.voipSendTarget.generic.type = MTYPE_SPINCONTROL; + networkOptionsInfo.voipSendTarget.generic.name = "Send Target:"; + networkOptionsInfo.voipSendTarget.generic.flags = QMF_SMALLFONT; + networkOptionsInfo.voipSendTarget.generic.callback = UI_NetworkOptionsMenu_Event; + networkOptionsInfo.voipSendTarget.generic.id = ID_VOIPSENDTARGET; + networkOptionsInfo.voipSendTarget.generic.x = XPOSITION; + networkOptionsInfo.voipSendTarget.generic.y = y; + networkOptionsInfo.voipCustomSendTarget = qtrue; + networkOptionsInfo.back.generic.type = MTYPE_BITMAP; networkOptionsInfo.back.generic.name = BACK0; networkOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY | QMF_PULSEIFFOCUS; @@ -220,8 +490,18 @@ static void UI_NetworkOptionsMenu_Init(void) { Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.display); Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.sound); Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.network); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.rate); - Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.allowdownload); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.allowDownload); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.voipHint); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.voipMode); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.voipVADmode); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.voipVADthreshold); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.voipGainDuringCapture); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.voipCaptureMult); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.voipSendTarget); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.mumbleScale); + Menu_AddItem(&networkOptionsInfo.menu, (void *)&networkOptionsInfo.back); rate = trap_Cvar_VariableValue("rate"); @@ -233,7 +513,23 @@ static void UI_NetworkOptionsMenu_Init(void) { networkOptionsInfo.rate.curvalue = 2; } - networkOptionsInfo.allowdownload.curvalue = (trap_Cvar_VariableValue("cl_allowDownload") != 0); + networkOptionsInfo.allowDownload.curvalue = (trap_Cvar_VariableValue("cl_allowDownload") != 0); + + if (!trap_Cvar_VariableValue("cl_voip") && trap_Cvar_VariableValue("cl_useMumble")) { + networkOptionsInfo.voipMode.curvalue = 2; + } else if (trap_Cvar_VariableValue("cl_voip") && !trap_Cvar_VariableValue("cl_useMumble")) { + networkOptionsInfo.voipMode.curvalue = 1; + } else { + networkOptionsInfo.voipMode.curvalue = 0; + } + + networkOptionsInfo.voipVADmode.curvalue = UI_GetCvarInt("cl_voipUseVAD"); + networkOptionsInfo.voipVADthreshold.curvalue = trap_Cvar_VariableValue("cl_voipVADThreshold") * 100; + networkOptionsInfo.voipGainDuringCapture.curvalue = trap_Cvar_VariableValue("cl_voipGainDuringCapture") * 100; + networkOptionsInfo.voipCaptureMult.curvalue = trap_Cvar_VariableValue("cl_voipCaptureMult"); + networkOptionsInfo.mumbleScale.curvalue = trap_Cvar_VariableValue("cl_mumbleScale") * 1000; + + UI_NetworkOptionsMenu_Update(); } /* @@ -245,7 +541,7 @@ void UI_NetworkOptionsMenu_Cache(void) { trap_R_RegisterShaderNoMip(BACK0); trap_R_RegisterShaderNoMip(BACK1); trap_R_RegisterShaderNoMip(GRAPHICS0); - trap_R_RegisterShaderNoMip(GRASHICS1); + trap_R_RegisterShaderNoMip(GRAPHICS1); trap_R_RegisterShaderNoMip(DISPLAY0); trap_R_RegisterShaderNoMip(DISPLAY1); trap_R_RegisterShaderNoMip(SOUND0); diff --git a/code/ui/ui_qmenu.c b/code/ui/ui_qmenu.c index cfdc31dbd..58c8e0431 100644 --- a/code/ui/ui_qmenu.c +++ b/code/ui/ui_qmenu.c @@ -665,7 +665,7 @@ static void Slider_Draw(menuslider_s *s) { SpinControl_Init ================= */ -static void SpinControl_Init(menulist_s *s) { +void SpinControl_Init(menulist_s *s) { int len; int l; const char *str; diff --git a/code/ui/ui_sound.c b/code/ui/ui_sound.c index 062b5f775..22f1debf7 100644 --- a/code/ui/ui_sound.c +++ b/code/ui/ui_sound.c @@ -33,13 +33,13 @@ SOUND OPTIONS MENU #define BACK0 "menu/buttons/back0" #define BACK1 "menu/buttons/back1" #define GRAPHICS0 "menu/buttons/graphics0" -#define GRASHICS1 "menu/buttons/graphics1" +#define GRAPHICS1 "menu/buttons/graphics1" #define DISPLAY0 "menu/buttons/display0" #define DISPLAY1 "menu/buttons/display1" #define SOUND0 "menu/buttons/sound0" #define SOUND1 "menu/buttons/sound1" -#define NETWORK0 "menu/buttons/network0" -#define NETWORK1 "menu/buttons/network1" +#define NETWORK0 "menu/buttons/netvoip0" +#define NETWORK1 "menu/buttons/netvoip1" #define ACCEPT0 "menu/buttons/accept" #define ACCEPT1 "menu/buttons/accept" @@ -58,18 +58,12 @@ SOUND OPTIONS MENU #define ID_QUALITY 15 #define ID_DOPPLER 16 -#define ID_VOIPMODE 17 -#define ID_RECORDMODE 18 -#define ID_VOICETHRESHOLD 19 -#define ID_GAINWHILECAPTURE 20 - #define XPOSITION 180 #define DEFAULT_SDL_SND_SPEED 44100 #define UISND_SDL 0 #define UISND_OPENAL 1 static const char *quality_items[] = {"Low", "Medium", "High", NULL}; -static const char *recording_items[] = {"Push to Talk", "Automatic", 0}; static const char *soundSystem_items[] = {"SDL", "OpenAL", NULL}; typedef struct { @@ -88,12 +82,6 @@ typedef struct { menulist_s quality; menuradiobutton_s doppler; - menuradiobutton_s voipmode; - menulist_s voipRecordMode; - menutext_s voipmode_grayed; - menuslider_s voiceThresholdVAD; - menuslider_s voiceGainDuringCapture; - menubitmap_s apply; menubitmap_s back; @@ -103,54 +91,6 @@ typedef struct { static soundOptionsInfo_t soundOptionsInfo; -static void UI_SoundOptionsMenu_Update(void) { - // openAL and a high rate are conditions for all voip settings - qboolean disableVoip = 25000 > trap_Cvar_VariableValue("rate"); - // voip is a condition for voip volume - qboolean voipOff = (0 == soundOptionsInfo.voipmode.curvalue); - // automatic recording is a condition for voip threshold - qboolean hideVADThreshold = (0 == soundOptionsInfo.voipRecordMode.curvalue); - int y; - - if (disableVoip) { - soundOptionsInfo.voipmode_grayed.generic.flags &= ~QMF_HIDDEN; - soundOptionsInfo.voipmode.generic.flags |= QMF_GRAYED; - soundOptionsInfo.voipRecordMode.generic.flags |= QMF_GRAYED; - soundOptionsInfo.voiceThresholdVAD.generic.flags |= QMF_GRAYED; - soundOptionsInfo.voiceGainDuringCapture.generic.flags |= QMF_GRAYED; - } else { - soundOptionsInfo.voipmode_grayed.generic.flags |= QMF_HIDDEN; - soundOptionsInfo.voipmode.generic.flags &= ~QMF_GRAYED; - - if (voipOff) { - soundOptionsInfo.voipRecordMode.generic.flags |= QMF_GRAYED; - soundOptionsInfo.voiceThresholdVAD.generic.flags |= QMF_GRAYED; - soundOptionsInfo.voiceGainDuringCapture.generic.flags |= QMF_GRAYED; - } else { - soundOptionsInfo.voipRecordMode.generic.flags &= ~QMF_GRAYED; - soundOptionsInfo.voiceGainDuringCapture.generic.flags &= ~QMF_GRAYED; - - if (hideVADThreshold) - soundOptionsInfo.voiceThresholdVAD.generic.flags |= QMF_GRAYED; - else - soundOptionsInfo.voiceThresholdVAD.generic.flags &= ~QMF_GRAYED; - } - } - - // move voip settings down to make space for the voipmode_grayed text - // or move them back up - y = soundOptionsInfo.voipmode_grayed.generic.y; - if (disableVoip) { - y += BIGCHAR_HEIGHT + 2; - } - soundOptionsInfo.voipmode.generic.y = y; - y += BIGCHAR_HEIGHT + 2; - soundOptionsInfo.voipRecordMode.generic.y = y; - y += BIGCHAR_HEIGHT + 2; - soundOptionsInfo.voiceThresholdVAD.generic.y = y; - y += BIGCHAR_HEIGHT + 2; - soundOptionsInfo.voiceGainDuringCapture.generic.y = y; -} /* ================= UI_SoundOptionsMenu_Event @@ -208,22 +148,6 @@ static void UI_SoundOptionsMenu_Event(void *ptr, int event) { trap_Cvar_SetValue("s_doppler", (float)soundOptionsInfo.doppler.curvalue); break; - case ID_GAINWHILECAPTURE: - trap_Cvar_SetValue("cl_voipGainDuringCapture", soundOptionsInfo.voiceGainDuringCapture.curvalue / 10); - break; - - case ID_VOIPMODE: - trap_Cvar_SetValue("cl_voip", (float)soundOptionsInfo.voipmode.curvalue); - break; - - case ID_RECORDMODE: - trap_Cvar_SetValue("cl_voipUseVAD", (float)soundOptionsInfo.voipRecordMode.curvalue); - break; - - case ID_VOICETHRESHOLD: - trap_Cvar_SetValue("cl_voipVADThreshold", soundOptionsInfo.voiceThresholdVAD.curvalue / 10); - break; - case ID_BACK: UI_PopMenu(); break; @@ -262,7 +186,6 @@ static void UI_SoundOptionsMenu_Event(void *ptr, int event) { break; } - UI_SoundOptionsMenu_Update(); } static void SoundOptions_UpdateMenuItems(void) { @@ -314,7 +237,7 @@ static void UI_SoundOptionsMenu_Init(void) { soundOptionsInfo.graphics.generic.y = 37; soundOptionsInfo.graphics.width = 160; soundOptionsInfo.graphics.height = 40; - soundOptionsInfo.graphics.focuspic = GRASHICS1; + soundOptionsInfo.graphics.focuspic = GRAPHICS1; soundOptionsInfo.graphics.focuspicinstead = qtrue; soundOptionsInfo.display.generic.type = MTYPE_BITMAP; @@ -427,61 +350,6 @@ static void UI_SoundOptionsMenu_Init(void) { soundOptionsInfo.doppler.generic.x = XPOSITION; soundOptionsInfo.doppler.generic.y = y; - y += BIGCHAR_HEIGHT * 2 + 2; - soundOptionsInfo.voipmode.generic.type = MTYPE_RADIOBUTTON; - soundOptionsInfo.voipmode.generic.name = "Voice Chat:"; - soundOptionsInfo.voipmode.generic.flags = QMF_SMALLFONT; - soundOptionsInfo.voipmode.generic.callback = UI_SoundOptionsMenu_Event; - soundOptionsInfo.voipmode.generic.id = ID_VOIPMODE; - soundOptionsInfo.voipmode.generic.x = XPOSITION; - soundOptionsInfo.voipmode.generic.y = y; - - soundOptionsInfo.voipmode_grayed.generic.type = MTYPE_TEXT; - soundOptionsInfo.voipmode_grayed.generic.flags = QMF_PULSE; - soundOptionsInfo.voipmode_grayed.generic.x = XPOSITION - 35; - soundOptionsInfo.voipmode_grayed.generic.y = y; - soundOptionsInfo.voipmode_grayed.string = "Needs LAN/Cable/xDSL Network!"; - soundOptionsInfo.voipmode_grayed.style = (UI_CENTER | UI_SMALLFONT); - soundOptionsInfo.voipmode_grayed.color = menu_text_color; - - y += BIGCHAR_HEIGHT + 2; - soundOptionsInfo.voipRecordMode.generic.type = MTYPE_SPINCONTROL; - soundOptionsInfo.voipRecordMode.generic.name = "Voice Recording:"; - soundOptionsInfo.voipRecordMode.generic.flags = QMF_SMALLFONT; - soundOptionsInfo.voipRecordMode.generic.callback = UI_SoundOptionsMenu_Event; - soundOptionsInfo.voipRecordMode.generic.id = ID_RECORDMODE; - soundOptionsInfo.voipRecordMode.generic.x = XPOSITION; - soundOptionsInfo.voipRecordMode.generic.y = y; - soundOptionsInfo.voipRecordMode.itemnames = recording_items; - - y += BIGCHAR_HEIGHT + 2; - soundOptionsInfo.voiceThresholdVAD.generic.type = MTYPE_SLIDER; - soundOptionsInfo.voiceThresholdVAD.generic.name = "Voice Threshold:"; - soundOptionsInfo.voiceThresholdVAD.generic.flags = QMF_SMALLFONT; - soundOptionsInfo.voiceThresholdVAD.generic.callback = UI_SoundOptionsMenu_Event; - soundOptionsInfo.voiceThresholdVAD.generic.id = ID_VOICETHRESHOLD; - soundOptionsInfo.voiceThresholdVAD.generic.x = XPOSITION; - soundOptionsInfo.voiceThresholdVAD.generic.y = y; - soundOptionsInfo.voiceThresholdVAD.minvalue = 0; - soundOptionsInfo.voiceThresholdVAD.maxvalue = 10; - soundOptionsInfo.voiceThresholdVAD.generic.toolTip = - "If microphone option is set to open use this to adjust the sensitivity of the open microphone, mid to high " - "setting recommended if using this method."; - - y += BIGCHAR_HEIGHT + 2; - soundOptionsInfo.voiceGainDuringCapture.generic.type = MTYPE_SLIDER; - soundOptionsInfo.voiceGainDuringCapture.generic.name = "Capture Volume:"; - soundOptionsInfo.voiceGainDuringCapture.generic.flags = QMF_SMALLFONT; - soundOptionsInfo.voiceGainDuringCapture.generic.callback = UI_SoundOptionsMenu_Event; - soundOptionsInfo.voiceGainDuringCapture.generic.id = ID_GAINWHILECAPTURE; - soundOptionsInfo.voiceGainDuringCapture.generic.x = XPOSITION; - soundOptionsInfo.voiceGainDuringCapture.generic.y = y; - soundOptionsInfo.voiceGainDuringCapture.minvalue = 0; - soundOptionsInfo.voiceGainDuringCapture.maxvalue = 10; - soundOptionsInfo.voiceGainDuringCapture.generic.toolTip = - "This is the volume of audio coming out of your speakers while you are recording sound for transmission. This " - "prevents audio feedback and echo. If you're using headphones, you don't need to turn this down."; - soundOptionsInfo.back.generic.type = MTYPE_BITMAP; soundOptionsInfo.back.generic.name = BACK0; soundOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY | QMF_PULSEIFFOCUS; @@ -509,6 +377,7 @@ static void UI_SoundOptionsMenu_Init(void) { Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.display); Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.sound); Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.network); + Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.sfxvolume); Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.musicvolume); Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.musicautoswitch); @@ -516,18 +385,14 @@ static void UI_SoundOptionsMenu_Init(void) { Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.soundSystem); Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.quality); Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.doppler); - Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.voipmode); - Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.voipmode_grayed); - Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.voipRecordMode); - Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.voiceThresholdVAD); - Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.voiceGainDuringCapture); + Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.back); Menu_AddItem(&soundOptionsInfo.menu, (void *)&soundOptionsInfo.apply); soundOptionsInfo.sfxvolume.curvalue = trap_Cvar_VariableValue("s_volume") * 10; soundOptionsInfo.musicvolume.curvalue = trap_Cvar_VariableValue("s_musicvolume") * 10; - if (trap_Cvar_VariableValue("s_muteWhenUnfocused") == 1 || trap_Cvar_VariableValue("s_muteWhenMinimized") == 1) { + if (trap_Cvar_VariableValue("s_muteWhenUnfocused") || trap_Cvar_VariableValue("s_muteWhenMinimized")) { soundOptionsInfo.automute.curvalue = 1; } else { soundOptionsInfo.automute.curvalue = 0; @@ -554,12 +419,6 @@ static void UI_SoundOptionsMenu_Init(void) { soundOptionsInfo.musicautoswitch.curvalue = (UI_GetCvarInt("wop_AutoswitchSongByNextMap") != 0); soundOptionsInfo.doppler.curvalue = (UI_GetCvarInt("s_doppler") != 0); - soundOptionsInfo.voiceThresholdVAD.curvalue = trap_Cvar_VariableValue("cl_voipVADThreshold") * 10; - soundOptionsInfo.voiceGainDuringCapture.curvalue = trap_Cvar_VariableValue("cl_voipGainDuringCapture") * 10; - soundOptionsInfo.voipmode.curvalue = UI_GetCvarInt("cl_voip"); - soundOptionsInfo.voipRecordMode.curvalue = UI_GetCvarInt("cl_voipUseVAD"); - - UI_SoundOptionsMenu_Update(); } /* @@ -571,7 +430,7 @@ void UI_SoundOptionsMenu_Cache(void) { trap_R_RegisterShaderNoMip(BACK0); trap_R_RegisterShaderNoMip(BACK1); trap_R_RegisterShaderNoMip(GRAPHICS0); - trap_R_RegisterShaderNoMip(GRASHICS1); + trap_R_RegisterShaderNoMip(GRAPHICS1); trap_R_RegisterShaderNoMip(DISPLAY0); trap_R_RegisterShaderNoMip(DISPLAY1); trap_R_RegisterShaderNoMip(SOUND0); diff --git a/code/ui/ui_video.c b/code/ui/ui_video.c index 68adf4b36..3d79e31f7 100644 --- a/code/ui/ui_video.c +++ b/code/ui/ui_video.c @@ -35,13 +35,13 @@ GRAPHICS OPTIONS MENU #define BACK0 "menu/buttons/back0" #define BACK1 "menu/buttons/back1" #define GRAPHICS0 "menu/buttons/graphics0" -#define GRASHICS1 "menu/buttons/graphics1" +#define GRAPHICS1 "menu/buttons/graphics1" #define DISPLAY0 "menu/buttons/display0" #define DISPLAY1 "menu/buttons/display1" #define SOUND0 "menu/buttons/sound0" #define SOUND1 "menu/buttons/sound1" -#define NETWORK0 "menu/buttons/network0" -#define NETWORK1 "menu/buttons/network1" +#define NETWORK0 "menu/buttons/netvoip0" +#define NETWORK1 "menu/buttons/netvoip1" #define ACCEPT0 "menu/buttons/accept" #define ACCEPT1 "menu/buttons/accept" @@ -697,7 +697,7 @@ void GraphicsOptions_MenuInit(void) { s_graphicsoptions.graphics.generic.y = 37; s_graphicsoptions.graphics.width = 160; s_graphicsoptions.graphics.height = 40; - s_graphicsoptions.graphics.focuspic = GRASHICS1; + s_graphicsoptions.graphics.focuspic = GRAPHICS1; s_graphicsoptions.graphics.focuspicinstead = qtrue; s_graphicsoptions.display.generic.type = MTYPE_BITMAP; @@ -928,7 +928,7 @@ void GraphicsOptions_Cache(void) { trap_R_RegisterShaderNoMip(BACK0); trap_R_RegisterShaderNoMip(BACK1); trap_R_RegisterShaderNoMip(GRAPHICS0); - trap_R_RegisterShaderNoMip(GRASHICS1); + trap_R_RegisterShaderNoMip(GRAPHICS1); trap_R_RegisterShaderNoMip(DISPLAY0); trap_R_RegisterShaderNoMip(DISPLAY1); trap_R_RegisterShaderNoMip(SOUND0); diff --git a/wop/menu.pk3dir/menu/buttons/netvoip0.png b/wop/menu.pk3dir/menu/buttons/netvoip0.png new file mode 100644 index 000000000..74744d6e1 --- /dev/null +++ b/wop/menu.pk3dir/menu/buttons/netvoip0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1872ad941cb9003382ddb1c45da066267cafa211e7ceed459ce9df7780a5383e +size 11061 diff --git a/wop/menu.pk3dir/menu/buttons/netvoip1.png b/wop/menu.pk3dir/menu/buttons/netvoip1.png new file mode 100644 index 000000000..ea2b03603 --- /dev/null +++ b/wop/menu.pk3dir/menu/buttons/netvoip1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b364273bd21fdc885382317b2f6533ac6a0de8070d387ebd607d805f516673b +size 12162 diff --git a/wop/menu.pk3dir/menu/buttons/network0.png b/wop/menu.pk3dir/menu/buttons/network0.png deleted file mode 100644 index e477a43bc..000000000 --- a/wop/menu.pk3dir/menu/buttons/network0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8e826fe9bf0b2c50c32600aa3be5d7f5fb705e709a03a8a79cc7a3e00250f53f -size 11109 diff --git a/wop/menu.pk3dir/menu/buttons/network1.png b/wop/menu.pk3dir/menu/buttons/network1.png deleted file mode 100644 index 282b0a77c..000000000 --- a/wop/menu.pk3dir/menu/buttons/network1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f07f12f5e34ea7b61a7be5574188a357e7b48ad0d0b38781bdcb1381bb82e19e -size 12347