switch(i)
{
case 0:
- stat = getstati(STAT_REDALIVE);
+ stat = STAT(REDALIVE);
pic = "player_red.tga";
color = '1 0 0';
break;
case 1:
- stat = getstati(STAT_BLUEALIVE);
+ stat = STAT(BLUEALIVE);
pic = "player_blue.tga";
color = '0 0 1';
break;
case 2:
- stat = getstati(STAT_YELLOWALIVE);
+ stat = STAT(YELLOWALIVE);
pic = "player_yellow.tga";
color = '1 1 0';
break;
default:
case 3:
- stat = getstati(STAT_PINKALIVE);
+ stat = STAT(PINKALIVE);
pic = "player_pink.tga";
color = '1 0 1';
break;
switch(i)
{
case 0:
- stat = getstatf(STAT_DOM_PPS_RED);
+ stat = STAT(DOM_PPS_RED);
pic = "dom_icon_red";
color = '1 0 0';
break;
case 1:
- stat = getstatf(STAT_DOM_PPS_BLUE);
+ stat = STAT(DOM_PPS_BLUE);
pic = "dom_icon_blue";
color = '0 0 1';
break;
case 2:
- stat = getstatf(STAT_DOM_PPS_YELLOW);
+ stat = STAT(DOM_PPS_YELLOW);
pic = "dom_icon_yellow";
color = '1 1 0';
break;
default:
case 3:
- stat = getstatf(STAT_DOM_PPS_PINK);
+ stat = STAT(DOM_PPS_PINK);
pic = "dom_icon_pink";
color = '1 0 1';
break;
}
- float pps_ratio = stat / getstatf(STAT_DOM_TOTAL_PPS);
+ float pps_ratio = stat / STAT(DOM_TOTAL_PPS);
if(mySize.x/mySize.y > aspect_ratio)
{
STAT_PL_CROUCH_MAX1,
STAT_PL_CROUCH_MAX2,
STAT_PL_CROUCH_MAX3,
-
- STAT_LAST_VECTOR
};
-const int REGISTERED_STATS = 139;
-
REGISTER_STAT(KH_KEYS, int)
/** weapon requested to switch to; next WANTED weapon (for HUD) */
REGISTER_STAT(SWITCHWEAPON, int)
REGISTER_STAT(MOVEVARS_HIGHSPEED, float, autocvar_g_movement_highspeed)
-enum {
- STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + REGISTERED_STATS,
-
- STAT_LAST_MAIN
-};
-
-const int STAT_LAST = STAT_LAST_MAIN + 5;
-
-/* The following stats change depending on the gamemode, so can share the same ID */
-
-// freeze tag, clan arena, jailbreak
-enum {
- STAT_REDALIVE = STAT_LAST_MAIN,
- STAT_BLUEALIVE,
- STAT_YELLOWALIVE,
- STAT_PINKALIVE,
-};
+// freeze tag, clan arena
+REGISTER_STAT(REDALIVE, int)
+REGISTER_STAT(BLUEALIVE, int)
+REGISTER_STAT(YELLOWALIVE, int)
+REGISTER_STAT(PINKALIVE, int)
// domination
-enum {
- STAT_DOM_TOTAL_PPS = STAT_LAST_MAIN,
- STAT_DOM_PPS_RED,
- STAT_DOM_PPS_BLUE,
- STAT_DOM_PPS_YELLOW,
- STAT_DOM_PPS_PINK,
-};
-
-// vip
-enum {
- STAT_VIP = STAT_LAST_MAIN,
- STAT_VIP_RED,
- STAT_VIP_BLUE,
- STAT_VIP_YELLOW,
- STAT_VIP_PINK,
-};
-
-// key hunt
-enum {
- STAT_KH_REDKEY_TEAM = STAT_LAST_MAIN,
- STAT_KH_BLUEKEY_TEAM,
- STAT_KH_YELLOWKEY_TEAM,
- STAT_KH_PINKKEY_TEAM,
-};
-
-#define ASSERT_LESS(name, var, const) noref int name[(const - var + 1)];
-ASSERT_LESS(stat_limit, STAT_LAST, 220)
+REGISTER_STAT(DOM_TOTAL_PPS, float)
+REGISTER_STAT(DOM_PPS_RED, float)
+REGISTER_STAT(DOM_PPS_BLUE, float)
+REGISTER_STAT(DOM_PPS_YELLOW, float)
+REGISTER_STAT(DOM_PPS_PINK, float)
#ifdef SVQC
#include "movetypes/movetypes.qh"
} \
while (0)
+#define ASSERT_LESS(name, var, const) noref int name[(const - var + 1)];
+
#endif
.float lastground;
float total_players;
float redalive, bluealive, yellowalive, pinkalive;
-.float redalive_stat, bluealive_stat, yellowalive_stat, pinkalive_stat;
+.float redalive_stat = _STAT(REDALIVE);
+.float bluealive_stat = _STAT(BLUEALIVE);
+.float yellowalive_stat = _STAT(YELLOWALIVE);
+.float pinkalive_stat = _STAT(PINKALIVE);
#endif
round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart);
round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
- addstat(STAT_REDALIVE, AS_INT, redalive_stat);
- addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
- addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
- addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
-
EliminatedPlayers_Init(ca_isEliminated);
}
const float SP_DOM_CAPS = 4;
// pps: points per second
-.float dom_total_pps;
-.float dom_pps_red;
-.float dom_pps_blue;
-.float dom_pps_yellow;
-.float dom_pps_pink;
+.float dom_total_pps = _STAT(DOM_TOTAL_PPS);
+.float dom_pps_red = _STAT(DOM_PPS_RED);
+.float dom_pps_blue = _STAT(DOM_PPS_BLUE);
+.float dom_pps_yellow = _STAT(DOM_PPS_YELLOW);
+.float dom_pps_pink = _STAT(DOM_PPS_PINK);
float total_pps;
float pps_red;
float pps_blue;
// if no teams are found, spawn defaults
if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
{
- LOG_INFO("No ""dom_team"" entities found on this map, creating them anyway.\n");
+ LOG_INFO("No \"dom_team\" entities found on this map, creating them anyway.\n");
domination_teams = bound(2, ((autocvar_g_domination_teams_override < 2) ? autocvar_g_domination_default_teams : autocvar_g_domination_teams_override), 4);
dom_spawnteams(domination_teams);
}
CheckAllowedTeams(world);
domination_teams = ((c4>=0) ? 4 : (c3>=0) ? 3 : 2);
- addstat(STAT_DOM_TOTAL_PPS, AS_FLOAT, dom_total_pps);
- addstat(STAT_DOM_PPS_RED, AS_FLOAT, dom_pps_red);
- addstat(STAT_DOM_PPS_BLUE, AS_FLOAT, dom_pps_blue);
- if(domination_teams >= 3) addstat(STAT_DOM_PPS_YELLOW, AS_FLOAT, dom_pps_yellow);
- if(domination_teams >= 4) addstat(STAT_DOM_PPS_PINK, AS_FLOAT, dom_pps_pink);
-
domination_roundbased = autocvar_g_domination_roundbased;
ScoreRules_dom(domination_teams);
round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, func_null);
round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
- addstat(STAT_REDALIVE, AS_INT, redalive_stat);
- addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
- addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
- addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
-
EliminatedPlayers_Init(freezetag_isEliminated);
}