From abc8f0841eb25992eac1557b445656bbf55edc8d Mon Sep 17 00:00:00 2001 From: Jamie Wilkinson Date: Fri, 5 Jul 2002 12:41:58 +0000 Subject: [PATCH] - Noted the requirement for automake 1.6 in the README - Got configure to work out the BUILDSTRING (now BUILDHOST) for common.c - Code cleanups. --- README | 3 +- configure.in | 2 + src/client.h | 8 +- src/common.c | 8 +- src/gcc_attr.h | 56 +++++----- src/gl_local.h | 3 +- src/gl_rmain.c | 5 +- src/keys.h | 284 +++++++++++++++++++++++++------------------------ src/main.c | 17 +-- src/qcommon.h | 125 +++++++--------------- src/qfiles.h | 57 +++++----- src/qgl.c | 2 +- src/qgl.h | 31 ++---- src/r_local.h | 7 +- src/ref.h | 47 ++++---- src/rw.h | 13 +-- src/vid_so.c | 216 +++++++++++++++---------------------- 17 files changed, 397 insertions(+), 487 deletions(-) diff --git a/README b/README index f8b5f40..f9839f4 100644 --- a/README +++ b/README @@ -5,7 +5,8 @@ Compiling --------- If you are checking this out from CVS, run the bootstrap command first to set -up configure. Then follow the instructions in INSTALL. +up configure. You will need autoconf 2.50, automake 1.6, libtool 1.4, or +greater. Then follow the instructions in INSTALL. Save Games ---------- diff --git a/configure.in b/configure.in index 1433c13..d71471c 100644 --- a/configure.in +++ b/configure.in @@ -10,6 +10,8 @@ AM_CONFIG_HEADER(config.h) dnl get the build and target hosts AC_CANONICAL_SYSTEM +AC_DEFINE_UNQUOTED(BUILDHOST, "${target_cpu}-${target_os}", + [Set to the canonical name of the target machine]) dnl set the program and version AM_INIT_AUTOMAKE(quake2, 0.1) diff --git a/src/client.h b/src/client.h index 5135077..0d79e4c 100644 --- a/src/client.h +++ b/src/client.h @@ -18,9 +18,13 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ +#ifndef __CLIENT_H__ +#define __CLIENT_H__ + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -588,3 +592,5 @@ void x86_TimerStop( void ); void x86_TimerInit( unsigned long smallest, unsigned longest ); unsigned long *x86_TimerGetHistogram( void ); #endif + +#endif /* __CLIENT_H__ */ diff --git a/src/common.c b/src/common.c index ec08874..656b2f1 100644 --- a/src/common.c +++ b/src/common.c @@ -18,7 +18,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ #ifdef HAVE_CONFIG_H @@ -1486,10 +1487,7 @@ void Qcommon_Init (int argc, char **argv) dedicated = Cvar_Get ("dedicated", "0", CVAR_NOSET); #endif - /* lose the arch - s = va("%4.2f %s %s %s", VERSION, CPUSTRING, __DATE__, BUILDSTRING); - */ - s = va("%s %s %s", VERSION, __DATE__, BUILDSTRING); + s = va("%s %s %s", VERSION, __DATE__, BUILDHOST); Cvar_Get ("version", s, CVAR_SERVERINFO|CVAR_NOSET); diff --git a/src/gcc_attr.h b/src/gcc_attr.h index 212acd3..9083c62 100644 --- a/src/gcc_attr.h +++ b/src/gcc_attr.h @@ -1,36 +1,32 @@ -/* - gcc_attr.h +/* $Id$ + * + * GCC __attribute__ protection for lame compilers. + * + * Copyright (C) 1996-1997 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to: + * Free Software Foundation, Inc. + * 59 Temple Place - Suite 330 + * Boston, MA 02111-1307, USA + */ - GCC __attribute__ protection for lame compilers. - - Copyright (C) 1996-1997 Id Software, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to: - - Free Software Foundation, Inc. - 59 Temple Place - Suite 330 - Boston, MA 02111-1307, USA - - $Id$ -*/ - -#ifndef __gcc_attr_h -#define __gcc_attr_h +#ifndef __GCC_ATTR_H__ +#define __GCC_ATTR_H__ #ifndef __GNUC__ # define __attribute__(x) #endif -#endif // __gcc_attr_h +#endif /* __GCC_ATTR_H__ */ diff --git a/src/gl_local.h b/src/gl_local.h index 685aacf..9c0531e 100644 --- a/src/gl_local.h +++ b/src/gl_local.h @@ -16,7 +16,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ #ifdef _WIN32 diff --git a/src/gl_rmain.c b/src/gl_rmain.c index d171795..5f62eaa 100644 --- a/src/gl_rmain.c +++ b/src/gl_rmain.c @@ -1,4 +1,6 @@ /* $Id$ + * + * entry point for the OpenGL refresher * * Copyright (C) 1997-2001 Id Software, Inc. * Copyright (c) 2002 The Quakeforge Project. @@ -16,7 +18,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ #include diff --git a/src/keys.h b/src/keys.h index 363f264..1cd42ae 100644 --- a/src/keys.h +++ b/src/keys.h @@ -1,151 +1,157 @@ -/* -Copyright (C) 1997-2001 Id Software, Inc. +/* $Id$ + * + * key number enumeration to be passed to Key_Event + * + * Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (c) 2002 The Quakeforge Project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +#ifndef __KEYS_H__ +#define __KEYS_H__ -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +/* numbers are specified so that key bindings remain compatible with + * user configurations */ -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -// -// these are the key numbers that should be passed to Key_Event -// enum QKEYS { - K_TAB = 9, - K_ENTER = 13, - K_ESCAPE = 27, - K_SPACE = 32, + K_TAB = 9, + K_ENTER = 13, + K_ESCAPE = 27, + K_SPACE = 32, + + /* normal keys should be passed as lowercased ascii */ + + K_BACKSPACE = 127, + K_UPARROW = 128, + K_DOWNARROW = 129, + K_LEFTARROW = 130, + K_RIGHTARROW = 131, + + K_ALT = 132, + K_CTRL = 133, + K_SHIFT = 134, + K_F1 = 135, + K_F2 = 136, + K_F3 = 137, + K_F4 = 138, + K_F5 = 139, + K_F6 = 140, + K_F7 = 141, + K_F8 = 142, + K_F9 = 143, + K_F10 = 144, + K_F11 = 145, + K_F12 = 146, + K_INS = 147, + K_DEL = 148, + K_PGDN = 149, + K_PGUP = 150, + K_HOME = 151, + K_END = 152, + + K_KP_HOME = 160, + K_KP_UPARROW = 161, + K_KP_PGUP = 162, + K_KP_LEFTARROW = 163, + K_KP_5 = 164, + K_KP_RIGHTARROW = 165, + K_KP_END = 166, + K_KP_DOWNARROW = 167, + K_KP_PGDN = 168, + K_KP_ENTER = 169, + K_KP_INS = 170, + K_KP_DEL = 171, + K_KP_SLASH = 172, + K_KP_MINUS = 173, + K_KP_PLUS = 174, + + /* mouse buttons generate virtual keys */ + + K_MOUSE1 = 200, + K_MOUSE2 = 201, + K_MOUSE3 = 202, + K_MOUSE4 = 241, + K_MOUSE5 = 242, + + /* joystick buttons */ + + K_JOY1 = 203, + K_JOY2 = 204, + K_JOY3 = 205, + K_JOY4 = 206, + + /* aux keys are for multi-buttoned joysticks to generate so they + * can use the normal binding process */ -// normal keys should be passed as lowercased ascii - - K_BACKSPACE = 127, - K_UPARROW = 128, - K_DOWNARROW = 129, - K_LEFTARROW = 130, - K_RIGHTARROW = 131, - - K_ALT = 132, - K_CTRL = 133, - K_SHIFT = 134, - K_F1 = 135, - K_F2 = 136, - K_F3 = 137, - K_F4 = 138, - K_F5 = 139, - K_F6 = 140, - K_F7 = 141, - K_F8 = 142, - K_F9 = 143, - K_F10 = 144, - K_F11 = 145, - K_F12 = 146, - K_INS = 147, - K_DEL = 148, - K_PGDN = 149, - K_PGUP = 150, - K_HOME = 151, - K_END = 152, - - K_KP_HOME = 160, - K_KP_UPARROW = 161, - K_KP_PGUP = 162, - K_KP_LEFTARROW = 163, - K_KP_5 = 164, - K_KP_RIGHTARROW = 165, - K_KP_END = 166, - K_KP_DOWNARROW = 167, - K_KP_PGDN = 168, - K_KP_ENTER = 169, - K_KP_INS = 170, - K_KP_DEL = 171, - K_KP_SLASH = 172, - K_KP_MINUS = 173, - K_KP_PLUS = 174, - -// -// mouse buttons generate virtual keys -// - K_MOUSE1 = 200, - K_MOUSE2 = 201, - K_MOUSE3 = 202, - K_MOUSE4 = 241, - K_MOUSE5 = 242, - -// -// joystick buttons -// - K_JOY1 = 203, - K_JOY2 = 204, - K_JOY3 = 205, - K_JOY4 = 206, - -// -// aux keys are for multi-buttoned joysticks to generate so they can use -// the normal binding process -// - K_AUX1 = 207, - K_AUX2 = 208, - K_AUX3 = 209, - K_AUX4 = 210, - K_AUX5 = 211, - K_AUX6 = 212, - K_AUX7 = 213, - K_AUX8 = 214, - K_AUX9 = 215, - K_AUX10 = 216, - K_AUX11 = 217, - K_AUX12 = 218, - K_AUX13 = 219, - K_AUX14 = 220, - K_AUX15 = 221, - K_AUX16 = 222, - K_AUX17 = 223, - K_AUX18 = 224, - K_AUX19 = 225, - K_AUX20 = 226, - K_AUX21 = 227, - K_AUX22 = 228, - K_AUX23 = 229, - K_AUX24 = 230, - K_AUX25 = 231, - K_AUX26 = 232, - K_AUX27 = 233, - K_AUX28 = 234, - K_AUX29 = 235, - K_AUX30 = 236, - K_AUX31 = 237, - K_AUX32 = 238, - - K_MWHEELDOWN = 239, - K_MWHEELUP = 240, - - K_PAUSE = 255, - - K_LAST + K_AUX1 = 207, + K_AUX2 = 208, + K_AUX3 = 209, + K_AUX4 = 210, + K_AUX5 = 211, + K_AUX6 = 212, + K_AUX7 = 213, + K_AUX8 = 214, + K_AUX9 = 215, + K_AUX10 = 216, + K_AUX11 = 217, + K_AUX12 = 218, + K_AUX13 = 219, + K_AUX14 = 220, + K_AUX15 = 221, + K_AUX16 = 222, + K_AUX17 = 223, + K_AUX18 = 224, + K_AUX19 = 225, + K_AUX20 = 226, + K_AUX21 = 227, + K_AUX22 = 228, + K_AUX23 = 229, + K_AUX24 = 230, + K_AUX25 = 231, + K_AUX26 = 232, + K_AUX27 = 233, + K_AUX28 = 234, + K_AUX29 = 235, + K_AUX30 = 236, + K_AUX31 = 237, + K_AUX32 = 238, + + K_MWHEELDOWN = 239, + K_MWHEELUP = 240, + + K_PAUSE = 255, + + K_LAST }; extern char * keybindings[K_LAST]; extern int key_repeats[K_LAST]; -extern int anykeydown; +extern int anykeydown; extern char chat_buffer[]; -extern int chat_bufferlen; -extern qboolean chat_team; +extern int chat_bufferlen; +extern qboolean chat_team; -void Key_Event (int key, qboolean down, unsigned time); -void Key_Init (void); -void Key_WriteBindings (FILE *f); -void Key_SetBinding (int keynum, char *binding); -void Key_ClearStates (void); -int Key_GetKey (void); +void Key_Event(int key, qboolean down, unsigned time); +void Key_Init(void); +void Key_WriteBindings(FILE * f); +void Key_SetBinding(int keynum, char * binding); +void Key_ClearStates(void); +int Key_GetKey(void); + +#endif /* __KEYS_H__ */ diff --git a/src/main.c b/src/main.c index 0f6e155..c0cd5c7 100644 --- a/src/main.c +++ b/src/main.c @@ -44,7 +44,7 @@ #include #include -/* merged from sys_*.c -- jaq */ +/* merged from sys_*.c -- jaq #if defined(__linux__) || defined(__sgi) #include #elif defined(__FreeBSD__) || defined(__bsd__) || defined (__NetBSD__) @@ -52,24 +52,11 @@ #elif defined(sun) #include #endif +*/ /* libtool dynamic loader */ #include -/* merged from sys_bsd.c -- jaq */ -#ifndef RTLD_NOW -#define RTLD_NOW RTLD_LAZY -#endif - -/* merged from sys_bsd.c -- jaq */ -#ifdef __OpenBSD__ -#define dlsym(X, Y) dlsym(X, "_"##Y) -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "qcommon.h" #include "game.h" #include "rw.h" diff --git a/src/qcommon.h b/src/qcommon.h index 37b4469..74d11b8 100644 --- a/src/qcommon.h +++ b/src/qcommon.h @@ -1,96 +1,49 @@ -/* -Copyright (C) 1997-2001 Id Software, Inc. +/* $Id$ + * + * definitions common between client and server, but not the game dll + * + * Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (c) 2002 The Quakeforge Project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +#ifndef __QCOMMON_H__ +#define __QCOMMON_H__ -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ #include "gcc_attr.h" - -// qcommon.h -- definitions common between client and server, but not game.dll - #include "q_shared.h" - -/* we define this in config.h now */ -/* #define VERSION 3.21 */ - #define BASEDIRNAME "baseq2" -#ifdef WIN32 - -#ifdef NDEBUG -#define BUILDSTRING "Win32 RELEASE" -#else -#define BUILDSTRING "Win32 DEBUG" -#endif -/* -#ifdef _M_IX86 -#define CPUSTRING "x86" -#elif defined _M_ALPHA -#define CPUSTRING "AXP" -#endif -*/ -#elif defined(__linux__) || defined(__bsd__) || defined (__FreeBSD__) || defined (__NetBSD__) - -#define BUILDSTRING "Linux" -/* -#ifdef __i386__ -#define CPUSTRING "i386" -#elif defined __alpha__ -#define CPUSTRING "axp" -#else -#define CPUSTRING "Unknown" -#endif -*/ -#elif defined __sun__ - -#define BUILDSTRING "Solaris" -/* -#ifdef __i386__ -#define CPUSTRING "i386" -#else -#define CPUSTRING "sparc" -#endif -*/ -#else // !WIN32 - -#define BUILDSTRING "NON-WIN32" -/* #define CPUSTRING "NON-WIN32" */ - -#endif - -/* all that crud above should die -- jaq */ -#define CPUSTRING ARCH -//============================================================================ - -typedef struct sizebuf_s -{ - qboolean allowoverflow; // if false, do a Com_Error - qboolean overflowed; // set to true if the buffer size failed - byte *data; - int maxsize; - int cursize; - int readcount; +typedef struct sizebuf_s { + qboolean allowoverflow; /* if false, do a Com_Error */ + qboolean overflowed; /* set to true if the buffer size failed */ + byte * data; + int maxsize; + int cursize; + int readcount; } sizebuf_t; -void SZ_Init (sizebuf_t *buf, byte *data, int length); -void SZ_Clear (sizebuf_t *buf); -void *SZ_GetSpace (sizebuf_t *buf, int length); -void SZ_Write (sizebuf_t *buf, void *data, int length); -void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf +void SZ_Init(sizebuf_t * buf, byte * data, int length); +void SZ_Clear(sizebuf_t * buf); +void * SZ_GetSpace(sizebuf_t * buf, int length); +void SZ_Write(sizebuf_t * buf, void * data, int length); +void SZ_Print(sizebuf_t * buf, char * data); /* strcats onto the sizebuf */ //============================================================================ @@ -854,6 +807,4 @@ void SV_Init (void); void SV_Shutdown (char *finalmsg, qboolean reconnect); void SV_Frame (int msec); - - -//char *strlwr (char *); // FIXME: is this needed? +#endif /* __QCOMMON_H__ */ diff --git a/src/qfiles.h b/src/qfiles.h index a7bc440..7679bef 100644 --- a/src/qfiles.h +++ b/src/qfiles.h @@ -1,35 +1,30 @@ -/* -Copyright (C) 1997-2001 Id Software, Inc. +/* $Id$ + * + * quake file formats + * + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +#ifndef __QFILES_H__ +#define __QFILES_H__ -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -// -// qfiles.h: quake file formats -// This file must be identical in the quake and utils directories -// - -/* -======================================================================== - -The .pak files are just a linear collapse of a directory tree - -======================================================================== -*/ +/* The .pak files are just a linear collapse of a directory tree */ #define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P') @@ -480,3 +475,5 @@ typedef struct int numareaportals; int firstareaportal; } darea_t; + +#endif /* __QFILES_H__ */ diff --git a/src/qgl.c b/src/qgl.c index 956f4d6..5d75b30 100644 --- a/src/qgl.c +++ b/src/qgl.c @@ -3077,7 +3077,7 @@ qboolean QGL_Init( const char *dllname ) /* from relnev 0.9 -- jaq */ if (glw_state.OpenGLLib) - QGL_Shutdown(); + QGL_Shutdown(); if ( ( glw_state.OpenGLLib = dlopen( dllname, RTLD_LAZY | RTLD_GLOBAL ) ) == 0 ) { diff --git a/src/qgl.h b/src/qgl.h index 6c2e161..79da5d4 100644 --- a/src/qgl.h +++ b/src/qgl.h @@ -26,7 +26,7 @@ #define __QGL_H__ #ifdef _WIN32 -# include +# include #endif #include @@ -35,25 +35,16 @@ qboolean QGL_Init( const char *dllname ); void QGL_Shutdown( void ); +/* for windos' benefit */ #ifndef APIENTRY -# define APIENTRY +# define APIENTRY #endif /* -#ifdef __OpenBSD__ || __FreeBSD__ -#define GPA(X) dlsym(glw_state.OpenGLLib, "_"##X) -#else -#define GPA(X) dlsym(glw_state.OpenGLLib, X) -#endif - -#ifndef qwglGetProcAddress -#define qwglGetProcAddress(X) (glw_state.OpenGLLib ? GPA(X) : NULL) -#endif -*/ - #ifdef __FreeBSD__ extern void *qwglGetProcAddress(char *symbol); #endif +*/ extern void ( APIENTRY * qglAccum )(GLenum op, GLfloat value); extern void ( APIENTRY * qglAlphaFunc )(GLenum func, GLclampf ref); @@ -444,7 +435,7 @@ extern BOOL ( WINAPI * qwglSetDeviceGammaRampEXT ) ( const unsigned char *pRed, #endif /* FIXME: this ifdef sucks */ -#if defined __linux__ || defined __FreeBSD__ +/*#if defined __linux__ || defined __FreeBSD__*/ // local function in dll //#ifndef qwglGetProcAddress // FIXME @@ -457,23 +448,22 @@ void APIENTRY Fake_glColorTableEXT( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ); -#endif // linux +/*#endif // linux */ -#if defined(__linux__) || defined(__bsd__) || defined(__FreeBSD__) || defined(__NetBSD__) +/*#if defined(__linux__) || defined(__bsd__) || defined(__FreeBSD__) || defined(__NetBSD__)*/ extern void (*qgl3DfxSetPaletteEXT)(GLuint *); -#endif +/*#endif*/ /* deprecated */ #define GL_TEXTURE0_SGIS 0x835E #define GL_TEXTURE1_SGIS 0x835F -#if 0 // FIXME: these are in glext.h, delete after testing /* -** extension constants -*/ +#if 0 // FIXME: these are in glext.h, delete after testing +// extension constants #define GL_POINT_SIZE_MIN_EXT 0x8126 #define GL_POINT_SIZE_MAX_EXT 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 @@ -489,6 +479,7 @@ extern void (*qgl3DfxSetPaletteEXT)(GLuint *); #define GL_TEXTURE1_ARB 0x84C1 #endif // FIXME: end of glext.h defines +*/ extern int GL_Texture0, GL_Texture1; diff --git a/src/r_local.h b/src/r_local.h index 45ab7b2..51482b3 100644 --- a/src/r_local.h +++ b/src/r_local.h @@ -16,8 +16,12 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ + +#ifndef __R_LOCAL_H__ +#define __R_LOCAL_H__ #include #include @@ -847,3 +851,4 @@ void SWimp_Shutdown( void ); rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen ); void SWimp_AppActivate( qboolean active ); +#endif /* __R_LOCAL_H__ */ diff --git a/src/ref.h b/src/ref.h index 25a8135..7be114a 100644 --- a/src/ref.h +++ b/src/ref.h @@ -1,24 +1,29 @@ -/* -Copyright (C) 1997-2001 Id Software, Inc. +/* $Id$ + * + * video refresher header + * + * Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (c) 2002 The Quakeforge Project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -#ifndef __REF_H -#define __REF_H +#ifndef __REF_H__ +#define __REF_H__ #include "qcommon.h" #include "gcc_attr.h" @@ -228,4 +233,4 @@ typedef struct // this is the only function actually exported at the linker level typedef refexport_t (*GetRefAPI_t) (refimport_t); -#endif // __REF_H +#endif /* __REF_H__ */ diff --git a/src/rw.h b/src/rw.h index 0836c2f..71f2b73 100644 --- a/src/rw.h +++ b/src/rw.h @@ -18,7 +18,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ #ifndef __RW_H__ @@ -31,11 +32,11 @@ extern void (*KBD_Init_fp)(Key_Event_fp_t fp); extern void (*KBD_Close_fp)(void); typedef struct in_state { - // Pointers to functions back in client, set by vid_so - void (*IN_CenterView_fp)(void); - Key_Event_fp_t Key_Event_fp; - vec_t *viewangles; - int *in_strafe_state; + /* Pointers to functions back in client, set by vid_so */ + void (*IN_CenterView_fp)(void); + Key_Event_fp_t Key_Event_fp; + vec_t *viewangles; + int *in_strafe_state; } in_state_t; #endif /* __RW_H__ */ diff --git a/src/vid_so.c b/src/vid_so.c index f071618..6d2357a 100644 --- a/src/vid_so.c +++ b/src/vid_so.c @@ -20,7 +20,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ #ifdef HAVE_CONFIG_H @@ -34,9 +35,11 @@ #include +/* #ifdef HAVE_DLOPEN # include // ELF dl loader #endif +*/ #include #include @@ -45,45 +48,26 @@ /* libtool dynamic loader */ #include -/* merged in from bsd -- jaq */ -/* -#ifndef RTLD_NOW -#define RTLD_NOW RTLD_LAZY -#endif - -#ifndef RTLD_GLOBAL -#define RTLD_GLOBAL 0 -#endif - -#ifdef __OpenBSD__ -#define dlsym(X, Y) dlsym(X, "_"##Y) -#endif -*/ - #include "client.h" #include "rw.h" -// Structure containing functions exported from refresh DLL -refexport_t re; +/* Structure containing functions exported from refresh DLL */ +refexport_t re; -/* merged from irix/vid_so.c -- jaq */ -/* -#ifdef REF_HARD_LINKED -refexport_t GetRefAPI(refimport_t rimp); -#endif -*/ +/* Console variables that we need to access from this module */ +cvar_t * vid_gamma; /* gamma value */ +cvar_t * vid_ref; /* name of refresher dll */ +cvar_t * vid_xpos; /* window position x */ +cvar_t * vid_ypos; /* window position y */ +cvar_t * vid_fullscreen; /* fullscreen on or off */ -// Console variables that we need to access from this module -cvar_t *vid_gamma; -cvar_t *vid_ref; // Name of Refresh DLL loaded -cvar_t *vid_xpos; // X coordinate of window position -cvar_t *vid_ypos; // Y coordinate of window position -cvar_t *vid_fullscreen; +/* global video state; used by other modules */ +viddef_t viddef; -// Global variables used internally by this module -viddef_t viddef; // global video state; used by other modules -lt_dlhandle reflib_library = NULL; // Handle to refresh DLL -qboolean reflib_active = 0; +/* Handle to refresh DLL */ +lt_dlhandle reflib_library = NULL; + +qboolean reflib_active = 0; #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) ) @@ -206,43 +190,34 @@ qboolean VID_GetModeInfo( unsigned int *width, unsigned int *height, int mode ) /* ** VID_NewWindow */ -void VID_NewWindow ( int width, int height) -{ - viddef.width = width; - viddef.height = height; +void VID_NewWindow(int width, int height) { + viddef.width = width; + viddef.height = height; } -void VID_FreeReflib (void) -{ - if (reflib_library) { - if (KBD_Close_fp) - KBD_Close_fp(); - if (RW_IN_Shutdown_fp) - RW_IN_Shutdown_fp(); -/* merged from irix/vid_so.c -- jaq */ -/* -#ifndef REF_HARD_LINKED -*/ - lt_dlclose(reflib_library); -/* -#endif -*/ - } - - KBD_Init_fp = NULL; - KBD_Update_fp = NULL; - KBD_Close_fp = NULL; - RW_IN_Init_fp = NULL; - RW_IN_Shutdown_fp = NULL; - RW_IN_Activate_fp = NULL; - RW_IN_Commands_fp = NULL; - RW_IN_Move_fp = NULL; - RW_IN_Frame_fp = NULL; - RW_Sys_GetClipboardData_fp = NULL; - - memset (&re, 0, sizeof(re)); - reflib_library = NULL; - reflib_active = false; +void VID_FreeReflib(void) { + if (reflib_library) { + if (KBD_Close_fp) + KBD_Close_fp(); + if (RW_IN_Shutdown_fp) + RW_IN_Shutdown_fp(); + lt_dlclose(reflib_library); + } + + KBD_Init_fp = NULL; + KBD_Update_fp = NULL; + KBD_Close_fp = NULL; + RW_IN_Init_fp = NULL; + RW_IN_Shutdown_fp = NULL; + RW_IN_Activate_fp = NULL; + RW_IN_Commands_fp = NULL; + RW_IN_Move_fp = NULL; + RW_IN_Frame_fp = NULL; + RW_Sys_GetClipboardData_fp = NULL; + + memset (&re, 0, sizeof(re)); + reflib_library = NULL; + reflib_active = false; } /* @@ -388,68 +363,53 @@ qboolean VID_LoadRefresh(char * name) { return true; } -/* -============ -VID_CheckChanges +/* This function gets called once just before drawing each frame, and + * its sole purpose in life is to check to see if any of the video mode + * parameters have changed, and if they have to update the rendering DLL + * and/or video mode to match. */ +void VID_CheckChanges(void) { + char name[100]; + cvar_t *sw_mode; -This function gets called once just before drawing each frame, and it's sole purpose in life -is to check to see if any of the video mode parameters have changed, and if they have to -update the rendering DLL and/or video mode to match. -============ -*/ -void VID_CheckChanges (void) -{ - char name[100]; - cvar_t *sw_mode; + if (vid_ref->modified) { + S_StopAllSounds(); + } - if ( vid_ref->modified ) - { - S_StopAllSounds(); + while (vid_ref->modified) { + /* refresher has changed */ + vid_ref->modified = false; + vid_fullscreen->modified = true; + cl.refresh_prepped = false; + cls.disable_screen = true; + + sprintf(name, "ref_%s", vid_ref->string); + if (!VID_LoadRefresh(name)) { + if (strcmp(vid_ref->string, "soft") == 0 || + strcmp(vid_ref->string, "softx") == 0) { + Com_Printf("Refresh failed\n"); + sw_mode = Cvar_Get("sw_mode", "0", 0); + if (sw_mode->value != 0) { + Com_Printf("Trying mode 0\n"); + Cvar_SetValue("sw_mode", 0); + if (!VID_LoadRefresh(name)) + Com_Error(ERR_FATAL, "Couldn't fall back to software refresh!"); + } else + Com_Error (ERR_FATAL, "Couldn't fall back to software refresh!"); + } + + /* prefer to fall back on X if active */ + if (getenv("DISPLAY")) + Cvar_Set("vid_ref", "softx"); + else + Cvar_Set("vid_ref", "soft"); + + /* drop the console if we fail to load a refresh */ + if (cls.key_dest != key_console) { + Con_ToggleConsole_f(); + } } - - while (vid_ref->modified) - { - /* - ** refresh has changed - */ - vid_ref->modified = false; - vid_fullscreen->modified = true; - cl.refresh_prepped = false; - cls.disable_screen = true; - - sprintf( name, "ref_%s", vid_ref->string ); - if ( !VID_LoadRefresh( name ) ) - { - if ( strcmp (vid_ref->string, "soft") == 0 || - strcmp (vid_ref->string, "softx") == 0 ) { - Com_Printf("Refresh failed\n"); - sw_mode = Cvar_Get( "sw_mode", "0", 0 ); - if (sw_mode->value != 0) { - Com_Printf("Trying mode 0\n"); - Cvar_SetValue("sw_mode", 0); - if ( !VID_LoadRefresh( name ) ) - Com_Error (ERR_FATAL, "Couldn't fall back to software refresh!"); - } else - Com_Error (ERR_FATAL, "Couldn't fall back to software refresh!"); - } - - /* prefer to fall back on X if active */ - if (getenv("DISPLAY")) - Cvar_Set( "vid_ref", "softx" ); - else - Cvar_Set( "vid_ref", "soft" ); - - /* - ** drop the console if we fail to load a refresh - */ - if ( cls.key_dest != key_console ) - { - Con_ToggleConsole_f(); - } - } - cls.disable_screen = false; - } - + cls.disable_screen = false; + } } /*