mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
Change hudswap to use a callback, and instead of passing a swap variable to 10 functions, where only 2 use it, use a global variable. Make a few scr functions static inline, too. Got a totally unexpected ~0.45fps speedup.
This commit is contained in:
parent
f9d3f9f017
commit
d4a8224d9b
18 changed files with 120 additions and 104 deletions
|
@ -42,7 +42,7 @@ void Draw_TextBox (int x, int y, int width, int lines, byte alpha);
|
||||||
void Draw_TransPic (int x, int y, qpic_t *pic);
|
void Draw_TransPic (int x, int y, qpic_t *pic);
|
||||||
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation);
|
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation);
|
||||||
void Draw_ConsoleBackground (int lines);
|
void Draw_ConsoleBackground (int lines);
|
||||||
void Draw_Crosshair(int swap);
|
void Draw_Crosshair (void);
|
||||||
void Draw_BeginDisc (void);
|
void Draw_BeginDisc (void);
|
||||||
void Draw_EndDisc (void);
|
void Draw_EndDisc (void);
|
||||||
void Draw_TileClear (int x, int y, int w, int h);
|
void Draw_TileClear (int x, int y, int w, int h);
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
void SCR_Init_Cvars (void);
|
void SCR_Init_Cvars (void);
|
||||||
void SCR_Init (void);
|
void SCR_Init (void);
|
||||||
|
|
||||||
typedef void (*SCR_Func)(int);
|
typedef void (*SCR_Func)(void);
|
||||||
// scr_funcs is a null terminated array
|
// scr_funcs is a null terminated array
|
||||||
void SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap);
|
void SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs);
|
||||||
void SCR_UpdateWholeScreen (void);
|
void SCR_UpdateWholeScreen (void);
|
||||||
|
|
||||||
void SCR_SizeUp (void);
|
void SCR_SizeUp (void);
|
||||||
|
@ -48,13 +48,13 @@ void SCR_CenterPrint (const char *str);
|
||||||
void SCR_BeginLoadingPlaque (void);
|
void SCR_BeginLoadingPlaque (void);
|
||||||
void SCR_EndLoadingPlaque (void);
|
void SCR_EndLoadingPlaque (void);
|
||||||
|
|
||||||
void SCR_DrawRam (int swap);
|
void SCR_DrawRam (void);
|
||||||
void SCR_DrawFPS (int swap);
|
void SCR_DrawFPS (void);
|
||||||
void SCR_DrawTime (int swap);
|
void SCR_DrawTime (void);
|
||||||
void SCR_DrawTurtle (int swap);
|
void SCR_DrawTurtle (void);
|
||||||
void SCR_DrawPause (int swap);
|
void SCR_DrawPause (void);
|
||||||
void SCR_CheckDrawCenterString (int swap);
|
void SCR_CheckDrawCenterString (void);
|
||||||
void SCR_DrawConsole (int swap);
|
void SCR_DrawConsole (void);
|
||||||
|
|
||||||
struct tex_s *SCR_ScreenShot (int width, int height);
|
struct tex_s *SCR_ScreenShot (int width, int height);
|
||||||
void SCR_DrawStringToSnap (const char *s, struct tex_s *tex, int x, int y);
|
void SCR_DrawStringToSnap (const char *s, struct tex_s *tex, int x, int y);
|
||||||
|
@ -71,6 +71,7 @@ extern int sb_lines;
|
||||||
extern int clearnotify; // set to 0 whenever notify text is drawn
|
extern int clearnotify; // set to 0 whenever notify text is drawn
|
||||||
extern qboolean scr_disabled_for_loading;
|
extern qboolean scr_disabled_for_loading;
|
||||||
extern qboolean scr_skipupdate;
|
extern qboolean scr_skipupdate;
|
||||||
|
extern qboolean hudswap;
|
||||||
|
|
||||||
extern struct cvar_s *scr_viewsize;
|
extern struct cvar_s *scr_viewsize;
|
||||||
extern struct cvar_s *scr_fov;
|
extern struct cvar_s *scr_fov;
|
||||||
|
|
|
@ -43,13 +43,13 @@ extern struct cvar_s *r_ambient;
|
||||||
extern struct cvar_s *r_clearcolor;
|
extern struct cvar_s *r_clearcolor;
|
||||||
extern struct cvar_s *r_dlight_lightmap;
|
extern struct cvar_s *r_dlight_lightmap;
|
||||||
extern struct cvar_s *r_drawentities;
|
extern struct cvar_s *r_drawentities;
|
||||||
extern struct cvar_s *r_drawexplosions; // DESPAIR
|
extern struct cvar_s *r_drawexplosions;
|
||||||
extern struct cvar_s *r_drawflat;
|
extern struct cvar_s *r_drawflat;
|
||||||
extern struct cvar_s *r_draworder;
|
extern struct cvar_s *r_draworder;
|
||||||
extern struct cvar_s *r_drawviewmodel;
|
extern struct cvar_s *r_drawviewmodel;
|
||||||
extern struct cvar_s *r_dspeeds;
|
extern struct cvar_s *r_dspeeds;
|
||||||
extern struct cvar_s *r_dynamic;
|
extern struct cvar_s *r_dynamic;
|
||||||
extern struct cvar_s *r_explosionclip; // DESPAIR
|
extern struct cvar_s *r_explosionclip;
|
||||||
extern struct cvar_s *r_firecolor;
|
extern struct cvar_s *r_firecolor;
|
||||||
extern struct cvar_s *r_fullbright;
|
extern struct cvar_s *r_fullbright;
|
||||||
extern struct cvar_s *r_graphheight;
|
extern struct cvar_s *r_graphheight;
|
||||||
|
|
|
@ -41,7 +41,7 @@ void Sbar_Init (void);
|
||||||
void Sbar_Changed (void);
|
void Sbar_Changed (void);
|
||||||
// call whenever any of the client stats represented on the sbar changes
|
// call whenever any of the client stats represented on the sbar changes
|
||||||
|
|
||||||
void Sbar_Draw (int swap);
|
void Sbar_Draw (void);
|
||||||
// called every frame by screen
|
// called every frame by screen
|
||||||
|
|
||||||
void Sbar_IntermissionOverlay (void);
|
void Sbar_IntermissionOverlay (void);
|
||||||
|
|
|
@ -386,7 +386,7 @@ Draw_AltString (int x, int y, const char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Draw_Crosshair (int swap)
|
Draw_Crosshair (void)
|
||||||
{
|
{
|
||||||
unsigned char *pColor;
|
unsigned char *pColor;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
|
@ -217,7 +217,7 @@ SCR_DrawCenterString (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_CheckDrawCenterString (int swap)
|
SCR_CheckDrawCenterString (void)
|
||||||
{
|
{
|
||||||
scr_copytop = 1;
|
scr_copytop = 1;
|
||||||
if (scr_center_lines > scr_erase_lines)
|
if (scr_center_lines > scr_erase_lines)
|
||||||
|
@ -363,7 +363,7 @@ SCR_Init (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawRam (int swap)
|
SCR_DrawRam (void)
|
||||||
{
|
{
|
||||||
if (!scr_showram->int_val)
|
if (!scr_showram->int_val)
|
||||||
return;
|
return;
|
||||||
|
@ -375,7 +375,7 @@ SCR_DrawRam (int swap)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawTurtle (int swap)
|
SCR_DrawTurtle (void)
|
||||||
{
|
{
|
||||||
static int count;
|
static int count;
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ SCR_DrawTurtle (int swap)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawFPS (int swap)
|
SCR_DrawFPS (void)
|
||||||
{
|
{
|
||||||
char st[80];
|
char st[80];
|
||||||
double t;
|
double t;
|
||||||
|
@ -427,7 +427,7 @@ SCR_DrawFPS (int swap)
|
||||||
i = 80;
|
i = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = swap ? vid.width - ((strlen (st) * 8) + i) : i;
|
x = hudswap ? vid.width - ((strlen (st) * 8) + i) : i;
|
||||||
y = vid.height - sb_lines - 8;
|
y = vid.height - sb_lines - 8;
|
||||||
Draw_String (x, y, st);
|
Draw_String (x, y, st);
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ SCR_DrawFPS (int swap)
|
||||||
Written by Misty, rewritten by Deek.
|
Written by Misty, rewritten by Deek.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
SCR_DrawTime (int swap)
|
SCR_DrawTime (void)
|
||||||
{
|
{
|
||||||
char st[80];
|
char st[80];
|
||||||
char *timefmt = NULL;
|
char *timefmt = NULL;
|
||||||
|
@ -463,13 +463,13 @@ SCR_DrawTime (int swap)
|
||||||
strftime (st, sizeof (st), timefmt, local);
|
strftime (st, sizeof (st), timefmt, local);
|
||||||
|
|
||||||
// Print it at far left/right of screen
|
// Print it at far left/right of screen
|
||||||
x = swap ? (vid.width - ((strlen (st) * 8) + 8)) : 8;
|
x = hudswap ? (vid.width - ((strlen (st) * 8) + 8)) : 8;
|
||||||
y = vid.height - (sb_lines + 8);
|
y = vid.height - (sb_lines + 8);
|
||||||
Draw_String (x, y, st);
|
Draw_String (x, y, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawPause (int swap)
|
SCR_DrawPause (void)
|
||||||
{
|
{
|
||||||
qpic_t *pic;
|
qpic_t *pic;
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ SCR_SetUpToDrawConsole (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawConsole (int swap)
|
SCR_DrawConsole (void)
|
||||||
{
|
{
|
||||||
if (scr_con_current) {
|
if (scr_con_current) {
|
||||||
scr_copyeverything = 1;
|
scr_copyeverything = 1;
|
||||||
|
@ -771,7 +771,7 @@ int oldviewsize = 0;
|
||||||
needs almost the entire 256k of stack space!
|
needs almost the entire 256k of stack space!
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs)
|
||||||
{
|
{
|
||||||
double time1 = 0, time2;
|
double time1 = 0, time2;
|
||||||
|
|
||||||
|
@ -851,10 +851,10 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
||||||
} else if (r_force_fullscreen /*FIXME better test*/ == 2 &&
|
} else if (r_force_fullscreen /*FIXME better test*/ == 2 &&
|
||||||
key_dest == key_game) {
|
key_dest == key_game) {
|
||||||
Sbar_FinaleOverlay ();
|
Sbar_FinaleOverlay ();
|
||||||
SCR_CheckDrawCenterString (swap);
|
SCR_CheckDrawCenterString ();
|
||||||
} else {
|
} else {
|
||||||
while (*scr_funcs) {
|
while (*scr_funcs) {
|
||||||
(*scr_funcs)(swap);
|
(*scr_funcs)();
|
||||||
scr_funcs++;
|
scr_funcs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,7 +283,7 @@ Draw_Pixel (int x, int y, byte color)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Draw_Crosshair (int swap)
|
Draw_Crosshair (void)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
byte c = crosshaircolor->int_val;
|
byte c = crosshaircolor->int_val;
|
||||||
|
|
|
@ -217,7 +217,7 @@ SCR_DrawCenterString (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_CheckDrawCenterString (int swap)
|
SCR_CheckDrawCenterString (void)
|
||||||
{
|
{
|
||||||
scr_copytop = 1;
|
scr_copytop = 1;
|
||||||
if (scr_center_lines > scr_erase_lines)
|
if (scr_center_lines > scr_erase_lines)
|
||||||
|
@ -417,7 +417,7 @@ SCR_Init (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawRam (int swap)
|
SCR_DrawRam (void)
|
||||||
{
|
{
|
||||||
if (!scr_showram->int_val)
|
if (!scr_showram->int_val)
|
||||||
return;
|
return;
|
||||||
|
@ -429,7 +429,7 @@ SCR_DrawRam (int swap)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawTurtle (int swap)
|
SCR_DrawTurtle (void)
|
||||||
{
|
{
|
||||||
static int count;
|
static int count;
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ SCR_DrawTurtle (int swap)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawFPS (int swap)
|
SCR_DrawFPS (void)
|
||||||
{
|
{
|
||||||
static double lastframetime;
|
static double lastframetime;
|
||||||
double t;
|
double t;
|
||||||
|
@ -476,10 +476,7 @@ SCR_DrawFPS (int swap)
|
||||||
} else {
|
} else {
|
||||||
i = 80;
|
i = 80;
|
||||||
}
|
}
|
||||||
/* Misty: New trick! (for me) the ? makes this work like a if then else -
|
x = hudswap ? vid.width - ((strlen (st) * 8) + i) : i;
|
||||||
IE: if cl_hudswap->int_val is not null, do first case, else (else is a
|
|
||||||
: here) do second case. Deek taught me this trick */
|
|
||||||
x = swap ? vid.width - ((strlen (st) * 8) + i) : i;
|
|
||||||
y = vid.height - (sb_lines + 8);
|
y = vid.height - (sb_lines + 8);
|
||||||
Draw_String (x, y, st);
|
Draw_String (x, y, st);
|
||||||
}
|
}
|
||||||
|
@ -491,7 +488,7 @@ SCR_DrawFPS (int swap)
|
||||||
Written by Misty, rewritten by Deek
|
Written by Misty, rewritten by Deek
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
SCR_DrawTime (int swap)
|
SCR_DrawTime (void)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
char st[80];
|
char st[80];
|
||||||
|
@ -516,13 +513,13 @@ SCR_DrawTime (int swap)
|
||||||
|
|
||||||
// Print it next to the fps meter
|
// Print it next to the fps meter
|
||||||
strftime (st, sizeof (st), timefmt, local);
|
strftime (st, sizeof (st), timefmt, local);
|
||||||
x = swap ? (vid.width - ((strlen (st) * 8) + 8)) : 8;
|
x = hudswap ? (vid.width - ((strlen (st) * 8) + 8)) : 8;
|
||||||
y = vid.height - (sb_lines + 8);
|
y = vid.height - (sb_lines + 8);
|
||||||
Draw_String (x, y, st);
|
Draw_String (x, y, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawPause (int swap)
|
SCR_DrawPause (void)
|
||||||
{
|
{
|
||||||
qpic_t *pic;
|
qpic_t *pic;
|
||||||
|
|
||||||
|
@ -572,7 +569,7 @@ SCR_SetUpToDrawConsole (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawConsole (int swap)
|
SCR_DrawConsole (void)
|
||||||
{
|
{
|
||||||
if (scr_con_current) {
|
if (scr_con_current) {
|
||||||
scr_copyeverything = 1;
|
scr_copyeverything = 1;
|
||||||
|
@ -809,7 +806,7 @@ SCR_DrawNotifyString (void)
|
||||||
needs almost the entire 256k of stack space!
|
needs almost the entire 256k of stack space!
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs)
|
||||||
{
|
{
|
||||||
static int oldscr_viewsize;
|
static int oldscr_viewsize;
|
||||||
vrect_t vrect;
|
vrect_t vrect;
|
||||||
|
@ -876,10 +873,10 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
||||||
Sbar_IntermissionOverlay ();
|
Sbar_IntermissionOverlay ();
|
||||||
} else if (r_force_fullscreen /*FIXME*/ == 2 && key_dest == key_game) {
|
} else if (r_force_fullscreen /*FIXME*/ == 2 && key_dest == key_game) {
|
||||||
Sbar_FinaleOverlay ();
|
Sbar_FinaleOverlay ();
|
||||||
SCR_CheckDrawCenterString (swap);
|
SCR_CheckDrawCenterString ();
|
||||||
} else {
|
} else {
|
||||||
while (*scr_funcs) {
|
while (*scr_funcs) {
|
||||||
(*scr_funcs)(swap);
|
(*scr_funcs)();
|
||||||
scr_funcs++;
|
scr_funcs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,7 @@ Draw_Pixel (int x, int y, byte color)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Draw_Crosshair (int swap)
|
Draw_Crosshair (void)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
byte c = crosshaircolor->int_val;
|
byte c = crosshaircolor->int_val;
|
||||||
|
|
|
@ -217,7 +217,7 @@ SCR_DrawCenterString (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_CheckDrawCenterString (int swap)
|
SCR_CheckDrawCenterString (void)
|
||||||
{
|
{
|
||||||
scr_copytop = 1;
|
scr_copytop = 1;
|
||||||
if (scr_center_lines > scr_erase_lines)
|
if (scr_center_lines > scr_erase_lines)
|
||||||
|
@ -484,7 +484,7 @@ SCR_Init (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawRam (int swap)
|
SCR_DrawRam (void)
|
||||||
{
|
{
|
||||||
if (!scr_showram->int_val)
|
if (!scr_showram->int_val)
|
||||||
return;
|
return;
|
||||||
|
@ -496,7 +496,7 @@ SCR_DrawRam (int swap)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawTurtle (int swap)
|
SCR_DrawTurtle (void)
|
||||||
{
|
{
|
||||||
static int count;
|
static int count;
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ SCR_DrawTurtle (int swap)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawFPS (int swap)
|
SCR_DrawFPS (void)
|
||||||
{
|
{
|
||||||
static double lastframetime;
|
static double lastframetime;
|
||||||
double t;
|
double t;
|
||||||
|
@ -543,10 +543,7 @@ SCR_DrawFPS (int swap)
|
||||||
} else {
|
} else {
|
||||||
i = 80;
|
i = 80;
|
||||||
}
|
}
|
||||||
/* Misty: New trick! (for me) the ? makes this work like a if then else -
|
x = hudswap ? vid.width - ((strlen (st) * 8) + i) : i;
|
||||||
IE: if cl_hudswap->int_val is not null, do first case, else (else is a
|
|
||||||
: here) do second case. Deek taught me this trick */
|
|
||||||
x = swap ? vid.width - ((strlen (st) * 8) + i) : i;
|
|
||||||
y = vid.height - (sb_lines + 8);
|
y = vid.height - (sb_lines + 8);
|
||||||
Draw_String (x, y, st);
|
Draw_String (x, y, st);
|
||||||
}
|
}
|
||||||
|
@ -558,7 +555,7 @@ SCR_DrawFPS (int swap)
|
||||||
Written by Misty, rewritten by Deek
|
Written by Misty, rewritten by Deek
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
SCR_DrawTime (int swap)
|
SCR_DrawTime (void)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
char st[80];
|
char st[80];
|
||||||
|
@ -583,13 +580,13 @@ SCR_DrawTime (int swap)
|
||||||
|
|
||||||
// Print it next to the fps meter
|
// Print it next to the fps meter
|
||||||
strftime (st, sizeof (st), timefmt, local);
|
strftime (st, sizeof (st), timefmt, local);
|
||||||
x = swap ? (vid.width - ((strlen (st) * 8) + 8)) : 8;
|
x = hudswap ? (vid.width - ((strlen (st) * 8) + 8)) : 8;
|
||||||
y = vid.height - (sb_lines + 8);
|
y = vid.height - (sb_lines + 8);
|
||||||
Draw_String (x, y, st);
|
Draw_String (x, y, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawPause (int swap)
|
SCR_DrawPause (void)
|
||||||
{
|
{
|
||||||
qpic_t *pic;
|
qpic_t *pic;
|
||||||
|
|
||||||
|
@ -639,7 +636,7 @@ SCR_SetUpToDrawConsole (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawConsole (int swap)
|
SCR_DrawConsole (void)
|
||||||
{
|
{
|
||||||
if (scr_con_current) {
|
if (scr_con_current) {
|
||||||
scr_copyeverything = 1;
|
scr_copyeverything = 1;
|
||||||
|
@ -829,7 +826,7 @@ SCR_DrawNotifyString (void)
|
||||||
needs almost the entire 256k of stack space!
|
needs almost the entire 256k of stack space!
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs)
|
||||||
{
|
{
|
||||||
static int oldscr_viewsize;
|
static int oldscr_viewsize;
|
||||||
vrect_t vrect;
|
vrect_t vrect;
|
||||||
|
@ -896,10 +893,10 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
||||||
Sbar_IntermissionOverlay ();
|
Sbar_IntermissionOverlay ();
|
||||||
} else if (r_force_fullscreen /*FIXME*/ == 2 && key_dest == key_game) {
|
} else if (r_force_fullscreen /*FIXME*/ == 2 && key_dest == key_game) {
|
||||||
Sbar_FinaleOverlay ();
|
Sbar_FinaleOverlay ();
|
||||||
SCR_CheckDrawCenterString (swap);
|
SCR_CheckDrawCenterString ();
|
||||||
} else {
|
} else {
|
||||||
while (*scr_funcs) {
|
while (*scr_funcs) {
|
||||||
(*scr_funcs)(swap);
|
(*scr_funcs)();
|
||||||
scr_funcs++;
|
scr_funcs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ cvar_t *show_fps;
|
||||||
cvar_t *show_time;
|
cvar_t *show_time;
|
||||||
|
|
||||||
int fps_count;
|
int fps_count;
|
||||||
|
qboolean hudswap;
|
||||||
|
|
||||||
client_static_t cls;
|
client_static_t cls;
|
||||||
client_state_t cl;
|
client_state_t cl;
|
||||||
|
@ -97,6 +98,15 @@ CL_Sbar_f (cvar_t *var)
|
||||||
r_lineadj = var->int_val ? sb_lines : 0;
|
r_lineadj = var->int_val ? sb_lines : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cl_hudswap_f (cvar_t *var)
|
||||||
|
{
|
||||||
|
if (cl_hudswap)
|
||||||
|
hudswap = cl_hudswap->int_val;
|
||||||
|
else
|
||||||
|
hudswap = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_InitCvars (void)
|
CL_InitCvars (void)
|
||||||
{
|
{
|
||||||
|
@ -135,7 +145,7 @@ CL_InitCvars (void)
|
||||||
"linear motion interpolation");
|
"linear motion interpolation");
|
||||||
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_f,
|
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_f,
|
||||||
"status bar mode");
|
"status bar mode");
|
||||||
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
|
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, cl_hudswap_f,
|
||||||
"new HUD on left side?");
|
"new HUD on left side?");
|
||||||
lookspring = Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL, "Snap view "
|
lookspring = Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL, "Snap view "
|
||||||
"to center when moving and no mlook/klook");
|
"to center when moving and no mlook/klook");
|
||||||
|
|
|
@ -162,7 +162,7 @@ Sbar_Changed (void)
|
||||||
|
|
||||||
Draw a texture.
|
Draw a texture.
|
||||||
*/
|
*/
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawPic (int x, int y, qpic_t *pic)
|
Sbar_DrawPic (int x, int y, qpic_t *pic)
|
||||||
{
|
{
|
||||||
if (sbar_centered)
|
if (sbar_centered)
|
||||||
|
@ -178,7 +178,7 @@ Sbar_DrawPic (int x, int y, qpic_t *pic)
|
||||||
|
|
||||||
Draw a _portion_ of a texture.
|
Draw a _portion_ of a texture.
|
||||||
*/
|
*/
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +197,7 @@ Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
||||||
|
|
||||||
Draw a transparent pic?
|
Draw a transparent pic?
|
||||||
*/
|
*/
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawTransPic (int x, int y, qpic_t *pic)
|
Sbar_DrawTransPic (int x, int y, qpic_t *pic)
|
||||||
{
|
{
|
||||||
if (sbar_centered)
|
if (sbar_centered)
|
||||||
|
@ -213,7 +213,7 @@ Sbar_DrawTransPic (int x, int y, qpic_t *pic)
|
||||||
|
|
||||||
Draw one solid graphics character
|
Draw one solid graphics character
|
||||||
*/
|
*/
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawCharacter (int x, int y, int num)
|
Sbar_DrawCharacter (int x, int y, int num)
|
||||||
{
|
{
|
||||||
if (sbar_centered)
|
if (sbar_centered)
|
||||||
|
@ -229,7 +229,7 @@ Sbar_DrawCharacter (int x, int y, int num)
|
||||||
|
|
||||||
Draw a string
|
Draw a string
|
||||||
*/
|
*/
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawString (int x, int y, char *str)
|
Sbar_DrawString (int x, int y, char *str)
|
||||||
{
|
{
|
||||||
if (sbar_centered)
|
if (sbar_centered)
|
||||||
|
@ -438,7 +438,7 @@ Sbar_DrawInventory (void)
|
||||||
|
|
||||||
if (headsup) {
|
if (headsup) {
|
||||||
if (i || vid.height > 200)
|
if (i || vid.height > 200)
|
||||||
Sbar_DrawSubPic ((cl_hudswap->int_val) ? 0
|
Sbar_DrawSubPic (hudswap ? 0
|
||||||
: (vid.width - 24), -68 - (7 - i) * 16,
|
: (vid.width - 24), -68 - (7 - i) * 16,
|
||||||
sb_weapons[flashon][i], 0, 0, 24, 16);
|
sb_weapons[flashon][i], 0, 0, 24, 16);
|
||||||
} else {
|
} else {
|
||||||
|
@ -514,19 +514,19 @@ Sbar_DrawInventory (void)
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
snprintf (num, sizeof (num), "%3i", cl.stats[STAT_SHELLS + i]);
|
snprintf (num, sizeof (num), "%3i", cl.stats[STAT_SHELLS + i]);
|
||||||
if (headsup) {
|
if (headsup) {
|
||||||
Sbar_DrawSubPic ((cl_hudswap->int_val) ? 0 : (vid.width - 42),
|
Sbar_DrawSubPic (hudswap ? 0 : (vid.width - 42),
|
||||||
-24 - (4 - i) * 11, sb_ibar, 3 + (i * 48), 0, 42,
|
-24 - (4 - i) * 11, sb_ibar, 3 + (i * 48), 0, 42,
|
||||||
11);
|
11);
|
||||||
if (num[0] != ' ')
|
if (num[0] != ' ')
|
||||||
Sbar_DrawCharacter ((cl_hudswap->int_val) ? 3
|
Sbar_DrawCharacter (hudswap ? 3
|
||||||
: (vid.width - 39), -24 - (4 - i) * 11,
|
: (vid.width - 39), -24 - (4 - i) * 11,
|
||||||
18 + num[0] - '0');
|
18 + num[0] - '0');
|
||||||
if (num[1] != ' ')
|
if (num[1] != ' ')
|
||||||
Sbar_DrawCharacter ((cl_hudswap->int_val) ? 11
|
Sbar_DrawCharacter (hudswap ? 11
|
||||||
: (vid.width - 31), -24 - (4 - i) * 11,
|
: (vid.width - 31), -24 - (4 - i) * 11,
|
||||||
18 + num[1] - '0');
|
18 + num[1] - '0');
|
||||||
if (num[2] != ' ')
|
if (num[2] != ' ')
|
||||||
Sbar_DrawCharacter ((cl_hudswap->int_val) ? 19
|
Sbar_DrawCharacter (hudswap ? 19
|
||||||
: (vid.width - 23), -24 - (4 - i) * 11,
|
: (vid.width - 23), -24 - (4 - i) * 11,
|
||||||
18 + num[2] - '0');
|
18 + num[2] - '0');
|
||||||
} else {
|
} else {
|
||||||
|
@ -833,7 +833,7 @@ Sbar_DrawNormal (void)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Sbar_Draw (int swap)
|
Sbar_Draw (void)
|
||||||
{
|
{
|
||||||
if (hipnotic || rogue) {
|
if (hipnotic || rogue) {
|
||||||
if (!cl_sbar->int_val) {
|
if (!cl_sbar->int_val) {
|
||||||
|
|
|
@ -335,7 +335,7 @@ extern double realtime;
|
||||||
|
|
||||||
void Cvar_Info (struct cvar_s *var);
|
void Cvar_Info (struct cvar_s *var);
|
||||||
|
|
||||||
void CL_NetGraph (int swap);
|
void CL_NetGraph (void);
|
||||||
void CL_UpdateScreen (double realtime);
|
void CL_UpdateScreen (double realtime);
|
||||||
|
|
||||||
void CL_SetState (cactive_t state);
|
void CL_SetState (cactive_t state);
|
||||||
|
|
|
@ -184,6 +184,7 @@ double connect_time = -1; // for connection retransmits
|
||||||
quakeparms_t host_parms;
|
quakeparms_t host_parms;
|
||||||
qboolean host_initialized; // true if into command execution
|
qboolean host_initialized; // true if into command execution
|
||||||
qboolean nomaster;
|
qboolean nomaster;
|
||||||
|
qboolean hudswap;
|
||||||
|
|
||||||
double host_frametime;
|
double host_frametime;
|
||||||
double realtime; // without any filtering or bounding
|
double realtime; // without any filtering or bounding
|
||||||
|
@ -1074,6 +1075,15 @@ CL_Download_f (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cl_hudswap_f (cvar_t *var)
|
||||||
|
{
|
||||||
|
if (cl_hudswap)
|
||||||
|
hudswap = cl_hudswap->int_val;
|
||||||
|
else
|
||||||
|
hudswap = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Force_CenterView_f (void)
|
Force_CenterView_f (void)
|
||||||
{
|
{
|
||||||
|
@ -1237,7 +1247,7 @@ CL_Init_Cvars (void)
|
||||||
"status bar mode");
|
"status bar mode");
|
||||||
cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, NULL,
|
cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, NULL,
|
||||||
"turns on status bar separator");
|
"turns on status bar separator");
|
||||||
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
|
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, cl_hudswap_f,
|
||||||
"new HUD on left side?");
|
"new HUD on left side?");
|
||||||
cl_maxfps = Cvar_Get ("cl_maxfps", "0", CVAR_ARCHIVE, NULL,
|
cl_maxfps = Cvar_Get ("cl_maxfps", "0", CVAR_ARCHIVE, NULL,
|
||||||
"maximum frames rendered in one second. 0 == 32");
|
"maximum frames rendered in one second. 0 == 32");
|
||||||
|
|
|
@ -40,6 +40,7 @@ static const char rcsid[] =
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "QF/draw.h"
|
#include "QF/draw.h"
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
|
#include "QF/screen.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "cl_parse.h"
|
#include "cl_parse.h"
|
||||||
|
@ -49,7 +50,7 @@ static const char rcsid[] =
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_NetGraph (int swap)
|
CL_NetGraph (void)
|
||||||
{
|
{
|
||||||
char st[80];
|
char st[80];
|
||||||
int lost, a, l, x, y, h, i;
|
int lost, a, l, x, y, h, i;
|
||||||
|
@ -59,7 +60,7 @@ CL_NetGraph (int swap)
|
||||||
|
|
||||||
a = 0; // shut up gcc
|
a = 0; // shut up gcc
|
||||||
|
|
||||||
x = swap ? vid.width - (NET_TIMINGS + 16): 0;
|
x = hudswap ? vid.width - (NET_TIMINGS + 16): 0;
|
||||||
y = vid.height - sb_lines - 24 - r_graphheight->int_val - 1;
|
y = vid.height - sb_lines - 24 - r_graphheight->int_val - 1;
|
||||||
|
|
||||||
h = r_graphheight->int_val % 8;
|
h = r_graphheight->int_val % 8;
|
||||||
|
@ -68,7 +69,7 @@ CL_NetGraph (int swap)
|
||||||
r_netgraph_alpha->value * 255);
|
r_netgraph_alpha->value * 255);
|
||||||
|
|
||||||
lost = CL_CalcNet ();
|
lost = CL_CalcNet ();
|
||||||
x = swap ? vid.width - (NET_TIMINGS + 8) : 8;
|
x = hudswap ? vid.width - (NET_TIMINGS + 8) : 8;
|
||||||
y = vid.height - sb_lines - 9;
|
y = vid.height - sb_lines - 9;
|
||||||
|
|
||||||
l = NET_TIMINGS;
|
l = NET_TIMINGS;
|
||||||
|
@ -86,7 +87,7 @@ CL_NetGraph (int swap)
|
||||||
|
|
||||||
y = vid.height - sb_lines - 24 - r_graphheight->int_val + 7;
|
y = vid.height - sb_lines - 24 - r_graphheight->int_val + 7;
|
||||||
snprintf (st, sizeof (st), "%3i%% packet loss", lost);
|
snprintf (st, sizeof (st), "%3i%% packet loss", lost);
|
||||||
if (swap) {
|
if (hudswap) {
|
||||||
Draw_String (vid.width - ((strlen (st) * 8) + 8), y, st);
|
Draw_String (vid.width - ((strlen (st) * 8) + 8), y, st);
|
||||||
} else {
|
} else {
|
||||||
Draw_String (8, y, st);
|
Draw_String (8, y, st);
|
||||||
|
|
|
@ -54,7 +54,7 @@ static const char rcsid[] =
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
SCR_DrawNet (int swap)
|
SCR_DrawNet (void)
|
||||||
{
|
{
|
||||||
if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged <
|
if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged <
|
||||||
UPDATE_BACKUP - 1)
|
UPDATE_BACKUP - 1)
|
||||||
|
@ -66,14 +66,14 @@ SCR_DrawNet (int swap)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_NetStats (int swap)
|
CL_NetStats (void)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
if (!show_ping->int_val && !show_pl->int_val)
|
if (!show_ping->int_val && !show_pl->int_val)
|
||||||
return;
|
return;
|
||||||
if (cls.state != ca_active)
|
if (cls.state != ca_active)
|
||||||
return;
|
return;
|
||||||
x = swap ? vid.width - 104 : 0;
|
x = hudswap ? vid.width - 104 : 0;
|
||||||
y = vid.height - sb_lines - 16;
|
y = vid.height - sb_lines - 16;
|
||||||
// request new ping times every two second
|
// request new ping times every two second
|
||||||
if (realtime - cl.last_ping_request > 2) {
|
if (realtime - cl.last_ping_request > 2) {
|
||||||
|
@ -86,7 +86,7 @@ CL_NetStats (int swap)
|
||||||
ping = bound (0, ping, 999);
|
ping = bound (0, ping, 999);
|
||||||
Draw_String (x, y, va ("%3d ms", ping));
|
Draw_String (x, y, va ("%3d ms", ping));
|
||||||
x+= 48;
|
x+= 48;
|
||||||
} else if (swap) {
|
} else if (hudswap) {
|
||||||
x += 56;
|
x += 56;
|
||||||
}
|
}
|
||||||
if (show_ping->int_val && show_pl->int_val) {
|
if (show_ping->int_val && show_pl->int_val) {
|
||||||
|
@ -124,7 +124,7 @@ void
|
||||||
CL_UpdateScreen (double realtime)
|
CL_UpdateScreen (double realtime)
|
||||||
{
|
{
|
||||||
V_PrepBlend ();
|
V_PrepBlend ();
|
||||||
SCR_UpdateScreen (realtime, scr_funcs, cl_hudswap->int_val);
|
SCR_UpdateScreen (realtime, scr_funcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -247,7 +247,7 @@ Sbar_Init (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// drawing routines are reletive to the status bar location
|
// drawing routines are reletive to the status bar location
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawPic (int x, int y, qpic_t *pic)
|
Sbar_DrawPic (int x, int y, qpic_t *pic)
|
||||||
{
|
{
|
||||||
Draw_Pic (x, y + (vid.height - SBAR_HEIGHT), pic);
|
Draw_Pic (x, y + (vid.height - SBAR_HEIGHT), pic);
|
||||||
|
@ -258,7 +258,7 @@ Sbar_DrawPic (int x, int y, qpic_t *pic)
|
||||||
|
|
||||||
JACK: Draws a portion of the picture in the status bar.
|
JACK: Draws a portion of the picture in the status bar.
|
||||||
*/
|
*/
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
|
@ -266,7 +266,7 @@ Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
||||||
height);
|
height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawTransPic (int x, int y, qpic_t *pic)
|
Sbar_DrawTransPic (int x, int y, qpic_t *pic)
|
||||||
{
|
{
|
||||||
Draw_Pic (x, y + (vid.height - SBAR_HEIGHT),
|
Draw_Pic (x, y + (vid.height - SBAR_HEIGHT),
|
||||||
|
@ -278,13 +278,13 @@ Sbar_DrawTransPic (int x, int y, qpic_t *pic)
|
||||||
|
|
||||||
Draws one solid graphics character
|
Draws one solid graphics character
|
||||||
*/
|
*/
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawCharacter (int x, int y, int num)
|
Sbar_DrawCharacter (int x, int y, int num)
|
||||||
{
|
{
|
||||||
Draw_Character (x + 4, y + vid.height - SBAR_HEIGHT, num);
|
Draw_Character (x + 4, y + vid.height - SBAR_HEIGHT, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static inline void
|
||||||
Sbar_DrawString (int x, int y, char *str)
|
Sbar_DrawString (int x, int y, char *str)
|
||||||
{
|
{
|
||||||
Draw_String (x, y + vid.height - SBAR_HEIGHT, str);
|
Draw_String (x, y + vid.height - SBAR_HEIGHT, str);
|
||||||
|
@ -366,7 +366,8 @@ Sbar_SortFrags (qboolean includespec)
|
||||||
// sort by frags
|
// sort by frags
|
||||||
scoreboardlines = 0;
|
scoreboardlines = 0;
|
||||||
for (i = 0; i < MAX_CLIENTS; i++) {
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
||||||
if (cl.players[i].name[0] && (!cl.players[i].spectator || includespec)) {
|
if (cl.players[i].name[0] && (!cl.players[i].spectator ||
|
||||||
|
includespec)) {
|
||||||
fragsort[scoreboardlines] = i;
|
fragsort[scoreboardlines] = i;
|
||||||
scoreboardlines++;
|
scoreboardlines++;
|
||||||
if (cl.players[i].spectator)
|
if (cl.players[i].spectator)
|
||||||
|
@ -477,10 +478,9 @@ Sbar_DrawInventory (void)
|
||||||
char num[6];
|
char num[6];
|
||||||
float time;
|
float time;
|
||||||
int flashon, i;
|
int flashon, i;
|
||||||
qboolean headsup, hudswap;
|
qboolean headsup;
|
||||||
|
|
||||||
headsup = !(cl_sbar->int_val || scr_viewsize->int_val < 100);
|
headsup = !(cl_sbar->int_val || scr_viewsize->int_val < 100);
|
||||||
hudswap = cl_hudswap->int_val;
|
|
||||||
|
|
||||||
if (!headsup)
|
if (!headsup)
|
||||||
Sbar_DrawPic (0, -24, sb_ibar);
|
Sbar_DrawPic (0, -24, sb_ibar);
|
||||||
|
@ -501,7 +501,7 @@ Sbar_DrawInventory (void)
|
||||||
|
|
||||||
if (headsup) {
|
if (headsup) {
|
||||||
if (i || vid.height > 200)
|
if (i || vid.height > 200)
|
||||||
Sbar_DrawSubPic ((hudswap) ? 0 : (vid.width - 24),
|
Sbar_DrawSubPic (hudswap ? 0 : (vid.width - 24),
|
||||||
-68 - (7 - i) * 16,
|
-68 - (7 - i) * 16,
|
||||||
sb_weapons[flashon][i], 0, 0, 24, 16);
|
sb_weapons[flashon][i], 0, 0, 24, 16);
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ Sbar_DrawInventory (void)
|
||||||
snprintf (num, sizeof (num), "%3i", min (cl.stats[STAT_SHELLS + i],
|
snprintf (num, sizeof (num), "%3i", min (cl.stats[STAT_SHELLS + i],
|
||||||
999));
|
999));
|
||||||
if (headsup) {
|
if (headsup) {
|
||||||
#define HUD_X(dist) ((hudswap) ? dist : (vid.width - (42 - dist)))
|
#define HUD_X(dist) (hudswap ? dist : (vid.width - (42 - dist)))
|
||||||
#define HUD_Y(n) (-24 - (4 - n) * 11)
|
#define HUD_Y(n) (-24 - (4 - n) * 11)
|
||||||
Sbar_DrawSubPic (HUD_X (0), HUD_Y (i), sb_ibar,
|
Sbar_DrawSubPic (HUD_X (0), HUD_Y (i), sb_ibar,
|
||||||
3 + (i * 48), 0, 42, 11);
|
3 + (i * 48), 0, 42, 11);
|
||||||
|
@ -699,7 +699,7 @@ Sbar_DrawNormal (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sbar_Draw (int swap)
|
Sbar_Draw (void)
|
||||||
{
|
{
|
||||||
char st[512];
|
char st[512];
|
||||||
qboolean headsup;
|
qboolean headsup;
|
||||||
|
|
Loading…
Reference in a new issue