1 float scores_initialized; // 1 when scores labels/rules have been set
4 * Attaches a PlayerScore entity to a player. Use that in ClientConnect.
5 * Remember to detach it in ClientDisconnect!
7 void PlayerScore_Attach(entity player);
10 * Detaches a PlayerScore entity from the player. Use that in ClientDisconnect.
12 void PlayerScore_Detach(entity player);
15 * Adds a score to the player's scores.
16 * NEVER call this if PlayerScore_Attach has not been called yet!
17 * Means: FIXME make players unable to join the game when not called ClientConnect yet.
18 * Returns the new score.
20 float PlayerScore_Add(entity player, float scorefield, float score);
23 * Initialize the score of this player if needed.
24 * Does nothing in teamplay.
25 * Use that when a spectator becomes a player.
27 void PlayerScore_Clear(entity player);
30 * Adds a score to the player's team's scores.
31 * NEVER call this if team has not been set yet!
32 * Returns the new score.
34 float TeamScore_Add(entity player, float scorefield, float score);
37 * Adds a score to the given team.
38 * NEVER call this if team has not been set yet!
39 * Returns the new score.
41 float TeamScore_AddToTeam(float t, float scorefield, float score);
44 * Adds a score to both the player and the team.
46 void PlayerTeamScore_Add(entity player, float pscorefield, float tscorefield, float score);
49 * Adds to the generic score fields for both the player and the team.
51 #define PlayerTeamScore_AddScore(p,s) PlayerTeamScore_Add(p, SP_SCORE, ST_SCORE, s)
54 * Initialize the scores info for the given number of teams.
55 * Immediately set all labels afterwards.
57 void ScoreInfo_Init(float teams);
60 * Set the label of a team score item, as well as the scoring flags.
62 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags);
65 * Set the label of a player score item, as well as the scoring flags.
67 void ScoreInfo_SetLabel_PlayerScore(float i, string label, float scoreflags);
70 * Clear ALL scores (for ready-restart).
72 void Score_ClearAll();
75 * Prints the scores (ugly!) to the console.
77 void Score_DebugPrint();
80 * Sets the following results for the current scores entities.
82 void WinningConditionHelper();
83 float WinningConditionHelper_topscore; ///< highest score
84 float WinningConditionHelper_equality; ///< 1 if and only if the top two have equal scores
85 float WinningConditionHelper_winnerteam; ///< the color of the winning team, or -1 if none
86 entity WinningConditionHelper_winner; ///< the winning player, or world if none