]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/ctf.qc
Merge branch 'master' into MaidenBeast/translation_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / ctf.qc
index 7edfe9337185601a50019e2b9c6eab592eee2e92..93446ed5ba811bd430c8d0eb30b8dfe0f7b3e3ee 100644 (file)
@@ -303,7 +303,7 @@ void DropFlag(entity e, entity penalty_receiver, entity attacker)
                backtrace("Flag carrier had no flag sprite?!?");
        }
        LogCTF("dropped", p.team, p);
-       sound (self, CHAN_TRIGGER, self.noise4, VOL_BASE, ATTN_NONE);
+       sound (p, CH_TRIGGER, self.noise4, VOL_BASE, ATTN_NONE);
 
        setattachment(e, world, "");
        e.damageforcescale = autocvar_g_balance_ctf_damageforcescale;
@@ -358,7 +358,7 @@ void FlagThink()
                {
                        bprint("The ", self.netname, " became impatient after ", ftos_decimals(flagcaptimerecord, 2), " seconds and returned itself\n");
 
-                       sound (self, CHAN_TRIGGER, self.noise3, VOL_BASE, ATTN_NONE);
+                       sound (self, CH_TRIGGER, self.noise3, VOL_BASE, ATTN_NONE);
                        self.owner.impulse = 141; // returning!
 
                        e = self;
@@ -385,7 +385,7 @@ void FlagThink()
                if (time > self.pain_finished)
                {
                        bprint("The ", self.netname, " has returned to base\n");
-                       sound (self, CHAN_TRIGGER, self.noise3, VOL_BASE, ATTN_NONE);
+                       sound (self, CH_TRIGGER, self.noise3, VOL_BASE, ATTN_NONE);
                        LogCTF("returned", self.team, world);
                        ReturnFlag(self);
                }
@@ -493,7 +493,7 @@ void FlagTouch()
                        }
                }
 
-               sound (other, CHAN_AUTO, self.noise2, VOL_BASE, ATTN_NONE);
+               sound (other, CH_TRIGGER, self.noise2, VOL_BASE, ATTN_NONE);
                WaypointSprite_DetachCarrier(other);
                if(self.speedrunning)
                        FakeTimeLimit(other, -1);
@@ -531,7 +531,7 @@ void FlagTouch()
                self.dropperid = other.playerid;
                PlayerScore_Add(other, SP_CTF_PICKUPS, 1);
                LogCTF("steal", self.team, other);
-               sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
+               sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NONE);
 
                FOR_EACH_PLAYER(player)
                        if(player.team == self.team)
@@ -586,7 +586,7 @@ void FlagTouch()
                        }
                        PlayerScore_Add(other, SP_CTF_RETURNS, 1);
                        LogCTF("return", self.team, other);
-                       sound (other, CHAN_AUTO, self.noise1, VOL_BASE, ATTN_NONE);
+                       sound (other, CH_TRIGGER, self.noise1, VOL_BASE, ATTN_NONE);
                        ReturnFlag(self);
                }
                else if (!other.flagcarried && (other.playerid != self.dropperid || time > self.ctf_droptime + autocvar_g_balance_ctf_delay_collect))
@@ -618,7 +618,7 @@ void FlagTouch()
                        UpdateFrags(other, f);
                        PlayerScore_Add(other, SP_CTF_PICKUPS, 1);
                        LogCTF("pickup", self.team, other);
-                       sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
+                       sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NONE);
 
                        FOR_EACH_PLAYER(player)
                                if(player.team == self.team)
@@ -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;