]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into divVerent/4team_ctf
authorMario <mario.mario@y7mail.com>
Fri, 23 Aug 2013 14:19:11 +0000 (00:19 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 23 Aug 2013 14:19:11 +0000 (00:19 +1000)
1  2 
qcsrc/client/hud.qc
qcsrc/server/autocvars.qh
qcsrc/server/mutators/gamemode_ctf.qc

Simple merge
Simple merge
index f6c43a91d1890f030ef1ea08e41a6309a42a0917,1de05661bed63d57a275f61c8d0709d2fb8c7232..3b2a0624ca9c3cc2bbe68aef142c891c0b0194ee
@@@ -131,25 -131,6 +131,29 @@@ float ctf_CheckPassDirection(vector hea
        else { return TRUE; }
  }
  
-       if(!IsDifferentTeam(self.owner, e))
-               return FALSE;
-       if not(IS_PLAYER(e))
 +float ctf_IsDifferentTeam(entity a, entity b)
 +{
 +      float f = IsDifferentTeam(a, b);
 +      return (autocvar_g_ctf_reverse) ? !f : f;
 +}
 +
 +float ctf_Stalemate_waypointsprite_visible_for_player(entity e)
 +{
++      // personal waypoints
++      if(self.enemy)
++              if(self.enemy != e)
++                      return FALSE;
++                      
 +      // team waypoints
++      if(self.rule == SPRITERULE_DEFAULT)
 +      if(ctf_IsDifferentTeam(self.owner.flagcarried, self.owner))
 +      if(ctf_IsDifferentTeam(self.owner.flagcarried, e))
++      if(!IsDifferentTeam(self.owner, e) || !IS_PLAYER(e))
 +              return FALSE;
 +
 +      return TRUE;
 +}
 +
  
  // =======================
  // CaptureShield Functions 
@@@ -648,20 -616,19 +652,23 @@@ void ctf_CheckStalemate(void
                        tmp_entity.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist
                        ctf_staleflaglist = tmp_entity;
                        
-                       if(tmp_entity.team == NUM_TEAM_1) { ++stale_red_flags; }
-                       if(tmp_entity.team == NUM_TEAM_2) { ++stale_blue_flags; }
-                       if(tmp_entity.team == NUM_TEAM_3) { ++stale_yellow_flags; }
-                       if(tmp_entity.team == NUM_TEAM_4) { ++stale_pink_flags; }
+                       switch(tmp_entity.team)
+                       {
+                               case NUM_TEAM_1: ++stale_red_flags; break;
+                               case NUM_TEAM_2: ++stale_blue_flags; break;
++                              case NUM_TEAM_3: ++stale_yellow_flags; break;
++                              case NUM_TEAM_4: ++stale_pink_flags; break;
+                       }
                }
        }
 -
 -      if(stale_red_flags && stale_blue_flags)
 +      
 +      stale_flags = (stale_red_flags > 0) + (stale_blue_flags > 0) + (stale_yellow_flags > 0) + (stale_pink_flags > 0);
 +      
-       if(stale_flags >= ctf_teams)
++      if(stale_flags == ctf_teams)
                ctf_stalemate = TRUE;
-       else if(stale_flags < ctf_teams && autocvar_g_ctf_stalemate_endcondition == 2)
 -      else if((!stale_red_flags && !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 2)
++      else if(stale_flags == 0 && autocvar_g_ctf_stalemate_endcondition == 2)
                { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
-       else if(stale_flags > 0 && autocvar_g_ctf_stalemate_endcondition == 1)
 -      else if((!stale_red_flags || !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 1)
++      else if(stale_flags < ctf_teams && stale_flags > 0 && autocvar_g_ctf_stalemate_endcondition == 1)
                { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
                
        // if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary
@@@ -805,10 -769,6 +812,11 @@@ void ctf_FlagThink(
                                        wpforenemy_nextthink = time + WPFE_THINKRATE; // waypoint for enemy think rate (to reduce unnecessary spam of this check)
                                }
                        }
 +                      if(!ctf_IsDifferentTeam(self, self.owner))
 +                      {
++                              // drop the flag if reverse status has changed
 +                              ctf_Handle_Throw(self.owner, world, DROP_THROW);
 +                      }
                        return;
                }
                
@@@ -1790,11 -1721,6 +1798,11 @@@ MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink
        // scan through all the flags and notify the client about them 
        for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
        {
-               if(flag.team == NUM_TEAM_1) { t = IT_RED_FLAG_CARRYING; t2 = IT_RED_FLAG_TAKEN; t3 = IT_RED_FLAG_LOST; }
-               if(flag.team == NUM_TEAM_2) { t = IT_BLUE_FLAG_CARRYING; t2 = IT_BLUE_FLAG_TAKEN; t3 = IT_BLUE_FLAG_LOST; }
-               if(flag.team == NUM_TEAM_3) { t = IT_YELLOW_FLAG_CARRYING; t2 = IT_YELLOW_FLAG_TAKEN; t3 = IT_YELLOW_FLAG_LOST; }
-               if(flag.team == NUM_TEAM_4) { t = IT_PINK_FLAG_CARRYING; t2 = IT_PINK_FLAG_TAKEN; t3 = IT_PINK_FLAG_LOST; }
++              if(flag.team == NUM_TEAM_1) { t = IT_RED_FLAG_CARRYING;         t2 = IT_RED_FLAG_TAKEN;         t3 = IT_RED_FLAG_LOST; }
++              if(flag.team == NUM_TEAM_2) { t = IT_BLUE_FLAG_CARRYING;        t2 = IT_BLUE_FLAG_TAKEN;        t3 = IT_BLUE_FLAG_LOST; }
++              if(flag.team == NUM_TEAM_3) { t = IT_YELLOW_FLAG_CARRYING;      t2 = IT_YELLOW_FLAG_TAKEN;      t3 = IT_YELLOW_FLAG_LOST; }
++              if(flag.team == NUM_TEAM_4) { t = IT_PINK_FLAG_CARRYING;        t2 = IT_PINK_FLAG_TAKEN;        t3 = IT_PINK_FLAG_LOST; }
 +      
                switch(flag.ctf_status)
                {
                        case FLAG_PASSING:
@@@ -2315,14 -2180,9 +2323,13 @@@ void ctf_DelayedInit() // Do this chec
                print("No ""ctf_team"" entities found on this map, creating them anyway.\n");
                ctf_SpawnTeam("Red", NUM_TEAM_1 - 1);
                ctf_SpawnTeam("Blue", NUM_TEAM_2 - 1);
 +              if(ctf_teams >= 3)
 +                      ctf_SpawnTeam("Yellow", NUM_TEAM_3 - 1);
 +              if(ctf_teams >= 4)
 +                      ctf_SpawnTeam("Pink", NUM_TEAM_4 - 1);
        }
        
-       ret_float = ctf_teams;
 -      ctf_ScoreRules();
 +      ctf_ScoreRules(ctf_teams);
  }
  
  void ctf_Initialize()