]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show respawn information below the scoreboard when dead. Useful to know if you've...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 5 Oct 2012 23:18:50 +0000 (02:18 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 5 Oct 2012 23:18:50 +0000 (02:18 +0300)
qcsrc/client/scoreboard.qc
qcsrc/common/constants.qh
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc

index 48a7217fc703a08b3b7f7fdfab3bc58efea36c2e..9bcb516a585c43a54ec6f53ad29e564f9e9102cb 100644 (file)
@@ -1374,6 +1374,25 @@ void HUD_DrawScoreboard()
                }
        }
 
+       // add information about respawn status
+       float respawn_time = getstatf(STAT_RESPAWN_SCHEDULE);
+       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
+                       str = strcat(str, "\n\nRespawning in ", ftos(respawn_time - time), " seconds...");
+               }
+               else if(time < respawn_time)
+               {
+                       str = strcat(str, "\n\nYou are dead, wait ", ftos(respawn_time - time), " seconds before respawning");
+               }
+               else if(time >= respawn_time)
+               {
+                       str = strcat(str, "\n\nYou are dead, press fire 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 c270b61a96efa51308b779c733231f2e6284dd47..8bbbd2ee20a3348a1d1d668ed44fdd072205f7e8 100644 (file)
@@ -179,6 +179,8 @@ const float STAT_VEHICLESTAT_RELOAD2 = 66;
 const float STAT_SECRETS_TOTAL = 70;
 const float STAT_SECRETS_FOUND = 71;
 
+const float STAT_RESPAWN_SCHEDULE = 72;
+
 // mod stats (1xx)
 const float STAT_REDALIVE = 100;
 const float STAT_BLUEALIVE = 101;
index 9d6bcf798d8b3026e6fb542731491923ba99b715..3cae45e4ff0460da48c7a9e2dd4ef4c06826ba26 100644 (file)
@@ -461,6 +461,7 @@ 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;
@@ -779,6 +780,7 @@ 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;
@@ -2730,6 +2732,12 @@ 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
+
                        return;
                }
                // FIXME from now on self.deadflag is always 0 (and self.health is never < 1)
index 9068fa75bf53e95400df5e635e8551faa3ae3a2c..6203456cbdfd4ea7c215dd027e32c748e78914b7 100644 (file)
@@ -647,6 +647,8 @@ 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
+
 void PlayerUseKey();
 
 typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
index 4cd5cc810a1c9f456bc372c0e8106e9b2d274488..798933a30d741c844266f57374b072e4c268ff9a 100644 (file)
@@ -830,6 +830,9 @@ void spawnfunc_worldspawn (void)
        // secrets
        addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total);
        addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found);
+
+       // misc
+       addstat(STAT_RESPAWN_SCHEDULE, AS_FLOAT, respawn_schedule);
        
        next_pingtime = time + 5;