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
31 static sbarpic_t sbarpics[256];
32 static int numsbarpics;
34 static sbarpic_t *Sbar_NewPic(char *name)
36 strcpy(sbarpics[numsbarpics].name, name);
37 sbarpics[numsbarpics].qpic = NULL;
38 return sbarpics + (numsbarpics++);
41 static qpic_t *Sbar_GetQPic(sbarpic_t *p)
44 p->qpic = Draw_CachePic(p->name);
48 static void Sbar_ClearPics(void)
51 for (i = 0;i < numsbarpics;i++)
52 sbarpics[i].qpic = NULL;
57 #define STAT_MINUS 10 // num frame for '-' stats digit
58 sbarpic_t *sb_nums[2][11];
59 sbarpic_t *sb_colon, *sb_slash;
62 sbarpic_t *sb_scorebar;
64 sbarpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
65 sbarpic_t *sb_ammo[4];
66 sbarpic_t *sb_sigil[4];
67 sbarpic_t *sb_armor[3];
68 sbarpic_t *sb_items[32];
70 // 0 is gibbed, 1 is dead, 2-6 are alive
71 // 0 is static, 1 is temporary animation
72 sbarpic_t *sb_faces[7][2];
74 sbarpic_t *sb_face_invis;
75 sbarpic_t *sb_face_quad;
76 sbarpic_t *sb_face_invuln;
77 sbarpic_t *sb_face_invis_invuln;
79 qboolean sb_showscores;
81 int sb_lines; // scan lines to draw
83 sbarpic_t *rsb_invbar[2];
84 sbarpic_t *rsb_weapons[5];
85 sbarpic_t *rsb_items[2];
86 sbarpic_t *rsb_ammo[3];
87 sbarpic_t *rsb_teambord; // PGM 01/19/97 - team color border
89 //MED 01/04/97 added two more weapons + 3 alternates for grenade launcher
90 sbarpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
91 //MED 01/04/97 added array to simplify weapon parsing
92 int hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT};
93 //MED 01/04/97 added hipnotic items array
94 sbarpic_t *hsb_items[2];
96 void Sbar_MiniDeathmatchOverlay (void);
97 void Sbar_DeathmatchOverlay (void);
106 void Sbar_ShowScores (void)
110 sb_showscores = true;
120 void Sbar_DontShowScores (void)
122 sb_showscores = false;
125 void sbar_start(void)
130 void sbar_shutdown(void)
135 void sbar_newmap(void)
144 void Sbar_Init (void)
148 Cmd_AddCommand ("+showscores", Sbar_ShowScores);
149 Cmd_AddCommand ("-showscores", Sbar_DontShowScores);
153 sb_disc = Sbar_NewPic("disc");
155 for (i=0 ; i<10 ; i++)
157 sb_nums[0][i] = Sbar_NewPic (va("num_%i",i));
158 sb_nums[1][i] = Sbar_NewPic (va("anum_%i",i));
161 sb_nums[0][10] = Sbar_NewPic ("num_minus");
162 sb_nums[1][10] = Sbar_NewPic ("anum_minus");
164 sb_colon = Sbar_NewPic ("num_colon");
165 sb_slash = Sbar_NewPic ("num_slash");
167 sb_weapons[0][0] = Sbar_NewPic ("inv_shotgun");
168 sb_weapons[0][1] = Sbar_NewPic ("inv_sshotgun");
169 sb_weapons[0][2] = Sbar_NewPic ("inv_nailgun");
170 sb_weapons[0][3] = Sbar_NewPic ("inv_snailgun");
171 sb_weapons[0][4] = Sbar_NewPic ("inv_rlaunch");
172 sb_weapons[0][5] = Sbar_NewPic ("inv_srlaunch");
173 sb_weapons[0][6] = Sbar_NewPic ("inv_lightng");
175 sb_weapons[1][0] = Sbar_NewPic ("inv2_shotgun");
176 sb_weapons[1][1] = Sbar_NewPic ("inv2_sshotgun");
177 sb_weapons[1][2] = Sbar_NewPic ("inv2_nailgun");
178 sb_weapons[1][3] = Sbar_NewPic ("inv2_snailgun");
179 sb_weapons[1][4] = Sbar_NewPic ("inv2_rlaunch");
180 sb_weapons[1][5] = Sbar_NewPic ("inv2_srlaunch");
181 sb_weapons[1][6] = Sbar_NewPic ("inv2_lightng");
183 for (i=0 ; i<5 ; i++)
185 sb_weapons[2+i][0] = Sbar_NewPic (va("inva%i_shotgun",i+1));
186 sb_weapons[2+i][1] = Sbar_NewPic (va("inva%i_sshotgun",i+1));
187 sb_weapons[2+i][2] = Sbar_NewPic (va("inva%i_nailgun",i+1));
188 sb_weapons[2+i][3] = Sbar_NewPic (va("inva%i_snailgun",i+1));
189 sb_weapons[2+i][4] = Sbar_NewPic (va("inva%i_rlaunch",i+1));
190 sb_weapons[2+i][5] = Sbar_NewPic (va("inva%i_srlaunch",i+1));
191 sb_weapons[2+i][6] = Sbar_NewPic (va("inva%i_lightng",i+1));
194 sb_ammo[0] = Sbar_NewPic ("sb_shells");
195 sb_ammo[1] = Sbar_NewPic ("sb_nails");
196 sb_ammo[2] = Sbar_NewPic ("sb_rocket");
197 sb_ammo[3] = Sbar_NewPic ("sb_cells");
199 sb_armor[0] = Sbar_NewPic ("sb_armor1");
200 sb_armor[1] = Sbar_NewPic ("sb_armor2");
201 sb_armor[2] = Sbar_NewPic ("sb_armor3");
203 sb_items[0] = Sbar_NewPic ("sb_key1");
204 sb_items[1] = Sbar_NewPic ("sb_key2");
205 sb_items[2] = Sbar_NewPic ("sb_invis");
206 sb_items[3] = Sbar_NewPic ("sb_invuln");
207 sb_items[4] = Sbar_NewPic ("sb_suit");
208 sb_items[5] = Sbar_NewPic ("sb_quad");
210 sb_sigil[0] = Sbar_NewPic ("sb_sigil1");
211 sb_sigil[1] = Sbar_NewPic ("sb_sigil2");
212 sb_sigil[2] = Sbar_NewPic ("sb_sigil3");
213 sb_sigil[3] = Sbar_NewPic ("sb_sigil4");
215 sb_faces[4][0] = Sbar_NewPic ("face1");
216 sb_faces[4][1] = Sbar_NewPic ("face_p1");
217 sb_faces[3][0] = Sbar_NewPic ("face2");
218 sb_faces[3][1] = Sbar_NewPic ("face_p2");
219 sb_faces[2][0] = Sbar_NewPic ("face3");
220 sb_faces[2][1] = Sbar_NewPic ("face_p3");
221 sb_faces[1][0] = Sbar_NewPic ("face4");
222 sb_faces[1][1] = Sbar_NewPic ("face_p4");
223 sb_faces[0][0] = Sbar_NewPic ("face5");
224 sb_faces[0][1] = Sbar_NewPic ("face_p5");
226 sb_face_invis = Sbar_NewPic ("face_invis");
227 sb_face_invuln = Sbar_NewPic ("face_invul2");
228 sb_face_invis_invuln = Sbar_NewPic ("face_inv2");
229 sb_face_quad = Sbar_NewPic ("face_quad");
231 sb_sbar = Sbar_NewPic ("sbar");
232 sb_ibar = Sbar_NewPic ("ibar");
233 sb_scorebar = Sbar_NewPic ("scorebar");
235 //MED 01/04/97 added new hipnotic weapons
236 if (gamemode == GAME_HIPNOTIC)
238 hsb_weapons[0][0] = Sbar_NewPic ("inv_laser");
239 hsb_weapons[0][1] = Sbar_NewPic ("inv_mjolnir");
240 hsb_weapons[0][2] = Sbar_NewPic ("inv_gren_prox");
241 hsb_weapons[0][3] = Sbar_NewPic ("inv_prox_gren");
242 hsb_weapons[0][4] = Sbar_NewPic ("inv_prox");
244 hsb_weapons[1][0] = Sbar_NewPic ("inv2_laser");
245 hsb_weapons[1][1] = Sbar_NewPic ("inv2_mjolnir");
246 hsb_weapons[1][2] = Sbar_NewPic ("inv2_gren_prox");
247 hsb_weapons[1][3] = Sbar_NewPic ("inv2_prox_gren");
248 hsb_weapons[1][4] = Sbar_NewPic ("inv2_prox");
250 for (i=0 ; i<5 ; i++)
252 hsb_weapons[2+i][0] = Sbar_NewPic (va("inva%i_laser",i+1));
253 hsb_weapons[2+i][1] = Sbar_NewPic (va("inva%i_mjolnir",i+1));
254 hsb_weapons[2+i][2] = Sbar_NewPic (va("inva%i_gren_prox",i+1));
255 hsb_weapons[2+i][3] = Sbar_NewPic (va("inva%i_prox_gren",i+1));
256 hsb_weapons[2+i][4] = Sbar_NewPic (va("inva%i_prox",i+1));
259 hsb_items[0] = Sbar_NewPic ("sb_wsuit");
260 hsb_items[1] = Sbar_NewPic ("sb_eshld");
262 else if (gamemode == GAME_ROGUE)
264 rsb_invbar[0] = Sbar_NewPic ("r_invbar1");
265 rsb_invbar[1] = Sbar_NewPic ("r_invbar2");
267 rsb_weapons[0] = Sbar_NewPic ("r_lava");
268 rsb_weapons[1] = Sbar_NewPic ("r_superlava");
269 rsb_weapons[2] = Sbar_NewPic ("r_gren");
270 rsb_weapons[3] = Sbar_NewPic ("r_multirock");
271 rsb_weapons[4] = Sbar_NewPic ("r_plasma");
273 rsb_items[0] = Sbar_NewPic ("r_shield1");
274 rsb_items[1] = Sbar_NewPic ("r_agrav1");
276 // PGM 01/19/97 - team color border
277 rsb_teambord = Sbar_NewPic ("r_teambord");
278 // PGM 01/19/97 - team color border
280 rsb_ammo[0] = Sbar_NewPic ("r_ammolava");
281 rsb_ammo[1] = Sbar_NewPic ("r_ammomulti");
282 rsb_ammo[2] = Sbar_NewPic ("r_ammoplasma");
285 R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap);
289 //=============================================================================
291 // drawing routines are relative to the status bar location
300 void Sbar_DrawPic (int x, int y, sbarpic_t *sbarpic)
302 Draw_Pic (sbar_x + x, sbar_y + y, Sbar_GetQPic(sbarpic));
305 void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha);
306 void Sbar_DrawAlphaPic (int x, int y, sbarpic_t *sbarpic, float alpha)
308 Draw_AlphaPic (sbar_x + x, sbar_y + y, Sbar_GetQPic(sbarpic), alpha);
315 Draws one solid graphics character
318 void Sbar_DrawCharacter (int x, int y, int num)
320 Draw_Character (sbar_x + x + 4 , sbar_y + y, num);
328 void Sbar_DrawString (int x, int y, char *str)
330 Draw_String (sbar_x + x, sbar_y + y, str, 0);
352 int Sbar_itoa (int num, char *buf)
365 for (i = 9;i > 0 && num < pow10table[i];i--);
370 while (num >= pow10table[i])
372 num -= pow10table[i];
389 void Sbar_DrawNum (int x, int y, int num, int digits, int color)
395 l = Sbar_itoa (num, str);
409 Sbar_DrawPic (x, y, sb_nums[color][frame]);
415 //=============================================================================
417 int fragsort[MAX_SCOREBOARD];
419 char scoreboardtext[MAX_SCOREBOARD][20];
420 int scoreboardtop[MAX_SCOREBOARD];
421 int scoreboardbottom[MAX_SCOREBOARD];
422 int scoreboardcount[MAX_SCOREBOARD];
430 void Sbar_SortFrags (void)
436 for (i=0 ; i<cl.maxclients ; i++)
438 if (cl.scores[i].name[0])
440 fragsort[scoreboardlines] = i;
445 for (i=0 ; i<scoreboardlines ; i++)
446 for (j=0 ; j<scoreboardlines-1-i ; j++)
447 if (cl.scores[fragsort[j]].frags < cl.scores[fragsort[j+1]].frags)
450 fragsort[j] = fragsort[j+1];
457 Sbar_UpdateScoreboard
460 void Sbar_UpdateScoreboard (void)
469 memset (scoreboardtext, 0, sizeof(scoreboardtext));
471 for (i=0 ; i<scoreboardlines; i++)
475 sprintf (&scoreboardtext[i][1], "%3i %s", s->frags, s->name);
477 top = s->colors & 0xf0;
478 bottom = (s->colors & 15) <<4;
479 scoreboardtop[i] = top + 8;
480 scoreboardbottom[i] = bottom + 8;
491 void Sbar_SoloScoreboard (void)
494 int minutes, seconds, tens, units;
497 sprintf (str,"Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
498 Sbar_DrawString (8, 4, str);
500 sprintf (str,"Secrets :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
501 Sbar_DrawString (8, 12, str);
504 minutes = cl.time / 60;
505 seconds = cl.time - 60*minutes;
507 units = seconds - 10*tens;
508 sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
509 Sbar_DrawString (184, 4, str);
512 l = strlen (cl.levelname);
513 Sbar_DrawString (232 - l*4, 12, cl.levelname);
521 void Sbar_DrawScoreboard (void)
523 Sbar_SoloScoreboard ();
524 if (cl.gametype == GAME_DEATHMATCH)
525 Sbar_DeathmatchOverlay ();
528 //=============================================================================
535 void Sbar_DrawInventory (void)
542 if (gamemode == GAME_ROGUE)
544 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
545 Sbar_DrawAlphaPic (0, -24, rsb_invbar[0], 0.4);
547 Sbar_DrawAlphaPic (0, -24, rsb_invbar[1], 0.4);
550 Sbar_DrawAlphaPic (0, -24, sb_ibar, 0.4);
553 for (i=0 ; i<7 ; i++)
555 if (cl.items & (IT_SHOTGUN<<i) )
557 time = cl.item_gettime[i];
558 flashon = (int)((cl.time - time)*10);
561 if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i) )
567 flashon = (flashon%5) + 2;
569 Sbar_DrawAlphaPic (i*24, -16, sb_weapons[flashon][i], 0.4);
575 if (gamemode == GAME_HIPNOTIC)
577 int grenadeflashing=0;
578 for (i=0 ; i<4 ; i++)
580 if (cl.items & (1<<hipweapons[i]) )
582 time = cl.item_gettime[hipweapons[i]];
583 flashon = (int)((cl.time - time)*10);
586 if ( cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i]) )
592 flashon = (flashon%5) + 2;
594 // check grenade launcher
597 if (cl.items & HIT_PROXIMITY_GUN)
602 Sbar_DrawPic (96, -16, hsb_weapons[flashon][2]);
608 if (cl.items & (IT_SHOTGUN<<4))
610 if (!grenadeflashing)
611 Sbar_DrawPic (96, -16, hsb_weapons[flashon][3]);
614 Sbar_DrawPic (96, -16, hsb_weapons[flashon][4]);
617 Sbar_DrawPic (176 + (i*24), -16, hsb_weapons[flashon][i]);
622 if (gamemode == GAME_ROGUE)
624 // check for powered up weapon.
625 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
627 if (cl.stats[STAT_ACTIVEWEAPON] == (RIT_LAVA_NAILGUN << i))
628 Sbar_DrawPic ((i+2)*24, -16, rsb_weapons[i]);
632 for (i=0 ; i<4 ; i++)
634 sprintf (num, "%3i",cl.stats[STAT_SHELLS+i] );
636 Sbar_DrawCharacter ( (6*i+1)*8 - 2, -24, 18 + num[0] - '0');
638 Sbar_DrawCharacter ( (6*i+2)*8 - 2, -24, 18 + num[1] - '0');
640 Sbar_DrawCharacter ( (6*i+3)*8 - 2, -24, 18 + num[2] - '0');
644 for (i=0 ; i<6 ; i++)
645 if (cl.items & (1<<(17+i)))
647 //MED 01/04/97 changed keys
648 if (gamemode != GAME_HIPNOTIC || (i>1))
649 Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
652 //MED 01/04/97 added hipnotic items
654 if (gamemode == GAME_HIPNOTIC)
656 for (i=0 ; i<2 ; i++)
657 if (cl.items & (1<<(24+i)))
658 Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
661 if (gamemode == GAME_ROGUE)
664 for (i=0 ; i<2 ; i++)
665 if (cl.items & (1<<(29+i)))
666 Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
671 for (i=0 ; i<4 ; i++)
672 if (cl.items & (1<<(28+i)))
673 Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]);
677 //=============================================================================
684 void Sbar_DrawFrags (void)
695 l = scoreboardlines <= 4 ? scoreboardlines : 4;
699 for (i = 0;i < l;i++)
707 top = (s->colors & 0xf0) + 8;
708 bottom = ((s->colors & 15)<<4) + 8;
710 Draw_Fill (sbar_x + x + 10, sbar_y - 23, 28, 4, top);
711 Draw_Fill (sbar_x + x + 10, sbar_y + 4 - 23, 28, 3, bottom);
715 sprintf (num, "%3i",f);
717 Sbar_DrawCharacter (x + 8, -24, num[0]);
718 Sbar_DrawCharacter (x + 16, -24, num[1]);
719 Sbar_DrawCharacter (x + 24, -24, num[2]);
721 if (k == cl.viewentity - 1)
723 Sbar_DrawCharacter ( x + 2, -24, 16);
724 Sbar_DrawCharacter ( x + 32 - 4, -24, 17);
730 //=============================================================================
738 void Sbar_DrawFace (void)
742 // PGM 01/19/97 - team color drawing
743 // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
744 if (gamemode == GAME_ROGUE && (cl.maxclients != 1) && (teamplay.integer > 3) && (teamplay.integer < 7))
750 s = &cl.scores[cl.viewentity - 1];
752 top = (s->colors & 0xf0) + 8;
753 bottom = ((s->colors & 15)<<4) + 8;
755 Sbar_DrawPic (112, 0, rsb_teambord);
756 Draw_Fill (sbar_x + 113, vid.conheight-SBAR_HEIGHT+3, 22, 9, top);
757 Draw_Fill (sbar_x + 113, vid.conheight-SBAR_HEIGHT+12, 22, 9, bottom);
761 sprintf (num, "%3i",f);
766 Sbar_DrawCharacter(109, 3, 18 + num[0] - '0');
768 Sbar_DrawCharacter(116, 3, 18 + num[1] - '0');
770 Sbar_DrawCharacter(123, 3, 18 + num[2] - '0');
774 Sbar_DrawCharacter ( 109, 3, num[0]);
775 Sbar_DrawCharacter ( 116, 3, num[1]);
776 Sbar_DrawCharacter ( 123, 3, num[2]);
781 // PGM 01/19/97 - team color drawing
783 if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY) ) == (IT_INVISIBILITY | IT_INVULNERABILITY) )
784 Sbar_DrawPic (112, 0, sb_face_invis_invuln);
785 else if (cl.items & IT_QUAD)
786 Sbar_DrawPic (112, 0, sb_face_quad );
787 else if (cl.items & IT_INVISIBILITY)
788 Sbar_DrawPic (112, 0, sb_face_invis );
789 else if (cl.items & IT_INVULNERABILITY)
790 Sbar_DrawPic (112, 0, sb_face_invuln);
793 f = cl.stats[STAT_HEALTH] / 20;
795 Sbar_DrawPic (112, 0, sb_faces[f][cl.time <= cl.faceanimtime]);
804 void Sbar_Draw (void)
806 if (scr_con_current == vid.conheight)
807 return; // console is full screen
809 sbar_y = vid.conheight - SBAR_HEIGHT;
810 if (cl.gametype == GAME_DEATHMATCH)
813 sbar_x = (vid.conwidth - 320)/2;
817 Sbar_DrawInventory ();
818 if (cl.maxclients != 1)
822 if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
824 Sbar_DrawAlphaPic (0, 0, sb_scorebar, 0.4);
825 Sbar_DrawScoreboard ();
829 Sbar_DrawAlphaPic (0, 0, sb_sbar, 0.4);
831 // keys (hipnotic only)
832 //MED 01/04/97 moved keys here so they would not be overwritten
833 if (gamemode == GAME_HIPNOTIC)
835 if (cl.items & IT_KEY1)
836 Sbar_DrawPic (209, 3, sb_items[0]);
837 if (cl.items & IT_KEY2)
838 Sbar_DrawPic (209, 12, sb_items[1]);
841 if (cl.items & IT_INVULNERABILITY)
843 Sbar_DrawNum (24, 0, 666, 3, 1);
844 Sbar_DrawPic (0, 0, sb_disc);
848 if (gamemode == GAME_ROGUE)
850 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
851 if (cl.items & RIT_ARMOR3)
852 Sbar_DrawPic (0, 0, sb_armor[2]);
853 else if (cl.items & RIT_ARMOR2)
854 Sbar_DrawPic (0, 0, sb_armor[1]);
855 else if (cl.items & RIT_ARMOR1)
856 Sbar_DrawPic (0, 0, sb_armor[0]);
860 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
861 if (cl.items & IT_ARMOR3)
862 Sbar_DrawPic (0, 0, sb_armor[2]);
863 else if (cl.items & IT_ARMOR2)
864 Sbar_DrawPic (0, 0, sb_armor[1]);
865 else if (cl.items & IT_ARMOR1)
866 Sbar_DrawPic (0, 0, sb_armor[0]);
874 Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
877 if (gamemode == GAME_ROGUE)
879 if (cl.items & RIT_SHELLS)
880 Sbar_DrawPic (224, 0, sb_ammo[0]);
881 else if (cl.items & RIT_NAILS)
882 Sbar_DrawPic (224, 0, sb_ammo[1]);
883 else if (cl.items & RIT_ROCKETS)
884 Sbar_DrawPic (224, 0, sb_ammo[2]);
885 else if (cl.items & RIT_CELLS)
886 Sbar_DrawPic (224, 0, sb_ammo[3]);
887 else if (cl.items & RIT_LAVA_NAILS)
888 Sbar_DrawPic (224, 0, rsb_ammo[0]);
889 else if (cl.items & RIT_PLASMA_AMMO)
890 Sbar_DrawPic (224, 0, rsb_ammo[1]);
891 else if (cl.items & RIT_MULTI_ROCKETS)
892 Sbar_DrawPic (224, 0, rsb_ammo[2]);
896 if (cl.items & IT_SHELLS)
897 Sbar_DrawPic (224, 0, sb_ammo[0]);
898 else if (cl.items & IT_NAILS)
899 Sbar_DrawPic (224, 0, sb_ammo[1]);
900 else if (cl.items & IT_ROCKETS)
901 Sbar_DrawPic (224, 0, sb_ammo[2]);
902 else if (cl.items & IT_CELLS)
903 Sbar_DrawPic (224, 0, sb_ammo[3]);
906 Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
909 if (vid.conwidth > 320 && cl.gametype == GAME_DEATHMATCH)
910 Sbar_MiniDeathmatchOverlay ();
913 //=============================================================================
917 Sbar_DeathmatchOverlay
921 void Sbar_DeathmatchOverlay (void)
924 int i, k, l, top, bottom, x, y, total, n, minutes, tens, units, fph;
928 pic = Draw_CachePic ("gfx/ranking.lmp");
929 Draw_Pic ((vid.conwidth - pic->width)/2, 8, pic);
937 x = ((vid.conwidth - 320)>>1) - 140;
939 for (i = 0;i < l;i++)
947 top = (s->colors & 0xf0) + 8;
948 bottom = ((s->colors & 15)<<4) + 8;
950 Draw_Fill ( x, y+1, 88, 3, top);
951 Draw_Fill ( x, y+4, 88, 3, bottom);
953 total = cl.time - s->entertime;
954 minutes = (int)total/60;
955 n = total - minutes*60;
959 fph = total ? (int) ((float) s->frags * 3600.0 / total) : 0;
960 if (fph < -999) fph = -999;
961 if (fph > 9999) fph = 9999;
964 sprintf (num, "%c %4i:%4i %4i:%c%c %s", k == cl.viewentity - 1 ? 12 : ' ', (int) s->frags, fph, minutes, tens, units, s->name);
965 Draw_String(x - 8, y, num, 0);
973 Sbar_DeathmatchOverlay
977 void Sbar_MiniDeathmatchOverlay (void)
979 int i, l, k, top, bottom, x, y, fph, numlines;
983 if (vid.conwidth < 512 || !sb_lines)
991 y = vid.conheight - sb_lines;
992 numlines = sb_lines/8;
997 for (i = 0; i < scoreboardlines; i++)
998 if (fragsort[i] == cl.viewentity - 1)
1001 if (i == scoreboardlines) // we're not there
1003 else // figure out start
1006 if (i > scoreboardlines - numlines)
1007 i = scoreboardlines - numlines;
1012 for (;i < scoreboardlines && y < vid.conheight - 8;i++)
1020 top = (s->colors & 0xf0) + 8;
1021 bottom = ((s->colors & 15)<<4) + 8;
1023 Draw_Fill ( x, y+1, 72, 3, top);
1024 Draw_Fill ( x, y+4, 72, 3, bottom);
1026 fph = (cl.time - s->entertime) ? (int) ((float) s->frags * 3600.0 / (cl.time - s->entertime)) : 0;
1027 if (fph < -999) fph = -999;
1028 if (fph > 9999) fph = 9999;
1031 sprintf (num, "%c%4i:%4i%c %s", k == cl.viewentity - 1 ? 16 : ' ', (int) s->frags, fph, k == cl.viewentity - 1 ? 17 : ' ', s->name);
1032 Draw_String(x - 8, y, num, 0);
1040 Sbar_IntermissionOverlay
1044 void Sbar_IntermissionOverlay (void)
1049 if (cl.gametype == GAME_DEATHMATCH)
1051 Sbar_DeathmatchOverlay ();
1058 Draw_Pic (64, 24, Draw_CachePic ("gfx/complete.lmp"));
1059 Draw_Pic (0, 56, Draw_CachePic ("gfx/inter.lmp"));
1062 dig = cl.completed_time/60;
1063 Sbar_DrawNum (160, 64, dig, 3, 0);
1064 num = cl.completed_time - dig*60;
1065 Sbar_DrawPic (234,64,sb_colon);
1066 Sbar_DrawPic (246,64,sb_nums[0][num/10]);
1067 Sbar_DrawPic (266,64,sb_nums[0][num%10]);
1069 Sbar_DrawNum (160, 104, cl.stats[STAT_SECRETS], 3, 0);
1070 Sbar_DrawPic (232, 104, sb_slash);
1071 Sbar_DrawNum (240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
1073 Sbar_DrawNum (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
1074 Sbar_DrawPic (232, 144, sb_slash);
1075 Sbar_DrawNum (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
1086 void Sbar_FinaleOverlay (void)
1090 pic = Draw_CachePic ("gfx/finale.lmp");
1091 Draw_Pic((vid.conwidth - pic->width)/2, 16, pic);