previous_game_starttime = startTime;
}
+#define ANNOUNCER_CHECKMINUTE(minute) MACRO_BEGIN { \
+ if(announcer_##minute##min) { \
+ if(timeleft > minute * 60) \
+ announcer_##minute##min = false; \
+ } else { \
+ if(timeleft < minute * 60 && timeleft > minute * 60 - 1) { \
+ announcer_##minute##min = true; \
+ Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_##minute); \
+ } \
+ } \
+} MACRO_END
-// Plays the 1 minute or 5 minutes (of maptime) remaining sound, if client wants it
void Announcer_Time()
{
- float timelimit = STAT(TIMELIMIT);
- float timeleft = max(0, timelimit * 60 + STAT(GAMESTARTTIME) - time);
- float warmup_timeleft = 0;
-
+ float timeleft;
if(warmup_stage)
- if(autocvar_g_warmup_limit > 0)
- warmup_timeleft = max(0, autocvar_g_warmup_limit + STAT(GAMESTARTTIME) - time);
-
- // 5 minute check
- if(autocvar_cl_announcer_maptime >= 2)
{
- // make sure that after connect (and e.g. 4 minutes left) we will not get a wrong sound
- if(announcer_5min)
- {
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 300)
- || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 300))
- announcer_5min = false;
- }
+ float warmup_timelimit = STAT(WARMUP_TIMELIMIT);
+ if(warmup_timelimit > 0)
+ timeleft = max(0, warmup_timelimit - time);
else
- {
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 300 && timeleft > 299)
- || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 300 && warmup_timeleft > 299))
- {
- //if we're in warmup mode, check whether there's a warmup timelimit
- if(!(autocvar_g_warmup_limit == -1 && warmup_stage))
- {
- announcer_5min = true;
- Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_5);
- }
- }
- }
+ timeleft = 0;
}
+ else
+ timeleft = max(0, STAT(TIMELIMIT) * 60 + STAT(GAMESTARTTIME) - time);
+
+ if(autocvar_cl_announcer_maptime >= 2)
+ ANNOUNCER_CHECKMINUTE(5);
- // 1 minute check
if((autocvar_cl_announcer_maptime == 1) || (autocvar_cl_announcer_maptime == 3))
- {
- if (announcer_1min)
- {
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 60)
- || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 60))
- announcer_1min = false;
- }
- else if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 60)
- || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 60))
- {
- // if we're in warmup mode, check whether there's a warmup timelimit
- if(!(autocvar_g_warmup_limit == -1 && warmup_stage))
- {
- announcer_1min = true;
- Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_1);
- }
- }
- }
+ ANNOUNCER_CHECKMINUTE(1);
}
void Announcer()
int autocvar_ekg;
float autocvar_fov;
float autocvar_g_balance_damagepush_speedfactor;
-float autocvar_g_warmup_limit;
bool autocvar_hud_cursormode = true;
float autocvar_hud_colorflash_alpha;
bool autocvar_hud_configure_checkcollisions;
minutesLeft = floor(timeleft / 60);
+ float warmup_timeleft = 0;
+ if(warmup_stage)
+ {
+ float warmup_timelimit = STAT(WARMUP_TIMELIMIT);
+ if(warmup_timelimit > 0)
+ warmup_timeleft = max(0, warmup_timelimit - time);
+ else if(warmup_timelimit == 0)
+ warmup_timeleft = timeleft;
+ warmup_timeleft = ceil(warmup_timeleft);
+ }
+
vector timer_color;
if(minutesLeft >= 5 || warmup_stage || timelimit == 0) //don't use red or yellow in warmup or when there is no timelimit
timer_color = '1 1 1'; //white
else
timer_color = '1 0 0'; //red
- if (autocvar_hud_panel_timer_increment || timelimit == 0 || warmup_stage) {
+ if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) {
if (time < STAT(GAMESTARTTIME)) {
//while restart is still active, show 00:00
timer = seconds_tostring(0);
} else {
- elapsedTime = floor(time - STAT(GAMESTARTTIME)); //127
+ elapsedTime = floor(time - STAT(GAMESTARTTIME));
timer = seconds_tostring(elapsedTime);
}
} else {
- timer = seconds_tostring(timeleft);
+ if(warmup_stage)
+ timer = seconds_tostring(warmup_timeleft);
+ else
+ timer = seconds_tostring(timeleft);
}
drawstring_aspect(pos, timer, mySize, timer_color, panel_fg_alpha, DRAWFLAG_NORMAL);
REGISTER_STAT(MOVEVARS_AIRCONTROL, float)
REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit)
REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit)
+REGISTER_STAT(WARMUP_TIMELIMIT, float, warmup_limit)
#ifdef SVQC
float autocvar_sv_wallfriction;
#endif
#pragma once
+float warmup_limit;
#include <common/weapons/all.qh>
#include <common/stats.qh>
// Globals
float g_footsteps, g_grappling_hook, g_instagib;
-float g_warmup_limit;
float g_warmup_allguns;
float g_warmup_allow_timeout;
float warmup_stage;
sv_taunt = cvar("sv_taunt");
warmup_stage = cvar("g_warmup");
- g_warmup_limit = cvar("g_warmup_limit");
+ warmup_limit = cvar("g_warmup_limit");
+ if(warmup_limit == 0)
+ warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
g_warmup_allguns = cvar("g_warmup_allguns");
g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
CreatureFrame_All();
CheckRules_World();
- // if in warmup stage and limit for warmup is hit start match
- if(warmup_stage)
- if(!gameover)
- if((g_warmup_limit > 0 && time >= g_warmup_limit)
- || (g_warmup_limit == 0 && autocvar_timelimit != 0 && time >= autocvar_timelimit * 60))
+ if(warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit)
{
ReadyRestart();
return;