From: Mircea Kitsune Date: Sat, 6 Oct 2012 10:36:11 +0000 (+0300) Subject: Code cleanup X-Git-Tag: xonotic-v0.7.0~198^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c7df878d742427829b294ae9043a64e98aa00c8d;p=xonotic%2Fxonotic-data.pk3dir.git Code cleanup --- diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index 3deb10caa..21e800abc 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -1377,24 +1377,20 @@ void HUD_DrawScoreboard() pos_y += 1.2 * hud_fontsize_y; drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL); - // add information about respawn status - float respawn_time = getstatf(STAT_RESPAWN_SCHEDULE); + // print information about respawn status + float respawn_time = getstatf(STAT_RESPAWN_TIME); if(respawn_time) { if(respawn_time < 0) { - // a negative value means we are awaiting respawn, time value is still the same - respawn_time *= -1; // remove our mark now that we checked it + // a negative number means we are awaiting respawn, time value is still the same + respawn_time *= -1; // remove mark now that we checked it str = strcat("Respawning in ^3", substring(ftos(bound(0, respawn_time - time, 9.999999)), 0, 4), "^7 seconds..."); } else if(time < respawn_time) - { str = strcat("You are dead, wait ^3", substring(ftos(bound(0, respawn_time - time, 9.999999)), 0, 4), "^7 seconds before respawning"); - } else if(time >= respawn_time) - { str = strcat("You are dead, press ^1", getcommandkey("primary fire", "+fire"), "^7 to respawn"); - } pos_y += 1.2 * hud_fontsize_y; drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL); diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 8bbbd2ee2..75f5a0bde 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -179,7 +179,7 @@ const float STAT_VEHICLESTAT_RELOAD2 = 66; const float STAT_SECRETS_TOTAL = 70; const float STAT_SECRETS_FOUND = 71; -const float STAT_RESPAWN_SCHEDULE = 72; +const float STAT_RESPAWN_TIME = 72; // mod stats (1xx) const float STAT_REDALIVE = 100; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 3cae45e4f..527216340 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -461,7 +461,6 @@ void PutObserverInServer (void) self.damageforcescale = 0; self.death_time = 0; self.respawn_time = 0; - self.respawn_schedule = 0; self.alpha = 0; self.scale = 0; self.fade_time = 0; @@ -780,7 +779,6 @@ void PutClientInServer (void) self.damageforcescale = 2; self.death_time = 0; self.respawn_time = 0; - self.respawn_schedule = 0; self.scale = 0; self.fade_time = 0; self.pain_frame = 0; @@ -2559,6 +2557,7 @@ void PlayerPreThink (void) self.stat_game_starttime = game_starttime; self.stat_allow_oldnexbeam = autocvar_g_allow_oldnexbeam; self.stat_leadlimit = autocvar_leadlimit; + self.stat_respawn_time = self.respawn_time; if(frametime) { @@ -2733,10 +2732,9 @@ void PlayerPreThink (void) ShowRespawnCountdown(); } - if(self.respawn_schedule != self.respawn_time) - self.respawn_schedule = self.respawn_time; - if(self.deadflag == DEAD_RESPAWNING && self.respawn_schedule > 0) - self.respawn_schedule *= -1; // invert to indicate we're awaiting respawn, the client translates this + // if respawning, invert stat_respawn_time to indicate this, the client translates it + if(self.deadflag == DEAD_RESPAWNING && self.stat_respawn_time > 0) + self.stat_respawn_time *= -1; return; } diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 6203456cb..d7772e509 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -647,7 +647,7 @@ float serverflags; .entity muzzle_flash; .float misc_bulletcounter; // replaces uzi & hlac bullet counter. -.float respawn_schedule; // shows respawn time, and is negative when awaiting respawn +.float stat_respawn_time; // shows respawn time, and is negative when awaiting respawn void PlayerUseKey(); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 798933a30..69bf57d51 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -832,7 +832,7 @@ void spawnfunc_worldspawn (void) addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found); // misc - addstat(STAT_RESPAWN_SCHEDULE, AS_FLOAT, respawn_schedule); + addstat(STAT_RESPAWN_TIME, AS_FLOAT, stat_respawn_time); next_pingtime = time + 5;