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 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
;
34 qpic_t
*sb_weapons
[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
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
;
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
*rsb_invbar
[2];
52 qpic_t
*rsb_weapons
[5];
55 qpic_t
*rsb_teambord
; // PGM 01/19/97 - team color border
57 //MED 01/04/97 added two more weapons + 3 alternates for grenade launcher
58 qpic_t
*hsb_weapons
[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
59 //MED 01/04/97 added array to simplify weapon parsing
60 int hipweapons
[4] = {HIT_LASER_CANNON_BIT
,HIT_MJOLNIR_BIT
,4,HIT_PROXIMITY_GUN_BIT
};
61 //MED 01/04/97 added hipnotic items array
64 void Sbar_MiniDeathmatchOverlay (void);
65 void Sbar_DeathmatchOverlay (void);
66 void M_DrawPic (int x
, int y
, qpic_t
*pic
);
75 void Sbar_ShowScores (void)
90 void Sbar_DontShowScores (void)
92 sb_showscores
= false;
101 void Sbar_Changed (void)
103 sb_updates
= 0; // update next frame
111 void Sbar_Init (void)
115 for (i
=0 ; i
<10 ; i
++)
117 sb_nums
[0][i
] = Draw_PicFromWad (va("num_%i",i
));
118 sb_nums
[1][i
] = Draw_PicFromWad (va("anum_%i",i
));
121 sb_nums
[0][10] = Draw_PicFromWad ("num_minus");
122 sb_nums
[1][10] = Draw_PicFromWad ("anum_minus");
124 sb_colon
= Draw_PicFromWad ("num_colon");
125 sb_slash
= Draw_PicFromWad ("num_slash");
127 sb_weapons
[0][0] = Draw_PicFromWad ("inv_shotgun");
128 sb_weapons
[0][1] = Draw_PicFromWad ("inv_sshotgun");
129 sb_weapons
[0][2] = Draw_PicFromWad ("inv_nailgun");
130 sb_weapons
[0][3] = Draw_PicFromWad ("inv_snailgun");
131 sb_weapons
[0][4] = Draw_PicFromWad ("inv_rlaunch");
132 sb_weapons
[0][5] = Draw_PicFromWad ("inv_srlaunch");
133 sb_weapons
[0][6] = Draw_PicFromWad ("inv_lightng");
135 sb_weapons
[1][0] = Draw_PicFromWad ("inv2_shotgun");
136 sb_weapons
[1][1] = Draw_PicFromWad ("inv2_sshotgun");
137 sb_weapons
[1][2] = Draw_PicFromWad ("inv2_nailgun");
138 sb_weapons
[1][3] = Draw_PicFromWad ("inv2_snailgun");
139 sb_weapons
[1][4] = Draw_PicFromWad ("inv2_rlaunch");
140 sb_weapons
[1][5] = Draw_PicFromWad ("inv2_srlaunch");
141 sb_weapons
[1][6] = Draw_PicFromWad ("inv2_lightng");
143 for (i
=0 ; i
<5 ; i
++)
145 sb_weapons
[2+i
][0] = Draw_PicFromWad (va("inva%i_shotgun",i
+1));
146 sb_weapons
[2+i
][1] = Draw_PicFromWad (va("inva%i_sshotgun",i
+1));
147 sb_weapons
[2+i
][2] = Draw_PicFromWad (va("inva%i_nailgun",i
+1));
148 sb_weapons
[2+i
][3] = Draw_PicFromWad (va("inva%i_snailgun",i
+1));
149 sb_weapons
[2+i
][4] = Draw_PicFromWad (va("inva%i_rlaunch",i
+1));
150 sb_weapons
[2+i
][5] = Draw_PicFromWad (va("inva%i_srlaunch",i
+1));
151 sb_weapons
[2+i
][6] = Draw_PicFromWad (va("inva%i_lightng",i
+1));
154 sb_ammo
[0] = Draw_PicFromWad ("sb_shells");
155 sb_ammo
[1] = Draw_PicFromWad ("sb_nails");
156 sb_ammo
[2] = Draw_PicFromWad ("sb_rocket");
157 sb_ammo
[3] = Draw_PicFromWad ("sb_cells");
159 sb_armor
[0] = Draw_PicFromWad ("sb_armor1");
160 sb_armor
[1] = Draw_PicFromWad ("sb_armor2");
161 sb_armor
[2] = Draw_PicFromWad ("sb_armor3");
163 sb_items
[0] = Draw_PicFromWad ("sb_key1");
164 sb_items
[1] = Draw_PicFromWad ("sb_key2");
165 sb_items
[2] = Draw_PicFromWad ("sb_invis");
166 sb_items
[3] = Draw_PicFromWad ("sb_invuln");
167 sb_items
[4] = Draw_PicFromWad ("sb_suit");
168 sb_items
[5] = Draw_PicFromWad ("sb_quad");
170 sb_sigil
[0] = Draw_PicFromWad ("sb_sigil1");
171 sb_sigil
[1] = Draw_PicFromWad ("sb_sigil2");
172 sb_sigil
[2] = Draw_PicFromWad ("sb_sigil3");
173 sb_sigil
[3] = Draw_PicFromWad ("sb_sigil4");
175 sb_faces
[4][0] = Draw_PicFromWad ("face1");
176 sb_faces
[4][1] = Draw_PicFromWad ("face_p1");
177 sb_faces
[3][0] = Draw_PicFromWad ("face2");
178 sb_faces
[3][1] = Draw_PicFromWad ("face_p2");
179 sb_faces
[2][0] = Draw_PicFromWad ("face3");
180 sb_faces
[2][1] = Draw_PicFromWad ("face_p3");
181 sb_faces
[1][0] = Draw_PicFromWad ("face4");
182 sb_faces
[1][1] = Draw_PicFromWad ("face_p4");
183 sb_faces
[0][0] = Draw_PicFromWad ("face5");
184 sb_faces
[0][1] = Draw_PicFromWad ("face_p5");
186 sb_face_invis
= Draw_PicFromWad ("face_invis");
187 sb_face_invuln
= Draw_PicFromWad ("face_invul2");
188 sb_face_invis_invuln
= Draw_PicFromWad ("face_inv2");
189 sb_face_quad
= Draw_PicFromWad ("face_quad");
191 Cmd_AddCommand ("+showscores", Sbar_ShowScores
);
192 Cmd_AddCommand ("-showscores", Sbar_DontShowScores
);
194 sb_sbar
= Draw_PicFromWad ("sbar");
195 sb_ibar
= Draw_PicFromWad ("ibar");
196 sb_scorebar
= Draw_PicFromWad ("scorebar");
198 //MED 01/04/97 added new hipnotic weapons
201 hsb_weapons
[0][0] = Draw_PicFromWad ("inv_laser");
202 hsb_weapons
[0][1] = Draw_PicFromWad ("inv_mjolnir");
203 hsb_weapons
[0][2] = Draw_PicFromWad ("inv_gren_prox");
204 hsb_weapons
[0][3] = Draw_PicFromWad ("inv_prox_gren");
205 hsb_weapons
[0][4] = Draw_PicFromWad ("inv_prox");
207 hsb_weapons
[1][0] = Draw_PicFromWad ("inv2_laser");
208 hsb_weapons
[1][1] = Draw_PicFromWad ("inv2_mjolnir");
209 hsb_weapons
[1][2] = Draw_PicFromWad ("inv2_gren_prox");
210 hsb_weapons
[1][3] = Draw_PicFromWad ("inv2_prox_gren");
211 hsb_weapons
[1][4] = Draw_PicFromWad ("inv2_prox");
213 for (i
=0 ; i
<5 ; i
++)
215 hsb_weapons
[2+i
][0] = Draw_PicFromWad (va("inva%i_laser",i
+1));
216 hsb_weapons
[2+i
][1] = Draw_PicFromWad (va("inva%i_mjolnir",i
+1));
217 hsb_weapons
[2+i
][2] = Draw_PicFromWad (va("inva%i_gren_prox",i
+1));
218 hsb_weapons
[2+i
][3] = Draw_PicFromWad (va("inva%i_prox_gren",i
+1));
219 hsb_weapons
[2+i
][4] = Draw_PicFromWad (va("inva%i_prox",i
+1));
222 hsb_items
[0] = Draw_PicFromWad ("sb_wsuit");
223 hsb_items
[1] = Draw_PicFromWad ("sb_eshld");
228 rsb_invbar
[0] = Draw_PicFromWad ("r_invbar1");
229 rsb_invbar
[1] = Draw_PicFromWad ("r_invbar2");
231 rsb_weapons
[0] = Draw_PicFromWad ("r_lava");
232 rsb_weapons
[1] = Draw_PicFromWad ("r_superlava");
233 rsb_weapons
[2] = Draw_PicFromWad ("r_gren");
234 rsb_weapons
[3] = Draw_PicFromWad ("r_multirock");
235 rsb_weapons
[4] = Draw_PicFromWad ("r_plasma");
237 rsb_items
[0] = Draw_PicFromWad ("r_shield1");
238 rsb_items
[1] = Draw_PicFromWad ("r_agrav1");
240 // PGM 01/19/97 - team color border
241 rsb_teambord
= Draw_PicFromWad ("r_teambord");
242 // PGM 01/19/97 - team color border
244 rsb_ammo
[0] = Draw_PicFromWad ("r_ammolava");
245 rsb_ammo
[1] = Draw_PicFromWad ("r_ammomulti");
246 rsb_ammo
[2] = Draw_PicFromWad ("r_ammoplasma");
251 //=============================================================================
253 // drawing routines are relative to the status bar location
260 void Sbar_DrawPic (int x
, int y
, qpic_t
*pic
)
262 if (cl
.gametype
== GAME_DEATHMATCH
)
263 Draw_Pic (x
/* + ((vid.width - 320)>>1)*/, y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
265 Draw_Pic (x
+ ((vid
.width
- 320)>>1), y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
273 void Sbar_DrawTransPic (int x
, int y
, qpic_t
*pic
)
275 if (cl
.gametype
== GAME_DEATHMATCH
)
276 Draw_TransPic (x
/*+ ((vid.width - 320)>>1)*/, y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
278 Draw_TransPic (x
+ ((vid
.width
- 320)>>1), y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
285 Draws one solid graphics character
288 void Sbar_DrawCharacter (int x
, int y
, int num
)
290 if (cl
.gametype
== GAME_DEATHMATCH
)
291 Draw_Character ( x
/*+ ((vid.width - 320)>>1) */ + 4 , y
+ vid
.height
-SBAR_HEIGHT
, num
);
293 Draw_Character ( x
+ ((vid
.width
- 320)>>1) + 4 , y
+ vid
.height
-SBAR_HEIGHT
, num
);
301 void Sbar_DrawString (int x
, int y
, char *str
)
303 if (cl
.gametype
== GAME_DEATHMATCH
)
304 Draw_String (x
/*+ ((vid.width - 320)>>1)*/, y
+ vid
.height
-SBAR_HEIGHT
, str
);
306 Draw_String (x
+ ((vid
.width
- 320)>>1), y
+ vid
.height
-SBAR_HEIGHT
, str
);
314 int Sbar_itoa (int num
, char *buf
)
328 for (pow10
= 10 ; num
>= pow10
; pow10
*= 10)
337 } while (pow10
!= 1);
350 void Sbar_DrawNum (int x
, int y
, int num
, int digits
, int color
)
356 l
= Sbar_itoa (num
, str
);
370 Sbar_DrawTransPic (x
,y
,sb_nums
[color
][frame
]);
376 //=============================================================================
378 int fragsort
[MAX_SCOREBOARD
];
380 char scoreboardtext
[MAX_SCOREBOARD
][20];
381 int scoreboardtop
[MAX_SCOREBOARD
];
382 int scoreboardbottom
[MAX_SCOREBOARD
];
383 int scoreboardcount
[MAX_SCOREBOARD
];
391 void Sbar_SortFrags (void)
397 for (i
=0 ; i
<cl
.maxclients
; i
++)
399 if (cl
.scores
[i
].name
[0])
401 fragsort
[scoreboardlines
] = i
;
406 for (i
=0 ; i
<scoreboardlines
; i
++)
407 for (j
=0 ; j
<scoreboardlines
-1-i
; j
++)
408 if (cl
.scores
[fragsort
[j
]].frags
< cl
.scores
[fragsort
[j
+1]].frags
)
411 fragsort
[j
] = fragsort
[j
+1];
416 int Sbar_ColorForMap (int m
)
418 return m
< 128 ? m
+ 8 : m
+ 8;
423 Sbar_UpdateScoreboard
426 void Sbar_UpdateScoreboard (void)
435 memset (scoreboardtext
, 0, sizeof(scoreboardtext
));
437 for (i
=0 ; i
<scoreboardlines
; i
++)
441 sprintf (&scoreboardtext
[i
][1], "%3i %s", s
->frags
, s
->name
);
443 top
= s
->colors
& 0xf0;
444 bottom
= (s
->colors
& 15) <<4;
445 scoreboardtop
[i
] = Sbar_ColorForMap (top
);
446 scoreboardbottom
[i
] = Sbar_ColorForMap (bottom
);
457 void Sbar_SoloScoreboard (void)
460 int minutes
, seconds
, tens
, units
;
463 sprintf (str
,"Monsters:%3i /%3i", cl
.stats
[STAT_MONSTERS
], cl
.stats
[STAT_TOTALMONSTERS
]);
464 Sbar_DrawString (8, 4, str
);
466 sprintf (str
,"Secrets :%3i /%3i", cl
.stats
[STAT_SECRETS
], cl
.stats
[STAT_TOTALSECRETS
]);
467 Sbar_DrawString (8, 12, str
);
470 minutes
= cl
.time
/ 60;
471 seconds
= cl
.time
- 60*minutes
;
473 units
= seconds
- 10*tens
;
474 sprintf (str
,"Time :%3i:%i%i", minutes
, tens
, units
);
475 Sbar_DrawString (184, 4, str
);
478 l
= strlen (cl
.levelname
);
479 Sbar_DrawString (232 - l
*4, 12, cl
.levelname
);
487 void Sbar_DrawScoreboard (void)
489 Sbar_SoloScoreboard ();
490 if (cl
.gametype
== GAME_DEATHMATCH
)
491 Sbar_DeathmatchOverlay ();
499 if (cl
.gametype
!= GAME_DEATHMATCH
)
501 Sbar_SoloScoreboard ();
505 Sbar_UpdateScoreboard ();
507 l
= scoreboardlines
<= 6 ? scoreboardlines
: 6;
509 for (i
=0 ; i
<l
; i
++)
514 s
= &cl
.scores
[fragsort
[i
]];
519 top
= s
->colors
& 0xf0;
520 bottom
= (s
->colors
& 15)<<4;
521 top
= Sbar_ColorForMap (top
);
522 bottom
= Sbar_ColorForMap (bottom
);
524 Draw_Fill ( x
*8+10 + ((vid
.width
- 320)>>1), y
+ vid
.height
- SBAR_HEIGHT
, 28, 4, top
);
525 Draw_Fill ( x
*8+10 + ((vid
.width
- 320)>>1), y
+4 + vid
.height
- SBAR_HEIGHT
, 28, 4, bottom
);
528 for (j
=0 ; j
<20 ; j
++)
530 c
= scoreboardtext
[i
][j
];
531 if (c
== 0 || c
== ' ')
533 Sbar_DrawCharacter ( (x
+j
)*8, y
, c
);
539 //=============================================================================
546 void Sbar_DrawInventory (void)
555 if ( cl
.stats
[STAT_ACTIVEWEAPON
] >= RIT_LAVA_NAILGUN
)
556 Sbar_DrawPic (0, -24, rsb_invbar
[0]);
558 Sbar_DrawPic (0, -24, rsb_invbar
[1]);
562 Sbar_DrawPic (0, -24, sb_ibar
);
566 for (i
=0 ; i
<7 ; i
++)
568 if (cl
.items
& (IT_SHOTGUN
<<i
) )
570 time
= cl
.item_gettime
[i
];
571 flashon
= (int)((cl
.time
- time
)*10);
574 if ( cl
.stats
[STAT_ACTIVEWEAPON
] == (IT_SHOTGUN
<<i
) )
580 flashon
= (flashon
%5) + 2;
582 Sbar_DrawPic (i
*24, -16, sb_weapons
[flashon
][i
]);
585 sb_updates
= 0; // force update to remove flash
593 int grenadeflashing
=0;
594 for (i
=0 ; i
<4 ; i
++)
596 if (cl
.items
& (1<<hipweapons
[i
]) )
598 time
= cl
.item_gettime
[hipweapons
[i
]];
599 flashon
= (int)((cl
.time
- time
)*10);
602 if ( cl
.stats
[STAT_ACTIVEWEAPON
] == (1<<hipweapons
[i
]) )
608 flashon
= (flashon
%5) + 2;
610 // check grenade launcher
613 if (cl
.items
& HIT_PROXIMITY_GUN
)
618 Sbar_DrawPic (96, -16, hsb_weapons
[flashon
][2]);
624 if (cl
.items
& (IT_SHOTGUN
<<4))
626 if (flashon
&& !grenadeflashing
)
628 Sbar_DrawPic (96, -16, hsb_weapons
[flashon
][3]);
630 else if (!grenadeflashing
)
632 Sbar_DrawPic (96, -16, hsb_weapons
[0][3]);
636 Sbar_DrawPic (96, -16, hsb_weapons
[flashon
][4]);
639 Sbar_DrawPic (176 + (i
*24), -16, hsb_weapons
[flashon
][i
]);
641 sb_updates
= 0; // force update to remove flash
648 // check for powered up weapon.
649 if ( cl
.stats
[STAT_ACTIVEWEAPON
] >= RIT_LAVA_NAILGUN
)
653 if (cl
.stats
[STAT_ACTIVEWEAPON
] == (RIT_LAVA_NAILGUN
<< i
))
655 Sbar_DrawPic ((i
+2)*24, -16, rsb_weapons
[i
]);
662 for (i
=0 ; i
<4 ; i
++)
664 sprintf (num
, "%3i",cl
.stats
[STAT_SHELLS
+i
] );
666 Sbar_DrawCharacter ( (6*i
+1)*8 - 2, -24, 18 + num
[0] - '0');
668 Sbar_DrawCharacter ( (6*i
+2)*8 - 2, -24, 18 + num
[1] - '0');
670 Sbar_DrawCharacter ( (6*i
+3)*8 - 2, -24, 18 + num
[2] - '0');
675 for (i
=0 ; i
<6 ; i
++)
676 if (cl
.items
& (1<<(17+i
)))
678 time
= cl
.item_gettime
[17+i
];
679 if (time
&& time
> cl
.time
- 2 && flashon
)
685 //MED 01/04/97 changed keys
686 if (!hipnotic
|| (i
>1))
688 Sbar_DrawPic (192 + i
*16, -16, sb_items
[i
]);
691 if (time
&& time
> cl
.time
- 2)
694 //MED 01/04/97 added hipnotic items
698 for (i
=0 ; i
<2 ; i
++)
699 if (cl
.items
& (1<<(24+i
)))
701 time
= cl
.item_gettime
[24+i
];
702 if (time
&& time
> cl
.time
- 2 && flashon
)
708 Sbar_DrawPic (288 + i
*16, -16, hsb_items
[i
]);
710 if (time
&& time
> cl
.time
- 2)
718 for (i
=0 ; i
<2 ; i
++)
720 if (cl
.items
& (1<<(29+i
)))
722 time
= cl
.item_gettime
[29+i
];
724 if (time
&& time
> cl
.time
- 2 && flashon
)
730 Sbar_DrawPic (288 + i
*16, -16, rsb_items
[i
]);
733 if (time
&& time
> cl
.time
- 2)
741 for (i
=0 ; i
<4 ; i
++)
743 if (cl
.items
& (1<<(28+i
)))
745 time
= cl
.item_gettime
[28+i
];
746 if (time
&& time
> cl
.time
- 2 && flashon
)
751 Sbar_DrawPic (320-32 + i
*8, -16, sb_sigil
[i
]);
752 if (time
&& time
> cl
.time
- 2)
759 //=============================================================================
766 void Sbar_DrawFrags (void)
778 l
= scoreboardlines
<= 4 ? scoreboardlines
: 4;
781 if (cl
.gametype
== GAME_DEATHMATCH
)
784 xofs
= (vid
.width
- 320)>>1;
785 y
= vid
.height
- SBAR_HEIGHT
- 23;
787 for (i
=0 ; i
<l
; i
++)
795 top
= s
->colors
& 0xf0;
796 bottom
= (s
->colors
& 15)<<4;
797 top
= Sbar_ColorForMap (top
);
798 bottom
= Sbar_ColorForMap (bottom
);
800 Draw_Fill (xofs
+ x
*8 + 10, y
, 28, 4, top
);
801 Draw_Fill (xofs
+ x
*8 + 10, y
+4, 28, 3, bottom
);
805 sprintf (num
, "%3i",f
);
807 Sbar_DrawCharacter ( (x
+1)*8 , -24, num
[0]);
808 Sbar_DrawCharacter ( (x
+2)*8 , -24, num
[1]);
809 Sbar_DrawCharacter ( (x
+3)*8 , -24, num
[2]);
811 if (k
== cl
.viewentity
- 1)
813 Sbar_DrawCharacter (x
*8+2, -24, 16);
814 Sbar_DrawCharacter ( (x
+4)*8-4, -24, 17);
820 //=============================================================================
828 void Sbar_DrawFace (void)
832 // PGM 01/19/97 - team color drawing
833 // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
835 (cl
.maxclients
!= 1) &&
836 (teamplay
.value
>3) &&
844 s
= &cl
.scores
[cl
.viewentity
- 1];
846 top
= s
->colors
& 0xf0;
847 bottom
= (s
->colors
& 15)<<4;
848 top
= Sbar_ColorForMap (top
);
849 bottom
= Sbar_ColorForMap (bottom
);
851 if (cl
.gametype
== GAME_DEATHMATCH
)
854 xofs
= ((vid
.width
- 320)>>1) + 113;
856 Sbar_DrawPic (112, 0, rsb_teambord
);
857 Draw_Fill (xofs
, vid
.height
-SBAR_HEIGHT
+3, 22, 9, top
);
858 Draw_Fill (xofs
, vid
.height
-SBAR_HEIGHT
+12, 22, 9, bottom
);
862 sprintf (num
, "%3i",f
);
867 Sbar_DrawCharacter(109, 3, 18 + num
[0] - '0');
869 Sbar_DrawCharacter(116, 3, 18 + num
[1] - '0');
871 Sbar_DrawCharacter(123, 3, 18 + num
[2] - '0');
875 Sbar_DrawCharacter ( 109, 3, num
[0]);
876 Sbar_DrawCharacter ( 116, 3, num
[1]);
877 Sbar_DrawCharacter ( 123, 3, num
[2]);
882 // PGM 01/19/97 - team color drawing
884 if ( (cl
.items
& (IT_INVISIBILITY
| IT_INVULNERABILITY
) )
885 == (IT_INVISIBILITY
| IT_INVULNERABILITY
) )
887 Sbar_DrawPic (112, 0, sb_face_invis_invuln
);
890 if (cl
.items
& IT_QUAD
)
892 Sbar_DrawPic (112, 0, sb_face_quad
);
895 if (cl
.items
& IT_INVISIBILITY
)
897 Sbar_DrawPic (112, 0, sb_face_invis
);
900 if (cl
.items
& IT_INVULNERABILITY
)
902 Sbar_DrawPic (112, 0, sb_face_invuln
);
906 if (cl
.stats
[STAT_HEALTH
] >= 100)
909 f
= cl
.stats
[STAT_HEALTH
] / 20;
911 if (cl
.time
<= cl
.faceanimtime
)
914 sb_updates
= 0; // make sure the anim gets drawn over
918 Sbar_DrawPic (112, 0, sb_faces
[f
][anim
]);
926 void Sbar_Draw (void)
928 if (scr_con_current
== vid
.height
)
929 return; // console is full screen
931 if (sb_updates
>= vid
.numpages
)
934 scr_copyeverything
= 1;
938 if (sb_lines
&& vid
.width
> 320)
939 Draw_TileClear (0, vid
.height
- sb_lines
, vid
.width
, sb_lines
);
943 Sbar_DrawInventory ();
944 if (cl
.maxclients
!= 1)
948 if (sb_showscores
|| cl
.stats
[STAT_HEALTH
] <= 0)
950 Sbar_DrawPic (0, 0, sb_scorebar
);
951 Sbar_DrawScoreboard ();
956 Sbar_DrawPic (0, 0, sb_sbar
);
958 // keys (hipnotic only)
959 //MED 01/04/97 moved keys here so they would not be overwritten
962 if (cl
.items
& IT_KEY1
)
963 Sbar_DrawPic (209, 3, sb_items
[0]);
964 if (cl
.items
& IT_KEY2
)
965 Sbar_DrawPic (209, 12, sb_items
[1]);
968 if (cl
.items
& IT_INVULNERABILITY
)
970 Sbar_DrawNum (24, 0, 666, 3, 1);
971 Sbar_DrawPic (0, 0, draw_disc
);
977 Sbar_DrawNum (24, 0, cl
.stats
[STAT_ARMOR
], 3,
978 cl
.stats
[STAT_ARMOR
] <= 25);
979 if (cl
.items
& RIT_ARMOR3
)
980 Sbar_DrawPic (0, 0, sb_armor
[2]);
981 else if (cl
.items
& RIT_ARMOR2
)
982 Sbar_DrawPic (0, 0, sb_armor
[1]);
983 else if (cl
.items
& RIT_ARMOR1
)
984 Sbar_DrawPic (0, 0, sb_armor
[0]);
988 Sbar_DrawNum (24, 0, cl
.stats
[STAT_ARMOR
], 3
989 , cl
.stats
[STAT_ARMOR
] <= 25);
990 if (cl
.items
& IT_ARMOR3
)
991 Sbar_DrawPic (0, 0, sb_armor
[2]);
992 else if (cl
.items
& IT_ARMOR2
)
993 Sbar_DrawPic (0, 0, sb_armor
[1]);
994 else if (cl
.items
& IT_ARMOR1
)
995 Sbar_DrawPic (0, 0, sb_armor
[0]);
1003 Sbar_DrawNum (136, 0, cl
.stats
[STAT_HEALTH
], 3
1004 , cl
.stats
[STAT_HEALTH
] <= 25);
1009 if (cl
.items
& RIT_SHELLS
)
1010 Sbar_DrawPic (224, 0, sb_ammo
[0]);
1011 else if (cl
.items
& RIT_NAILS
)
1012 Sbar_DrawPic (224, 0, sb_ammo
[1]);
1013 else if (cl
.items
& RIT_ROCKETS
)
1014 Sbar_DrawPic (224, 0, sb_ammo
[2]);
1015 else if (cl
.items
& RIT_CELLS
)
1016 Sbar_DrawPic (224, 0, sb_ammo
[3]);
1017 else if (cl
.items
& RIT_LAVA_NAILS
)
1018 Sbar_DrawPic (224, 0, rsb_ammo
[0]);
1019 else if (cl
.items
& RIT_PLASMA_AMMO
)
1020 Sbar_DrawPic (224, 0, rsb_ammo
[1]);
1021 else if (cl
.items
& RIT_MULTI_ROCKETS
)
1022 Sbar_DrawPic (224, 0, rsb_ammo
[2]);
1026 if (cl
.items
& IT_SHELLS
)
1027 Sbar_DrawPic (224, 0, sb_ammo
[0]);
1028 else if (cl
.items
& IT_NAILS
)
1029 Sbar_DrawPic (224, 0, sb_ammo
[1]);
1030 else if (cl
.items
& IT_ROCKETS
)
1031 Sbar_DrawPic (224, 0, sb_ammo
[2]);
1032 else if (cl
.items
& IT_CELLS
)
1033 Sbar_DrawPic (224, 0, sb_ammo
[3]);
1036 Sbar_DrawNum (248, 0, cl
.stats
[STAT_AMMO
], 3,
1037 cl
.stats
[STAT_AMMO
] <= 10);
1040 if (vid
.width
> 320) {
1041 if (cl
.gametype
== GAME_DEATHMATCH
)
1042 Sbar_MiniDeathmatchOverlay ();
1046 //=============================================================================
1050 Sbar_IntermissionNumber
1054 void Sbar_IntermissionNumber (int x
, int y
, int num
, int digits
, int color
)
1060 l
= Sbar_itoa (num
, str
);
1074 Draw_TransPic (x
,y
,sb_nums
[color
][frame
]);
1082 Sbar_DeathmatchOverlay
1086 void Sbar_DeathmatchOverlay (void)
1095 scr_copyeverything
= 1;
1098 pic
= Draw_CachePic ("gfx/ranking.lmp");
1099 M_DrawPic ((320-pic
->width
)/2, 8, pic
);
1105 l
= scoreboardlines
;
1107 x
= 80 + ((vid
.width
- 320)>>1);
1109 for (i
=0 ; i
<l
; i
++)
1117 top
= s
->colors
& 0xf0;
1118 bottom
= (s
->colors
& 15)<<4;
1119 top
= Sbar_ColorForMap (top
);
1120 bottom
= Sbar_ColorForMap (bottom
);
1122 Draw_Fill ( x
, y
, 40, 4, top
);
1123 Draw_Fill ( x
, y
+4, 40, 4, bottom
);
1127 sprintf (num
, "%3i",f
);
1129 Draw_Character ( x
+8 , y
, num
[0]);
1130 Draw_Character ( x
+16 , y
, num
[1]);
1131 Draw_Character ( x
+24 , y
, num
[2]);
1133 if (k
== cl
.viewentity
- 1)
1134 Draw_Character ( x
- 8, y
, 12);
1139 int n
, minutes
, tens
, units
;
1142 total
= cl
.completed_time
- s
->entertime
;
1143 minutes
= (int)total
/60;
1144 n
= total
- minutes
*60;
1148 sprintf (num
, "%3i:%i%i", minutes
, tens
, units
);
1150 Draw_String ( x
+48 , y
, num
);
1155 Draw_String (x
+64, y
, s
->name
);
1163 Sbar_DeathmatchOverlay
1167 void Sbar_MiniDeathmatchOverlay (void)
1176 if (vid
.width
< 512 || !sb_lines
)
1179 scr_copyeverything
= 1;
1186 y
= vid
.height
- sb_lines
;
1187 numlines
= sb_lines
/8;
1192 for (i
= 0; i
< scoreboardlines
; i
++)
1193 if (fragsort
[i
] == cl
.viewentity
- 1)
1196 if (i
== scoreboardlines
) // we're not there
1198 else // figure out start
1201 if (i
> scoreboardlines
- numlines
)
1202 i
= scoreboardlines
- numlines
;
1207 for (/* */; i
< scoreboardlines
&& y
< vid
.height
- 8 ; i
++)
1215 top
= s
->colors
& 0xf0;
1216 bottom
= (s
->colors
& 15)<<4;
1217 top
= Sbar_ColorForMap (top
);
1218 bottom
= Sbar_ColorForMap (bottom
);
1220 Draw_Fill ( x
, y
+1, 40, 3, top
);
1221 Draw_Fill ( x
, y
+4, 40, 4, bottom
);
1225 sprintf (num
, "%3i",f
);
1227 Draw_Character ( x
+8 , y
, num
[0]);
1228 Draw_Character ( x
+16 , y
, num
[1]);
1229 Draw_Character ( x
+24 , y
, num
[2]);
1231 if (k
== cl
.viewentity
- 1) {
1232 Draw_Character ( x
, y
, 16);
1233 Draw_Character ( x
+ 32, y
, 17);
1239 int n
, minutes
, tens
, units
;
1242 total
= cl
.completed_time
- s
->entertime
;
1243 minutes
= (int)total
/60;
1244 n
= total
- minutes
*60;
1248 sprintf (num
, "%3i:%i%i", minutes
, tens
, units
);
1250 Draw_String ( x
+48 , y
, num
);
1255 Draw_String (x
+48, y
, s
->name
);
1263 Sbar_IntermissionOverlay
1267 void Sbar_IntermissionOverlay (void)
1273 scr_copyeverything
= 1;
1276 if (cl
.gametype
== GAME_DEATHMATCH
)
1278 Sbar_DeathmatchOverlay ();
1282 pic
= Draw_CachePic ("gfx/complete.lmp");
1283 Draw_Pic (64, 24, pic
);
1285 pic
= Draw_CachePic ("gfx/inter.lmp");
1286 Draw_TransPic (0, 56, pic
);
1289 dig
= cl
.completed_time
/60;
1290 Sbar_IntermissionNumber (160, 64, dig
, 3, 0);
1291 num
= cl
.completed_time
- dig
*60;
1292 Draw_TransPic (234,64,sb_colon
);
1293 Draw_TransPic (246,64,sb_nums
[0][num
/10]);
1294 Draw_TransPic (266,64,sb_nums
[0][num
%10]);
1296 Sbar_IntermissionNumber (160, 104, cl
.stats
[STAT_SECRETS
], 3, 0);
1297 Draw_TransPic (232,104,sb_slash
);
1298 Sbar_IntermissionNumber (240, 104, cl
.stats
[STAT_TOTALSECRETS
], 3, 0);
1300 Sbar_IntermissionNumber (160, 144, cl
.stats
[STAT_MONSTERS
], 3, 0);
1301 Draw_TransPic (232,144,sb_slash
);
1302 Sbar_IntermissionNumber (240, 144, cl
.stats
[STAT_TOTALMONSTERS
], 3, 0);
1313 void Sbar_FinaleOverlay (void)
1317 scr_copyeverything
= 1;
1319 pic
= Draw_CachePic ("gfx/finale.lmp");
1320 Draw_TransPic ( (vid
.width
-pic
->width
)/2, 16, pic
);