- Noted the requirement for automake 1.6 in the README

- Got configure to work out the BUILDSTRING (now BUILDHOST)
  for common.c
- Code cleanups.
This commit is contained in:
Jamie Wilkinson 2002-07-05 12:41:58 +00:00
parent 101e724922
commit abc8f0841e
17 changed files with 397 additions and 487 deletions

3
README
View file

@ -5,7 +5,8 @@ Compiling
--------- ---------
If you are checking this out from CVS, run the bootstrap command first to set 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 Save Games
---------- ----------

View file

@ -10,6 +10,8 @@ AM_CONFIG_HEADER(config.h)
dnl get the build and target hosts dnl get the build and target hosts
AC_CANONICAL_SYSTEM 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 dnl set the program and version
AM_INIT_AUTOMAKE(quake2, 0.1) AM_INIT_AUTOMAKE(quake2, 0.1)

View file

@ -18,9 +18,13 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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 #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
@ -588,3 +592,5 @@ void x86_TimerStop( void );
void x86_TimerInit( unsigned long smallest, unsigned longest ); void x86_TimerInit( unsigned long smallest, unsigned longest );
unsigned long *x86_TimerGetHistogram( void ); unsigned long *x86_TimerGetHistogram( void );
#endif #endif
#endif /* __CLIENT_H__ */

View file

@ -18,7 +18,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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 #ifdef HAVE_CONFIG_H
@ -1486,10 +1487,7 @@ void Qcommon_Init (int argc, char **argv)
dedicated = Cvar_Get ("dedicated", "0", CVAR_NOSET); dedicated = Cvar_Get ("dedicated", "0", CVAR_NOSET);
#endif #endif
/* lose the arch s = va("%s %s %s", VERSION, __DATE__, BUILDHOST);
s = va("%4.2f %s %s %s", VERSION, CPUSTRING, __DATE__, BUILDSTRING);
*/
s = va("%s %s %s", VERSION, __DATE__, BUILDSTRING);
Cvar_Get ("version", s, CVAR_SERVERINFO|CVAR_NOSET); Cvar_Get ("version", s, CVAR_SERVERINFO|CVAR_NOSET);

View file

@ -1,36 +1,32 @@
/* /* $Id$
gcc_attr.h *
* 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. #ifndef __GCC_ATTR_H__
#define __GCC_ATTR_H__
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 __GNUC__ #ifndef __GNUC__
# define __attribute__(x) # define __attribute__(x)
#endif #endif
#endif // __gcc_attr_h #endif /* __GCC_ATTR_H__ */

View file

@ -16,7 +16,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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 #ifdef _WIN32

View file

@ -1,4 +1,6 @@
/* $Id$ /* $Id$
*
* entry point for the OpenGL refresher
* *
* Copyright (C) 1997-2001 Id Software, Inc. * Copyright (C) 1997-2001 Id Software, Inc.
* Copyright (c) 2002 The Quakeforge Project. * Copyright (c) 2002 The Quakeforge Project.
@ -16,7 +18,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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 <ctype.h> #include <ctype.h>

View file

@ -1,151 +1,157 @@
/* /* $Id$
Copyright (C) 1997-2001 Id Software, Inc. *
* 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 #ifndef __KEYS_H__
modify it under the terms of the GNU General Public License #define __KEYS_H__
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, /* numbers are specified so that key bindings remain compatible with
but WITHOUT ANY WARRANTY; without even the implied warranty of * user configurations */
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.
*/
//
// these are the key numbers that should be passed to Key_Event
//
enum QKEYS { enum QKEYS {
K_TAB = 9, K_TAB = 9,
K_ENTER = 13, K_ENTER = 13,
K_ESCAPE = 27, K_ESCAPE = 27,
K_SPACE = 32, 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_AUX1 = 207,
K_AUX2 = 208,
K_BACKSPACE = 127, K_AUX3 = 209,
K_UPARROW = 128, K_AUX4 = 210,
K_DOWNARROW = 129, K_AUX5 = 211,
K_LEFTARROW = 130, K_AUX6 = 212,
K_RIGHTARROW = 131, K_AUX7 = 213,
K_AUX8 = 214,
K_ALT = 132, K_AUX9 = 215,
K_CTRL = 133, K_AUX10 = 216,
K_SHIFT = 134, K_AUX11 = 217,
K_F1 = 135, K_AUX12 = 218,
K_F2 = 136, K_AUX13 = 219,
K_F3 = 137, K_AUX14 = 220,
K_F4 = 138, K_AUX15 = 221,
K_F5 = 139, K_AUX16 = 222,
K_F6 = 140, K_AUX17 = 223,
K_F7 = 141, K_AUX18 = 224,
K_F8 = 142, K_AUX19 = 225,
K_F9 = 143, K_AUX20 = 226,
K_F10 = 144, K_AUX21 = 227,
K_F11 = 145, K_AUX22 = 228,
K_F12 = 146, K_AUX23 = 229,
K_INS = 147, K_AUX24 = 230,
K_DEL = 148, K_AUX25 = 231,
K_PGDN = 149, K_AUX26 = 232,
K_PGUP = 150, K_AUX27 = 233,
K_HOME = 151, K_AUX28 = 234,
K_END = 152, K_AUX29 = 235,
K_AUX30 = 236,
K_KP_HOME = 160, K_AUX31 = 237,
K_KP_UPARROW = 161, K_AUX32 = 238,
K_KP_PGUP = 162,
K_KP_LEFTARROW = 163, K_MWHEELDOWN = 239,
K_KP_5 = 164, K_MWHEELUP = 240,
K_KP_RIGHTARROW = 165,
K_KP_END = 166, K_PAUSE = 255,
K_KP_DOWNARROW = 167,
K_KP_PGDN = 168, K_LAST
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
}; };
extern char * keybindings[K_LAST]; extern char * keybindings[K_LAST];
extern int key_repeats[K_LAST]; extern int key_repeats[K_LAST];
extern int anykeydown; extern int anykeydown;
extern char chat_buffer[]; extern char chat_buffer[];
extern int chat_bufferlen; extern int chat_bufferlen;
extern qboolean chat_team; extern qboolean chat_team;
void Key_Event (int key, qboolean down, unsigned time); void Key_Event(int key, qboolean down, unsigned time);
void Key_Init (void); void Key_Init(void);
void Key_WriteBindings (FILE *f); void Key_WriteBindings(FILE * f);
void Key_SetBinding (int keynum, char *binding); void Key_SetBinding(int keynum, char * binding);
void Key_ClearStates (void); void Key_ClearStates(void);
int Key_GetKey (void); int Key_GetKey(void);
#endif /* __KEYS_H__ */

View file

@ -44,7 +44,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <errno.h> #include <errno.h>
/* merged from sys_*.c -- jaq */ /* merged from sys_*.c -- jaq
#if defined(__linux__) || defined(__sgi) #if defined(__linux__) || defined(__sgi)
#include <mntent.h> #include <mntent.h>
#elif defined(__FreeBSD__) || defined(__bsd__) || defined (__NetBSD__) #elif defined(__FreeBSD__) || defined(__bsd__) || defined (__NetBSD__)
@ -52,24 +52,11 @@
#elif defined(sun) #elif defined(sun)
#include <sys/file.h> #include <sys/file.h>
#endif #endif
*/
/* libtool dynamic loader */ /* libtool dynamic loader */
#include <ltdl.h> #include <ltdl.h>
/* 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 "qcommon.h"
#include "game.h" #include "game.h"
#include "rw.h" #include "rw.h"

View file

@ -1,96 +1,49 @@
/* /* $Id$
Copyright (C) 1997-2001 Id Software, Inc. *
* 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 #ifndef __QCOMMON_H__
modify it under the terms of the GNU General Public License #define __QCOMMON_H__
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.
*/
#include "gcc_attr.h" #include "gcc_attr.h"
// qcommon.h -- definitions common between client and server, but not game.dll
#include "q_shared.h" #include "q_shared.h"
/* we define this in config.h now */
/* #define VERSION 3.21 */
#define BASEDIRNAME "baseq2" #define BASEDIRNAME "baseq2"
#ifdef WIN32 typedef struct sizebuf_s {
qboolean allowoverflow; /* if false, do a Com_Error */
#ifdef NDEBUG qboolean overflowed; /* set to true if the buffer size failed */
#define BUILDSTRING "Win32 RELEASE" byte * data;
#else int maxsize;
#define BUILDSTRING "Win32 DEBUG" int cursize;
#endif int readcount;
/*
#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;
} sizebuf_t; } sizebuf_t;
void SZ_Init (sizebuf_t *buf, byte *data, int length); void SZ_Init(sizebuf_t * buf, byte * data, int length);
void SZ_Clear (sizebuf_t *buf); void SZ_Clear(sizebuf_t * buf);
void *SZ_GetSpace (sizebuf_t *buf, int length); void * SZ_GetSpace(sizebuf_t * buf, int length);
void SZ_Write (sizebuf_t *buf, void *data, 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_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_Shutdown (char *finalmsg, qboolean reconnect);
void SV_Frame (int msec); void SV_Frame (int msec);
#endif /* __QCOMMON_H__ */
//char *strlwr (char *); // FIXME: is this needed?

View file

@ -1,35 +1,30 @@
/* /* $Id$
Copyright (C) 1997-2001 Id Software, Inc. *
* 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 #ifndef __QFILES_H__
modify it under the terms of the GNU General Public License #define __QFILES_H__
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, /* The .pak files are just a linear collapse of a directory tree */
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
========================================================================
*/
#define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P') #define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P')
@ -480,3 +475,5 @@ typedef struct
int numareaportals; int numareaportals;
int firstareaportal; int firstareaportal;
} darea_t; } darea_t;
#endif /* __QFILES_H__ */

View file

@ -3077,7 +3077,7 @@ qboolean QGL_Init( const char *dllname )
/* from relnev 0.9 -- jaq */ /* from relnev 0.9 -- jaq */
if (glw_state.OpenGLLib) if (glw_state.OpenGLLib)
QGL_Shutdown(); QGL_Shutdown();
if ( ( glw_state.OpenGLLib = dlopen( dllname, RTLD_LAZY | RTLD_GLOBAL ) ) == 0 ) if ( ( glw_state.OpenGLLib = dlopen( dllname, RTLD_LAZY | RTLD_GLOBAL ) ) == 0 )
{ {

View file

@ -26,7 +26,7 @@
#define __QGL_H__ #define __QGL_H__
#ifdef _WIN32 #ifdef _WIN32
# include <windows.h> # include <windows.h>
#endif #endif
#include <GL/gl.h> #include <GL/gl.h>
@ -35,25 +35,16 @@
qboolean QGL_Init( const char *dllname ); qboolean QGL_Init( const char *dllname );
void QGL_Shutdown( void ); void QGL_Shutdown( void );
/* for windos' benefit */
#ifndef APIENTRY #ifndef APIENTRY
# define APIENTRY # define APIENTRY
#endif #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__ #ifdef __FreeBSD__
extern void *qwglGetProcAddress(char *symbol); extern void *qwglGetProcAddress(char *symbol);
#endif #endif
*/
extern void ( APIENTRY * qglAccum )(GLenum op, GLfloat value); extern void ( APIENTRY * qglAccum )(GLenum op, GLfloat value);
extern void ( APIENTRY * qglAlphaFunc )(GLenum func, GLclampf ref); extern void ( APIENTRY * qglAlphaFunc )(GLenum func, GLclampf ref);
@ -444,7 +435,7 @@ extern BOOL ( WINAPI * qwglSetDeviceGammaRampEXT ) ( const unsigned char *pRed,
#endif #endif
/* FIXME: this ifdef sucks */ /* FIXME: this ifdef sucks */
#if defined __linux__ || defined __FreeBSD__ /*#if defined __linux__ || defined __FreeBSD__*/
// local function in dll // local function in dll
//#ifndef qwglGetProcAddress // FIXME //#ifndef qwglGetProcAddress // FIXME
@ -457,23 +448,22 @@ void APIENTRY Fake_glColorTableEXT( GLenum target, GLenum internalformat,
GLsizei width, GLenum format, GLenum type, GLsizei width, GLenum format, GLenum type,
const GLvoid *table ); 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 *); extern void (*qgl3DfxSetPaletteEXT)(GLuint *);
#endif /*#endif*/
/* deprecated */ /* deprecated */
#define GL_TEXTURE0_SGIS 0x835E #define GL_TEXTURE0_SGIS 0x835E
#define GL_TEXTURE1_SGIS 0x835F #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_MIN_EXT 0x8126
#define GL_POINT_SIZE_MAX_EXT 0x8127 #define GL_POINT_SIZE_MAX_EXT 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 #define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
@ -489,6 +479,7 @@ extern void (*qgl3DfxSetPaletteEXT)(GLuint *);
#define GL_TEXTURE1_ARB 0x84C1 #define GL_TEXTURE1_ARB 0x84C1
#endif // FIXME: end of glext.h defines #endif // FIXME: end of glext.h defines
*/
extern int GL_Texture0, GL_Texture1; extern int GL_Texture0, GL_Texture1;

View file

@ -16,8 +16,12 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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 <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -847,3 +851,4 @@ void SWimp_Shutdown( void );
rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen ); rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen );
void SWimp_AppActivate( qboolean active ); void SWimp_AppActivate( qboolean active );
#endif /* __R_LOCAL_H__ */

View file

@ -1,24 +1,29 @@
/* /* $Id$
Copyright (C) 1997-2001 Id Software, Inc. *
* 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 #ifndef __REF_H__
modify it under the terms of the GNU General Public License #define __REF_H__
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
#include "qcommon.h" #include "qcommon.h"
#include "gcc_attr.h" #include "gcc_attr.h"
@ -228,4 +233,4 @@ typedef struct
// this is the only function actually exported at the linker level // this is the only function actually exported at the linker level
typedef refexport_t (*GetRefAPI_t) (refimport_t); typedef refexport_t (*GetRefAPI_t) (refimport_t);
#endif // __REF_H #endif /* __REF_H__ */

View file

@ -18,7 +18,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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__ #ifndef __RW_H__
@ -31,11 +32,11 @@ extern void (*KBD_Init_fp)(Key_Event_fp_t fp);
extern void (*KBD_Close_fp)(void); extern void (*KBD_Close_fp)(void);
typedef struct in_state { typedef struct in_state {
// Pointers to functions back in client, set by vid_so /* Pointers to functions back in client, set by vid_so */
void (*IN_CenterView_fp)(void); void (*IN_CenterView_fp)(void);
Key_Event_fp_t Key_Event_fp; Key_Event_fp_t Key_Event_fp;
vec_t *viewangles; vec_t *viewangles;
int *in_strafe_state; int *in_strafe_state;
} in_state_t; } in_state_t;
#endif /* __RW_H__ */ #endif /* __RW_H__ */

View file

@ -20,7 +20,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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 #ifdef HAVE_CONFIG_H
@ -34,9 +35,11 @@
#include <assert.h> #include <assert.h>
/*
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
# include <dlfcn.h> // ELF dl loader # include <dlfcn.h> // ELF dl loader
#endif #endif
*/
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
@ -45,45 +48,26 @@
/* libtool dynamic loader */ /* libtool dynamic loader */
#include <ltdl.h> #include <ltdl.h>
/* 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 "client.h"
#include "rw.h" #include "rw.h"
// Structure containing functions exported from refresh DLL /* Structure containing functions exported from refresh DLL */
refexport_t re; refexport_t re;
/* merged from irix/vid_so.c -- jaq */ /* Console variables that we need to access from this module */
/* cvar_t * vid_gamma; /* gamma value */
#ifdef REF_HARD_LINKED cvar_t * vid_ref; /* name of refresher dll */
refexport_t GetRefAPI(refimport_t rimp); cvar_t * vid_xpos; /* window position x */
#endif 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 /* global video state; used by other modules */
cvar_t *vid_gamma; viddef_t viddef;
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 variables used internally by this module /* Handle to refresh DLL */
viddef_t viddef; // global video state; used by other modules lt_dlhandle reflib_library = NULL;
lt_dlhandle reflib_library = NULL; // Handle to refresh DLL
qboolean reflib_active = 0; qboolean reflib_active = 0;
#define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[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 ** VID_NewWindow
*/ */
void VID_NewWindow ( int width, int height) void VID_NewWindow(int width, int height) {
{ viddef.width = width;
viddef.width = width; viddef.height = height;
viddef.height = height;
} }
void VID_FreeReflib (void) void VID_FreeReflib(void) {
{ if (reflib_library) {
if (reflib_library) { if (KBD_Close_fp)
if (KBD_Close_fp) KBD_Close_fp();
KBD_Close_fp(); if (RW_IN_Shutdown_fp)
if (RW_IN_Shutdown_fp) RW_IN_Shutdown_fp();
RW_IN_Shutdown_fp(); lt_dlclose(reflib_library);
/* merged from irix/vid_so.c -- jaq */ }
/*
#ifndef REF_HARD_LINKED KBD_Init_fp = NULL;
*/ KBD_Update_fp = NULL;
lt_dlclose(reflib_library); KBD_Close_fp = NULL;
/* RW_IN_Init_fp = NULL;
#endif RW_IN_Shutdown_fp = NULL;
*/ RW_IN_Activate_fp = NULL;
} RW_IN_Commands_fp = NULL;
RW_IN_Move_fp = NULL;
KBD_Init_fp = NULL; RW_IN_Frame_fp = NULL;
KBD_Update_fp = NULL; RW_Sys_GetClipboardData_fp = NULL;
KBD_Close_fp = NULL;
RW_IN_Init_fp = NULL; memset (&re, 0, sizeof(re));
RW_IN_Shutdown_fp = NULL; reflib_library = NULL;
RW_IN_Activate_fp = NULL; reflib_active = false;
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; return true;
} }
/* /* 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
VID_CheckChanges * 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 if (vid_ref->modified) {
is to check to see if any of the video mode parameters have changed, and if they have to S_StopAllSounds();
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 ) while (vid_ref->modified) {
{ /* refresher has changed */
S_StopAllSounds(); 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;
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;
}
} }
/* /*