void Announcer_Countdown()
{
SELFPARAM();
- float starttime = getstatf(STAT_GAMESTARTTIME);
+ float starttime = STAT(GAMESTARTTIME);
float roundstarttime = getstatf(STAT_ROUNDSTARTTIME);
if(roundstarttime == -1)
{
float previous_game_starttime;
void Announcer_Gamestart()
{
- float startTime = getstatf(STAT_GAMESTARTTIME);
+ float startTime = STAT(GAMESTARTTIME);
float roundstarttime = getstatf(STAT_ROUNDSTARTTIME);
if(roundstarttime > startTime)
startTime = roundstarttime;
void Announcer_Time()
{
float timelimit = getstatf(STAT_TIMELIMIT);
- float timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time);
+ float timeleft = max(0, timelimit * 60 + STAT(GAMESTARTTIME) - time);
float warmup_timeleft = 0;
if(warmup_stage)
if(autocvar_g_warmup_limit > 0)
- warmup_timeleft = max(0, autocvar_g_warmup_limit + getstatf(STAT_GAMESTARTTIME) - time);
+ warmup_timeleft = max(0, autocvar_g_warmup_limit + STAT(GAMESTARTTIME) - time);
// 5 minute check
if(autocvar_cl_announcer_maptime >= 2)
drawInfoMessage(s);
//show restart countdown:
- if (time < getstatf(STAT_GAMESTARTTIME)) {
+ if (time < STAT(GAMESTARTTIME)) {
float countdown;
//we need to ceil, otherwise the countdown would be off by .5 when using round()
- countdown = ceil(getstatf(STAT_GAMESTARTTIME) - time);
+ countdown = ceil(STAT(GAMESTARTTIME) - time);
s = sprintf(_("^1Game starts in ^3%d^1 seconds"), countdown);
drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
o.y += fontsize.y;
if(getstati(STAT_HEALTH) <= 0) return;
if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return;
- strengthTime = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99);
- shieldTime = bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 99);
+ strengthTime = bound(0, STAT(STRENGTH_FINISHED) - time, 99);
+ shieldTime = bound(0, STAT(INVINCIBLE_FINISHED) - time, 99);
superTime = bound(0, getstatf(STAT_SUPERWEAPONS_FINISHED) - time, 99);
if(allItems & IT_UNLIMITED_SUPERWEAPONS)
timelimit = getstatf(STAT_TIMELIMIT);
- timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time);
+ timeleft = max(0, timelimit * 60 + STAT(GAMESTARTTIME) - time);
timeleft = ceil(timeleft);
minutesLeft = floor(timeleft / 60);
timer_color = '1 0 0'; //red
if (autocvar_hud_panel_timer_increment || timelimit == 0 || warmup_stage) {
- if (time < getstatf(STAT_GAMESTARTTIME)) {
+ if (time < STAT(GAMESTARTTIME)) {
//while restart is still active, show 00:00
timer = seconds_tostring(0);
} else {
- elapsedTime = floor(time - getstatf(STAT_GAMESTARTTIME)); //127
+ elapsedTime = floor(time - STAT(GAMESTARTTIME)); //127
timer = seconds_tostring(elapsedTime);
}
} else {
vortex_charge = getstatf(STAT_VORTEX_CHARGE);
vortex_chargepool = getstatf(STAT_VORTEX_CHARGEPOOL);
- float arc_heat = getstatf(STAT_ARC_HEAT);
+ float arc_heat = STAT(ARC_HEAT);
if(vortex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
vortex_charge_movingavg = vortex_charge;
}
// edge detection postprocess handling done second (used by hud_powerup)
- float sharpen_intensity = 0, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED);
+ float sharpen_intensity = 0, strength_finished = STAT(STRENGTH_FINISHED), invincible_finished = STAT(INVINCIBLE_FINISHED);
if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
STAT_LAST_VECTOR
};
+const int REGISTERED_STATS = 6;
+
REGISTER_STAT(KH_KEYS, int)
/** weapon requested to switch to; next WANTED weapon (for HUD) */
REGISTER_STAT(SWITCHWEAPON, int)
+REGISTER_STAT(GAMESTARTTIME, float)
+REGISTER_STAT(STRENGTH_FINISHED, float)
+REGISTER_STAT(INVINCIBLE_FINISHED, float)
+/** arc heat in [0,1] */
+REGISTER_STAT(ARC_HEAT, float)
enum {
- STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + 2,
+ STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + REGISTERED_STATS,
- STAT_GAMESTARTTIME,
- STAT_STRENGTH_FINISHED,
- STAT_INVINCIBLE_FINISHED,
- STAT_ARC_HEAT,
STAT_PRESSED_KEYS,
/** this stat could later contain some other bits of info, like, more server-side particle config */ STAT_ALLOW_OLDVORTEXBEAM,
STAT_FUEL,
#define WEAPONS_ALL_H
#include "../command/all.qh"
+#include "../stats.qh"
#include "config.qh"
// weapon sets
.float beam_heat; // (beam) amount of heat produced
.float arc_overheat; // (dropped arc/player) time during which it's too hot
.float arc_cooldown; // (dropped arc/player) cooling speed
-.float arc_heat_percent; // (player) arc heat in [0,1] (stat)
+.float arc_heat_percent = _STAT(ARC_HEAT);
.float arc_smoke_sound;
#endif
#ifdef CSQC
.float pain_frame; //"
.float crouch; // Crouching or not?
-.float strength_finished;
-.float invincible_finished;
+.float strength_finished = _STAT(STRENGTH_FINISHED);
+.float invincible_finished = _STAT(INVINCIBLE_FINISHED);
.float superweapons_finished;
.float cnt; // used in too many places
float game_starttime; //point in time when the countdown to game start is over
float round_starttime; //point in time when the countdown to round start is over
-.float stat_game_starttime;
+.float stat_game_starttime = _STAT(GAMESTARTTIME);
.float stat_round_starttime;
void W_Porto_Remove (entity p);
WepSet_AddStat();
WepSet_AddStat_InMap();
addstat(STAT_SWITCHINGWEAPON, AS_INT, switchingweapon);
- addstat(STAT_GAMESTARTTIME, AS_FLOAT, stat_game_starttime);
addstat(STAT_ROUNDSTARTTIME, AS_FLOAT, stat_round_starttime);
addstat(STAT_ALLOW_OLDVORTEXBEAM, AS_INT, stat_allow_oldvortexbeam);
Nagger_Init();
- addstat(STAT_STRENGTH_FINISHED, AS_FLOAT, strength_finished);
- addstat(STAT_INVINCIBLE_FINISHED, AS_FLOAT, invincible_finished);
addstat(STAT_SUPERWEAPONS_FINISHED, AS_FLOAT, superweapons_finished);
addstat(STAT_PRESSED_KEYS, AS_FLOAT, pressedkeys);
addstat(STAT_FUEL, AS_INT, ammo_fuel);
addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load);
- addstat(STAT_ARC_HEAT, AS_FLOAT, arc_heat_percent);
-
// freeze attacks
addstat(STAT_FROZEN, AS_INT, frozen);
addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, revive_progress);