]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Code cleanup
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 6 Oct 2012 10:36:11 +0000 (13:36 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 6 Oct 2012 10:36:11 +0000 (13:36 +0300)
qcsrc/client/scoreboard.qc
qcsrc/common/constants.qh
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc

index 3deb10caa9747cc251089aa1b04edd4ec541b166..21e800abc02adcf870929354d2bf0896e56a5c62 100644 (file)
@@ -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);
index 8bbbd2ee20a3348a1d1d668ed44fdd072205f7e8..75f5a0bde762037387dbeb344989a47b1409bc01 100644 (file)
@@ -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;
index 3cae45e4ff0460da48c7a9e2dd4ef4c06826ba26..527216340145463f8cc321a048a61cdf3a7d2b77 100644 (file)
@@ -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;
                }
index 6203456cbdfd4ea7c215dd027e32c748e78914b7..d7772e5090d0fda499eb14eee8f3544b298bf007 100644 (file)
@@ -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();
 
index 798933a30d741c844266f57374b072e4c268ff9a..69bf57d51b4af98e37a6f79e55d45cdc4cffe841 100644 (file)
@@ -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;