From 245300d9266c0cf8e3179e6741346486a208f145 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Wed, 30 Mar 2022 14:30:26 +1000 Subject: [PATCH] menu: misc settings polishing Improved layout and labelling Removed cl_port as it's for very rare corner cases Removed cl_movement as nobody should disable it, but sometimes people did by accident or without understanding the effect, also https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2549 Added cl_netrepeatinput as this compensation has a cost and hides issues Modernised speed limit options (should not imply xonotic supports 56k) Removed 30fps from cl_maxfps options Added 40fps cl_minfps option, fixes "Custom" being displayed by default Added an Apply button for the `developer` setting --- qcsrc/menu/xonotic/dialog_settings_misc.qc | 92 +++++++++++----------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/qcsrc/menu/xonotic/dialog_settings_misc.qc b/qcsrc/menu/xonotic/dialog_settings_misc.qc index 504479368..1a777af6a 100644 --- a/qcsrc/menu/xonotic/dialog_settings_misc.qc +++ b/qcsrc/menu/xonotic/dialog_settings_misc.qc @@ -7,10 +7,11 @@ #include "checkbox.qh" #include "button.qh" #include "mainwindow.qh" +#include "commandbutton.qh" #define ADDVALUE_FPS(i) e.addValue(e, strzone(sprintf(_("%d fps"), i)), #i) -#define ADDVALUE_SPEED_KB(i) e.addValue(e, strzone(sprintf(_("%d KB/s"), i)), #i) -#define ADDVALUE_SPEED_MB(i, j) e.addValue(e, strzone(sprintf(_("%d MB/s"), i)), #j) +#define ADDVALUE_SPEED_KB(i) e.addValue(e, strzone(sprintf(_("%d KiB/s"), i)), #i) +#define ADDVALUE_SPEED_MB(i, j) e.addValue(e, strzone(sprintf(_("%d MiB/s"), i)), #j) entity makeXonoticMiscSettingsTab() { entity me; @@ -23,63 +24,68 @@ void XonoticMiscSettingsTab_fill(entity me) entity e; //entity sk; + entity miscApplyButton = makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "menu_restart;", COMMANDBUTTON_APPLY); + miscApplyButton.disableOnClick = true; + + me.TR(me); + me.TD(me, 1, 3.25, e = makeXonoticHeaderLabel(_("Network"))); + me.TR(me); + me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "shownetgraph", _("Show netgraph"), + _("Show a graph of packet sizes and other information"))); + me.TR(me); + me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "cl_netrepeatinput", _("Packet loss compensation"), + _("Each packet includes a copy of the previous message"))); me.TR(me); - me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Network"))); + me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_movement_errorcompensation", _("Movement prediction error compensation"))); + setDependent(e, "cl_movement", 1, 1); me.TR(me); - me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Client UDP port:"))); - me.TD(me, 1, 1.5, e = makeXonoticInputBox_T(0, "cl_port", - _("Force client to use chosen port unless it is set to 0"))); + if(cvar_type("crypto_aeslevel") & CVAR_TYPEFLAG_ENGINE) + me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "crypto_aeslevel", _("Use encryption (AES) when available"))); me.TR(me); me.TR(me); - me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bandwidth:"))); + me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bandwidth limit:"))); me.TD(me, 1, 2, e = makeXonoticTextSlider_T("_cl_rate", _("Specify your network speed"))); - e.addValue(e, _("56k"), "4000"); - e.addValue(e, _("ISDN"), "7000"); e.addValue(e, _("Slow ADSL"), "20000"); e.addValue(e, _("Fast ADSL"), "40000"); e.addValue(e, _("Broadband"), "66666"); e.configureXonoticTextSliderValues(e); + if(cvar("developer") > 0) + { + me.TR(me); + me.TR(me); + me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Local latency:"))); + me.TD(me, 1, 2, e = makeXonoticSlider(0, 1000, 25, "cl_netlocalping")); + } + me.TR(me); me.TR(me); + me.TD(me, 1, 3.25, e = makeXonoticHeaderLabel(_("HTTP downloads"))); me.TR(me); - me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Downloads:"))); + me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Simultaneous:"))); me.TD(me, 1, 2, e = makeXonoticSlider_T(1, 5, 1, "cl_curl_maxdownloads", - _("Maximum number of concurrent HTTP/FTP downloads"))); + _("Maximum number of concurrent HTTP downloads"))); me.TR(me); - me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Download speed:"))); + me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bandwidth limit:"))); me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_curl_maxspeed")); - ADDVALUE_SPEED_KB(50); - ADDVALUE_SPEED_KB(100); - ADDVALUE_SPEED_KB(300); - ADDVALUE_SPEED_KB(500); - ADDVALUE_SPEED_MB(1, 1000); - ADDVALUE_SPEED_MB(2, 2000); + ADDVALUE_SPEED_KB(64); + ADDVALUE_SPEED_KB(128); + ADDVALUE_SPEED_KB(256); + ADDVALUE_SPEED_KB(512); + ADDVALUE_SPEED_MB(1, 1024); + ADDVALUE_SPEED_MB(2, 2048); + ADDVALUE_SPEED_MB(4, 4096); + ADDVALUE_SPEED_MB(8, 8192); e.addValue(e, strzone(_("Unlimited")), "0"); e.configureXonoticTextSliderValues(e); - me.TR(me); - if(cvar("developer") > 0) - { - me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Local latency:"))); - me.TD(me, 1, 2, e = makeXonoticSlider(0, 1000, 25, "cl_netlocalping")); - } - me.TR(me); - me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "shownetgraph", _("Show netgraph"), - _("Show a graph of packet sizes and other information"))); - me.TR(me); - me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_movement", _("Client-side movement prediction"))); - me.TR(me); - me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_movement_errorcompensation", _("Movement error compensation"))); - setDependent(e, "cl_movement", 1, 1); - me.TR(me); - if(cvar_type("crypto_aeslevel") & CVAR_TYPEFLAG_ENGINE) - me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "crypto_aeslevel", _("Use encryption (AES) when available"))); // TODO: move up me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn); me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Framerate"))); + me.TR(me); + me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "showfps", _("Show frames per second"), + _("Show your rendered frames per second"))); me.TR(me); me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Maximum:"))); me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_maxfps")); - ADDVALUE_FPS(30); ADDVALUE_FPS(60); ADDVALUE_FPS(100); ADDVALUE_FPS(125); @@ -93,7 +99,7 @@ void XonoticMiscSettingsTab_fill(entity me) me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Target:"))); me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_minfps")); e.addValue(e, ZCTX(_("TRGT^Disabled")), "0"); - ADDVALUE_FPS(30); + ADDVALUE_FPS(40); ADDVALUE_FPS(60); ADDVALUE_FPS(100); ADDVALUE_FPS(125); @@ -112,13 +118,6 @@ void XonoticMiscSettingsTab_fill(entity me) e.addValue(e, ZCTX(_("IDLFPS^Unlimited")), "0"); e.configureXonoticTextSliderValues(e); me.TR(me); - me.TR(me); - me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_maxfps_alwayssleep", _("Save processing time for other apps"))); - setDependent(e, "cl_maxfps", 1, 1000); - me.TR(me); - me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "showfps", _("Show frames per second"), - _("Show your rendered frames per second"))); - me.TR(me); me.TR(me); me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other"))); me.TR(me); @@ -135,6 +134,7 @@ void XonoticMiscSettingsTab_fill(entity me) makeMulti(e, "showdate"); me.TR(me); me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "developer", _("Enable developer mode"))); + e.applyButton = miscApplyButton; me.TR(me); me.TDempty(me, 0.5); @@ -142,10 +142,14 @@ void XonoticMiscSettingsTab_fill(entity me) _("Advanced settings where you can tweak every single variable of the game"))); e.onClick = DialogOpenButton_Click; e.onClickEntity = main.cvarsDialog; + me.TR(me); me.TR(me); me.TDempty(me, 0.5); me.TD(me, 1, 2, e = makeXonoticButton(_("Factory reset"), '0 0 0')); e.onClick = DialogOpenButton_Click; e.onClickEntity = main.resetDialog; + + me.gotoRC(me, me.rows - 1, 0); + me.TD(me, 1, me.columns, miscApplyButton); } #undef ADDVALUE_FPS -- 2.39.2