r4620 - in trunk/data/qcsrc: client common server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Oct 4 07:21:08 EDT 2008
Author: div0
Date: 2008-10-04 07:21:08 -0400 (Sat, 04 Oct 2008)
New Revision: 4620
Modified:
trunk/data/qcsrc/client/sbar.qc
trunk/data/qcsrc/common/constants.qh
trunk/data/qcsrc/server/arena.qc
trunk/data/qcsrc/server/bots.qc
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/cl_weapons.qc
trunk/data/qcsrc/server/cl_weaponsystem.qc
trunk/data/qcsrc/server/clientcommands.qc
trunk/data/qcsrc/server/defs.qh
trunk/data/qcsrc/server/domination.qc
trunk/data/qcsrc/server/g_hook.qc
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/race.qc
trunk/data/qcsrc/server/runematch.qc
trunk/data/qcsrc/server/sv_main.qc
trunk/data/qcsrc/server/teamplay.qc
Log:
fix timelimit display after ready-restart (no longer 20.166666667)
Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/client/sbar.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -1078,11 +1078,12 @@
}
}
timelimit = getstatf(STAT_TIMELIMIT);
- if(timelimit)
+ if(timelimit > 0)
{
- timeleft = max(0, timelimit * 60 - time);
+ timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time);
+ timeleft = ceil(timeleft);
minutes = floor(timeleft / 60);
- seconds = floor(timeleft - minutes*60);
+ seconds = timeleft - minutes*60;
if(minutes >= 5)
{
Sbar_DrawXNum('-72 32 0', minutes, 3, 12, '1 1 1', 1, DRAWFLAG_NORMAL);
Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/common/constants.qh 2008-10-04 11:21:08 UTC (rev 4620)
@@ -227,6 +227,7 @@
const float STAT_SYS_TICRATE = 34;
const float STAT_WEAPONS = 35;
const float STAT_SWITCHWEAPON = 36;
+const float STAT_GAMESTARTTIME = 37;
const float CTF_STATE_ATTACK = 1;
const float CTF_STATE_DEFEND = 2;
const float CTF_STATE_COMMANDER = 3;
Modified: trunk/data/qcsrc/server/arena.qc
===================================================================
--- trunk/data/qcsrc/server/arena.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/arena.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -134,7 +134,7 @@
restart_mapalreadyrestarted to 1 after the countdown ended or when
sv_ready_restart_after_countdown is not used and countdown is still running
*/
- if (restart_mapalreadyrestarted || (time < restart_countdown))
+ if (restart_mapalreadyrestarted || (time < game_starttime))
{
//NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
if (self.classname == "player") {
@@ -154,7 +154,7 @@
}
if(g_keyhunt)
- kh_Controller_SetThink(cvar("g_balance_keyhunt_delay_round")+RESTART_COUNTDOWN, "", kh_StartRound);
+ kh_Controller_SetThink(cvar("g_balance_keyhunt_delay_round")+(game_starttime - time), "", kh_StartRound);
if(g_arena)
if(champion)
@@ -225,7 +225,7 @@
float f;
string msg;
- if(!g_arena || !arena_roundbased || (time < restart_countdown))
+ if(!g_arena || !arena_roundbased || (time < game_starttime))
return;
f = rint(warmup - time);
Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/bots.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -1815,7 +1815,7 @@
//self.bot_painintensity = self.bot_painintensity + self.bot_oldhealth - self.health;
//self.bot_painintensity = bound(0, self.bot_painintensity, 100);
- if(time < restart_countdown || ((cvar("g_campaign") && !campaign_bots_may_start)))
+ if(time < game_starttime || ((cvar("g_campaign") && !campaign_bots_may_start)))
{
self.nextthink = time + 0.5;
return;
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/cl_client.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -671,11 +671,11 @@
self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
//extend the pause of rotting if client was reset at the beginning of the countdown
- if(!cvar("sv_ready_restart_after_countdown") && time < restart_countdown) {
- self.spawnshieldtime += RESTART_COUNTDOWN;
- self.pauserotarmor_finished += RESTART_COUNTDOWN;
- self.pauserothealth_finished += RESTART_COUNTDOWN;
- self.pauseregen_finished += RESTART_COUNTDOWN;
+ if(!cvar("sv_ready_restart_after_countdown") && time < game_starttime) { // TODO why is this cvar NOTted?
+ self.spawnshieldtime += game_starttime - time;
+ self.pauserotarmor_finished += game_starttime - time;
+ self.pauserothealth_finished += game_starttime - time;
+ self.pauseregen_finished += game_starttime - time;
}
self.damageforcescale = 2;
self.death_time = 0;
@@ -1605,7 +1605,7 @@
if (g_midair)
self.spawnshieldtime = max(self.spawnshieldtime, time + cvar("g_midair_shieldtime"));
- if (time > restart_countdown)
+ if (time >= game_starttime)
if (time < self.spawnshieldtime)
self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
}
@@ -1997,6 +1997,8 @@
void PlayerPreThink (void)
{
self.stat_sys_ticrate = cvar("sys_ticrate");
+ self.stat_game_starttime = game_starttime;
+
if(blockSpectators)
checkSpectatorBlock();
@@ -2140,7 +2142,7 @@
dist_z = 0;
self.lms_traveled_distance += fabs(vlen(dist));
- if((cvar("g_campaign") && !campaign_bots_may_start) || (time < restart_countdown))
+ if((cvar("g_campaign") && !campaign_bots_may_start) || (time < game_starttime))
{
self.lms_nextcheck = time + cvar("g_lms_campcheck_interval")*2;
self.lms_traveled_distance = 0;
@@ -2294,16 +2296,16 @@
//if (TetrisPostFrame()) return;
// restart countdown
- if (restart_countdown) {
- if(time < restart_countdown) {
+ if(time < game_starttime) {
if (!cvar("sv_ready_restart_after_countdown"))
{
if(self.movement != '0 0 0' && g_race && !g_race_qualifying)
{
- if(time < restart_countdown - 2)
+ if(time < game_starttime - 2)
{
if(!self.race_penalty_nagged)
{
+ // TODO better notification for this!
centerprint_atprio(self, CENTERPRIO_IDLEKICK, "^1DO NOT MOVE DURING THE COUNTDOWN.");
self.race_penalty_nagged = 1;
}
@@ -2340,7 +2342,6 @@
self.race_penalty_nagged = 0;
}
}
- }
} else if (self.classname == "observer") {
//do nothing
Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/cl_weapons.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -244,7 +244,7 @@
// Bringed back weapon frame
void W_WeaponFrame()
{
- if((arena_roundbased && time < warmup) || ((time < restart_countdown) && !cvar("sv_ready_restart_after_countdown")))
+ if((arena_roundbased && time < warmup) || ((time < game_starttime) && !cvar("sv_ready_restart_after_countdown")))
return;
if (!self.weaponentity || self.health < 1)
Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -412,7 +412,7 @@
//if sv_ready_restart_after_countdown is set, don't allow the player to shoot
//if all players readied up and the countdown is running
if (cvar("sv_ready_restart_after_countdown"))
- if(time < restart_countdown || time < self.race_penalty) {
+ if(time < game_starttime || time < self.race_penalty) {
return FALSE;
}
Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/clientcommands.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -330,7 +330,7 @@
return sprint(self, "^1You cannot reset the game while a timeout is active!\n");
}
- if(!restart_countdown || cvar("sv_ready_restart_repeatable"))
+ if(game_starttime == 0 || cvar("sv_ready_restart_repeatable"))
{
self.ready = TRUE;
bprint(self.netname, "^2 is ready\n");
@@ -454,17 +454,8 @@
if(checkrules_overtimeend)
checkrules_overtimeend = 0;
- restart_countdown = time + RESTART_COUNTDOWN;
+ game_starttime = time + RESTART_COUNTDOWN;
restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use
- if(0 < cvar("timelimit") || inWarmupStage)
- {
- // remember original timelimit on first restart
- if(!timelimit_orig)
- timelimit_orig = cvar("timelimit");
- //only set the new timelimit if, when loading the map, a timelimit was really set
- if(timelimit_orig)
- cvar_set("timelimit", ftos(timelimit_orig + ceil(restart_countdown)/60));
- }
inWarmupStage = 0; //once the game is restarted the game is in match stage
@@ -598,22 +589,19 @@
void evaluateTimeoutCall() {
if (inWarmupStage && !g_warmup_allow_timeout)
return sprint(self, "^7Error: You can not call a timeout in warmup-stage!\n");
- if (time < restart_countdown )
+ if (time < game_starttime )
return sprint(self, "^7Error: You can not call a timeout while the map is being restarted!\n");
if (timeoutStatus != 2) {
//if the map uses a timelimit make sure that timeout cannot be called right before the map ends
if (cvar("timelimit")) {
//a timelimit was used
local float myTl;
- if (cvar("timelimit"))
- myTl = cvar("timelimit");
- else
- myTl = timelimit_orig;
+ myTl = cvar("timelimit");
local float lastPossibleTimeout;
lastPossibleTimeout = (myTl*60) - cvar("sv_timeout_leadtime") - 1;
- if (lastPossibleTimeout < time)
+ if (lastPossibleTimeout < time - game_starttime)
return sprint(self, "^7Error: It is too late to call a timeout now!\n");
}
}
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/defs.qh 2008-10-04 11:21:08 UTC (rev 4620)
@@ -277,14 +277,12 @@
.float ready;
#define RESTART_COUNTDOWN 10
-float restart_countdown; //point in time when the countdown is over
float restart_mapalreadyrestarted; //bool, indicates whether reset_map() was already executed
entity restartAnnouncer; //a temporary entity which will play the countdown sounds 3, 2, 1 for all clients, will also reset the map after the countdown
void restartAnnouncer_Think();
float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
.float spectatortime; //point in time since the client is spectating or observing
void checkSpectatorBlock();
-float timelimit_orig;
.float winning;
.float jointime;
@@ -492,3 +490,6 @@
.string fog;
string cvar_changes;
+
+float game_starttime; //point in time when the countdown is over
+.float stat_game_starttime;
Modified: trunk/data/qcsrc/server/domination.qc
===================================================================
--- trunk/data/qcsrc/server/domination.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/domination.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -121,7 +121,7 @@
// give points
- if (gameover || self.delay > time || time < restart_countdown) // game has ended, don't keep giving points
+ if (gameover || self.delay > time || time < game_starttime) // game has ended, don't keep giving points
return;
waittime = cvar("g_domination_point_rate");
Modified: trunk/data/qcsrc/server/g_hook.qc
===================================================================
--- trunk/data/qcsrc/server/g_hook.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/g_hook.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -304,7 +304,7 @@
local entity missile;
local vector org;
- if((arena_roundbased && time < warmup) || (time < restart_countdown))
+ if((arena_roundbased && time < warmup) || (time < game_starttime))
return;
makevectors(self.v_angle);
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/g_world.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -354,12 +354,6 @@
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 1);
- //if tourney is used map starts in warmup mode. if this mode shall stay unlimited, reset timelimit, but save the original one
- if(inWarmupStage) {
- timelimit_orig = cvar("timelimit");
- cvar_set("timelimit", "0");
- }
-
if(whichpack(strcat("maps/", mapname, ".cfg")) != "")
{
fd = fopen(strcat("maps/", mapname, ".cfg"), FILE_READ);
@@ -398,6 +392,7 @@
addstat(STAT_SYS_TICRATE, AS_FLOAT, stat_sys_ticrate);
addstat(STAT_WEAPONS, AS_INT, weapons);
addstat(STAT_SWITCHWEAPON, AS_INT, switchweapon);
+ addstat(STAT_GAMESTARTTIME, AS_FLOAT, stat_game_starttime);
Nagger_Init();
next_pingtime = time + 5;
@@ -1286,7 +1281,7 @@
local entity oldself;
oldself = self;
self = ent;
- cvar_set("timelimit", ftos((2*time)/60));
+ cvar_set("timelimit", ftos((2*time)/60)); // FIXME use game_starttime here
assault_new_round();
self = oldself;
}
@@ -1610,9 +1605,15 @@
timelimit = cvar("timelimit") * 60;
fraglimit = cvar("fraglimit");
- if(inWarmupStage)
+ if(inWarmupStage || time <= game_starttime) // NOTE: this is <= to prevent problems in the very tic where the game starts
+ {
+ timelimit = 0; // timelimit is not made for warmup
fraglimit = 0; // no fraglimit for now
+ }
+ if(timelimit > 0)
+ timelimit += game_starttime;
+
if(checkrules_overtimeend)
{
if(!checkrules_overtimewarning)
Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/race.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -96,7 +96,7 @@
else
{
s = PlayerScore_Add(e, SP_RACE_TIME, 0);
- snew = floor(0.5 + 10 * (time - restart_countdown));
+ snew = floor(0.5 + 10 * (time - game_starttime));
PlayerScore_Add(e, SP_RACE_TIME, snew - s);
l = PlayerTeamScore_Add(e, SP_RACE_LAPS, ST_RACE_LAPS, 1);
Modified: trunk/data/qcsrc/server/runematch.qc
===================================================================
--- trunk/data/qcsrc/server/runematch.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/runematch.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -151,7 +151,7 @@
vector ang;
entity rune;
- if(self.owner.classname != "player" || time < restart_countdown)
+ if(self.owner.classname != "player" || time < game_starttime)
{
rune_respawn();
return;
Modified: trunk/data/qcsrc/server/sv_main.qc
===================================================================
--- trunk/data/qcsrc/server/sv_main.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/sv_main.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -158,7 +158,7 @@
// if in warmup stage and limit for warmup is hit start match
if (inWarmupStage
&& 0 < g_warmup_limit
- && (time + RESTART_COUNTDOWN) >= g_warmup_limit)
+ && time >= g_warmup_limit)
{
ReadyRestart();
return;
Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc 2008-10-03 18:32:25 UTC (rev 4619)
+++ trunk/data/qcsrc/server/teamplay.qc 2008-10-04 11:21:08 UTC (rev 4620)
@@ -368,7 +368,7 @@
self.welcomemessage_time = time + 0.8; */
if(self.cvar_scr_centertime == 0) return;
- if( !(timeoutStatus >= 1 || (time < restart_countdown) ) ) { //really print the WelcomeMessage to the player every frame when timeout-seconds are shown or the game is restarted, to make sure that the shown number is accurate
+ if( !(timeoutStatus >= 1 || (time < game_starttime) ) ) { //really print the WelcomeMessage to the player every frame when timeout-seconds are shown or the game is restarted, to make sure that the shown number is accurate
if(self.welcomemessage_time > time) return;
self.welcomemessage_time = time + self.cvar_scr_centertime * 0.6;
}
@@ -384,7 +384,7 @@
// TODO get rid of this too
local string specString;
specString = NEWLINES;
- if(time < restart_countdown) //also show the countdown when being a spectator
+ if(time < game_starttime) //also show the countdown when being a spectator
specString = strcat(specString, "\n\n^1Game starts in ", ftos(restartAnnouncer.cnt + 1), " seconds^7");
else if (timeoutStatus != 0)
specString = strcat(specString, "\n\n", getTimeoutText(1));
@@ -452,7 +452,7 @@
if(modifications != "")
s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n");
- if(time < restart_countdown)
+ if(time < game_starttime)
s = strcat(s, "\n^1Game starts in ", ftos(restartAnnouncer.cnt + 1), " seconds^7");
if(timeoutStatus != 0)
More information about the nexuiz-commits
mailing list