2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 // sbar.c -- status bar code
24 typedef struct sbarpic_s
30 static sbarpic_t sbarpics[256];
31 static int numsbarpics;
33 static sbarpic_t *Sbar_NewPic(const char *name)
35 strcpy(sbarpics[numsbarpics].name, name);
37 // FIXME: precache on every renderer restart (or move this to client)
38 Draw_CachePic(sbarpics[numsbarpics].name, true);
39 return sbarpics + (numsbarpics++);
44 #define STAT_MINUS 10 // num frame for '-' stats digit
45 sbarpic_t *sb_nums[2][11];
46 sbarpic_t *sb_colon, *sb_slash;
49 sbarpic_t *sb_scorebar;
50 // AK only used by NEX
51 sbarpic_t *sb_sbar_minimal;
52 sbarpic_t *sb_sbar_overlay;
54 // AK changed the bound to 9
55 sbarpic_t *sb_weapons[7][9]; // 0 is active, 1 is owned, 2-5 are flashes
56 sbarpic_t *sb_ammo[4];
57 sbarpic_t *sb_sigil[4];
58 sbarpic_t *sb_armor[3];
59 sbarpic_t *sb_items[32];
61 // 0-4 are based on health (in 20 increments)
62 // 0 is static, 1 is temporary animation
63 sbarpic_t *sb_faces[5][2];
65 sbarpic_t *sb_face_invis;
66 sbarpic_t *sb_face_quad;
67 sbarpic_t *sb_face_invuln;
68 sbarpic_t *sb_face_invis_invuln;
70 qboolean sb_showscores;
72 int sb_lines; // scan lines to draw
74 sbarpic_t *rsb_invbar[2];
75 sbarpic_t *rsb_weapons[5];
76 sbarpic_t *rsb_items[2];
77 sbarpic_t *rsb_ammo[3];
78 sbarpic_t *rsb_teambord; // PGM 01/19/97 - team color border
80 //MED 01/04/97 added two more weapons + 3 alternates for grenade launcher
81 sbarpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
82 //MED 01/04/97 added array to simplify weapon parsing
83 int hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT};
84 //MED 01/04/97 added hipnotic items array
85 sbarpic_t *hsb_items[2];
88 sbarpic_t *somsb_health;
89 sbarpic_t *somsb_ammo[4];
90 sbarpic_t *somsb_armor[3];
92 sbarpic_t *zymsb_crosshair_dot;
93 sbarpic_t *zymsb_crosshair_line;
94 sbarpic_t *zymsb_crosshair_health;
95 sbarpic_t *zymsb_crosshair_ammo;
96 sbarpic_t *zymsb_crosshair_clip;
97 sbarpic_t *zymsb_crosshair_background;
99 cvar_t showfps = {CVAR_SAVE, "showfps", "0"};
100 cvar_t showtime = {CVAR_SAVE, "showtime", "0"};
101 cvar_t showtime_format = {CVAR_SAVE, "showtime_format", "%H:%M:%S"};
102 cvar_t showdate = {CVAR_SAVE, "showdate", "0"};
103 cvar_t showdate_format = {CVAR_SAVE, "showdate_format", "%Y-%m-%d"};
104 cvar_t sbar_alpha_bg = {CVAR_SAVE, "sbar_alpha_bg", "0.4"};
105 cvar_t sbar_alpha_fg = {CVAR_SAVE, "sbar_alpha_fg", "1"};
107 cvar_t cl_deathscoreboard = {0, "cl_deathscoreboard", "1"};
109 void Sbar_MiniDeathmatchOverlay (int x, int y);
110 void Sbar_DeathmatchOverlay (void);
111 void Sbar_IntermissionOverlay (void);
112 void Sbar_FinaleOverlay (void);
122 void Sbar_ShowScores (void)
126 sb_showscores = true;
136 void Sbar_DontShowScores (void)
138 sb_showscores = false;
141 void sbar_start(void)
147 if (gamemode == GAME_SOM)
149 sb_disc = Sbar_NewPic("gfx/disc");
151 for (i = 0;i < 10;i++)
152 sb_nums[0][i] = Sbar_NewPic (va("gfx/num_%i",i));
154 somsb_health = Sbar_NewPic("gfx/hud_health");
155 somsb_ammo[0] = Sbar_NewPic("gfx/sb_shells");
156 somsb_ammo[1] = Sbar_NewPic("gfx/sb_nails");
157 somsb_ammo[2] = Sbar_NewPic("gfx/sb_rocket");
158 somsb_ammo[3] = Sbar_NewPic("gfx/sb_cells");
159 somsb_armor[0] = Sbar_NewPic("gfx/sb_armor1");
160 somsb_armor[1] = Sbar_NewPic("gfx/sb_armor2");
161 somsb_armor[2] = Sbar_NewPic("gfx/sb_armor3");
163 else if (gamemode == GAME_NEXUIZ)
165 for (i = 0;i < 10;i++)
166 sb_nums[0][i] = Sbar_NewPic (va("gfx/num_%i",i));
167 sb_nums[0][10] = Sbar_NewPic ("gfx/num_minus");
169 sb_ammo[0] = Sbar_NewPic ("gfx/sb_shells");
170 sb_ammo[1] = Sbar_NewPic ("gfx/sb_bullets");
171 sb_ammo[2] = Sbar_NewPic ("gfx/sb_rocket");
172 sb_ammo[3] = Sbar_NewPic ("gfx/sb_cells");
174 sb_items[2] = Sbar_NewPic ("gfx/sb_slowmo");
175 sb_items[3] = Sbar_NewPic ("gfx/sb_invinc");
176 sb_items[4] = Sbar_NewPic ("gfx/sb_energy");
177 sb_items[5] = Sbar_NewPic ("gfx/sb_str");
179 sb_sbar = Sbar_NewPic("gfx/sbar");
180 sb_sbar_minimal = Sbar_NewPic("gfx/sbar_minimal");
181 sb_sbar_overlay = Sbar_NewPic("gfx/sbar_overlay");
183 for(i = 0; i < 9;i++)
184 sb_weapons[0][i] = Sbar_NewPic(va("gfx/inv_weapon%i",i));
186 else if (gamemode == GAME_ZYMOTIC)
188 zymsb_crosshair_dot = Sbar_NewPic ("gfx/hud/crosshair_dot");
189 zymsb_crosshair_line = Sbar_NewPic ("gfx/hud/crosshair_line");
190 zymsb_crosshair_health = Sbar_NewPic ("gfx/hud/crosshair_health");
191 zymsb_crosshair_clip = Sbar_NewPic ("gfx/hud/crosshair_clip");
192 zymsb_crosshair_ammo = Sbar_NewPic ("gfx/hud/crosshair_ammo");
193 zymsb_crosshair_background = Sbar_NewPic ("gfx/hud/crosshair_background");
197 sb_disc = Sbar_NewPic("gfx/disc");
199 for (i = 0;i < 10;i++)
201 sb_nums[0][i] = Sbar_NewPic (va("gfx/num_%i",i));
202 sb_nums[1][i] = Sbar_NewPic (va("gfx/anum_%i",i));
205 sb_nums[0][10] = Sbar_NewPic ("gfx/num_minus");
206 sb_nums[1][10] = Sbar_NewPic ("gfx/anum_minus");
208 sb_colon = Sbar_NewPic ("gfx/num_colon");
209 sb_slash = Sbar_NewPic ("gfx/num_slash");
211 sb_weapons[0][0] = Sbar_NewPic ("gfx/inv_shotgun");
212 sb_weapons[0][1] = Sbar_NewPic ("gfx/inv_sshotgun");
213 sb_weapons[0][2] = Sbar_NewPic ("gfx/inv_nailgun");
214 sb_weapons[0][3] = Sbar_NewPic ("gfx/inv_snailgun");
215 sb_weapons[0][4] = Sbar_NewPic ("gfx/inv_rlaunch");
216 sb_weapons[0][5] = Sbar_NewPic ("gfx/inv_srlaunch");
217 sb_weapons[0][6] = Sbar_NewPic ("gfx/inv_lightng");
219 sb_weapons[1][0] = Sbar_NewPic ("gfx/inv2_shotgun");
220 sb_weapons[1][1] = Sbar_NewPic ("gfx/inv2_sshotgun");
221 sb_weapons[1][2] = Sbar_NewPic ("gfx/inv2_nailgun");
222 sb_weapons[1][3] = Sbar_NewPic ("gfx/inv2_snailgun");
223 sb_weapons[1][4] = Sbar_NewPic ("gfx/inv2_rlaunch");
224 sb_weapons[1][5] = Sbar_NewPic ("gfx/inv2_srlaunch");
225 sb_weapons[1][6] = Sbar_NewPic ("gfx/inv2_lightng");
227 for (i = 0;i < 5;i++)
229 sb_weapons[2+i][0] = Sbar_NewPic (va("gfx/inva%i_shotgun",i+1));
230 sb_weapons[2+i][1] = Sbar_NewPic (va("gfx/inva%i_sshotgun",i+1));
231 sb_weapons[2+i][2] = Sbar_NewPic (va("gfx/inva%i_nailgun",i+1));
232 sb_weapons[2+i][3] = Sbar_NewPic (va("gfx/inva%i_snailgun",i+1));
233 sb_weapons[2+i][4] = Sbar_NewPic (va("gfx/inva%i_rlaunch",i+1));
234 sb_weapons[2+i][5] = Sbar_NewPic (va("gfx/inva%i_srlaunch",i+1));
235 sb_weapons[2+i][6] = Sbar_NewPic (va("gfx/inva%i_lightng",i+1));
238 sb_ammo[0] = Sbar_NewPic ("gfx/sb_shells");
239 sb_ammo[1] = Sbar_NewPic ("gfx/sb_nails");
240 sb_ammo[2] = Sbar_NewPic ("gfx/sb_rocket");
241 sb_ammo[3] = Sbar_NewPic ("gfx/sb_cells");
243 sb_armor[0] = Sbar_NewPic ("gfx/sb_armor1");
244 sb_armor[1] = Sbar_NewPic ("gfx/sb_armor2");
245 sb_armor[2] = Sbar_NewPic ("gfx/sb_armor3");
247 sb_items[0] = Sbar_NewPic ("gfx/sb_key1");
248 sb_items[1] = Sbar_NewPic ("gfx/sb_key2");
249 sb_items[2] = Sbar_NewPic ("gfx/sb_invis");
250 sb_items[3] = Sbar_NewPic ("gfx/sb_invuln");
251 sb_items[4] = Sbar_NewPic ("gfx/sb_suit");
252 sb_items[5] = Sbar_NewPic ("gfx/sb_quad");
254 sb_sigil[0] = Sbar_NewPic ("gfx/sb_sigil1");
255 sb_sigil[1] = Sbar_NewPic ("gfx/sb_sigil2");
256 sb_sigil[2] = Sbar_NewPic ("gfx/sb_sigil3");
257 sb_sigil[3] = Sbar_NewPic ("gfx/sb_sigil4");
259 sb_faces[4][0] = Sbar_NewPic ("gfx/face1");
260 sb_faces[4][1] = Sbar_NewPic ("gfx/face_p1");
261 sb_faces[3][0] = Sbar_NewPic ("gfx/face2");
262 sb_faces[3][1] = Sbar_NewPic ("gfx/face_p2");
263 sb_faces[2][0] = Sbar_NewPic ("gfx/face3");
264 sb_faces[2][1] = Sbar_NewPic ("gfx/face_p3");
265 sb_faces[1][0] = Sbar_NewPic ("gfx/face4");
266 sb_faces[1][1] = Sbar_NewPic ("gfx/face_p4");
267 sb_faces[0][0] = Sbar_NewPic ("gfx/face5");
268 sb_faces[0][1] = Sbar_NewPic ("gfx/face_p5");
270 sb_face_invis = Sbar_NewPic ("gfx/face_invis");
271 sb_face_invuln = Sbar_NewPic ("gfx/face_invul2");
272 sb_face_invis_invuln = Sbar_NewPic ("gfx/face_inv2");
273 sb_face_quad = Sbar_NewPic ("gfx/face_quad");
275 sb_sbar = Sbar_NewPic ("gfx/sbar");
276 sb_ibar = Sbar_NewPic ("gfx/ibar");
277 sb_scorebar = Sbar_NewPic ("gfx/scorebar");
279 //MED 01/04/97 added new hipnotic weapons
280 if (gamemode == GAME_HIPNOTIC)
282 hsb_weapons[0][0] = Sbar_NewPic ("gfx/inv_laser");
283 hsb_weapons[0][1] = Sbar_NewPic ("gfx/inv_mjolnir");
284 hsb_weapons[0][2] = Sbar_NewPic ("gfx/inv_gren_prox");
285 hsb_weapons[0][3] = Sbar_NewPic ("gfx/inv_prox_gren");
286 hsb_weapons[0][4] = Sbar_NewPic ("gfx/inv_prox");
288 hsb_weapons[1][0] = Sbar_NewPic ("gfx/inv2_laser");
289 hsb_weapons[1][1] = Sbar_NewPic ("gfx/inv2_mjolnir");
290 hsb_weapons[1][2] = Sbar_NewPic ("gfx/inv2_gren_prox");
291 hsb_weapons[1][3] = Sbar_NewPic ("gfx/inv2_prox_gren");
292 hsb_weapons[1][4] = Sbar_NewPic ("gfx/inv2_prox");
294 for (i = 0;i < 5;i++)
296 hsb_weapons[2+i][0] = Sbar_NewPic (va("gfx/inva%i_laser",i+1));
297 hsb_weapons[2+i][1] = Sbar_NewPic (va("gfx/inva%i_mjolnir",i+1));
298 hsb_weapons[2+i][2] = Sbar_NewPic (va("gfx/inva%i_gren_prox",i+1));
299 hsb_weapons[2+i][3] = Sbar_NewPic (va("gfx/inva%i_prox_gren",i+1));
300 hsb_weapons[2+i][4] = Sbar_NewPic (va("gfx/inva%i_prox",i+1));
303 hsb_items[0] = Sbar_NewPic ("gfx/sb_wsuit");
304 hsb_items[1] = Sbar_NewPic ("gfx/sb_eshld");
306 else if (gamemode == GAME_ROGUE)
308 rsb_invbar[0] = Sbar_NewPic ("gfx/r_invbar1");
309 rsb_invbar[1] = Sbar_NewPic ("gfx/r_invbar2");
311 rsb_weapons[0] = Sbar_NewPic ("gfx/r_lava");
312 rsb_weapons[1] = Sbar_NewPic ("gfx/r_superlava");
313 rsb_weapons[2] = Sbar_NewPic ("gfx/r_gren");
314 rsb_weapons[3] = Sbar_NewPic ("gfx/r_multirock");
315 rsb_weapons[4] = Sbar_NewPic ("gfx/r_plasma");
317 rsb_items[0] = Sbar_NewPic ("gfx/r_shield1");
318 rsb_items[1] = Sbar_NewPic ("gfx/r_agrav1");
320 // PGM 01/19/97 - team color border
321 rsb_teambord = Sbar_NewPic ("gfx/r_teambord");
322 // PGM 01/19/97 - team color border
324 rsb_ammo[0] = Sbar_NewPic ("gfx/r_ammolava");
325 rsb_ammo[1] = Sbar_NewPic ("gfx/r_ammomulti");
326 rsb_ammo[2] = Sbar_NewPic ("gfx/r_ammoplasma");
331 void sbar_shutdown(void)
335 void sbar_newmap(void)
339 void Sbar_Init (void)
341 Cmd_AddCommand ("+showscores", Sbar_ShowScores);
342 Cmd_AddCommand ("-showscores", Sbar_DontShowScores);
343 Cvar_RegisterVariable (&showfps);
344 Cvar_RegisterVariable (&showtime);
345 Cvar_RegisterVariable (&showtime_format);
346 Cvar_RegisterVariable (&showdate);
347 Cvar_RegisterVariable (&showdate_format);
348 Cvar_RegisterVariable (&sbar_alpha_bg);
349 Cvar_RegisterVariable (&sbar_alpha_fg);
350 Cvar_RegisterVariable (&cl_deathscoreboard);
352 R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap);
356 //=============================================================================
358 // drawing routines are relative to the status bar location
367 void Sbar_DrawPic (int x, int y, sbarpic_t *sbarpic)
369 DrawQ_Pic (sbar_x + x, sbar_y + y, sbarpic->name, 0, 0, 1, 1, 1, sbar_alpha_fg.value, 0);
372 void Sbar_DrawAlphaPic (int x, int y, sbarpic_t *sbarpic, float alpha)
374 DrawQ_Pic (sbar_x + x, sbar_y + y, sbarpic->name, 0, 0, 1, 1, 1, alpha, 0);
381 Draws one solid graphics character
384 void Sbar_DrawCharacter (int x, int y, int num)
386 DrawQ_String (sbar_x + x + 4 , sbar_y + y, va("%c", num), 0, 8, 8, 1, 1, 1, sbar_alpha_fg.value, 0);
394 void Sbar_DrawString (int x, int y, char *str)
396 DrawQ_String (sbar_x + x, sbar_y + y, str, 0, 8, 8, 1, 1, 1, sbar_alpha_fg.value, 0);
404 void Sbar_DrawNum (int x, int y, int num, int digits, int color)
409 l = sprintf(str, "%i", num);
423 Sbar_DrawPic (x, y, sb_nums[color][frame]);
436 void Sbar_DrawXNum (int x, int y, int num, int digits, int lettersize, float r, float g, float b, float a, int flags)
441 l = sprintf(str, "%i", num);
446 x += (digits-l) * lettersize;
455 DrawQ_Pic (sbar_x + x, sbar_y + y, sb_nums[0][frame]->name,lettersize,lettersize,r,g,b,a * sbar_alpha_fg.value,flags);
462 //=============================================================================
470 static int fragsort[MAX_SCOREBOARD];
471 static int scoreboardlines;
472 void Sbar_SortFrags (void)
478 for (i=0 ; i<cl.maxclients ; i++)
480 if (cl.scores[i].name[0])
482 fragsort[scoreboardlines] = i;
487 for (i=0 ; i<scoreboardlines ; i++)
488 for (j=0 ; j<scoreboardlines-1-i ; j++)
489 if (cl.scores[fragsort[j]].frags < cl.scores[fragsort[j+1]].frags)
492 fragsort[j] = fragsort[j+1];
502 void Sbar_SoloScoreboard (void)
505 int minutes, seconds, tens, units;
508 if (gamemode != GAME_NEXUIZ) {
509 sprintf (str,"Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
510 Sbar_DrawString (8, 4, str);
512 sprintf (str,"Secrets :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
513 Sbar_DrawString (8, 12, str);
517 minutes = cl.time / 60;
518 seconds = cl.time - 60*minutes;
520 units = seconds - 10*tens;
521 sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
522 Sbar_DrawString (184, 4, str);
525 if (gamemode == GAME_NEXUIZ) {
526 l = (int) strlen (cl.worldmodel->name);
527 Sbar_DrawString (232 - l*4, 12, cl.worldmodel->name);
529 l = (int) strlen (cl.levelname);
530 Sbar_DrawString (232 - l*4, 12, cl.levelname);
539 void Sbar_DrawScoreboard (void)
541 Sbar_SoloScoreboard ();
542 if (cl.gametype == GAME_DEATHMATCH)
543 Sbar_DeathmatchOverlay ();
546 //=============================================================================
548 // AK to make DrawInventory smaller
549 static void Sbar_DrawWeapon(int nr, float fade, int active)
551 // width = 300, height = 100
552 const int w_width = 300, w_height = 100, w_space = 10;
553 const float w_scale = 0.4;
555 DrawQ_Pic(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, sb_weapons[0][nr]->name, w_width * w_scale, w_height * w_scale, (active) ? 1 : 0.6, active ? 1 : 0.6, active ? 1 : 1, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
556 //DrawQ_String(vid_conwidth.integer - (w_space + font_size ), (w_height + w_space) * w_scale * nr + w_space, va("%i",nr+1), 0, font_size, font_size, 1, 0, 0, fade, 0);
559 DrawQ_Fill(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, w_width * w_scale, w_height * w_scale, 0.3, 0.3, 0.3, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
567 void Sbar_DrawInventory (void)
574 if (gamemode == GAME_ROGUE)
576 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
577 Sbar_DrawAlphaPic (0, -24, rsb_invbar[0], sbar_alpha_bg.value);
579 Sbar_DrawAlphaPic (0, -24, rsb_invbar[1], sbar_alpha_bg.value);
582 Sbar_DrawAlphaPic (0, -24, sb_ibar, sbar_alpha_bg.value);
585 for (i=0 ; i<7 ; i++)
587 if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN<<i) )
589 time = cl.item_gettime[i];
590 flashon = (int)((cl.time - time)*10);
593 if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i) )
599 flashon = (flashon%5) + 2;
601 Sbar_DrawAlphaPic (i*24, -16, sb_weapons[flashon][i], sbar_alpha_bg.value);
607 if (gamemode == GAME_HIPNOTIC)
609 int grenadeflashing=0;
610 for (i=0 ; i<4 ; i++)
612 if (cl.stats[STAT_ITEMS] & (1<<hipweapons[i]) )
614 time = cl.item_gettime[hipweapons[i]];
615 flashon = (int)((cl.time - time)*10);
618 if ( cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i]) )
624 flashon = (flashon%5) + 2;
626 // check grenade launcher
629 if (cl.stats[STAT_ITEMS] & HIT_PROXIMITY_GUN)
634 Sbar_DrawPic (96, -16, hsb_weapons[flashon][2]);
640 if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN<<4))
642 if (!grenadeflashing)
643 Sbar_DrawPic (96, -16, hsb_weapons[flashon][3]);
646 Sbar_DrawPic (96, -16, hsb_weapons[flashon][4]);
649 Sbar_DrawPic (176 + (i*24), -16, hsb_weapons[flashon][i]);
654 if (gamemode == GAME_ROGUE)
656 // check for powered up weapon.
657 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
659 if (cl.stats[STAT_ACTIVEWEAPON] == (RIT_LAVA_NAILGUN << i))
660 Sbar_DrawPic ((i+2)*24, -16, rsb_weapons[i]);
664 for (i=0 ; i<4 ; i++)
666 sprintf (num, "%3i",cl.stats[STAT_SHELLS+i] );
668 Sbar_DrawCharacter ( (6*i+1)*8 - 2, -24, 18 + num[0] - '0');
670 Sbar_DrawCharacter ( (6*i+2)*8 - 2, -24, 18 + num[1] - '0');
672 Sbar_DrawCharacter ( (6*i+3)*8 - 2, -24, 18 + num[2] - '0');
676 for (i=0 ; i<6 ; i++)
677 if (cl.stats[STAT_ITEMS] & (1<<(17+i)))
679 //MED 01/04/97 changed keys
680 if (gamemode != GAME_HIPNOTIC || (i>1))
681 Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
684 //MED 01/04/97 added hipnotic items
686 if (gamemode == GAME_HIPNOTIC)
688 for (i=0 ; i<2 ; i++)
689 if (cl.stats[STAT_ITEMS] & (1<<(24+i)))
690 Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
693 if (gamemode == GAME_ROGUE)
696 for (i=0 ; i<2 ; i++)
697 if (cl.stats[STAT_ITEMS] & (1<<(29+i)))
698 Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
703 for (i=0 ; i<4 ; i++)
704 if (cl.stats[STAT_ITEMS] & (1<<(28+i)))
705 Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]);
709 //=============================================================================
716 void Sbar_DrawFrags (void)
726 l = min(scoreboardlines, 4);
730 for (i = 0;i < l;i++)
736 c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8];
737 DrawQ_Fill (sbar_x + x + 10, sbar_y - 23, 28, 4, 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);
738 c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8];
739 DrawQ_Fill (sbar_x + x + 10, sbar_y + 4 - 23, 28, 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);
743 sprintf (num, "%3i",f);
745 if (k == cl.viewentity - 1)
747 Sbar_DrawCharacter ( x + 2, -24, 16);
748 Sbar_DrawCharacter ( x + 32 - 4, -24, 17);
750 Sbar_DrawCharacter (x + 8, -24, num[0]);
751 Sbar_DrawCharacter (x + 16, -24, num[1]);
752 Sbar_DrawCharacter (x + 24, -24, num[2]);
757 //=============================================================================
765 void Sbar_DrawFace (void)
769 // PGM 01/19/97 - team color drawing
770 // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
771 if (gamemode == GAME_ROGUE && !cl.islocalgame && (teamplay.integer > 3) && (teamplay.integer < 7))
777 s = &cl.scores[cl.viewentity - 1];
779 Sbar_DrawPic (112, 0, rsb_teambord);
780 c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8];
781 DrawQ_Fill (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+3, 22, 9, 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);
782 c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8];
783 DrawQ_Fill (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+12, 22, 9, 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);
787 sprintf (num, "%3i",f);
789 if ((s->colors & 0xf0)==0)
792 Sbar_DrawCharacter(109, 3, 18 + num[0] - '0');
794 Sbar_DrawCharacter(116, 3, 18 + num[1] - '0');
796 Sbar_DrawCharacter(123, 3, 18 + num[2] - '0');
800 Sbar_DrawCharacter ( 109, 3, num[0]);
801 Sbar_DrawCharacter ( 116, 3, num[1]);
802 Sbar_DrawCharacter ( 123, 3, num[2]);
807 // PGM 01/19/97 - team color drawing
809 if ( (cl.stats[STAT_ITEMS] & (IT_INVISIBILITY | IT_INVULNERABILITY) ) == (IT_INVISIBILITY | IT_INVULNERABILITY) )
810 Sbar_DrawPic (112, 0, sb_face_invis_invuln);
811 else if (cl.stats[STAT_ITEMS] & IT_QUAD)
812 Sbar_DrawPic (112, 0, sb_face_quad );
813 else if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
814 Sbar_DrawPic (112, 0, sb_face_invis );
815 else if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY)
816 Sbar_DrawPic (112, 0, sb_face_invuln);
819 f = cl.stats[STAT_HEALTH] / 20;
821 Sbar_DrawPic (112, 0, sb_faces[f][cl.time <= cl.faceanimtime]);
825 void Sbar_ShowFPS(void)
827 float fps_x, fps_y, fps_scalex, fps_scaley, fps_height;
831 qboolean red = false;
838 if (showfps.integer > 1)
840 static double currtime, frametimes[32];
841 double newtime, total;
843 static int framecycle = 0;
845 newtime = Sys_DoubleTime();
846 frametimes[framecycle] = newtime - currtime;
849 while(total < 0.2 && count < 32 && frametimes[i = (framecycle - count) & 31])
851 total += frametimes[i];
856 if (showfps.integer == 2)
857 calc = (((double)count / total) + 0.5);
858 else // showfps 3, rapid update
859 calc = ((1.0 / (newtime - currtime)) + 0.5);
864 static double nexttime = 0, lasttime = 0;
865 static float framerate = 0;
866 static int framecount = 0;
868 newtime = Sys_DoubleTime();
869 if (newtime >= nexttime)
871 framerate = ((float)framecount / (newtime - lasttime) + 0.5);
873 nexttime = max(nexttime + 1, lasttime - 1);
880 if ((red = (calc < 1.0f)))
881 dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0f / calc + 0.5));
883 dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(calc + 0.5));
885 if (showtime.integer)
886 strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
887 if (showdate.integer)
888 strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring));
889 if (fpsstring[0] || timestring[0])
893 fps_height = fps_scaley * ((fpsstring[0] != 0) + (timestring[0] != 0) + (datestring[0] != 0));
894 //fps_y = vid_conheight.integer - sb_lines; // yes this may draw over the sbar
895 //fps_y = bound(0, fps_y, vid_conheight.integer - fps_height);
896 fps_y = vid_conheight.integer - fps_height;
899 fps_x = vid_conwidth.integer - fps_scalex * strlen(fpsstring);
900 DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(fpsstring), fps_scaley, 0, 0, 0, 0.5, 0);
902 DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 0, 0, 1, 0);
904 DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
909 fps_x = vid_conwidth.integer - fps_scalex * strlen(timestring);
910 DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(timestring), fps_scaley, 0, 0, 0, 0.5, 0);
911 DrawQ_String(fps_x, fps_y, timestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
916 fps_x = vid_conwidth.integer - fps_scalex * strlen(datestring);
917 DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(datestring), fps_scaley, 0, 0, 0, 0.5, 0);
918 DrawQ_String(fps_x, fps_y, datestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
929 extern float v_dmg_time, v_dmg_roll, v_dmg_pitch;
930 extern cvar_t v_kicktime;
931 void Sbar_Draw (void)
933 if (cl.intermission == 1)
935 Sbar_IntermissionOverlay();
938 else if (cl.intermission == 2)
940 Sbar_FinaleOverlay();
944 if (gamemode == GAME_SOM)
946 if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
947 Sbar_DrawScoreboard ();
950 // this is the top left of the sbar area
952 sbar_y = vid_conheight.integer - 24*3;
955 if (cl.stats[STAT_ARMOR])
957 if (cl.stats[STAT_ITEMS] & IT_ARMOR3)
958 Sbar_DrawPic(0, 0, somsb_armor[2]);
959 else if (cl.stats[STAT_ITEMS] & IT_ARMOR2)
960 Sbar_DrawPic(0, 0, somsb_armor[1]);
961 else if (cl.stats[STAT_ITEMS] & IT_ARMOR1)
962 Sbar_DrawPic(0, 0, somsb_armor[0]);
963 Sbar_DrawNum(24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
967 Sbar_DrawPic(0, 24, somsb_health);
968 Sbar_DrawNum(24, 24, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
971 if (cl.stats[STAT_ITEMS] & IT_SHELLS)
972 Sbar_DrawPic(0, 48, somsb_ammo[0]);
973 else if (cl.stats[STAT_ITEMS] & IT_NAILS)
974 Sbar_DrawPic(0, 48, somsb_ammo[1]);
975 else if (cl.stats[STAT_ITEMS] & IT_ROCKETS)
976 Sbar_DrawPic(0, 48, somsb_ammo[2]);
977 else if (cl.stats[STAT_ITEMS] & IT_CELLS)
978 Sbar_DrawPic(0, 48, somsb_ammo[3]);
979 Sbar_DrawNum(24, 48, cl.stats[STAT_AMMO], 3, false);
980 if (cl.stats[STAT_SHELLS])
981 Sbar_DrawNum(24 + 3*24, 48, cl.stats[STAT_SHELLS], 1, true);
984 else if (gamemode == GAME_NEXUIZ)
986 sbar_y = vid_conheight.integer - 47;
987 sbar_x = (vid_conwidth.integer - 640)/2;
989 if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
991 Sbar_DrawAlphaPic (0, 0, sb_scorebar, sbar_alpha_bg.value);
992 Sbar_DrawScoreboard ();
1000 // we have a max time 2s (min time = 0)
1001 if ((time = cl.time - cl.weapontime) < 2)
1003 fade = (1.0 - 0.5 * time);
1005 for (i = 0; i < 8;i++)
1006 if (cl.stats[STAT_ITEMS] & (1 << i))
1007 Sbar_DrawWeapon(i + 1, fade, (i + 2 == cl.stats[STAT_ACTIVEWEAPON]));
1009 if((cl.stats[STAT_ITEMS] & (1<<12)))
1010 Sbar_DrawWeapon(0, fade, (cl.stats[STAT_ACTIVEWEAPON] == 1));
1013 //if (!cl.islocalgame)
1014 // Sbar_DrawFrags ();
1017 Sbar_DrawAlphaPic (0, 0, sb_sbar, sbar_alpha_fg.value);
1019 Sbar_DrawAlphaPic (0, 0, sb_sbar_minimal, sbar_alpha_fg.value);
1022 if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY)
1024 // Nexuiz has no anum pics
1025 //Sbar_DrawNum (36, 0, 666, 3, 1);
1026 // Nexuiz has no disc pic
1027 //Sbar_DrawPic (0, 0, sb_disc);
1031 Sbar_DrawXNum ((340-3*24), 12, cl.stats[STAT_ARMOR], 3, 24, 0.6,0.7,0.8,1,0);
1034 if(cl.stats[STAT_HEALTH] > 100)
1035 Sbar_DrawXNum((154-3*24),12,cl.stats[STAT_HEALTH],3,24,1,1,1,1,0);
1036 else if(cl.stats[STAT_HEALTH] <= 25 && cl.time - (int)cl.time > 0.5)
1037 Sbar_DrawXNum((154-3*24),12,cl.stats[STAT_HEALTH],3,24,0.7,0,0,1,0);
1039 Sbar_DrawXNum((154-3*24),12,cl.stats[STAT_HEALTH],3,24,0.6,0.7,0.8,1,0);
1041 // AK dont draw ammo for the laser
1042 if(cl.stats[STAT_ACTIVEWEAPON] != 12)
1044 if (cl.stats[STAT_ITEMS] & NEX_IT_SHELLS)
1045 Sbar_DrawPic (519, 0, sb_ammo[0]);
1046 else if (cl.stats[STAT_ITEMS] & NEX_IT_BULLETS)
1047 Sbar_DrawPic (519, 0, sb_ammo[1]);
1048 else if (cl.stats[STAT_ITEMS] & NEX_IT_ROCKETS)
1049 Sbar_DrawPic (519, 0, sb_ammo[2]);
1050 else if (cl.stats[STAT_ITEMS] & NEX_IT_CELLS)
1051 Sbar_DrawPic (519, 0, sb_ammo[3]);
1053 if(cl.stats[STAT_AMMO] <= 10)
1054 Sbar_DrawXNum ((519-3*24), 12, cl.stats[STAT_AMMO], 3, 24, 0.7, 0,0,1,0);
1056 Sbar_DrawXNum ((519-3*24), 12, cl.stats[STAT_AMMO], 3, 24, 0.6, 0.7,0.8,1,0);
1061 DrawQ_Pic(sbar_x,sbar_y,sb_sbar_overlay->name,0,0,1,1,1,1,DRAWFLAG_MODULATE);
1064 //if (vid_conwidth.integer > 320 && cl.gametype == GAME_DEATHMATCH)
1065 // Sbar_MiniDeathmatchOverlay (0, 17);
1067 else if (gamemode == GAME_ZYMOTIC)
1069 float scale = 128.0f / 256.0f;
1070 float healthstart, healthheight, healthstarttc, healthendtc;
1071 float shieldstart, shieldheight, shieldstarttc, shieldendtc;
1072 float ammostart, ammoheight, ammostarttc, ammoendtc;
1073 float clipstart, clipheight, clipstarttc, clipendtc;
1074 float kickoffset[3], offset;
1075 VectorClear(kickoffset);
1078 kickoffset[0] = (v_dmg_time/v_kicktime.value*v_dmg_roll) * 10 * scale;
1079 kickoffset[1] = (v_dmg_time/v_kicktime.value*v_dmg_pitch) * 10 * scale;
1081 sbar_x = (vid_conwidth.integer - 256 * scale)/2 + kickoffset[0];
1082 sbar_y = (vid_conheight.integer - 256 * scale)/2 + kickoffset[1];
1083 offset = 0; // TODO: offset should be controlled by recoil (question: how to detect firing?)
1084 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);
1085 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);
1086 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);
1087 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);
1088 healthheight = cl.stats[STAT_HEALTH] * (152.0f / 300.0f);
1089 shieldheight = cl.stats[STAT_ARMOR] * (152.0f / 300.0f);
1090 healthstart = 204 - healthheight;
1091 shieldstart = healthstart - shieldheight;
1092 healthstarttc = healthstart * (1.0f / 256.0f);
1093 healthendtc = (healthstart + healthheight) * (1.0f / 256.0f);
1094 shieldstarttc = shieldstart * (1.0f / 256.0f);
1095 shieldendtc = (shieldstart + shieldheight) * (1.0f / 256.0f);
1096 ammoheight = cl.stats[STAT_SHELLS] * (62.0f / 200.0f);
1097 ammostart = 114 - ammoheight;
1098 ammostarttc = ammostart * (1.0f / 256.0f);
1099 ammoendtc = (ammostart + ammoheight) * (1.0f / 256.0f);
1100 clipheight = cl.stats[STAT_AMMO] * (122.0f / 200.0f);
1101 clipstart = 190 - clipheight;
1102 clipstarttc = clipstart * (1.0f / 256.0f);
1103 clipendtc = (clipstart + clipheight) * (1.0f / 256.0f);
1104 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);
1105 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);
1106 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);
1107 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);
1108 DrawQ_Pic(sbar_x + 0 * scale, sbar_y + 0 * scale, zymsb_crosshair_background->name, 256 * scale, 256 * scale, 1, 1, 1, 1, DRAWFLAG_NORMAL);
1110 else // Quake and others
1112 sbar_y = vid_conheight.integer - SBAR_HEIGHT;
1113 if (cl.gametype == GAME_DEATHMATCH && gamemode != GAME_TRANSFUSION)
1116 sbar_x = (vid_conwidth.integer - 320)/2;
1120 if (gamemode != GAME_GOODVSBAD2)
1121 Sbar_DrawInventory ();
1122 if (!cl.islocalgame && gamemode != GAME_TRANSFUSION)
1126 if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
1128 if (gamemode != GAME_GOODVSBAD2)
1129 Sbar_DrawAlphaPic (0, 0, sb_scorebar, sbar_alpha_bg.value);
1130 Sbar_DrawScoreboard ();
1134 Sbar_DrawAlphaPic (0, 0, sb_sbar, sbar_alpha_bg.value);
1136 // keys (hipnotic only)
1137 //MED 01/04/97 moved keys here so they would not be overwritten
1138 if (gamemode == GAME_HIPNOTIC)
1140 if (cl.stats[STAT_ITEMS] & IT_KEY1)
1141 Sbar_DrawPic (209, 3, sb_items[0]);
1142 if (cl.stats[STAT_ITEMS] & IT_KEY2)
1143 Sbar_DrawPic (209, 12, sb_items[1]);
1146 if (gamemode != GAME_GOODVSBAD2)
1148 if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY)
1150 Sbar_DrawNum (24, 0, 666, 3, 1);
1151 Sbar_DrawPic (0, 0, sb_disc);
1155 if (gamemode == GAME_ROGUE)
1157 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
1158 if (cl.stats[STAT_ITEMS] & RIT_ARMOR3)
1159 Sbar_DrawPic (0, 0, sb_armor[2]);
1160 else if (cl.stats[STAT_ITEMS] & RIT_ARMOR2)
1161 Sbar_DrawPic (0, 0, sb_armor[1]);
1162 else if (cl.stats[STAT_ITEMS] & RIT_ARMOR1)
1163 Sbar_DrawPic (0, 0, sb_armor[0]);
1167 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
1168 if (cl.stats[STAT_ITEMS] & IT_ARMOR3)
1169 Sbar_DrawPic (0, 0, sb_armor[2]);
1170 else if (cl.stats[STAT_ITEMS] & IT_ARMOR2)
1171 Sbar_DrawPic (0, 0, sb_armor[1]);
1172 else if (cl.stats[STAT_ITEMS] & IT_ARMOR1)
1173 Sbar_DrawPic (0, 0, sb_armor[0]);
1182 Sbar_DrawNum (154, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
1185 if (gamemode == GAME_ROGUE)
1187 if (cl.stats[STAT_ITEMS] & RIT_SHELLS)
1188 Sbar_DrawPic (224, 0, sb_ammo[0]);
1189 else if (cl.stats[STAT_ITEMS] & RIT_NAILS)
1190 Sbar_DrawPic (224, 0, sb_ammo[1]);
1191 else if (cl.stats[STAT_ITEMS] & RIT_ROCKETS)
1192 Sbar_DrawPic (224, 0, sb_ammo[2]);
1193 else if (cl.stats[STAT_ITEMS] & RIT_CELLS)
1194 Sbar_DrawPic (224, 0, sb_ammo[3]);
1195 else if (cl.stats[STAT_ITEMS] & RIT_LAVA_NAILS)
1196 Sbar_DrawPic (224, 0, rsb_ammo[0]);
1197 else if (cl.stats[STAT_ITEMS] & RIT_PLASMA_AMMO)
1198 Sbar_DrawPic (224, 0, rsb_ammo[1]);
1199 else if (cl.stats[STAT_ITEMS] & RIT_MULTI_ROCKETS)
1200 Sbar_DrawPic (224, 0, rsb_ammo[2]);
1204 if (cl.stats[STAT_ITEMS] & IT_SHELLS)
1205 Sbar_DrawPic (224, 0, sb_ammo[0]);
1206 else if (cl.stats[STAT_ITEMS] & IT_NAILS)
1207 Sbar_DrawPic (224, 0, sb_ammo[1]);
1208 else if (cl.stats[STAT_ITEMS] & IT_ROCKETS)
1209 Sbar_DrawPic (224, 0, sb_ammo[2]);
1210 else if (cl.stats[STAT_ITEMS] & IT_CELLS)
1211 Sbar_DrawPic (224, 0, sb_ammo[3]);
1214 Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
1218 if (vid_conwidth.integer > 320 && cl.gametype == GAME_DEATHMATCH)
1220 if (gamemode == GAME_TRANSFUSION)
1221 Sbar_MiniDeathmatchOverlay (0, 0);
1223 Sbar_MiniDeathmatchOverlay (324, vid_conheight.integer - sb_lines);
1229 R_Draw2DCrosshair();
1231 if (cl_prydoncursor.integer)
1232 DrawQ_Pic((cl.cmd.cursor_screen[0] + 1) * 0.5 * vid_conwidth.integer, (cl.cmd.cursor_screen[1] + 1) * 0.5 * vid_conheight.integer, va("gfx/prydoncursor%03i", cl_prydoncursor.integer), 0, 0, 1, 1, 1, 1, 0);
1235 //=============================================================================
1239 Sbar_DeathmatchOverlay
1243 float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y)
1246 // draw colors behind score
1247 c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8];
1248 DrawQ_Fill(x + 8, y+1, 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);
1249 c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8];
1250 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);
1252 //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);
1253 // FIXME: use a constant for this color tag instead
1254 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 );
1258 void Sbar_DeathmatchOverlay (void)
1263 pic = Draw_CachePic ("gfx/ranking", true);
1264 DrawQ_Pic ((vid_conwidth.integer - pic->width)/2, 8, "gfx/ranking", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
1269 x = (vid_conwidth.integer - (6 + 15) * 8) / 2;
1271 for (i = 0;i < scoreboardlines && y < vid_conheight.integer;i++)
1272 y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
1277 Sbar_DeathmatchOverlay
1281 void Sbar_MiniDeathmatchOverlay (int x, int y)
1285 // decide where to print
1286 if (gamemode == GAME_TRANSFUSION)
1287 numlines = (vid_conwidth.integer - x + 127) / 128;
1289 numlines = (vid_conheight.integer - y + 7) / 8;
1291 // give up if there isn't room
1292 if (x >= vid_conwidth.integer || y >= vid_conheight.integer || numlines < 1)
1299 for (i = 0; i < scoreboardlines; i++)
1300 if (fragsort[i] == cl.playerentity - 1)
1305 i = min(i, scoreboardlines - numlines);
1308 if (gamemode == GAME_TRANSFUSION)
1310 for (;i < scoreboardlines && x < vid_conwidth.integer;i++)
1311 x += 128 + Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
1315 for (;i < scoreboardlines && y < vid_conheight.integer;i++)
1316 y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
1322 Sbar_IntermissionOverlay
1326 void Sbar_IntermissionOverlay (void)
1331 if (cl.gametype == GAME_DEATHMATCH)
1333 Sbar_DeathmatchOverlay ();
1337 sbar_x = (vid_conwidth.integer - 320) >> 1;
1338 sbar_y = (vid_conheight.integer - 200) >> 1;
1340 DrawQ_Pic (sbar_x + 64, sbar_y + 24, "gfx/complete", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
1341 DrawQ_Pic (sbar_x + 0, sbar_y + 56, "gfx/inter", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
1344 dig = cl.completed_time/60;
1345 Sbar_DrawNum (160, 64, dig, 3, 0);
1346 num = cl.completed_time - dig*60;
1347 if (gamemode != GAME_NEXUIZ)
1348 Sbar_DrawPic (234,64,sb_colon);
1349 Sbar_DrawPic (246,64,sb_nums[0][num/10]);
1350 Sbar_DrawPic (266,64,sb_nums[0][num%10]);
1352 Sbar_DrawNum (160, 104, cl.stats[STAT_SECRETS], 3, 0);
1353 if (gamemode != GAME_NEXUIZ)
1354 Sbar_DrawPic (232, 104, sb_slash);
1355 Sbar_DrawNum (240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
1357 Sbar_DrawNum (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
1358 if (gamemode != GAME_NEXUIZ)
1359 Sbar_DrawPic (232, 144, sb_slash);
1360 Sbar_DrawNum (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
1371 void Sbar_FinaleOverlay (void)
1375 pic = Draw_CachePic ("gfx/finale", true);
1376 DrawQ_Pic((vid_conwidth.integer - pic->width)/2, 16, "gfx/finale", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);