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);
271 void Sbar_DrawTransPic (int x, int y, qpic_t *pic)
273 if (cl.gametype == GAME_DEATHMATCH)
274 Draw_TransPic (x /*+ ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
276 Draw_TransPic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic);
283 Draws one solid graphics character
286 void Sbar_DrawCharacter (int x, int y, int num)
288 if (cl.gametype == GAME_DEATHMATCH)
289 Draw_Character ( x /*+ ((vid.width - 320)>>1) */ + 4 , y + vid.height-SBAR_HEIGHT, num);
291 Draw_Character ( x + ((vid.width - 320)>>1) + 4 , y + vid.height-SBAR_HEIGHT, num);
299 void Sbar_DrawString (int x, int y, char *str)
301 if (cl.gametype == GAME_DEATHMATCH)
302 Draw_String (x /*+ ((vid.width - 320)>>1)*/, y+ vid.height-SBAR_HEIGHT, str, 0);
304 Draw_String (x + ((vid.width - 320)>>1), y+ vid.height-SBAR_HEIGHT, str, 0);
312 int Sbar_itoa (int num, char *buf)
326 for (pow10 = 10 ; num >= pow10 ; pow10 *= 10)
335 } while (pow10 != 1);
348 void Sbar_DrawNum (int x, int y, int num, int digits, int color)
354 l = Sbar_itoa (num, str);
368 Sbar_DrawTransPic (x,y,sb_nums[color][frame]);
374 //=============================================================================
376 int fragsort[MAX_SCOREBOARD];
378 char scoreboardtext[MAX_SCOREBOARD][20];
379 int scoreboardtop[MAX_SCOREBOARD];
380 int scoreboardbottom[MAX_SCOREBOARD];
381 int scoreboardcount[MAX_SCOREBOARD];
389 void Sbar_SortFrags (void)
395 for (i=0 ; i<cl.maxclients ; i++)
397 if (cl.scores[i].name[0])
399 fragsort[scoreboardlines] = i;
404 for (i=0 ; i<scoreboardlines ; i++)
405 for (j=0 ; j<scoreboardlines-1-i ; j++)
406 if (cl.scores[fragsort[j]].frags < cl.scores[fragsort[j+1]].frags)
409 fragsort[j] = fragsort[j+1];
414 int Sbar_ColorForMap (int m)
416 return m < 128 ? m + 8 : m + 8;
421 Sbar_UpdateScoreboard
424 void Sbar_UpdateScoreboard (void)
433 memset (scoreboardtext, 0, sizeof(scoreboardtext));
435 for (i=0 ; i<scoreboardlines; i++)
439 sprintf (&scoreboardtext[i][1], "%3i %s", s->frags, s->name);
441 top = s->colors & 0xf0;
442 bottom = (s->colors & 15) <<4;
443 scoreboardtop[i] = Sbar_ColorForMap (top);
444 scoreboardbottom[i] = Sbar_ColorForMap (bottom);
455 void Sbar_SoloScoreboard (void)
458 int minutes, seconds, tens, units;
461 sprintf (str,"Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
462 Sbar_DrawString (8, 4, str);
464 sprintf (str,"Secrets :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
465 Sbar_DrawString (8, 12, str);
468 minutes = cl.time / 60;
469 seconds = cl.time - 60*minutes;
471 units = seconds - 10*tens;
472 sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
473 Sbar_DrawString (184, 4, str);
476 l = strlen (cl.levelname);
477 Sbar_DrawString (232 - l*4, 12, cl.levelname);
485 void Sbar_DrawScoreboard (void)
487 Sbar_SoloScoreboard ();
488 if (cl.gametype == GAME_DEATHMATCH)
489 Sbar_DeathmatchOverlay ();
497 if (cl.gametype != GAME_DEATHMATCH)
499 Sbar_SoloScoreboard ();
503 Sbar_UpdateScoreboard ();
505 l = scoreboardlines <= 6 ? scoreboardlines : 6;
507 for (i=0 ; i<l ; i++)
512 s = &cl.scores[fragsort[i]];
517 top = s->colors & 0xf0;
518 bottom = (s->colors & 15)<<4;
519 top = Sbar_ColorForMap (top);
520 bottom = Sbar_ColorForMap (bottom);
522 Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y + vid.height - SBAR_HEIGHT, 28, 4, top);
523 Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y+4 + vid.height - SBAR_HEIGHT, 28, 4, bottom);
526 for (j=0 ; j<20 ; j++)
528 c = scoreboardtext[i][j];
529 if (c == 0 || c == ' ')
531 Sbar_DrawCharacter ( (x+j)*8, y, c);
537 //=============================================================================
544 void Sbar_DrawInventory (void)
553 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
554 Sbar_DrawPic (0, -24, rsb_invbar[0]);
556 Sbar_DrawPic (0, -24, rsb_invbar[1]);
560 Sbar_DrawPic (0, -24, sb_ibar);
564 for (i=0 ; i<7 ; i++)
566 if (cl.items & (IT_SHOTGUN<<i) )
568 time = cl.item_gettime[i];
569 flashon = (int)((cl.time - time)*10);
572 if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i) )
578 flashon = (flashon%5) + 2;
580 Sbar_DrawPic (i*24, -16, sb_weapons[flashon][i]);
583 // sb_updates = 0; // force update to remove flash
591 int grenadeflashing=0;
592 for (i=0 ; i<4 ; i++)
594 if (cl.items & (1<<hipweapons[i]) )
596 time = cl.item_gettime[hipweapons[i]];
597 flashon = (int)((cl.time - time)*10);
600 if ( cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i]) )
606 flashon = (flashon%5) + 2;
608 // check grenade launcher
611 if (cl.items & HIT_PROXIMITY_GUN)
616 Sbar_DrawPic (96, -16, hsb_weapons[flashon][2]);
622 if (cl.items & (IT_SHOTGUN<<4))
624 if (flashon && !grenadeflashing)
626 Sbar_DrawPic (96, -16, hsb_weapons[flashon][3]);
628 else if (!grenadeflashing)
630 Sbar_DrawPic (96, -16, hsb_weapons[0][3]);
634 Sbar_DrawPic (96, -16, hsb_weapons[flashon][4]);
637 Sbar_DrawPic (176 + (i*24), -16, hsb_weapons[flashon][i]);
639 // sb_updates = 0; // force update to remove flash
646 // check for powered up weapon.
647 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
651 if (cl.stats[STAT_ACTIVEWEAPON] == (RIT_LAVA_NAILGUN << i))
653 Sbar_DrawPic ((i+2)*24, -16, rsb_weapons[i]);
660 for (i=0 ; i<4 ; i++)
662 sprintf (num, "%3i",cl.stats[STAT_SHELLS+i] );
664 Sbar_DrawCharacter ( (6*i+1)*8 - 2, -24, 18 + num[0] - '0');
666 Sbar_DrawCharacter ( (6*i+2)*8 - 2, -24, 18 + num[1] - '0');
668 Sbar_DrawCharacter ( (6*i+3)*8 - 2, -24, 18 + num[2] - '0');
673 for (i=0 ; i<6 ; i++)
674 if (cl.items & (1<<(17+i)))
676 time = cl.item_gettime[17+i];
677 if (time && time > cl.time - 2 && flashon )
683 //MED 01/04/97 changed keys
684 if (!hipnotic || (i>1))
686 Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
689 // if (time && time > cl.time - 2)
692 //MED 01/04/97 added hipnotic items
696 for (i=0 ; i<2 ; i++)
697 if (cl.items & (1<<(24+i)))
699 time = cl.item_gettime[24+i];
700 if (time && time > cl.time - 2 && flashon )
706 Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
708 // if (time && time > cl.time - 2)
716 for (i=0 ; i<2 ; i++)
718 if (cl.items & (1<<(29+i)))
720 time = cl.item_gettime[29+i];
722 if (time && time > cl.time - 2 && flashon )
728 Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
731 // if (time && time > cl.time - 2)
739 for (i=0 ; i<4 ; i++)
741 if (cl.items & (1<<(28+i)))
743 time = cl.item_gettime[28+i];
744 if (time && time > cl.time - 2 && flashon )
749 Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]);
750 // if (time && time > cl.time - 2)
757 //=============================================================================
764 void Sbar_DrawFrags (void)
776 l = scoreboardlines <= 4 ? scoreboardlines : 4;
779 if (cl.gametype == GAME_DEATHMATCH)
782 xofs = (vid.width - 320)>>1;
783 y = vid.height - SBAR_HEIGHT - 23;
785 for (i=0 ; i<l ; i++)
793 top = s->colors & 0xf0;
794 bottom = (s->colors & 15)<<4;
795 top = Sbar_ColorForMap (top);
796 bottom = Sbar_ColorForMap (bottom);
798 Draw_Fill (xofs + x*8 + 10, y, 28, 4, top);
799 Draw_Fill (xofs + x*8 + 10, y+4, 28, 3, bottom);
803 sprintf (num, "%3i",f);
805 Sbar_DrawCharacter ( (x+1)*8 , -24, num[0]);
806 Sbar_DrawCharacter ( (x+2)*8 , -24, num[1]);
807 Sbar_DrawCharacter ( (x+3)*8 , -24, num[2]);
809 if (k == cl.viewentity - 1)
811 Sbar_DrawCharacter (x*8+2, -24, 16);
812 Sbar_DrawCharacter ( (x+4)*8-4, -24, 17);
818 //=============================================================================
826 void Sbar_DrawFace (void)
830 // PGM 01/19/97 - team color drawing
831 // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
833 (cl.maxclients != 1) &&
834 (teamplay.value>3) &&
842 s = &cl.scores[cl.viewentity - 1];
844 top = s->colors & 0xf0;
845 bottom = (s->colors & 15)<<4;
846 top = Sbar_ColorForMap (top);
847 bottom = Sbar_ColorForMap (bottom);
849 if (cl.gametype == GAME_DEATHMATCH)
852 xofs = ((vid.width - 320)>>1) + 113;
854 Sbar_DrawPic (112, 0, rsb_teambord);
855 Draw_Fill (xofs, vid.height-SBAR_HEIGHT+3, 22, 9, top);
856 Draw_Fill (xofs, vid.height-SBAR_HEIGHT+12, 22, 9, bottom);
860 sprintf (num, "%3i",f);
865 Sbar_DrawCharacter(109, 3, 18 + num[0] - '0');
867 Sbar_DrawCharacter(116, 3, 18 + num[1] - '0');
869 Sbar_DrawCharacter(123, 3, 18 + num[2] - '0');
873 Sbar_DrawCharacter ( 109, 3, num[0]);
874 Sbar_DrawCharacter ( 116, 3, num[1]);
875 Sbar_DrawCharacter ( 123, 3, num[2]);
880 // PGM 01/19/97 - team color drawing
882 if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY) )
883 == (IT_INVISIBILITY | IT_INVULNERABILITY) )
885 Sbar_DrawPic (112, 0, sb_face_invis_invuln);
888 if (cl.items & IT_QUAD)
890 Sbar_DrawPic (112, 0, sb_face_quad );
893 if (cl.items & IT_INVISIBILITY)
895 Sbar_DrawPic (112, 0, sb_face_invis );
898 if (cl.items & IT_INVULNERABILITY)
900 Sbar_DrawPic (112, 0, sb_face_invuln);
904 if (cl.stats[STAT_HEALTH] >= 100)
907 f = cl.stats[STAT_HEALTH] / 20;
909 if (cl.time <= cl.faceanimtime)
912 // sb_updates = 0; // make sure the anim gets drawn over
916 Sbar_DrawPic (112, 0, sb_faces[f][anim]);
924 void Sbar_Draw (void)
926 if (scr_con_current == vid.height)
927 return; // console is full screen
929 scr_copyeverything = 1;
935 Sbar_DrawInventory ();
936 if (cl.maxclients != 1)
940 if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
942 Sbar_DrawPic (0, 0, sb_scorebar);
943 Sbar_DrawScoreboard ();
948 Sbar_DrawPic (0, 0, sb_sbar);
950 // keys (hipnotic only)
951 //MED 01/04/97 moved keys here so they would not be overwritten
954 if (cl.items & IT_KEY1)
955 Sbar_DrawPic (209, 3, sb_items[0]);
956 if (cl.items & IT_KEY2)
957 Sbar_DrawPic (209, 12, sb_items[1]);
960 if (cl.items & IT_INVULNERABILITY)
962 Sbar_DrawNum (24, 0, 666, 3, 1);
963 Sbar_DrawPic (0, 0, draw_disc);
969 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3,
970 cl.stats[STAT_ARMOR] <= 25);
971 if (cl.items & RIT_ARMOR3)
972 Sbar_DrawPic (0, 0, sb_armor[2]);
973 else if (cl.items & RIT_ARMOR2)
974 Sbar_DrawPic (0, 0, sb_armor[1]);
975 else if (cl.items & RIT_ARMOR1)
976 Sbar_DrawPic (0, 0, sb_armor[0]);
980 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3
981 , cl.stats[STAT_ARMOR] <= 25);
982 if (cl.items & IT_ARMOR3)
983 Sbar_DrawPic (0, 0, sb_armor[2]);
984 else if (cl.items & IT_ARMOR2)
985 Sbar_DrawPic (0, 0, sb_armor[1]);
986 else if (cl.items & IT_ARMOR1)
987 Sbar_DrawPic (0, 0, sb_armor[0]);
995 Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3
996 , cl.stats[STAT_HEALTH] <= 25);
1001 if (cl.items & RIT_SHELLS)
1002 Sbar_DrawPic (224, 0, sb_ammo[0]);
1003 else if (cl.items & RIT_NAILS)
1004 Sbar_DrawPic (224, 0, sb_ammo[1]);
1005 else if (cl.items & RIT_ROCKETS)
1006 Sbar_DrawPic (224, 0, sb_ammo[2]);
1007 else if (cl.items & RIT_CELLS)
1008 Sbar_DrawPic (224, 0, sb_ammo[3]);
1009 else if (cl.items & RIT_LAVA_NAILS)
1010 Sbar_DrawPic (224, 0, rsb_ammo[0]);
1011 else if (cl.items & RIT_PLASMA_AMMO)
1012 Sbar_DrawPic (224, 0, rsb_ammo[1]);
1013 else if (cl.items & RIT_MULTI_ROCKETS)
1014 Sbar_DrawPic (224, 0, rsb_ammo[2]);
1018 if (cl.items & IT_SHELLS)
1019 Sbar_DrawPic (224, 0, sb_ammo[0]);
1020 else if (cl.items & IT_NAILS)
1021 Sbar_DrawPic (224, 0, sb_ammo[1]);
1022 else if (cl.items & IT_ROCKETS)
1023 Sbar_DrawPic (224, 0, sb_ammo[2]);
1024 else if (cl.items & IT_CELLS)
1025 Sbar_DrawPic (224, 0, sb_ammo[3]);
1028 Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3,
1029 cl.stats[STAT_AMMO] <= 10);
1032 if (vid.width > 320) {
1033 if (cl.gametype == GAME_DEATHMATCH)
1034 Sbar_MiniDeathmatchOverlay ();
1038 //=============================================================================
1042 Sbar_IntermissionNumber
1046 void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
1052 l = Sbar_itoa (num, str);
1066 Draw_TransPic (x,y,sb_nums[color][frame]);
1074 Sbar_DeathmatchOverlay
1078 void Sbar_DeathmatchOverlay (void)
1081 int i, k, l, top, bottom, x, y, total, n, minutes, tens, units, fph;
1085 scr_copyeverything = 1;
1088 pic = Draw_CachePic ("gfx/ranking.lmp");
1089 M_DrawPic ((320-pic->width)/2, 8, pic);
1095 l = scoreboardlines;
1097 x = ((vid.width - 320)>>1) - 140;
1099 for (i = 0;i < l;i++)
1107 top = s->colors & 0xf0;
1108 bottom = (s->colors & 15)<<4;
1109 top = Sbar_ColorForMap (top);
1110 bottom = Sbar_ColorForMap (bottom);
1112 Draw_Fill ( x, y+1, 88, 3, top);
1113 Draw_Fill ( x, y+4, 88, 3, bottom);
1115 total = cl.time - s->entertime;
1116 minutes = (int)total/60;
1117 n = total - minutes*60;
1121 fph = total ? (int) ((float) s->frags * 3600.0 / total) : 0;
1122 if (fph < -999) fph = -999;
1123 if (fph > 9999) fph = 9999;
1126 sprintf (num, "%c %4i:%4i %3i:%i%i %s", k == cl.viewentity - 1 ? 12 : ' ', (int) s->frags, fph, minutes, tens, units, s->name);
1127 Draw_String(x - 8, y, num, 0);
1135 Sbar_DeathmatchOverlay
1139 void Sbar_MiniDeathmatchOverlay (void)
1141 int i, l, k, top, bottom, x, y, fph, numlines;
1145 if (vid.width < 512 || !sb_lines)
1148 scr_copyeverything = 1;
1155 l = scoreboardlines;
1156 y = vid.height - sb_lines;
1157 numlines = sb_lines/8;
1162 for (i = 0; i < scoreboardlines; i++)
1163 if (fragsort[i] == cl.viewentity - 1)
1166 if (i == scoreboardlines) // we're not there
1168 else // figure out start
1171 if (i > scoreboardlines - numlines)
1172 i = scoreboardlines - numlines;
1177 for (;i < scoreboardlines && y < vid.height - 8;i++)
1185 top = Sbar_ColorForMap (s->colors & 0xf0);
1186 bottom = Sbar_ColorForMap ((s->colors & 15)<<4);
1188 Draw_Fill ( x, y+1, 72, 3, top);
1189 Draw_Fill ( x, y+4, 72, 3, bottom);
1191 fph = (cl.time - s->entertime) ? (int) ((float) s->frags * 3600.0 / (cl.time - s->entertime)) : 0;
1192 if (fph < -999) fph = -999;
1193 if (fph > 9999) fph = 9999;
1196 sprintf (num, "%c%4i:%4i%c %s", k == cl.viewentity - 1 ? 16 : ' ', (int) s->frags, fph, k == cl.viewentity - 1 ? 17 : ' ', s->name);
1197 Draw_String(x - 8, y, num, 0);
1205 Sbar_IntermissionOverlay
1209 void Sbar_IntermissionOverlay (void)
1215 scr_copyeverything = 1;
1218 if (cl.gametype == GAME_DEATHMATCH)
1220 Sbar_DeathmatchOverlay ();
1224 pic = Draw_CachePic ("gfx/complete.lmp");
1225 Draw_Pic (64, 24, pic);
1227 pic = Draw_CachePic ("gfx/inter.lmp");
1228 Draw_TransPic (0, 56, pic);
1231 dig = cl.completed_time/60;
1232 Sbar_IntermissionNumber (160, 64, dig, 3, 0);
1233 num = cl.completed_time - dig*60;
1234 Draw_TransPic (234,64,sb_colon);
1235 Draw_TransPic (246,64,sb_nums[0][num/10]);
1236 Draw_TransPic (266,64,sb_nums[0][num%10]);
1238 Sbar_IntermissionNumber (160, 104, cl.stats[STAT_SECRETS], 3, 0);
1239 Draw_TransPic (232,104,sb_slash);
1240 Sbar_IntermissionNumber (240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
1242 Sbar_IntermissionNumber (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
1243 Draw_TransPic (232,144,sb_slash);
1244 Sbar_IntermissionNumber (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
1255 void Sbar_FinaleOverlay (void)
1259 scr_copyeverything = 1;
1261 pic = Draw_CachePic ("gfx/finale.lmp");
1262 Draw_TransPic ( (vid.width-pic->width)/2, 16, pic);