From 8b18f9d56bc8f989104fbd24ac1938e7b777a2bc Mon Sep 17 00:00:00 2001 From: Joseph Carter Date: Thu, 2 Mar 2000 19:57:24 +0000 Subject: [PATCH] A little cleanup... S_Init() is now where it belongs--outside of VID_Init(). I think I did manage to update every target. If I missed one, kill the sound.h include and remove S_Init() from VID_Init(). New Cvar: r_sky, defaults to 0, turn it on if you want to use skyboxes. Cvar r_skyname can actually be used now I _think_, need another skybox to test it. Quake2000's instructions were used in the skybox stuff but, as all know by now, our tree is so different from anyone else's that I had to redo a number of things. But thanks all the same--cut the time spent debugging it in half. I also want to thank whoever did the night skybox on the MegaTF page I used to test. Looks great on start map! New GL-specific Cvar: r_conspin, defaults to 0. Turn it on. You can turn it off too. Shamelessly ripped from QER. --- AUTHORS | 16 +++++++++++++-- common/cmd.h | 2 +- common/common_quakedef.h | 41 +++------------------------------------ common/gl_draw.c | 36 ++++++++++++++++++++++++++-------- common/gl_rmain.c | 20 ++++++++++--------- common/gl_rmisc.c | 2 ++ common/gl_vidglx.c | 9 --------- common/gl_vidlinux_3dfx.c | 3 --- common/gl_warp.c | 8 ++------ common/glquake.h | 8 +++++--- common/host.c | 23 ++++++++++++++-------- common/quakefs.c | 6 +++--- common/vid_aa.c | 7 ++----- common/vid_ggi.c | 4 ---- common/vid_null.c | 6 +++--- common/vid_sdl.c | 3 --- common/vid_svgalib.c | 3 --- common/vid_win.c | 14 ++++++------- common/vid_x11.c | 4 +--- 19 files changed, 96 insertions(+), 119 deletions(-) diff --git a/AUTHORS b/AUTHORS index a231e05..9155035 100644 --- a/AUTHORS +++ b/AUTHORS @@ -51,8 +51,12 @@ N: Joseph Carter E: knghtbrd@debian.org D: QW/Q1 tree merging D: Autoconf support and portability -D: Documentation -D: Driver module support/design +D: User documentation +D: Development design +D: GL renderer fixes +D: Driver module support +D: Skybox implementation +D: Spinning console implementation N: Peter Andreasen E: pandr@pandr.dk @@ -183,3 +187,11 @@ E: jukka.sorjonen@asikkala.fi D: Bug squasher (see below). D: QW network protocol fixes. D: Found out why our VERSION was messing things up.. + +N: Tane Piper +E: descent@barrysworld.com +D: GL skybox implementation tutorial + +N: Nawfel Tricha +E: topaz@endorproductions.com +D: GL spinning console implementation tutorial diff --git a/common/cmd.h b/common/cmd.h index 1a6678f..40573cd 100644 --- a/common/cmd.h +++ b/common/cmd.h @@ -1,4 +1,5 @@ /* +cmd.h - Command buffer and command execution Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors @@ -23,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _CMD_H #define _CMD_H -// cmd.h -- Command buffer and command execution //=========================================================================== diff --git a/common/common_quakedef.h b/common/common_quakedef.h index 3668253..da3e600 100644 --- a/common/common_quakedef.h +++ b/common/common_quakedef.h @@ -1,4 +1,5 @@ /* +common_quakedef.h - common header Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors @@ -22,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _COMMON_QUAKEDEF_H #define _COMMON_QUAKEDEF_H -// quakedef.h -- primary header for client - #define QUAKE_GAME // as opposed to utilities #include // generated from config.h.in @@ -48,43 +47,9 @@ void VID_UnlockBuffer (void); #define VID_UnlockBuffer() #endif -#include "qtypes.h" -#include "qstructs.h" +#include +#include -/* -#include "common.h" -#include "bspfile.h" -#include "vid.h" -#include "sys.h" -#include "zone.h" -#include "mathlib.h" -#include "wad.h" -#include "draw.h" -#include "cvar.h" -#include "screen.h" -#include "net.h" -#include "protocol.h" -#include "cmd.h" -#include "sbar.h" -#include "sound.h" - -#include "model.h" -#include "d_iface.h" -#include "render.h" -#include "client.h" - -#include "input.h" -#include "keys.h" -#include "console.h" -#include "view.h" -#ifndef SERVERONLY -# include "menu.h" -#endif -#include "crc.h" -#include "cdaudio.h" - -#include "cvars.h" -*/ #ifndef max #define max(a,b) ((a) > (b) ? (a) : (b)) diff --git a/common/gl_draw.c b/common/gl_draw.c index b188b10..6213207 100644 --- a/common/gl_draw.c +++ b/common/gl_draw.c @@ -38,6 +38,7 @@ extern cvar_t *crosshair, *cl_crossx, *cl_crossy, *crosshaircolor; cvar_t *gl_nobind; cvar_t *gl_max_size; cvar_t *gl_picmip; +cvar_t *gl_conspin; byte *draw_chars; // 8*8 graphic characters qpic_t *draw_disc; @@ -390,19 +391,14 @@ void Draw_Init (void) { int i; qpic_t *cb; -// byte *dest; -// int x; -// char ver[40]; glpic_t *gl; int start; byte *ncdata; -// Cvar_RegisterVariable (&gl_nobind); gl_nobind = Cvar_Get ("gl_nobind","0",0,"None"); -// Cvar_RegisterVariable (&gl_max_size); gl_max_size = Cvar_Get ("gl_max_size","1024",0,"None"); -// Cvar_RegisterVariable (&gl_picmip); gl_picmip = Cvar_Get ("gl_picmip","0",0,"None"); + gl_conspin = Cvar_Get ("gl_conspin", "0", CVAR_NONE, "None"); // 3dfx can only handle 256 wide textures if (!Q_strncasecmp ((char *)gl_renderer, "3dfx",4) || @@ -816,6 +812,7 @@ void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation) glEnd (); } +#define SPIN_HACK 1 /* ================ @@ -833,11 +830,33 @@ void Draw_ConsoleBackground (int lines) int x, i; int y; + if (gl_conspin->value) + { + static float xangle = 0, xfactor = .3f, xstep = .005f; + + glPushMatrix (); + glMatrixMode (GL_TEXTURE); + glPushMatrix (); + glLoadIdentity (); + xangle += 1.0f; + xfactor += xstep; + if (xfactor > 8 || xfactor < .3f) + xstep = -xstep; + glRotatef (xangle, 0, 0, 1); + glScalef (xfactor, xfactor, xfactor); + } + y = (vid.height * 3) >> 2; if (lines > y) Draw_Pic(0, lines-vid.height, conback); else - Draw_AlphaPic (0, lines - vid.height, conback, (float)(1.2 * lines)/y); + Draw_AlphaPic (0, lines - vid.height, conback, + (float)(1.2 * lines)/y); + if (gl_conspin->value) { + glPopMatrix (); + glMatrixMode (GL_MODELVIEW); + glPopMatrix (); + } // hack the version number directly into the pic y = lines-14; @@ -1407,7 +1426,8 @@ int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolea { if (!strcmp (identifier, glt->identifier)) { - if (width != glt->width || height != glt->height) + if (width != glt->width + || height != glt->height) Sys_Error ("GL_LoadTexture: cache mismatch"); return gltextures[i].texnum; } diff --git a/common/gl_rmain.c b/common/gl_rmain.c index 875fc3b..aa96b34 100644 --- a/common/gl_rmain.c +++ b/common/gl_rmain.c @@ -47,21 +47,21 @@ qboolean r_cache_thrash; // compatability vec3_t modelorg, r_entorigin; entity_t *currententity; -int r_visframecount; // bumped when going to a new PVS -int r_framecount; // used for dlight push checking +int r_visframecount; // bumped when going to a new PVS +int r_framecount; // used for dlight push checking mplane_t frustum[4]; -int c_brush_polys, c_alias_polys; +int c_brush_polys, c_alias_polys; -qboolean envmap; // true during envmap command capture +qboolean envmap; // true during envmap command capture -int currenttexture = -1; // to avoid unnecessary texture sets +int currenttexture = -1; // to avoid unnecessary texture sets -int cnttextures[2] = {-1, -1}; // cached +int cnttextures[2] = {-1, -1}; // cached -int particletexture; // little dot for particles -int playertextures; // up to 16 color translated skins +int particletexture; // little dot for particles +int playertextures; // up to 16 color translated skins // // view origin @@ -104,9 +104,11 @@ cvar_t *r_netgraph; #endif cvar_t *r_fog; -cvar_t *r_volfog; +cvar_t *r_volfog; cvar_t *r_waterwarp; cvar_t *r_waterripple; +cvar_t *r_sky; +cvar_t *r_skyname; cvar_t *gl_finish; cvar_t *gl_clear; diff --git a/common/gl_rmisc.c b/common/gl_rmisc.c index 7b7ef91..8fd4c0e 100644 --- a/common/gl_rmisc.c +++ b/common/gl_rmisc.c @@ -206,6 +206,8 @@ void R_Init (void) r_volfog = Cvar_Get ("r_volfog","0",0,"None"); r_waterripple = Cvar_Get ("r_waterripple","0",0,"None"); r_clearcolor = Cvar_Get ("r_clearcolor","2",0,"None"); + r_sky = Cvar_Get ("r_sky", "0", CVAR_NONE, "None"); + r_skyname = Cvar_Get ("r_skyname", "sky", CVAR_NONE, "None"); gl_clear = Cvar_Get ("gl_clear","0",0,"None"); gl_texsort = Cvar_Get ("gl_texsort","1",0,"None"); diff --git a/common/gl_vidglx.c b/common/gl_vidglx.c index e8d7a4c..21ec9fe 100644 --- a/common/gl_vidglx.c +++ b/common/gl_vidglx.c @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include @@ -122,7 +121,6 @@ int texture_extension_number = 1; float gldepthmin, gldepthmax; -//cvar_t gl_ztrick = {"gl_ztrick", "0", CVAR_ARCHIVE}; cvar_t *gl_ztrick; const char *gl_vendor; @@ -412,18 +410,11 @@ void VID_Init(unsigned char *palette) Window root; XVisualInfo *visinfo; - S_Init(); - -// Cvar_RegisterVariable(&vid_mode); vid_mode = Cvar_Get ("vid_mode","0",0,"None"); -// Cvar_RegisterVariable(&gl_ztrick); gl_ztrick = Cvar_Get ("gl_ztrick","0",CVAR_ARCHIVE,"None"); -// Cvar_RegisterVariable(&_windowed_mouse); _windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None"); -// Cvar_RegisterVariable(&vid_glx_fullscreen); vid_glx_fullscreen = Cvar_Get ("vid_glx_fullscreen","0",0,"None"); #ifdef HAS_DGA -// Cvar_RegisterVariable(&vid_dga_mouseaccel); vid_dga_mouseaccel = Cvar_Get("vid_dga_mouseaccel","1",CVAR_ARCHIVE, "None"); #endif diff --git a/common/gl_vidlinux_3dfx.c b/common/gl_vidlinux_3dfx.c index 2418f4c..a0aee7d 100644 --- a/common/gl_vidlinux_3dfx.c +++ b/common/gl_vidlinux_3dfx.c @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include @@ -409,8 +408,6 @@ void VID_Init(unsigned char *palette) char gldir[MAX_OSPATH]; int width = 640, height = 480; - S_Init(); - // Cvar_RegisterVariable (&vid_mode); vid_mode = Cvar_Get ("vid_mode","5",0,"None"); // Cvar_RegisterVariable (&vid_redrawfull); diff --git a/common/gl_warp.c b/common/gl_warp.c index 6a848ed..a06461e 100644 --- a/common/gl_warp.c +++ b/common/gl_warp.c @@ -582,9 +582,7 @@ R_LoadSkys ( void ) { int i; QFile *f; char name[64]; - cvar_t *r_skyname; - r_skyname = Cvar_Get ("r_skyname","sky",CVAR_NONE, ""); for (i=0 ; i<6 ; i++) { GL_Bind (SKY_TEX + i); snprintf(name, sizeof(name), "gfx/env/%s%s.tga", @@ -820,7 +818,7 @@ R_DrawSkyChain (msurface_t *s) { vec3_t verts[MAX_CLIP_VERTS]; glpoly_t *p; - if (1) + if (r_sky->value) { c_sky = 0; GL_Bind(solidskytexture); @@ -917,9 +915,7 @@ int skytexorder[6] = {0,2,1,3,4,5}; void R_DrawSkyBox (void) { - int i; //, j, k; -// vec3_t v; -// float s, t; + int i; #if 0 glEnable (GL_BLEND); diff --git a/common/glquake.h b/common/glquake.h index f729572..8689feb 100644 --- a/common/glquake.h +++ b/common/glquake.h @@ -36,9 +36,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include "model.h" -#include "client.h" -#include "wad.h" +#include +#include +#include void GL_BeginRendering (int *x, int *y, int *width, int *height); void GL_EndRendering (void); @@ -186,6 +186,8 @@ extern cvar_t *r_fog; extern cvar_t *r_waterwarp; extern cvar_t *r_volfog; extern cvar_t *r_waterripple; +extern cvar_t *r_sky; +extern cvar_t *r_skyname; extern cvar_t *gl_clear; extern cvar_t *gl_cull; diff --git a/common/host.c b/common/host.c index 4589095..f14599e 100644 --- a/common/host.c +++ b/common/host.c @@ -522,6 +522,15 @@ Host_InitVCR ( quakeparms_t *parms ) } } +/* + Host_InitDisplay + + Video initialization +*/ +void +Host_InitDisplay () +{ +} /* Host_Init @@ -529,7 +538,7 @@ Host_InitVCR ( quakeparms_t *parms ) System Startup */ void -Host_Init ( quakeparms_t *parms) +Host_Init (quakeparms_t *parms) { COM_InitArgv (parms->argc, parms->argv); @@ -599,14 +608,12 @@ Host_Init ( quakeparms_t *parms) if (!host_colormap) Sys_Error ("Couldn't load gfx/colormap.lmp"); -// plugin_load("./in_x11.so"); -// Not the best place to load the plugin... - VID_Init(host_basepal); - IN_Init(); - // DDOI - I made this so host.c wouldn't try to unload a plugin - // that it hasn't loaded. Could be done better I'm sure. - vid_initialized = true; + VID_Init(host_basepal); + IN_Init(); + vid_initialized = true; + Host_InitDisplay(); + S_Init(); Draw_Init(); SCR_Init(); R_Init(); diff --git a/common/quakefs.c b/common/quakefs.c index 1d67a1b..201108c 100644 --- a/common/quakefs.c +++ b/common/quakefs.c @@ -493,10 +493,10 @@ of the list so they override previous pack files. */ pack_t *COM_LoadPackFile (char *packfile) { - dpackheader_t header; - int i; + dpackheader_t header; + int i; packfile_t *newfiles; - int numpackfiles; + int numpackfiles; pack_t *pack; QFile *packhandle; dpackfile_t info[MAX_FILES_IN_PACK]; diff --git a/common/vid_aa.c b/common/vid_aa.c index 7120742..6c94154 100644 --- a/common/vid_aa.c +++ b/common/vid_aa.c @@ -21,8 +21,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "quakedef.h" -#include "d_local.h" +#include +#include #include #include @@ -378,9 +378,6 @@ VID_Init(unsigned char *palette) int w, h, d; int err; - /* Sound gets initialized here */ - S_Init(); - #if 0 Cmd_AddCommand ("gamma", VID_Gamma_f); #endif diff --git a/common/vid_ggi.c b/common/vid_ggi.c index 343a4b1..c6677cc 100644 --- a/common/vid_ggi.c +++ b/common/vid_ggi.c @@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include #include #include #include @@ -239,9 +238,6 @@ void VID_Init(unsigned char *pal) { int pnum; - /* Initalize sound */ - S_Init(); - vid.width = GGI_AUTO; vid.height = GGI_AUTO; diff --git a/common/vid_null.c b/common/vid_null.c index 31ad87c..96db413 100644 --- a/common/vid_null.c +++ b/common/vid_null.c @@ -1,4 +1,5 @@ /* +vid_null.c - null video driver to aid porting efforts Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors @@ -19,10 +20,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// vid_null.c -- null video driver to aid porting efforts -#include "quakedef.h" -#include "d_local.h" +#include +#include viddef_t vid; // global video state diff --git a/common/vid_sdl.c b/common/vid_sdl.c index 7541b87..557b385 100644 --- a/common/vid_sdl.c +++ b/common/vid_sdl.c @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include @@ -94,8 +93,6 @@ void VID_Init (unsigned char *palette) Uint32 flags; - S_Init(); - // Load the SDL library if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_CDROM)<0) //|SDL_INIT_AUDIO|SDL_INIT_CDROM) < 0) Sys_Error("VID: Couldn't load SDL: %s", SDL_GetError()); diff --git a/common/vid_svgalib.c b/common/vid_svgalib.c index ef8eabf..9e9b1c1 100644 --- a/common/vid_svgalib.c +++ b/common/vid_svgalib.c @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include @@ -496,8 +495,6 @@ VID_Init(unsigned char *palette) int err; //plugin_load("in_svgalib.so"); - /* Sound gets initialized here */ - S_Init(); if (svgalib_inited) return; diff --git a/common/vid_win.c b/common/vid_win.c index 79a107d..eeecb84 100644 --- a/common/vid_win.c +++ b/common/vid_win.c @@ -1,4 +1,5 @@ /* +vid_win.c - Win32 video driver Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Portions Copyright (C) 1999,2000 Nelson Rush. @@ -20,12 +21,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// vid_win.c -- Win32 video driver -#include "quakedef.h" -#include "winquake.h" -#include "d_local.h" -#include "resource.h" +#include +#include +#include +#include #include #include #include @@ -33,7 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include @@ -43,7 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include "plugin.h" +#include #ifndef CDS_FULLSCREEN @@ -2244,7 +2243,6 @@ void VID_Init (unsigned char *palette) hide_window = true; VID_SetMode (MODE_WINDOWED, palette); hide_window = false; - S_Init (); vid_initialized = true; diff --git a/common/vid_x11.c b/common/vid_x11.c index 1d02fbc..a7f1802 100644 --- a/common/vid_x11.c +++ b/common/vid_x11.c @@ -47,7 +47,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include #include #include #include @@ -485,9 +484,8 @@ void VID_Init (unsigned char *palette) int template_mask; //plugin_load("in_x11.so"); - S_Init(); // sound is initialized here - Cmd_AddCommand("gamma", VID_Gamma_f); +// Cmd_AddCommand("gamma", VID_Gamma_f); for (i=0; i < 256; i++) vid_gamma[i] = i; vid.width = 320;