A few of Mercury's local changes and things I've done to stable.. We're

attempting to get a build WITHOUT GL to work again...
This commit is contained in:
Joseph Carter 2000-01-25 05:59:19 +00:00
parent 392ba79ded
commit 8e85621d15
9 changed files with 223 additions and 153 deletions

6
NEWS
View file

@ -1,6 +1,12 @@
NEWS for the QuakeForge project NEWS for the QuakeForge project
------------------------------- -------------------------------
22 Jan 2000 - cl_sbar and cl_hudswap in uquake
The cvars cl_sbar and cl_hudswap noe work in uquake just like they
do in qw-client. In uquake, cl_sbar defaults to 1 to satisfy the
least-surprise principle. Set it to 0 if you want a qw-client like
HUD.
22 Jan 2000 - changes to command line option -game 22 Jan 2000 - changes to command line option -game
You may now specify multiple game directories with -game. If for You may now specify multiple game directories with -game. If for
example you wanted to use the original registered game with MegaTF example you wanted to use the original registered game with MegaTF

View file

@ -76,6 +76,7 @@ void VID_UnlockBuffer (void);
#include "cdaudio.h" #include "cdaudio.h"
#include "glquake.h" #include "glquake.h"
#include "cvars.h"
#ifndef max #ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b)) #define max(a,b) ((a) > (b) ? (a) : (b))

View file

@ -23,6 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CVARS_H #ifndef _CVARS_H
#define _CVARS_H #define _CVARS_H
extert cvar_t gl_flashblend; extern cvar_t gl_flashblend;
#endif _CVARS_H #endif _CVARS_H

View file

@ -36,7 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SURFCACHE_SIZE_AT_320X200 600*1024 #define SURFCACHE_SIZE_AT_320X200 600*1024
/*
typedef struct surfcache_s typedef struct surfcache_s
{ {
struct surfcache_s *next; struct surfcache_s *next;
@ -50,7 +49,6 @@ typedef struct surfcache_s
struct texture_s *texture; // checked for animating textures struct texture_s *texture; // checked for animating textures
byte data[4]; // width*height elements byte data[4]; // width*height elements
} surfcache_t; } surfcache_t;
*/
// !!! if this is changed, it must be changed in asm_draw.h too !!! // !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct sspan_s typedef struct sspan_s

View file

@ -657,7 +657,7 @@ void VID_Init(unsigned char *palette)
if (QF_XMesaSetFXmode) { if (QF_XMesaSetFXmode) {
#ifdef XMESA #ifdef XMESA
const char *str = getenv("MESA_GLX_FX"); const char *str = getenv("MESA_GLX_FX");
if (*str && *str != 'd') { if (str != NULL && *str != 'f') {
if (tolower(*str) == 'w') { if (tolower(*str) == 'w') {
Cvar_SetValue("vid_glx_fullscreen", 0); Cvar_SetValue("vid_glx_fullscreen", 0);
} else { } else {

View file

@ -117,6 +117,7 @@ void R_TimeRefresh_f (void);
void R_ReadPointFile_f (void); void R_ReadPointFile_f (void);
texture_t *R_TextureAnimation (texture_t *base); texture_t *R_TextureAnimation (texture_t *base);
/*
typedef struct surfcache_s typedef struct surfcache_s
{ {
struct surfcache_s *next; struct surfcache_s *next;
@ -130,6 +131,7 @@ typedef struct surfcache_s
struct texture_s *texture; // checked for animating textures struct texture_s *texture; // checked for animating textures
byte data[4]; // width*height elements byte data[4]; // width*height elements
} surfcache_t; } surfcache_t;
*/
//==================================================== //====================================================

View file

@ -11,8 +11,8 @@ AC_DEFINE_UNQUOTED(VERSION,"$VERSION")
dnl Set to yes for releases dnl Set to yes for releases
RELEASE=no RELEASE=no
dnl At some point this might be set to yes by default dnl Set this to no for Id defaults
NEWSTYLE=no NEWSTYLE=yes
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
AC_LANG_C AC_LANG_C

View file

@ -1,6 +1,8 @@
/* /*
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush. Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include <time.h>
/* /*
background clear background clear
@ -71,50 +75,49 @@ console is:
*/ */
int glx, gly, glwidth, glheight; int glx, gly, glwidth, glheight;
// only the refresh window will be updated unless these variables are flagged // only the refresh window will be updated unless these variables are flagged
int scr_copytop; int scr_copytop;
int scr_copyeverything; int scr_copyeverything;
float scr_con_current; float scr_con_current;
float scr_conlines; // lines of console to display float scr_conlines; // lines of console to display
float oldscreensize, oldfov; float oldscreensize, oldfov;
cvar_t scr_viewsize = {"viewsize","100", true}; cvar_t scr_viewsize = {"viewsize","100", true};
cvar_t scr_fov = {"fov","90"}; // 10 - 170 cvar_t scr_fov = {"fov","90"}; // 10 - 170
cvar_t scr_conspeed = {"scr_conspeed","300"}; cvar_t scr_conspeed = {"scr_conspeed","300"};
cvar_t scr_centertime = {"scr_centertime","2"}; cvar_t scr_centertime = {"scr_centertime","2"};
cvar_t scr_showram = {"showram","1"}; cvar_t scr_showram = {"showram","1"};
cvar_t scr_showturtle = {"showturtle","0"}; cvar_t scr_showturtle = {"showturtle","0"};
cvar_t scr_showpause = {"showpause","1"}; cvar_t scr_showpause = {"showpause","1"};
cvar_t scr_printspeed = {"scr_printspeed","8"}; cvar_t scr_printspeed = {"scr_printspeed","8"};
cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", true }; cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", true };
extern cvar_t crosshair;
extern cvar_t crosshair; qboolean scr_initialized; // ready to draw
qboolean scr_initialized; // ready to draw qpic_t *scr_ram;
qpic_t *scr_net;
qpic_t *scr_turtle;
qpic_t *scr_ram; int scr_fullupdate;
qpic_t *scr_net;
qpic_t *scr_turtle;
int scr_fullupdate; int clearconsole;
int clearnotify;
int clearconsole; int sb_lines;
int clearnotify;
int sb_lines; viddef_t vid; // global video state
viddef_t vid; // global video state vrect_t scr_vrect;
vrect_t scr_vrect; qboolean scr_disabled_for_loading;
qboolean scr_drawloading;
float scr_disabled_time;
qboolean scr_disabled_for_loading; qboolean block_drawing;
qboolean scr_drawloading;
float scr_disabled_time;
qboolean block_drawing;
void SCR_ScreenShot_f (void); void SCR_ScreenShot_f (void);
@ -126,12 +129,12 @@ CENTER PRINTING
=============================================================================== ===============================================================================
*/ */
char scr_centerstring[1024]; char scr_centerstring[1024];
float scr_centertime_start; // for slow victory printing float scr_centertime_start; // for slow victory printing
float scr_centertime_off; float scr_centertime_off;
int scr_center_lines; int scr_center_lines;
int scr_erase_lines; int scr_erase_lines;
int scr_erase_center; int scr_erase_center;
/* /*
============== ==============
@ -160,11 +163,11 @@ void SCR_CenterPrint (char *str)
void SCR_DrawCenterString (void) void SCR_DrawCenterString (void)
{ {
char *start; char *start;
int l; int l;
int j; int j;
int x, y; int x, y;
int remaining; int remaining;
// the finale prints the characters one at a time // the finale prints the characters one at a time
if (cl.intermission) if (cl.intermission)
@ -180,7 +183,7 @@ void SCR_DrawCenterString (void)
else else
y = 48; y = 48;
do do
{ {
// scan the width of the line // scan the width of the line
for (l=0 ; l<40 ; l++) for (l=0 ; l<40 ; l++)
@ -189,7 +192,7 @@ void SCR_DrawCenterString (void)
x = (vid.width - l*8)/2; x = (vid.width - l*8)/2;
for (j=0 ; j<l ; j++, x+=8) for (j=0 ; j<l ; j++, x+=8)
{ {
Draw_Character (x, y, start[j]); Draw_Character (x, y, start[j]);
if (!remaining--) if (!remaining--)
return; return;
} }
@ -201,7 +204,7 @@ void SCR_DrawCenterString (void)
if (!*start) if (!*start)
break; break;
start++; // skip the \n start++; // skip the \n
} while (1); } while (1);
} }
@ -255,12 +258,12 @@ Internal use only
*/ */
static void SCR_CalcRefdef (void) static void SCR_CalcRefdef (void)
{ {
float size; float size;
int h; int h;
qboolean full = false; qboolean full = false;
scr_fullupdate = 0; // force a background redraw scr_fullupdate = 0; // force a background redraw
vid.recalc_refdef = 0; vid.recalc_refdef = 0;
// force the status bar to redraw // force the status bar to redraw
@ -280,16 +283,16 @@ static void SCR_CalcRefdef (void)
if (scr_fov.value > 170) if (scr_fov.value > 170)
Cvar_Set ("fov","170"); Cvar_Set ("fov","170");
// intermission is always full screen // intermission is always full screen
if (cl.intermission) if (cl.intermission)
size = 120; size = 120;
else else
size = scr_viewsize.value; size = scr_viewsize.value;
if (size >= 120) if (size >= 120)
sb_lines = 0; // no status bar at all sb_lines = 0; // no status bar at all
else if (size >= 110) else if (size >= 110)
sb_lines = 24; // no inventory sb_lines = 24; // no inventory
else else
sb_lines = 24+16+8; sb_lines = 24+16+8;
@ -301,24 +304,28 @@ static void SCR_CalcRefdef (void)
if (cl.intermission) if (cl.intermission)
{ {
full = true; full = true;
size = 100; size = 100.0;
sb_lines = 0; sb_lines = 0;
} }
size /= 100.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; 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; size = 96.0 / r_refdef.vrect.width;
r_refdef.vrect.width = 96; // min for icons r_refdef.vrect.width = 96; // min for icons
} }
r_refdef.vrect.height = vid.height * size; r_refdef.vrect.height = vid.height * size;
if (r_refdef.vrect.height > vid.height - sb_lines) if (cl_sbar.value || !full) {
r_refdef.vrect.height = vid.height - sb_lines; if (r_refdef.vrect.height > vid.height - sb_lines)
if (r_refdef.vrect.height > vid.height) 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.height = vid.height;
r_refdef.vrect.x = (vid.width - r_refdef.vrect.width)/2; r_refdef.vrect.x = (vid.width - r_refdef.vrect.width)/2;
if (full) if (full)
@ -369,7 +376,6 @@ SCR_Init
*/ */
void SCR_Init (void) void SCR_Init (void)
{ {
Cvar_RegisterVariable (&scr_fov); Cvar_RegisterVariable (&scr_fov);
Cvar_RegisterVariable (&scr_viewsize); Cvar_RegisterVariable (&scr_viewsize);
Cvar_RegisterVariable (&scr_conspeed); Cvar_RegisterVariable (&scr_conspeed);
@ -419,7 +425,7 @@ SCR_DrawTurtle
*/ */
void SCR_DrawTurtle (void) void SCR_DrawTurtle (void)
{ {
static int count; static int count;
if (!scr_showturtle.value) if (!scr_showturtle.value)
return; return;
@ -460,10 +466,9 @@ Backported by Jules Bean <jules@jellybean.co.uk> from
quakeworld client quakeworld client
=============== ===============
*/ */
void SCR_DrawFPS (void) void SCR_DrawFPS (void)
{ {
extern cvar_t show_fps; extern cvar_t show_fps;
static double lastframetime; static double lastframetime;
double t; double t;
extern int fps_count; extern int fps_count;
@ -471,8 +476,8 @@ void SCR_DrawFPS (void)
int x, y; int x, y;
char st[80]; char st[80];
if (!show_fps.value) if (!show_fps.value)
return; return;
t = Sys_DoubleTime(); t = Sys_DoubleTime();
if ((t - lastframetime) >= 1.0) { if ((t - lastframetime) >= 1.0) {
@ -488,6 +493,7 @@ void SCR_DrawFPS (void)
Draw_String(x, y, st); Draw_String(x, y, st);
} }
/* /*
============== ==============
DrawPause DrawPause
@ -495,9 +501,9 @@ DrawPause
*/ */
void SCR_DrawPause (void) void SCR_DrawPause (void)
{ {
qpic_t *pic; qpic_t *pic;
if (!scr_showpause.value) // turn off for screenshots if (!scr_showpause.value) // turn off for screenshots
return; return;
if (!cl.paused) if (!cl.paused)
@ -517,7 +523,7 @@ SCR_DrawLoading
*/ */
void SCR_DrawLoading (void) void SCR_DrawLoading (void)
{ {
qpic_t *pic; qpic_t *pic;
if (!scr_drawloading) if (!scr_drawloading)
return; return;
@ -542,20 +548,20 @@ void SCR_SetUpToDrawConsole (void)
Con_CheckResize (); Con_CheckResize ();
if (scr_drawloading) if (scr_drawloading)
return; // never a console with loading plaque return; // never a console with loading plaque
// decide on the height of the console // decide on the height of the console
con_forcedup = !cl.worldmodel || cls.signon != SIGNONS; con_forcedup = !cl.worldmodel || cls.signon != SIGNONS;
if (con_forcedup) if (con_forcedup)
{ {
scr_conlines = vid.height; // full screen scr_conlines = vid.height; // full screen
scr_con_current = scr_conlines; scr_con_current = scr_conlines;
} }
else if (key_dest == key_console) else if (key_dest == key_console)
scr_conlines = vid.height/2; // half screen scr_conlines = vid.height/2; // half screen
else else
scr_conlines = 0; // none visible scr_conlines = 0; // none visible
if (scr_conlines < scr_con_current) if (scr_conlines < scr_con_current)
{ {
@ -598,7 +604,7 @@ void SCR_DrawConsole (void)
else else
{ {
if (key_dest == key_game || key_dest == key_message) if (key_dest == key_game || key_dest == key_message)
Con_DrawNotify (); // only draw notify in game Con_DrawNotify (); // only draw notify in game
} }
} }
@ -612,11 +618,11 @@ void SCR_DrawConsole (void)
*/ */
typedef struct _TargaHeader { typedef struct _TargaHeader {
unsigned char id_length, colormap_type, image_type; unsigned char id_length, colormap_type, image_type;
unsigned short colormap_index, colormap_length; unsigned short colormap_index, colormap_length;
unsigned char colormap_size; unsigned char colormap_size;
unsigned short x_origin, y_origin, width, height; unsigned short x_origin, y_origin, width, height;
unsigned char pixel_size, attributes; unsigned char pixel_size, attributes;
} TargaHeader; } TargaHeader;
@ -627,10 +633,10 @@ SCR_ScreenShot_f
*/ */
void SCR_ScreenShot_f (void) void SCR_ScreenShot_f (void)
{ {
byte *buffer; byte *buffer;
char pcxname[80]; char pcxname[80];
char checkname[MAX_OSPATH]; char checkname[MAX_OSPATH];
int i, c, temp; int i, c, temp;
// //
// find a file name to save it to // find a file name to save it to
// //
@ -642,23 +648,23 @@ void SCR_ScreenShot_f (void)
pcxname[6] = i%10 + '0'; pcxname[6] = i%10 + '0';
snprintf(checkname, sizeof(checkname), "%s/%s", com_gamedir, pcxname); snprintf(checkname, sizeof(checkname), "%s/%s", com_gamedir, pcxname);
if (Sys_FileTime(checkname) == -1) if (Sys_FileTime(checkname) == -1)
break; // file doesn't exist break; // file doesn't exist
} }
if (i==100) if (i==100)
{ {
Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX file\n"); Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX file\n");
return; return;
} }
buffer = malloc(glwidth*glheight*3 + 18); buffer = malloc(glwidth*glheight*3 + 18);
memset (buffer, 0, 18); memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type buffer[2] = 2; // uncompressed type
buffer[12] = glwidth&255; buffer[12] = glwidth&255;
buffer[13] = glwidth>>8; buffer[13] = glwidth>>8;
buffer[14] = glheight&255; buffer[14] = glheight&255;
buffer[15] = glheight>>8; buffer[15] = glheight>>8;
buffer[16] = 24; // pixel size buffer[16] = 24; // pixel size
glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 ); glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 );
@ -676,10 +682,6 @@ void SCR_ScreenShot_f (void)
Con_Printf ("Wrote %s\n", pcxname); Con_Printf ("Wrote %s\n", pcxname);
} }
//=============================================================================
/* /*
=============== ===============
SCR_BeginLoadingPlaque SCR_BeginLoadingPlaque
@ -726,21 +728,21 @@ void SCR_EndLoadingPlaque (void)
//============================================================================= //=============================================================================
char *scr_notifystring; char *scr_notifystring;
qboolean scr_drawdialog; qboolean scr_drawdialog;
void SCR_DrawNotifyString (void) void SCR_DrawNotifyString (void)
{ {
char *start; char *start;
int l; int l;
int j; int j;
int x, y; int x, y;
start = scr_notifystring; start = scr_notifystring;
y = vid.height*0.35; y = vid.height*0.35;
do do
{ {
// scan the width of the line // scan the width of the line
for (l=0 ; l<40 ; l++) for (l=0 ; l<40 ; l++)
@ -748,7 +750,7 @@ void SCR_DrawNotifyString (void)
break; break;
x = (vid.width - l*8)/2; x = (vid.width - l*8)/2;
for (j=0 ; j<l ; j++, x+=8) for (j=0 ; j<l ; j++, x+=8)
Draw_Character (x, y, start[j]); Draw_Character (x, y, start[j]);
y += 8; y += 8;
@ -757,7 +759,7 @@ void SCR_DrawNotifyString (void)
if (!*start) if (!*start)
break; break;
start++; // skip the \n start++; // skip the \n
} while (1); } while (1);
} }
@ -773,7 +775,7 @@ int SCR_ModalMessage (char *text)
{ {
if (cls.state == ca_dedicated) if (cls.state == ca_dedicated)
return true; return true;
scr_notifystring = text; scr_notifystring = text;
// draw a fresh screen // draw a fresh screen
@ -782,11 +784,11 @@ int SCR_ModalMessage (char *text)
SCR_UpdateScreen (); SCR_UpdateScreen ();
scr_drawdialog = false; scr_drawdialog = false;
S_ClearBuffer (); // so dma doesn't loop current sound S_ClearBuffer (); // so dma doesn't loop current sound
do do
{ {
key_count = -1; // wait for a key down and up key_count = -1; // wait for a key down and up
Sys_SendKeyEvents (); Sys_SendKeyEvents ();
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE); } while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
@ -808,14 +810,14 @@ Brings the console down and fades the palettes back to normal
*/ */
void SCR_BringDownConsole (void) void SCR_BringDownConsole (void)
{ {
int i; int i;
scr_centertime_off = 0; scr_centertime_off = 0;
for (i=0 ; i<20 && scr_conlines != scr_con_current ; i++) for (i=0 ; i<20 && scr_conlines != scr_con_current ; i++)
SCR_UpdateScreen (); SCR_UpdateScreen ();
cl.cshifts[0].percent = 0; // no area contents palette on next frame cl.cshifts[0].percent = 0; // no area contents palette on next frame
VID_SetPalette (host_basepal); VID_SetPalette (host_basepal);
} }
@ -843,6 +845,8 @@ void SCR_TileClear (void)
} }
} }
float oldsbar = 0;
/* /*
================== ==================
SCR_UpdateScreen SCR_UpdateScreen
@ -876,9 +880,14 @@ void SCR_UpdateScreen (void)
} }
if (!scr_initialized || !con_initialized) if (!scr_initialized || !con_initialized)
return; // not initialized yet return; // not initialized yet
if (oldsbar != cl_sbar.value) {
oldsbar = cl_sbar.value;
vid.recalc_refdef = true;
}
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
// //
@ -890,12 +899,6 @@ void SCR_UpdateScreen (void)
vid.recalc_refdef = true; vid.recalc_refdef = true;
} }
if (oldscreensize != scr_viewsize.value)
{
oldscreensize = scr_viewsize.value;
vid.recalc_refdef = true;
}
if (vid.recalc_refdef) if (vid.recalc_refdef)
SCR_CalcRefdef (); SCR_CalcRefdef ();
@ -938,7 +941,6 @@ void SCR_UpdateScreen (void)
{ {
if (crosshair.value) if (crosshair.value)
Draw_Crosshair(); Draw_Crosshair();
// Draw_Character (scr_vrect.x + scr_vrect.width/2, scr_vrect.y + scr_vrect.height/2, '+');
SCR_DrawRam (); SCR_DrawRam ();
SCR_DrawNet (); SCR_DrawNet ();
@ -947,7 +949,7 @@ void SCR_UpdateScreen (void)
SCR_DrawPause (); SCR_DrawPause ();
SCR_CheckDrawCenterString (); SCR_CheckDrawCenterString ();
Sbar_Draw (); Sbar_Draw ();
SCR_DrawConsole (); SCR_DrawConsole ();
M_Draw (); M_Draw ();
} }
@ -955,4 +957,3 @@ void SCR_UpdateScreen (void)
GL_EndRendering (); GL_EndRendering ();
} }

View file

@ -1,6 +1,8 @@
/* /*
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush. Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,6 +25,56 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include "r_local.h" #include "r_local.h"
#include <time.h>
/*
background clear
rendering
turtle/net/ram icons
sbar
centerprint / slow centerprint
notify lines
intermission / finale overlay
loading plaque
console
menu
required background clears
required update regions
syncronous draw mode or async
One off screen buffer, with updates either copied or xblited
Need to double buffer?
async draw will require the refresh area to be cleared, because it will be
xblited, but sync draw can just ignore it.
sync
draw
CenterPrint ()
SlowPrint ()
Screen_Update ();
Con_Printf ();
net
turn off messages option
the refresh is allways rendered, unless the console is full screen
console is:
notify lines
half
full
*/
// only the refresh window will be updated unless these variables are flagged // only the refresh window will be updated unless these variables are flagged
int scr_copytop; int scr_copytop;
int scr_copyeverything; int scr_copyeverything;
@ -31,6 +83,7 @@ float scr_con_current;
float scr_conlines; // lines of console to display float scr_conlines; // lines of console to display
float oldscreensize, oldfov; float oldscreensize, oldfov;
float oldsbar;
cvar_t scr_viewsize = {"viewsize","100", true}; cvar_t scr_viewsize = {"viewsize","100", true};
cvar_t scr_fov = {"fov","90"}; // 10 - 170 cvar_t scr_fov = {"fov","90"}; // 10 - 170
cvar_t scr_conspeed = {"scr_conspeed","300"}; cvar_t scr_conspeed = {"scr_conspeed","300"};
@ -51,6 +104,8 @@ int scr_fullupdate;
int clearconsole; int clearconsole;
int clearnotify; int clearnotify;
int sb_lines;
viddef_t vid; // global video state viddef_t vid; // global video state
vrect_t *pconupdate; vrect_t *pconupdate;
@ -59,6 +114,7 @@ vrect_t scr_vrect;
qboolean scr_disabled_for_loading; qboolean scr_disabled_for_loading;
qboolean scr_drawloading; qboolean scr_drawloading;
float scr_disabled_time; float scr_disabled_time;
qboolean scr_skipupdate; qboolean scr_skipupdate;
qboolean block_drawing; qboolean block_drawing;
@ -120,7 +176,7 @@ void SCR_EraseCenterString (void)
y = 48; y = 48;
scr_copytop = 1; scr_copytop = 1;
Draw_TileClear (0, y,vid.width, 8*scr_erase_lines); Draw_TileClear (0, y, vid.width, min(8*scr_erase_lines, vid.height - y - 1));
} }
void SCR_DrawCenterString (void) void SCR_DrawCenterString (void)
@ -287,8 +343,10 @@ Keybinding command
*/ */
void SCR_SizeUp_f (void) void SCR_SizeUp_f (void)
{ {
if (scr_viewsize.value < 120) {
Cvar_SetValue ("viewsize",scr_viewsize.value+10); Cvar_SetValue ("viewsize",scr_viewsize.value+10);
vid.recalc_refdef = 1; vid.recalc_refdef = 1;
}
} }
@ -330,9 +388,9 @@ void SCR_Init (void)
Cmd_AddCommand ("sizeup",SCR_SizeUp_f); Cmd_AddCommand ("sizeup",SCR_SizeUp_f);
Cmd_AddCommand ("sizedown",SCR_SizeDown_f); Cmd_AddCommand ("sizedown",SCR_SizeDown_f);
scr_ram = Draw_PicFromWad ("ram"); scr_ram = W_GetLumpName ("ram");
scr_net = Draw_PicFromWad ("net"); scr_net = W_GetLumpName ("net");
scr_turtle = Draw_PicFromWad ("turtle"); scr_turtle = W_GetLumpName ("turtle");
scr_initialized = true; scr_initialized = true;
} }
@ -403,10 +461,9 @@ Backported by Jules Bean <jules@jellybean.co.uk> from
quakeworld client quakeworld client
=============== ===============
*/ */
void SCR_DrawFPS (void) void SCR_DrawFPS (void)
{ {
extern cvar_t show_fps; extern cvar_t show_fps;
static double lastframetime; static double lastframetime;
double t; double t;
extern int fps_count; extern int fps_count;
@ -414,8 +471,8 @@ void SCR_DrawFPS (void)
int x, y; int x, y;
char st[80]; char st[80];
if (!show_fps.value) if (!show_fps.value)
return; return;
t = Sys_DoubleTime(); t = Sys_DoubleTime();
if ((t - lastframetime) >= 1.0) { if ((t - lastframetime) >= 1.0) {
@ -452,7 +509,6 @@ void SCR_DrawPause (void)
} }
/* /*
============== ==============
SCR_DrawLoading SCR_DrawLoading
@ -470,8 +526,6 @@ void SCR_DrawLoading (void)
(vid.height - 48 - pic->height)/2, pic); (vid.height - 48 - pic->height)/2, pic);
} }
//============================================================================= //=============================================================================
@ -486,7 +540,7 @@ void SCR_SetUpToDrawConsole (void)
if (scr_drawloading) if (scr_drawloading)
return; // never a console with loading plaque return; // never a console with loading plaque
// decide on the height of the console // decide on the height of the console
con_forcedup = !cl.worldmodel || cls.signon != SIGNONS; con_forcedup = !cl.worldmodel || cls.signon != SIGNONS;
@ -557,7 +611,6 @@ void SCR_DrawConsole (void)
============================================================================== ==============================================================================
*/ */
typedef struct typedef struct
{ {
@ -582,7 +635,7 @@ WritePCXfile
============== ==============
*/ */
void WritePCXfile (char *filename, byte *data, int width, int height, void WritePCXfile (char *filename, byte *data, int width, int height,
int rowbytes, byte *palette) int rowbytes, byte *palette)
{ {
int i, j, length; int i, j, length;
pcx_t *pcx; pcx_t *pcx;
@ -668,10 +721,10 @@ void SCR_ScreenShot_f (void)
} }
if (i==100) if (i==100)
{ {
Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX file\n"); Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
return; return;
} }
// //
// save the pcx file // save the pcx file
// //
@ -687,10 +740,8 @@ void SCR_ScreenShot_f (void)
Con_Printf ("Wrote %s\n", pcxname); Con_Printf ("Wrote %s\n", pcxname);
} }
//============================================================================= //=============================================================================
/* /*
=============== ===============
SCR_BeginLoadingPlaque SCR_BeginLoadingPlaque
@ -734,9 +785,6 @@ void SCR_EndLoadingPlaque (void)
scr_fullupdate = 0; scr_fullupdate = 0;
Con_ClearNotify (); Con_ClearNotify ();
} }
//=============================================================================
char *scr_notifystring; char *scr_notifystring;
qboolean scr_drawdialog; qboolean scr_drawdialog;
@ -772,6 +820,8 @@ void SCR_DrawNotifyString (void)
} while (1); } while (1);
} }
//=============================================================================
/* /*
================== ==================
SCR_ModalMessage SCR_ModalMessage
@ -845,9 +895,9 @@ needs almost the entire 256k of stack space!
void SCR_UpdateScreen (void) void SCR_UpdateScreen (void)
{ {
static float oldscr_viewsize; static float oldscr_viewsize;
static float oldlcd_x; static float oldlcd_x;
vrect_t vrect; vrect_t vrect;
if (scr_skipupdate || block_drawing) if (scr_skipupdate || block_drawing)
return; return;
@ -862,11 +912,20 @@ void SCR_UpdateScreen (void)
Con_Printf ("load failed.\n"); Con_Printf ("load failed.\n");
} }
else else
return; return;
} }
#ifdef _WIN32
{ // don't suck up any cpu if minimized
extern int Minimized;
if (Minimized)
return;
}
#endif
if (cls.state == ca_dedicated) if (cls.state == ca_dedicated)
return; // stdout only return;
if (!scr_initialized || !con_initialized) if (!scr_initialized || !con_initialized)
return; // not initialized yet return; // not initialized yet
@ -897,10 +956,16 @@ void SCR_UpdateScreen (void)
oldscreensize = scr_viewsize.value; oldscreensize = scr_viewsize.value;
vid.recalc_refdef = true; vid.recalc_refdef = true;
} }
if (oldsbar != cl_sbar.value)
{
oldsbar = cl_sbar.value;
vid.recalc_refdef = true;
}
if (vid.recalc_refdef) if (vid.recalc_refdef)
{ {
// something changed, so reorder the screen // something changed, so reorder the screen
SCR_CalcRefdef (); SCR_CalcRefdef ();
} }
@ -921,14 +986,12 @@ void SCR_UpdateScreen (void)
SCR_SetUpToDrawConsole (); SCR_SetUpToDrawConsole ();
SCR_EraseCenterString (); SCR_EraseCenterString ();
D_DisableBackBufferAccess (); // for adapters that can't stay mapped in D_DisableBackBufferAccess (); // for adapters that can't stay mapped in
// for linear writes all the time // for linear writes all the time
VID_LockBuffer (); VID_LockBuffer ();
V_RenderView (); V_RenderView ();
VID_UnlockBuffer (); VID_UnlockBuffer ();
D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly
@ -967,10 +1030,11 @@ void SCR_UpdateScreen (void)
SCR_DrawFPS (); SCR_DrawFPS ();
SCR_CheckDrawCenterString (); SCR_CheckDrawCenterString ();
Sbar_Draw (); Sbar_Draw ();
SCR_DrawConsole (); SCR_DrawConsole ();
M_Draw (); M_Draw ();
} }
D_DisableBackBufferAccess (); // for adapters that can't stay mapped in D_DisableBackBufferAccess (); // for adapters that can't stay mapped in
// for linear writes all the time // for linear writes all the time
if (pconupdate) if (pconupdate)
@ -983,7 +1047,6 @@ void SCR_UpdateScreen (void)
// //
// update one of three areas // update one of three areas
// //
if (scr_copyeverything) if (scr_copyeverything)
{ {
vrect.x = 0; vrect.x = 0;
@ -1013,10 +1076,9 @@ void SCR_UpdateScreen (void)
vrect.pnext = 0; vrect.pnext = 0;
VID_Update (&vrect); VID_Update (&vrect);
} }
} }
/* /*
================== ==================
SCR_UpdateWholeScreen SCR_UpdateWholeScreen