]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/sv_rules.qh
Refactor game rules
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / sv_rules.qh
1 #pragma once
2
3 // todo: accept the number of teams as a parameter
4 void GameRules_teams(bool value);
5
6 /**
7  * Disabling score disables the "score" column on the scoreboard
8  */
9 void GameRules_score_enabled(bool value);
10
11 void GameRules_limit_score(int limit);
12 void GameRules_limit_lead(int limit);
13 void GameRules_limit_time(int limit);
14 void GameRules_limit_time_qualifying(int limit);
15
16 /**
17  * Set any unspecified rules to their defaults
18  */
19 void GameRules_limit_fallbacks();
20
21 // derive score_enabled from !frags_enabled
22
23 /**
24  * @param teams a bitmask of active teams
25  * @param spprio player score priority (if frags aren't enabled)
26  * @param stprio team score priority (if frags aren't enabled)
27  */
28 #define GameRules_scoring(teams, spprio, stprio, fields) MACRO_BEGIN { \
29     _GameRules_scoring_begin((teams), (spprio), (stprio)); \
30     noref void(entity, string, float) field = _GameRules_scoring_field; \
31     /* todo: just have the one `field` function */ \
32     noref void(int, string, float) field_team = _GameRules_scoring_field_team; \
33     LAMBDA(fields); \
34     _GameRules_scoring_end(); \
35 } MACRO_END
36
37 void _GameRules_scoring_begin(int teams, float spprio, float stprio);
38 void _GameRules_scoring_field(entity i, string label, int scoreflags);
39 void _GameRules_scoring_field_team(float i, string label, int scoreflags);
40 void _GameRules_scoring_end();