]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/scores.qh
add much more stuff. REALLY need to initialize the scoring for the other game modes...
[divverent/nexuiz.git] / data / qcsrc / server / scores.qh
1 /**
2  * Attaches a PlayerScore entity to a player. Use that in ClientConnect.
3  * Remember to detach it in ClientDisconnect!
4  */
5 void PlayerScore_Attach(entity player);
6
7 /**
8  * Detaches a PlayerScore entity from the player. Use that in ClientDisconnect.
9  */
10 void PlayerScore_Detach(entity player);
11
12 /**
13  * Adds a score to the player's scores.
14  * NEVER call this if PlayerScore_Attach has not been called yet!
15  * Means: FIXME make players unable to join the game when not called ClientConnect yet.
16  */
17 void PlayerScore_Add(entity player, float scorefield, float score);
18
19 /**
20  * Initialize the score of this player if needed.
21  * Does nothing in teamplay.
22  * Use that when a spectator becomes a player.
23  */
24 void PlayerScore_Clear(entity player);
25
26 /**
27  * Adds a score to the player's team's scores.
28  * NEVER call this if team has not been set yet!
29  */
30 void TeamScore_Add(entity player, float scorefield, float score);
31
32 /**
33  * Adds a score to the given team.
34  * NEVER call this if team has not been set yet!
35  */
36 void TeamScore_AddToTeam(float t, float scorefield, float score);
37
38 /**
39  * Adds a score to both the player and the team.
40  */
41 void PlayerTeamScore_Add(entity player, float pscorefield, float tscorefield, float score);
42
43 /**
44  * Adds to the generic score fields for both the player and the team.
45  */
46 #define PlayerTeamScore_AddScore(p,s) PlayerTeamScore_Add(p, SP_SCORE, ST_SCORE, s)
47
48 /**
49  * Initialize the scores info for the given number of teams.
50  * Immediately set all labels afterwards.
51  */
52 void ScoreInfo_Init(float teams);
53
54 /**
55  * Set the label of a team score item, as well as the scoring flags.
56  */
57 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags);
58
59 /**
60  * Set the label of a player score item, as well as the scoring flags.
61  */
62 void ScoreInfo_SetLabel_PlayerScore(float i, string label, float scoreflags);
63
64 /**
65  * Clear ALL scores (for ready-restart).
66  */
67 void Score_ClearAll();
68
69 /**
70  * Prints the scores (ugly!) to the console.
71  */
72 void Score_DebugPrint();
73
74 /**
75  * Sets the following results for the current scores entities.
76  */
77 void WinningConditionHelper();
78 float WinningConditionHelper_topscore;   ///< highest score
79 float WinningConditionHelper_equality;   ///< 1 if and only if the top two have equal scores
80 float WinningConditionHelper_winnerteam; ///< the color of the winning team, or -1 if none
81 entity WinningConditionHelper_winner;    ///< the winning player, or world if none