git-svn-id: http://bladebattles.com/kurok/SVN@11 20cd92bb-ff49-0410-b73e-96a06e42c3b9
[kurok.git] / sbar.c
blobc30745fca83015b6386edf655199b790c1bdacfb
1 /*
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
22 #include "quakedef.h"
23 #include <pspgu.h>
25 int sb_updates; // if >= vid.numpages, no update needed
27 #define STAT_MINUS 10 // num frame for '-' stats digit
28 qpic_t *sb_nums[2][11];
29 qpic_t *sb_colon, *sb_slash;
30 qpic_t *sb_ibar;
31 qpic_t *sb_sbar;
32 qpic_t *sb_scorebar;
34 qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
35 qpic_t *sb_ammo[4];
36 qpic_t *sb_sigil[4];
37 qpic_t *sb_armor[3];
38 qpic_t *sb_items[32];
40 qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive
41 // 0 is static, 1 is temporary animation
42 qpic_t *sb_face_invis;
43 qpic_t *sb_face_quad;
44 qpic_t *sb_face_invuln;
45 qpic_t *sb_face_invis_invuln;
47 qboolean sb_showscores;
49 int sb_lines; // scan lines to draw
51 qpic_t *ksb_ammo[1];
53 qpic_t *rsb_invbar[2];
54 qpic_t *rsb_weapons[5];
55 qpic_t *rsb_items[2];
56 qpic_t *rsb_ammo[3];
57 qpic_t *rsb_teambord; // PGM 01/19/97 - team color border
59 //MED 01/04/97 added two more weapons + 3 alternates for grenade launcher
60 qpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
61 //MED 01/04/97 added array to simplify weapon parsing
62 int hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT};
63 //MED 01/04/97 added hipnotic items array
64 qpic_t *hsb_items[2];
66 void Sbar_MiniDeathmatchOverlay (void);
67 void Sbar_TimeOverlay (void);
68 void Sbar_DeathmatchOverlay (void);
69 void Sbar_DeathmatchOverlay2 (void);
70 void M_DrawPic (int x, int y, qpic_t *pic);
73 ===============
74 Sbar_ShowScores
76 Tab key down
77 ===============
79 void Sbar_ShowScores (void)
81 if (sb_showscores)
82 return;
83 sb_showscores = true;
84 sb_updates = 0;
88 ===============
89 Sbar_DontShowScores
91 Tab key up
92 ===============
94 void Sbar_DontShowScores (void)
96 sb_showscores = false;
97 sb_updates = 0;
101 ===============
102 Sbar_Changed
103 ===============
105 void Sbar_Changed (void)
107 sb_updates = 0; // update next frame
111 ===============
112 Sbar_Init
113 ===============
115 void Sbar_Init (void)
117 int i;
119 for (i=0 ; i<10 ; i++)
121 sb_nums[0][i] = Draw_PicFromWad (va("num_%i",i));
122 sb_nums[1][i] = Draw_PicFromWad (va("anum_%i",i));
125 sb_nums[0][10] = Draw_PicFromWad ("num_minus");
126 sb_nums[1][10] = Draw_PicFromWad ("anum_minus");
128 sb_colon = Draw_PicFromWad ("num_colon");
129 sb_slash = Draw_PicFromWad ("num_slash");
131 sb_weapons[0][0] = Draw_PicFromWad ("inv_shotgun");
132 sb_weapons[0][1] = Draw_PicFromWad ("inv_sshotgun");
133 sb_weapons[0][2] = Draw_PicFromWad ("inv_nailgun");
134 sb_weapons[0][3] = Draw_PicFromWad ("inv_snailgun");
135 sb_weapons[0][4] = Draw_PicFromWad ("inv_rlaunch");
136 sb_weapons[0][5] = Draw_PicFromWad ("inv_srlaunch");
137 sb_weapons[0][6] = Draw_PicFromWad ("inv_lightng");
139 sb_weapons[1][0] = Draw_PicFromWad ("inv2_shotgun");
140 sb_weapons[1][1] = Draw_PicFromWad ("inv2_sshotgun");
141 sb_weapons[1][2] = Draw_PicFromWad ("inv2_nailgun");
142 sb_weapons[1][3] = Draw_PicFromWad ("inv2_snailgun");
143 sb_weapons[1][4] = Draw_PicFromWad ("inv2_rlaunch");
144 sb_weapons[1][5] = Draw_PicFromWad ("inv2_srlaunch");
145 sb_weapons[1][6] = Draw_PicFromWad ("inv2_lightng");
147 for (i=0 ; i<5 ; i++)
149 sb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_shotgun",i+1));
150 sb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_sshotgun",i+1));
151 sb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_nailgun",i+1));
152 sb_weapons[2+i][3] = Draw_PicFromWad (va("inva%i_snailgun",i+1));
153 sb_weapons[2+i][4] = Draw_PicFromWad (va("inva%i_rlaunch",i+1));
154 sb_weapons[2+i][5] = Draw_PicFromWad (va("inva%i_srlaunch",i+1));
155 sb_weapons[2+i][6] = Draw_PicFromWad (va("inva%i_lightng",i+1));
158 sb_ammo[0] = Draw_PicFromWad ("sb_shells");
159 sb_ammo[1] = Draw_PicFromWad ("sb_nails");
160 sb_ammo[2] = Draw_PicFromWad ("sb_rocket");
161 sb_ammo[3] = Draw_PicFromWad ("sb_cells");
163 sb_armor[0] = Draw_PicFromWad ("sb_armor1");
164 sb_armor[1] = Draw_PicFromWad ("sb_armor2");
165 sb_armor[2] = Draw_PicFromWad ("sb_armor3");
167 sb_items[0] = Draw_PicFromWad ("sb_key1");
168 sb_items[1] = Draw_PicFromWad ("sb_key2");
169 sb_items[2] = Draw_PicFromWad ("sb_invis");
170 sb_items[3] = Draw_PicFromWad ("sb_invuln");
171 sb_items[4] = Draw_PicFromWad ("sb_suit");
172 sb_items[5] = Draw_PicFromWad ("sb_quad");
174 sb_sigil[0] = Draw_PicFromWad ("sb_sigil1");
175 sb_sigil[1] = Draw_PicFromWad ("sb_sigil2");
176 sb_sigil[2] = Draw_PicFromWad ("sb_sigil3");
177 sb_sigil[3] = Draw_PicFromWad ("sb_sigil4");
179 sb_faces[4][0] = Draw_PicFromWad ("face1");
180 sb_faces[4][1] = Draw_PicFromWad ("face_p1");
181 sb_faces[3][0] = Draw_PicFromWad ("face2");
182 sb_faces[3][1] = Draw_PicFromWad ("face_p2");
183 sb_faces[2][0] = Draw_PicFromWad ("face3");
184 sb_faces[2][1] = Draw_PicFromWad ("face_p3");
185 sb_faces[1][0] = Draw_PicFromWad ("face4");
186 sb_faces[1][1] = Draw_PicFromWad ("face_p4");
187 sb_faces[0][0] = Draw_PicFromWad ("face5");
188 sb_faces[0][1] = Draw_PicFromWad ("face_p5");
190 sb_face_invis = Draw_PicFromWad ("face_invis");
191 sb_face_invuln = Draw_PicFromWad ("face_invul2");
192 sb_face_invis_invuln = Draw_PicFromWad ("face_inv2");
193 sb_face_quad = Draw_PicFromWad ("face_quad");
195 Cmd_AddCommand ("+showscores", Sbar_ShowScores);
196 Cmd_AddCommand ("-showscores", Sbar_DontShowScores);
198 sb_sbar = Draw_PicFromWad ("sbar");
199 sb_ibar = Draw_PicFromWad ("ibar");
200 sb_scorebar = Draw_PicFromWad ("scorebar");
202 //MED 01/04/97 added new hipnotic weapons
203 if (hipnotic)
205 hsb_weapons[0][0] = Draw_PicFromWad ("inv_laser");
206 hsb_weapons[0][1] = Draw_PicFromWad ("inv_mjolnir");
207 hsb_weapons[0][2] = Draw_PicFromWad ("inv_gren_prox");
208 hsb_weapons[0][3] = Draw_PicFromWad ("inv_prox_gren");
209 hsb_weapons[0][4] = Draw_PicFromWad ("inv_prox");
211 hsb_weapons[1][0] = Draw_PicFromWad ("inv2_laser");
212 hsb_weapons[1][1] = Draw_PicFromWad ("inv2_mjolnir");
213 hsb_weapons[1][2] = Draw_PicFromWad ("inv2_gren_prox");
214 hsb_weapons[1][3] = Draw_PicFromWad ("inv2_prox_gren");
215 hsb_weapons[1][4] = Draw_PicFromWad ("inv2_prox");
217 for (i=0 ; i<5 ; i++)
219 hsb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_laser",i+1));
220 hsb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_mjolnir",i+1));
221 hsb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_gren_prox",i+1));
222 hsb_weapons[2+i][3] = Draw_PicFromWad (va("inva%i_prox_gren",i+1));
223 hsb_weapons[2+i][4] = Draw_PicFromWad (va("inva%i_prox",i+1));
226 hsb_items[0] = Draw_PicFromWad ("sb_wsuit");
227 hsb_items[1] = Draw_PicFromWad ("sb_eshld");
230 if (rogue)
232 rsb_invbar[0] = Draw_PicFromWad ("r_invbar1");
233 rsb_invbar[1] = Draw_PicFromWad ("r_invbar2");
235 rsb_weapons[0] = Draw_PicFromWad ("r_lava");
236 rsb_weapons[1] = Draw_PicFromWad ("r_superlava");
237 rsb_weapons[2] = Draw_PicFromWad ("r_gren");
238 rsb_weapons[3] = Draw_PicFromWad ("r_multirock");
239 rsb_weapons[4] = Draw_PicFromWad ("r_plasma");
241 rsb_items[0] = Draw_PicFromWad ("r_shield1");
242 rsb_items[1] = Draw_PicFromWad ("r_agrav1");
244 // PGM 01/19/97 - team color border
245 rsb_teambord = Draw_PicFromWad ("r_teambord");
246 // PGM 01/19/97 - team color border
248 rsb_ammo[0] = Draw_PicFromWad ("r_ammolava");
249 rsb_ammo[1] = Draw_PicFromWad ("r_ammomulti");
250 rsb_ammo[2] = Draw_PicFromWad ("r_ammoplasma");
253 if (kurok)
255 ksb_ammo[0] = Draw_PicFromWad ("sb_50cal");
260 //=============================================================================
262 // drawing routines are relative to the status bar location
265 =============
266 Sbar_DrawPic
267 =============
269 void Sbar_DrawPic (int x, int y, qpic_t *pic)
271 if(kurok)
272 Draw_Pic (x /* + ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
273 else
275 if (cl.gametype == GAME_DEATHMATCH)
276 Draw_Pic (x /* + ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
277 else
278 Draw_Pic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic);
283 =============
284 Sbar_DrawTransPic
285 =============
287 void Sbar_DrawTransPic (int x, int y, qpic_t *pic)
289 if(kurok)
290 Draw_TransPic (x /*+ ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
291 else
293 if (cl.gametype == GAME_DEATHMATCH)
294 Draw_TransPic (x /*+ ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
295 else
296 Draw_TransPic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic);
301 ================
302 Sbar_DrawCharacter
304 Draws one solid graphics character
305 ================
307 void Sbar_DrawCharacter (int x, int y, int num)
309 if(kurok)
310 Draw_Character ( x /*+ ((vid.width - 320)>>1) */ + 4 , y + vid.height-SBAR_HEIGHT, num);
311 else
313 if (cl.gametype == GAME_DEATHMATCH)
314 Draw_Character ( x /*+ ((vid.width - 320)>>1) */ + 4 , y + vid.height-SBAR_HEIGHT, num);
315 else
316 Draw_Character ( x + ((vid.width - 320)>>1) + 4 , y + vid.height-SBAR_HEIGHT, num);
321 ================
322 Sbar_DrawString
323 ================
325 void Sbar_DrawString (int x, int y, char *str)
327 if(kurok)
328 Draw_String (x /*+ ((vid.width - 320)>>1)*/, y + vid.height-SBAR_HEIGHT, str);
329 else
331 if (cl.gametype == GAME_DEATHMATCH)
332 Draw_String (x /*+ ((vid.width - 320)>>1)*/, y+ vid.height-SBAR_HEIGHT, str);
333 else
334 Draw_String (x + ((vid.width - 320)>>1), y+ vid.height-SBAR_HEIGHT, str);
339 ===============
340 Sbar_DrawScrollString -- johnfitz
342 scroll the string inside a glscissor region
343 ===============
345 void Sbar_DrawScrollString (int x, int y, int width, char* str)
347 int len, ofs;
349 y += vid.height-SBAR_HEIGHT;
350 // if (cl.gametype != GAME_DEATHMATCH) x += ((vid.width - 320)>>1);
352 len = strlen(str)*8 + 40;
353 ofs = ((int)(realtime*30))%len;
355 // sceGuEnable(GU_SCISSOR_TEST);
356 // sceGuViewport (x, y, glwidth, glheight);
357 // sceGuScissor (x, vid.height - y - 8, 160, 8);
359 Draw_String (x - ofs, y, str);
360 Draw_String (x - ofs + len - 32, y, "///");
361 Draw_String (x - ofs + len, y, str);
363 // sceGuDisable(GU_SCISSOR_TEST);
367 =============
368 Sbar_itoa
369 =============
371 int Sbar_itoa (int num, char *buf)
373 char *str;
374 int pow10;
375 int dig;
377 str = buf;
379 if (num < 0)
381 *str++ = '-';
382 num = -num;
385 for (pow10 = 10 ; num >= pow10 ; pow10 *= 10)
390 pow10 /= 10;
391 dig = num/pow10;
392 *str++ = '0'+dig;
393 num -= dig*pow10;
394 } while (pow10 != 1);
396 *str = 0;
398 return str-buf;
403 =============
404 Sbar_DrawNum
405 =============
407 void Sbar_DrawNum (int x, int y, int num, int digits, int color)
409 char str[12];
410 char *ptr;
411 int l, frame;
413 l = Sbar_itoa (num, str);
414 ptr = str;
415 if (l > digits)
416 ptr += (l-digits);
418 if (l < digits)
420 if (kurok)
421 x += (digits-l)*16;
422 else
423 x += (digits-l)*24;
426 while (*ptr)
428 if (*ptr == '-')
429 frame = STAT_MINUS;
430 else
431 frame = *ptr -'0';
433 Sbar_DrawTransPic (x,y,sb_nums[color][frame]);
435 if (kurok)
436 x += 16;
437 else
438 x += 24;
439 ptr++;
444 =============
445 Sbar_DrawNum2
446 =============
448 void Sbar_DrawNum2 (int x, int y, int num, int digits, int color)
450 char str[12];
451 char *ptr;
452 int l, frame;
454 l = Sbar_itoa (num, str);
455 ptr = str;
456 if (l > digits)
457 ptr += (l-digits);
459 if (l < digits)
460 x += (digits-l)*0;
462 while (*ptr)
464 if (*ptr == '-')
465 frame = STAT_MINUS;
466 else
467 frame = *ptr -'0';
469 Sbar_DrawTransPic (x,y,sb_nums[color][frame]);
471 x += 16;
472 ptr++;
476 //=============================================================================
478 int fragsort[MAX_SCOREBOARD];
480 char scoreboardtext[MAX_SCOREBOARD][20];
481 int scoreboardtop[MAX_SCOREBOARD];
482 int scoreboardbottom[MAX_SCOREBOARD];
483 int scoreboardcount[MAX_SCOREBOARD];
484 int scoreboardlines;
487 ===============
488 Sbar_SortFrags
489 ===============
491 void Sbar_SortFrags (void)
493 int i, j, k;
495 // sort by frags
496 scoreboardlines = 0;
497 for (i=0 ; i<cl.maxclients ; i++)
499 if (cl.scores[i].name[0])
501 fragsort[scoreboardlines] = i;
502 scoreboardlines++;
506 for (i=0 ; i<scoreboardlines ; i++)
507 for (j=0 ; j<scoreboardlines-1-i ; j++)
508 if (cl.scores[fragsort[j]].frags < cl.scores[fragsort[j+1]].frags)
510 k = fragsort[j];
511 fragsort[j] = fragsort[j+1];
512 fragsort[j+1] = k;
516 int Sbar_ColorForMap (int m)
518 return m < 128 ? m + 8 : m + 8;
522 ===============
523 Sbar_UpdateScoreboard
524 ===============
526 void Sbar_UpdateScoreboard (void)
528 int i, k;
529 int top, bottom;
530 scoreboard_t *s;
532 Sbar_SortFrags ();
534 // draw the text
535 memset (scoreboardtext, 0, sizeof(scoreboardtext));
537 for (i=0 ; i<scoreboardlines; i++)
539 k = fragsort[i];
540 s = &cl.scores[k];
541 sprintf (&scoreboardtext[i][1], "%3i %s", s->frags, s->name);
543 top = s->colors & 0xf0;
544 bottom = (s->colors & 15) <<4;
545 scoreboardtop[i] = Sbar_ColorForMap (top);
546 scoreboardbottom[i] = Sbar_ColorForMap (bottom);
553 ===============
554 Sbar_SoloScoreboard
555 ===============
557 void Sbar_SoloScoreboard (void)
559 char str[80];
560 int minutes, seconds, tens, units;
561 int len;
563 if(kurok)
564 sprintf (str,"Enemies :%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
565 else
566 sprintf (str,"Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
567 Sbar_DrawString (8, 4, str);
569 if(kurok)
570 sprintf (str,"Objectives :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
571 else
572 sprintf (str,"Secrets :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
573 Sbar_DrawString (8, 12, str);
575 // time
576 minutes = cl.time / 60;
577 seconds = cl.time - 60*minutes;
578 tens = seconds / 10;
579 units = seconds - 10*tens;
580 sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
581 Sbar_DrawString (184, 4, str);
583 //johnfitz -- scroll long levelnames
584 len = strlen (cl.levelname);
585 #ifdef PSP_HARDWARE_VIDEO
586 if (len > 22)
587 Sbar_DrawScrollString (184, 12, 160, cl.levelname);
588 else
589 #endif
590 // Sbar_DrawString (232 - len*4, 12, cl.levelname);
591 Sbar_DrawString (184, 12, cl.levelname);
592 //johnfitz
594 // draw level name
595 // l = strlen (cl.levelname);
596 // Sbar_DrawString (232 - l*4, 12, cl.levelname);
600 ===============
601 Sbar_DrawScoreboard
602 ===============
604 void Sbar_DrawScoreboard (void)
606 Sbar_SoloScoreboard ();
607 if (cl.gametype == GAME_DEATHMATCH)
608 Sbar_DeathmatchOverlay ();
609 #if 0
610 int i, j, c;
611 int x, y;
612 int l;
613 int top, bottom;
614 scoreboard_t *s;
616 if (cl.gametype != GAME_DEATHMATCH)
618 Sbar_SoloScoreboard ();
619 return;
622 Sbar_UpdateScoreboard ();
624 l = scoreboardlines <= 6 ? scoreboardlines : 6;
626 for (i=0 ; i<l ; i++)
628 x = 20*(i&1);
629 y = i/2 * 8;
631 s = &cl.scores[fragsort[i]];
632 if (!s->name[0])
633 continue;
635 // draw background
636 top = s->colors & 0xf0;
637 bottom = (s->colors & 15)<<4;
638 top = Sbar_ColorForMap (top);
639 bottom = Sbar_ColorForMap (bottom);
641 Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y + vid.height - SBAR_HEIGHT, 28, 4, top);
642 Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y+4 + vid.height - SBAR_HEIGHT, 28, 4, bottom);
644 // draw text
645 for (j=0 ; j<20 ; j++)
647 c = scoreboardtext[i][j];
648 if (c == 0 || c == ' ')
649 continue;
650 Sbar_DrawCharacter ( (x+j)*8, y, c);
653 #endif
656 //=============================================================================
659 ===============
660 Sbar_DrawInventory
661 ===============
663 void Sbar_DrawInventory (void)
665 int i;
666 char num[6];
667 float time;
668 int flashon;
670 if (rogue)
672 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
673 Sbar_DrawPic (0, -24, rsb_invbar[0]);
674 else
675 Sbar_DrawPic (0, -24, rsb_invbar[1]);
677 else if (!kurok)
678 Sbar_DrawPic (0, -24, sb_ibar);
680 // weapons
681 if (!kurok)
683 for (i=0 ; i<7 ; i++)
685 if (cl.items & (IT_SHOTGUN<<i) )
687 time = cl.item_gettime[i];
688 flashon = (int)((cl.time - time)*10);
689 if (flashon >= 10)
691 if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i) )
692 flashon = 1;
693 else
694 flashon = 0;
696 else
697 flashon = (flashon%5) + 2;
699 Sbar_DrawPic (i*24, -16, sb_weapons[flashon][i]);
701 if (flashon > 1)
702 sb_updates = 0; // force update to remove flash
706 // MED 01/04/97
707 // hipnotic weapons
708 if (hipnotic)
710 int grenadeflashing=0;
711 for (i=0 ; i<4 ; i++)
713 if (cl.items & (1<<hipweapons[i]) )
715 time = cl.item_gettime[hipweapons[i]];
716 flashon = (int)((cl.time - time)*10);
717 if (flashon >= 10)
719 if ( cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i]) )
720 flashon = 1;
721 else
722 flashon = 0;
724 else
725 flashon = (flashon%5) + 2;
727 // check grenade launcher
728 if (i==2)
730 if (cl.items & HIT_PROXIMITY_GUN)
732 if (flashon)
734 grenadeflashing = 1;
735 Sbar_DrawPic (96, -16, hsb_weapons[flashon][2]);
739 else if (i==3)
741 if (cl.items & (IT_SHOTGUN<<4))
743 if (flashon && !grenadeflashing)
745 Sbar_DrawPic (96, -16, hsb_weapons[flashon][3]);
747 else if (!grenadeflashing)
749 Sbar_DrawPic (96, -16, hsb_weapons[0][3]);
752 else
753 Sbar_DrawPic (96, -16, hsb_weapons[flashon][4]);
755 else
756 Sbar_DrawPic (176 + (i*24), -16, hsb_weapons[flashon][i]);
757 if (flashon > 1)
758 sb_updates = 0; // force update to remove flash
763 if (rogue)
765 // check for powered up weapon.
766 if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
768 for (i=0;i<5;i++)
770 if (cl.stats[STAT_ACTIVEWEAPON] == (RIT_LAVA_NAILGUN << i))
772 Sbar_DrawPic ((i+2)*24, -16, rsb_weapons[i]);
778 if (!kurok)
781 // ammo counts
782 for (i=0 ; i<4 ; i++)
784 sprintf (num, "%3i",cl.stats[STAT_SHELLS+i] );
785 if (num[0] != ' ')
786 Sbar_DrawCharacter ( (6*i+1)*8 - 2, -24, 18 + num[0] - '0');
787 if (num[1] != ' ')
788 Sbar_DrawCharacter ( (6*i+2)*8 - 2, -24, 18 + num[1] - '0');
789 if (num[2] != ' ')
790 Sbar_DrawCharacter ( (6*i+3)*8 - 2, -24, 18 + num[2] - '0');
793 flashon = 0;
795 // items
796 for (i=0 ; i<6 ; i++)
797 if (cl.items & (1<<(17+i)))
799 time = cl.item_gettime[17+i];
800 if (time && time > cl.time - 2 && flashon )
801 { // flash frame
802 sb_updates = 0;
804 else
806 //MED 01/04/97 changed keys
807 if (!hipnotic || (i>1))
809 if(kurok)
810 Sbar_DrawPic (80 + i*16, 0, sb_items[i]);
811 else
812 Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
815 if (time && time > cl.time - 2)
816 sb_updates = 0;
819 //MED 01/04/97 added hipnotic items
820 // hipnotic items
821 if (hipnotic)
823 for (i=0 ; i<2 ; i++)
824 if (cl.items & (1<<(24+i)))
826 time = cl.item_gettime[24+i];
827 if (time && time > cl.time - 2 && flashon )
828 { // flash frame
829 sb_updates = 0;
831 else
833 Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
835 if (time && time > cl.time - 2)
836 sb_updates = 0;
840 if (rogue)
842 // new rogue items
843 for (i=0 ; i<2 ; i++)
845 if (cl.items & (1<<(29+i)))
847 time = cl.item_gettime[29+i];
849 if (time && time > cl.time - 2 && flashon )
850 { // flash frame
851 sb_updates = 0;
853 else
855 Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
858 if (time && time > cl.time - 2)
859 sb_updates = 0;
864 if (kurok)
867 // new kurok items
868 for (i=0 ; i<2 ; i++)
870 if (cl.items & (1<<(29+i)))
872 time = cl.item_gettime[29+i];
874 if (time && time > cl.time - 2 && flashon )
875 { // flash frame
876 sb_updates = 0;
878 else
880 Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
883 if (time && time > cl.time - 2)
884 sb_updates = 0;
890 else
892 // sigils
893 for (i=0 ; i<4 ; i++)
895 if (cl.items & (1<<(28+i)))
897 time = cl.item_gettime[28+i];
898 if (time && time > cl.time - 2 && flashon )
899 { // flash frame
900 sb_updates = 0;
902 else
903 Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]);
904 if (time && time > cl.time - 2)
905 sb_updates = 0;
911 //=============================================================================
914 ===============
915 Sbar_DrawFrags
916 ===============
918 void Sbar_DrawFrags (void)
920 int i, k, l;
921 int top, bottom;
922 int x, y, f;
923 int xofs;
924 char num[12];
925 scoreboard_t *s;
927 Sbar_SortFrags ();
929 // draw the text
930 l = scoreboardlines <= 4 ? scoreboardlines : 4;
932 x = 23;
934 if (kurok)
936 xofs = 0;
938 else
940 if (cl.gametype == GAME_DEATHMATCH)
941 xofs = 0;
942 else
943 xofs = (vid.width - 320)>>1;
946 y = vid.height - SBAR_HEIGHT - 23;
948 for (i=0 ; i<l ; i++)
950 k = fragsort[i];
951 s = &cl.scores[k];
952 if (!s->name[0])
953 continue;
955 // draw background
956 top = s->colors & 0xf0;
957 bottom = (s->colors & 15)<<4;
958 top = Sbar_ColorForMap (top);
959 bottom = Sbar_ColorForMap (bottom);
961 Draw_Fill (xofs + x*8 + 10, y, 28, 4, top);
962 Draw_Fill (xofs + x*8 + 10, y+4, 28, 3, bottom);
964 // draw number
965 f = s->frags;
966 sprintf (num, "%3i",f);
968 Sbar_DrawCharacter ( (x+1)*8 , -24, num[0]);
969 Sbar_DrawCharacter ( (x+2)*8 , -24, num[1]);
970 Sbar_DrawCharacter ( (x+3)*8 , -24, num[2]);
972 if (k == cl.viewentity - 1)
974 Sbar_DrawCharacter (x*8+2, -24, 16);
975 Sbar_DrawCharacter ( (x+4)*8-4, -24, 17);
977 x+=4;
981 //=============================================================================
985 ===============
986 Sbar_DrawFace
987 ===============
989 void Sbar_DrawFace (void)
991 int f, anim;
993 // PGM 01/19/97 - team color drawing
994 // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
995 if (rogue &&
996 (cl.maxclients != 1) &&
997 (teamplay.value>3) &&
998 (teamplay.value<7))
1000 int top, bottom;
1001 int xofs;
1002 char num[12];
1003 scoreboard_t *s;
1005 s = &cl.scores[cl.viewentity - 1];
1006 // draw background
1007 top = s->colors & 0xf0;
1008 bottom = (s->colors & 15)<<4;
1009 top = Sbar_ColorForMap (top);
1010 bottom = Sbar_ColorForMap (bottom);
1012 if (kurok)
1014 xofs = 113;
1016 else
1018 if (cl.gametype == GAME_DEATHMATCH)
1019 xofs = 113;
1020 else
1021 xofs = ((vid.width - 320)>>1) + 113;
1024 Sbar_DrawPic (112, 0, rsb_teambord);
1025 Draw_Fill (xofs, vid.height-SBAR_HEIGHT+3, 22, 9, top);
1026 Draw_Fill (xofs, vid.height-SBAR_HEIGHT+12, 22, 9, bottom);
1028 // draw number
1029 f = s->frags;
1030 sprintf (num, "%3i",f);
1032 if (top==8)
1034 if (num[0] != ' ')
1035 Sbar_DrawCharacter(109, 3, 18 + num[0] - '0');
1036 if (num[1] != ' ')
1037 Sbar_DrawCharacter(116, 3, 18 + num[1] - '0');
1038 if (num[2] != ' ')
1039 Sbar_DrawCharacter(123, 3, 18 + num[2] - '0');
1041 else
1043 Sbar_DrawCharacter ( 109, 3, num[0]);
1044 Sbar_DrawCharacter ( 116, 3, num[1]);
1045 Sbar_DrawCharacter ( 123, 3, num[2]);
1048 return;
1050 // PGM 01/19/97 - team color drawing
1052 if (!kurok)
1055 if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY) )
1056 == (IT_INVISIBILITY | IT_INVULNERABILITY) )
1058 if (kurok)
1059 Sbar_DrawPic (8, 0, sb_face_invis_invuln);
1060 else
1061 Sbar_DrawPic (112, 0, sb_face_invis_invuln);
1062 return;
1064 if (cl.items & IT_QUAD)
1066 if (kurok)
1067 Sbar_DrawPic (8, 0, sb_face_quad );
1068 else
1069 Sbar_DrawPic (112, 0, sb_face_quad );
1070 return;
1072 if (cl.items & IT_INVISIBILITY)
1074 if (kurok)
1075 Sbar_DrawPic (8, 0, sb_face_invis );
1076 else
1077 Sbar_DrawPic (112, 0, sb_face_invis );
1078 return;
1080 if (cl.items & IT_INVULNERABILITY)
1082 if (kurok)
1083 Sbar_DrawPic (8, 0, sb_face_invuln);
1084 else
1085 Sbar_DrawPic (112, 0, sb_face_invuln);
1086 return;
1090 if (cl.stats[STAT_HEALTH] >= 100)
1091 f = 4;
1092 else
1093 f = cl.stats[STAT_HEALTH] / 20;
1095 if (cl.time <= cl.faceanimtime)
1097 anim = 1;
1098 sb_updates = 0; // make sure the anim gets drawn over
1100 else
1101 anim = 0;
1103 if (kurok)
1104 Sbar_DrawPic (8, 0, sb_faces[f][anim]);
1105 else
1106 Sbar_DrawPic (112, 0, sb_faces[f][anim]);
1111 ===============
1112 Sbar_Draw
1113 ===============
1115 void Sbar_Draw (void)
1117 extern cvar_t cl_gunpitch;
1119 if (scr_con_current == vid.height)
1120 return; // console is full screen
1122 if (scr_viewsize.value == 130)
1123 return;
1125 if (!kurok)
1127 if (sb_updates >= vid.numpages)
1128 return;
1130 scr_copyeverything = 1;
1132 sb_updates++;
1134 if (sb_lines && vid.width > 320)
1135 Draw_TileClear (0, vid.height - sb_lines, vid.width, sb_lines);
1137 if (kurok)
1139 if (scr_viewsize.value < 130)
1141 Sbar_DrawInventory ();
1142 if (cl.maxclients != 1)
1144 if (cl.stats[STAT_HEALTH] > 0)
1146 Sbar_DeathmatchOverlay2 ();
1147 Sbar_TimeOverlay();
1151 else// if (sb_lines < 24)
1153 if (cl.maxclients != 1)
1155 if (cl.stats[STAT_HEALTH] > 0)
1157 Sbar_DeathmatchOverlay2 ();
1158 Sbar_TimeOverlay();
1163 else
1165 if (sb_lines > 24)
1167 Sbar_DrawInventory ();
1168 if (cl.maxclients != 1)
1169 Sbar_DrawFrags ();
1171 else if (sb_lines < 48)
1173 if (cl.maxclients != 1)
1175 if (cl.stats[STAT_HEALTH] > 0)
1176 Sbar_DeathmatchOverlay2 ();
1181 if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
1183 if(!kurok)
1184 Sbar_DrawPic (0, 0, sb_scorebar);
1185 Sbar_DrawScoreboard ();
1186 sb_updates = 0;
1188 // else if (sb_lines)
1189 else if (sb_lines >= 0)
1192 if (!kurok)
1194 if (sb_lines >= 24)
1195 Sbar_DrawPic (0, 0, sb_sbar);
1198 // keys (hipnotic only)
1199 //MED 01/04/97 moved keys here so they would not be overwritten
1200 if (hipnotic)
1202 if (cl.items & IT_KEY1)
1203 Sbar_DrawPic (209, 3, sb_items[0]);
1204 if (cl.items & IT_KEY2)
1205 Sbar_DrawPic (209, 12, sb_items[1]);
1207 // armor
1208 if (cl.items & IT_INVULNERABILITY)
1210 Sbar_DrawNum (24, 0, 666, 3, 1);
1211 Sbar_DrawPic (0, 0, draw_disc);
1213 else
1215 if (rogue)
1217 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3,
1218 cl.stats[STAT_ARMOR] <= 25);
1219 if (cl.items & RIT_ARMOR3)
1220 Sbar_DrawPic (0, 0, sb_armor[2]);
1221 else if (cl.items & RIT_ARMOR2)
1222 Sbar_DrawPic (0, 0, sb_armor[1]);
1223 else if (cl.items & RIT_ARMOR1)
1224 Sbar_DrawPic (0, 0, sb_armor[0]);
1226 else if (kurok)
1228 if (cl.items & KIT_ARMOR3)
1229 Sbar_DrawPic (8, -16, sb_armor[2]);
1230 else if (cl.items & KIT_ARMOR2)
1231 Sbar_DrawPic (8, -16, sb_armor[1]);
1232 else if (cl.items & KIT_ARMOR1)
1233 Sbar_DrawPic (8, -16, sb_armor[0]);
1235 else
1237 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3,
1238 cl.stats[STAT_ARMOR] <= 25);
1239 if (cl.items & IT_ARMOR3)
1240 Sbar_DrawPic (0, 0, sb_armor[2]);
1241 else if (cl.items & IT_ARMOR2)
1242 Sbar_DrawPic (0, 0, sb_armor[1]);
1243 else if (cl.items & IT_ARMOR1)
1244 Sbar_DrawPic (0, 0, sb_armor[0]);
1248 // face
1249 Sbar_DrawFace ();
1251 // ammo icon
1252 if (rogue)
1254 if (cl.items & RIT_SHELLS)
1255 Sbar_DrawPic (224, 0, sb_ammo[0]);
1256 else if (cl.items & RIT_NAILS)
1257 Sbar_DrawPic (224, 0, sb_ammo[1]);
1258 else if (cl.items & RIT_ROCKETS)
1259 Sbar_DrawPic (224, 0, sb_ammo[2]);
1260 else if (cl.items & RIT_CELLS)
1261 Sbar_DrawPic (224, 0, sb_ammo[3]);
1262 else if (cl.items & RIT_LAVA_NAILS)
1263 Sbar_DrawPic (224, 0, rsb_ammo[0]);
1264 else if (cl.items & RIT_PLASMA_AMMO)
1265 Sbar_DrawPic (224, 0, rsb_ammo[1]);
1266 else if (cl.items & RIT_MULTI_ROCKETS)
1267 Sbar_DrawPic (224, 0, rsb_ammo[2]);
1269 else if (kurok)
1271 if (!cl_gunpitch.value)
1273 if (cl.items & KIT_SHELLS)
1274 Sbar_DrawPic (402, 0, sb_ammo[0]);
1275 else if (cl.items & KIT_NAILS)
1276 Sbar_DrawPic (402, 0, sb_ammo[1]);
1277 else if (cl.items & KIT_ROCKETS)
1278 Sbar_DrawPic (402, 0, sb_ammo[2]);
1279 else if (cl.items & KIT_CELLS)
1280 Sbar_DrawPic (402, 0, sb_ammo[3]);
1281 else if (cl.items & KIT_50CAL)
1282 Sbar_DrawPic (402, -16, ksb_ammo[0]);
1283 // else if (cl.items & KIT_60CAL)
1284 // Sbar_DrawPic (402, -16, ksb_ammo[1]);
1287 else
1289 if (cl.items & IT_SHELLS)
1290 Sbar_DrawPic (224, 0, sb_ammo[0]);
1291 else if (cl.items & IT_NAILS)
1292 Sbar_DrawPic (224, 0, sb_ammo[1]);
1293 else if (cl.items & IT_ROCKETS)
1294 Sbar_DrawPic (224, 0, sb_ammo[2]);
1295 else if (cl.items & IT_CELLS)
1296 Sbar_DrawPic (224, 0, sb_ammo[3]);
1299 if (cl.stats[STAT_ARMOR] <= 0)
1301 else
1303 if (kurok)
1304 Sbar_DrawNum2 (24, -16, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
1305 else
1306 Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
1309 if (cl.stats[STAT_HEALTH] <= 0)
1311 else
1313 if (kurok)
1315 // if (cl.stats[STAT_ARMOR] >= 1)
1316 // {}
1317 // else
1318 Sbar_DrawNum2 (24, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
1320 else
1321 Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
1324 if (kurok)
1326 if (!cl_gunpitch.value)
1328 if (cl.stats[STAT_ACTIVEWEAPON] == IT_SHOTGUN) // Pistol
1330 Sbar_DrawNum (352, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 1);
1331 Sbar_DrawNum2 (418, 0, cl.stats[STAT_NAILS], 3, cl.stats[STAT_NAILS] <= 10);
1333 else if (cl.stats[STAT_ACTIVEWEAPON] == IT_NAILGUN) // Assualt rifle
1335 Sbar_DrawNum (352, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 1);
1336 Sbar_DrawNum2 (418, 0, cl.stats[STAT_NAILS], 3, cl.stats[STAT_NAILS] <= 10);
1338 else if (cl.stats[STAT_ACTIVEWEAPON] == KIT_UZI) // Uzi
1340 Sbar_DrawNum (352, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 1);
1341 Sbar_DrawNum2 (418, 0, cl.stats[STAT_NAILS], 3, cl.stats[STAT_NAILS] <= 10);
1343 else if (cl.stats[STAT_ACTIVEWEAPON] == IT_SUPER_SHOTGUN) // Shotgun
1344 Sbar_DrawNum2 (418, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
1346 else if (cl.stats[STAT_ACTIVEWEAPON] == KIT_M99) // Sniper
1347 Sbar_DrawNum2 (418, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
1349 else if (cl.stats[STAT_ACTIVEWEAPON] == IT_SUPER_NAILGUN) // Minigun
1350 Sbar_DrawNum2 (418, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
1352 else if (cl.stats[STAT_ACTIVEWEAPON] == IT_GRENADE_LAUNCHER) // Grenade launcher
1353 Sbar_DrawNum2 (418, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
1355 else if (cl.stats[STAT_ACTIVEWEAPON] == IT_ROCKET_LAUNCHER) // Rocket launcher
1356 Sbar_DrawNum2 (418, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
1358 else if (cl.stats[STAT_ACTIVEWEAPON] == IT_LIGHTNING) // Remote Mines
1359 Sbar_DrawNum2 (418, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
1361 else if (cl.stats[STAT_AMMO] <= 0) // Axe / Bow
1365 else
1366 Sbar_DrawNum2 (418, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] < 0);
1369 else
1370 Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
1373 // Con_Printf ("I am an %i! woohoo!\n", cl.stats[STAT_ACTIVEWEAPON]);
1375 // if (vid.width > 320) {
1376 if (cl.gametype == GAME_DEATHMATCH)
1377 Sbar_MiniDeathmatchOverlay ();
1378 // }
1381 //=============================================================================
1384 ==================
1385 Sbar_IntermissionNumber
1387 ==================
1389 void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
1391 char str[12];
1392 char *ptr;
1393 int l, frame;
1395 l = Sbar_itoa (num, str);
1396 ptr = str;
1397 if (l > digits)
1398 ptr += (l-digits);
1399 if (l < digits)
1400 x += (digits-l)*24;
1402 while (*ptr)
1404 if (*ptr == '-')
1405 frame = STAT_MINUS;
1406 else
1407 frame = *ptr -'0';
1409 Draw_TransPic (x,y,sb_nums[color][frame]);
1410 x += 24;
1411 ptr++;
1416 ==================
1417 Sbar_DeathmatchOverlay
1419 ==================
1421 void Sbar_DeathmatchOverlay (void)
1423 qpic_t *pic;
1424 int i, k, l;
1425 int top, bottom;
1426 int x, y, f;
1427 char num[12];
1428 scoreboard_t *s;
1430 scr_copyeverything = 1;
1431 scr_fullupdate = 0;
1433 pic = Draw_CachePic ("gfx/ranking.lmp");
1434 M_DrawPic ((320-pic->width)/2, 8, pic);
1436 // scores
1437 Sbar_SortFrags ();
1439 // draw the text
1440 l = scoreboardlines;
1442 x = 80 + ((vid.width - 320)>>1);
1443 y = 40;
1444 for (i=0 ; i<l ; i++)
1446 k = fragsort[i];
1447 s = &cl.scores[k];
1448 if (!s->name[0])
1449 continue;
1451 // draw background
1452 top = s->colors & 0xf0;
1453 bottom = (s->colors & 15)<<4;
1454 top = Sbar_ColorForMap (top);
1455 bottom = Sbar_ColorForMap (bottom);
1457 Draw_Fill ( x, y, 40, 4, top);
1458 Draw_Fill ( x, y+4, 40, 4, bottom);
1460 // draw number
1461 f = s->frags;
1462 sprintf (num, "%3i",f);
1464 Draw_Character ( x+8 , y, num[0]);
1465 Draw_Character ( x+16 , y, num[1]);
1466 Draw_Character ( x+24 , y, num[2]);
1468 // if (k == cl.viewentity - 1)
1469 // Draw_Character ( x - 8, y, 12);
1471 if (k == cl.viewentity - 1) {
1472 Draw_Character ( x, y, 16);
1473 Draw_Character ( x + 32, y, 17);
1476 #if 0
1478 int total;
1479 int n, minutes, tens, units;
1481 // draw time
1482 total = cl.completed_time - s->entertime;
1483 minutes = (int)total/60;
1484 n = total - minutes*60;
1485 tens = n/10;
1486 units = n%10;
1488 sprintf (num, "%3i:%i%i", minutes, tens, units);
1490 Draw_String ( x+48 , y, num);
1492 #endif
1494 // draw name
1495 Draw_String (x+64, y, s->name);
1497 y += 10;
1502 ==================
1503 Sbar_DeathmatchOverlay
1505 ==================
1507 void Sbar_MiniDeathmatchOverlay (void)
1509 int i, k, l;
1510 int top, bottom;
1511 int x, y, f;
1512 char num[12];
1513 scoreboard_t *s;
1514 int numlines;
1516 if (vid.width < 512 || !sb_lines)
1517 return;
1519 scr_copyeverything = 1;
1520 scr_fullupdate = 0;
1522 // scores
1523 Sbar_SortFrags ();
1525 // draw the text
1526 l = scoreboardlines;
1527 y = vid.height - sb_lines;
1528 numlines = sb_lines/8;
1529 if (numlines < 3)
1530 return;
1532 //find us
1533 for (i = 0; i < scoreboardlines; i++)
1534 if (fragsort[i] == cl.viewentity - 1)
1535 break;
1537 if (i == scoreboardlines) // we're not there
1538 i = 0;
1539 else // figure out start
1540 i = i - numlines/2;
1542 if (i > scoreboardlines - numlines)
1543 i = scoreboardlines - numlines;
1544 if (i < 0)
1545 i = 0;
1547 x = 324;
1548 for (/* */; i < scoreboardlines && y < vid.height - 8 ; i++)
1550 k = fragsort[i];
1551 s = &cl.scores[k];
1552 if (!s->name[0])
1553 continue;
1555 // draw background
1556 top = s->colors & 0xf0;
1557 bottom = (s->colors & 15)<<4;
1558 top = Sbar_ColorForMap (top);
1559 bottom = Sbar_ColorForMap (bottom);
1561 Draw_Fill ( x, y+1, 40, 3, top);
1562 Draw_Fill ( x, y+4, 40, 4, bottom);
1564 // draw number
1565 f = s->frags;
1566 sprintf (num, "%3i",f);
1568 Draw_Character ( x+8 , y, num[0]);
1569 Draw_Character ( x+16 , y, num[1]);
1570 Draw_Character ( x+24 , y, num[2]);
1572 if (k == cl.viewentity - 1) {
1573 Draw_Character ( x, y, 16);
1574 Draw_Character ( x + 32, y, 17);
1577 #if 0
1579 int total;
1580 int n, minutes, tens, units;
1582 // draw time
1583 total = cl.completed_time - s->entertime;
1584 minutes = (int)total/60;
1585 n = total - minutes*60;
1586 tens = n/10;
1587 units = n%10;
1589 sprintf (num, "%3i:%i%i", minutes, tens, units);
1591 Draw_String ( x+48 , y, num);
1593 #endif
1595 // draw name
1596 Draw_String (x+48, y, s->name);
1598 y += 8;
1603 ==================
1604 Sbar_DeathmatchOverlay2
1606 ==================
1608 void Sbar_DeathmatchOverlay2 (void)
1610 // qpic_t *pic;
1611 int i, k, l;
1612 int top, bottom;
1613 int x, y, f;
1614 char num[12];
1615 scoreboard_t *s;
1617 scr_copyeverything = 1;
1618 scr_fullupdate = 0;
1620 // scores
1621 Sbar_SortFrags ();
1623 // draw the text
1624 l = scoreboardlines;
1626 x = 16;
1627 y = 56;
1628 for (i=0 ; i<l ; i++)
1630 k = fragsort[i];
1631 s = &cl.scores[k];
1632 if (!s->name[0])
1633 continue;
1635 // draw background
1636 top = s->colors & 0xf0;
1637 bottom = (s->colors & 15)<<4;
1638 top = Sbar_ColorForMap (top);
1639 bottom = Sbar_ColorForMap (bottom);
1641 Draw_Fill ( x, y, 24, 4, top);
1642 Draw_Fill ( x, y+4, 24, 4, bottom);
1644 // draw number
1645 f = s->frags;
1646 sprintf (num, "%3i",f);
1648 Draw_Character ( x, y, num[0]);
1649 Draw_Character ( x+8 , y, num[1]);
1650 Draw_Character ( x+16 , y, num[2]);
1652 if (k == cl.viewentity - 1)
1653 Draw_Character ( x - 8, y, 13);
1655 Draw_String (x+32, y, s->name);
1657 y += 10;
1662 ==================
1663 Sbar_TimeOverlay
1665 ==================
1668 void Sbar_TimeOverlay (void)
1670 char str[80];
1671 int minutes, seconds, tens, units;
1672 int x, y;
1674 x = 8;
1675 y = 56;
1677 minutes = cl.time / 60;
1678 seconds = cl.time - 60*minutes;
1679 tens = seconds / 10;
1680 units = seconds - 10*tens;
1681 sprintf (str,"Time %i:%i%i", minutes, tens, units);
1682 Draw_String ( x, y - 16, str);
1685 ==================
1686 Sbar_IntermissionOverlay
1688 ==================
1690 void Sbar_IntermissionOverlay (void)
1692 qpic_t *pic;
1693 int dig;
1694 int num;
1696 scr_copyeverything = 1;
1697 scr_fullupdate = 0;
1699 if (cl.gametype == GAME_DEATHMATCH)
1701 Sbar_DeathmatchOverlay ();
1702 return;
1705 pic = Draw_CachePic ("gfx/complete.lmp");
1706 Draw_Pic (64, 24, pic);
1708 pic = Draw_CachePic ("gfx/inter.lmp");
1709 Draw_TransPic (0, 56, pic);
1711 // time
1712 dig = cl.completed_time/60;
1713 Sbar_IntermissionNumber (160, 64, dig, 3, 0);
1714 num = cl.completed_time - dig*60;
1715 Draw_TransPic (234,64,sb_colon);
1716 Draw_TransPic (246,64,sb_nums[0][num/10]);
1717 Draw_TransPic (266,64,sb_nums[0][num%10]);
1719 Sbar_IntermissionNumber (160, 104, cl.stats[STAT_SECRETS], 3, 0);
1720 Draw_TransPic (232,104,sb_slash);
1721 Sbar_IntermissionNumber (240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
1723 Sbar_IntermissionNumber (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
1724 Draw_TransPic (232,144,sb_slash);
1725 Sbar_IntermissionNumber (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
1731 ==================
1732 Sbar_FinaleOverlay
1734 ==================
1736 void Sbar_FinaleOverlay (void)
1738 qpic_t *pic;
1740 scr_copyeverything = 1;
1742 pic = Draw_CachePic ("gfx/finale.lmp");
1743 Draw_TransPic ( (vid.width-pic->width)/2, 16, pic);