31 if((fieldflags & SFL_SORT_PRIO_MASK) < previous.y)
33 if (t1.(field) == t2.(field))
45 else if (t2.(field) == 0)
53 previous.x = (t2.(field) - t1.(field));
55 previous.x = (t1.(field) - t2.(field));
68 WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
69 int t = this.
team - 1;
78 #if MAX_TEAMSCORE <= 8 86 if(sendflags &
BIT(i))
88 if(longflags &
BIT(i))
89 WriteInt24_t(MSG_ENTITY, this.(
teamscores(i)));
105 PlayerStats_GameReport_AddTeam(t);
118 if(t <= 0 || t >= 16)
122 error(
"Adding score to invalid team!");
129 error(
"Adding score to unknown team!");
133 s.SendFlags |=
BIT(scorefield);
134 return (s.(teamscores(scorefield)) += score);
144 if(!t1 || !t2)
return (!t2) - !t1;
155 if (result.x == 0 && strict)
156 result.x = t1.team - t2.team;
176 PlayerStats_GameReport_AddEvent(
strcat(PLAYERSTATS_TOTAL, label));
177 PlayerStats_GameReport_AddEvent(
strcat(PLAYERSTATS_SCOREBOARD, label));
192 PlayerStats_GameReport_AddEvent(
strcat(PLAYERSTATS_TOTAL, label));
193 PlayerStats_GameReport_AddEvent(
strcat(PLAYERSTATS_SCOREBOARD, label));
200 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES_INFO);
241 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES);
246 int p = 1 << (i % 16);
247 if (this.(
scores(it)) > 127 || this.(
scores(it)) <= -128)
254 int p = 1 << (i % 16);
258 WriteInt24_t(MSG_ENTITY, this.(
scores(it)));
276 sk =
CS(player).scorekeeper;
278 if(sk.(scores(it)) != 0)
280 sk.SendFlags |=
BIT(i % 16);
293 sk =
CS(it).scorekeeper;
296 if(sk.(scores(it)) != 0)
298 sk.SendFlags |=
BIT(i % 16);
303 for(t = 0; t < 16; ++t)
310 if(sk.(teamscores(j)) != 0)
312 sk.SendFlags |=
BIT(j);
313 sk.(teamscores(j)) = 0;
321 error(
"player already has a scorekeeper");
325 CS(player).scorekeeper = sk;
331 error(
"player has no scorekeeper");
332 delete(
CS(player).scorekeeper);
333 CS(player).scorekeeper =
NULL;
338 bool mutator_returnvalue =
MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
341 if(!mutator_returnvalue && game_stopped)
352 LOG_WARN(
"Adding score to unknown player!");
357 return s.(scores(scorefield));
360 s.SendFlags |=
BIT(scorefield.m_id % 16);
362 PlayerStats_GameReport_Event_Player(s.owner,
strcat(PLAYERSTATS_TOTAL,
scores_label(scorefield)), score);
363 s.(scores(scorefield)) += score;
365 return s.(scores(scorefield));
376 LOG_WARN(
"Setting score of unknown player!");
380 float oldscore = s.(scores(scorefield));
381 if(oldscore == score)
385 s.SendFlags |=
BIT(scorefield.m_id % 16);
386 s.(scores(scorefield)) = score;
387 return s.(scores(scorefield));
401 if(!t1 || !t2)
return (!t2) - !t1;
405 var .float f =
scores(it);
409 if (result.x == 0 && strict)
410 result.x = t1.owner.playerid - t2.owner.playerid;
446 for(t = 0; t < 16; ++t)
452 winnerscorekeeper =
NULL;
453 secondscorekeeper =
NULL;
454 for(t = 0; t < 16; ++t)
462 secondscorekeeper = winnerscorekeeper;
463 winnerscorekeeper = sk;
471 secondscorekeeper = sk;
492 winnerscorekeeper =
NULL;
493 secondscorekeeper =
NULL;
495 sk =
CS(it).scorekeeper;
501 secondscorekeeper = winnerscorekeeper;
502 winnerscorekeeper = sk;
510 secondscorekeeper = sk;
516 if(WinningConditionHelper_equality)
561 s =
strcat(s,
":spectator");
571 strcpy(it.clientstatus, s);
578 label =
strcat(label,
"<");
580 label =
strcat(label,
"!!");
582 label =
strcat(label,
"!");
630 out =
strcat(out,
ftos(sk.(scores(it))),
",");
635 out =
strcat(out,
ftos(sk.(scores(it))),
",");
641 out =
strcat(out,
ftos(sk.(scores(it))),
",");
689 out =
strcat(out,
ftos(sk.(teamscores(i))),
",");
693 out =
strcat(out,
ftos(sk.(teamscores(i))),
",");
698 out =
strcat(out,
ftos(sk.(teamscores(i))),
",");
708 if(p1.team != p2.team)
726 entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
744 pfirst = plast =
NULL;
749 pprev = pbestprev =
NULL;
751 for(p = plist; (pprev = p), (p = p.chain); )
761 if(pbestprev ==
NULL)
764 pbestprev.chain = pbest.chain;
788 if(t <= 0 || t >= 16)
792 error(
"Reading score of invalid team!");
798 s = sk.teamscores_primary;
836 sc = sk.(teamscores(i));
865 sk =
CS(p).scorekeeper;
867 s =
strcat(s, playername(p.netname, p.team,
false));
875 s =
strcat(s, strpad(i,
""));
884 sc = sk.(scores(it));
944 PlayerStats_GameReport_Event_Player(s.owner,
953 for(t = 0; t < 16; ++t)
961 PlayerStats_GameReport_Event_Team(t+1,
bool autocvar_g_full_getstatus_responses
float PlayerScore_Compare(entity t1, entity t2, bool strict)
void Score_NicePrint_Player(entity to, entity p, float w)
string GetTeamScoreString(float tm, float shortString)
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1 f1points s1 s2
const int SFL_SORT_PRIO_MASK
bool PlayerScore_SendEntity(entity this, entity to, float sendflags)
float WinningConditionHelper_secondteam
the color of the second team, or -1 if none
void Score_NicePrint(entity to)
Prints the scores to the console of a player.
float TeamScore_AddToTeam(int t, float scorefield, float score)
Adds a score to the given team.
float TeamScore_Compare(entity t1, entity t2, bool strict)
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit)
entity teamscorekeepers[16]
vector ScoreField_Compare(entity t1, entity t2,.float field, float fieldflags, vector previous, bool strict)
float scores_flags_primary
ClientState CS(Client this)
void TeamScore_Spawn(float t, string name)
void Score_ClearAll()
Clear ALL scores (for ready-restart).
#define FOREACH_CLIENT(cond, body)
Gametype MapInfo_LoadedGametype
const int SFL_SORT_PRIO_PRIMARY
void PlayerScore_Detach(entity player)
Detaches a PlayerScore entity from the player.
void ScoreInfo_SetLabel_PlayerScore(PlayerScoreField i, string label, float scoreflags)
Set the label of a player score item, as well as the scoring flags.
float WinningConditionHelper_lowerisbetter
lower is better, duh
void print_to(entity to, string input)
#define WriteRegistered(r, to, it)
#define SFL_ZERO_IS_WORST
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
#define IS_REAL_CLIENT(v)
void Score_NicePrint_Team(entity to, float t, float w)
void PlayerScore_PlayerStats(entity p)
#define teamscores_label(i)
entity WinningConditionHelper_winner
the winning player, or NULL if none
bool ScoreInfo_SendEntity(entity this, entity to, int sf)
void ScoreInfo_Init(int teams)
void Score_NicePrint_Spectators(entity to)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
#define FOREACH_CLIENTSLOT(cond, body)
float WinningConditionHelper_zeroisworst
zero is worst, duh
void PlayerScore_TeamStats()
string GetScoreLogLabel(string label, float fl)
float cvar_purechanges_count
entity scores_initialized
float WinningConditionHelper_secondscore
second highest score
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
var float teamscores_primary
entity WinningConditionHelper_second
the second player, or NULL if none
float PlayerTeamScore_Add(entity player, PlayerScoreField pscorefield, float tscorefield, float score)
Adds a score to both the player and the team.
float TeamScore_GetCompareValue(float t)
Returns a value indicating the team score (and higher is better).
float PlayerScore_Clear(entity player)
Initialize the score of this player if needed.
void Score_NicePrint_Spectator(entity to, entity p)
float PlayerTeamScore_Compare(entity p1, entity p2, float teams, bool strict)
#define scores_flags(this)
entity PlayerScore_Sort(.float field, int teams, bool strict, bool nospectators)
Sorts the players and stores their place in the given field, starting with.
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
Set the label of a team score item, as well as the scoring flags.
#define scores_label(this)
bool TeamScore_SendEntity(entity this, entity to, float sendflags)
float WinningConditionHelper_winnerteam
the color of the winning team, or -1 if none
#define INGAME_JOINED(it)
const int FRAGS_SPECTATOR
#define MUTATOR_CALLHOOK(id,...)
float teamscores_flags_primary
string sv_termsofservice_url_escaped
float teamscores_entities_count
#define new_pure(class)
purely logical entities (.origin doesn't work)
string Score_NicePrint_ItemColor(float vflags)
int nJoinAllowed(entity this, entity ignore)
Determines whether the player is allowed to join.
#define teamscores_flags(i)
float WinningConditionHelper_topscore
highest score
float TeamScore_Add(entity player, float scorefield, float score)
Adds a score to the player's team's scores.
string GetPlayerScoreString(entity pl, float shortString)
Returns score strings for eventlog etc.
float WinningConditionHelper_equality
we have no winner
float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
Adds a score to the player's scores.
void PlayerScore_Attach(entity player)
Attaches a PlayerScore entity to a player.
#define Team_ColoredFullName(teamid)
#define FOREACH(list, cond, body)
void WinningConditionHelper(entity this)
Sets the following results for the current scores entities.
string autocvar_g_xonoticversion
float PlayerScore_Set(entity player, PlayerScoreField scorefield, float score)
Sets the player's score to the score parameter.