From: terencehill Date: Tue, 29 Oct 2024 10:11:32 +0000 (+0100) Subject: Simplify spec_forfeit (at the cost of sending another cvar to the server) X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3f3ba94e801bf878357ffe4c47785cb897425d50;p=xonotic%2Fxonotic-data.pk3dir.git Simplify spec_forfeit (at the cost of sending another cvar to the server) --- diff --git a/commands.cfg b/commands.cfg index 75e052ba2..b748e8ed2 100644 --- a/commands.cfg +++ b/commands.cfg @@ -216,10 +216,8 @@ alias team_auto "togglemenu 0; cmd selectteam auto; cmd join" // TODO remove this cvar and related menu code in a later Xonotic version seta _spec_forfeit_bindupdate 0 -seta menu_ask_forfeit 1 "ask for forfeit confirmation" -alias spec_forfeit0 "spectate" -alias spec_forfeit1 "spectate \"\" ASK_FORFEIT" -alias spec_forfeit "spec_forfeit${menu_ask_forfeit}" +seta spec_forfeit_ask 1 "allow asking for forfeit confirmation" +alias spec_forfeit "spectate \"\" ASK_FORFEIT" alias spec "spectate ${* ?}" diff --git a/qcsrc/common/replicate.qh b/qcsrc/common/replicate.qh index afc1c7b97..85298a35d 100644 --- a/qcsrc/common/replicate.qh +++ b/qcsrc/common/replicate.qh @@ -3,6 +3,7 @@ // TODO: Remove cvar_cl_handicap vector after 0.9 release #ifdef GAMEQC +REPLICATE_INIT(bool, cvar_spec_forfeit_ask); REPLICATE_INIT(bool, cvar__menu_forfeit_dialog_available); REPLICATE_INIT(bool, cvar_cl_autoswitch); REPLICATE_INIT(int, cvar_cl_autoscreenshot); @@ -13,6 +14,7 @@ REPLICATE_INIT(float, cvar_cl_handicap_damage_given); REPLICATE_INIT(float, cvar_cl_handicap_damage_taken); REPLICATE_INIT(bool, cvar_cl_noantilag); REPLICATE_INIT(string, cvar_g_xonoticversion); +REPLICATE(cvar_spec_forfeit_ask, bool, "spec_forfeit_ask"); REPLICATE(cvar__menu_forfeit_dialog_available, bool, "_menu_forfeit_dialog_available"); REPLICATE(cvar_cl_autoswitch, bool, "cl_autoswitch"); REPLICATE(cvar_cl_autoscreenshot, int, "cl_autoscreenshot"); diff --git a/qcsrc/menu/xonotic/dialog_forfeit.qc b/qcsrc/menu/xonotic/dialog_forfeit.qc index 8b67ed63b..efffba232 100644 --- a/qcsrc/menu/xonotic/dialog_forfeit.qc +++ b/qcsrc/menu/xonotic/dialog_forfeit.qc @@ -26,5 +26,5 @@ void XonoticForfeitDialog_fill(entity me) e.onClickEntity = me; me.TR(me); me.TR(me); - me.TD(me, 1, 2, e = makeXonoticCheckBox(1, "menu_ask_forfeit", _("Never ask again"))); + me.TD(me, 1, 2, e = makeXonoticCheckBox(1, "spec_forfeit_ask", _("Never ask again"))); } diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 718b74c64..7202a9116 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -710,7 +710,8 @@ void ClientCommand_spectate(entity caller, int request) return; } - bool forfeit_now = (warmup_stage || argv(2) != "ASK_FORFEIT"); + bool forfeit_now = + (warmup_stage || !caller.cvar_spec_forfeit_ask || argv(2) != "ASK_FORFEIT"); if (IS_PLAYER(caller) && !forfeit_now && caller.cvar__menu_forfeit_dialog_available) {