Xonotic
teams.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ColorByTeam(number)   Team_IndexToTeam(number + 1)
 
#define DIFF_TEAM(a, b)   (teamplay ? (a.team != b.team) : (a != b))
 
#define FLAG_TEAM_1   CTX(_("FLAG^Red"))
 
#define FLAG_TEAM_2   CTX(_("FLAG^Blue"))
 
#define FLAG_TEAM_3   CTX(_("FLAG^Yellow"))
 
#define FLAG_TEAM_4   CTX(_("FLAG^Pink"))
 
#define GENERATOR_TEAM_1   CTX(_("GENERATOR^Red"))
 
#define GENERATOR_TEAM_2   CTX(_("GENERATOR^Blue"))
 
#define GENERATOR_TEAM_3   CTX(_("GENERATOR^Yellow"))
 
#define GENERATOR_TEAM_4   CTX(_("GENERATOR^Pink"))
 
#define KEY_TEAM_1   CTX(_("KEY^Red"))
 
#define KEY_TEAM_2   CTX(_("KEY^Blue"))
 
#define KEY_TEAM_3   CTX(_("KEY^Yellow"))
 
#define KEY_TEAM_4   CTX(_("KEY^Pink"))
 
#define NAME_NEUTRAL   _("Neutral")
 
#define NAME_TEAM   _("Team")
 
#define NAME_TEAM_1   CTX(_("TEAM^Red"))
 
#define NAME_TEAM_2   CTX(_("TEAM^Blue"))
 
#define NAME_TEAM_3   CTX(_("TEAM^Yellow"))
 
#define NAME_TEAM_4   CTX(_("TEAM^Pink"))
 
#define SAME_TEAM(a, b)   (teamplay ? (a.team == b.team) : (a == b))
 
#define Static_Team_ColorName_Lower(teamid)   strtolower(Static_Team_ColorName(teamid))
 
#define Static_Team_ColorName_Upper(teamid)   strtoupper(Static_Team_ColorName(teamid))
 
#define TCR(input, type, team)   strreplace("^TC", COL_TEAM_##team, strreplace("^TT", strtoupper(type##_TEAM_##team), input))
 
#define Team_ColoredFullName(teamid)   strcat(Team_ColorCode(teamid), Team_ColorName(teamid), " ", NAME_TEAM, "^7")
 
#define Team_ColorName_Lower(teamid)   strtolower(Team_ColorName(teamid))
 
#define Team_ColorName_Upper(teamid)   strtoupper(Team_ColorName(teamid))
 
#define Team_FullName(teamid)   strcat(Team_ColorName(teamid), " ", NAME_TEAM, "^7")
 
#define Team_IndexToColoredFullName(index)   Team_ColoredFullName(Team_IndexToTeam(index))
 
#define Team_IndexToFullName(index)   Team_FullName(Team_IndexToTeam(index))
 
#define TeamByColor(teamid)   (Team_TeamToIndex(teamid) - 1)
 

Functions

string Static_Team_ColorName (int teamid)
 
string Team_ColorCode (int teamid)
 
string Team_ColorName (int teamid)
 
vector Team_ColorRGB (int teamid)
 
float Team_ColorToTeam (string team_color)
 
int Team_IndexToBit (int index)
 Converts team index into bit value that is used in team bitmasks. More...
 
int Team_IndexToTeam (int index)
 Converts team index into team value. More...
 
bool Team_IsValidIndex (int index)
 Returns whether the team index is valid. More...
 
bool Team_IsValidTeam (int team_num)
 Returns whether team value is valid. More...
 
int Team_TeamToBit (int team_num)
 Converts team value into bit value that is used in team bitmasks. More...
 
int Team_TeamToIndex (int team_num)
 Converts team value into team index. More...
 

Variables

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 int NUM_SPECTATOR = 1337
 
const int NUM_TEAM_1 = 5
 
const int NUM_TEAM_2 = 14
 
const int NUM_TEAM_3 = 13
 
const int NUM_TEAM_4 = 10
 
const int NUM_TEAMS = 4
 Number of teams in the game. More...
 
const string STATIC_NAME_TEAM_1 = "Red"
 
const string STATIC_NAME_TEAM_2 = "Blue"
 
const string STATIC_NAME_TEAM_3 = "Yellow"
 
const string STATIC_NAME_TEAM_4 = "Pink"
 

Macro Definition Documentation

◆ ColorByTeam

#define ColorByTeam (   number)    Team_IndexToTeam(number + 1)

Definition at line 219 of file teams.qh.

Referenced by HUD_Score_Rankings().

◆ DIFF_TEAM

◆ FLAG_TEAM_1

#define FLAG_TEAM_1   CTX(_("FLAG^Red"))

Definition at line 43 of file teams.qh.

◆ FLAG_TEAM_2

#define FLAG_TEAM_2   CTX(_("FLAG^Blue"))

Definition at line 44 of file teams.qh.

◆ FLAG_TEAM_3

#define FLAG_TEAM_3   CTX(_("FLAG^Yellow"))

Definition at line 45 of file teams.qh.

◆ FLAG_TEAM_4

#define FLAG_TEAM_4   CTX(_("FLAG^Pink"))

Definition at line 46 of file teams.qh.

◆ GENERATOR_TEAM_1

#define GENERATOR_TEAM_1   CTX(_("GENERATOR^Red"))

Definition at line 47 of file teams.qh.

◆ GENERATOR_TEAM_2

#define GENERATOR_TEAM_2   CTX(_("GENERATOR^Blue"))

Definition at line 48 of file teams.qh.

◆ GENERATOR_TEAM_3

#define GENERATOR_TEAM_3   CTX(_("GENERATOR^Yellow"))

Definition at line 49 of file teams.qh.

◆ GENERATOR_TEAM_4

#define GENERATOR_TEAM_4   CTX(_("GENERATOR^Pink"))

Definition at line 50 of file teams.qh.

◆ KEY_TEAM_1

#define KEY_TEAM_1   CTX(_("KEY^Red"))

Definition at line 39 of file teams.qh.

◆ KEY_TEAM_2

#define KEY_TEAM_2   CTX(_("KEY^Blue"))

Definition at line 40 of file teams.qh.

◆ KEY_TEAM_3

#define KEY_TEAM_3   CTX(_("KEY^Yellow"))

Definition at line 41 of file teams.qh.

◆ KEY_TEAM_4

#define KEY_TEAM_4   CTX(_("KEY^Pink"))

Definition at line 42 of file teams.qh.

◆ NAME_NEUTRAL

#define NAME_NEUTRAL   _("Neutral")

Definition at line 36 of file teams.qh.

Referenced by Static_Team_ColorName(), and Team_ColorName().

◆ NAME_TEAM

#define NAME_TEAM   _("Team")

Definition at line 35 of file teams.qh.

◆ NAME_TEAM_1

#define NAME_TEAM_1   CTX(_("TEAM^Red"))

Definition at line 31 of file teams.qh.

Referenced by Team_ColorName().

◆ NAME_TEAM_2

#define NAME_TEAM_2   CTX(_("TEAM^Blue"))

Definition at line 32 of file teams.qh.

Referenced by Team_ColorName().

◆ NAME_TEAM_3

#define NAME_TEAM_3   CTX(_("TEAM^Yellow"))

Definition at line 33 of file teams.qh.

Referenced by Team_ColorName().

◆ NAME_TEAM_4

#define NAME_TEAM_4   CTX(_("TEAM^Pink"))

Definition at line 34 of file teams.qh.

Referenced by Team_ColorName().

◆ SAME_TEAM

◆ Static_Team_ColorName_Lower

#define Static_Team_ColorName_Lower (   teamid)    strtolower(Static_Team_ColorName(teamid))

Definition at line 226 of file teams.qh.

Referenced by ctf_FlagSetup().

◆ Static_Team_ColorName_Upper

#define Static_Team_ColorName_Upper (   teamid)    strtoupper(Static_Team_ColorName(teamid))

Definition at line 227 of file teams.qh.

◆ TCR

#define TCR (   input,
  type,
  team 
)    strreplace("^TC", COL_TEAM_##team, strreplace("^TT", strtoupper(type##_TEAM_##team), input))

Definition at line 236 of file teams.qh.

◆ Team_ColoredFullName

#define Team_ColoredFullName (   teamid)    strcat(Team_ColorCode(teamid), Team_ColorName(teamid), " ", NAME_TEAM, "^7")

◆ Team_ColorName_Lower

#define Team_ColorName_Lower (   teamid)    strtolower(Team_ColorName(teamid))

Definition at line 222 of file teams.qh.

◆ Team_ColorName_Upper

#define Team_ColorName_Upper (   teamid)    strtoupper(Team_ColorName(teamid))

Definition at line 223 of file teams.qh.

Referenced by ctf_FlagSetup(), and NextLevel().

◆ Team_FullName

#define Team_FullName (   teamid)    strcat(Team_ColorName(teamid), " ", NAME_TEAM, "^7")

Definition at line 229 of file teams.qh.

◆ Team_IndexToColoredFullName

#define Team_IndexToColoredFullName (   index)    Team_ColoredFullName(Team_IndexToTeam(index))

Definition at line 233 of file teams.qh.

◆ Team_IndexToFullName

#define Team_IndexToFullName (   index)    Team_FullName(Team_IndexToTeam(index))

Definition at line 232 of file teams.qh.

◆ TeamByColor

#define TeamByColor (   teamid)    (Team_TeamToIndex(teamid) - 1)

Definition at line 218 of file teams.qh.

Function Documentation

◆ Static_Team_ColorName()

string Static_Team_ColorName ( int  teamid)

Definition at line 103 of file teams.qh.

References NAME_NEUTRAL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, STATIC_NAME_TEAM_1, STATIC_NAME_TEAM_2, STATIC_NAME_TEAM_3, and STATIC_NAME_TEAM_4.

Referenced by Get_Notif_CvarName().

104 {
105  switch(teamid)
106  {
107  case NUM_TEAM_1: return STATIC_NAME_TEAM_1;
108  case NUM_TEAM_2: return STATIC_NAME_TEAM_2;
109  case NUM_TEAM_3: return STATIC_NAME_TEAM_3;
110  case NUM_TEAM_4: return STATIC_NAME_TEAM_4;
111  }
112 
113  return NAME_NEUTRAL;
114 }
const int NUM_TEAM_2
Definition: teams.qh:19
const string STATIC_NAME_TEAM_1
Definition: teams.qh:53
const string STATIC_NAME_TEAM_3
Definition: teams.qh:55
const string STATIC_NAME_TEAM_2
Definition: teams.qh:54
#define NAME_NEUTRAL
Definition: teams.qh:36
const string STATIC_NAME_TEAM_4
Definition: teams.qh:56
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the caller graph for this function:

◆ Team_ColorCode()

string Team_ColorCode ( int  teamid)

Definition at line 63 of file teams.qh.

References COL_TEAM_1, COL_TEAM_2, COL_TEAM_3, COL_TEAM_4, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

Referenced by ctf_FlagSetup(), ctf_Handle_Pickup(), FindConnectedComponent(), NextLevel(), and Say().

64 {
65  switch(teamid)
66  {
67  case NUM_TEAM_1: return COL_TEAM_1;
68  case NUM_TEAM_2: return COL_TEAM_2;
69  case NUM_TEAM_3: return COL_TEAM_3;
70  case NUM_TEAM_4: return COL_TEAM_4;
71  }
72 
73  return "^7";
74 }
const int NUM_TEAM_2
Definition: teams.qh:19
const string COL_TEAM_3
Definition: teams.qh:28
const string COL_TEAM_4
Definition: teams.qh:29
const string COL_TEAM_2
Definition: teams.qh:27
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
const int NUM_TEAM_3
Definition: teams.qh:20
const string COL_TEAM_1
Definition: teams.qh:26
+ Here is the caller graph for this function:

◆ Team_ColorName()

string Team_ColorName ( int  teamid)

Definition at line 89 of file teams.qh.

References NAME_NEUTRAL, NAME_TEAM_1, NAME_TEAM_2, NAME_TEAM_3, NAME_TEAM_4, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

90 {
91  switch(teamid)
92  {
93  case NUM_TEAM_1: return NAME_TEAM_1;
94  case NUM_TEAM_2: return NAME_TEAM_2;
95  case NUM_TEAM_3: return NAME_TEAM_3;
96  case NUM_TEAM_4: return NAME_TEAM_4;
97  }
98 
99  return NAME_NEUTRAL;
100 }
const int NUM_TEAM_2
Definition: teams.qh:19
#define NAME_TEAM_3
Definition: teams.qh:33
#define NAME_TEAM_1
Definition: teams.qh:31
#define NAME_TEAM_4
Definition: teams.qh:34
#define NAME_NEUTRAL
Definition: teams.qh:36
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
#define NAME_TEAM_2
Definition: teams.qh:32
const int NUM_TEAM_3
Definition: teams.qh:20

◆ Team_ColorRGB()

vector Team_ColorRGB ( int  teamid)

Definition at line 76 of file teams.qh.

References NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

Referenced by ClientKill_TeamChange(), cpicon_changeteam(), ctf_DelayedFlagSetup(), Freeze(), generator_changeteam(), HUD_Radar(), HUD_Score(), HUD_Score_Rankings(), invasion_SpawnChosenMonster(), kh_Key_Spawn(), kh_WinnerTeam(), monster_changeteam(), Monster_Spawn_Setup(), SpawnGoal(), turret_changeteam(), vehicles_enter(), and vehicles_showwp().

77 {
78  switch(teamid)
79  {
80  case NUM_TEAM_1: return '1 0.0625 0.0625'; // 0xFF0F0F
81  case NUM_TEAM_2: return '0.0625 0.0625 1'; // 0x0F0FFF
82  case NUM_TEAM_3: return '1 1 0.0625'; // 0xFFFF0F
83  case NUM_TEAM_4: return '1 0.0625 1'; // 0xFF0FFF
84  }
85 
86  return '0 0 0';
87 }
const int NUM_TEAM_2
Definition: teams.qh:19
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the caller graph for this function:

◆ Team_ColorToTeam()

float Team_ColorToTeam ( string  team_color)

Definition at line 116 of file teams.qh.

References NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

Referenced by ClientCommand_selectteam(), and GameCommand_moveplayer().

117 {
118  switch(strtolower(team_color))
119  {
120  case "red": return NUM_TEAM_1;
121  case "blue": return NUM_TEAM_2;
122  case "yellow": return NUM_TEAM_3;
123  case "pink": return NUM_TEAM_4;
124  case "auto": return 0;
125  }
126 
127  return -1;
128 }
const int NUM_TEAM_2
Definition: teams.qh:19
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the caller graph for this function:

◆ Team_IndexToBit()

int Team_IndexToBit ( int  index)

Converts team index into bit value that is used in team bitmasks.

Parameters
[in]indexTeam index to convert.
Returns
Team bit.

Definition at line 211 of file teams.qh.

References BIT.

Referenced by CA_CheckTeams(), ClientCommand_selectteam(), freezetag_CheckTeams(), Player_SetTeamIndexChecked(), TeamBalance_AutoBalanceBots(), TeamBalance_FindBestTeam(), TeamBalance_FindBestTeams(), TeamBalance_GetAllowedTeams(), and TeamBalance_GetLargestTeamIndex().

212 {
213  return BIT(index - 1);
214 }
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
+ Here is the caller graph for this function:

◆ Team_IndexToTeam()

int Team_IndexToTeam ( int  index)

Converts team index into team value.

Parameters
[in]indexTeam index to convert.
Returns
Team value.

Definition at line 169 of file teams.qh.

References NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

Referenced by GameCommand_moveplayer(), Player_SetTeamIndex(), Team_GetWinnerAliveTeam(), Team_GetWinnerTeam_WithOwnedItems(), TeamBalance_GetTeamCounts(), WinningCondition_RanOutOfSpawns(), and WinningCondition_Scores().

170 {
171  switch (index)
172  {
173  case 1: return NUM_TEAM_1;
174  case 2: return NUM_TEAM_2;
175  case 3: return NUM_TEAM_3;
176  case 4: return NUM_TEAM_4;
177  }
178  return -1;
179 }
const int NUM_TEAM_2
Definition: teams.qh:19
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the caller graph for this function:

◆ Team_IsValidIndex()

bool Team_IsValidIndex ( int  index)

Returns whether the team index is valid.

Parameters
[in]indexTeam index to check.
Returns
True if team index is valid, false otherwise.

Definition at line 151 of file teams.qh.

Referenced by bot_clientconnect(), bot_setnameandstuff(), Entity_GetTeam(), Player_DetermineForcedTeam(), Player_SetForcedTeamIndex(), Player_SetTeamIndexChecked(), Team_GetTeamFromIndex(), TeamBalance_CompareTeams(), TeamBalance_GetNumberOfPlayers(), TeamBalance_GetTeamCounts(), TeamBalance_GetTeamFromIndex(), and TeamBalance_IsTeamAllowed().

152 {
153  switch (index)
154  {
155  case 1:
156  case 2:
157  case 3:
158  case 4:
159  {
160  return true;
161  }
162  }
163  return false;
164 }
+ Here is the caller graph for this function:

◆ Team_IsValidTeam()

bool Team_IsValidTeam ( int  team_num)

Returns whether team value is valid.

Parameters
[in]team_numTeam to check.
Returns
True if team is valid, false otherwise.

Definition at line 133 of file teams.qh.

References NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

Referenced by bot_removefromlargestteam(), EFFECT_ROCKETMINSTA_LASER(), Entity_HasValidTeam(), link_spawnpoint(), MUTATOR_HOOKFUNCTION(), SpawnGoal(), Team_GetTeam(), Team_TeamToBit(), TeamBalance_CheckAllowedTeams(), TeamBalance_GetTeamCounts(), and WinningCondition_RanOutOfSpawns().

134 {
135  switch (team_num)
136  {
137  case NUM_TEAM_1:
138  case NUM_TEAM_2:
139  case NUM_TEAM_3:
140  case NUM_TEAM_4:
141  {
142  return true;
143  }
144  }
145  return false;
146 }
const int NUM_TEAM_2
Definition: teams.qh:19
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the caller graph for this function:

◆ Team_TeamToBit()

int Team_TeamToBit ( int  team_num)

Converts team value into bit value that is used in team bitmasks.

Parameters
[in]team_numTeam value to convert.
Returns
Team bit.

Definition at line 199 of file teams.qh.

References BIT, Team_IsValidTeam(), and Team_TeamToIndex().

Referenced by IsTeamAvailable(), and MUTATOR_HOOKFUNCTION().

200 {
201  if (!Team_IsValidTeam(team_num))
202  {
203  return 0;
204  }
205  return BIT(Team_TeamToIndex(team_num) - 1);
206 }
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
int Team_TeamToIndex(int team_num)
Converts team value into team index.
Definition: teams.qh:184
bool Team_IsValidTeam(int team_num)
Returns whether team value is valid.
Definition: teams.qh:133
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Team_TeamToIndex()

int Team_TeamToIndex ( int  team_num)

Converts team value into team index.

Parameters
[in]team_numTeam value to convert.
Returns
Team index.

Definition at line 184 of file teams.qh.

References NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

Referenced by ClientCommand_selectteam(), ClientKill_Now_TeamChange(), Entity_GetTeamIndex(), GameCommand_moveplayer(), Player_SetTeamIndex(), SV_ChangeTeam(), Team_GetTeam(), Team_TeamToBit(), and TeamBalance_GetTeam().

185 {
186  switch (team_num)
187  {
188  case NUM_TEAM_1: return 1;
189  case NUM_TEAM_2: return 2;
190  case NUM_TEAM_3: return 3;
191  case NUM_TEAM_4: return 4;
192  }
193  return -1;
194 }
const int NUM_TEAM_2
Definition: teams.qh:19
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the caller graph for this function:

Variable Documentation

◆ COL_TEAM_1

const string COL_TEAM_1 = "^1"

Definition at line 26 of file teams.qh.

Referenced by Team_ColorCode().

◆ COL_TEAM_2

const string COL_TEAM_2 = "^4"

Definition at line 27 of file teams.qh.

Referenced by Team_ColorCode().

◆ COL_TEAM_3

const string COL_TEAM_3 = "^3"

Definition at line 28 of file teams.qh.

Referenced by Team_ColorCode().

◆ COL_TEAM_4

const string COL_TEAM_4 = "^6"

Definition at line 29 of file teams.qh.

Referenced by Team_ColorCode().

◆ NUM_SPECTATOR

◆ NUM_TEAM_1

◆ NUM_TEAM_2

◆ NUM_TEAM_3

◆ NUM_TEAM_4

◆ NUM_TEAMS

◆ STATIC_NAME_TEAM_1

const string STATIC_NAME_TEAM_1 = "Red"

Definition at line 53 of file teams.qh.

Referenced by Static_Team_ColorName().

◆ STATIC_NAME_TEAM_2

const string STATIC_NAME_TEAM_2 = "Blue"

Definition at line 54 of file teams.qh.

Referenced by Static_Team_ColorName().

◆ STATIC_NAME_TEAM_3

const string STATIC_NAME_TEAM_3 = "Yellow"

Definition at line 55 of file teams.qh.

Referenced by Static_Team_ColorName().

◆ STATIC_NAME_TEAM_4

const string STATIC_NAME_TEAM_4 = "Pink"

Definition at line 56 of file teams.qh.

Referenced by Static_Team_ColorName().