#include "quakedef.h"
-typedef struct
+typedef struct sbarpic_s
{
char name[32];
}
sbarpic_t *somsb_ammo[4];
sbarpic_t *somsb_armor[3];
+sbarpic_t *zymsb_crosshair_dot;
+sbarpic_t *zymsb_crosshair_line;
+sbarpic_t *zymsb_crosshair_health;
+sbarpic_t *zymsb_crosshair_ammo;
+sbarpic_t *zymsb_crosshair_clip;
+sbarpic_t *zymsb_crosshair_background;
+
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 sbar_alpha_bg = {CVAR_SAVE, "sbar_alpha_bg", "0.4"};
cvar_t sbar_alpha_fg = {CVAR_SAVE, "sbar_alpha_fg", "1"};
+cvar_t cl_deathscoreboard = {0, "cl_deathscoreboard", "1"};
+
void Sbar_MiniDeathmatchOverlay (int x, int y);
void Sbar_DeathmatchOverlay (void);
void Sbar_IntermissionOverlay (void);
for(i = 0; i < 9;i++)
sb_weapons[0][i] = Sbar_NewPic(va("gfx/inv_weapon%i",i));
}
+ else if (gamemode == GAME_ZYMOTIC)
+ {
+ zymsb_crosshair_dot = Sbar_NewPic ("gfx/hud/crosshair_dot");
+ zymsb_crosshair_line = Sbar_NewPic ("gfx/hud/crosshair_line");
+ zymsb_crosshair_health = Sbar_NewPic ("gfx/hud/crosshair_health");
+ zymsb_crosshair_clip = Sbar_NewPic ("gfx/hud/crosshair_clip");
+ zymsb_crosshair_ammo = Sbar_NewPic ("gfx/hud/crosshair_ammo");
+ zymsb_crosshair_background = Sbar_NewPic ("gfx/hud/crosshair_background");
+ }
else
{
sb_disc = Sbar_NewPic("gfx/disc");
Cvar_RegisterVariable (&showdate_format);
Cvar_RegisterVariable (&sbar_alpha_bg);
Cvar_RegisterVariable (&sbar_alpha_fg);
+ Cvar_RegisterVariable (&cl_deathscoreboard);
R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap);
}
// draw level name
if (gamemode == GAME_NEXUIZ) {
- l = strlen (cl.worldmodel->name);
+ l = (int) strlen (cl.worldmodel->name);
Sbar_DrawString (232 - l*4, 12, cl.worldmodel->name);
} else {
- l = strlen (cl.levelname);
+ l = (int) strlen (cl.levelname);
Sbar_DrawString (232 - l*4, 12, cl.levelname);
}
}
f = s->frags;
sprintf (num, "%3i",f);
- Sbar_DrawCharacter (x + 8, -24, num[0]);
- Sbar_DrawCharacter (x + 16, -24, num[1]);
- Sbar_DrawCharacter (x + 24, -24, num[2]);
-
if (k == cl.viewentity - 1)
{
Sbar_DrawCharacter ( x + 2, -24, 16);
Sbar_DrawCharacter ( x + 32 - 4, -24, 17);
}
+ Sbar_DrawCharacter (x + 8, -24, num[0]);
+ Sbar_DrawCharacter (x + 16, -24, num[1]);
+ Sbar_DrawCharacter (x + 24, -24, num[2]);
x += 32;
}
}
char fpsstring[32];
char timestring[32];
char datestring[32];
+ qboolean red = false;
fpsstring[0] = 0;
timestring[0] = 0;
datestring[0] = 0;
if (showfps.integer)
{
- int calc;
+ float calc;
if (showfps.integer > 1)
{
static double currtime, frametimes[32];
framecycle++;
framecycle &= 31;
if (showfps.integer == 2)
- calc = (int) (((double) count / total) + 0.5);
+ calc = (((double)count / total) + 0.5);
else // showfps 3, rapid update
- calc = (int) ((1.0 / (newtime - currtime)) + 0.5);
+ calc = ((1.0 / (newtime - currtime)) + 0.5);
currtime = newtime;
}
else
{
static double nexttime = 0, lasttime = 0;
- static int framerate = 0, framecount = 0;
+ static float framerate = 0;
+ static int framecount = 0;
double newtime;
newtime = Sys_DoubleTime();
if (newtime >= nexttime)
{
- framerate = (int) (framecount / (newtime - lasttime) + 0.5);
+ framerate = ((float)framecount / (newtime - lasttime) + 0.5);
lasttime = newtime;
nexttime = max(nexttime + 1, lasttime - 1);
framecount = 0;
framecount++;
calc = framerate;
}
- dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", calc);
+
+ if ((red = (calc < 1.0f)))
+ dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0f / calc + 0.5));
+ else
+ dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(calc + 0.5));
}
if (showtime.integer)
strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
{
fps_x = vid_conwidth.integer - fps_scalex * strlen(fpsstring);
DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(fpsstring), fps_scaley, 0, 0, 0, 0.5, 0);
- DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
+ if (red)
+ DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 0, 0, 1, 0);
+ else
+ DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
fps_y += fps_scaley;
}
if (timestring[0])
Sbar_Draw
===============
*/
+extern float v_dmg_time, v_dmg_roll, v_dmg_pitch;
+extern cvar_t v_kicktime;
void Sbar_Draw (void)
{
if (cl.intermission == 1)
if (gamemode == GAME_SOM)
{
- if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
+ if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
Sbar_DrawScoreboard ();
else if (sb_lines)
{
sbar_y = vid_conheight.integer - 47;
sbar_x = (vid_conwidth.integer - 640)/2;
- if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
+ if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
{
Sbar_DrawAlphaPic (0, 0, sb_scorebar, sbar_alpha_bg.value);
Sbar_DrawScoreboard ();
//if (vid_conwidth.integer > 320 && cl.gametype == GAME_DEATHMATCH)
// Sbar_MiniDeathmatchOverlay (0, 17);
}
+ else if (gamemode == GAME_ZYMOTIC)
+ {
+ float scale = 128.0f / 256.0f;
+ float healthstart, healthheight, healthstarttc, healthendtc;
+ float shieldstart, shieldheight, shieldstarttc, shieldendtc;
+ float ammostart, ammoheight, ammostarttc, ammoendtc;
+ float clipstart, clipheight, clipstarttc, clipendtc;
+ float kickoffset[3], offset;
+ VectorClear(kickoffset);
+ if (v_dmg_time > 0)
+ {
+ kickoffset[0] = (v_dmg_time/v_kicktime.value*v_dmg_roll) * 10 * scale;
+ kickoffset[1] = (v_dmg_time/v_kicktime.value*v_dmg_pitch) * 10 * scale;
+ }
+ sbar_x = (vid_conwidth.integer - 256 * scale)/2 + kickoffset[0];
+ sbar_y = (vid_conheight.integer - 256 * scale)/2 + kickoffset[1];
+ offset = 0; // TODO: offset should be controlled by recoil (question: how to detect firing?)
+ DrawQ_SuperPic(sbar_x + 120 * scale, sbar_y + ( 88 - offset) * scale, zymsb_crosshair_line->name, 16 * scale, 36 * scale, 0,0, 1,1,1,1, 1,0, 1,1,1,1, 0,1, 1,1,1,1, 1,1, 1,1,1,1, 0);
+ DrawQ_SuperPic(sbar_x + (132 + offset) * scale, sbar_y + 120 * scale, zymsb_crosshair_line->name, 36 * scale, 16 * scale, 0,1, 1,1,1,1, 0,0, 1,1,1,1, 1,1, 1,1,1,1, 1,0, 1,1,1,1, 0);
+ DrawQ_SuperPic(sbar_x + 120 * scale, sbar_y + (132 + offset) * scale, zymsb_crosshair_line->name, 16 * scale, 36 * scale, 1,1, 1,1,1,1, 0,1, 1,1,1,1, 1,0, 1,1,1,1, 0,0, 1,1,1,1, 0);
+ DrawQ_SuperPic(sbar_x + ( 88 - offset) * scale, sbar_y + 120 * scale, zymsb_crosshair_line->name, 36 * scale, 16 * scale, 1,0, 1,1,1,1, 1,1, 1,1,1,1, 0,0, 1,1,1,1, 0,1, 1,1,1,1, 0);
+ healthheight = cl.stats[STAT_HEALTH] * (152.0f / 300.0f);
+ shieldheight = cl.stats[STAT_ARMOR] * (152.0f / 300.0f);
+ healthstart = 204 - healthheight;
+ shieldstart = healthstart - shieldheight;
+ healthstarttc = healthstart * (1.0f / 256.0f);
+ healthendtc = (healthstart + healthheight) * (1.0f / 256.0f);
+ shieldstarttc = shieldstart * (1.0f / 256.0f);
+ shieldendtc = (shieldstart + shieldheight) * (1.0f / 256.0f);
+ ammoheight = cl.stats[STAT_SHELLS] * (62.0f / 200.0f);
+ ammostart = 114 - ammoheight;
+ ammostarttc = ammostart * (1.0f / 256.0f);
+ ammoendtc = (ammostart + ammoheight) * (1.0f / 256.0f);
+ clipheight = cl.stats[STAT_AMMO] * (122.0f / 200.0f);
+ clipstart = 190 - clipheight;
+ clipstarttc = clipstart * (1.0f / 256.0f);
+ clipendtc = (clipstart + clipheight) * (1.0f / 256.0f);
+ if (healthheight > 0) DrawQ_SuperPic(sbar_x + 0 * scale, sbar_y + healthstart * scale, zymsb_crosshair_health->name, 256 * scale, healthheight * scale, 0,healthstarttc, 1.0f,0.0f,0.0f,1.0f, 1,healthstarttc, 1.0f,0.0f,0.0f,1.0f, 0,healthendtc, 1.0f,0.0f,0.0f,1.0f, 1,healthendtc, 1.0f,0.0f,0.0f,1.0f, DRAWFLAG_NORMAL);
+ if (shieldheight > 0) DrawQ_SuperPic(sbar_x + 0 * scale, sbar_y + shieldstart * scale, zymsb_crosshair_health->name, 256 * scale, shieldheight * scale, 0,shieldstarttc, 0.0f,0.5f,1.0f,1.0f, 1,shieldstarttc, 0.0f,0.5f,1.0f,1.0f, 0,shieldendtc, 0.0f,0.5f,1.0f,1.0f, 1,shieldendtc, 0.0f,0.5f,1.0f,1.0f, DRAWFLAG_NORMAL);
+ if (ammoheight > 0) DrawQ_SuperPic(sbar_x + 0 * scale, sbar_y + ammostart * scale, zymsb_crosshair_ammo->name, 256 * scale, ammoheight * scale, 0,ammostarttc, 0.8f,0.8f,0.0f,1.0f, 1,ammostarttc, 0.8f,0.8f,0.0f,1.0f, 0,ammoendtc, 0.8f,0.8f,0.0f,1.0f, 1,ammoendtc, 0.8f,0.8f,0.0f,1.0f, DRAWFLAG_NORMAL);
+ if (clipheight > 0) DrawQ_SuperPic(sbar_x + 0 * scale, sbar_y + clipstart * scale, zymsb_crosshair_clip->name, 256 * scale, clipheight * scale, 0,clipstarttc, 1.0f,1.0f,0.0f,1.0f, 1,clipstarttc, 1.0f,1.0f,0.0f,1.0f, 0,clipendtc, 1.0f,1.0f,0.0f,1.0f, 1,clipendtc, 1.0f,1.0f,0.0f,1.0f, DRAWFLAG_NORMAL);
+ DrawQ_Pic(sbar_x + 0 * scale, sbar_y + 0 * scale, zymsb_crosshair_background->name, 256 * scale, 256 * scale, 1, 1, 1, 1, DRAWFLAG_NORMAL);
+ }
else // Quake and others
{
sbar_y = vid_conheight.integer - SBAR_HEIGHT;
Sbar_DrawFrags ();
}
- if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
+ if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
{
if (gamemode != GAME_GOODVSBAD2)
Sbar_DrawAlphaPic (0, 0, sb_scorebar, sbar_alpha_bg.value);
c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8];
DrawQ_Fill(x + 8, y+4, 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_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);
+ // FIXME: use a constant for this color tag instead
+ DrawQ_ColoredString(x, y, va("%c%4i %s" STRING_COLOR_DEFAULT_STR, (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
return 8;
}