]> git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/hud.qc
Scoreboard respawn info from my code in Xonotic
[voretournament/voretournament.git] / data / qcsrc / client / hud.qc
index c0983860157696377c5139d158a76e552d8e9b25..be1cc1e7204dfac692a3734e36eca97c3e4cbbfe 100644 (file)
@@ -1516,6 +1516,29 @@ void Sbar_DrawScoreboard()
        pos_y += 1.2 * sbar_fontsize_y;\r
        drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, sbar_fontsize)), str, sbar_fontsize, sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
+       // print information about respawn status\r
+       float respawn_time = getstatf(STAT_RESPAWN_TIME);\r
+       dprint(strcat(ftos(respawn_time), " --------\n"));\r
+       if(respawn_time)\r
+       {\r
+               if(respawn_time < 0)\r
+               {\r
+                       // a negative number means we are awaiting respawn, time value is still the same\r
+                       respawn_time *= -1; // remove mark now that we checked it\r
+                       if(time >= respawn_time) // don't show a negative value while the server is respawning the player (lag)\r
+                               str = strcat("^1Respawning...");\r
+                       else\r
+                               str = strcat("^1Respawning in ^3", ftos_decimals(respawn_time - time, 2), "^1 seconds...");\r
+               }\r
+               else if(time < respawn_time)\r
+                       str = strcat("You are dead, wait ^3", ftos_decimals(respawn_time - time, 2), "^7 seconds before respawning");\r
+               else if(time >= respawn_time)\r
+                       str = strcat("You are dead, press ^2", getcommandkey("primary fire", "+fire"), "^7 to respawn");\r
+\r
+               pos_y += 1.2 * sbar_fontsize_y;\r
+               drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, sbar_fontsize)), str, sbar_fontsize, sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL);\r
+       }\r
+\r
        scoreboard_bottom = pos_y + 2 * sbar_fontsize_y;\r
 }\r
 \r
@@ -1989,7 +2012,7 @@ void Sbar_Status()
        health_pos = bottom - '43 58 0';\r
        armor_pos = bottom - '43 68 0';\r
 \r
-       if (cvar("viewsize") <= 100) {\r
+       if (cvar("viewsize") <= 100 && sbar_hudselector) {\r
                if (teamplay)\r
                        drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
                else {\r
@@ -2015,6 +2038,10 @@ void Sbar_Status()
        health_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '22 22 0') * 0.5;\r
        Sbar_DrawXNum(health_pos, x, 3, 0, 22, Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
+       // if we are dead, we can skip the HUD from here\r
+       if(health <= 0)\r
+               return;\r
+\r
        // ammo\r
        pos_x = bottom_x + 140;\r
        pos_y = bottom_y - 20;\r
@@ -2138,7 +2165,7 @@ void Sbar_Timer()
                bgpos_z = 0;\r
        }\r
 \r
-       if (cvar("viewsize") <= 100) { // draw timer background when viewsize <= 100\r
+       if (cvar("viewsize") <= 100 && sbar_hudselector) { // draw timer background when viewsize <= 100\r
                if (teamplay)\r
                        drawpic(bgpos, "gfx/hud/bg_timer", '120 30 0' * scale, GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // timer bg color = myteam color\r
                else {\r
@@ -3118,6 +3145,7 @@ void Sbar_Draw (void)
                Sbar_DrawScoreboard();\r
                Sbar_Score();\r
                Sbar_Timer();\r
+               Sbar_Portrait();\r
                if(getstati(STAT_VORE_EATEN))\r
                        Sbar_Status();\r
 \r
@@ -3147,6 +3175,7 @@ void Sbar_Draw (void)
                                drawpic(warn_pos - '128 0 0', "gfx/hud/sb_power_fail", '256 256 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                                drawpic(warn_pos - '16 0 0' + '0 150 0', "gfx/hud/sb_power_fail_icon", '32 32 0', '1 1 1', sbar_alpha_fg * (0.5 + sin(time * 5) / 2), DRAWFLAG_NORMAL);\r
                                power_boot = time + g_power_reboot;\r
+                               Sbar_Portrait(); // draw the portrait still\r
                                return; // skip drawing the HUD\r
                        }\r
                        else if(time <= power_boot)\r
@@ -3154,6 +3183,7 @@ void Sbar_Draw (void)
                                // subsystems are rebooting\r
                                drawpic(warn_pos - '128 0 0', "gfx/hud/sb_power_reboot", '256 256 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                                drawpic(warn_pos - '16 0 0' + '0 150 0', "gfx/hud/sb_power_reboot_icon", '32 32 0', '1 1 1', sbar_alpha_fg * (0.5 + sin(time * 5) / 2), DRAWFLAG_NORMAL);\r
+                               Sbar_Portrait(); // draw the portrait still\r
                                return; // skip drawing the HUD\r
                        }\r
                }\r
@@ -3161,7 +3191,7 @@ void Sbar_Draw (void)
                if(g_vore) // only when the vore system is active\r
                {\r
                        // draw the stomach board\r
-                       if (cvar("viewsize") <= 100) {\r
+                       if (cvar("viewsize") <= 100 && sbar_hudselector) {\r
                                if (teamplay)\r
                                        drawpic(bottomleft- '0 256 0', "gfx/hud/bg_stomach", '256 256 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
                                else {\r
@@ -3204,7 +3234,7 @@ void Sbar_Draw (void)
                                status_pos = bottomleft - '-43 168 0';\r
                                status_size = 16;\r
                        }\r
-                       else if(g_healthsize_center >= 0) // no point in showing it otherwise\r
+                       else\r
                        {\r
                                status_text = strcat(status_color, ftos(stomach_maxload));\r
                                status_pos = bottomleft - '-43 170 0';\r
@@ -3225,6 +3255,7 @@ void Sbar_Draw (void)
                        float f, l;\r
 \r
                        pos = bottomleft;\r
+                       hud_total_prey = 0;\r
                        for(pl = players.sort_next; pl; pl = pl.sort_next)\r
                        {\r
                                if(pl.team == COLOR_SPECTATOR)\r
@@ -3240,11 +3271,15 @@ void Sbar_Draw (void)
                                                f = pl.plpredator == player_localentnum;\r
                                }\r
 \r
-                               if(f && l <= 8) // limit the stomach board to 9 entries due to the HUD design\r
+                               if(f)\r
                                {\r
-                                       Sbar_PrintStomachboardItem(pos - '-16 124 0', pl);\r
-                                       pos_y += 1.1 * sbar_fontsize_y;\r
-                                       l += 1;\r
+                                       if(l <= 8) // limit the stomach board to 9 entries due to the HUD design\r
+                                       {\r
+                                               Sbar_PrintStomachboardItem(pos - '-16 124 0', pl);\r
+                                               pos_y += 1.1 * sbar_fontsize_y;\r
+                                               l += 1;\r
+                                       }\r
+                                       ++hud_total_prey;\r
                                }\r
 \r
                                // set the predator's name\r