sbarpic_t *sb_ibar;
sbarpic_t *sb_sbar;
sbarpic_t *sb_scorebar;
-// AK only used by NEX(and only if everybody agrees)
+// AK only used by NEX
+sbarpic_t *sb_sbar_minimal;
sbarpic_t *sb_sbar_overlay;
// AK changed the bound to 9
sbarpic_t *somsb_armor[3];
cvar_t showfps = {CVAR_SAVE, "showfps", "0"};
+cvar_t showtime = {CVAR_SAVE, "showtime", "0"};
+cvar_t showtime_format = {CVAR_SAVE, "showtime_format", "%H:%M:%S"};
+cvar_t showdate = {CVAR_SAVE, "showdate", "0"};
+cvar_t showdate_format = {CVAR_SAVE, "showdate_format", "%Y-%m-%d"};
cvar_t sbar_alpha = {CVAR_SAVE, "sbar_alpha", "1"};
void Sbar_MiniDeathmatchOverlay (int x, int y);
sb_items[5] = Sbar_NewPic ("gfx/sb_str");
sb_sbar = Sbar_NewPic("gfx/sbar");
+ sb_sbar_minimal = Sbar_NewPic("gfx/sbar_minimal");
sb_sbar_overlay = Sbar_NewPic("gfx/sbar_overlay");
for(i = 0; i < 9;i++)
Cmd_AddCommand ("+showscores", Sbar_ShowScores);
Cmd_AddCommand ("-showscores", Sbar_DontShowScores);
Cvar_RegisterVariable (&showfps);
+ Cvar_RegisterVariable (&showtime);
+ Cvar_RegisterVariable (&showtime_format);
+ Cvar_RegisterVariable (&showdate);
+ Cvar_RegisterVariable (&showdate_format);
Cvar_RegisterVariable (&sbar_alpha);
R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap);
void Sbar_ShowFPS(void)
{
+ float fps_x, fps_y, fps_scalex, fps_scaley, fps_height;
+ char fpsstring[32];
+ char timestring[32];
+ char datestring[32];
+ fpsstring[0] = 0;
+ timestring[0] = 0;
+ datestring[0] = 0;
if (showfps.integer)
{
int calc;
- char temp[32];
- float fps_x, fps_y, fps_scalex, fps_scaley;
if (showfps.integer > 1)
{
static double currtime, frametimes[32];
}
calc = framerate;
}
- sprintf(temp, "%4i", calc);
+ snprintf(fpsstring, sizeof(fpsstring), "%4i fps", calc);
+ }
+ if (showtime.integer)
+ strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
+ if (showdate.integer)
+ strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring));
+ if (fpsstring[0] || timestring[0])
+ {
fps_scalex = 12;
fps_scaley = 12;
- fps_x = vid.conwidth - (fps_scalex * strlen(temp));
- fps_y = vid.conheight - sb_lines/* - 8*/; // yes this might draw over the sbar
- if (fps_y > vid.conheight - fps_scaley)
- fps_y = vid.conheight - fps_scaley;
- DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(temp), fps_scaley, 0, 0, 0, 0.5 * sbar_alpha.value, 0);
- DrawQ_String(fps_x, fps_y, temp, 0, fps_scalex, fps_scaley, 1, 1, 1, 1 * sbar_alpha.value, 0);
+ fps_height = fps_scaley * ((fpsstring[0] != 0) + (timestring[0] != 0) + (datestring[0] != 0));
+ //fps_y = vid.conheight - sb_lines; // yes this may draw over the sbar
+ //fps_y = bound(0, fps_y, vid.conheight - fps_height);
+ fps_y = vid.conheight - fps_height;
+ if (fpsstring[0])
+ {
+ fps_x = vid.conwidth - fps_scalex * strlen(fpsstring);
+ DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(fpsstring), fps_scaley, 0, 0, 0, 0.5 * sbar_alpha.value, 0);
+ DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1 * sbar_alpha.value, 0);
+ fps_y += fps_scaley;
+ }
+ if (timestring[0])
+ {
+ fps_x = vid.conwidth - fps_scalex * strlen(timestring);
+ DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(timestring), fps_scaley, 0, 0, 0, 0.5 * sbar_alpha.value, 0);
+ DrawQ_String(fps_x, fps_y, timestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1 * sbar_alpha.value, 0);
+ fps_y += fps_scaley;
+ }
+ if (datestring[0])
+ {
+ fps_x = vid.conwidth - fps_scalex * strlen(datestring);
+ DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(datestring), fps_scaley, 0, 0, 0, 0.5 * sbar_alpha.value, 0);
+ DrawQ_String(fps_x, fps_y, datestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1 * sbar_alpha.value, 0);
+ fps_y += fps_scaley;
+ }
}
}
sbar_y = vid.conheight - 47;
sbar_x = (vid.conwidth - 640)/2;
- if (sb_lines)
+ if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
+ {
+ Sbar_DrawAlphaPic (0, 0, sb_scorebar, 0.4);
+ Sbar_DrawScoreboard ();
+ }
+ else if (sb_lines)
{
int i;
double time;
float fade;
+
// we have a max time 2s (min time = 0)
if ((time = cl.time - cl.weapontime) < 2)
{
if((cl.items & (1<<12)))
Sbar_DrawWeapon(0, fade, (cl.stats[STAT_ACTIVEWEAPON] == 12));
}
- if (!cl.islocalgame)
- Sbar_DrawFrags ();
- }
- if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
- {
- Sbar_DrawAlphaPic (0, 0, sb_scorebar, 0.4);
- Sbar_DrawScoreboard ();
- }
- else if (sb_lines)
- {
- Sbar_DrawPic (0, 0, sb_sbar);
+ //if (!cl.islocalgame)
+ // Sbar_DrawFrags ();
+
+ if (sb_lines > 24)
+ Sbar_DrawAlphaPic (0, 0, sb_sbar, sbar_alpha.value);
+ else
+ Sbar_DrawAlphaPic (0, 0, sb_sbar_minimal, sbar_alpha.value);
// special items
if (cl.items & IT_INVULNERABILITY)
}
- DrawQ_Pic(sbar_x,sbar_y,sb_sbar_overlay->name,0,0,1,1,1,1,DRAWFLAG_MODULATE);
+ if (sb_lines > 24)
+ DrawQ_Pic(sbar_x,sbar_y,sb_sbar_overlay->name,0,0,1,1,1,1,DRAWFLAG_MODULATE);
}
- if (vid.conwidth > 320 && cl.gametype == GAME_DEATHMATCH)
- Sbar_MiniDeathmatchOverlay (0, 0);
+ //if (vid.conwidth > 320 && cl.gametype == GAME_DEATHMATCH)
+ // Sbar_MiniDeathmatchOverlay (0, 17);
}
else // Quake and others
{
sbar_y = vid.conheight - SBAR_HEIGHT;
- if (cl.gametype == GAME_DEATHMATCH)
+ if (cl.gametype == GAME_DEATHMATCH && gamemode != GAME_TRANSFUSION)
sbar_x = 0;
else
sbar_x = (vid.conwidth - 320)/2;
{
if (gamemode != GAME_GOODVSBAD2)
Sbar_DrawInventory ();
- if (!cl.islocalgame)
+ if (!cl.islocalgame && gamemode != GAME_TRANSFUSION)
Sbar_DrawFrags ();
}
}
if (vid.conwidth > 320 && cl.gametype == GAME_DEATHMATCH)
- Sbar_MiniDeathmatchOverlay (324, vid.conheight - sb_lines);
+ {
+ if (gamemode == GAME_TRANSFUSION)
+ Sbar_MiniDeathmatchOverlay (0, 0);
+ else
+ Sbar_MiniDeathmatchOverlay (324, vid.conheight - sb_lines);
+ }
}
Sbar_ShowFPS();
i = bound(0, i, scoreboardlines - numlines);
}
- for (;i < scoreboardlines && y < vid.conheight;i++)
- y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+ if (gamemode == GAME_TRANSFUSION)
+ {
+ for (;i < scoreboardlines && x < vid.conwidth;i++)
+ x += 128 + Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+ }
+ else
+ {
+ for (;i < scoreboardlines && y < vid.conheight;i++)
+ y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+ }
}
/*