cachepic_t *zymsb_crosshair_left2;
cachepic_t *zymsb_crosshair_right;
+cachepic_t *sb_ranking;
+cachepic_t *sb_complete;
+cachepic_t *sb_inter;
+cachepic_t *sb_finale;
+
cvar_t showfps = {CVAR_SAVE, "showfps", "0", "shows your rendered fps (frames per second)"};
cvar_t showtime = {CVAR_SAVE, "showtime", "0", "shows current time of day (useful on screenshots)"};
cvar_t showtime_format = {CVAR_SAVE, "showtime_format", "%H:%M:%S", "format string for time of day"};
rsb_ammo[2] = Draw_CachePic ("gfx/r_ammoplasma", true);
}
}
+
+ sb_ranking = Draw_CachePic ("gfx/ranking", true);
+ sb_complete = Draw_CachePic ("gfx/complete", true);
+ sb_inter = Draw_CachePic ("gfx/inter", true);
+ sb_finale = Draw_CachePic ("gfx/finale", true);
}
void sbar_shutdown(void)
if (showfps.integer)
{
float calc;
- if (showfps.integer > 1)
+ static double nexttime = 0, lasttime = 0;
+ static double framerate = 0;
+ static int framecount = 0;
+ double newtime;
+ newtime = Sys_DoubleTime();
+ if (newtime >= nexttime)
{
- static double currtime, frametimes[32];
- double newtime, total;
- int count, i;
- static int framecycle = 0;
-
- newtime = Sys_DoubleTime();
- frametimes[framecycle] = newtime - currtime;
- total = 0;
- count = 0;
- while(total < 0.2 && count < 32 && frametimes[i = (framecycle - count) & 31])
- {
- total += frametimes[i];
- count++;
- }
- framecycle++;
- framecycle &= 31;
- if (showfps.integer == 2)
- calc = (((double)count / total) + 0.5);
- else // showfps 3, rapid update
- calc = ((1.0 / (newtime - currtime)) + 0.5);
- currtime = newtime;
- }
- else
- {
- static double nexttime = 0, lasttime = 0;
- static float framerate = 0;
- static int framecount = 0;
- double newtime;
- newtime = Sys_DoubleTime();
- if (newtime >= nexttime)
- {
- framerate = ((float)framecount / (newtime - lasttime) + 0.5);
- lasttime = newtime;
- nexttime = max(nexttime + 1, lasttime - 1);
- framecount = 0;
- }
- framecount++;
- calc = framerate;
+ framerate = framecount / (newtime - lasttime);
+ lasttime = newtime;
+ nexttime = max(nexttime + 1, lasttime - 1);
+ framecount = 0;
}
+ framecount++;
+ calc = framerate;
if ((red = (calc < 1.0f)))
dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0f / calc + 0.5));
if (cls.protocol == PROTOCOL_QUAKEWORLD)
{
minutes = (int)((cl.intermission ? cl.completed_time - s->qw_entertime : realtime - s->qw_entertime) / 60.0);
- // draw colors behind score
- c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
- DrawQ_Pic(x + 14*8, y+1, NULL, 32, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
- c = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8];
- DrawQ_Pic(x + 14*8, y+4, NULL, 32, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
- // print the text
- //DrawQ_String(x, y, va("%c%4i %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
- DrawQ_ColoredString(x, y, va("%c%4i %2i %4i %4i %-4s %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes,(int) s->frags, cl.qw_teamplay ? s->qw_team : "", s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
+ if (s->qw_spectator)
+ DrawQ_ColoredString(x, y, va("%c%4i %2i %4i spec %-4s %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes, cl.qw_teamplay ? s->qw_team : "", s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
+ else
+ {
+ // draw colors behind score
+ c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
+ DrawQ_Pic(x + 14*8, y+1, NULL, 32, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
+ c = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8];
+ DrawQ_Pic(x + 14*8, y+4, NULL, 32, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
+ // print the text
+ //DrawQ_String(x, y, va("%c%4i %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+ DrawQ_ColoredString(x, y, va("%c%4i %2i %4i %4i %-4s %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes,(int) s->frags, cl.qw_teamplay ? s->qw_team : "", s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
+ }
}
else
{
void Sbar_DeathmatchOverlay (void)
{
int i, x, y;
- cachepic_t *pic;
// request new ping times every two second
if (cl.last_ping_request < realtime - 2)
{
cl.last_ping_request = realtime;
- if (cls.protocol == PROTOCOL_QUAKEWORLD)
+ if (cls.protocol == PROTOCOL_QUAKEWORLD && cls.netcon)
{
MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd);
MSG_WriteString(&cls.netcon->message, "pings");
}
}
- pic = Draw_CachePic ("gfx/ranking", true);
- DrawQ_Pic ((vid_conwidth.integer - pic->width)/2, 8, pic, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+ DrawQ_Pic ((vid_conwidth.integer - sb_ranking->width)/2, 8, sb_ranking, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
// scores
Sbar_SortFrags ();
sbar_x = (vid_conwidth.integer - 320) >> 1;
sbar_y = (vid_conheight.integer - 200) >> 1;
- DrawQ_Pic (sbar_x + 64, sbar_y + 24, Draw_CachePic("gfx/complete", true), 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
- DrawQ_Pic (sbar_x + 0, sbar_y + 56, Draw_CachePic("gfx/inter", true), 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+ DrawQ_Pic (sbar_x + 64, sbar_y + 24, sb_complete, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+ DrawQ_Pic (sbar_x + 0, sbar_y + 56, sb_inter, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
// time
dig = (int)cl.completed_time / 60;
*/
void Sbar_FinaleOverlay (void)
{
- cachepic_t *pic;
-
- pic = Draw_CachePic ("gfx/finale", true);
- DrawQ_Pic((vid_conwidth.integer - pic->width)/2, 16, pic, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+ DrawQ_Pic((vid_conwidth.integer - sb_finale->width)/2, 16, sb_finale, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
}