]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/scores.qh
add ClearAll
[divverent/nexuiz.git] / data / qcsrc / server / scores.qh
1 #define MAX_SCORE 9
2 #define MAX_TEAMSCORE 2
3
4 /**
5  * Attaches a PlayerScore entity to a player. Use that in ClientConnect.
6  * Remember to detach it in ClientDisconnect!
7  */
8 void PlayerScore_Attach(entity player);
9
10 /**
11  * Detaches a PlayerScore entity from the player. Use that in ClientDisconnect.
12  */
13 void PlayerScore_Detach(entity player);
14
15 /**
16  * Adds a score to the player's scores.
17  * NEVER call this if PlayerScore_Attach has not been called yet!
18  * Means: FIXME make players unable to join the game when not called ClientConnect yet.
19  */
20 void PlayerScore_Add(entity player, float scorefield, float score);
21
22 /**
23  * Initialize the score of this player if needed.
24  * Does nothing in teamplay.
25  * Use that when a spectator becomes a player.
26  */
27 void PlayerScore_Clear(entity player);
28
29 /**
30  * Adds a score to the player's team's scores.
31  * NEVER call this if team has not been set yet!
32  */
33 void TeamScore_Add(entity player, float scorefield, float score);
34
35 /**
36  * Initialize the scores info for the given number of teams.
37  * Immediately set all labels afterwards.
38  */
39 void ScoreInfo_Init(float teams);
40
41 /**
42  * Set the label of a team score item, as well as the scoring flags.
43  */
44 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags);
45
46 /**
47  * Set the label of a player score item, as well as the scoring flags.
48  */
49 void ScoreInfo_SetLabel_PlayerScore(float i, string label, float scoreflags);
50
51 /**
52  * Clear ALL scores (for ready-restart).
53  */
54 void Score_ClearAll();
55
56 /**
57  * Lower scores are better (e.g. deaths)
58  */
59 #define SFL_DECREASING         1
60
61 /**
62  * Scoring priority (NOTE: PRIMARY is used for fraglimit)
63  */
64 #define SFL_SORT_PRIO_LOW      2
65 #define SFL_SORT_PRIO_MED      4
66 #define SFL_SORT_PRIO_HIGH     8
67 #define SFL_SORT_PRIO_PRIMARY 14
68 #define SFL_SORT_PRIO_MASK    14
69
70 /**
71  * Sets the following results for the current scores entities.
72  */
73 void WinningConditionHelper();
74 float WinningConditionHelper_topscore;   ///< highest score
75 float WinningConditionHelper_equality;   ///< 1 if and only if the top two have equal scores
76 float WinningConditionHelper_winnerteam; ///< the color of the winning team, or -1 if none
77 entity WinningConditionHelper_winner;    ///< the winning player, or world if none
78
79 #define SP_KILLS 0
80 #define SP_DEATHS 1
81 #define SP_SUICIDES 2
82 #define SP_SCORE 3 // personal score, game modes can set it their own way
83
84 #define SP_CTF_CAPS 4
85 #define SP_CTF_RETURNS 5
86 #define ST_CTF_CAPS 0
87 #define ST_CTF_SCORE 1
88
89 #define SP_KH_COLLECT 4
90 #define SP_KH_LOSEKEY 5
91 #define SP_KH_CAPTURE 6
92 #define SP_KH_PUSH 7
93 #define SP_KH_DESTROYED 8
94 #define ST_KH_CAPS 0
95 #define ST_KH_SCORE 1