From: terencehill Date: Tue, 12 Jul 2011 18:10:04 +0000 (+0200) Subject: Fix g_ctf_reverse by making spawn the red flag instead of the blue one and vice versa... X-Git-Tag: xonotic-v0.5.0~148^2~43^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cf649e945503e6952eaa0fc438ba75b371314d46;p=xonotic%2Fxonotic-data.pk3dir.git Fix g_ctf_reverse by making spawn the red flag instead of the blue one and vice versa. Previous code was very buggy: names, sounds and effects of the flags were wrong (inverted). --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 2bc8cd325..59336c1a4 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -702,7 +702,7 @@ set g_ctf_flagcarrier_selfforce 1 set g_ctf_fullbrightflags 0 set g_ctf_dynamiclights 0 set g_ctf_allow_drop 1 "dropping allows circumventing carrierkill score, so enable this with care!" -set g_ctf_reverse 0 "when 1, bases/flags are switched :P you have to capture your OWN flag by bringing it to the ENEMY's" +set g_ctf_reverse 0 "if enabled, flags positions are switched: you have to capture the enemy's flag from your own base by bringing it to your own flag in the enemy base" set g_balance_ctf_delay_collect 1.0 set g_balance_ctf_damageforcescale 1 diff --git a/qcsrc/server/ctf.qc b/qcsrc/server/ctf.qc index a54ee6a8a..93446ed5b 100644 --- a/qcsrc/server/ctf.qc +++ b/qcsrc/server/ctf.qc @@ -765,6 +765,7 @@ Keys: (default ctf/respawn.wav) */ +void spawnfunc_item_flag_team2(); void spawnfunc_item_flag_team1() { if (!g_ctf) @@ -773,21 +774,22 @@ void spawnfunc_item_flag_team1() return; } + if (g_ctf_reverse) + { + float old_g_ctf_reverse = g_ctf_reverse; + g_ctf_reverse = 0; // avoid an endless loop + spawnfunc_item_flag_team2(); + g_ctf_reverse = old_g_ctf_reverse; + return; + } + // link flag into ctf_worldflaglist self.ctf_worldflagnext = ctf_worldflaglist; ctf_worldflaglist = self; self.classname = "item_flag_team"; - if(g_ctf_reverse) - { - self.team = COLOR_TEAM2; // color 13 team (blue) - self.items = IT_KEY1; // silver key (bluish enough) - } - else - { - self.team = COLOR_TEAM1; // color 4 team (red) - self.items = IT_KEY2; // gold key (redish enough) - } + self.team = COLOR_TEAM1; // color 4 team (red) + self.items = IT_KEY2; // gold key (redish enough) self.netname = "^1RED^7 flag"; self.target = "###item###"; self.skin = autocvar_g_ctf_flag_red_skin; @@ -871,21 +873,22 @@ void spawnfunc_item_flag_team2() return; } + if (g_ctf_reverse) + { + float old_g_ctf_reverse = g_ctf_reverse; + g_ctf_reverse = 0; // avoid an endless loop + spawnfunc_item_flag_team1(); + g_ctf_reverse = old_g_ctf_reverse; + return; + } + // link flag into ctf_worldflaglist self.ctf_worldflagnext = ctf_worldflaglist; ctf_worldflaglist = self; self.classname = "item_flag_team"; - if(g_ctf_reverse) - { - self.team = COLOR_TEAM1; // color 4 team (red) - self.items = IT_KEY2; // gold key (redish enough) - } - else - { - self.team = COLOR_TEAM2; // color 13 team (blue) - self.items = IT_KEY1; // silver key (bluish enough) - } + self.team = COLOR_TEAM2; // color 13 team (blue) + self.items = IT_KEY1; // silver key (bluish enough) self.netname = "^4BLUE^7 flag"; self.target = "###item###"; self.skin = autocvar_g_ctf_flag_blue_skin;