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

@ -263,35 +263,38 @@ typedef struct
//
// cvars
//
extern cvar_t *cl_name;
extern cvar_t *cl_color;
extern cvar_t *cl_name;
extern cvar_t *cl_color;
extern cvar_t *cl_upspeed;
extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_backspeed;
extern cvar_t *cl_sidespeed;
extern cvar_t *cl_upspeed;
extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_backspeed;
extern cvar_t *cl_sidespeed;
extern cvar_t *cl_movespeedkey;
extern cvar_t *cl_movespeedkey;
extern cvar_t *cl_yawspeed;
extern cvar_t *cl_pitchspeed;
extern cvar_t *cl_yawspeed;
extern cvar_t *cl_pitchspeed;
extern cvar_t *cl_anglespeedkey;
extern cvar_t *cl_anglespeedkey;
extern cvar_t *cl_autofire;
extern cvar_t *cl_autofire;
extern cvar_t *cl_shownet;
extern cvar_t *cl_nolerp;
extern cvar_t *cl_shownet;
extern cvar_t *cl_nolerp;
extern cvar_t *cl_pitchdriftspeed;
extern cvar_t *lookspring;
extern cvar_t *lookstrafe;
extern cvar_t *sensitivity;
extern cvar_t *cl_sbar;
extern cvar_t *cl_hudswap;
extern cvar_t *m_pitch;
extern cvar_t *m_yaw;
extern cvar_t *m_forward;
extern cvar_t *m_side;
extern cvar_t *cl_pitchdriftspeed;
extern cvar_t *lookspring;
extern cvar_t *lookstrafe;
extern cvar_t *sensitivity;
extern cvar_t *m_pitch;
extern cvar_t *m_yaw;
extern cvar_t *m_forward;
extern cvar_t *m_side;
#define MAX_TEMP_ENTITIES 64 // lightning bolts, etc

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

@ -298,31 +298,25 @@ Internal use only
static void SCR_CalcRefdef (void)
{
float size;
int h;
qboolean full = false;
int h;
qboolean full = false;
scr_fullupdate = 0; // force a background redraw
vid.recalc_refdef = 0;
// force the status bar to redraw
// force the status bar to redraw
Sbar_Changed ();
//========================================
// bound viewsize
if (scr_viewsize->value < 30)
Cvar_Set (scr_viewsize,"30");
if (scr_viewsize->value > 120)
Cvar_Set (scr_viewsize,"120");
// bound viewsize
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");
// bound field of view
Cvar_SetValue (scr_fov, bound (10, scr_fov->value, 170));
// intermission is always full screen
// intermission is always full screen
if (cl.intermission)
size = 120;
else
@ -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;
h = vid.height - sb_lines;
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 (r_refdef.vrect.height > vid.height - sb_lines)
r_refdef.vrect.height = vid.height - sb_lines;
if (r_refdef.vrect.height > vid.height)
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

@ -325,19 +325,35 @@ R_SetVrect
*/
void R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
{
int h;
float size;
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;
h = pvrectin->height - lineadj;
pvrect->width = pvrectin->width * size;
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,20 +361,28 @@ void R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
}
pvrect->width &= ~7;
pvrect->height = pvrectin->height * size;
if (pvrect->height > pvrectin->height - lineadj)
pvrect->height = pvrectin->height - lineadj;
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;
}
}
}

File diff suppressed because it is too large Load diff

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;
@ -887,6 +889,12 @@ void SCR_UpdateScreen (void)
oldscreensize = scr_viewsize->value;
vid.recalc_refdef = true;
}
if (oldsbar != cl_sbar->value)
{
oldsbar = cl_sbar->value;
vid.recalc_refdef = true;
}
if (vid.recalc_refdef)
{