QW-style HUD support for NUQ. It defaults to off. Set cl_sbar 0 to turn

it on, set cl_hudswap to move it to the left side. I'll make the options
menu options for them work tomorrow.
This commit is contained in:
Jeff Teunissen 2000-09-27 01:17:48 +00:00
parent 495cf79c09
commit 2c1968e79e
8 changed files with 556 additions and 572 deletions

View file

@ -283,6 +283,9 @@ extern cvar_t *cl_autofire;
extern cvar_t *cl_shownet;
extern cvar_t *cl_nolerp;
extern cvar_t *cl_sbar;
extern cvar_t *cl_hudswap;
extern cvar_t *cl_pitchdriftspeed;
extern cvar_t *lookspring;
extern cvar_t *lookstrafe;

View file

@ -37,6 +37,7 @@ void Draw_Init (void);
void Draw_Character8 (int x, int y, int num);
void Draw_DebugChar (char num);
void Draw_Pic (int x, int y, qpic_t *pic);
void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height);
void Draw_TransPic (int x, int y, qpic_t *pic);
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation);
void Draw_ConsoleBackground (int lines);

View file

@ -52,6 +52,9 @@ cvar_t *cl_color;
cvar_t *cl_shownet;
cvar_t *cl_nolerp;
cvar_t *cl_sbar;
cvar_t *cl_hudswap;
cvar_t *lookspring;
cvar_t *lookstrafe;
cvar_t *sensitivity;
@ -94,6 +97,10 @@ CL_InitCvars(void)
cl_anglespeedkey = Cvar_Get("cl_anglespeedkey", "1.5", CVAR_NONE, "None");
cl_shownet = Cvar_Get("cl_shownet", "0", CVAR_NONE, "can be 0, 1, or 2");
cl_nolerp = Cvar_Get("cl_nolerp", "0", CVAR_NONE, "None");
cl_sbar = Cvar_Get ("cl_sbar", "1", CVAR_ARCHIVE, "Use old status bar");
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, "HUD on left side?");
lookspring = Cvar_Get("lookspring", "0", CVAR_ARCHIVE, "None");
lookstrafe = Cvar_Get("lookstrafe", "0", CVAR_ARCHIVE, "None");
sensitivity = Cvar_Get("sensitivity", "3", CVAR_ARCHIVE, "None");

View file

@ -345,6 +345,57 @@ void Draw_Pic (int x, int y, qpic_t *pic)
}
/*
=============
Draw_SubPic
=============
*/
void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height)
{
byte *dest, *source;
unsigned short *pusdest;
int v, u;
if ((x < 0) ||
(x + width > vid.width) ||
(y < 0) ||
(y + height > vid.height))
{
Sys_Error ("Draw_SubPic: bad coordinates");
}
source = pic->data + srcy * pic->width + srcx;
if (r_pixbytes == 1)
{
dest = vid.buffer + y * vid.rowbytes + x;
for (v=0 ; v<height ; v++)
{
memcpy (dest, source, width);
dest += vid.rowbytes;
source += pic->width;
}
}
else
{
// FIXME: pretranslate at load time?
pusdest = (unsigned short *)vid.buffer + y * (vid.rowbytes >> 1) + x;
for (v=0 ; v<height ; v++)
{
for (u=srcx ; u<(srcx+width) ; u++)
{
pusdest[u] = d_8to16table[source[u]];
}
pusdest += vid.rowbytes >> 1;
source += pic->width;
}
}
}
/*
=============
Draw_TransPic

View file

@ -311,16 +311,10 @@ static void SCR_CalcRefdef (void)
//========================================
// bound viewsize
if (scr_viewsize->value < 30)
Cvar_Set (scr_viewsize,"30");
if (scr_viewsize->value > 120)
Cvar_Set (scr_viewsize,"120");
Cvar_SetValue (scr_viewsize, bound (30, scr_viewsize->value, 120));
// bound field of view
if (scr_fov->value < 10)
Cvar_Set (scr_fov,"10");
if (scr_fov->value > 170)
Cvar_Set (scr_fov,"170");
Cvar_SetValue (scr_fov, bound (10, scr_fov->value, 170));
// intermission is always full screen
if (cl.intermission)
@ -338,30 +332,36 @@ static void SCR_CalcRefdef (void)
if (scr_viewsize->value >= 100.0) {
full = true;
size = 100.0;
} else
} else {
size = scr_viewsize->value;
if (cl.intermission)
{
}
if (cl.intermission) {
full = true;
size = 100;
sb_lines = 0;
}
size /= 100.0;
if (!cl_sbar->value && full)
h = vid.height;
else
h = vid.height - sb_lines;
r_refdef.vrect.width = vid.width * size;
if (r_refdef.vrect.width < 96)
{
if (r_refdef.vrect.width < 96) {
size = 96.0 / r_refdef.vrect.width;
r_refdef.vrect.width = 96; // min for icons
}
r_refdef.vrect.height = vid.height * size;
if (cl_sbar->value || !full) {
if (r_refdef.vrect.height > vid.height - sb_lines)
r_refdef.vrect.height = vid.height - sb_lines;
} else {
if (r_refdef.vrect.height > vid.height)
r_refdef.vrect.height = vid.height;
}
r_refdef.vrect.x = (vid.width - r_refdef.vrect.width)/2;
if (full)
r_refdef.vrect.y = 0;

View file

@ -327,17 +327,33 @@ void R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
{
int h;
float size;
qboolean full = false;
size = scr_viewsize->value > 100 ? 100 : scr_viewsize->value;
if (cl.intermission)
{
size = 100;
if (scr_viewsize->value >= 100.0) {
size = 100.0;
full = true;
} else {
size = scr_viewsize->value;
}
if (cl.intermission) {
full = true;
size = 100.0;
lineadj = 0;
}
size /= 100;
if (!cl_sbar->value && full)
h = pvrectin->height;
else
h = pvrectin->height - lineadj;
if (full) {
pvrect->width = pvrectin->width;
} else {
pvrect->width = pvrectin->width * size;
}
if (pvrect->width < 96)
{
size = 96.0 / pvrectin->width;
@ -345,22 +361,30 @@ void R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
}
pvrect->width &= ~7;
pvrect->height = pvrectin->height * size;
if (cl_sbar->value || !full) {
if (pvrect->height > pvrectin->height - lineadj)
pvrect->height = pvrectin->height - lineadj;
} else {
if (pvrect->height > pvrectin->height)
pvrect->height = pvrectin->height;
}
pvrect->height &= ~1;
pvrect->x = (pvrectin->width - pvrect->width)/2;
pvrect->y = (h - pvrect->height)/2;
{
if (lcd_x->value)
{
if (full)
pvrect->y = 0;
else
pvrect->y = (h - pvrect->height)/2;
if (lcd_x->value) {
pvrect->y >>= 1;
pvrect->height >>= 1;
}
}
}
/*

View file

@ -1,7 +1,7 @@
/*
sbar.c
@description@
Status bar
Copyright (C) 1996-1997 Id Software, Inc.
@ -30,6 +30,7 @@
# include "config.h"
#endif
#include "compat.h"
#include "sbar.h"
#include "qdefs.h"
#include "vid.h"
@ -130,8 +131,7 @@ void Sbar_Init (void)
{
int i;
for (i=0 ; i<10 ; i++)
{
for (i=0 ; i<10 ; i++) {
sb_nums[0][i] = Draw_PicFromWad (va("num_%i",i));
sb_nums[1][i] = Draw_PicFromWad (va("anum_%i",i));
}
@ -158,8 +158,7 @@ void Sbar_Init (void)
sb_weapons[1][5] = Draw_PicFromWad ("inv2_srlaunch");
sb_weapons[1][6] = Draw_PicFromWad ("inv2_lightng");
for (i=0 ; i<5 ; i++)
{
for (i = 0; i < 5; i++) {
sb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_shotgun",i+1));
sb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_sshotgun",i+1));
sb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_nailgun",i+1));
@ -214,8 +213,7 @@ void Sbar_Init (void)
sb_scorebar = Draw_PicFromWad ("scorebar");
//MED 01/04/97 added new hipnotic weapons
if (hipnotic)
{
if (hipnotic) {
hsb_weapons[0][0] = Draw_PicFromWad ("inv_laser");
hsb_weapons[0][1] = Draw_PicFromWad ("inv_mjolnir");
hsb_weapons[0][2] = Draw_PicFromWad ("inv_gren_prox");
@ -228,8 +226,7 @@ void Sbar_Init (void)
hsb_weapons[1][3] = Draw_PicFromWad ("inv2_prox_gren");
hsb_weapons[1][4] = Draw_PicFromWad ("inv2_prox");
for (i=0 ; i<5 ; i++)
{
for (i = 0; i < 5; i++) {
hsb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_laser",i+1));
hsb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_mjolnir",i+1));
hsb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_gren_prox",i+1));
@ -241,8 +238,7 @@ void Sbar_Init (void)
hsb_items[1] = Draw_PicFromWad ("sb_eshld");
}
if (rogue)
{
if (rogue) {
rsb_invbar[0] = Draw_PicFromWad ("r_invbar1");
rsb_invbar[1] = Draw_PicFromWad ("r_invbar2");
@ -277,10 +273,25 @@ Sbar_DrawPic
*/
void Sbar_DrawPic (int x, int y, qpic_t *pic)
{
if (cl.gametype == GAME_DEATHMATCH)
Draw_Pic (x /* + ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
else
if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue))
Draw_Pic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic);
else
Draw_Pic (x, y + (vid.height-SBAR_HEIGHT), pic);
}
/*
=============
Sbar_DrawSubPic
=============
JACK: Draws a portion of the picture in the status bar.
*/
void Sbar_DrawSubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height)
{
if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue))
Draw_SubPic (x + ((vid.width - 320)>>1), y + (vid.height - SBAR_HEIGHT), pic, srcx, srcy, width, height);
else
Draw_SubPic (x, y + (vid.height - SBAR_HEIGHT), pic, srcx, srcy, width, height);
}
/*
@ -290,10 +301,10 @@ Sbar_DrawTransPic
*/
void Sbar_DrawTransPic (int x, int y, qpic_t *pic)
{
if (cl.gametype == GAME_DEATHMATCH)
Draw_TransPic (x /*+ ((vid.width - 320)>>1)*/, y + (vid.height-SBAR_HEIGHT), pic);
else
if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue))
Draw_TransPic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic);
else
Draw_TransPic (x, y + (vid.height-SBAR_HEIGHT), pic);
}
/*
@ -305,10 +316,10 @@ Draws one solid graphics character
*/
void Sbar_DrawCharacter (int x, int y, int num)
{
if (cl.gametype == GAME_DEATHMATCH)
Draw_Character8 ( x /*+ ((vid.width - 320)>>1) */ + 4 , y + vid.height-SBAR_HEIGHT, num);
else
if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue))
Draw_Character8 (x + ((vid.width - 320)>>1) + 4 , y + vid.height-SBAR_HEIGHT, num);
else
Draw_Character8 (x + 4 , y + vid.height-SBAR_HEIGHT, num);
}
/*
@ -318,10 +329,10 @@ Sbar_DrawString
*/
void Sbar_DrawString (int x, int y, char *str)
{
if (cl.gametype == GAME_DEATHMATCH)
Draw_String8 (x /*+ ((vid.width - 320)>>1)*/, y+ vid.height-SBAR_HEIGHT, str);
else
if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue))
Draw_String8 (x + ((vid.width - 320)>>1), y+ vid.height-SBAR_HEIGHT, str);
else
Draw_String8 (x, y+ vid.height-SBAR_HEIGHT, str);
}
/*
@ -337,17 +348,14 @@ int Sbar_itoa (int num, char *buf)
str = buf;
if (num < 0)
{
if (num < 0) {
*str++ = '-';
num = -num;
}
for (pow10 = 10 ; num >= pow10 ; pow10 *= 10)
;
for (pow10 = 10; num >= pow10; pow10 *= 10);
do
{
do {
pow10 /= 10;
dig = num/pow10;
*str++ = '0' + dig;
@ -378,8 +386,7 @@ void Sbar_DrawNum (int x, int y, int num, int digits, int color)
if (l < digits)
x += (digits-l)*24;
while (*ptr)
{
while (*ptr) {
if (*ptr == '-')
frame = STAT_MINUS;
else
@ -412,28 +419,27 @@ void Sbar_SortFrags (void)
// sort by frags
scoreboardlines = 0;
for (i=0 ; i<cl.maxclients ; i++)
{
if (cl.scores[i].name[0])
{
for (i = 0; i < cl.maxclients; i++) {
if (cl.scores[i].name[0]) {
fragsort[scoreboardlines] = i;
scoreboardlines++;
}
}
for (i=0 ; i<scoreboardlines ; i++)
for (j=0 ; j<scoreboardlines-1-i ; j++)
if (cl.scores[fragsort[j]].frags < cl.scores[fragsort[j+1]].frags)
{
for (i = 0; i < scoreboardlines; i++) {
for (j = 0; j < (scoreboardlines - 1 - i); j++) {
if (cl.scores[fragsort[j]].frags < cl.scores[fragsort[j+1]].frags) {
k = fragsort[j];
fragsort[j] = fragsort[j+1];
fragsort[j+1] = k;
}
}
}
}
int Sbar_ColorForMap (int m)
{
return m < 128 ? m + 8 : m + 8;
return m + 8; // FIXME: Might want this to be return (bound (0, m, 13) * 16) + 8;
}
/*
@ -452,8 +458,7 @@ void Sbar_UpdateScoreboard (void)
// draw the text
memset (scoreboardtext, 0, sizeof (scoreboardtext));
for (i=0 ; i<scoreboardlines; i++)
{
for (i = 0; i < scoreboardlines; i++) {
k = fragsort[i];
s = &cl.scores[k];
snprintf (&scoreboardtext[i][1], sizeof (&scoreboardtext[i][1]), "%3i %s", s->frags, s->name);
@ -466,7 +471,6 @@ void Sbar_UpdateScoreboard (void)
}
/*
===============
Sbar_SoloScoreboard
@ -486,9 +490,9 @@ void Sbar_SoloScoreboard (void)
// time
minutes = cl.time / 60;
seconds = cl.time - 60*minutes;
seconds = cl.time - (60 * minutes);
tens = seconds / 10;
units = seconds - 10*tens;
units = seconds - (10 * tens);
snprintf (str, sizeof (str), "Time :%3i:%i%i", minutes, tens, units);
Sbar_DrawString (184, 4, str);
@ -507,51 +511,6 @@ void Sbar_DrawScoreboard (void)
Sbar_SoloScoreboard ();
if (cl.gametype == GAME_DEATHMATCH)
Sbar_DeathmatchOverlay ();
#if 0
int i, j, c;
int x, y;
int l;
int top, bottom;
scoreboard_t *s;
if (cl.gametype != GAME_DEATHMATCH)
{
Sbar_SoloScoreboard ();
return;
}
Sbar_UpdateScoreboard ();
l = scoreboardlines <= 6 ? scoreboardlines : 6;
for (i=0 ; i<l ; i++)
{
x = 20*(i&1);
y = i/2 * 8;
s = &cl.scores[fragsort[i]];
if (!s->name[0])
continue;
// draw background
top = s->colors & 0xf0;
bottom = (s->colors & 15)<<4;
top = Sbar_ColorForMap (top);
bottom = Sbar_ColorForMap (bottom);
Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y + vid.height - SBAR_HEIGHT, 28, 4, top);
Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y+4 + vid.height - SBAR_HEIGHT, 28, 4, bottom);
// draw text
for (j=0 ; j<20 ; j++)
{
c = scoreboardtext[i][j];
if (c == 0 || c == ' ')
continue;
Sbar_DrawCharacter ( (x+j)*8, y, c);
}
}
#endif
}
//=============================================================================
@ -567,109 +526,108 @@ void Sbar_DrawInventory (void)
char num[6];
float time;
int flashon;
qboolean headsup;
qboolean hudswap;
if (rogue)
{
headsup = !(cl_sbar->value || scr_viewsize->value<100);
hudswap = cl_hudswap->value; // Get that nasty float out :)
if (hipnotic)
headsup = false;
if (rogue) {
headsup = false;
if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
Sbar_DrawPic (0, -24, rsb_invbar[0]);
else
Sbar_DrawPic (0, -24, rsb_invbar[1]);
}
else
{
} else {
if (!headsup)
Sbar_DrawPic (0, -24, sb_ibar);
}
// weapons
for (i=0 ; i<7 ; i++)
{
if (cl.items & (IT_SHOTGUN<<i) )
{
for (i = 0; i < 7; i++) {
if (cl.items & (IT_SHOTGUN<<i)) {
time = cl.item_gettime[i];
flashon = (int) ((cl.time - time) * 10);
if (flashon >= 10)
{
flashon = max (0, flashon);
if (flashon >= 10) {
if (cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN << i))
flashon = 1;
else
flashon = 0;
}
else
} else {
flashon = (flashon % 5) + 2;
}
if (headsup) {
if (i || vid.height > 200)
Sbar_DrawSubPic ((hudswap) ? 0 : (vid.width-24), -68 -(7 - i) * 16, sb_weapons[flashon][i], 0, 0, 24, 16);
} else {
Sbar_DrawPic (i*24, -16, sb_weapons[flashon][i]);
}
if (flashon > 1)
sb_updates = 0; // force update to remove flash
}
}
// MED 01/04/97
// hipnotic weapons
if (hipnotic)
{
if (hipnotic) {
int grenadeflashing = 0;
for (i=0 ; i<4 ; i++)
{
if (cl.items & (1<<hipweapons[i]) )
{
for (i=0; i < 4; i++) {
if (cl.items & (1 << hipweapons[i])) {
time = cl.item_gettime[hipweapons[i]];
flashon = (int) ((cl.time - time) * 10);
if (flashon >= 10)
{
flashon = max (0, flashon);
if (flashon >= 10) {
if (cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i]))
flashon = 1;
else
flashon = 0;
}
else
} else {
flashon = (flashon % 5) + 2;
}
// check grenade launcher
if (i==2)
{
if (cl.items & HIT_PROXIMITY_GUN)
{
if (flashon)
{
switch (i) {
case 2:
if (cl.items & HIT_PROXIMITY_GUN) {
if (flashon) {
grenadeflashing = 1;
Sbar_DrawPic (96, -16, hsb_weapons[flashon][2]);
}
}
}
else if (i==3)
{
if (cl.items & (IT_SHOTGUN<<4))
{
if (flashon && !grenadeflashing)
{
break;
case 3:
if (cl.items & (IT_SHOTGUN << 4)) {
if (flashon && !grenadeflashing) {
Sbar_DrawPic (96, -16, hsb_weapons[flashon][3]);
}
else if (!grenadeflashing)
{
} else if (!grenadeflashing) {
Sbar_DrawPic (96, -16, hsb_weapons[0][3]);
}
}
else
} else {
Sbar_DrawPic (96, -16, hsb_weapons[flashon][4]);
}
else
break;
default:
Sbar_DrawPic (176 + (i*24), -16, hsb_weapons[flashon][i]);
break;
}
if (flashon > 1)
sb_updates = 0; // force update to remove flash
}
}
}
if (rogue)
{
if (rogue) {
// check for powered up weapon.
if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
{
for (i=0;i<5;i++)
{
if (cl.stats[STAT_ACTIVEWEAPON] == (RIT_LAVA_NAILGUN << i))
{
if (cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN) {
for (i = 0; i < 5; i++) {
if (cl.stats[STAT_ACTIVEWEAPON] == (RIT_LAVA_NAILGUN << i)) {
Sbar_DrawPic ((i+2)*24, -16, rsb_weapons[i]);
}
}
@ -677,9 +635,17 @@ void Sbar_DrawInventory (void)
}
// ammo counts
for (i=0 ; i<4 ; i++)
{
for (i = 0; i < 4; i++) {
snprintf (num, sizeof (num), "%3i", cl.stats[STAT_SHELLS + i] );
if (headsup) {
Sbar_DrawSubPic ((hudswap) ? 0 : (vid.width-42), -24 - (4-i)*11, sb_ibar, 3+(i*48), 0, 42, 11);
if (num[0] != ' ')
Sbar_DrawCharacter ((hudswap) ? 3 : (vid.width-39), -24 - (4-i)*11, 18 + num[0] - '0');
if (num[1] != ' ')
Sbar_DrawCharacter ((hudswap) ? 11 : (vid.width-31), -24 - (4-i)*11, 18 + num[1] - '0');
if (num[2] != ' ')
Sbar_DrawCharacter ((hudswap) ? 19 : (vid.width-23), -24 - (4-i)*11, 18 + num[2] - '0');
} else {
if (num[0] != ' ')
Sbar_DrawCharacter ((6 * i + 1) * 8 - 2, -24, 18 + num[0] - '0');
if (num[1] != ' ')
@ -687,86 +653,67 @@ void Sbar_DrawInventory (void)
if (num[2] != ' ')
Sbar_DrawCharacter ((6 * i + 3) * 8 - 2, -24, 18 + num[2] - '0');
}
}
flashon = 0;
// items
for (i=0 ; i<6 ; i++)
if (cl.items & (1<<(17+i)))
{
for (i = 0; i < 6; i++) {
if (cl.items & (1 << (17 + i))) {
time = cl.item_gettime[17 + i];
if (time && time > cl.time - 2 && flashon )
{ // flash frame
if (time && time > (cl.time - 2) && flashon ) { // Flash frame
sb_updates = 0;
}
else
{
//MED 01/04/97 changed keys
if (!hipnotic || (i>1))
{
} else {
if (!hipnotic || (i > 1)) {
Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
}
}
if (time && time > cl.time - 2)
sb_updates = 0;
}
//MED 01/04/97 added hipnotic items
// hipnotic items
if (hipnotic)
{
for (i=0 ; i<2 ; i++)
if (cl.items & (1<<(24+i)))
{
time = cl.item_gettime[24+i];
if (time && time > cl.time - 2 && flashon )
{ // flash frame
sb_updates = 0;
}
else
{
// hipnotic items
if (hipnotic) {
for (i = 0; i < 2; i++) {
if (cl.items & (1 << (24 + i))) {
time = cl.item_gettime[24+i];
if (time && time > cl.time - 2 && flashon ) { // flash frame
sb_updates = 0;
} else {
Sbar_DrawPic (288 + i * 16, -16, hsb_items[i]);
}
if (time && time > cl.time - 2)
if (time && time > (cl.time - 2))
sb_updates = 0;
}
}
}
if (rogue)
{
// new rogue items
for (i=0 ; i<2 ; i++)
{
if (cl.items & (1<<(29+i)))
{
if (rogue) { // new rogue items
for (i = 0; i < 2; i++) {
if (cl.items & (1 << (29 + i))) {
time = cl.item_gettime[29+i];
if (time && time > cl.time - 2 && flashon )
{ // flash frame
if (time && time > (cl.time - 2) && flashon) { // flash frame
sb_updates = 0;
}
else
{
} else {
Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
}
if (time && time > cl.time - 2)
if (time && time > (cl.time - 2))
sb_updates = 0;
}
}
}
else
{
} else {
// sigils
for (i=0 ; i<4 ; i++)
{
if (cl.items & (1<<(28+i)))
{
for (i = 0; i < 4; i++) {
if (cl.items & (1 << (28 + i))) {
time = cl.item_gettime[28 + i];
if (time && time > cl.time - 2 && flashon )
{ // flash frame
if (time && time > cl.time - 2 && flashon ) { // flash frame
sb_updates = 0;
}
else
} else {
Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]);
}
if (time && time > cl.time - 2)
sb_updates = 0;
}
@ -802,8 +749,7 @@ void Sbar_DrawFrags (void)
xofs = (vid.width - 320)>>1;
y = vid.height - SBAR_HEIGHT - 23;
for (i=0 ; i<l ; i++)
{
for (i=0 ; i<l ; i++) {
k = fragsort[i];
s = &cl.scores[k];
if (!s->name[0])
@ -826,8 +772,7 @@ void Sbar_DrawFrags (void)
Sbar_DrawCharacter ( (x+2)*8 , -24, num[1]);
Sbar_DrawCharacter ( (x+3)*8 , -24, num[2]);
if (k == cl.viewentity - 1)
{
if (k == cl.viewentity - 1) {
Sbar_DrawCharacter ( x * 8 + 2, -24, 16);
Sbar_DrawCharacter ((x + 4) * 8 - 4, -24, 17);
}
@ -849,20 +794,19 @@ void Sbar_DrawFace (void)
// PGM 01/19/97 - team color drawing
// PGM 03/02/97 - fixed so color swatch only appears in CTF modes
if (rogue &&
(cl.maxclients != 1) &&
(teamplay->value>3) &&
(teamplay->value<7))
{
if (rogue && (cl.maxclients != 1)
&& (teamplay->value > 3) && (teamplay->value < 7)) {
int top, bottom;
int xofs;
char num[12];
scoreboard_t *s;
s = &cl.scores[cl.viewentity - 1];
// draw background
top = s->colors & 0xf0;
bottom = (s->colors & 15)<<4;
top = (s->colors & 0xf0);
bottom = ((s->colors & 15) << 4);
top = Sbar_ColorForMap (top);
bottom = Sbar_ColorForMap (bottom);
@ -879,17 +823,14 @@ void Sbar_DrawFace (void)
f = s->frags;
snprintf (num, sizeof (num), "%3i", f);
if (top==8)
{
if (top==8) {
if (num[0] != ' ')
Sbar_DrawCharacter(109, 3, 18 + num[0] - '0');
if (num[1] != ' ')
Sbar_DrawCharacter(116, 3, 18 + num[1] - '0');
if (num[2] != ' ')
Sbar_DrawCharacter(123, 3, 18 + num[2] - '0');
}
else
{
} else {
Sbar_DrawCharacter ( 109, 3, num[0]);
Sbar_DrawCharacter ( 116, 3, num[1]);
Sbar_DrawCharacter ( 123, 3, num[2]);
@ -900,23 +841,22 @@ void Sbar_DrawFace (void)
// PGM 01/19/97 - team color drawing
if ((cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY))
== (IT_INVISIBILITY | IT_INVULNERABILITY) )
{
== (IT_INVISIBILITY | IT_INVULNERABILITY)) {
Sbar_DrawPic (112, 0, sb_face_invis_invuln);
return;
}
if (cl.items & IT_QUAD)
{
if (cl.items & IT_QUAD) {
Sbar_DrawPic (112, 0, sb_face_quad );
return;
}
if (cl.items & IT_INVISIBILITY)
{
if (cl.items & IT_INVISIBILITY) {
Sbar_DrawPic (112, 0, sb_face_invis );
return;
}
if (cl.items & IT_INVULNERABILITY)
{
if (cl.items & IT_INVULNERABILITY) {
Sbar_DrawPic (112, 0, sb_face_invuln);
return;
}
@ -926,85 +866,47 @@ void Sbar_DrawFace (void)
else
f = cl.stats[STAT_HEALTH] / 20;
if (cl.time <= cl.faceanimtime)
{
if (cl.time <= cl.faceanimtime) {
anim = 1;
sb_updates = 0; // make sure the anim gets drawn over
}
else
} else {
anim = 0;
}
Sbar_DrawPic (112, 0, sb_faces[f][anim]);
}
/*
===============
Sbar_Draw
===============
=============
Sbar_DrawNormal
=============
*/
void Sbar_Draw (void)
{
if (scr_con_current == vid.height)
return; // console is full screen
if (sb_updates >= vid.numpages)
return;
scr_copyeverything = 1;
sb_updates++;
if (sb_lines && vid.width > 320)
Draw_TileClear (0, vid.height - sb_lines, vid.width, sb_lines);
if (sb_lines > 24)
{
Sbar_DrawInventory ();
if (cl.maxclients != 1)
Sbar_DrawFrags ();
}
if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
{
Sbar_DrawPic (0, 0, sb_scorebar);
Sbar_DrawScoreboard ();
sb_updates = 0;
}
else if (sb_lines)
void Sbar_DrawNormal (void)
{
if (cl_sbar->value || scr_viewsize->value < 100)
Sbar_DrawPic (0, 0, sb_sbar);
// keys (hipnotic only)
//MED 01/04/97 moved keys here so they would not be overwritten
if (hipnotic)
{
if (hipnotic) {
if (cl.items & IT_KEY1)
Sbar_DrawPic (209, 3, sb_items[0]);
if (cl.items & IT_KEY2)
Sbar_DrawPic (209, 12, sb_items[1]);
}
// armor
if (cl.items & IT_INVULNERABILITY)
{
if (cl.items & IT_INVULNERABILITY) {
Sbar_DrawNum (24, 0, 666, 3, 1);
Sbar_DrawPic (0, 0, draw_disc);
}
else
{
if (rogue)
{
Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3,
cl.stats[STAT_ARMOR] <= 25);
} else {
if (rogue) {
Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
if (cl.items & RIT_ARMOR3)
Sbar_DrawPic (0, 0, sb_armor[2]);
else if (cl.items & RIT_ARMOR2)
Sbar_DrawPic (0, 0, sb_armor[1]);
else if (cl.items & RIT_ARMOR1)
Sbar_DrawPic (0, 0, sb_armor[0]);
}
else
{
Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3
, cl.stats[STAT_ARMOR] <= 25);
} else {
Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
if (cl.items & IT_ARMOR3)
Sbar_DrawPic (0, 0, sb_armor[2]);
else if (cl.items & IT_ARMOR2)
@ -1018,12 +920,10 @@ void Sbar_Draw (void)
Sbar_DrawFace ();
// health
Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3
, cl.stats[STAT_HEALTH] <= 25);
Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
// ammo icon
if (rogue)
{
if (rogue) {
if (cl.items & RIT_SHELLS)
Sbar_DrawPic (224, 0, sb_ammo[0]);
else if (cl.items & RIT_NAILS)
@ -1038,9 +938,7 @@ void Sbar_Draw (void)
Sbar_DrawPic (224, 0, rsb_ammo[1]);
else if (cl.items & RIT_MULTI_ROCKETS)
Sbar_DrawPic (224, 0, rsb_ammo[2]);
}
else
{
} else {
if (cl.items & IT_SHELLS)
Sbar_DrawPic (224, 0, sb_ammo[0]);
else if (cl.items & IT_NAILS)
@ -1050,15 +948,49 @@ void Sbar_Draw (void)
else if (cl.items & IT_CELLS)
Sbar_DrawPic (224, 0, sb_ammo[3]);
}
Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3,
cl.stats[STAT_AMMO] <= 10);
Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
}
if (vid.width > 320) {
if (cl.gametype == GAME_DEATHMATCH)
Sbar_MiniDeathmatchOverlay ();
/*
===============
Sbar_Draw
===============
*/
void Sbar_Draw (void)
{
qboolean headsup;
// char st[512];
headsup = !(cl_sbar->value || scr_viewsize->value<100);
if ((sb_updates >= vid.numpages) && !headsup)
return;
if (scr_con_current == vid.height)
return; // console is full screen
scr_copyeverything = 1;
sb_updates++;
// top line
if (sb_lines > 24) {
Sbar_DrawInventory ();
if (cl.maxclients != 1)
Sbar_DrawFrags ();
}
// main area
if (sb_lines > 0) {
if (sb_showscores || cl.stats[STAT_HEALTH] <= 0) {
Sbar_DrawScoreboard ();
} else {
Sbar_DrawNormal ();
}
}
if (!headsup && sb_lines && vid.width > 320)
Draw_TileClear (320, vid.height - sb_lines, vid.width - 320, sb_lines);
}
//=============================================================================
@ -1082,8 +1014,7 @@ void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
if (l < digits)
x += (digits-l)*24;
while (*ptr)
{
while (*ptr) {
if (*ptr == '-')
frame = STAT_MINUS;
else
@ -1124,8 +1055,7 @@ void Sbar_DeathmatchOverlay (void)
x = 80 + ((vid.width - 320) >> 1);
y = 40;
for (i=0 ; i<l ; i++)
{
for (i = 0; i < l; i++) {
k = fragsort[i];
s = &cl.scores[k];
if (!s->name[0])
@ -1151,24 +1081,6 @@ void Sbar_DeathmatchOverlay (void)
if (k == cl.viewentity - 1)
Draw_Character8 ( x - 8, y, 12);
#if 0
{
int total;
int n, minutes, tens, units;
// draw time
total = cl.completed_time - s->entertime;
minutes = (int)total/60;
n = total - minutes*60;
tens = n/10;
units = n%10;
snprintf (num, sizeof(num), "%3i:%i%i", minutes, tens, units);
Draw_String8 ( x+48 , y, num);
}
#endif
// draw name
Draw_String8 (x+64, y, s->name);
@ -1219,12 +1131,10 @@ void Sbar_MiniDeathmatchOverlay (void)
if (i > scoreboardlines - numlines)
i = scoreboardlines - numlines;
if (i < 0)
i = 0;
i = max(i, 0);
x = 324;
for (/* */; i < scoreboardlines && y < vid.height - 8 ; i++)
{
for (; i < scoreboardlines && y < vid.height - 8 ; i++) {
k = fragsort[i];
s = &cl.scores[k];
if (!s->name[0])
@ -1252,24 +1162,6 @@ void Sbar_MiniDeathmatchOverlay (void)
Draw_Character8 ( x + 32, y, 17);
}
#if 0
{
int total;
int n, minutes, tens, units;
// draw time
total = cl.completed_time - s->entertime;
minutes = (int)total/60;
n = total - minutes*60;
tens = n/10;
units = n%10;
snprintf (num, sizeof(num), "%3i:%i%i", minutes, tens, units);
Draw_String8 ( x+48 , y, num);
}
#endif
// draw name
Draw_String8 (x+48, y, s->name);
@ -1292,8 +1184,7 @@ void Sbar_IntermissionOverlay (void)
scr_copyeverything = 1;
scr_fullupdate = 0;
if (cl.gametype == GAME_DEATHMATCH)
{
if (cl.gametype == GAME_DEATHMATCH) {
Sbar_DeathmatchOverlay ();
return;
}
@ -1319,7 +1210,6 @@ void Sbar_IntermissionOverlay (void)
Sbar_IntermissionNumber (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
Draw_TransPic (232, 144, sb_slash);
Sbar_IntermissionNumber (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
}

View file

@ -51,6 +51,8 @@ float scr_con_current;
float scr_conlines; // lines of console to display
float oldscreensize, oldfov;
float oldsbar;
cvar_t *scr_viewsize;
cvar_t *scr_fov;
cvar_t *scr_conspeed;
@ -888,6 +890,12 @@ void SCR_UpdateScreen (void)
vid.recalc_refdef = true;
}
if (oldsbar != cl_sbar->value)
{
oldsbar = cl_sbar->value;
vid.recalc_refdef = true;
}
if (vid.recalc_refdef)
{
// something changed, so reorder the screen