X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sbar.c;h=95fb089d8c98271c1cfa418034d2d009058f4578;hb=174d8329f84ed718f848273e1e730c60b6d93a28;hp=37a70452a3a2b069472e431916ea4ffe18263790;hpb=2965b15fe9f10b90420d1d7185e06eacb203d804;p=xonotic%2Fdarkplaces.git diff --git a/sbar.c b/sbar.c index 37a70452..95fb089d 100644 --- a/sbar.c +++ b/sbar.c @@ -622,6 +622,45 @@ Sbar_SoloScoreboard */ void Sbar_SoloScoreboard (void) { +#if 1 + char str[80], timestr[40]; + int i, max; + int minutes, seconds; + + minutes = (int)(cl.time / 60); + seconds = (int)(cl.time - 60*floor(cl.time/60)); + + // monsters and secrets are now both on the top row + if (gamemode != GAME_NEXUIZ) + Sbar_DrawString(8, 4, va("Monsters:%3i /%3i Secrets :%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS], cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS])); + + // figure out the map's filename without path or extension + strlcpy(str, FS_FileWithoutPath(cl.worldmodel ? cl.worldmodel->name : ""), sizeof(str)); + if (strrchr(str, '.')) + *(strrchr(str, '.')) = 0; + + // append a : separator and then the full title + strlcat(str, ":", sizeof(str)); + strlcat(str, cl.levelname, sizeof(str)); + + // make the time string + max = 38 - sprintf(timestr, " %i:%02i", minutes, seconds); + + // if there's a newline character, terminate the string there + if (strchr(str, '\n')) + *(strchr(str, '\n')) = 0; + + // pad with spaces to fill the allotted space and append the time + i = bound(0, (int)strlen(str), max); + while (i < max) + str[i++] = ' '; + str[i] = 0; + strlcat(str, timestr, sizeof(str)); + + // print the line of text + Sbar_DrawString(8, 12, str); + +#else char str[80]; int minutes, seconds, tens, units; int l; @@ -650,6 +689,7 @@ void Sbar_SoloScoreboard (void) l = (int) strlen (cl.levelname); Sbar_DrawString (232 - l*4, 12, cl.levelname); } +#endif } /* @@ -710,7 +750,7 @@ void Sbar_DrawInventory (void) if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN<= 10) { if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<= 10) { @@ -1119,9 +1159,10 @@ void Sbar_Draw (void) int i; double time; float fade; + int redflag, blueflag; // we have a max time 2s (min time = 0) - if ((time = cl.time - cl.weapontime) < 2) + if ((time = max(0, cl.time - cl.weapontime)) < 2) { fade = (1.0 - 0.5 * time); fade *= fade; @@ -1142,10 +1183,10 @@ void Sbar_Draw (void) Sbar_DrawAlphaPic (0, 0, sb_sbar_minimal, sbar_alpha_fg.value); // flag icons - int redflag = ((cl.stats[STAT_ITEMS]>>15) & 3); + redflag = ((cl.stats[STAT_ITEMS]>>15) & 3); if (redflag) Sbar_DrawPic (10, -85, sb_items[redflag+10]); - int blueflag = ((cl.stats[STAT_ITEMS]>>17) & 3); + blueflag = ((cl.stats[STAT_ITEMS]>>17) & 3); if (blueflag) Sbar_DrawPic (10, -145, sb_items[blueflag+14]); @@ -1324,7 +1365,7 @@ void Sbar_Draw (void) Sbar_DrawFace (); // health - Sbar_DrawNum (154, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25); + Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25); // ammo icon if (gamemode == GAME_ROGUE) @@ -1399,9 +1440,9 @@ float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y) if (s->qw_spectator) { if (s->qw_ping || s->qw_packetloss) - DrawQ_ColoredString(x, y, va("%4i %3i %4i spectator %c%s", bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes, cl.qw_teamplay ? s->qw_team : "", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL ); + DrawQ_ColoredString(x, y, va("%4i %3i %4i spectator %c%s", bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes, (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL ); else - DrawQ_ColoredString(x, y, va(" %4i spectator %c%s", minutes, cl.qw_teamplay ? s->qw_team : "", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL ); + DrawQ_ColoredString(x, y, va(" %4i spectator %c%s", minutes, (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL ); } else { @@ -1461,9 +1502,20 @@ void Sbar_DeathmatchOverlay (void) else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4 || cls.protocol == PROTOCOL_DARKPLACES5 || cls.protocol == PROTOCOL_DARKPLACES6 || cls.protocol == PROTOCOL_DARKPLACES7) { // these servers usually lack the pings command and so a less efficient "ping" command must be sent, which on modern DP servers will also reply with a pingplreport command after the ping listing - cl.parsingtextexpectingpingforscores = true; // hide the output of the next ping report - MSG_WriteByte(&cls.netcon->message, clc_stringcmd); - MSG_WriteString(&cls.netcon->message, "ping"); + static int ping_anyway_counter = 0; + if(cl.parsingtextexpectingpingforscores == 1) + { + Con_DPrintf("want to send ping, but still waiting for other reply\n"); + if(++ping_anyway_counter >= 5) + cl.parsingtextexpectingpingforscores = 0; + } + if(cl.parsingtextexpectingpingforscores != 1) + { + ping_anyway_counter = 0; + cl.parsingtextexpectingpingforscores = 1; // hide the output of the next ping report + MSG_WriteByte(&cls.netcon->message, clc_stringcmd); + MSG_WriteString(&cls.netcon->message, "ping"); + } } else {