]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/notification_rewrite
authorSamual Lenks <samual@xonotic.org>
Sun, 3 Feb 2013 21:30:25 +0000 (16:30 -0500)
committerSamual Lenks <samual@xonotic.org>
Sun, 3 Feb 2013 21:30:25 +0000 (16:30 -0500)
1  2 
qcsrc/server/cl_client.qc
qcsrc/server/race.qc
qcsrc/server/scores.qc

index 6fb67b4f084dd36895993faf4ba1c73f0748e014,691f8621c6f8b35b14c5f80b0057a248fb720aff..7aa2f1c8ff4d0a1e6669d7ba2ce83ddb1ef43a50
@@@ -407,10 -407,11 +407,11 @@@ void PutObserverInServer (void
        minstagib_stop_countdown(self);
  
        Portal_ClearAll(self);
+       
        if(self.alivetime)
        {
-               PlayerStats_Event(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
+               if(!inWarmupStage)
+                       PlayerStats_Event(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
                self.alivetime = 0;
        }
  
        {
                if(self.version_mismatch)
                {
+                       self.frags = FRAGS_SPECTATOR;
                        Spawnqueue_Unmark(self);
                        Spawnqueue_Remove(self);
                }
                else
                {
+                       self.frags = FRAGS_LMS_LOSER;
                        Spawnqueue_Insert(self);
                }
        }
                else
                        self.frags = FRAGS_SPECTATOR;
        }
+       else if((g_race && g_race_qualifying) || g_cts)
+       {
+               if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
+                       self.frags = FRAGS_LMS_LOSER;
+               else
+                       self.frags = FRAGS_SPECTATOR;
+       }
        else
                self.frags = FRAGS_SPECTATOR;
  }
@@@ -554,7 -564,7 +564,7 @@@ void FixPlayermodel(
                if(teamplay)
                {
                        string s;
 -                      s = Team_ColorNameLowerCase(self.team);
 +                      s = Team_ColorName_Lower(self.team);
                        if(s != "neutral")
                        {
                                defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s));
@@@ -913,8 -923,9 +923,9 @@@ void PutClientInServer (void
                self.weaponname = "";
                self.switchingweapon = 0;
  
-               if(!self.alivetime)
-                       self.alivetime = time;
+               if(!inWarmupStage)
+                       if(!self.alivetime)
+                               self.alivetime = time;
  
                antilag_clear(self);
  
@@@ -1241,10 -1252,10 +1252,10 @@@ void ClientKill_TeamChange (float targe
                }
                else
                {
 -                      self.killindicator.colormod = TeamColor(targetteam);
 +                      self.killindicator.colormod = Team_ColorRGB(targetteam);
                        if(clienttype(self) == CLIENTTYPE_REAL)
                        if(self.killindicator.cnt > 0)
 -                              Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, strcat("Changing to ", ColoredTeamName(targetteam), " in %d seconds"), 1, self.killindicator.cnt);
 +                              Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, strcat("^7Changing to ", Team_ColoredFullName(targetteam), "^7 in %d seconds"), 1, self.killindicator.cnt);
                }
        }
  
@@@ -1286,7 -1297,7 +1297,7 @@@ void FixClientCvars(entity e
                stuffcmd(e, "cl_cmd settemp cl_movecliptokeyboard 2\n");
        if(autocvar_g_antilag == 3) // client side hitscan
                stuffcmd(e, "cl_cmd settemp cl_prydoncursor_notrace 0\n");
 -      if(sv_gentle)
 +      if(autocvar_sv_gentle)
                stuffcmd(e, "cl_cmd settemp cl_gentle 1\n");
        /*
         * we no longer need to stuff this. Remove this comment block if you feel
@@@ -1335,6 -1346,7 +1346,6 @@@ ClientConnec
  Called when a client connects to the server
  =============
  */
 -string ColoredTeamName(float t);
  void DecodeLevelParms (void);
  //void dom_player_join_team(entity pl);
  void set_dom_state(entity e);
@@@ -1362,16 -1374,6 +1373,16 @@@ void ClientConnect (void
        self.flags = FL_CLIENT;
        self.version_nagtime = time + 10 + random() * 10;
  
 +      if(self.netaddress == "local")
 +      {
 +              print("^3server is local!\n");
 +
 +              if(server_is_local)
 +                      print("Multiple local clients???");
 +              else
 +                      server_is_local = TRUE;
 +      }
 +
        if(player_count<0)
        {
                dprint("BUG player count is lower than zero, this cannot happen!\n");
                {
                        switch(autocvar_g_campaign_forceteam)
                        {
 -                              case 1: self.team_forced = COLOR_TEAM1; break;
 -                              case 2: self.team_forced = COLOR_TEAM2; break;
 -                              case 3: self.team_forced = COLOR_TEAM3; break;
 -                              case 4: self.team_forced = COLOR_TEAM4; break;
 +                              case 1: self.team_forced = FL_TEAM_1; break;
 +                              case 2: self.team_forced = FL_TEAM_2; break;
 +                              case 3: self.team_forced = FL_TEAM_3; break;
 +                              case 4: self.team_forced = FL_TEAM_4; break;
                                default: self.team_forced = 0;
                        }
                }
        }
        else if(PlayerInIDList(self, autocvar_g_forced_team_red))
 -              self.team_forced = COLOR_TEAM1;
 +              self.team_forced = FL_TEAM_1;
        else if(PlayerInIDList(self, autocvar_g_forced_team_blue))
 -              self.team_forced = COLOR_TEAM2;
 +              self.team_forced = FL_TEAM_2;
        else if(PlayerInIDList(self, autocvar_g_forced_team_yellow))
 -              self.team_forced = COLOR_TEAM3;
 +              self.team_forced = FL_TEAM_3;
        else if(PlayerInIDList(self, autocvar_g_forced_team_pink))
 -              self.team_forced = COLOR_TEAM4;
 +              self.team_forced = FL_TEAM_4;
        else if(autocvar_g_forced_team_otherwise == "red")
 -              self.team_forced = COLOR_TEAM1;
 +              self.team_forced = FL_TEAM_1;
        else if(autocvar_g_forced_team_otherwise == "blue")
 -              self.team_forced = COLOR_TEAM2;
 +              self.team_forced = FL_TEAM_2;
        else if(autocvar_g_forced_team_otherwise == "yellow")
 -              self.team_forced = COLOR_TEAM3;
 +              self.team_forced = FL_TEAM_3;
        else if(autocvar_g_forced_team_otherwise == "pink")
 -              self.team_forced = COLOR_TEAM4;
 +              self.team_forced = FL_TEAM_4;
        else if(autocvar_g_forced_team_otherwise == "spectate")
                self.team_forced = -1;
        else if(autocvar_g_forced_team_otherwise == "spectator")
        bprint("^4", self.netname, "^4 connected");
  
        if(self.classname != "observer" && (g_domination || g_ctf))
 -              bprint(" and joined the ", ColoredTeamName(self.team));
 +              bprint(" and joined the ", Team_ColoredFullName(self.team));
  
        bprint("\n");
  
diff --combined qcsrc/server/race.qc
index fb029930c1ba1746550767354cae5a147ef3f6c2,2742888b6179bab1e088d5d4a222b778f01af3e2..4b32c6af694d3615d3b905c6953277c14fb67dfc
@@@ -156,13 -156,13 +156,13 @@@ void race_setTime(string map, float t, 
                recorddifference = strcat(" ^1[+", TIME_ENCODED_TOSTRING(t - oldrec), "]");
                bprint(mynetname, "^7 couldn't break their ", race_placeName(player_prevpos), " place record of ", TIME_ENCODED_TOSTRING(oldrec), recorddifference, "\n");
                race_SendStatus(0, e); // "fail"
 -              Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_FAIL, MSG_RACE);
 +              Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_RACE_FAIL, e.netname, TIME_ENCODED_TOSTRING(t), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG);
                return;
        } else if (!newpos) { // no ranking, time worse than the worst ranked
                recorddifference = strcat(" ^1[+", TIME_ENCODED_TOSTRING(t - race_readTime(GetMapname(), RANKINGS_CNT)), "]");
                bprint(mynetname, "^7 couldn't break the ", race_placeName(RANKINGS_CNT), " place record of ", TIME_ENCODED_TOSTRING(race_readTime(GetMapname(), RANKINGS_CNT)), recorddifference, "\n");
                race_SendStatus(0, e); // "fail"
 -              Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_FAIL, MSG_RACE);
 +              Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_RACE_FAIL, e.netname, TIME_ENCODED_TOSTRING(t), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG);
                return;
        }
  
                        bprint(mynetname, "^1 broke ", oldrec_holder, "^1's 1st place record with ", strcat(TIME_ENCODED_TOSTRING(t), recorddifference, "\n"));
                }
                race_SendStatus(3, e); // "new server record"
 -              Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_SERVER_RECORD, MSG_RACE);
 +              Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_RACE_NEW_RECORD, e.netname, TIME_ENCODED_TOSTRING(t), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG);
        } else {
                if(newpos == player_prevpos) {
                        recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]");
                        bprint(mynetname, "^5 improved their ", race_placeName(newpos), " ^5place record with ", TIME_ENCODED_TOSTRING(t), recorddifference, "\n");
                        race_SendStatus(1, e); // "new time"
 -                      Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_NEW_TIME, MSG_RACE);
 +                      Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_RACE_NEW_TIME, e.netname, TIME_ENCODED_TOSTRING(t), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG);
                } else if (oldrec == 0) {
                        bprint(mynetname, "^2 set the ", race_placeName(newpos), " ^2place record with ", TIME_ENCODED_TOSTRING(t), "\n");
                        race_SendStatus(2, e); // "new rank"
 -                      Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_NEW_RANK, MSG_RACE);
 +                      Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_RACE_NEW_RANK, e.netname, TIME_ENCODED_TOSTRING(t), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG);
                } else {
                        recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]");
                        bprint(mynetname, "^2 broke ", oldrec_holder, "^2's ", race_placeName(newpos), " ^2place record with ", strcat(TIME_ENCODED_TOSTRING(t), recorddifference, "\n"));
                        race_SendStatus(2, e); // "new rank"
 -                      Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_NEW_TIME, MSG_RACE);
 +                      Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_RACE_NEW_RANK, e.netname, TIME_ENCODED_TOSTRING(t), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG);
                }
        }
  }
@@@ -273,6 -273,10 +273,10 @@@ void race_SendTime(entity e, float cp, 
                }
                else
                {
+                       s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
+                       if(!s || t < s)
+                               PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
                        s = PlayerScore_Add(e, SP_RACE_TIME, 0);
                        snew = TIME_ENCODE(time - game_starttime);
                        PlayerScore_Add(e, SP_RACE_TIME, snew - s);
@@@ -1026,7 -1030,7 +1030,7 @@@ void race_ReadyRestart(
        Score_NicePrint(world);
  
        race_ClearRecords();
-       PlayerScore_Sort(race_place, 1);
+       PlayerScore_Sort(race_place, 0, 1, 0);
  
        entity e;
        FOR_EACH_CLIENT(e)
diff --combined qcsrc/server/scores.qc
index 2465cbc89859c4fb811a9cc691542eadcc860b36,0df5b69af06fbc09c3809ddca9604a3d51a0f412..1d62a7084254e750e14c04136c37ca49e83245c3
@@@ -204,13 -204,13 +204,13 @@@ void ScoreInfo_Init(float teams
                Net_LinkEntity(scores_initialized, FALSE, 0, ScoreInfo_SendEntity);
        }
        if(teams >= 1)
 -              TeamScore_Spawn(COLOR_TEAM1, "Red");
 +              TeamScore_Spawn(FL_TEAM_1, "Red");
        if(teams >= 2)
 -              TeamScore_Spawn(COLOR_TEAM2, "Blue");
 +              TeamScore_Spawn(FL_TEAM_2, "Blue");
        if(teams >= 3)
 -              TeamScore_Spawn(COLOR_TEAM3, "Yellow");
 +              TeamScore_Spawn(FL_TEAM_3, "Yellow");
        if(teams >= 4)
 -              TeamScore_Spawn(COLOR_TEAM4, "Pink");
 +              TeamScore_Spawn(FL_TEAM_4, "Pink");
  }
  
  /*
@@@ -248,18 -248,18 +248,18 @@@ float PlayerScore_SendEntity(entity to
        return TRUE;
  }
  
void PlayerScore_Clear(entity player)
float PlayerScore_Clear(entity player)
  {
        entity sk;
        float i;
  
        if(teamscores_entities_count)
-               return;
+               return 0;
  
-       if(g_lms) return;
-       if(g_arena || g_ca) return;
-       if(g_cts) return; // in CTS, you don't lose score by observing
-       if(g_race && g_race_qualifying) return; // in qualifying, you don't lose score by observing
+       if(g_lms) return 0;
+       if(g_arena || g_ca) return 0;
+       if(g_cts) return 0; // in CTS, you don't lose score by observing
+       if(g_race && g_race_qualifying) return 0; // in qualifying, you don't lose score by observing
  
        sk = player.scorekeeper;
        for(i = 0; i < MAX_SCORE; ++i)
                                sk.SendFlags |= pow(2, i);
                sk.(scores[i]) = 0;
        }
+       return 1;
  }
  
  void Score_ClearAll()
@@@ -665,23 -667,27 +667,27 @@@ string GetTeamScoreString(float tm, flo
        return out;
  }
  
- float PlayerTeamScore_Compare(entity p1, entity p2, float strict)
+ float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
  {
-       if(teamscores_entities_count)
+       if(teams && teamscores_entities_count)
+       {
                if(p1.team != p2.team)
                {
                        entity t1, t2;
                        float r;
                        t1 = teamscorekeepers[p1.team - 1];
                        t2 = teamscorekeepers[p2.team - 1];
-                       r = TeamScore_Compare(t1, t2, strict);
+                       r = TeamScore_Compare(t1, t2, ((teams >= 0) ? 1 : strict));
                        return r;
                }
+               if(teams < 0)
+                       return 0;
+       }
        
        return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
  }
  
- entity PlayerScore_Sort(.float field, float strict)
+ entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
  {
        entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
        float i, j;
        FOR_EACH_CLIENT(p)
                p.field = 0;
  
-       FOR_EACH_PLAYER(p) if(p.scorekeeper)
+       FOR_EACH_CLIENT(p) if(p.scorekeeper)
        {
+               if(nospectators)
+                       if(p.frags == FRAGS_SPECTATOR)
+                               continue;
                p.chain = plist;
                plist = p;
        }
                pbest = plist;
                for(p = plist; (pprev = p), (p = p.chain); )
                {
-                       if(PlayerTeamScore_Compare(p, pbest, strict) > 0)
+                       if(PlayerTeamScore_Compare(p, pbest, teams, strict) > 0)
                        {
                                pbest = p;
                                pbestprev = pprev;
                pbest.chain = world;
  
                ++i;
-               if(!plast || PlayerTeamScore_Compare(plast, pbest, 0))
+               if(!plast || PlayerTeamScore_Compare(plast, pbest, teams, 0))
                        j = i;
  
                pbest.field = j;
@@@ -785,7 -795,7 +795,7 @@@ void Score_NicePrint_Team(entity to, fl
        sk = teamscorekeepers[t - 1];
        if(sk)
        {
 -              s = strcat(s, ColoredTeamName(t));
 +              s = strcat(s, Team_ColoredFullName(t));
                for(i = 0; i < MAX_TEAMSCORE; ++i)
                        if(teamscores_label[i] != "")
                        {
@@@ -867,7 -877,7 +877,7 @@@ void Score_NicePrint(entity to
                        ++t;
        w = bound(6, floor(SCORESWIDTH / t - 1), 9);
  
-       p = PlayerScore_Sort(score_dummyfield, 1);
+       p = PlayerScore_Sort(score_dummyfield, 1, 1, 0);
        t = -1;
  
        if(!teamscores_entities_count)