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
25 #define STAT_MINUS 10 // num frame for '-' stats digit
26 qpic_t *sb_nums[2][11];
27 qpic_t *sb_colon, *sb_slash;
32 qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
38 qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive
39 // 0 is static, 1 is temporary animation
40 qpic_t *sb_face_invis;
42 qpic_t *sb_face_invuln;
43 qpic_t *sb_face_invis_invuln;
45 qboolean sb_showscores;
47 int sb_lines; // scan lines to draw
49 qpic_t *rsb_invbar[2];
50 qpic_t *rsb_weapons[5];
53 qpic_t *rsb_teambord; // PGM 01/19/97 - team color border
55 //MED 01/04/97 added two more weapons + 3 alternates for grenade launcher
56 qpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
57 //MED 01/04/97 added array to simplify weapon parsing
58 int hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT};
59 //MED 01/04/97 added hipnotic items array
62 void Sbar_MiniDeathmatchOverlay (void);
63 void Sbar_DeathmatchOverlay (void);
64 void M_DrawPic (int x, int y, qpic_t *pic);
73 void Sbar_ShowScores (void)
88 void Sbar_DontShowScores (void)
90 sb_showscores = false;
99 //void Sbar_Changed (void)
101 // sb_updates = 0; // update next frame
109 void Sbar_Init (void)
113 for (i=0 ; i<10 ; i++)
115 sb_nums[0][i] = Draw_PicFromWad (va("num_%i",i));
116 sb_nums[1][i] = Draw_PicFromWad (va("anum_%i",i));
119 sb_nums[0][10] = Draw_PicFromWad ("num_minus");
120 sb_nums[1][10] = Draw_PicFromWad ("anum_minus");
122 sb_colon = Draw_PicFromWad ("num_colon");
123 sb_slash = Draw_PicFromWad ("num_slash");
125 sb_weapons[0][0] = Draw_PicFromWad ("inv_shotgun");
126 sb_weapons[0][1] = Draw_PicFromWad ("inv_sshotgun");
127 sb_weapons[0][2] = Draw_PicFromWad ("inv_nailgun");
128 sb_weapons[0][3] = Draw_PicFromWad ("inv_snailgun");
129 sb_weapons[0][4] = Draw_PicFromWad ("inv_rlaunch");
130 sb_weapons[0][5] = Draw_PicFromWad ("inv_srlaunch");
131 sb_weapons[0][6] = Draw_PicFromWad ("inv_lightng");
133 sb_weapons[1][0] = Draw_PicFromWad ("inv2_shotgun");
134 sb_weapons[1][1] = Draw_PicFromWad ("inv2_sshotgun");
135 sb_weapons[1][2] = Draw_PicFromWad ("inv2_nailgun");
136 sb_weapons[1][3] = Draw_PicFromWad ("inv2_snailgun");
137 sb_weapons[1][4] = Draw_PicFromWad ("inv2_rlaunch");
138 sb_weapons[1][5] = Draw_PicFromWad ("inv2_srlaunch");
139 sb_weapons[1][6] = Draw_PicFromWad ("inv2_lightng");
141 for (i=0 ; i<5 ; i++)
143 sb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_shotgun",i+1));
144 sb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_sshotgun",i+1));
145 sb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_nailgun",i+1));
146 sb_weapons[2+i][3] = Draw_PicFromWad (va("inva%i_snailgun",i+1));
147 sb_weapons[2+i][4] = Draw_PicFromWad (va("inva%i_rlaunch",i+1));
148 sb_weapons[2+i][5] = Draw_PicFromWad (va("inva%i_srlaunch",i+1));
149 sb_weapons[2+i][6] = Draw_PicFromWad (va("inva%i_lightng",i+1));
152 sb_ammo[0] = Draw_PicFromWad ("sb_shells");
153 sb_ammo[1] = Draw_PicFromWad ("sb_nails");
154 sb_ammo[2] = Draw_PicFromWad ("sb_rocket");
155 sb_ammo[3] = Draw_PicFromWad ("sb_cells");
157 sb_armor[0] = Draw_PicFromWad ("sb_armor1");
158 sb_armor[1] = Draw_PicFromWad ("sb_armor2");
159 sb_armor[2] = Draw_PicFromWad ("sb_armor3");
161 sb_items[0] = Draw_PicFromWad ("sb_key1");
162 sb_items[1] = Draw_PicFromWad ("sb_key2");
163 sb_items[2] = Draw_PicFromWad ("sb_invis");
164 sb_items[3] = Draw_PicFromWad ("sb_invuln");
165 sb_items[4] = Draw_PicFromWad ("sb_suit");
166 sb_items[5] = Draw_PicFromWad ("sb_quad");
168 sb_sigil[0] = Draw_PicFromWad ("sb_sigil1");
169 sb_sigil[1] = Draw_PicFromWad ("sb_sigil2");
170 sb_sigil[2] = Draw_PicFromWad ("sb_sigil3");
171 sb_sigil[3] = Draw_PicFromWad ("sb_sigil4");
173 sb_faces[4][0] = Draw_PicFromWad ("face1");
174 sb_faces[4][1] = Draw_PicFromWad ("face_p1");
175 sb_faces[3][0] = Draw_PicFromWad ("face2");
176 sb_faces[3][1] = Draw_PicFromWad ("face_p2");
177 sb_faces[2][0] = Draw_PicFromWad ("face3");
178 sb_faces[2][1] = Draw_PicFromWad ("face_p3");
179 sb_faces[1][0] = Draw_PicFromWad ("face4");
180 sb_faces[1][1] = Draw_PicFromWad ("face_p4");
181 sb_faces[0][0] = Draw_PicFromWad ("face5");
182 sb_faces[0][1] = Draw_PicFromWad ("face_p5");
184 sb_face_invis = Draw_PicFromWad ("face_invis");
185 sb_face_invuln = Draw_PicFromWad ("face_invul2");
186 sb_face_invis_invuln = Draw_PicFromWad ("face_inv2");
187 sb_face_quad = Draw_PicFromWad ("face_quad");
189 Cmd_AddCommand ("+showscores", Sbar_ShowScores);
190 Cmd_AddCommand ("-showscores", Sbar_DontShowScores);
192 sb_sbar = Draw_PicFromWad ("sbar");
193 sb_ibar = Draw_PicFromWad ("ibar");
194 sb_scorebar = Draw_PicFromWad ("scorebar");
196 //MED 01/04/97 added new hipnotic weapons
199 hsb_weapons[0][0] = Draw_PicFromWad ("inv_laser");
200 hsb_weapons[0][1] = Draw_PicFromWad ("inv_mjolnir");
201 hsb_weapons[0][2] = Draw_PicFromWad ("inv_gren_prox");
202 hsb_weapons[0][3] = Draw_PicFromWad ("inv_prox_gren");
203 hsb_weapons[0][4] = Draw_PicFromWad ("inv_prox");
205 hsb_weapons[1][0] = Draw_PicFromWad ("inv2_laser");
206 hsb_weapons[1][1] = Draw_PicFromWad ("inv2_mjolnir");
207 hsb_weapons[1][2] = Draw_PicFromWad ("inv2_gren_prox");
208 hsb_weapons[1][3] = Draw_PicFromWad ("inv2_prox_gren");
209 hsb_weapons[1][4] = Draw_PicFromWad ("inv2_prox");
211 for (i=0 ; i<5 ; i++)
213 hsb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_laser",i+1));
214 hsb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_mjolnir",i+1));
215 hsb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_gren_prox",i+1));
216 hsb_weapons[2+i][3] = Draw_PicFromWad (va("inva%i_prox_gren",i+1));
217 hsb_weapons[2+i][4] = Draw_PicFromWad (va("inva%i_prox",i+1));
220 hsb_items[0] = Draw_PicFromWad ("sb_wsuit");
221 hsb_items[1] = Draw_PicFromWad ("sb_eshld");
226 rsb_invbar[0] = Draw_PicFromWad ("r_invbar1");
227 rsb_invbar[1] = Draw_PicFromWad ("r_invbar2");
229 rsb_weapons[0] = Draw_PicFromWad ("r_lava");
230 rsb_weapons[1] = Draw_PicFromWad ("r_superlava");
231 rsb_weapons[2] = Draw_PicFromWad ("r_gren");
232 rsb_weapons[3] = Draw_PicFromWad ("r_multirock");
233 rsb_weapons[4] = Draw_PicFromWad ("r_plasma");
235 rsb_items[0] = Draw_PicFromWad ("r_shield1");
236 rsb_items[1] = Draw_PicFromWad ("r_agrav1");
238 // PGM 01/19/97 - team color border
239 rsb_teambord = Draw_PicFromWad ("r_teambord");
240 // PGM 01/19/97 - team color border
242 rsb_ammo[0] = Draw_PicFromWad ("r_ammolava");
243 rsb_ammo[1] = Draw_PicFromWad ("r_ammomulti");
244 rsb_ammo[2] = Draw_PicFromWad ("r_ammoplasma");
249 //=============================================================================
251 // drawing routines are relative to the status bar location
258 void Sbar_DrawPic (int x, int y, qpic_t *pic)
260 if (cl.gametype == GAME_DEATHMATCH)
261 Draw_Pic (x /* + ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
263 Draw_Pic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic);
266 void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha);
267 void Sbar_DrawAlphaPic (int x, int y, qpic_t *pic, float alpha)
269 if (cl.gametype == GAME_DEATHMATCH)
270 Draw_AlphaPic (x /* + ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic, alpha);
272 Draw_AlphaPic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic, alpha);
280 void Sbar_DrawTransPic (int x, int y, qpic_t *pic)
282 if (cl.gametype == GAME_DEATHMATCH)
283 Draw_TransPic (x /*+ ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
285 Draw_TransPic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic);
292 Draws one solid graphics character
295 void Sbar_DrawCharacter (int x, int y, int num)
297 if (cl.gametype == GAME_DEATHMATCH)
298 Draw_Character ( x /*+ ((vid.width - 320)>>1) */ + 4 , y + vid.height-SBAR_HEIGHT, num);
300 Draw_Character ( x + ((vid.width - 320)>>1) + 4 , y + vid.height-SBAR_HEIGHT, num);
308 void Sbar_DrawString (int x, int y, char *str)
310 if (cl.gametype == GAME_DEATHMATCH)
311 Draw_String (x /*+ ((vid.width - 320)>>1)*/, y+ vid.height-SBAR_HEIGHT, str, 0);
313 Draw_String (x + ((vid.width - 320)>>1), y+ vid.height-SBAR_HEIGHT, str, 0);
321 int Sbar_itoa (int num, char *buf)
335 for (pow10 = 10 ; num >= pow10 ; pow10 *= 10)
344 } while (pow10 != 1);
357 void Sbar_DrawNum (int x, int y, int num, int digits, int color)
363 l = Sbar_itoa (num, str);
377 Sbar_DrawTransPic (x,y,sb_nums[color][frame]);
383 //=============================================================================
385 int fragsort[MAX_SCOREBOARD];
387 char scoreboardtext[MAX_SCOREBOARD][20];
388 int scoreboardtop[MAX_SCOREBOARD];
389 int scoreboardbottom[MAX_SCOREBOARD];
390 int scoreboardcount[MAX_SCOREBOARD];
398 void Sbar_SortFrags (void)
404 for (i=0 ; i<cl.maxclients ; i++)
406 if (cl.scores[i].name[0])
408 fragsort[scoreboardlines] = i;
413 for (i=0 ; i<scoreboardlines ; i++)
414 for (j=0 ; j<scoreboardlines-1-i ; j++)
415 if (cl.scores[fragsort[j]].frags < cl.scores[fragsort[j+1]].frags)
418 fragsort[j] = fragsort[j+1];
423 int Sbar_ColorForMap (int m)
425 return m < 128 ? m + 8 : m + 8;
430 Sbar_UpdateScoreboard
433 void Sbar_UpdateScoreboard (void)
442 memset (scoreboardtext, 0, sizeof(scoreboardtext));
444 for (i=0 ; i<scoreboardlines; i++)
448 sprintf (&scoreboardtext[i][1], "%3i %s", s->frags, s->name);
450 top = s->colors & 0xf0;
451 bottom = (s->colors & 15) <<4;
452 scoreboardtop[i] = Sbar_ColorForMap (top);
453 scoreboardbottom[i] = Sbar_ColorForMap (bottom);
464 void Sbar_SoloScoreboard (void)
467 int minutes, seconds, tens, units;
470 sprintf (str,"Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
471 Sbar_DrawString (8, 4, str);
473 sprintf (str,"Secrets :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
474 Sbar_DrawString (8, 12, str);
477 minutes = cl.time / 60;
478 seconds = cl.time - 60*minutes;
480 units = seconds - 10*tens;
481 sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
482 Sbar_DrawString (184, 4, str);
485 l = strlen (cl.levelname);
486 Sbar_DrawString (232 - l*4, 12, cl.levelname);
494 void Sbar_DrawScoreboard (void)
496 Sbar_SoloScoreboard ();
497 if (cl.gametype == GAME_DEATHMATCH)
498 Sbar_DeathmatchOverlay ();
506 if (cl.gametype != GAME_DEATHMATCH)
508 Sbar_SoloScoreboard ();
512 Sbar_UpdateScoreboard ();
514 l = scoreboardlines <= 6 ? scoreboardlines : 6;
516 for (i=0 ; i<l ; i++)
521 s = &cl.scores[fragsort[i]];
526 top = s->colors & 0xf0;
527 bottom = (s->colors & 15)<<4;
528 top = Sbar_ColorForMap (top);
529 bottom = Sbar_ColorForMap (bottom);
531 Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y + vid.height - SBAR_HEIGHT, 28, 4, top);
532 Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y+4 + vid.height - SBAR_HEIGHT, 28, 4, bottom);
535 for (j=0 ; j<20 ; j++)
537 c = scoreboardtext[i][j];
538 if (c == 0 || c == ' ')
540 Sbar_DrawCharacter ( (x+j)*8, y, c);
546 //=============================================================================
553 void Sbar_DrawInventory (void)
562 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
563 Sbar_DrawAlphaPic (0, -24, rsb_invbar[0], 0.4);
565 Sbar_DrawAlphaPic (0, -24, rsb_invbar[1], 0.4);
569 Sbar_DrawAlphaPic (0, -24, sb_ibar, 0.4);
573 for (i=0 ; i<7 ; i++)
575 if (cl.items & (IT_SHOTGUN<<i) )
577 time = cl.item_gettime[i];
578 flashon = (int)((cl.time - time)*10);
581 if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i) )
587 flashon = (flashon%5) + 2;
589 Sbar_DrawAlphaPic (i*24, -16, sb_weapons[flashon][i], 0.4);
592 // sb_updates = 0; // force update to remove flash
600 int grenadeflashing=0;
601 for (i=0 ; i<4 ; i++)
603 if (cl.items & (1<<hipweapons[i]) )
605 time = cl.item_gettime[hipweapons[i]];
606 flashon = (int)((cl.time - time)*10);
609 if ( cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i]) )
615 flashon = (flashon%5) + 2;
617 // check grenade launcher
620 if (cl.items & HIT_PROXIMITY_GUN)
625 Sbar_DrawPic (96, -16, hsb_weapons[flashon][2]);
631 if (cl.items & (IT_SHOTGUN<<4))
633 if (flashon && !grenadeflashing)
635 Sbar_DrawPic (96, -16, hsb_weapons[flashon][3]);
637 else if (!grenadeflashing)
639 Sbar_DrawPic (96, -16, hsb_weapons[0][3]);
643 Sbar_DrawPic (96, -16, hsb_weapons[flashon][4]);
646 Sbar_DrawPic (176 + (i*24), -16, hsb_weapons[flashon][i]);
648 // sb_updates = 0; // force update to remove flash
655 // check for powered up weapon.
656 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
660 if (cl.stats[STAT_ACTIVEWEAPON] == (RIT_LAVA_NAILGUN << i))
662 Sbar_DrawPic ((i+2)*24, -16, rsb_weapons[i]);
669 for (i=0 ; i<4 ; i++)
671 sprintf (num, "%3i",cl.stats[STAT_SHELLS+i] );
673 Sbar_DrawCharacter ( (6*i+1)*8 - 2, -24, 18 + num[0] - '0');
675 Sbar_DrawCharacter ( (6*i+2)*8 - 2, -24, 18 + num[1] - '0');
677 Sbar_DrawCharacter ( (6*i+3)*8 - 2, -24, 18 + num[2] - '0');
682 for (i=0 ; i<6 ; i++)
683 if (cl.items & (1<<(17+i)))
685 time = cl.item_gettime[17+i];
686 if (time && time > cl.time - 2 && flashon )
692 //MED 01/04/97 changed keys
693 if (!hipnotic || (i>1))
695 Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
698 // if (time && time > cl.time - 2)
701 //MED 01/04/97 added hipnotic items
705 for (i=0 ; i<2 ; i++)
706 if (cl.items & (1<<(24+i)))
708 time = cl.item_gettime[24+i];
709 if (time && time > cl.time - 2 && flashon )
715 Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
717 // if (time && time > cl.time - 2)
725 for (i=0 ; i<2 ; i++)
727 if (cl.items & (1<<(29+i)))
729 time = cl.item_gettime[29+i];
731 if (time && time > cl.time - 2 && flashon )
737 Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
740 // if (time && time > cl.time - 2)
748 for (i=0 ; i<4 ; i++)
750 if (cl.items & (1<<(28+i)))
752 time = cl.item_gettime[28+i];
753 if (time && time > cl.time - 2 && flashon )
758 Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]);
759 // if (time && time > cl.time - 2)
766 //=============================================================================
773 void Sbar_DrawFrags (void)
785 l = scoreboardlines <= 4 ? scoreboardlines : 4;
788 if (cl.gametype == GAME_DEATHMATCH)
791 xofs = (vid.width - 320)>>1;
792 y = vid.height - SBAR_HEIGHT - 23;
794 for (i=0 ; i<l ; i++)
802 top = s->colors & 0xf0;
803 bottom = (s->colors & 15)<<4;
804 top = Sbar_ColorForMap (top);
805 bottom = Sbar_ColorForMap (bottom);
807 Draw_Fill (xofs + x*8 + 10, y, 28, 4, top);
808 Draw_Fill (xofs + x*8 + 10, y+4, 28, 3, bottom);
812 sprintf (num, "%3i",f);
814 Sbar_DrawCharacter ( (x+1)*8 , -24, num[0]);
815 Sbar_DrawCharacter ( (x+2)*8 , -24, num[1]);
816 Sbar_DrawCharacter ( (x+3)*8 , -24, num[2]);
818 if (k == cl.viewentity - 1)
820 Sbar_DrawCharacter (x*8+2, -24, 16);
821 Sbar_DrawCharacter ( (x+4)*8-4, -24, 17);
827 //=============================================================================
835 void Sbar_DrawFace (void)
839 // PGM 01/19/97 - team color drawing
840 // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
842 (cl.maxclients != 1) &&
843 (teamplay.value>3) &&
851 s = &cl.scores[cl.viewentity - 1];
853 top = s->colors & 0xf0;
854 bottom = (s->colors & 15)<<4;
855 top = Sbar_ColorForMap (top);
856 bottom = Sbar_ColorForMap (bottom);
858 if (cl.gametype == GAME_DEATHMATCH)
861 xofs = ((vid.width - 320)>>1) + 113;
863 Sbar_DrawPic (112, 0, rsb_teambord);
864 Draw_Fill (xofs, vid.height-SBAR_HEIGHT+3, 22, 9, top);
865 Draw_Fill (xofs, vid.height-SBAR_HEIGHT+12, 22, 9, bottom);
869 sprintf (num, "%3i",f);
874 Sbar_DrawCharacter(109, 3, 18 + num[0] - '0');
876 Sbar_DrawCharacter(116, 3, 18 + num[1] - '0');
878 Sbar_DrawCharacter(123, 3, 18 + num[2] - '0');
882 Sbar_DrawCharacter ( 109, 3, num[0]);
883 Sbar_DrawCharacter ( 116, 3, num[1]);
884 Sbar_DrawCharacter ( 123, 3, num[2]);
889 // PGM 01/19/97 - team color drawing
891 if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY) )
892 == (IT_INVISIBILITY | IT_INVULNERABILITY) )
894 Sbar_DrawPic (112, 0, sb_face_invis_invuln);
897 if (cl.items & IT_QUAD)
899 Sbar_DrawPic (112, 0, sb_face_quad );
902 if (cl.items & IT_INVISIBILITY)
904 Sbar_DrawPic (112, 0, sb_face_invis );
907 if (cl.items & IT_INVULNERABILITY)
909 Sbar_DrawPic (112, 0, sb_face_invuln);
913 if (cl.stats[STAT_HEALTH] >= 100)
916 f = cl.stats[STAT_HEALTH] / 20;
918 if (cl.time <= cl.faceanimtime)
921 // sb_updates = 0; // make sure the anim gets drawn over
925 Sbar_DrawPic (112, 0, sb_faces[f][anim]);
933 void Sbar_Draw (void)
935 if (scr_con_current == vid.height)
936 return; // console is full screen
938 scr_copyeverything = 1;
944 Sbar_DrawInventory ();
945 if (cl.maxclients != 1)
949 if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
951 Sbar_DrawAlphaPic (0, 0, sb_scorebar, 0.4);
952 Sbar_DrawScoreboard ();
957 Sbar_DrawAlphaPic (0, 0, sb_sbar, 0.4);
959 // keys (hipnotic only)
960 //MED 01/04/97 moved keys here so they would not be overwritten
963 if (cl.items & IT_KEY1)
964 Sbar_DrawPic (209, 3, sb_items[0]);
965 if (cl.items & IT_KEY2)
966 Sbar_DrawPic (209, 12, sb_items[1]);
969 if (cl.items & IT_INVULNERABILITY)
971 Sbar_DrawNum (24, 0, 666, 3, 1);
972 Sbar_DrawPic (0, 0, draw_disc);
978 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3,
979 cl.stats[STAT_ARMOR] <= 25);
980 if (cl.items & RIT_ARMOR3)
981 Sbar_DrawPic (0, 0, sb_armor[2]);
982 else if (cl.items & RIT_ARMOR2)
983 Sbar_DrawPic (0, 0, sb_armor[1]);
984 else if (cl.items & RIT_ARMOR1)
985 Sbar_DrawPic (0, 0, sb_armor[0]);
989 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3
990 , cl.stats[STAT_ARMOR] <= 25);
991 if (cl.items & IT_ARMOR3)
992 Sbar_DrawPic (0, 0, sb_armor[2]);
993 else if (cl.items & IT_ARMOR2)
994 Sbar_DrawPic (0, 0, sb_armor[1]);
995 else if (cl.items & IT_ARMOR1)
996 Sbar_DrawPic (0, 0, sb_armor[0]);
1004 Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3
1005 , cl.stats[STAT_HEALTH] <= 25);
1010 if (cl.items & RIT_SHELLS)
1011 Sbar_DrawPic (224, 0, sb_ammo[0]);
1012 else if (cl.items & RIT_NAILS)
1013 Sbar_DrawPic (224, 0, sb_ammo[1]);
1014 else if (cl.items & RIT_ROCKETS)
1015 Sbar_DrawPic (224, 0, sb_ammo[2]);
1016 else if (cl.items & RIT_CELLS)
1017 Sbar_DrawPic (224, 0, sb_ammo[3]);
1018 else if (cl.items & RIT_LAVA_NAILS)
1019 Sbar_DrawPic (224, 0, rsb_ammo[0]);
1020 else if (cl.items & RIT_PLASMA_AMMO)
1021 Sbar_DrawPic (224, 0, rsb_ammo[1]);
1022 else if (cl.items & RIT_MULTI_ROCKETS)
1023 Sbar_DrawPic (224, 0, rsb_ammo[2]);
1027 if (cl.items & IT_SHELLS)
1028 Sbar_DrawPic (224, 0, sb_ammo[0]);
1029 else if (cl.items & IT_NAILS)
1030 Sbar_DrawPic (224, 0, sb_ammo[1]);
1031 else if (cl.items & IT_ROCKETS)
1032 Sbar_DrawPic (224, 0, sb_ammo[2]);
1033 else if (cl.items & IT_CELLS)
1034 Sbar_DrawPic (224, 0, sb_ammo[3]);
1037 Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3,
1038 cl.stats[STAT_AMMO] <= 10);
1041 if (vid.width > 320) {
1042 if (cl.gametype == GAME_DEATHMATCH)
1043 Sbar_MiniDeathmatchOverlay ();
1047 //=============================================================================
1051 Sbar_IntermissionNumber
1055 void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
1061 l = Sbar_itoa (num, str);
1075 Draw_TransPic (x,y,sb_nums[color][frame]);
1083 Sbar_DeathmatchOverlay
1087 void Sbar_DeathmatchOverlay (void)
1090 int i, k, l, top, bottom, x, y, total, n, minutes, tens, units, fph;
1094 scr_copyeverything = 1;
1097 pic = Draw_CachePic ("gfx/ranking.lmp");
1098 M_DrawPic ((320-pic->width)/2, 8, pic);
1104 l = scoreboardlines;
1106 x = ((vid.width - 320)>>1) - 140;
1108 for (i = 0;i < l;i++)
1116 top = s->colors & 0xf0;
1117 bottom = (s->colors & 15)<<4;
1118 top = Sbar_ColorForMap (top);
1119 bottom = Sbar_ColorForMap (bottom);
1121 Draw_Fill ( x, y+1, 88, 3, top);
1122 Draw_Fill ( x, y+4, 88, 3, bottom);
1124 total = cl.time - s->entertime;
1125 minutes = (int)total/60;
1126 n = total - minutes*60;
1130 fph = total ? (int) ((float) s->frags * 3600.0 / total) : 0;
1131 if (fph < -999) fph = -999;
1132 if (fph > 9999) fph = 9999;
1135 sprintf (num, "%c %4i:%4i %3i:%i%i %s", k == cl.viewentity - 1 ? 12 : ' ', (int) s->frags, fph, minutes, tens, units, s->name);
1136 Draw_String(x - 8, y, num, 0);
1144 Sbar_DeathmatchOverlay
1148 void Sbar_MiniDeathmatchOverlay (void)
1150 int i, l, k, top, bottom, x, y, fph, numlines;
1154 if (vid.width < 512 || !sb_lines)
1157 scr_copyeverything = 1;
1164 l = scoreboardlines;
1165 y = vid.height - sb_lines;
1166 numlines = sb_lines/8;
1171 for (i = 0; i < scoreboardlines; i++)
1172 if (fragsort[i] == cl.viewentity - 1)
1175 if (i == scoreboardlines) // we're not there
1177 else // figure out start
1180 if (i > scoreboardlines - numlines)
1181 i = scoreboardlines - numlines;
1186 for (;i < scoreboardlines && y < vid.height - 8;i++)
1194 top = Sbar_ColorForMap (s->colors & 0xf0);
1195 bottom = Sbar_ColorForMap ((s->colors & 15)<<4);
1197 Draw_Fill ( x, y+1, 72, 3, top);
1198 Draw_Fill ( x, y+4, 72, 3, bottom);
1200 fph = (cl.time - s->entertime) ? (int) ((float) s->frags * 3600.0 / (cl.time - s->entertime)) : 0;
1201 if (fph < -999) fph = -999;
1202 if (fph > 9999) fph = 9999;
1205 sprintf (num, "%c%4i:%4i%c %s", k == cl.viewentity - 1 ? 16 : ' ', (int) s->frags, fph, k == cl.viewentity - 1 ? 17 : ' ', s->name);
1206 Draw_String(x - 8, y, num, 0);
1214 Sbar_IntermissionOverlay
1218 void Sbar_IntermissionOverlay (void)
1224 scr_copyeverything = 1;
1227 if (cl.gametype == GAME_DEATHMATCH)
1229 Sbar_DeathmatchOverlay ();
1233 pic = Draw_CachePic ("gfx/complete.lmp");
1234 Draw_Pic (64, 24, pic);
1236 pic = Draw_CachePic ("gfx/inter.lmp");
1237 Draw_TransPic (0, 56, pic);
1240 dig = cl.completed_time/60;
1241 Sbar_IntermissionNumber (160, 64, dig, 3, 0);
1242 num = cl.completed_time - dig*60;
1243 Draw_TransPic (234,64,sb_colon);
1244 Draw_TransPic (246,64,sb_nums[0][num/10]);
1245 Draw_TransPic (266,64,sb_nums[0][num%10]);
1247 Sbar_IntermissionNumber (160, 104, cl.stats[STAT_SECRETS], 3, 0);
1248 Draw_TransPic (232,104,sb_slash);
1249 Sbar_IntermissionNumber (240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
1251 Sbar_IntermissionNumber (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
1252 Draw_TransPic (232,144,sb_slash);
1253 Sbar_IntermissionNumber (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
1264 void Sbar_FinaleOverlay (void)
1268 scr_copyeverything = 1;
1270 pic = Draw_CachePic ("gfx/finale.lmp");
1271 Draw_TransPic ( (vid.width-pic->width)/2, 16, pic);