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
53 qpic_t
*rsb_invbar
[2];
54 qpic_t
*rsb_weapons
[5];
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
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
);
79 void Sbar_ShowScores (void)
94 void Sbar_DontShowScores (void)
96 sb_showscores
= false;
105 void Sbar_Changed (void)
107 sb_updates
= 0; // update next frame
115 void Sbar_Init (void)
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
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");
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");
255 ksb_ammo
[0] = Draw_PicFromWad ("sb_50cal");
260 //=============================================================================
262 // drawing routines are relative to the status bar location
269 void Sbar_DrawPic (int x
, int y
, qpic_t
*pic
)
272 Draw_Pic (x
/* + ((vid.width - 320)>>1)*/, y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
275 if (cl
.gametype
== GAME_DEATHMATCH
)
276 Draw_Pic (x
/* + ((vid.width - 320)>>1)*/, y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
278 Draw_Pic (x
+ ((vid
.width
- 320)>>1), y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
287 void Sbar_DrawTransPic (int x
, int y
, qpic_t
*pic
)
290 Draw_TransPic (x
/*+ ((vid.width - 320)>>1)*/, y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
293 if (cl
.gametype
== GAME_DEATHMATCH
)
294 Draw_TransPic (x
/*+ ((vid.width - 320)>>1)*/, y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
296 Draw_TransPic (x
+ ((vid
.width
- 320)>>1), y
+ (vid
.height
-SBAR_HEIGHT
), pic
);
304 Draws one solid graphics character
307 void Sbar_DrawCharacter (int x
, int y
, int num
)
310 Draw_Character ( x
/*+ ((vid.width - 320)>>1) */ + 4 , y
+ vid
.height
-SBAR_HEIGHT
, num
);
313 if (cl
.gametype
== GAME_DEATHMATCH
)
314 Draw_Character ( x
/*+ ((vid.width - 320)>>1) */ + 4 , y
+ vid
.height
-SBAR_HEIGHT
, num
);
316 Draw_Character ( x
+ ((vid
.width
- 320)>>1) + 4 , y
+ vid
.height
-SBAR_HEIGHT
, num
);
325 void Sbar_DrawString (int x
, int y
, char *str
)
328 Draw_String (x
/*+ ((vid.width - 320)>>1)*/, y
+ vid
.height
-SBAR_HEIGHT
, str
);
331 if (cl
.gametype
== GAME_DEATHMATCH
)
332 Draw_String (x
/*+ ((vid.width - 320)>>1)*/, y
+ vid
.height
-SBAR_HEIGHT
, str
);
334 Draw_String (x
+ ((vid
.width
- 320)>>1), y
+ vid
.height
-SBAR_HEIGHT
, str
);
340 Sbar_DrawScrollString -- johnfitz
342 scroll the string inside a glscissor region
345 void Sbar_DrawScrollString (int x
, int y
, int width
, char* str
)
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);
371 int Sbar_itoa (int num
, char *buf
)
385 for (pow10
= 10 ; num
>= pow10
; pow10
*= 10)
394 } while (pow10
!= 1);
407 void Sbar_DrawNum (int x
, int y
, int num
, int digits
, int color
)
413 l
= Sbar_itoa (num
, str
);
433 Sbar_DrawTransPic (x
,y
,sb_nums
[color
][frame
]);
448 void Sbar_DrawNum2 (int x
, int y
, int num
, int digits
, int color
)
454 l
= Sbar_itoa (num
, str
);
469 Sbar_DrawTransPic (x
,y
,sb_nums
[color
][frame
]);
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
];
491 void Sbar_SortFrags (void)
497 for (i
=0 ; i
<cl
.maxclients
; i
++)
499 if (cl
.scores
[i
].name
[0])
501 fragsort
[scoreboardlines
] = i
;
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
)
511 fragsort
[j
] = fragsort
[j
+1];
516 int Sbar_ColorForMap (int m
)
518 return m
< 128 ? m
+ 8 : m
+ 8;
523 Sbar_UpdateScoreboard
526 void Sbar_UpdateScoreboard (void)
535 memset (scoreboardtext
, 0, sizeof(scoreboardtext
));
537 for (i
=0 ; i
<scoreboardlines
; i
++)
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
);
557 void Sbar_SoloScoreboard (void)
560 int minutes
, seconds
, tens
, units
;
564 sprintf (str
,"Enemies :%3i /%3i", cl
.stats
[STAT_MONSTERS
], cl
.stats
[STAT_TOTALMONSTERS
]);
566 sprintf (str
,"Monsters:%3i /%3i", cl
.stats
[STAT_MONSTERS
], cl
.stats
[STAT_TOTALMONSTERS
]);
567 Sbar_DrawString (8, 4, str
);
570 sprintf (str
,"Objectives :%3i /%3i", cl
.stats
[STAT_SECRETS
], cl
.stats
[STAT_TOTALSECRETS
]);
572 sprintf (str
,"Secrets :%3i /%3i", cl
.stats
[STAT_SECRETS
], cl
.stats
[STAT_TOTALSECRETS
]);
573 Sbar_DrawString (8, 12, str
);
576 minutes
= cl
.time
/ 60;
577 seconds
= cl
.time
- 60*minutes
;
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
587 Sbar_DrawScrollString (184, 12, 160, cl
.levelname
);
590 // Sbar_DrawString (232 - len*4, 12, cl.levelname);
591 Sbar_DrawString (184, 12, cl
.levelname
);
595 // l = strlen (cl.levelname);
596 // Sbar_DrawString (232 - l*4, 12, cl.levelname);
604 void Sbar_DrawScoreboard (void)
606 Sbar_SoloScoreboard ();
607 if (cl
.gametype
== GAME_DEATHMATCH
)
608 Sbar_DeathmatchOverlay ();
616 if (cl
.gametype
!= GAME_DEATHMATCH
)
618 Sbar_SoloScoreboard ();
622 Sbar_UpdateScoreboard ();
624 l
= scoreboardlines
<= 6 ? scoreboardlines
: 6;
626 for (i
=0 ; i
<l
; i
++)
631 s
= &cl
.scores
[fragsort
[i
]];
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
);
645 for (j
=0 ; j
<20 ; j
++)
647 c
= scoreboardtext
[i
][j
];
648 if (c
== 0 || c
== ' ')
650 Sbar_DrawCharacter ( (x
+j
)*8, y
, c
);
656 //=============================================================================
663 void Sbar_DrawInventory (void)
672 if ( cl
.stats
[STAT_ACTIVEWEAPON
] >= RIT_LAVA_NAILGUN
)
673 Sbar_DrawPic (0, -24, rsb_invbar
[0]);
675 Sbar_DrawPic (0, -24, rsb_invbar
[1]);
678 Sbar_DrawPic (0, -24, sb_ibar
);
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);
691 if ( cl
.stats
[STAT_ACTIVEWEAPON
] == (IT_SHOTGUN
<<i
) )
697 flashon
= (flashon
%5) + 2;
699 Sbar_DrawPic (i
*24, -16, sb_weapons
[flashon
][i
]);
702 sb_updates
= 0; // force update to remove flash
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);
719 if ( cl
.stats
[STAT_ACTIVEWEAPON
] == (1<<hipweapons
[i
]) )
725 flashon
= (flashon
%5) + 2;
727 // check grenade launcher
730 if (cl
.items
& HIT_PROXIMITY_GUN
)
735 Sbar_DrawPic (96, -16, hsb_weapons
[flashon
][2]);
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]);
753 Sbar_DrawPic (96, -16, hsb_weapons
[flashon
][4]);
756 Sbar_DrawPic (176 + (i
*24), -16, hsb_weapons
[flashon
][i
]);
758 sb_updates
= 0; // force update to remove flash
765 // check for powered up weapon.
766 if ( cl
.stats
[STAT_ACTIVEWEAPON
] >= RIT_LAVA_NAILGUN
)
770 if (cl
.stats
[STAT_ACTIVEWEAPON
] == (RIT_LAVA_NAILGUN
<< i
))
772 Sbar_DrawPic ((i
+2)*24, -16, rsb_weapons
[i
]);
782 for (i
=0 ; i
<4 ; i
++)
784 sprintf (num
, "%3i",cl
.stats
[STAT_SHELLS
+i
] );
786 Sbar_DrawCharacter ( (6*i
+1)*8 - 2, -24, 18 + num
[0] - '0');
788 Sbar_DrawCharacter ( (6*i
+2)*8 - 2, -24, 18 + num
[1] - '0');
790 Sbar_DrawCharacter ( (6*i
+3)*8 - 2, -24, 18 + num
[2] - '0');
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
)
806 //MED 01/04/97 changed keys
807 if (!hipnotic
|| (i
>1))
810 Sbar_DrawPic (80 + i
*16, 0, sb_items
[i
]);
812 Sbar_DrawPic (192 + i
*16, -16, sb_items
[i
]);
815 if (time
&& time
> cl
.time
- 2)
819 //MED 01/04/97 added hipnotic items
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
)
833 Sbar_DrawPic (288 + i
*16, -16, hsb_items
[i
]);
835 if (time
&& time
> cl
.time
- 2)
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
)
855 Sbar_DrawPic (288 + i
*16, -16, rsb_items
[i
]);
858 if (time
&& time
> cl
.time
- 2)
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 )
880 Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
883 if (time && time > cl.time - 2)
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
)
903 Sbar_DrawPic (320-32 + i
*8, -16, sb_sigil
[i
]);
904 if (time
&& time
> cl
.time
- 2)
911 //=============================================================================
918 void Sbar_DrawFrags (void)
930 l
= scoreboardlines
<= 4 ? scoreboardlines
: 4;
940 if (cl
.gametype
== GAME_DEATHMATCH
)
943 xofs
= (vid
.width
- 320)>>1;
946 y
= vid
.height
- SBAR_HEIGHT
- 23;
948 for (i
=0 ; i
<l
; i
++)
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
);
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);
981 //=============================================================================
989 void Sbar_DrawFace (void)
993 // PGM 01/19/97 - team color drawing
994 // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
996 (cl
.maxclients
!= 1) &&
997 (teamplay
.value
>3) &&
1005 s
= &cl
.scores
[cl
.viewentity
- 1];
1007 top
= s
->colors
& 0xf0;
1008 bottom
= (s
->colors
& 15)<<4;
1009 top
= Sbar_ColorForMap (top
);
1010 bottom
= Sbar_ColorForMap (bottom
);
1018 if (cl
.gametype
== GAME_DEATHMATCH
)
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
);
1030 sprintf (num
, "%3i",f
);
1035 Sbar_DrawCharacter(109, 3, 18 + num
[0] - '0');
1037 Sbar_DrawCharacter(116, 3, 18 + num
[1] - '0');
1039 Sbar_DrawCharacter(123, 3, 18 + num
[2] - '0');
1043 Sbar_DrawCharacter ( 109, 3, num
[0]);
1044 Sbar_DrawCharacter ( 116, 3, num
[1]);
1045 Sbar_DrawCharacter ( 123, 3, num
[2]);
1050 // PGM 01/19/97 - team color drawing
1055 if ( (cl
.items
& (IT_INVISIBILITY
| IT_INVULNERABILITY
) )
1056 == (IT_INVISIBILITY
| IT_INVULNERABILITY
) )
1059 Sbar_DrawPic (8, 0, sb_face_invis_invuln
);
1061 Sbar_DrawPic (112, 0, sb_face_invis_invuln
);
1064 if (cl
.items
& IT_QUAD
)
1067 Sbar_DrawPic (8, 0, sb_face_quad
);
1069 Sbar_DrawPic (112, 0, sb_face_quad
);
1072 if (cl
.items
& IT_INVISIBILITY
)
1075 Sbar_DrawPic (8, 0, sb_face_invis
);
1077 Sbar_DrawPic (112, 0, sb_face_invis
);
1080 if (cl
.items
& IT_INVULNERABILITY
)
1083 Sbar_DrawPic (8, 0, sb_face_invuln
);
1085 Sbar_DrawPic (112, 0, sb_face_invuln
);
1090 if (cl
.stats
[STAT_HEALTH
] >= 100)
1093 f
= cl
.stats
[STAT_HEALTH
] / 20;
1095 if (cl
.time
<= cl
.faceanimtime
)
1098 sb_updates
= 0; // make sure the anim gets drawn over
1104 Sbar_DrawPic (8, 0, sb_faces
[f
][anim
]);
1106 Sbar_DrawPic (112, 0, sb_faces
[f
][anim
]);
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)
1127 if (sb_updates
>= vid
.numpages
)
1130 scr_copyeverything
= 1;
1134 if (sb_lines
&& vid
.width
> 320)
1135 Draw_TileClear (0, vid
.height
- sb_lines
, vid
.width
, sb_lines
);
1139 if (scr_viewsize
.value
< 130)
1141 Sbar_DrawInventory ();
1142 if (cl
.maxclients
!= 1)
1144 if (cl
.stats
[STAT_HEALTH
] > 0)
1146 Sbar_DeathmatchOverlay2 ();
1151 else// if (sb_lines < 24)
1153 if (cl
.maxclients
!= 1)
1155 if (cl
.stats
[STAT_HEALTH
] > 0)
1157 Sbar_DeathmatchOverlay2 ();
1167 Sbar_DrawInventory ();
1168 if (cl
.maxclients
!= 1)
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)
1184 Sbar_DrawPic (0, 0, sb_scorebar
);
1185 Sbar_DrawScoreboard ();
1188 // else if (sb_lines)
1189 else if (sb_lines
>= 0)
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
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]);
1208 if (cl
.items
& IT_INVULNERABILITY
)
1210 Sbar_DrawNum (24, 0, 666, 3, 1);
1211 Sbar_DrawPic (0, 0, draw_disc
);
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]);
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]);
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]);
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]);
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]);
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)
1304 Sbar_DrawNum2 (24, -16, cl
.stats
[STAT_ARMOR
], 3, cl
.stats
[STAT_ARMOR
] <= 25);
1306 Sbar_DrawNum (24, 0, cl
.stats
[STAT_ARMOR
], 3, cl
.stats
[STAT_ARMOR
] <= 25);
1309 if (cl
.stats
[STAT_HEALTH
] <= 0)
1315 // if (cl.stats[STAT_ARMOR] >= 1)
1318 Sbar_DrawNum2 (24, 0, cl
.stats
[STAT_HEALTH
], 3, cl
.stats
[STAT_HEALTH
] <= 25);
1321 Sbar_DrawNum (136, 0, cl
.stats
[STAT_HEALTH
], 3, cl
.stats
[STAT_HEALTH
] <= 25);
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
1366 Sbar_DrawNum2 (418, 0, cl
.stats
[STAT_AMMO
], 3, cl
.stats
[STAT_AMMO
] < 0);
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 ();
1381 //=============================================================================
1385 Sbar_IntermissionNumber
1389 void Sbar_IntermissionNumber (int x
, int y
, int num
, int digits
, int color
)
1395 l
= Sbar_itoa (num
, str
);
1409 Draw_TransPic (x
,y
,sb_nums
[color
][frame
]);
1417 Sbar_DeathmatchOverlay
1421 void Sbar_DeathmatchOverlay (void)
1430 scr_copyeverything
= 1;
1433 pic
= Draw_CachePic ("gfx/ranking.lmp");
1434 M_DrawPic ((320-pic
->width
)/2, 8, pic
);
1440 l
= scoreboardlines
;
1442 x
= 80 + ((vid
.width
- 320)>>1);
1444 for (i
=0 ; i
<l
; i
++)
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
);
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);
1479 int n
, minutes
, tens
, units
;
1482 total
= cl
.completed_time
- s
->entertime
;
1483 minutes
= (int)total
/60;
1484 n
= total
- minutes
*60;
1488 sprintf (num
, "%3i:%i%i", minutes
, tens
, units
);
1490 Draw_String ( x
+48 , y
, num
);
1495 Draw_String (x
+64, y
, s
->name
);
1503 Sbar_DeathmatchOverlay
1507 void Sbar_MiniDeathmatchOverlay (void)
1516 if (vid
.width
< 512 || !sb_lines
)
1519 scr_copyeverything
= 1;
1526 l
= scoreboardlines
;
1527 y
= vid
.height
- sb_lines
;
1528 numlines
= sb_lines
/8;
1533 for (i
= 0; i
< scoreboardlines
; i
++)
1534 if (fragsort
[i
] == cl
.viewentity
- 1)
1537 if (i
== scoreboardlines
) // we're not there
1539 else // figure out start
1542 if (i
> scoreboardlines
- numlines
)
1543 i
= scoreboardlines
- numlines
;
1548 for (/* */; i
< scoreboardlines
&& y
< vid
.height
- 8 ; i
++)
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
);
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);
1580 int n
, minutes
, tens
, units
;
1583 total
= cl
.completed_time
- s
->entertime
;
1584 minutes
= (int)total
/60;
1585 n
= total
- minutes
*60;
1589 sprintf (num
, "%3i:%i%i", minutes
, tens
, units
);
1591 Draw_String ( x
+48 , y
, num
);
1596 Draw_String (x
+48, y
, s
->name
);
1604 Sbar_DeathmatchOverlay2
1608 void Sbar_DeathmatchOverlay2 (void)
1617 scr_copyeverything
= 1;
1624 l
= scoreboardlines
;
1628 for (i
=0 ; i
<l
; i
++)
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
);
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
);
1668 void Sbar_TimeOverlay (void)
1671 int minutes
, seconds
, tens
, units
;
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
);
1686 Sbar_IntermissionOverlay
1690 void Sbar_IntermissionOverlay (void)
1696 scr_copyeverything
= 1;
1699 if (cl
.gametype
== GAME_DEATHMATCH
)
1701 Sbar_DeathmatchOverlay ();
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
);
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);
1736 void Sbar_FinaleOverlay (void)
1740 scr_copyeverything
= 1;
1742 pic
= Draw_CachePic ("gfx/finale.lmp");
1743 Draw_TransPic ( (vid
.width
-pic
->width
)/2, 16, pic
);