]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
More work on unifying team functions
authorSamual Lenks <samual@xonotic.org>
Wed, 3 Oct 2012 19:32:16 +0000 (15:32 -0400)
committerSamual Lenks <samual@xonotic.org>
Wed, 3 Oct 2012 19:32:16 +0000 (15:32 -0400)
18 files changed:
qcsrc/client/hud.qc
qcsrc/client/progs.src
qcsrc/client/scoreboard.qc
qcsrc/client/teamplay.qc [deleted file]
qcsrc/client/teamplay.qh [deleted file]
qcsrc/common/notifications.qc
qcsrc/common/teams.qh [new file with mode: 0644]
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/g_damage.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/scores.qc
qcsrc/server/teamplay.qc
qcsrc/server/vehicles/vehicles.qc

index 60bfec04b43eda0df975725be66f178216092212..87ba6060848cce13bab83b03556b60658913a4c0 100644 (file)
@@ -241,6 +241,30 @@ float race_CheckName(string net_name) {
        return 0;
 }
 
+float GetPlayerColorForce(float i)
+{
+       if(!teamplay)
+               return 0;
+       else
+               return stof(getplayerkeyvalue(i, "colors")) & 15;
+}
+
+float GetPlayerColor(float i)
+{
+       if not(playerslots[i].gotscores) // unconnected
+               return FL_SPECTATOR;
+       else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
+               return FL_SPECTATOR;
+       else
+               return GetPlayerColorForce(i);
+}
+
+string GetPlayerName(float i)
+{
+       return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
+}
+
+
 /*
 ==================
 HUD panels
@@ -2452,7 +2476,7 @@ void HUD_Radar(void)
        {
                color2 = GetPlayerColor(tm.sv_entnum);
                //if(color == FL_SPECTATOR || color == color2)
-                       draw_teamradar_player(tm.origin, tm.angles, GetTeamRGB(color2));
+                       draw_teamradar_player(tm.origin, tm.angles, Team_ColorRGB(color2));
        }
        draw_teamradar_player(view_origin, view_angles, '1 1 1');
 
@@ -2493,7 +2517,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
                        for(i=0; i<team_count; ++i) {
                                if (i == floor((entries - 2) / players_per_team) || (entries == 1 && i == 0))
                                        HUD_Panel_DrawHighlight(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                               drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), eX * score_size + eY * fontsize_y, GetTeamRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), eX * score_size + eY * fontsize_y, Team_ColorRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
                        first_pl = 1;
                        pos_y += fontsize_y;
@@ -2518,7 +2542,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
                        }
 
                        if (team_count)
-                               score_color = GetTeamRGB(ColorByTeam(floor((i - first_pl) / players_per_team))) * 0.8;
+                               score_color = Team_ColorRGB(ColorByTeam(floor((i - first_pl) / players_per_team))) * 0.8;
                        s = textShortenToWidth(s, name_size, fontsize, stringwidth_colors);
                        drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                        drawstring(pos + eX * (name_size + spacing_size), ftos(score), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
@@ -2538,7 +2562,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
                                continue;
                        if (tm.team == myteam)
                                drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                       drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize_y, GetTeamRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize_y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                        ++i;
                }
                first_pl = 1;
@@ -2575,7 +2599,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
                        drawfill(pos, eX * mySize_x + eY * fontsize_y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                if (team_count)
-                       score_color = GetTeamRGB(pl.team) * 0.8;
+                       score_color = Team_ColorRGB(pl.team) * 0.8;
                s = textShortenToWidth(GetPlayerName(pl.sv_entnum), name_size, fontsize, stringwidth_colors);
                drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                drawstring(pos + eX * (name_size + spacing_size), ftos(pl.(scores[ps_primary])), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
@@ -2755,7 +2779,7 @@ void HUD_Score(void)
                                score_pos = pos + eX * column * (score_size_x + offset_x) + eY * row * (score_size_y + offset_y);
                                if (max_fragcount == score)
                                        HUD_Panel_DrawHighlight(score_pos, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                               drawstring_aspect(score_pos, ftos(score), score_size, GetTeamRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(score_pos, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                                ++row;
                                if(row >= rows)
                                {
@@ -2766,11 +2790,11 @@ void HUD_Score(void)
                        else if(tm.team == myteam) {
                                if (max_fragcount == score)
                                        HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                               drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, GetTeamRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                        } else {
                                if (max_fragcount == score)
                                        HUD_Panel_DrawHighlight(pos + eX * 0.75 * mySize_x + eY * (1/3) * rows * mySize_y, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                               drawstring_aspect(pos + eX * 0.75 * mySize_x + eY * (1/3) * rows * mySize_y, ftos(score), score_size, GetTeamRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(pos + eX * 0.75 * mySize_x + eY * (1/3) * rows * mySize_y, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                                ++rows;
                        }
                }
index 7ea864d5d09885094a0fecf6bf711e16b43a19a3..5aec16ba0c1a19727a2d5489b196525ea4262f62 100644 (file)
@@ -40,7 +40,6 @@ movetypes.qh
 prandom.qh
 bgmscript.qh
 noise.qh
-teamplay.qh
 tturrets.qh
 ../server/tturrets/include/turrets_early.qh
 ../server/movelib.qc
@@ -56,7 +55,6 @@ projectile.qh
 
 sortlist.qc
 miscfunctions.qc
-teamplay.qc
 ../server/t_items.qc
 
 teamradar.qc
index 417f97e0dfb45cc48d68a4365b2b978ba318a8fd..324c83b423c093fe3e14dd73e0cb7d93ad4e0c3e 100644 (file)
@@ -659,7 +659,7 @@ string HUD_FixScoreboardColumnWidth(float i, string str)
 void HUD_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_number)
 {
        vector tmp, rgb;
-       rgb = GetTeamRGB(pl.team);
+       rgb = Team_ColorRGB(pl.team);
        string str;
        float i, field;
        float is_spec;
@@ -1245,7 +1245,7 @@ void HUD_DrawScoreboard()
                                continue;
 
                        draw_beginBoldFont();
-                       rgb = GetTeamRGB(tm.team);
+                       rgb = Team_ColorRGB(tm.team);
                        str = ftos(tm.(teamscores[ts_primary]));
                        drawstring(pos + team_score_baseoffset - eX * stringwidth(str, FALSE, hud_fontsize * 1.5), str, hud_fontsize * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
@@ -1287,14 +1287,14 @@ void HUD_DrawScoreboard()
        }
        else if(autocvar_scoreboard_accuracy && spectatee_status != -1 && !warmup_stage) {
                if(teamplay)
-                       pos = HUD_DrawScoreboardAccuracyStats(pos, GetTeamRGB(myteam), bg_size);
+                       pos = HUD_DrawScoreboardAccuracyStats(pos, Team_ColorRGB(myteam), bg_size);
                else
                        pos = HUD_DrawScoreboardAccuracyStats(pos, rgb, bg_size);
        }
 
                
        if(teamplay)
-               pos = HUD_DrawMapStats(pos, GetTeamRGB(myteam), bg_size);
+               pos = HUD_DrawMapStats(pos, Team_ColorRGB(myteam), bg_size);
        else
                pos = HUD_DrawMapStats(pos, rgb, bg_size);
 
diff --git a/qcsrc/client/teamplay.qc b/qcsrc/client/teamplay.qc
deleted file mode 100644 (file)
index 058b699..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-float TeamByColor(float color)
-{
-       switch(color)
-       {
-       case FL_TEAM_1: return 0;
-       case FL_TEAM_2: return 1;
-       case FL_TEAM_3: return 2;
-       case FL_TEAM_4: return 3;
-       default: return 0;
-       }
-}
-float ColorByTeam(float i)
-{
-       switch(i)
-       {
-       case 0: return FL_TEAM_1;
-       case 1: return FL_TEAM_2;
-       case 2: return FL_TEAM_3;
-       case 3: return FL_TEAM_4;
-       default: return FL_TEAM_1;
-       }
-}
-
-float GetPlayerColorForce(float i)
-{
-       if(!teamplay)
-               return 0;
-       else
-               return stof(getplayerkeyvalue(i, "colors")) & 15;
-}
-
-float GetPlayerColor(float i)
-{
-       if not(playerslots[i].gotscores) // unconnected
-               return FL_SPECTATOR;
-       else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
-               return FL_SPECTATOR;
-       else
-               return GetPlayerColorForce(i);
-}
-
-string GetPlayerName(float i)
-{
-       return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
-}
-
-vector GetTeamRGB(float color)
-{
-       switch(color)
-       {
-       default: return '1 1 1';
-       case FL_TEAM_1: return '1 0 0'; // red
-       case FL_TEAM_2: return '0 0 1'; // blue
-       case FL_TEAM_3: return '1 1 0'; // yellow
-       case FL_TEAM_4: return '1 0 1'; // pink
-       }
-}
-
-string GetTeamName(float color)
-{
-       switch(color)
-       {
-       default: return _("Spectators");
-       case FL_TEAM_1: return _("Red Team");
-       case FL_TEAM_2: return _("Blue Team");
-       case FL_TEAM_3: return _("Yellow Team");
-       case FL_TEAM_4: return _("Pink Team");
-       }
-}
diff --git a/qcsrc/client/teamplay.qh b/qcsrc/client/teamplay.qh
deleted file mode 100644 (file)
index 8335990..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-float teamplay;
-float myteam;
index caca75999cf0e484c6c203a284199850fee0bd6e..b970907e5de86e8b967253f8e672c8bc73f1307d 100644 (file)
@@ -90,7 +90,7 @@ var float autocvar_notification_ctf_pickup_enemy_verbose = TRUE;
        #endif
 #define MSG_INFO_NOTIFICATIONS \
        MSG_INFO_NOTIF(INFO_EMPTY,                                                      0, 0, NO_STR_ARG, XPND2("", ""),                                        "", "", "") \
-       MULTITEAM_INFO(INFO_SCORES_, 2,                                         0, 0, NO_STR_ARG, XPND2("", ""),                                        "", _("^TC^TT ^BGteam scores!\n"), "") \
+       MULTITEAM_INFO(INFO_SCORES_, 4,                                         0, 0, NO_STR_ARG, XPND2("", ""),                                        "", _("^TC^TT ^BGteam scores!\n"), "") \
        MULTITEAM_INFO(INFO_CTF_FLAGRETURN_DROPPED_, 2,         0, 0, NO_STR_ARG, XPND2("", ""),                                        "", _("^BGThe ^TC^TT^BG flag was dropped in the base and returned itself\n"), "") \
        MULTITEAM_INFO(INFO_CTF_FLAGRETURN_DAMAGED_, 2,         0, 0, NO_STR_ARG, XPND2("", ""),                                        "", _("^BGThe ^TC^TT^BG flag was destroyed and returned to base\n"), "") \
        MULTITEAM_INFO(INFO_CTF_FLAGRETURN_SPEEDRUN_, 2,        0, 1, f1/100, XPND2("", ""),                                            "", _("^BGThe ^TC^TT^BG flag became impatient after ^F1%.2f^BG seconds and returned itself\n"), "") \
@@ -325,21 +325,31 @@ void Local_Notification(float net_type, float net_name, string s1, string s2, fl
                case MSG_INFO:
                {
                        #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) \
-                               { NOTIF_MATCH(name, net_name) CHECK_AUTOCVAR(name) { print(sprintf(CCR(normal_or_gentle(normal, gentle)), args)); if(strtolower(icon) != "") { HUD_Notify_Push(icon, hudargs); } } }
+                               { NOTIF_MATCH(name, net_name) CHECK_AUTOCVAR(name) \
+                               { \
+                                       print(sprintf(CCR(normal_or_gentle(normal, gentle)), args)); \
+                                       if(strtolower(icon) != "") { HUD_Notify_Push(icon, hudargs); } \
+                               } }
                        MSG_INFO_NOTIFICATIONS
                        break;
                }
                case MSG_CENTER:
                {
                        #define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) \
-                               { NOTIF_MATCH(name, net_name) CHECK_AUTOCVAR(name) { centerprint_generic(HANDLE_CPID(cpid), sprintf(CCR(normal_or_gentle(normal, gentle)), args), durcnt); } }
+                               { NOTIF_MATCH(name, net_name) CHECK_AUTOCVAR(name) \
+                               { \
+                                       centerprint_generic(HANDLE_CPID(cpid), sprintf(CCR(normal_or_gentle(normal, gentle)), args), durcnt); \
+                               } }
                        MSG_CENTER_NOTIFICATIONS
                        break;
                }
                case MSG_WEAPON:
                {
                        #define MSG_WEAPON_NOTIF(name,strnum,flnum,args,normal,gentle) \
-                               { NOTIF_MATCH(name, net_name) CHECK_AUTOCVAR(name) { print("unhandled\n"); } }
+                               { NOTIF_MATCH(name, net_name) CHECK_AUTOCVAR(name) \
+                               { \
+                                       print("unhandled\n"); \
+                               } }
                        MSG_WEAPON_NOTIFICATIONS
                        break;
                }
diff --git a/qcsrc/common/teams.qh b/qcsrc/common/teams.qh
new file mode 100644 (file)
index 0000000..ef1b3c7
--- /dev/null
@@ -0,0 +1,137 @@
+#ifdef TEAMNUMBERS_THAT_ARENT_STUPID
+const float FL_TEAM_1 = 1;  // red
+const float FL_TEAM_2 = 2; // blue
+const float FL_TEAM_3 = 3; // yellow
+const float FL_TEAM_4 = 4; // pink
+const float FL_SPECTATOR = 5;
+#else
+#ifdef CSQC
+const float FL_TEAM_1 = 4;  // red
+const float FL_TEAM_2 = 13; // blue
+const float FL_TEAM_3 = 12; // yellow
+const float FL_TEAM_4 = 9; // pink
+#else
+const float FL_TEAM_1 = 5;  // red
+const float FL_TEAM_2 = 14; // blue
+const float FL_TEAM_3 = 13; // yellow
+const float FL_TEAM_4 = 10; // pink
+#endif
+const float FL_SPECTATOR = 1337;
+#endif
+
+const string COL_TEAM_1 = "^1";
+const string COL_TEAM_2 = "^4";
+const string COL_TEAM_3 = "^3";
+const string COL_TEAM_4 = "^6";
+const string STR_TEAM_1 = _("Red");
+const string STR_TEAM_2 = _("Blue");
+const string STR_TEAM_3 = _("Yellow");
+const string STR_TEAM_4 = _("Pink");
+const string STR_TEAM = _("Team");
+const string STR_NEUTRAL = _("Neutral");
+
+#ifdef CSQC
+float teamplay;
+float myteam;
+#endif
+
+string Team_ColorCode(float teamid)
+{
+    switch(teamid)
+    {
+               case FL_TEAM_1: return COL_TEAM_1;
+       case FL_TEAM_2: return COL_TEAM_2;
+       case FL_TEAM_3: return COL_TEAM_3;
+       case FL_TEAM_4: return COL_TEAM_4;
+       }
+       
+       return "^7";
+}
+
+vector Team_ColorRGB(float teamid)
+{
+       switch(teamid)
+       {
+               #ifdef TEAMNUMBERS_THAT_ARENT_STUPID
+               case FL_TEAM_1: return '1 0 0'; // red
+               case FL_TEAM_2: return '0 0 1'; // blue
+               case FL_TEAM_3: return '1 1 0'; // yellow
+               case FL_TEAM_4: return '1 0 1'; // pink
+               #else
+               case FL_TEAM_1: return '1 0.0625 0.0625';
+               case FL_TEAM_2: return '0.0625 0.0625 1';
+               case FL_TEAM_3: return '1 1 0.0625';
+               case FL_TEAM_4: return '1 0.0625 1';
+               #endif
+       }
+
+    return '0 0 0';
+}
+
+string Team_ColorName(float teamid)
+{
+    switch(teamid)
+    {
+               case FL_TEAM_1: return STR_TEAM_1;
+       case FL_TEAM_2: return STR_TEAM_2;
+       case FL_TEAM_3: return STR_TEAM_3;
+       case FL_TEAM_4: return STR_TEAM_4;
+       }
+       
+    return STR_NEUTRAL;
+}
+
+float Team_ColorToTeam(string team_color)
+{
+       switch(strtolower(team_color))
+       {
+               case "red": return FL_TEAM_1;
+       case "blue": return FL_TEAM_2;
+       case "yellow": return FL_TEAM_3;
+       case "pink": return FL_TEAM_4;
+       case "auto": return 0;
+       }
+       
+       return -1;
+}
+
+float Team_NumberToTeam(float number)
+{
+       switch(number)
+       {
+               case 1: return FL_TEAM_1;
+               case 2: return FL_TEAM_2;
+               case 3: return FL_TEAM_3;
+               case 4: return FL_TEAM_4;
+       }
+       
+       return -1;
+}
+
+float Team_TeamToNumber(float teamid)
+{
+       switch(teamid)
+       {
+               case FL_TEAM_1: return 1;
+               case FL_TEAM_2: return 2;
+               case FL_TEAM_3: return 3;
+               case FL_TEAM_4: return 4;
+       }
+       
+       return -1;
+}
+
+
+// legacy aliases for shitty code
+float TeamByColor(float teamid) { return (Team_TeamToNumber(teamid) - 1); }
+float ColorByTeam(float number) { return Team_NumberToTeam(number + 1); }
+
+// useful aliases
+string Team_ColorName_Lower(float teamid) { return strtolower(Team_ColorName(teamid)); }
+string Team_ColorName_Upper(float teamid) { return strtoupper(Team_ColorName(teamid)); }
+
+string Team_FullName(float teamid) { return strcat(Team_ColorName(teamid), " ", STR_TEAM, "^7"); }
+string Team_ColoredFullName(float teamid) { return strcat(Team_ColorCode(teamid), Team_ColorName(teamid), " ", STR_TEAM, "^7"); }
+
+string Team_NumberToFullName(float number) { return Team_FullName(Team_NumberToTeam(number)); }
+string Team_NumberToColoredFullName(float number) { return Team_ColoredFullName(Team_NumberToTeam(number)); }
index 8512f57dfbfe2a6752aff8cb4780dd962ccdce6b..006db3c36b6d5e73f3c7f9b6c5a35a45121281bc 100644 (file)
@@ -1241,10 +1241,10 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                }
                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);
                }
        }
 
@@ -1335,7 +1335,6 @@ ClientConnect
 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);
@@ -1479,7 +1478,7 @@ void ClientConnect (void)
        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");
 
index f7c206091f63096298571f285ecea6a96d88d4ea..cbec4f5ea39a5ffa5eccfc8346aac35225a609e1 100644 (file)
@@ -1425,5 +1425,5 @@ void MoveToTeam(entity client, float team_colour, float type, float show_message
        if not(show_message & 1) // admin message
                sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: You have been moved to the ", Team_ColorName_Lower(team_colour), " team\n"));  // send a chat message
 
-       bprint(strcat(client.netname, " joined the ", ColoredTeamName(client.team), "\n"));
+       bprint(strcat(client.netname, " joined the ", Team_ColoredFullName(client.team), "\n"));
 }
index c289334f25ea56b834875f8e9626ca72145e1c81..fc2b3c0aa021a6aed66d2c4df59b14c7f9c38ebe 100644 (file)
@@ -961,21 +961,21 @@ void GameCommand_moveplayer(float request, float argc)
                                                        if(teamplay)
                                                        {
                                                                // set up
-                                                               float team_color;
+                                                               float team_id;
                                                                float save = client.team_forced;
                                                                client.team_forced = 0;
 
                                                                // find the team to move the player to
-                                                               team_color = Team_ColorToNumber(destination);
-                                                               if(team_color == client.team) // already on the destination team
+                                                               team_id = Team_ColorToTeam(destination);
+                                                               if(team_id == client.team) // already on the destination team
                                                                {
                                                                        // keep the forcing undone
-                                                                       print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", ColoredTeamName(client.team), (targets ? ", skipping to next player.\n" : ".\n"));
+                                                                       print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
                                                                        continue;
                                                                } 
-                                                               else if(team_color == 0)  // auto team
+                                                               else if(team_id == 0)  // auto team
                                                                {
-                                                                       team_color = Team_NumberToTeam(FindSmallestTeam(client, FALSE));
+                                                                       team_id = Team_NumberToTeam(FindSmallestTeam(client, FALSE));
                                                                }
                                                                else
                                                                {
@@ -984,7 +984,7 @@ void GameCommand_moveplayer(float request, float argc)
                                                                client.team_forced = save;
                                                                
                                                                // Check to see if the destination team is even available
-                                                               switch(team_color
+                                                               switch(team_id
                                                                {
                                                                        case FL_TEAM_1: if(c1 == -1) { print("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
                                                                        case FL_TEAM_2: if(c2 == -1) { print("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
@@ -996,9 +996,9 @@ void GameCommand_moveplayer(float request, float argc)
                                                                
                                                                // If so, lets continue and finally move the player
                                                                client.team_forced = 0;
-                                                               MoveToTeam(client, team_color, 6, stof(notify));
+                                                               MoveToTeam(client, team_id, 6, stof(notify));
                                                                successful = strcat(successful, (successful ? ", " : ""), client.netname);
-                                                               print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") has been moved to the ", ColoredTeamName(team_color), ".\n");
+                                                               print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n");
                                                                continue;
                                                        }
                                                        else
index b32424d37dc0840e51ad330bcc6fead80cbe2730..3a211853c4634b58d6f14b32c72d3eab577ace25 100644 (file)
@@ -334,7 +334,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 
                if (targ == attacker) // suicides
                {
-                       s1 = ((deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE) ? ColoredTeamName(targ.team) : "");
+                       s1 = ((deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE) ? Team_ColoredFullName(targ.team) : "");
 
                        // no "killed your own dumb self" message in CTS
             if(!g_cts) { Obituary_Notification(targ, s1, "", "", deathtype); }
index 593d57d403790f4f5e1acd3deda46686ee02d1e5..b32dec3660b704e8386a2e2118fc88f7926ec525 100644 (file)
@@ -32,7 +32,6 @@ void WarpZone_crosshair_trace(entity pl)
 void() spawnfunc_info_player_deathmatch; // needed for the other spawnpoints
 void() spawnpoint_use;
 string GetMapname();
-string ColoredTeamName(float t);
 
 string admin_name(void)
 {
index bcf42bbed4c5f3acf45419e4c8c91f313b9a9df7..9bf9498c5c4fcc76646489f8ec186d4635e8e6cd 100644 (file)
@@ -541,7 +541,7 @@ void kh_WinnerTeam(float teem)  // runs when a team wins
                        bprint(key.owner.netname);
                        first = FALSE;
                }
-       bprint("^7 captured the keys for the ", ColoredTeamName(teem), "\n");
+       bprint("^7 captured the keys for the ", Team_ColoredFullName(teem), "\n");
 
        first = TRUE;
        midpoint = '0 0 0';
@@ -567,7 +567,7 @@ void kh_WinnerTeam(float teem)  // runs when a team wins
                te_lightning2(world, lastorigin, firstorigin);
        }
        midpoint = midpoint * (1 / kh_teams);
-       te_customflash(midpoint, 1000, 1, TeamColor(teem) * 0.5 + '0.5 0.5 0.5');  // make the color >=0.5 in each component
+       te_customflash(midpoint, 1000, 1, Team_ColorRGB(teem) * 0.5 + '0.5 0.5 0.5');  // make the color >=0.5 in each component
 
        play2all(kh_sound_capture);
        kh_FinishRound();
@@ -596,7 +596,7 @@ void kh_LoserTeam(float teem, entity lostkey)  // runs when a player pushes a fl
                kh_Scores_Event(attacker, world, "push", autocvar_g_balance_keyhunt_score_push, 0);
                PlayerScore_Add(attacker, SP_KH_PUSHES, 1);
                centerprint(attacker, "Your push is the best!");
-               bprint("The ", ColoredTeamName(teem), "^7 could not take care of the ", lostkey.netname, "^7 when ", attacker.netname, "^7 came\n");
+               bprint("The ", Team_ColoredFullName(teem), "^7 could not take care of the ", lostkey.netname, "^7 when ", attacker.netname, "^7 came\n");
        }
        else
        {
@@ -656,7 +656,7 @@ void kh_LoserTeam(float teem, entity lostkey)  // runs when a player pushes a fl
                        --j;
                }
 
-               bprint("The ", ColoredTeamName(teem), "^7 could not take care of the ", lostkey.netname, "\n");
+               bprint("The ", Team_ColoredFullName(teem), "^7 could not take care of the ", lostkey.netname, "\n");
        }
        play2all(kh_sound_destroy);
        te_tarexplosion(lostkey.origin);
@@ -715,7 +715,7 @@ void kh_Key_Think()  // runs all the time
                                else
                                        Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, "All keys are in your team's hands!\n\nHelp the key carriers to meet!", 0, 0);
                        else
-                               Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, strcat("All keys are in the ", ColoredTeamName(kh_interferemsg_team), "^7's hands!\n\nInterfere ^1NOW^7!"), 0, 0);
+                               Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, strcat("All keys are in the ", Team_ColoredFullName(kh_interferemsg_team), "^7's hands!\n\nInterfere ^1NOW^7!"), 0, 0);
                }
        }
 
@@ -748,7 +748,7 @@ void kh_Key_Spawn(entity initial_owner, float angle, float i)  // runs every tim
        key.kh_dropperteam = 0;
        key.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
        setsize(key, KH_KEY_MIN, KH_KEY_MAX);
-       key.colormod = TeamColor(initial_owner.team) * KH_KEY_BRIGHTNESS;
+       key.colormod = Team_ColorRGB(initial_owner.team) * KH_KEY_BRIGHTNESS;
        key.reset = key_reset;
 
        switch(initial_owner.team)
@@ -876,7 +876,7 @@ string kh_CheckEnoughPlayers()  // checks enough player are present, runs after
                {
                        if(result != "")
                                result = strcat(result, ", ");
-                       result = strcat(result, ColoredTeamName(teem));
+                       result = strcat(result, Team_ColoredFullName(teem));
                }
        }
        return result;
index 433d781fb9eb1df2dc08c2327320f9e2090aa0ce..f5b92a4808f39528ac5e769beeff3b09c5069885 100644 (file)
@@ -49,7 +49,7 @@ void nexball_setstatus(void)
        {
                if(self.ballcarried.teamtime && (self.ballcarried.teamtime < time))
                {
-                       bprint("The ", ColoredTeamName(self.team), " held the ball for too long.\n");
+                       bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n");
                        oldself = self;
                        self = self.ballcarried;
                        DropBall(self, self.owner.origin, '0 0 0');
@@ -204,7 +204,7 @@ void ResetBall(void)
        if(self.cnt < 2)        // step 1
        {
                if(time == self.teamtime)
-                       bprint("The ", ColoredTeamName(self.team), " held the ball for too long.\n");
+                       bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n");
                self.touch = SUB_Null;
                self.movetype = MOVETYPE_NOCLIP;
                self.velocity = '0 0 0'; // just in case?
@@ -341,9 +341,9 @@ void GoalTouch(void)
        {
                LogNB("fault", ball.pusher);
                if(nb_teams == 2)
-                       bprint(ColoredTeamName(otherteam), " gets a point due to ", pname, "^7's silliness.\n");
+                       bprint(Team_ColoredFullName(otherteam), " gets a point due to ", pname, "^7's silliness.\n");
                else
-                       bprint(ColoredTeamName(ball.team), " loses a point due to ", pname, "^7's silliness.\n");
+                       bprint(Team_ColoredFullName(ball.team), " loses a point due to ", pname, "^7's silliness.\n");
                pscore = -1;
        }
        else if(self.team == GOAL_OUT)
@@ -358,7 +358,7 @@ void GoalTouch(void)
        else                                                       //score
        {
                LogNB(strcat("goal:", ftos(self.team)), ball.pusher);
-               bprint("Goaaaaal! ", pname, "^7 scored a point for the ", ColoredTeamName(ball.team), ".\n");
+               bprint("Goaaaaal! ", pname, "^7 scored a point for the ", Team_ColoredFullName(ball.team), ".\n");
                pscore = 1;
        }
 
index 70479625aa27d3ba5979bcccfda3be9847435190..b09a9e982188d5eea299f5a78b162ba0741326ad 100644 (file)
@@ -596,7 +596,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage,
                if (time > self.pain_finished)
                {
                        self.pain_finished = time + 10;
-                       bprint(ColoredTeamName(self.team), " generator under attack!\n");
+                       bprint(Team_ColoredFullName(self.team), " generator under attack!\n");
                        play2team(self.team, "onslaught/generator_underattack.wav");
                }
        }
@@ -612,19 +612,19 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage,
                lh = ceil(self.lasthealth / 100) * 100;
                h = ceil(self.health / 100) * 100;
                if(lh != h)
-                       bprint(ColoredTeamName(self.team), " generator has less than ", ftos(h), " health remaining\n");
+                       bprint(Team_ColoredFullName(self.team), " generator has less than ", ftos(h), " health remaining\n");
 #endif
                self.lasthealth = self.health;
        }
        else if not(inWarmupStage)
        {
                if (attacker == self)
-                       bprint(ColoredTeamName(self.team), " generator spontaneously exploded due to overtime!\n");
+                       bprint(Team_ColoredFullName(self.team), " generator spontaneously exploded due to overtime!\n");
                else
                {
                        string t;
-                       t = ColoredTeamName(attacker.team);
-                       bprint(ColoredTeamName(self.team), " generator destroyed by ", t, "!\n");
+                       t = Team_ColoredFullName(attacker.team);
+                       bprint(Team_ColoredFullName(self.team), " generator destroyed by ", t, "!\n");
                }
                self.iscaptured = FALSE;
                self.islinked = FALSE;
@@ -1035,8 +1035,8 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
                pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
                {
                        string t;
-                       t = ColoredTeamName(attacker.team);
-                       bprint(ColoredTeamName(self.team), " ", self.message, " control point destroyed by ", t, "\n");
+                       t = Team_ColoredFullName(attacker.team);
+                       bprint(Team_ColoredFullName(self.team), " ", self.message, " control point destroyed by ", t, "\n");
                        ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 25, "models/onslaught/controlpoint_icon_gib1.md3", 3, FALSE);
                        ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, FALSE);
                        ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, FALSE);
@@ -1234,7 +1234,7 @@ void onslaught_controlpoint_icon_buildthink()
                self.count = autocvar_g_onslaught_cp_regen * sys_frametime; // slow repair rate from now on
                self.think = onslaught_controlpoint_icon_think;
                sound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTN_NORM);
-               bprint(ColoredTeamName(self.team), " captured ", self.owner.message, " control point\n");
+               bprint(Team_ColoredFullName(self.team), " captured ", self.owner.message, " control point\n");
                self.owner.iscaptured = TRUE;
 
                WaypointSprite_UpdateMaxHealth(self.owner.sprite, self.max_health);
index 19d613b0791b635b4564ca85983d721d65b5be0e..38425a8ba180c67b116783366579e49c2576790c 100644 (file)
@@ -775,7 +775,7 @@ void Score_NicePrint_Team(entity to, float t, float w)
        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] != "")
                        {
index be6f34a6e0a6dd2437144c2b02c0b3264fd0f8f1..fd7b554ef33c5ac10cf7c510fbca176604744fd6 100644 (file)
@@ -13,45 +13,6 @@ void TeamchangeFrags(entity e)
        PlayerScore_Clear(e);
 }
 
-vector TeamColor(float teem)
-{
-       switch(teem)
-       {
-               case FL_TEAM_1:
-                       return '1 0.0625 0.0625';
-               case FL_TEAM_2:
-                       return '0.0625 0.0625 1';
-               case FL_TEAM_3:
-                       return '1 1 0.0625';
-               case FL_TEAM_4:
-                       return '1 0.0625 1';
-               default:
-                       return '1 1 1';
-       }
-}
-
-string TeamName(float t)
-{
-       return strcat(Team_ColorName(t), " Team");
-}
-string ColoredTeamName(float t)
-{
-       return strcat(Team_ColorCode(t), Team_ColorName(t), " Team^7");
-}
-string TeamNoName(float t)
-{
-       // fixme: Search for team entities and get their .netname's!
-       if(t == 1)
-               return "Red Team";
-       if(t == 2)
-               return "Blue Team";
-       if(t == 3)
-               return "Yellow Team";
-       if(t == 4)
-               return "Pink Team";
-       return "Neutral Team";
-}
-
 void dom_init();
 void runematch_init();
 void tdm_init();
@@ -431,7 +392,7 @@ void SetPlayerTeam(entity pl, float t, float s, float noprint)
                LogTeamchange(pl.playerid, pl.team, 3);  // log manual team join
 
                if(!noprint)
-               bprint(pl.netname, "^7 has changed from ", TeamNoName(s), " to ", TeamNoName(t), "\n");
+               bprint(pl.netname, "^7 has changed from ", Team_NumberToColoredFullName(s), "^7 to ", Team_NumberToColoredFullName(t), "\n");
        }
 
 }
@@ -1049,7 +1010,7 @@ void ShufflePlayerOutOfTeam (float source_team)
 
        if(selected.deadflag == DEAD_NO)
                Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0');
-       centerprint(selected, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", ColoredTeamName(selected.team)));
+       centerprint(selected, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", Team_ColoredFullName(selected.team)));
 }
 
 // code from here on is just to support maps that don't have team entities
index 16a339e09f40380dec3e1f84cfb5512d63252d5f..861f8ee4e8ff39c2f68621e52973a31e9a2ffdea 100644 (file)
@@ -1033,7 +1033,7 @@ void vehicles_showwp()
     }
 
     if(teamplay && self.team)
-           rgb = TeamColor(self.team);
+           rgb = Team_ColorRGB(self.team);
     else
            rgb = '1 1 1';
     WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb);