* Merge unified-sdl to trunk

* Bump Q3_VERSION to 1.35
This commit is contained in:
Tim Angus 2007-09-05 18:17:46 +00:00
parent 39abffeb3b
commit 672cfbf16f
188 changed files with 5071 additions and 41739 deletions

203
Makefile
View file

@ -32,12 +32,8 @@ BUILD_SERVER =
BUILD_GAME_SO =
BUILD_GAME_QVM =
ifeq ($(V),1)
echo_cmd=@:
Q=
else
echo_cmd=@echo
Q=@
ifneq ($(PLATFORM),darwin)
BUILD_CLIENT_SMP = 0
endif
#############################################################################
@ -96,10 +92,6 @@ USE_CCACHE=0
endif
export USE_CCACHE
ifndef USE_SDL
USE_SDL=1
endif
ifndef USE_OPENAL
USE_OPENAL=1
endif
@ -136,8 +128,9 @@ CDIR=$(MOUNT_DIR)/client
SDIR=$(MOUNT_DIR)/server
RDIR=$(MOUNT_DIR)/renderer
CMDIR=$(MOUNT_DIR)/qcommon
UDIR=$(MOUNT_DIR)/unix
W32DIR=$(MOUNT_DIR)/win32
SDLDIR=$(MOUNT_DIR)/sdl
ASMDIR=$(MOUNT_DIR)/asm
SYSDIR=$(MOUNT_DIR)/sys
GDIR=$(MOUNT_DIR)/game
CGDIR=$(MOUNT_DIR)/cgame
BLIBDIR=$(MOUNT_DIR)/botlib
@ -146,7 +139,7 @@ UIDIR=$(MOUNT_DIR)/ui
Q3UIDIR=$(MOUNT_DIR)/q3_ui
JPDIR=$(MOUNT_DIR)/jpeg-6
TOOLSDIR=$(MOUNT_DIR)/tools
LOKISETUPDIR=$(UDIR)/setup
LOKISETUPDIR=misc/setup
SDLHDIR=$(MOUNT_DIR)/SDL12
LIBSDIR=$(MOUNT_DIR)/libs
@ -158,7 +151,7 @@ USE_SVN=
ifeq ($(wildcard .svn),.svn)
SVN_REV=$(shell LANG=C svnversion .)
ifneq ($(SVN_REV),)
SVN_VERSION=$(VERSION)_SVN$(SVN_REV)
SVN_VERSION=$(SVN_REV)
USE_SVN=1
endif
endif
@ -195,7 +188,8 @@ ifeq ($(PLATFORM),linux)
endif
endif
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes -pipe
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-pipe -DUSE_ICON $(shell sdl-config --cflags)
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1
@ -215,12 +209,6 @@ ifeq ($(PLATFORM),linux)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif
ifeq ($(USE_SDL),1)
BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
else
BASE_CFLAGS += -I/usr/X11R6/include
endif
OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer
ifeq ($(ARCH),x86_64)
@ -247,10 +235,6 @@ ifeq ($(PLATFORM),linux)
BASE_CFLAGS += -DNO_VM_COMPILED
endif
DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS)
@ -258,18 +242,14 @@ ifeq ($(PLATFORM),linux)
THREAD_LDFLAGS=-lpthread
LDFLAGS=-ldl -lm
ifeq ($(USE_SDL),1)
CLIENT_LDFLAGS=$(shell sdl-config --libs)
else
CLIENT_LDFLAGS=-L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
endif
CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LDFLAGS += -lopenal
endif
endif
ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LDFLAGS += -lcurl
@ -286,6 +266,9 @@ ifeq ($(PLATFORM),linux)
LDFLAGS+=-m32
endif
DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
else # ifeq Linux
#############################################################################
@ -384,19 +367,13 @@ ifeq ($(PLATFORM),darwin)
CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
endif
ifeq ($(USE_SDL),1)
BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 \
-I$(SDLHDIR)/include
# We copy sdlmain before ranlib'ing it so that subversion doesn't think
# the file has been modified by each build.
LIBSDLMAIN=$(B)/libSDLmain.a
LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
CLIENT_LDFLAGS += -framework Cocoa -framework IOKit -framework OpenGL \
$(LIBSDIR)/macosx/libSDL-1.2.0.dylib
else
# !!! FIXME: frameworks: OpenGL, Carbon, etc...
#CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
endif
BASE_CFLAGS += -D_THREAD_SAFE=1 -I$(SDLHDIR)/include
# We copy sdlmain before ranlib'ing it so that subversion doesn't think
# the file has been modified by each build.
LIBSDLMAIN=$(B)/libSDLmain.a
LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
CLIENT_LDFLAGS += -framework Cocoa -framework IOKit -framework OpenGL \
$(LIBSDIR)/macosx/libSDL-1.2.0.dylib
OPTIMIZE += -ffast-math -falign-loops=16
@ -429,7 +406,8 @@ endif
ARCH=x86
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON -I$(SDLHDIR)/include
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN=1
@ -446,22 +424,19 @@ endif
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif
OPTIMIZE = -O3 -march=i586 -fomit-frame-pointer -ffast-math -falign-loops=2 \
-funroll-loops -falign-jumps=2 -falign-functions=2 -fstrength-reduce
OPTIMIZE = -O3 -march=i586 -fno-omit-frame-pointer -ffast-math \
-falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \
-fstrength-reduce
HAVE_VM_COMPILED = true
DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
SHLIBEXT=dll
SHLIBCFLAGS=
SHLIBLDFLAGS=-shared $(LDFLAGS)
BINEXT=.exe
LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32
LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32 -lopengl32
CLIENT_LDFLAGS=
ifeq ($(USE_CURL),1)
@ -480,6 +455,14 @@ endif
LDFLAGS+=-m32
endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
# libmingw32 must be linked before libSDLmain
CLIENT_LDFLAGS += -lmingw32 \
$(LIBSDIR)/win32/libSDLmain.a \
$(LIBSDIR)/win32/libSDL.dll.a
BUILD_SERVER = 0
BUILD_CLIENT_SMP = 0
@ -499,9 +482,7 @@ ifeq ($(PLATFORM),freebsd)
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-I/usr/X11R6/include
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
-DUSE_ICON $(shell sdl-config --cflags)
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1
@ -514,10 +495,6 @@ ifeq ($(PLATFORM),freebsd)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif
ifeq ($(USE_SDL),1)
BASE_CFLAGS += $(shell sdl-config --cflags) -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1
endif
ifeq ($(ARCH),axp)
BASE_CFLAGS += -DNO_VM_COMPILED
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -ffast-math -funroll-loops \
@ -534,6 +511,8 @@ ifeq ($(PLATFORM),freebsd)
endif
endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS)
@ -544,11 +523,7 @@ ifeq ($(PLATFORM),freebsd)
CLIENT_LDFLAGS =
ifeq ($(USE_SDL),1)
CLIENT_LDFLAGS += $(shell sdl-config --libs)
else
CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
endif
CLIENT_LDFLAGS += $(shell sdl-config --libs) -lGL
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
@ -580,12 +555,13 @@ ifeq ($(PLATFORM),netbsd)
THREAD_LDFLAGS=-lpthread
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
ifneq ($(ARCH),i386)
BASE_CFLAGS += -DNO_VM_COMPILED
endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
BUILD_CLIENT = 0
BUILD_GAME_QVM = 0
@ -637,13 +613,8 @@ ifeq ($(PLATFORM),sunos)
endif
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes -pipe
ifeq ($(USE_SDL),1)
BASE_CFLAGS += -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
else
BASE_CFLAGS += -I/usr/openwin/include
endif
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-pipe -DUSE_ICON $(shell sdl-config --cflags)
OPTIMIZE = -O3 -ffast-math -funroll-loops
@ -681,11 +652,7 @@ ifeq ($(PLATFORM),sunos)
BOTCFLAGS=-O0
ifeq ($(USE_SDL),1)
CLIENT_LDFLAGS=$(shell sdl-config --libs) -L/usr/X11/lib -lGLU -lX11 -lXext
else
CLIENT_LDFLAGS=-L/usr/openwin/$(LIB) -L/usr/X11/lib -lGLU -lX11 -lXext
endif
CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL
else # ifeq sunos
@ -763,6 +730,14 @@ ifeq ($(USE_SVN),1)
BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\"
endif
ifeq ($(V),1)
echo_cmd=@:
Q=
else
echo_cmd=@echo
Q=@
endif
define DO_CC
$(echo_cmd) "CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
@ -1049,6 +1024,12 @@ Q3OBJ = \
$(B)/client/tr_sky.o \
$(B)/client/tr_surface.o \
$(B)/client/tr_world.o \
\
$(B)/client/sdl_gamma.o \
$(B)/client/sdl_input.o \
$(B)/client/sdl_snd.o \
\
$(B)/client/sys_main.o
ifeq ($(ARCH),i386)
Q3OBJ += \
@ -1082,44 +1063,19 @@ endif
ifeq ($(PLATFORM),mingw32)
Q3OBJ += \
$(B)/client/win_gamma.o \
$(B)/client/win_glimp.o \
$(B)/client/win_input.o \
$(B)/client/win_main.o \
$(B)/client/win_qgl.o \
$(B)/client/win_shared.o \
$(B)/client/win_snd.o \
$(B)/client/win_syscon.o \
$(B)/client/win_wndproc.o \
$(B)/client/win_resource.o
$(B)/client/win_resource.o \
$(B)/client/sys_win32.o
else
Q3OBJ += \
$(B)/client/unix_main.o \
$(B)/client/unix_shared.o \
$(B)/client/linux_signals.o \
$(B)/client/linux_qgl.o \
$(B)/client/linux_snd.o \
$(B)/client/sdl_snd.o
ifeq ($(PLATFORM),linux)
Q3OBJ += $(B)/client/linux_joystick.o
endif
ifeq ($(USE_SDL),1)
ifneq ($(PLATFORM),darwin)
BUILD_CLIENT_SMP = 0
endif
endif
Q3POBJ = \
$(B)/client/linux_glimp.o \
$(B)/client/sdl_glimp.o
Q3POBJ_SMP = \
$(B)/clientsmp/linux_glimp.o \
$(B)/clientsmp/sdl_glimp.o
$(B)/client/sys_unix.o
endif
Q3POBJ += \
$(B)/client/sdl_glimp.o
Q3POBJ_SMP += \
$(B)/clientsmp/sdl_glimp.o
$(B)/ioquake3.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@"
$(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \
@ -1206,13 +1162,14 @@ Q3DOBJ = \
$(B)/ded/l_script.o \
$(B)/ded/l_struct.o \
\
$(B)/ded/linux_signals.o \
$(B)/ded/unix_main.o \
$(B)/ded/unix_shared.o \
\
$(B)/ded/null_client.o \
$(B)/ded/null_input.o \
$(B)/ded/null_snddma.o
$(B)/ded/null_snddma.o \
\
$(B)/ded/tty_console.o \
$(B)/ded/sys_unix.o \
\
$(B)/ded/sys_main.o
ifeq ($(ARCH),i386)
Q3DOBJ += \
@ -1529,7 +1486,7 @@ $(B)/missionpack/vm/ui.qvm: $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm
## CLIENT/SERVER RULES
#############################################################################
$(B)/client/%.o: $(UDIR)/%.s
$(B)/client/%.o: $(ASMDIR)/%.s
$(DO_AS)
$(B)/client/%.o: $(CDIR)/%.c
@ -1550,20 +1507,20 @@ $(B)/client/%.o: $(JPDIR)/%.c
$(B)/client/%.o: $(RDIR)/%.c
$(DO_CC)
$(B)/client/%.o: $(UDIR)/%.c
$(B)/client/%.o: $(SDLDIR)/%.c
$(DO_CC)
$(B)/clientsmp/%.o: $(UDIR)/%.c
$(B)/clientsmp/%.o: $(SDLDIR)/%.c
$(DO_SMP_CC)
$(B)/client/%.o: $(W32DIR)/%.c
$(B)/client/%.o: $(SYSDIR)/%.c
$(DO_CC)
$(B)/client/%.o: $(W32DIR)/%.rc
$(B)/client/%.o: $(SYSDIR)/%.rc
$(DO_WINDRES)
$(B)/ded/%.o: $(UDIR)/%.s
$(B)/ded/%.o: $(ASMDIR)/%.s
$(DO_AS)
$(B)/ded/%.o: $(SDIR)/%.c
@ -1575,7 +1532,7 @@ $(B)/ded/%.o: $(CMDIR)/%.c
$(B)/ded/%.o: $(BLIBDIR)/%.c
$(DO_BOT_CC)
$(B)/ded/%.o: $(UDIR)/%.c
$(B)/ded/%.o: $(SYSDIR)/%.c
$(DO_DED_CC)
$(B)/ded/%.o: $(NDIR)/%.c

40
README
View file

@ -10,7 +10,7 @@
The intent of this project is to provide a baseline Quake 3 which may be used
for further development. Some of the major features currently implemented are:
* SDL backend for unix-like operating systems
* SDL backend
* OpenAL sound API support (multiple speaker support and better sound
quality)
* Full x86_64 support on Linux
@ -46,17 +46,7 @@ For *nix
For Windows, using MinGW
1. Download and install MinGW and MSys from http://www.mingw.org/.
2. Download http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
and untar it into your MinGW directory (usually C:\MinGW).
3. Open an MSys terminal, and follow the instructions for compiling on *nix.
For Windows, using MSVC
1. Run Visual Studio and open the quake3.sln file in the code/win32/msvc
directory.
2. Build.
3. Copy the resultant Quake3.exe to your quake 3 directory, make a backup if
you want to keep your original. If you wish to use native libraries, copy
the resultant dlls to your baseq3 directory.
2. Open an MSys terminal, and follow the instructions for compiling on *nix.
For Mac OS X, building a Universal Binary
1. Install the MacOSX10.2.8.sdk and MacOSX10.4u.sdk which are included in
@ -68,7 +58,7 @@ For Mac OS X, building a Universal Binary
Installation, for *nix
1. Set the COPYDIR variable in the shell to be where you installed Quake 3
to. By default it will be /usr/local/games/quake3 if you haven't set it.
to. By default it will be /usr/local/games/quake3 if you haven't set it.
This is the path as used by the original Linux Q3 installer and subsequent
point releases.
2. Run 'make copyfiles'.
@ -83,11 +73,10 @@ compiling is simply a case of using './cross-make-mingw.sh' in place of 'make',
though you may find you need to change the value of the variables in this
script to match your environment.
If the make based build system is being used (i.e. *nix or MinGW), the
following variables may be set, either on the command line or in
The following variables may be set, either on the command line or in
Makefile.local:
OPTIMIZE - use this for custom CFLAGS
CFLAGS - use this for custom CFLAGS
V - set to show cc command line when building
DEFAULT_BASEDIR - extra path to search for baseq3 and such
BUILD_SERVER - build the 'ioq3ded' server binary
@ -95,7 +84,6 @@ Makefile.local:
BUILD_CLIENT_SMP - build the 'ioquake3-smp' client binary
BUILD_GAME_SO - build the game shared libraries
BUILD_GAME_QVM - build the game qvms
USE_SDL - use the SDL backend where available
USE_OPENAL - use OpenAL where available
USE_OPENAL_DLOPEN - link with OpenAL at runtime
USE_CURL - use libcurl for http/ftp download support
@ -140,15 +128,12 @@ New cvars
s_sdlDevSamps - SDL DMA buffer size override
s_sdlMixSamps - SDL mix buffer size override
ttycon_ansicolor - enable use of ANSI escape codes in the tty
r_GLlibCoolDownMsec - wait for some milliseconds to close GL
library
com_ansiColor - enable use of ANSI escape codes in the tty
com_altivec - enable use of altivec on PowerPC systems
s_backend - read only, indicates the current sound
backend
in_shiftedKeys - non-SDL Linux only; enables binding to
shifted keys
in_joystickNo - SDL only; select which joystick to use
s_muteWhenMinimized - mute sound when minimized
in_joystickNo - select which joystick to use
cl_consoleHistory - read only, stores the console history
cl_platformSensitivity - read only, indicates the mouse input
scaling
@ -292,8 +277,8 @@ Multiuser Support on Windows systems
Note that this cvar MUST be set as a command line parameter.
SDL Keyboard Differences
ioquake3 clients built againt SDL (e.g. Linux and Mac OS X) have different
keyboard behaviour than the original Quake3 clients.
ioquake3 clients have different keyboard behaviour compared to the original
Quake3 clients.
* "Caps Lock" and "Num Lock" can not be used as normal binds since they
do not send a KEYUP event until the key is pressed again.
@ -345,7 +330,7 @@ all.
The focus for ioquake3 to develop a stable base suitable for further
development, and provide players with the same Quake 3 experience they've had
for years. As such ioq3 does not have any significant graphical enhancements
for years. As such ioq3 does not have any significant graphical enhancements
and none are planned at this time. However, improved graphics and sound
patches will be accepted as long as they are entirely optional, do not
require new media and are off by default.
@ -372,8 +357,7 @@ but we have some general guidelines:
providing pak0.pk3 and the patch pk3s are not refered to or included in the
installer.
* Please include at least an SDL so/dylib on every platform but Windows
(which doesn't use it yet).
* Please include at least an SDL so/dylib on every platform.
* Please include an OpenAL so/dylib/dll, since every platform should be using
it by now.

1
TODO
View file

@ -19,7 +19,6 @@ MacOS X
For 1.35+:
* IPv6 support
* Replace windows DirectX backend with SDL
* Graphical "ioquake3" watermark in videos, optional, on by default
* Gamma stuff while recording videos.
* Application for OS X at least to launch mods with appropriate hunkmegs, etc.

View file

@ -1439,7 +1439,7 @@ int StringsMatch(bot_matchpiece_t *pieces, bot_match_t *match)
//if the last piece was a variable string
if (lastvariable >= 0)
{
assert( match->variables[lastvariable].offset >= 0 ); // bk001204
assert( match->variables[lastvariable].offset >= 0 );
match->variables[lastvariable].length =
strlen(&match->string[ (int) match->variables[lastvariable].offset]);
} //end if
@ -1500,7 +1500,7 @@ void BotMatchVariable(bot_match_t *match, int variable, char *buf, int size)
{
if (match->variables[variable].length < size)
size = match->variables[variable].length+1;
assert( match->variables[variable].offset >= 0 ); // bk001204
assert( match->variables[variable].offset >= 0 );
strncpy(buf, &match->string[ (int) match->variables[variable].offset], size-1);
buf[size-1] = '\0';
} //end if
@ -2316,7 +2316,7 @@ int BotExpandChatMessage(char *outmessage, char *message, unsigned long mcontext
} //end if
if (match->variables[num].offset >= 0)
{
assert( match->variables[num].offset >= 0 ); // bk001204
assert( match->variables[num].offset >= 0 );
ptr = &match->string[ (int) match->variables[num].offset];
for (i = 0; i < match->variables[num].length; i++)
{

View file

@ -176,22 +176,22 @@ typedef struct bot_goalstate_s
float avoidgoaltimes[MAX_AVOIDGOALS]; //times to avoid the goals
} bot_goalstate_t;
bot_goalstate_t *botgoalstates[MAX_CLIENTS + 1]; // bk001206 - FIXME: init?
bot_goalstate_t *botgoalstates[MAX_CLIENTS + 1]; // FIXME: init?
//item configuration
itemconfig_t *itemconfig = NULL; // bk001206 - init
itemconfig_t *itemconfig = NULL;
//level items
levelitem_t *levelitemheap = NULL; // bk001206 - init
levelitem_t *freelevelitems = NULL; // bk001206 - init
levelitem_t *levelitems = NULL; // bk001206 - init
levelitem_t *levelitemheap = NULL;
levelitem_t *freelevelitems = NULL;
levelitem_t *levelitems = NULL;
int numlevelitems = 0;
//map locations
maplocation_t *maplocations = NULL; // bk001206 - init
maplocation_t *maplocations = NULL;
//camp spots
campspot_t *campspots = NULL; // bk001206 - init
campspot_t *campspots = NULL;
//the game type
int g_gametype = 0; // bk001206 - init
int g_gametype = 0;
//additional dropped item weight
libvar_t *droppedweight = NULL; // bk001206 - init
libvar_t *droppedweight = NULL;
//========================================================================
//

View file

@ -51,8 +51,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//#define DEBUG_ELEVATOR
//#define DEBUG_GRAPPLE
// bk001204 - redundant bot_avoidspot_t, see be_ai_move.h
//movement state
//NOTE: the moveflags MFL_ONGROUND, MFL_TELEPORTED, MFL_WATERJUMP and
// MFL_GRAPPLEPULL must be set outside the movement code

View file

@ -102,8 +102,6 @@ typedef struct bot_moveresult_s
#define bot_moveresult_t_cleared(x) bot_moveresult_t (x) = {0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, {0, 0, 0}}
// bk001204: from code/botlib/be_ai_move.c
// TTimo 04/12/2001 was moved here to avoid dup defines
typedef struct bot_avoidspot_s
{
vec3_t origin;

View file

@ -51,7 +51,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define WEAPON_OFS(x) (size_t)&(((weaponinfo_t *)0)->x)
#define PROJECTILE_OFS(x) (size_t)&(((projectileinfo_t *)0)->x)
//weapon definition // bk001212 - static
//weapon definition
static fielddef_t weaponinfo_fields[] =
{
{"number", WEAPON_OFS(number), FT_INT}, //weapon number

View file

@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*****************************************************************************
* name: be_interface.c // bk010221 - FIXME - DEAD code elimination
* name: be_interface.c
*
* desc: bot library interface
*
@ -140,7 +140,7 @@ int Export_BotLibSetup(void)
char *homedir, *gamedir;
bot_developer = LibVarGetValue("bot_developer");
memset( &botlibglobals, 0, sizeof(botlibglobals) ); // bk001207 - init
memset( &botlibglobals, 0, sizeof(botlibglobals) );
//initialize byte swapping (litte endian etc.)
// Swap_Init();
homedir = LibVarGetString("homedir");
@ -860,9 +860,9 @@ GetBotLibAPI
============
*/
botlib_export_t *GetBotLibAPI(int apiVersion, botlib_import_t *import) {
assert(import); // bk001129 - this wasn't set for baseq3/
botimport = *import;
assert(botimport.Print); // bk001129 - pars pro toto
assert(import);
botimport = *import;
assert(botimport.Print);
Com_Memset( &be_botlib_export, 0, sizeof( be_botlib_export ) );

View file

@ -100,7 +100,7 @@ void *GetMemory(unsigned long size)
{
void *ptr;
memoryblock_t *block;
assert(botimport.GetMemory); // bk001129 - was NULL'ed
assert(botimport.GetMemory);
ptr = botimport.GetMemory(size + sizeof(memoryblock_t));
block = (memoryblock_t *) ptr;
block->id = MEM_ID;

View file

@ -669,7 +669,7 @@ void PC_AddBuiltinDefines(source_t *source)
{
char *string;
int builtin;
} builtin[] = { // bk001204 - brackets
} builtin[] = {
{ "__LINE__", BUILTIN_LINE },
{ "__FILE__", BUILTIN_FILE },
{ "__DATE__", BUILTIN_DATE },

View file

@ -706,14 +706,14 @@ int PS_ReadNumber(script_t *script, token_t *token)
{
c = *script->script_p;
//check for a LONG number
if ( (c == 'l' || c == 'L') // bk001204 - brackets
if ( (c == 'l' || c == 'L')
&& !(token->subtype & TT_LONG))
{
script->script_p++;
token->subtype |= TT_LONG;
} //end if
//check for an UNSIGNED number
else if ( (c == 'u' || c == 'U') // bk001204 - brackets
else if ( (c == 'u' || c == 'U')
&& !(token->subtype & (TT_UNSIGNED | TT_FLOAT)))
{
script->script_p++;

View file

@ -1596,18 +1596,18 @@ static void CG_DrawDisconnect( void ) {
int cmdNum;
usercmd_t cmd;
const char *s;
int w; // bk010215 - FIXME char message[1024];
int w;
// draw the phone jack if we are completely past our buffers
cmdNum = trap_GetCurrentCmdNumber() - CMD_BACKUP + 1;
trap_GetUserCmd( cmdNum, &cmd );
if ( cmd.serverTime <= cg.snap->ps.commandTime
|| cmd.serverTime > cg.time ) { // special check for map_restart // bk 0102165 - FIXME
|| cmd.serverTime > cg.time ) { // special check for map_restart
return;
}
// also add text in center of screen
s = "Connection Interrupted"; // bk 010215 - FIXME
s = "Connection Interrupted";
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
CG_DrawBigString( 320 - w/2, 100, s, 1.0F);
@ -1786,8 +1786,8 @@ static void CG_DrawCenterString( void ) {
char *start;
int l;
int x, y, w;
#ifdef MISSIONPACK // bk010221 - unused else
int h;
#ifdef MISSIONPACK
int h;
#endif
float *color;

View file

@ -431,10 +431,6 @@ void CG_ColorForHealth( vec4_t hcolor ) {
}
// bk001205 - code below duplicated in q3_ui/ui-atoms.c
// bk001205 - FIXME: does this belong in ui_shared.c?
/*
=================
UI_DrawProportionalString2
@ -594,7 +590,7 @@ UI_DrawBannerString
static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color )
{
const char* s;
unsigned char ch; // bk001204 : array subscript
unsigned char ch;
float ax;
float ay;
float aw;
@ -704,7 +700,7 @@ int UI_ProportionalStringWidth( const char* str ) {
static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset )
{
const char* s;
unsigned char ch; // bk001204 - unsigned
unsigned char ch;
float ax;
float ay;
float aw;

View file

@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h"
// for the voice chats
#ifdef MISSIONPACK // bk001205
#ifdef MISSIONPACK
#include "../../ui/menudef.h"
#endif
//==========================================================================

View file

@ -1635,7 +1635,7 @@ typedef enum {
SYSTEM_PRINT,
CHAT_PRINT,
TEAMCHAT_PRINT
} q3print_t; // bk001201 - warning: useless keyword or type name in empty declaration
} q3print_t;
int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);

View file

@ -204,7 +204,7 @@ typedef struct {
int cvarFlags;
} cvarTable_t;
static cvarTable_t cvarTable[] = { // bk001129
static cvarTable_t cvarTable[] = {
{ &cg_ignore, "cg_ignore", "0", 0 }, // used for debugging
{ &cg_autoswitch, "cg_autoswitch", "1", CVAR_ARCHIVE },
{ &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
@ -1357,7 +1357,7 @@ qboolean CG_Asset_Parse(int handle) {
continue;
}
}
return qfalse; // bk001204 - why not?
return qfalse;
}
void CG_ParseMenu(const char *menuFile) {
@ -1690,7 +1690,7 @@ static void CG_FeederSelection(float feederID, int index) {
}
#endif
#ifdef MISSIONPACK // bk001204 - only needed there
#ifdef MISSIONPACK
static float CG_Cvar_Get(const char *cvar) {
char buff[128];
memset(buff, 0, sizeof(buff));

View file

@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifndef MISSIONPACK // bk001204
#ifndef MISSIONPACK
#error This file not be used for classic Q3A.
#endif
@ -172,7 +172,7 @@ static void CG_DrawPlayerArmorIcon( rectDef_t *rect, qboolean draw2D ) {
cent = &cg_entities[cg.snap->ps.clientNum];
ps = &cg.snap->ps;
if ( draw2D || ( !cg_draw3dIcons.integer && cg_drawIcons.integer) ) { // bk001206 - parentheses
if ( draw2D || ( !cg_draw3dIcons.integer && cg_drawIcons.integer) ) {
CG_DrawPic( rect->x, rect->y + rect->h/2 + 1, rect->w, rect->h, cgs.media.armorIcon );
} else if (cg_draw3dIcons.integer) {
VectorClear( angles );
@ -209,10 +209,9 @@ static void CG_DrawPlayerArmorValue(rectDef_t *rect, float scale, vec4_t color,
}
}
#ifndef MISSIONPACK // bk001206
#ifndef MISSIONPACK
static float healthColors[4][4] = {
// { 0.2, 1.0, 0.2, 1.0 } , { 1.0, 0.2, 0.2, 1.0 }, {0.5, 0.5, 0.5, 1} };
// bk0101016 - float const
{ 1.0f, 0.69f, 0.0f, 1.0f } , // normal
{ 1.0f, 0.2f, 0.2f, 1.0f }, // low health
{ 0.5f, 0.5f, 0.5f, 1.0f}, // weapon firing
@ -228,7 +227,7 @@ static void CG_DrawPlayerAmmoIcon( rectDef_t *rect, qboolean draw2D ) {
cent = &cg_entities[cg.snap->ps.clientNum];
ps = &cg.snap->ps;
if ( draw2D || (!cg_draw3dIcons.integer && cg_drawIcons.integer) ) { // bk001206 - parentheses
if ( draw2D || (!cg_draw3dIcons.integer && cg_drawIcons.integer) ) {
qhandle_t icon;
icon = cg_weapons[ cg.predictedPlayerState.weapon ].ammoIcon;
if ( icon ) {
@ -1214,8 +1213,6 @@ static void CG_Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4
vec4_t newColor;
glyphInfo_t *glyph;
if (text) {
// TTimo: FIXME
// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text;
float max = *maxX;
float useScale;

View file

@ -1752,7 +1752,7 @@ static void CG_PlayerFlag( centity_t *cent, qhandle_t hSkin, refEntity_t *torso
}
#ifdef MISSIONPACK // bk001204
#ifdef MISSIONPACK
/*
===============
CG_PlayerTokens
@ -2025,7 +2025,7 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane ) {
// fade the shadow out with height
alpha = 1.0 - trace.fraction;
// bk0101022 - hack / FPE - bogus planes?
// hack / FPE - bogus planes?
//assert( DotProduct( trace.plane.normal, trace.plane.normal ) != 0.0f )
// add the mark as a temporary, so it goes directly to the renderer

View file

@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// be a valid snapshot this frame
#include "cg_local.h"
#include "../../ui/menudef.h" // bk001205 - for Q3_ui as well
#include "../../ui/menudef.h"
typedef struct {
const char *order;
@ -46,7 +46,7 @@ static const orderTask_t validOrders[] = {
static const int numValidOrders = sizeof(validOrders) / sizeof(orderTask_t);
#ifdef MISSIONPACK // bk001204
#ifdef MISSIONPACK
static int CG_ValidOrder(const char *p) {
int i;
for (i = 0; i < numValidOrders; i++) {

View file

@ -697,7 +697,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
return re.inPVS( VMA(1), VMA(2) );
default:
assert(0); // bk010102
assert(0);
Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] );
}
return 0;
@ -906,8 +906,6 @@ void CL_FirstSnapshot( void ) {
Cbuf_AddText( cl_activeAction->string );
Cvar_Set( "activeAction", "" );
}
Sys_BeginProfiling();
}
/*
@ -1010,9 +1008,35 @@ void CL_SetCGameTime( void ) {
// while a normal demo may have different time samples
// each time it is played back
if ( cl_timedemo->integer ) {
int now = Sys_Milliseconds( );
int frameDuration;
if (!clc.timeDemoStart) {
clc.timeDemoStart = Sys_Milliseconds();
clc.timeDemoStart = clc.timeDemoLastFrame = now;
clc.timeDemoMinDuration = INT_MAX;
clc.timeDemoMaxDuration = 0;
}
frameDuration = now - clc.timeDemoLastFrame;
clc.timeDemoLastFrame = now;
// Ignore the first measurement as it'll always be 0
if( clc.timeDemoFrames > 0 )
{
if( frameDuration > clc.timeDemoMaxDuration )
clc.timeDemoMaxDuration = frameDuration;
if( frameDuration < clc.timeDemoMinDuration )
clc.timeDemoMinDuration = frameDuration;
// 255 ms = about 4fps
if( frameDuration > UCHAR_MAX )
frameDuration = UCHAR_MAX;
clc.timeDemoDurations[ ( clc.timeDemoFrames - 1 ) %
MAX_TIMEDEMO_DURATIONS ] = frameDuration;
}
clc.timeDemoFrames++;
cl.serverTime = clc.timeDemoBaseTime + clc.timeDemoFrames * 50;
}

View file

@ -1072,12 +1072,10 @@ static void RoQReset( void ) {
if (currentHandle < 0) return;
Sys_EndStreamedFile(cinTable[currentHandle].iFile);
FS_FCloseFile( cinTable[currentHandle].iFile );
FS_FOpenFileRead (cinTable[currentHandle].fileName, &cinTable[currentHandle].iFile, qtrue);
// let the background thread start reading ahead
Sys_BeginStreamedFile( cinTable[currentHandle].iFile, 0x10000 );
Sys_StreamedRead (cin.file, 16, 1, cinTable[currentHandle].iFile);
FS_Read (cin.file, 16, cinTable[currentHandle].iFile);
RoQ_init();
cinTable[currentHandle].status = FMV_LOOPED;
}
@ -1098,7 +1096,7 @@ static void RoQInterrupt(void)
if (currentHandle < 0) return;
Sys_StreamedRead( cin.file, cinTable[currentHandle].RoQFrameSize+8, 1, cinTable[currentHandle].iFile );
FS_Read( cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile );
if ( cinTable[currentHandle].RoQPlayed >= cinTable[currentHandle].ROQSize ) {
if (cinTable[currentHandle].holdAtEnd==qfalse) {
if (cinTable[currentHandle].looping) {
@ -1214,7 +1212,7 @@ redump:
// one more frame hits the dust
//
// assert(cinTable[currentHandle].RoQFrameSize <= 65536);
// r = Sys_StreamedRead( cin.file, cinTable[currentHandle].RoQFrameSize+8, 1, cinTable[currentHandle].iFile );
// r = FS_Read( cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile );
cinTable[currentHandle].RoQPlayed += cinTable[currentHandle].RoQFrameSize+8;
}
@ -1272,7 +1270,6 @@ static void RoQShutdown( void ) {
cinTable[currentHandle].status = FMV_IDLE;
if (cinTable[currentHandle].iFile) {
Sys_EndStreamedFile( cinTable[currentHandle].iFile );
FS_FCloseFile( cinTable[currentHandle].iFile );
cinTable[currentHandle].iFile = 0;
}
@ -1332,7 +1329,6 @@ Fetch and decompress the pending frame
e_status CIN_RunCinematic (int handle)
{
// bk001204 - init
int start = 0;
int thisTime = 0;
@ -1472,8 +1468,6 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
{
RoQ_init();
// FS_Read (cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile);
// let the background thread start reading ahead
Sys_BeginStreamedFile( cinTable[currentHandle].iFile, 0x10000 );
cinTable[currentHandle].status = FMV_PLAY;
Com_DPrintf("trFMV::play(), playing %s\n", arg);

View file

@ -71,9 +71,8 @@ Con_ToggleConsole_f
================
*/
void Con_ToggleConsole_f (void) {
// closing a full screen console restarts the demo loop
// Can't toggle the console when it's the only thing available
if ( cls.state == CA_DISCONNECTED && cls.keyCatchers == KEYCATCH_CONSOLE ) {
CL_StartDemoLoop();
return;
}
@ -619,13 +618,13 @@ void Con_DrawSolidConsole( float frac ) {
re.SetColor( g_color_table[ColorIndex(COLOR_RED)] );
i = strlen( SVN_VERSION );
i = strlen( Q3_VERSION );
for (x=0 ; x<i ; x++) {
SCR_DrawSmallChar( cls.glconfig.vidWidth - ( i - x ) * SMALLCHAR_WIDTH,
(lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), SVN_VERSION[x] );
(lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), Q3_VERSION[x] );
}

View file

@ -25,37 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cvar_t *cl_cURLLib;
#if USE_CURL_DLOPEN
#if USE_SDL_VIDEO
#include "SDL.h"
#include "SDL_loadso.h"
#define OBJTYPE void *
#define OBJLOAD(x) SDL_LoadObject(x)
#define SYMLOAD(x,y) SDL_LoadFunction(x,y)
#define OBJFREE(x) SDL_UnloadObject(x)
#elif defined _WIN32
#include <windows.h>
#define OBJTYPE HMODULE
#define OBJLOAD(x) LoadLibrary(x)
#define SYMLOAD(x,y) GetProcAddress(x,y)
#define OBJFREE(x) FreeLibrary(x)
#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X || defined __sun
#include <dlfcn.h>
#define OBJTYPE void *
#define OBJLOAD(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
#define SYMLOAD(x,y) dlsym(x,y)
#define OBJFREE(x) dlclose(x)
#else
#error "Your platform has no lib loading code or it is disabled"
#endif
#if defined __linux__ || defined __FreeBSD__ || defined MACOS_X
#include <unistd.h>
#include <sys/types.h>
#endif
#include "../sys/sys_loadlib.h"
char* (*qcurl_version)(void);
@ -85,7 +55,7 @@ CURLMsg *(*qcurl_multi_info_read)(CURLM *multi_handle,
int *msgs_in_queue);
const char *(*qcurl_multi_strerror)(CURLMcode);
static OBJTYPE cURLLib = NULL;
static void *cURLLib = NULL;
/*
=================
@ -96,7 +66,7 @@ static void *GPA(char *str)
{
void *rv;
rv = SYMLOAD(cURLLib, str);
rv = Sys_LoadFunction(cURLLib, str);
if(!rv)
{
Com_Printf("Can't load symbol %s\n", str);
@ -124,17 +94,17 @@ qboolean CL_cURL_Init()
Com_Printf("Loading \"%s\"...", cl_cURLLib->string);
if( (cURLLib = OBJLOAD(cl_cURLLib->string)) == 0 )
if( (cURLLib = Sys_LoadLibrary(cl_cURLLib->string)) == 0 )
{
#ifdef _WIN32
return qfalse;
#else
char fn[1024];
getcwd(fn, sizeof(fn));
Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
strncat(fn, "/", sizeof(fn)-strlen(fn)-1);
strncat(fn, cl_cURLLib->string, sizeof(fn)-strlen(fn)-1);
if( (cURLLib = OBJLOAD(fn)) == 0 )
if( (cURLLib = Sys_LoadLibrary(fn)) == 0 )
{
return qfalse;
}
@ -189,7 +159,7 @@ void CL_cURL_Shutdown( void )
#if USE_CURL_DLOPEN
if(cURLLib)
{
OBJFREE(cURLLib);
Sys_UnloadLibrary(cURLLib);
cURLLib = NULL;
}
qcurl_easy_init = NULL;

View file

@ -1147,7 +1147,6 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
}
}
#ifndef _WIN32
if (key == K_ENTER)
{
if (down)
@ -1157,14 +1156,10 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
Key_ClearStates();
Cvar_SetValue( "r_fullscreen",
!Cvar_VariableIntegerValue( "r_fullscreen" ) );
#if !USE_SDL_VIDEO // This is handled in sdl_glimp.c/GLimp_EndFrame
Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n");
#endif
return;
}
}
}
#endif
// console key is hardcoded, so the user can never unbind it
if (key == '`' || key == '~' ||
@ -1207,7 +1202,7 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
if ( cls.state == CA_ACTIVE && !clc.demoplaying ) {
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
}
else {
else if ( cls.state != CA_DISCONNECTED ) {
CL_Disconnect_f();
S_StopAllSounds();
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
@ -1222,19 +1217,21 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
//
// key up events only perform actions if the game key binding is
// a button command (leading + sign). These will be processed even in
// console mode and menu mode, to keep the character from continuing
// console mode and menu mode, to keep the character from continuing
// an action started before a mode switch.
//
if (!down) {
kb = keys[key].binding;
if (!down ) {
if ( cls.state != CA_DISCONNECTED ) {
kb = keys[key].binding;
CL_AddKeyUpCommands( key, kb, time );
CL_AddKeyUpCommands( key, kb, time );
if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
VM_Call( uivm, UI_KEY_EVENT, key, down );
} else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) {
VM_Call( cgvm, CG_KEY_EVENT, key, down );
}
if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
VM_Call( uivm, UI_KEY_EVENT, key, down );
} else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) {
VM_Call( cgvm, CG_KEY_EVENT, key, down );
}
}
return;
}
@ -1263,7 +1260,7 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
Com_Printf ("%s is unbound, use controls menu to set.\n"
, Key_KeynumToString( key ) );
}
} else if (kb[0] == '+') {
} else if (kb[0] == '+') {
int i;
char button[1024], *buttonPtr;
buttonPtr = button;

View file

@ -43,6 +43,7 @@ cvar_t *cl_freezeDemo;
cvar_t *cl_shownet;
cvar_t *cl_showSend;
cvar_t *cl_timedemo;
cvar_t *cl_timedemoLog;
cvar_t *cl_autoRecordDemo;
cvar_t *cl_aviFrameRate;
cvar_t *cl_aviMotionJpeg;
@ -391,19 +392,96 @@ CLIENT SIDE DEMO PLAYBACK
=======================================================================
*/
/*
=================
CL_DemoFrameDurationSDev
=================
*/
static float CL_DemoFrameDurationSDev( void )
{
int i;
int numFrames;
float mean = 0.0f;
float variance = 0.0f;
if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS )
numFrames = MAX_TIMEDEMO_DURATIONS;
else
numFrames = clc.timeDemoFrames - 1;
for( i = 0; i < numFrames; i++ )
mean += clc.timeDemoDurations[ i ];
mean /= numFrames;
for( i = 0; i < numFrames; i++ )
{
float x = clc.timeDemoDurations[ i ];
variance += ( ( x - mean ) * ( x - mean ) );
}
variance /= numFrames;
return sqrt( variance );
}
/*
=================
CL_DemoCompleted
=================
*/
void CL_DemoCompleted( void ) {
if (cl_timedemo && cl_timedemo->integer) {
void CL_DemoCompleted( void )
{
char buffer[ MAX_STRING_CHARS ];
if( cl_timedemo && cl_timedemo->integer )
{
int time;
time = Sys_Milliseconds() - clc.timeDemoStart;
if ( time > 0 ) {
Com_Printf ("%i frames, %3.1f seconds: %3.1f fps\n", clc.timeDemoFrames,
time/1000.0, clc.timeDemoFrames*1000.0 / time);
if( time > 0 )
{
// Millisecond times are frame durations:
// minimum/average/maximum/std deviation
Com_sprintf( buffer, sizeof( buffer ),
"%i frames %3.1f seconds %3.1f fps %d.0/%.1f/%d.0/%.1f ms\n",
clc.timeDemoFrames,
time/1000.0,
clc.timeDemoFrames*1000.0 / time,
clc.timeDemoMinDuration,
time / (float)clc.timeDemoFrames,
clc.timeDemoMaxDuration,
CL_DemoFrameDurationSDev( ) );
Com_Printf( buffer );
// Write a log of all the frame durations
if( cl_timedemoLog && strlen( cl_timedemoLog->string ) > 0 )
{
int i;
int numFrames;
fileHandle_t f;
if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS )
numFrames = MAX_TIMEDEMO_DURATIONS;
else
numFrames = clc.timeDemoFrames - 1;
f = FS_FOpenFileWrite( cl_timedemoLog->string );
if( f )
{
FS_Printf( f, "# %s", buffer );
for( i = 0; i < numFrames; i++ )
FS_Printf( f, "%d\n", clc.timeDemoDurations[ i ] );
FS_FCloseFile( f );
Com_Printf( "%s written\n", cl_timedemoLog->string );
}
else
{
Com_Printf( "Couldn't open %s for writing\n",
cl_timedemoLog->string );
}
}
}
}
@ -658,7 +736,7 @@ void CL_FlushMemory( void ) {
Hunk_ClearToMark();
}
CL_StartHunkUsers();
CL_StartHunkUsers( qfalse );
}
/*
@ -671,6 +749,12 @@ memory on the hunk from cgame, ui, and renderer
=====================
*/
void CL_MapLoading( void ) {
if ( com_dedicated->integer ) {
cls.state = CA_DISCONNECTED;
cls.keyCatchers = KEYCATCH_CONSOLE;
return;
}
if ( !com_cl_running->integer ) {
return;
}
@ -830,7 +914,7 @@ void CL_ForwardCommandToServer( const char *string ) {
}
if ( clc.demoplaying || cls.state < CA_CONNECTED || cmd[0] == '+' ) {
Com_Printf ("Unknown command \"%s\"\n", cmd);
Com_Printf ("Unknown command \"%s" S_COLOR_WHITE "\"\n", cmd);
return;
}
@ -939,26 +1023,22 @@ void CL_RequestAuthorization( void ) {
return;
}
if ( Cvar_VariableValue( "fs_restrict" ) ) {
Q_strncpyz( nums, "demota", sizeof( nums ) );
} else {
// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
j = 0;
l = strlen( cl_cdkey );
if ( l > 32 ) {
l = 32;
}
for ( i = 0 ; i < l ; i++ ) {
if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
j = 0;
l = strlen( cl_cdkey );
if ( l > 32 ) {
l = 32;
}
for ( i = 0 ; i < l ; i++ ) {
if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
|| ( cl_cdkey[i] >= 'a' && cl_cdkey[i] <= 'z' )
|| ( cl_cdkey[i] >= 'A' && cl_cdkey[i] <= 'Z' )
) {
nums[j] = cl_cdkey[i];
j++;
}
) {
nums[j] = cl_cdkey[i];
j++;
}
nums[j] = 0;
}
nums[j] = 0;
fs = Cvar_Get ("cl_anonymous", "0", CVAR_INIT|CVAR_SYSTEMINFO );
@ -1276,7 +1356,7 @@ void CL_Vid_Restart_f( void ) {
CL_InitRef();
// startup all the client stuff
CL_StartHunkUsers();
CL_StartHunkUsers( qfalse );
// start the cgame if connected
if ( cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
@ -2316,7 +2396,7 @@ After the server has cleared the hunk, these will need to be restarted
This is the only place that any of these functions are called from
============================
*/
void CL_StartHunkUsers( void ) {
void CL_StartHunkUsers( qboolean rendererOnly ) {
if (!com_cl_running) {
return;
}
@ -2330,6 +2410,10 @@ void CL_StartHunkUsers( void ) {
CL_InitRenderer();
}
if ( rendererOnly ) {
return;
}
if ( !cls.soundStarted ) {
cls.soundStarted = qtrue;
S_Init();
@ -2590,6 +2674,7 @@ void CL_Init( void ) {
cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP );
cl_timedemo = Cvar_Get ("timedemo", "0", 0);
cl_timedemoLog = Cvar_Get ("cl_timedemoLog", "", CVAR_ARCHIVE);
cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
@ -3203,11 +3288,6 @@ void CL_GlobalServers_f( void ) {
for (i=3; i<count; i++)
buffptr += sprintf( buffptr, " %s", Cmd_Argv(i) );
// if we are a demo, automatically add a "demo" keyword
if ( Cvar_VariableValue( "fs_restrict" ) ) {
buffptr += sprintf( buffptr, " demo" );
}
NET_OutOfBandPrint( NS_SERVER, to, command );
}

View file

@ -448,14 +448,9 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
}
}
if ( !uivm ) {
Com_DPrintf("draw screen without UI loaded\n");
return;
}
// if the menu is going to cover the entire screen, we
// don't need to render anything under it
if ( !VM_Call( uivm, UI_IS_FULLSCREEN )) {
if ( uivm && !VM_Call( uivm, UI_IS_FULLSCREEN )) {
switch( cls.state ) {
default:
Com_Error( ERR_FATAL, "SCR_DrawScreenField: bad cls.state" );

View file

@ -677,6 +677,8 @@ Ket_SetCatcher
====================
*/
void Key_SetCatcher( int catcher ) {
// prevent console from being closed
catcher |= cls.keyCatchers & KEYCATCH_CONSOLE;
cls.keyCatchers = catcher;
}

View file

@ -153,6 +153,7 @@ demo through a file.
=============================================================================
*/
#define MAX_TIMEDEMO_DURATIONS 4096
typedef struct {
@ -219,6 +220,10 @@ typedef struct {
int timeDemoFrames; // counter of rendered frames
int timeDemoStart; // cls.realtime before first frame
int timeDemoBaseTime; // each frame will be at this time + frameNum * 50
int timeDemoLastFrame;// time the last frame was rendered
int timeDemoMinDuration; // minimum frame duration
int timeDemoMaxDuration; // maximum frame duration
unsigned char timeDemoDurations[ MAX_TIMEDEMO_DURATIONS ]; // log of frame durations
// big stuff at end of structure so most offsets are 15 bits or less
netchan_t netchan;
@ -384,7 +389,7 @@ void CL_FlushMemory(void);
void CL_ShutdownAll(void);
void CL_AddReliableCommand( const char *cmd );
void CL_StartHunkUsers( void );
void CL_StartHunkUsers( qboolean rendererOnly );
void CL_Disconnect_f (void);
void CL_GetChallengePacket (void);

View file

@ -29,36 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if USE_OPENAL_DLOPEN
#if USE_SDL_VIDEO
#include "SDL.h"
#include "SDL_loadso.h"
#define OBJTYPE void *
#define OBJLOAD(x) SDL_LoadObject(x)
#define SYMLOAD(x,y) SDL_LoadFunction(x,y)
#define OBJFREE(x) SDL_UnloadObject(x)
#elif defined _WIN32
#include <windows.h>
#define OBJTYPE HMODULE
#define OBJLOAD(x) LoadLibrary(x)
#define SYMLOAD(x,y) GetProcAddress(x,y)
#define OBJFREE(x) FreeLibrary(x)
#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X || defined __sun
#include <dlfcn.h>
#define OBJTYPE void *
#define OBJLOAD(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
#define SYMLOAD(x,y) dlsym(x,y)
#define OBJFREE(x) dlclose(x)
#else
#error "Your platform has no lib loading code or it is disabled"
#endif
#if defined __linux__ || defined __FreeBSD__ || defined MACOS_X
#include <unistd.h>
#include <sys/types.h>
#endif
#include "../sys/sys_loadlib.h"
LPALENABLE qalEnable;
LPALDISABLE qalDisable;
@ -131,7 +102,7 @@ LPALCGETENUMVALUE qalcGetEnumValue;
LPALCGETSTRING qalcGetString;
LPALCGETINTEGERV qalcGetIntegerv;
static OBJTYPE OpenALLib = NULL;
static void *OpenALLib = NULL;
static qboolean alinit_fail = qfalse;
@ -144,7 +115,7 @@ static void *GPA(char *str)
{
void *rv;
rv = SYMLOAD(OpenALLib, str);
rv = Sys_LoadFunction(OpenALLib, str);
if(!rv)
{
Com_Printf( " Can't load symbol %s\n", str);
@ -169,17 +140,17 @@ qboolean QAL_Init(const char *libname)
return qtrue;
Com_Printf( "Loading \"%s\"...\n", libname);
if( (OpenALLib = OBJLOAD(libname)) == 0 )
if( (OpenALLib = Sys_LoadLibrary(libname)) == 0 )
{
#ifdef _WIN32
return qfalse;
#else
char fn[1024];
getcwd(fn, sizeof(fn));
Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
strncat(fn, "/", sizeof(fn) - strlen(fn) - 1);
strncat(fn, libname, sizeof(fn) - strlen(fn) - 1);
if( (OpenALLib = OBJLOAD(fn)) == 0 )
if( (OpenALLib = Sys_LoadLibrary(fn)) == 0 )
{
return qfalse;
}
@ -278,7 +249,7 @@ void QAL_Shutdown( void )
{
if(OpenALLib)
{
OBJFREE(OpenALLib);
Sys_UnloadLibrary(OpenALLib);
OpenALLib = NULL;
}

View file

@ -616,11 +616,7 @@ void S_Base_ClearSoundBuffer( void ) {
SNDDMA_BeginPainting ();
if (dma.buffer)
// TTimo: due to a particular bug workaround in linux sound code,
// have to optionally use a custom C implementation of Com_Memset
// not affecting win32, we have #define Snd_Memset Com_Memset
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
Com_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
SNDDMA_Submit ();
}

View file

@ -30,6 +30,7 @@ cvar_t *s_volume;
cvar_t *s_musicVolume;
cvar_t *s_doppler;
cvar_t *s_backend;
cvar_t *s_muteWhenMinimized;
static soundInterface_t si;
@ -219,6 +220,11 @@ S_Update
*/
void S_Update( void )
{
if( s_muteWhenMinimized->integer && com_minimized->integer ) {
S_StopAllSounds( );
return;
}
if( si.Update ) {
si.Update( );
}
@ -372,6 +378,7 @@ void S_Init( void )
s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE );
s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE );
s_backend = Cvar_Get( "s_backend", "", CVAR_ROM );
s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE );
cv = Cvar_Get( "s_initsound", "1", 0 );
if( !cv->integer ) {

View file

@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
static portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
static int snd_vol;
// bk001119 - these not static, required by unix/snd_mixa.s
int* snd_p;
int snd_linear_count;
short* snd_out;

View file

@ -53,7 +53,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "match.h" //string matching types and vars
// for the voice chats
#ifdef MISSIONPACK // bk001205
#ifdef MISSIONPACK
#include "../../ui/menudef.h"
#endif

View file

@ -3751,7 +3751,6 @@ void BotMapScripts(bot_state_t *bs) {
BotSetMovedir
==================
*/
// bk001205 - made these static
static vec3_t VEC_UP = {0, -1, 0};
static vec3_t MOVEDIR_UP = {0, 0, 1};
static vec3_t VEC_DOWN = {0, -2, 0};

View file

@ -1626,9 +1626,6 @@ int BotInitLibrary(void) {
//game directory
trap_Cvar_VariableStringBuffer("fs_game", buf, sizeof(buf));
if (strlen(buf)) trap_BotLibVarSet("gamedir", buf);
//cd directory
trap_Cvar_VariableStringBuffer("fs_cdpath", buf, sizeof(buf));
if (strlen(buf)) trap_BotLibVarSet("cddir", buf);
//home directory
trap_Cvar_VariableStringBuffer("fs_homepath", buf, sizeof(buf));
if (strlen(buf)) trap_BotLibVarSet("homedir", buf);

View file

@ -43,7 +43,6 @@ static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] =
#endif /* LIBC_SCCS and not lint */
// bk001127 - needed for DLL's
#if !defined( Q3_VM )
typedef int cmp_t(const void *, const void *);
#endif
@ -189,8 +188,6 @@ loop: SWAPINIT(a, es);
// this file is excluded from release builds because of intrinsics
// bk001211 - gcc errors on compiling strcpy: parse error before `__extension__'
#if defined ( Q3_VM )
size_t strlen( const char *string ) {
@ -265,7 +262,7 @@ char *strstr( const char *string, const char *strCharSet ) {
}
return (char *)0;
}
#endif // bk001211
#endif
#if defined ( Q3_VM )
int tolower( int c ) {
@ -754,8 +751,6 @@ double atan2( double y, double x ) {
#endif
#ifdef Q3_VM
// bk001127 - guarded this tan replacement
// ld: undefined versioned symbol name tan@@GLIBC_2.0
double tan( double x ) {
return sin(x) / cos(x);
}
@ -844,7 +839,7 @@ double _atof( const char **stringPtr ) {
const char *string;
float sign;
float value;
int c = '0'; // bk001211 - uninitialized use possible
int c = '0';
string = *stringPtr;

View file

@ -1177,7 +1177,7 @@ qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const play
Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: IT_BAD" );
default:
#ifndef Q3_VM
#ifndef NDEBUG // bk0001204
#ifndef NDEBUG
Com_Printf("BG_CanItemBeGrabbed: unknown enum %d\n", item->giType );
#endif
#endif

View file

@ -43,7 +43,7 @@ void UpdateTournamentInfo( void ) {
int playerClientNum;
int n, accuracy, perfect, msglen;
int buflen;
#ifdef MISSIONPACK // bk001205
#ifdef MISSIONPACK
int score1, score2;
qboolean won;
#endif

View file

@ -43,7 +43,6 @@ typedef struct {
int spawnTime;
} botSpawnQueue_t;
//static int botBeginDelay = 0; // bk001206 - unused, init
static botSpawnQueue_t botSpawnQueue[BOT_SPAWN_QUEUE_DEPTH];
vmCvar_t bot_minplayers;

View file

@ -1129,7 +1129,7 @@ void ClientSpawn(gentity_t *ent) {
}
eventSequence = client->ps.eventSequence;
memset (client, 0, sizeof(*client)); // bk FIXME: Com_Memset?
Com_Memset (client, 0, sizeof(*client));
client->pers = saved;
client->sess = savedSess;

View file

@ -95,7 +95,6 @@ vmCvar_t g_enableBreath;
vmCvar_t g_proxMineTimeout;
#endif
// bk001129 - made static to avoid aliasing
static cvarTable_t gameCvarTable[] = {
// don't override the cheat state set by the system
{ &g_cheats, "sv_cheats", "", 0, 0, qfalse },
@ -182,7 +181,6 @@ static cvarTable_t gameCvarTable[] = {
};
// bk001129 - made static to avoid aliasing
static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[0] );
@ -1118,7 +1116,7 @@ Append information about this game to the log file
void LogExit( const char *string ) {
int i, numSorted;
gclient_t *cl;
#ifdef MISSIONPACK // bk001205
#ifdef MISSIONPACK
qboolean won = qtrue;
#endif
G_LogPrintf( "Exit: %s\n", string );

View file

@ -41,7 +41,7 @@ void *G_Alloc( int size ) {
}
if ( allocPoint + size > POOLSIZE ) {
G_Error( "G_Alloc: failed on allocation of %i bytes\n", size ); // bk010103 - was %u, but is signed
G_Error( "G_Alloc: failed on allocation of %i bytes\n", size );
return NULL;
}

View file

@ -69,8 +69,6 @@ Called on a reconnect
void G_ReadSessionData( gclient_t *client ) {
char s[MAX_STRING_CHARS];
const char *var;
// bk001205 - format
int teamLeader;
int spectatorState;
int sessionTeam;
@ -79,16 +77,15 @@ void G_ReadSessionData( gclient_t *client ) {
trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );
sscanf( s, "%i %i %i %i %i %i %i",
&sessionTeam, // bk010221 - format
&sessionTeam,
&client->sess.spectatorTime,
&spectatorState, // bk010221 - format
&spectatorState,
&client->sess.spectatorClient,
&client->sess.wins,
&client->sess.losses,
&teamLeader // bk010221 - format
&teamLeader
);
// bk001205 - format issues
client->sess.sessionTeam = (team_t)sessionTeam;
client->sess.spectatorState = (spectatorState_t)spectatorState;
client->sess.teamLeader = (qboolean)teamLeader;

View file

@ -179,95 +179,6 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
* blocks. The quantized coefficients are returned in coef_blocks[].
*/
#if 0 // bk001204
METHODDEF void
forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
JDIMENSION start_row, JDIMENSION start_col,
JDIMENSION num_blocks)
/* This version is used for integer DCT implementations. */
{
/* This routine is heavily used, so it's worth coding it tightly. */
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
forward_DCT_method_ptr do_dct = fdct->do_dct;
DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no];
DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */
JDIMENSION bi;
sample_data += start_row; /* fold in the vertical offset once */
for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
/* Load data into workspace, applying unsigned->signed conversion */
{ register DCTELEM *workspaceptr;
register JSAMPROW elemptr;
register int elemr;
workspaceptr = workspace;
for (elemr = 0; elemr < DCTSIZE; elemr++) {
elemptr = sample_data[elemr] + start_col;
#if DCTSIZE == 8 /* unroll the inner loop */
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
#else
{ register int elemc;
for (elemc = DCTSIZE; elemc > 0; elemc--) {
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
}
}
#endif
}
}
/* Perform the DCT */
(*do_dct) (workspace);
/* Quantize/descale the coefficients, and store into coef_blocks[] */
{ register DCTELEM temp, qval;
register int i;
register JCOEFPTR output_ptr = coef_blocks[bi];
for (i = 0; i < DCTSIZE2; i++) {
qval = divisors[i];
temp = workspace[i];
/* Divide the coefficient value by qval, ensuring proper rounding.
* Since C does not specify the direction of rounding for negative
* quotients, we have to force the dividend positive for portability.
*
* In most files, at least half of the output values will be zero
* (at default quantization settings, more like three-quarters...)
* so we should ensure that this case is fast. On many machines,
* a comparison is enough cheaper than a divide to make a special test
* a win. Since both inputs will be nonnegative, we need only test
* for a < b to discover whether a/b is 0.
* If your machine's division is fast enough, define FAST_DIVIDE.
*/
#ifdef FAST_DIVIDE
#define DIVIDE_BY(a,b) a /= b
#else
#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0
#endif
if (temp < 0) {
temp = -temp;
temp += qval>>1; /* for rounding */
DIVIDE_BY(temp, qval);
temp = -temp;
} else {
temp += qval>>1; /* for rounding */
DIVIDE_BY(temp, qval);
}
output_ptr[i] = (JCOEF) temp;
}
}
}
}
#endif // 0
#ifdef DCT_FLOAT_SUPPORTED
METHODDEF void

View file

@ -68,7 +68,6 @@ METHODDEF void process_data_buffer_main
METHODDEF void
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
// bk001204 - don't use main...
my_main_ptr jmain = (my_main_ptr) cinfo->main;
/* Do nothing in raw-data mode. */
@ -115,7 +114,6 @@ process_data_simple_main (j_compress_ptr cinfo,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
JDIMENSION in_rows_avail)
{
// bk001204 - don't use main
my_main_ptr jmain = (my_main_ptr) cinfo->main;
while (jmain->cur_iMCU_row < cinfo->total_iMCU_rows) {
@ -246,7 +244,6 @@ process_data_buffer_main (j_compress_ptr cinfo,
GLOBAL void
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
{
// bk001204 - don't use main
my_main_ptr jmain;
int ci;
jpeg_component_info *compptr;

View file

@ -159,7 +159,6 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
* This is done only once, not once per pass.
*/
{
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main;
int ci, rgroup;
int M = cinfo->min_DCT_scaled_size;
@ -201,7 +200,6 @@ make_funny_pointers (j_decompress_ptr cinfo)
* This will be repeated at the beginning of each pass.
*/
{
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main;
int ci, i, rgroup;
int M = cinfo->min_DCT_scaled_size;
@ -242,7 +240,6 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
* This changes the pointer list state from top-of-image to the normal state.
*/
{
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main;
int ci, i, rgroup;
int M = cinfo->min_DCT_scaled_size;
@ -272,7 +269,6 @@ set_bottom_pointers (j_decompress_ptr cinfo)
* Also sets rowgroups_avail to indicate number of nondummy row groups in row.
*/
{
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main;
int ci, i, rgroup, iMCUheight, rows_left;
jpeg_component_info *compptr;
@ -310,7 +306,6 @@ set_bottom_pointers (j_decompress_ptr cinfo)
METHODDEF void
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
{
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main;
switch (pass_mode) {
@ -351,7 +346,6 @@ process_data_simple_main (j_decompress_ptr cinfo,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main;
JDIMENSION rowgroups_avail;
@ -392,7 +386,6 @@ process_data_context_main (j_decompress_ptr cinfo,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main;
/* Read input data if we haven't filled the main buffer yet */
@ -482,7 +475,6 @@ process_data_crank_post (j_decompress_ptr cinfo,
GLOBAL void
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
{
// bk001204 - no use main
my_main_ptr jmain;
int ci, rgroup, ngroups;
jpeg_component_info *compptr;

BIN
code/libs/win32/libSDL.dll.a Executable file

Binary file not shown.

35
code/libs/win32/libSDL.la Executable file
View file

@ -0,0 +1,35 @@
# libSDL.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='../bin/SDL.dll'
# Names of this library.
library_names='libSDL.dll.a'
# The name of the static archive.
old_library='libSDL.a'
# Libraries that this one depends upon.
dependency_libs=' -luser32 -lgdi32 -lwinmm -ldxguid'
# Version information for libSDL.
current=11
age=11
revision=1
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/Users/hercules/tmp/SDL-1.2.12/lib'

Binary file not shown.

View file

@ -53,7 +53,7 @@ void CL_MapLoading( void ) {
}
qboolean CL_GameCommand( void ) {
return qfalse; // bk001204 - non-void
return qfalse;
}
void CL_KeyEvent (int key, qboolean down, unsigned time) {
@ -81,11 +81,9 @@ void CL_CDDialog( void ) {
void CL_FlushMemory( void ) {
}
void CL_StartHunkUsers( void ) {
void CL_StartHunkUsers( qboolean rendererOnly ) {
}
// bk001119 - added new dummy for sv_init.c
void CL_ShutdownAll(void) {}
// bk001208 - added new dummy (RC4)
qboolean CL_CDKeyValidate( const char *key, const char *checksum ) { return qtrue; }

View file

@ -47,7 +47,6 @@ void SNDDMA_Submit(void)
{
}
// bk001119 - added boolean flag, match client/snd_public.h
sfxHandle_t S_RegisterSound( const char *name, qboolean compressed )
{
return 0;

View file

@ -330,8 +330,6 @@ static int propMapB[26][3] = {
#define PROPB_SPACE_WIDTH 12
#define PROPB_HEIGHT 36
// bk001205 - code below duplicated in cgame/cg_drawtools.c
// bk001205 - FIXME: does this belong in ui_shared.c?
/*
=================
UI_DrawBannerString
@ -340,7 +338,7 @@ UI_DrawBannerString
static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color )
{
const char* s;
unsigned char ch; // bk001204 - unsigned
unsigned char ch;
float ax;
float ay;
float aw;
@ -450,10 +448,10 @@ int UI_ProportionalStringWidth( const char* str ) {
static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset )
{
const char* s;
unsigned char ch; // bk001204 - unsigned
unsigned char ch;
float ax;
float ay;
float aw = 0; // bk001204 - init
float aw = 0;
float ah;
float frow;
float fcol;
@ -831,7 +829,6 @@ void UI_SetActiveMenu( uiMenuCommand_t menu ) {
UI_InGameMenu();
return;
// bk001204
case UIMENU_TEAM:
case UIMENU_POSTGAME:
default:

View file

@ -82,15 +82,6 @@ static void UI_DisplayDownloadInfo( const char *downloadName ) {
downloadCount = trap_Cvar_VariableValue( "cl_downloadCount" );
downloadTime = trap_Cvar_VariableValue( "cl_downloadTime" );
#if 0 // bk010104
fprintf( stderr, "\n\n-----------------------------------------------\n");
fprintf( stderr, "DB: downloadSize: %16d\n", downloadSize );
fprintf( stderr, "DB: downloadCount: %16d\n", downloadCount );
fprintf( stderr, "DB: downloadTime: %16d\n", downloadTime );
fprintf( stderr, "DB: UI realtime: %16d\n", uis.realtime ); // bk
fprintf( stderr, "DB: UI frametime: %16d\n", uis.frametime ); // bk
#endif
leftWidth = width = UI_ProportionalStringWidth( dlText ) * UI_ProportionalSizeScale( style );
width = UI_ProportionalStringWidth( etaText ) * UI_ProportionalSizeScale( style );
if (width > leftWidth) leftWidth = width;
@ -118,10 +109,6 @@ static void UI_DisplayDownloadInfo( const char *downloadName ) {
UI_DrawProportionalString( leftWidth, 192,
va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), style, color_white );
} else {
// bk010108
//float elapsedTime = (float)(uis.realtime - downloadTime); // current - start (msecs)
//elapsedTime = elapsedTime * 0.001f; // in seconds
//if ( elapsedTime <= 0.0f ) elapsedTime == 0.0f;
if ( (uis.realtime - downloadTime) / 1000) {
xferRate = downloadCount / ((uis.realtime - downloadTime) / 1000);
//xferRate = (int)( ((float)downloadCount) / elapsedTime);
@ -129,9 +116,6 @@ static void UI_DisplayDownloadInfo( const char *downloadName ) {
xferRate = 0;
}
//fprintf( stderr, "DB: elapsedTime: %16.8f\n", elapsedTime ); // bk
//fprintf( stderr, "DB: xferRate: %16d\n", xferRate ); // bk
UI_ReadableSize( xferRateBuf, sizeof xferRateBuf, xferRate );
// Extrapolate estimated completion time
@ -141,7 +125,7 @@ static void UI_DisplayDownloadInfo( const char *downloadName ) {
// We do it in K (/1024) because we'd overflow around 4MB
n = (n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000;
UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf, n ); // bk010104
UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf, n );
//(n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000);
UI_DrawProportionalString( leftWidth, 160,

View file

@ -223,7 +223,7 @@ typedef struct
static controls_t s_controls;
static vec4_t controls_binding_color = {1.00f, 0.43f, 0.00f, 1.00f}; // bk: Win32 C4305
static vec4_t controls_binding_color = {1.00f, 0.43f, 0.00f, 1.00f};
static bind_t g_bindings[] =
{
@ -561,7 +561,6 @@ static void Controls_Update( void ) {
// disable all controls in all groups
for( i = 0; i < C_MAX; i++ ) {
controls = g_controls[i];
// bk001204 - parentheses
for( j = 0; (control = controls[j]) ; j++ ) {
control->flags |= (QMF_HIDDEN|QMF_INACTIVE);
}
@ -570,14 +569,12 @@ static void Controls_Update( void ) {
controls = g_controls[s_controls.section];
// enable controls in active group (and count number of items for vertical centering)
// bk001204 - parentheses
for( j = 0; (control = controls[j]) ; j++ ) {
control->flags &= ~(QMF_GRAYED|QMF_HIDDEN|QMF_INACTIVE);
}
// position controls
y = ( SCREEN_HEIGHT - j * SMALLCHAR_HEIGHT ) / 2;
// bk001204 - parentheses
for( j = 0; (control = controls[j]) ; j++, y += SMALLCHAR_HEIGHT ) {
control->x = 320;
control->y = y;

View file

@ -811,10 +811,5 @@ void UI_InitGameinfo( void ) {
UI_LoadArenas();
UI_LoadBots();
if( (trap_Cvar_VariableValue( "fs_restrict" )) || (ui_numSpecialSinglePlayerArenas == 0 && ui_numSinglePlayerArenas == 4) ) {
uis.demoversion = qtrue;
}
else {
uis.demoversion = qfalse;
}
uis.demoversion = qfalse;
}

View file

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/q_shared.h"
#include "../renderer/tr_types.h"
//NOTE: include the ui_public.h from the new UI
#include "../ui/ui_public.h" // bk001205 - yes, do have to use this
#include "../ui/ui_public.h"
//redefine to old API version
#undef UI_API_VERSION
#define UI_API_VERSION 4
@ -678,7 +678,7 @@ int trap_MemoryRemaining( void );
void trap_GetCDKey( char *buf, int buflen );
void trap_SetCDKey( char *buf );
qboolean trap_VerifyCDKey( const char *key, const char *chksum); // bk001208 - RC4
qboolean trap_VerifyCDKey( const char *key, const char *chksum);
void trap_SetPbClStatus( int status );

View file

@ -79,7 +79,7 @@ intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4,
UI_DrawConnectScreen( arg0 );
return 0;
case UI_HASUNIQUECDKEY: // mod authors need to observe this
return qtrue; // bk010117 - change this to qfalse for mods!
return qtrue; // change this to qfalse for mods!
}
return -1;
@ -156,7 +156,6 @@ vmCvar_t ui_server16;
vmCvar_t ui_cdkeychecked;
// bk001129 - made static to avoid aliasing.
static cvarTable_t cvarTable[] = {
{ &ui_ffa_fraglimit, "ui_ffa_fraglimit", "20", CVAR_ARCHIVE },
{ &ui_ffa_timelimit, "ui_ffa_timelimit", "0", CVAR_ARCHIVE },
@ -216,7 +215,6 @@ static cvarTable_t cvarTable[] = {
{ &ui_cdkeychecked, "ui_cdkeychecked", "0", CVAR_ROM }
};
// bk001129 - made static to avoid aliasing
static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);

View file

@ -106,42 +106,6 @@ static void UI_Mods_ParseInfos( char *modDir, char *modDesc ) {
}
#if 0 // bk001204 - unused
/*
===============
UI_Mods_LoadModsFromFile
===============
*/
static void UI_Mods_LoadModsFromFile( char *filename ) {
int len;
fileHandle_t f;
char buf[1024];
len = trap_FS_FOpenFile( filename, &f, FS_READ );
if ( !f ) {
trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
return;
}
if ( len >= sizeof(buf) ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, sizeof(buf) ) );
trap_FS_FCloseFile( f );
return;
}
trap_FS_Read( buf, len, f );
buf[len] = 0;
trap_FS_FCloseFile( f );
len = strlen( filename );
if( !Q_stricmp(filename + len - 4,".mod") ) {
filename[len-4] = '\0';
}
UI_Mods_ParseInfos( filename, buf );
}
#endif
/*
===============
UI_Mods_LoadMods

View file

@ -327,7 +327,6 @@ void Bitmap_Draw( menubitmap_s *b )
if (b->shader)
UI_DrawHandlePic( x, y, w, h, b->shader );
// bk001204 - parentheses
if ( ( (b->generic.flags & QMF_PULSE)
|| (b->generic.flags & QMF_PULSEIFFOCUS) )
&& (Menu_ItemAtCursor( b->generic.parent ) == b))

View file

@ -47,16 +47,6 @@ typedef struct
static teammain_t s_teammain;
// bk001204 - unused
//static menuframework_s s_teammain_menu;
//static menuaction_s s_teammain_orders;
//static menuaction_s s_teammain_voice;
//static menuaction_s s_teammain_joinred;
//static menuaction_s s_teammain_joinblue;
//static menuaction_s s_teammain_joingame;
//static menuaction_s s_teammain_spectate;
/*
===============
TeamMain_MenuEvent

View file

@ -238,13 +238,6 @@ GRAPHICS OPTIONS MENU
#define GRAPHICSOPTIONS_ACCEPT0 "menu/art/accept_0"
#define GRAPHICSOPTIONS_ACCEPT1 "menu/art/accept_1"
static const char *s_drivers[] =
{
OPENGL_DRIVER_NAME,
_3DFX_DRIVER_NAME,
NULL
};
#define ID_BACK2 101
#define ID_FULLSCREEN 102
#define ID_LIST 103
@ -489,24 +482,9 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification )
trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue );
trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue );
trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue );
trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] );
switch ( s_graphicsoptions.colordepth.curvalue )
{
case 0:
trap_Cvar_SetValue( "r_colorbits", 0 );
trap_Cvar_SetValue( "r_depthbits", 0 );
trap_Cvar_SetValue( "r_stencilbits", 0 );
break;
case 1:
trap_Cvar_SetValue( "r_colorbits", 16 );
trap_Cvar_SetValue( "r_depthbits", 16 );
trap_Cvar_SetValue( "r_stencilbits", 0 );
break;
case 2:
trap_Cvar_SetValue( "r_colorbits", 32 );
trap_Cvar_SetValue( "r_depthbits", 24 );
break;
}
trap_Cvar_SetValue( "r_colorbits", 0 );
trap_Cvar_SetValue( "r_depthbits", 0 );
trap_Cvar_SetValue( "r_stencilbits", 0 );
trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue );
if ( s_graphicsoptions.geometry.curvalue == 2 )

View file

@ -41,7 +41,7 @@ BASIC MATH
RotatePoint
================
*/
void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // bk: FIXME
void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // FIXME
vec3_t tvec;
VectorCopy(point, tvec);
@ -55,7 +55,7 @@ void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // bk: FIXME
TransposeMatrix
================
*/
void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]) { // bk: FIXME
void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]) { // FIXME
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
@ -1067,17 +1067,6 @@ void CM_TraceThroughTree( traceWork_t *tw, int num, float p1f, float p2f, vec3_t
if ( tw->isPoint ) {
offset = 0;
} else {
#if 0 // bk010201 - DEAD
// an axial brush right behind a slanted bsp plane
// will poke through when expanded, so adjust
// by sqrt(3)
offset = fabs(tw->extents[0]*plane->normal[0]) +
fabs(tw->extents[1]*plane->normal[1]) +
fabs(tw->extents[2]*plane->normal[2]);
offset *= 2;
offset = tw->maxOffset;
#endif
// this is silly
offset = 2048;
}
@ -1276,7 +1265,7 @@ void CM_Trace( trace_t *results, const vec3_t start, const vec3_t end, vec3_t mi
//
if (start[0] == end[0] && start[1] == end[1] && start[2] == end[2]) {
if ( model ) {
#ifdef ALWAYS_BBOX_VS_BBOX // bk010201 - FIXME - compile time flag?
#ifdef ALWAYS_BBOX_VS_BBOX // FIXME - compile time flag?
if ( model == BOX_MODEL_HANDLE || model == CAPSULE_MODEL_HANDLE) {
tw.sphere.use = qfalse;
CM_TestInLeaf( &tw, &cmod->leaf );

View file

@ -56,7 +56,6 @@ static fileHandle_t logfile;
fileHandle_t com_journalFile; // events are written here
fileHandle_t com_journalDataFile; // config files are written here
cvar_t *com_viewlog;
cvar_t *com_speeds;
cvar_t *com_developer;
cvar_t *com_dedicated;
@ -80,9 +79,9 @@ cvar_t *sv_paused;
cvar_t *cl_packetdelay;
cvar_t *sv_packetdelay;
cvar_t *com_cameraMode;
#if defined(_WIN32) && defined(_DEBUG)
cvar_t *com_noErrorInterrupt;
#endif
cvar_t *com_ansiColor;
cvar_t *com_unfocused;
cvar_t *com_minimized;
// com_speeds times
int time_game;
@ -161,10 +160,9 @@ void QDECL Com_Printf( const char *fmt, ... ) {
return;
}
// echo to console if we're not a dedicated server
if ( com_dedicated && !com_dedicated->integer ) {
CL_ConsolePrint( msg );
}
#ifndef DEDICATED
CL_ConsolePrint( msg );
#endif
// echo to dedicated console and early console
Sys_Print( msg );
@ -246,16 +244,6 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
static int errorCount;
int currentTime;
#if defined(_WIN32) && defined(_DEBUG)
if ( code != ERR_DISCONNECT && code != ERR_NEED_CD ) {
if (!com_noErrorInterrupt->integer) {
__asm {
int 0x03
}
}
}
#endif
// when we are running automated scripts, make sure we
// know if anything failed
if ( com_buildScript && com_buildScript->integer ) {
@ -1126,7 +1114,6 @@ typedef struct memstatic_s {
byte mem[2];
} memstatic_t;
// bk001204 - initializer brackets
memstatic_t emptystring =
{ {(sizeof(memblock_t)+2 + 3) & ~3, TAG_STATIC, NULL, NULL, ZONEID}, {'\0', '\0'} };
memstatic_t numberstring[] = {
@ -1385,7 +1372,6 @@ Com_InitZoneMemory
*/
void Com_InitSmallZoneMemory( void ) {
s_smallZoneTotal = 512 * 1024;
// bk001205 - was malloc
smallzone = calloc( s_smallZoneTotal, 1 );
if ( !smallzone ) {
Com_Error( ERR_FATAL, "Small zone data failed to allocate %1.1f megs", (float)s_smallZoneTotal / (1024*1024) );
@ -1411,7 +1397,6 @@ void Com_InitZoneMemory( void ) {
s_zoneTotal = cv->integer * 1024 * 1024;
}
// bk001205 - was malloc
mainzone = calloc( s_zoneTotal, 1 );
if ( !mainzone ) {
Com_Error( ERR_FATAL, "Zone data failed to allocate %i megs", s_zoneTotal / (1024*1024) );
@ -1536,8 +1521,6 @@ void Com_InitHunkMemory( void ) {
s_hunkTotal = cv->integer * 1024 * 1024;
}
// bk001205 - was malloc
s_hunkData = calloc( s_hunkTotal + 31, 1 );
if ( !s_hunkData ) {
Com_Error( ERR_FATAL, "Hunk data failed to allocate %i megs", s_hunkTotal / (1024*1024) );
@ -1901,14 +1884,9 @@ journaled file
===================================================================
*/
// bk001129 - here we go again: upped from 64
// FIXME TTimo blunt upping from 256 to 1024
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=5
#define MAX_PUSHED_EVENTS 1024
// bk001129 - init, also static
static int com_pushedEventsHead = 0;
static int com_pushedEventsTail = 0;
// bk001129 - static
static sysEvent_t com_pushedEvents[MAX_PUSHED_EVENTS];
/*
@ -1941,6 +1919,125 @@ void Com_InitJournaling( void ) {
}
}
/*
========================================================================
EVENT LOOP
========================================================================
*/
#define MAX_QUEUED_EVENTS 256
#define MASK_QUEUED_EVENTS ( MAX_QUEUED_EVENTS - 1 )
static sysEvent_t eventQueue[ MAX_QUEUED_EVENTS ];
static int eventHead = 0;
static int eventTail = 0;
static byte sys_packetReceived[ MAX_MSGLEN ];
/*
================
Com_QueueEvent
A time of 0 will get the current time
Ptr should either be null, or point to a block of data that can
be freed by the game later.
================
*/
void Com_QueueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr )
{
sysEvent_t *ev;
ev = &eventQueue[ eventHead & MASK_QUEUED_EVENTS ];
if ( eventHead - eventTail >= MAX_QUEUED_EVENTS )
{
Com_Printf("Com_QueueEvent: overflow\n");
// we are discarding an event, but don't leak memory
if ( ev->evPtr )
{
Z_Free( ev->evPtr );
}
eventTail++;
}
eventHead++;
if ( time == 0 )
{
time = Sys_Milliseconds();
}
ev->evTime = time;
ev->evType = type;
ev->evValue = value;
ev->evValue2 = value2;
ev->evPtrLength = ptrLength;
ev->evPtr = ptr;
}
/*
================
Com_GetSystemEvent
================
*/
sysEvent_t Com_GetSystemEvent( void )
{
sysEvent_t ev;
char *s;
msg_t netmsg;
netadr_t adr;
// return if we have data
if ( eventHead > eventTail )
{
eventTail++;
return eventQueue[ ( eventTail - 1 ) & MASK_QUEUED_EVENTS ];
}
// check for console commands
s = Sys_ConsoleInput();
if ( s )
{
char *b;
int len;
len = strlen( s ) + 1;
b = Z_Malloc( len );
strcpy( b, s );
Com_QueueEvent( 0, SE_CONSOLE, 0, 0, len, b );
}
// check for network packets
MSG_Init( &netmsg, sys_packetReceived, sizeof( sys_packetReceived ) );
if ( Sys_GetPacket ( &adr, &netmsg ) )
{
netadr_t *buf;
int len;
// copy out to a seperate buffer for qeueing
len = sizeof( netadr_t ) + netmsg.cursize;
buf = Z_Malloc( len );
*buf = adr;
memcpy( buf+1, netmsg.data, netmsg.cursize );
Com_QueueEvent( 0, SE_PACKET, 0, 0, len, buf );
}
// return if we have data
if ( eventHead > eventTail )
{
eventTail++;
return eventQueue[ ( eventTail - 1 ) & MASK_QUEUED_EVENTS ];
}
// create an empty event to return
memset( &ev, 0, sizeof( ev ) );
ev.evTime = Sys_Milliseconds();
return ev;
}
/*
=================
Com_GetRealEvent
@ -1964,7 +2061,7 @@ sysEvent_t Com_GetRealEvent( void ) {
}
}
} else {
ev = Sys_GetEvent();
ev = Com_GetSystemEvent();
// write the journal value out if needed
if ( com_journal->integer == 1 ) {
@ -1990,7 +2087,6 @@ sysEvent_t Com_GetRealEvent( void ) {
Com_InitPushEvent
=================
*/
// bk001129 - added
void Com_InitPushEvent( void ) {
// clear the static buffer array
// this requires SE_NONE to be accepted as a valid but NOP event
@ -2009,7 +2105,7 @@ Com_PushEvent
*/
void Com_PushEvent( sysEvent_t *event ) {
sysEvent_t *ev;
static int printedWarning = 0; // bk001129 - init, bk001204 - explicit int
static int printedWarning = 0;
ev = &com_pushedEvents[ com_pushedEventsHead & (MAX_PUSHED_EVENTS-1) ];
@ -2110,7 +2206,6 @@ int Com_EventLoop( void ) {
switch ( ev.evType ) {
default:
// bk001129 - was ev.evTime
Com_Error( ERR_FATAL, "Com_EventLoop: bad event type %i", ev.evType );
break;
case SE_NONE:
@ -2322,7 +2417,7 @@ void Com_AppendCDKey( const char *filename ) {
}
}
#ifndef DEDICATED // bk001204
#ifndef DEDICATED
/*
=================
Com_WriteCDKey
@ -2378,7 +2473,7 @@ static void Com_DetectAltivec(void)
static qboolean altivec = qfalse;
static qboolean detected = qfalse;
if (!detected) {
altivec = Sys_DetectAltivec();
altivec = ( Sys_GetProcessorFeatures( ) & CF_ALTIVEC );
detected = qtrue;
}
@ -2397,13 +2492,17 @@ Com_Init
void Com_Init( char *commandLine ) {
char *s;
Com_Printf( "%s %s %s\n", SVN_VERSION, PLATFORM_STRING, __DATE__ );
Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ );
if ( setjmp (abortframe) ) {
Sys_Error ("Error during initialization");
}
// bk001129 - do this before anything else decides to push events
// Clear queues
Com_Memset( &eventQueue[ 0 ], 0, MAX_QUEUED_EVENTS * sizeof( sysEvent_t ) );
Com_Memset( &sys_packetReceived[ 0 ], 0, MAX_MSGLEN * sizeof( byte ) );
// do this before anything else decides to push events
Com_InitPushEvent();
Com_InitSmallZoneMemory();
@ -2473,7 +2572,6 @@ void Com_Init( char *commandLine ) {
com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT);
com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT);
com_dropsim = Cvar_Get ("com_dropsim", "0", CVAR_CHEAT);
com_viewlog = Cvar_Get( "viewlog", "0", CVAR_CHEAT );
com_speeds = Cvar_Get ("com_speeds", "0", 0);
com_timedemo = Cvar_Get ("timedemo", "0", CVAR_CHEAT);
com_cameraMode = Cvar_Get ("com_cameraMode", "0", CVAR_CHEAT);
@ -2485,19 +2583,13 @@ void Com_Init( char *commandLine ) {
com_sv_running = Cvar_Get ("sv_running", "0", CVAR_ROM);
com_cl_running = Cvar_Get ("cl_running", "0", CVAR_ROM);
com_buildScript = Cvar_Get( "com_buildScript", "0", 0 );
com_ansiColor = Cvar_Get( "com_ansiColor", "0", CVAR_ARCHIVE );
com_unfocused = Cvar_Get( "com_unfocused", "0", CVAR_ROM );
com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM );
com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
#if defined(_WIN32) && defined(_DEBUG)
com_noErrorInterrupt = Cvar_Get( "com_noErrorInterrupt", "0", 0 );
#endif
if ( com_dedicated->integer ) {
if ( !com_viewlog->integer ) {
Cvar_Set( "viewlog", "1" );
}
}
if ( com_developer && com_developer->integer ) {
Cmd_AddCommand ("error", Com_Error_f);
Cmd_AddCommand ("crash", Com_Crash_f );
@ -2516,10 +2608,9 @@ void Com_Init( char *commandLine ) {
SV_Init();
com_dedicated->modified = qfalse;
if ( !com_dedicated->integer ) {
CL_Init();
Sys_ShowConsole( com_viewlog->integer, qfalse );
}
#ifndef DEDICATED
CL_Init();
#endif
// set com_frameTime so that if a map is started on the
// command line it will still be able to count on com_frameTime
@ -2541,7 +2632,7 @@ void Com_Init( char *commandLine ) {
// start in full screen ui mode
Cvar_Set("r_uiFullScreen", "1");
CL_StartHunkUsers();
CL_StartHunkUsers( qfalse );
// make sure single player is off by default
Cvar_Set("ui_singlePlayerActive", "0");
@ -2550,9 +2641,9 @@ void Com_Init( char *commandLine ) {
// always set the cvar, but only print the info if it makes sense.
Com_DetectAltivec();
#if idppc
#if idppc
Com_Printf ("Altivec support is %s\n", com_altivec->integer ? "enabled" : "disabled");
#endif
#endif
Com_Printf ("--- Common Initialization Complete ---\n");
}
@ -2583,7 +2674,7 @@ Writes key bindings and archived cvars to config file if modified
===============
*/
void Com_WriteConfiguration( void ) {
#ifndef DEDICATED // bk001204
#ifndef DEDICATED
cvar_t *fs;
#endif
// if we are quiting without fully initializing, make sure
@ -2599,7 +2690,7 @@ void Com_WriteConfiguration( void ) {
Com_WriteConfigToFile( "q3config.cfg" );
// bk001119 - tentative "not needed for dedicated"
// not needed for dedicated
#ifndef DEDICATED
fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
@ -2708,8 +2799,6 @@ void Com_Frame( void ) {
return; // an ERR_DROP was thrown
}
// bk001204 - init to zero.
// also: might be clobbered by `longjmp' or `vfork'
timeBeforeFirstEvents =0;
timeBeforeServer =0;
timeBeforeEvents =0;
@ -2723,14 +2812,6 @@ void Com_Frame( void ) {
// write config file if anything changed
Com_WriteConfiguration();
// if "viewlog" has been modified, show or hide the log console
if ( com_viewlog->modified ) {
if ( !com_dedicated->value ) {
Sys_ShowConsole( com_viewlog->integer, qfalse );
}
com_viewlog->modified = qfalse;
}
//
// main event loop
//
@ -2783,42 +2864,39 @@ void Com_Frame( void ) {
Cvar_Get( "dedicated", "0", 0 );
com_dedicated->modified = qfalse;
if ( !com_dedicated->integer ) {
CL_Init();
Sys_ShowConsole( com_viewlog->integer, qfalse );
} else {
CL_Shutdown();
Sys_ShowConsole( 1, qtrue );
SV_Shutdown( "dedicated set to 0" );
CL_FlushMemory();
}
}
#ifndef DEDICATED
//
// client system
//
if ( !com_dedicated->integer ) {
//
// run event loop a second time to get server to client packets
// without a frame of latency
//
if ( com_speeds->integer ) {
timeBeforeEvents = Sys_Milliseconds ();
}
Com_EventLoop();
Cbuf_Execute ();
//
// client side
//
if ( com_speeds->integer ) {
timeBeforeClient = Sys_Milliseconds ();
}
CL_Frame( msec );
if ( com_speeds->integer ) {
timeAfter = Sys_Milliseconds ();
}
//
// run event loop a second time to get server to client packets
// without a frame of latency
//
if ( com_speeds->integer ) {
timeBeforeEvents = Sys_Milliseconds ();
}
Com_EventLoop();
Cbuf_Execute ();
//
// client side
//
if ( com_speeds->integer ) {
timeBeforeClient = Sys_Milliseconds ();
}
CL_Frame( msec );
if ( com_speeds->integer ) {
timeAfter = Sys_Milliseconds ();
}
#endif
//
// report timing information

View file

@ -511,8 +511,20 @@ qboolean Cvar_Command( void ) {
if ( Cmd_Argc() == 1 ) {
Com_TruncateLongString( string, v->string );
Com_TruncateLongString( resetString, v->resetString );
Com_Printf ("\"%s\" is:\"%s" S_COLOR_WHITE "\" default:\"%s" S_COLOR_WHITE "\"\n",
v->name, string, resetString );
Com_Printf ("\"%s\" is:\"%s" S_COLOR_WHITE "\"",
v->name, string );
if ( !( v->flags & CVAR_ROM ) ) {
if ( !Q_stricmp( string, resetString ) ) {
Com_Printf (", the default" );
} else {
Com_Printf (" default:\"%s" S_COLOR_WHITE "\"",
resetString );
}
}
Com_Printf ("\n");
if ( v->latchedString ) {
Com_TruncateLongString( latchedString, v->latchedString );
Com_Printf( "latched: \"%s\"\n", latchedString );
@ -895,8 +907,8 @@ updates an interpreted modules' version of a cvar
=====================
*/
void Cvar_Update( vmCvar_t *vmCvar ) {
cvar_t *cv = NULL; // bk001129
assert(vmCvar); // bk
cvar_t *cv = NULL;
assert(vmCvar);
if ( (unsigned)vmCvar->handle >= cvar_numIndexes ) {
Com_Error( ERR_DROP, "Cvar_Update: handle out of range" );
@ -911,16 +923,10 @@ void Cvar_Update( vmCvar_t *vmCvar ) {
return; // variable might have been cleared by a cvar_restart
}
vmCvar->modificationCount = cv->modificationCount;
// bk001129 - mismatches.
if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING )
Com_Error( ERR_DROP, "Cvar_Update: src %s length %zd exceeds MAX_CVAR_VALUE_STRING",
cv->string,
strlen(cv->string));
// bk001212 - Q_strncpyz guarantees zero padding and dest[MAX_CVAR_VALUE_STRING-1]==0
// bk001129 - paranoia. Never trust the destination string.
// bk001129 - beware, sizeof(char*) is always 4 (for cv->string).
// sizeof(vmCvar->string) always MAX_CVAR_VALUE_STRING
//Q_strncpyz( vmCvar->string, cv->string, sizeof( vmCvar->string ) ); // id
Q_strncpyz( vmCvar->string, cv->string, MAX_CVAR_VALUE_STRING );
vmCvar->value = cv->value;

View file

@ -51,15 +51,6 @@ command line to allow code debugging in a different directory. Basepath cannot
be modified at all after startup. Any files that are created (demos, screenshots,
etc) will be created reletive to the base path, so base path should usually be writable.
The "cd path" is the path to an alternate hierarchy that will be searched if a file
is not located in the base path. A user can do a partial install that copies some
data to a base path created on their hard drive and leave the rest on the cd. Files
are never writen to the cd path. It defaults to a value set by the installer, like
"e:\quake3", but it can be overridden with "+set fs_cdpath g:\quake3".
If a user runs the game directly from a CD, the base path would be on the CD. This
should still function correctly, but all file writes will fail (harmlessly).
The "home path" is the path used for all write access. On win32 systems we have "base path"
== "home path", but on *nix systems the base installation is usually readonly, and
"home path" points to ~/.q3a or similar
@ -93,21 +84,6 @@ trying to restrict demo / oem versions of the game with code changes. Demo / oe
should be exactly the same executables as release versions, but with different data that
automatically restricts where game media can come from to prevent add-ons from working.
After the paths are initialized, quake will look for the product.txt file. If not
found and verified, the game will run in restricted mode. In restricted mode, only
files contained in demoq3/pak0.pk3 will be available for loading, and only if the zip header is
verified to not have been modified. A single exception is made for q3config.cfg. Files
can still be written out in restricted mode, so screenshots and demos are allowed.
Restricted mode can be tested by setting "+set fs_restrict 1" on the command line, even
if there is a valid product.txt under the basepath or cdpath.
If not running in restricted mode, and a file is not found in any local filesystem,
an attempt will be made to download it and save it under the base path.
If the "fs_copyfiles" cvar is set to 1, then every time a file is sourced from the cd
path, it will be copied over to the base path. This is a development aid to help build
test releases and to copy working sets over slow network links.
File search order: when FS_FOpenFileRead gets called it will go through the fs_searchpaths
structure and stop on the first successful hit. fs_searchpaths is built with successive
calls to FS_AddGameDirectory
@ -260,10 +236,7 @@ static cvar_t *fs_debug;
static cvar_t *fs_homepath;
static cvar_t *fs_basepath;
static cvar_t *fs_basegame;
static cvar_t *fs_cdpath;
static cvar_t *fs_copyfiles;
static cvar_t *fs_gamedirvar;
static cvar_t *fs_restrict;
static searchpath_t *fs_searchpaths;
static int fs_readCount; // total bytes read
static int fs_loadCount; // total files read
@ -362,7 +335,7 @@ int FS_LoadStack( void )
{
return fs_loadStack;
}
/*
================
return a hash value for the filename
@ -676,8 +649,9 @@ fileHandle_t FS_SV_FOpenFileWrite( const char *filename ) {
/*
===========
FS_SV_FOpenFileRead
search for a file somewhere below the home path, base path or cd path
we search in that order, matching FS_SV_FOpenFileRead order
Search for a file somewhere below the home path then base path
in that order
===========
*/
int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp ) {
@ -696,7 +670,7 @@ int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp ) {
// don't let sound stutter
S_ClearSoundBuffer();
// search homepath
// search homepath
ospath = FS_BuildOSPath( fs_homepath->string, filename, "" );
// remove trailing slash
ospath[strlen(ospath)-1] = '\0';
@ -707,48 +681,30 @@ int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp ) {
fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
fsh[f].handleSync = qfalse;
if (!fsh[f].handleFiles.file.o)
{
// NOTE TTimo on non *nix systems, fs_homepath == fs_basepath, might want to avoid
if (Q_stricmp(fs_homepath->string,fs_basepath->string))
{
// search basepath
ospath = FS_BuildOSPath( fs_basepath->string, filename, "" );
ospath[strlen(ospath)-1] = '\0';
if (!fsh[f].handleFiles.file.o)
{
// If fs_homepath == fs_basepath, don't bother
if (Q_stricmp(fs_homepath->string,fs_basepath->string))
{
// search basepath
ospath = FS_BuildOSPath( fs_basepath->string, filename, "" );
ospath[strlen(ospath)-1] = '\0';
if ( fs_debug->integer )
{
Com_Printf( "FS_SV_FOpenFileRead (fs_basepath): %s\n", ospath );
}
if ( fs_debug->integer )
{
Com_Printf( "FS_SV_FOpenFileRead (fs_basepath): %s\n", ospath );
}
fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
fsh[f].handleSync = qfalse;
fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
fsh[f].handleSync = qfalse;
}
if ( !fsh[f].handleFiles.file.o )
{
f = 0;
}
}
}
if ( !fsh[f].handleFiles.file.o )
{
f = 0;
}
}
if (!fsh[f].handleFiles.file.o) {
// search cd path
ospath = FS_BuildOSPath( fs_cdpath->string, filename, "" );
ospath[strlen(ospath)-1] = '\0';
if (fs_debug->integer)
{
Com_Printf( "FS_SV_FOpenFileRead (fs_cdpath) : %s\n", ospath );
}
fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
fsh[f].handleSync = qfalse;
if( !fsh[f].handleFiles.file.o ) {
f = 0;
}
}
*fp = f;
if (f) {
return FS_filelength(f);
@ -836,9 +792,6 @@ void FS_FCloseFile( fileHandle_t f ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
if (fsh[f].streamed) {
Sys_EndStreamedFile(f);
}
if (fsh[f].zipFile == qtrue) {
unzCloseCurrentFile( fsh[f].handleFiles.file.z );
if ( fsh[f].handleFiles.unique ) {
@ -1155,12 +1108,12 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
// if we are running restricted, the only files we
// will allow to come from the directory are .cfg files
l = strlen( filename );
// FIXME TTimo I'm not sure about the fs_numServerPaks test
// if you are using FS_ReadFile to find out if a file exists,
// this test can make the search fail although the file is in the directory
// I had the problem on https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=8
// turned out I used FS_FileExists instead
if ( fs_restrict->integer || fs_numServerPaks ) {
// FIXME TTimo I'm not sure about the fs_numServerPaks test
// if you are using FS_ReadFile to find out if a file exists,
// this test can make the search fail although the file is in the directory
// I had the problem on https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=8
// turned out I used FS_FileExists instead
if ( fs_numServerPaks ) {
if ( Q_stricmp( filename + l - 4, ".cfg" ) // for config files
&& Q_stricmp( filename + l - 5, ".menu" ) // menu files
@ -1186,7 +1139,7 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
&& Q_stricmp( filename + l - 4, ".dat" ) ) { // for journal files
fs_fakeChkSum = random();
}
Q_strncpyz( fsh[*file].name, filename, sizeof( fsh[*file].name ) );
fsh[*file].zipFile = qfalse;
if ( fs_debug->integer ) {
@ -1194,15 +1147,6 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
dir->path, dir->gamedir );
}
// if we are getting it from the cdpath, optionally copy it
// to the basepath
if ( fs_copyfiles->integer && !Q_stricmp( dir->path, fs_cdpath->string ) ) {
char *copypath;
copypath = FS_BuildOSPath( fs_basepath->string, dir->gamedir, filename );
FS_CopyFile( netpath, copypath );
}
return FS_filelength (*file);
}
}
@ -1235,7 +1179,7 @@ int FS_Read2( void *buffer, int len, fileHandle_t f ) {
if (fsh[f].streamed) {
int r;
fsh[f].streamed = qfalse;
r = Sys_StreamedRead( buffer, len, 1, f);
r = FS_Read( buffer, len, f );
fsh[f].streamed = qtrue;
return r;
} else {
@ -1371,7 +1315,7 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) {
if (fsh[f].streamed) {
fsh[f].streamed = qfalse;
Sys_StreamSeek( f, offset, origin );
FS_Seek( f, offset, origin );
fsh[f].streamed = qtrue;
}
@ -1946,7 +1890,7 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
char *name;
// don't scan directories for files if we are pure or restricted
if ( fs_restrict->integer || fs_numServerPaks ) {
if ( fs_numServerPaks ) {
continue;
} else {
netpath = FS_BuildOSPath( search->dir->path, search->dir->gamedir, path );
@ -2060,58 +2004,51 @@ FIXME TTimo those two should move to common.c next to Sys_ListFiles
*/
static unsigned int Sys_CountFileList(char **list)
{
int i = 0;
int i = 0;
if (list)
{
while (*list)
{
list++;
i++;
}
}
return i;
if (list)
{
while (*list)
{
list++;
i++;
}
}
return i;
}
static char** Sys_ConcatenateFileLists( char **list0, char **list1, char **list2 )
static char** Sys_ConcatenateFileLists( char **list0, char **list1 )
{
int totalLength = 0;
char** cat = NULL, **dst, **src;
int totalLength = 0;
char** cat = NULL, **dst, **src;
totalLength += Sys_CountFileList(list0);
totalLength += Sys_CountFileList(list1);
totalLength += Sys_CountFileList(list2);
totalLength += Sys_CountFileList(list0);
totalLength += Sys_CountFileList(list1);
/* Create new list. */
dst = cat = Z_Malloc( ( totalLength + 1 ) * sizeof( char* ) );
/* Create new list. */
dst = cat = Z_Malloc( ( totalLength + 1 ) * sizeof( char* ) );
/* Copy over lists. */
if (list0)
{
for (src = list0; *src; src++, dst++)
*dst = *src;
}
if (list1)
{
for (src = list1; *src; src++, dst++)
*dst = *src;
}
if (list2)
{
for (src = list2; *src; src++, dst++)
*dst = *src;
}
/* Copy over lists. */
if (list0)
{
for (src = list0; *src; src++, dst++)
*dst = *src;
}
if (list1)
{
for (src = list1; *src; src++, dst++)
*dst = *src;
}
// Terminate the list
*dst = NULL;
// Terminate the list
*dst = NULL;
// Free our old lists.
// NOTE: not freeing their content, it's been merged in dst and still being used
if (list0) Z_Free( list0 );
if (list1) Z_Free( list1 );
if (list2) Z_Free( list2 );
// Free our old lists.
// NOTE: not freeing their content, it's been merged in dst and still being used
if (list0) Z_Free( list0 );
if (list1) Z_Free( list1 );
return cat;
return cat;
}
/*
@ -2124,116 +2061,106 @@ The directories are searched in base path, cd path and home path
================
*/
int FS_GetModList( char *listbuf, int bufsize ) {
int nMods, i, j, nTotal, nLen, nPaks, nPotential, nDescLen;
char **pFiles = NULL;
char **pPaks = NULL;
char *name, *path;
char descPath[MAX_OSPATH];
fileHandle_t descHandle;
int nMods, i, j, nTotal, nLen, nPaks, nPotential, nDescLen;
char **pFiles = NULL;
char **pPaks = NULL;
char *name, *path;
char descPath[MAX_OSPATH];
fileHandle_t descHandle;
int dummy;
char **pFiles0 = NULL;
char **pFiles1 = NULL;
char **pFiles2 = NULL;
qboolean bDrop = qfalse;
int dummy;
char **pFiles0 = NULL;
char **pFiles1 = NULL;
qboolean bDrop = qfalse;
*listbuf = 0;
nMods = nPotential = nTotal = 0;
*listbuf = 0;
nMods = nPotential = nTotal = 0;
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
pFiles2 = Sys_ListFiles( fs_cdpath->string, NULL, NULL, &dummy, qtrue );
// we searched for mods in the three paths
// it is likely that we have duplicate names now, which we will cleanup below
pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1, pFiles2 );
nPotential = Sys_CountFileList(pFiles);
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
// we searched for mods in the three paths
// it is likely that we have duplicate names now, which we will cleanup below
pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
nPotential = Sys_CountFileList(pFiles);
for ( i = 0 ; i < nPotential ; i++ ) {
name = pFiles[i];
// NOTE: cleaner would involve more changes
// ignore duplicate mod directories
if (i!=0) {
bDrop = qfalse;
for(j=0; j<i; j++)
{
if (Q_stricmp(pFiles[j],name)==0) {
// this one can be dropped
bDrop = qtrue;
break;
}
}
}
if (bDrop) {
continue;
}
// we drop "baseq3" "." and ".."
if (Q_stricmp(name, BASEGAME) && Q_stricmpn(name, ".", 1)) {
// now we need to find some .pk3 files to validate the mod
// NOTE TTimo: (actually I'm not sure why .. what if it's a mod under developement with no .pk3?)
// we didn't keep the information when we merged the directory names, as to what OS Path it was found under
// so it could be in base path, cd path or home path
// we will try each three of them here (yes, it's a bit messy)
path = FS_BuildOSPath( fs_basepath->string, name, "" );
nPaks = 0;
pPaks = Sys_ListFiles(path, ".pk3", NULL, &nPaks, qfalse);
Sys_FreeFileList( pPaks ); // we only use Sys_ListFiles to check wether .pk3 files are present
for ( i = 0 ; i < nPotential ; i++ ) {
name = pFiles[i];
// NOTE: cleaner would involve more changes
// ignore duplicate mod directories
if (i!=0) {
bDrop = qfalse;
for(j=0; j<i; j++)
{
if (Q_stricmp(pFiles[j],name)==0) {
// this one can be dropped
bDrop = qtrue;
break;
}
}
}
if (bDrop) {
continue;
}
// we drop "baseq3" "." and ".."
if (Q_stricmp(name, BASEGAME) && Q_stricmpn(name, ".", 1)) {
// now we need to find some .pk3 files to validate the mod
// NOTE TTimo: (actually I'm not sure why .. what if it's a mod under developement with no .pk3?)
// we didn't keep the information when we merged the directory names, as to what OS Path it was found under
// so it could be in base path, cd path or home path
// we will try each three of them here (yes, it's a bit messy)
path = FS_BuildOSPath( fs_basepath->string, name, "" );
nPaks = 0;
pPaks = Sys_ListFiles(path, ".pk3", NULL, &nPaks, qfalse);
Sys_FreeFileList( pPaks ); // we only use Sys_ListFiles to check wether .pk3 files are present
/* Try on cd path */
if( nPaks <= 0 ) {
path = FS_BuildOSPath( fs_cdpath->string, name, "" );
nPaks = 0;
pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
Sys_FreeFileList( pPaks );
}
/* try on home path */
if ( nPaks <= 0 )
{
path = FS_BuildOSPath( fs_homepath->string, name, "" );
nPaks = 0;
pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
Sys_FreeFileList( pPaks );
}
/* try on home path */
if ( nPaks <= 0 )
{
path = FS_BuildOSPath( fs_homepath->string, name, "" );
nPaks = 0;
pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
Sys_FreeFileList( pPaks );
}
if (nPaks > 0) {
nLen = strlen(name) + 1;
// nLen is the length of the mod path
// we need to see if there is a description available
descPath[0] = '\0';
strcpy(descPath, name);
strcat(descPath, "/description.txt");
nDescLen = FS_SV_FOpenFileRead( descPath, &descHandle );
if ( nDescLen > 0 && descHandle) {
FILE *file;
file = FS_FileForHandle(descHandle);
Com_Memset( descPath, 0, sizeof( descPath ) );
nDescLen = fread(descPath, 1, 48, file);
if (nDescLen >= 0) {
descPath[nDescLen] = '\0';
}
FS_FCloseFile(descHandle);
} else {
strcpy(descPath, name);
}
nDescLen = strlen(descPath) + 1;
if (nPaks > 0) {
nLen = strlen(name) + 1;
// nLen is the length of the mod path
// we need to see if there is a description available
descPath[0] = '\0';
strcpy(descPath, name);
strcat(descPath, "/description.txt");
nDescLen = FS_SV_FOpenFileRead( descPath, &descHandle );
if ( nDescLen > 0 && descHandle) {
FILE *file;
file = FS_FileForHandle(descHandle);
Com_Memset( descPath, 0, sizeof( descPath ) );
nDescLen = fread(descPath, 1, 48, file);
if (nDescLen >= 0) {
descPath[nDescLen] = '\0';
}
FS_FCloseFile(descHandle);
} else {
strcpy(descPath, name);
}
nDescLen = strlen(descPath) + 1;
if (nTotal + nLen + 1 + nDescLen + 1 < bufsize) {
strcpy(listbuf, name);
listbuf += nLen;
strcpy(listbuf, descPath);
listbuf += nDescLen;
nTotal += nLen + nDescLen;
nMods++;
}
else {
break;
}
}
}
}
Sys_FreeFileList( pFiles );
if (nTotal + nLen + 1 + nDescLen + 1 < bufsize) {
strcpy(listbuf, name);
listbuf += nLen;
strcpy(listbuf, descPath);
listbuf += nDescLen;
nTotal += nLen + nDescLen;
nMods++;
}
else {
break;
}
}
}
}
Sys_FreeFileList( pFiles );
return nMods;
return nMods;
}
@ -2300,7 +2227,7 @@ Ignore case and seprator char distinctions
*/
int FS_PathCmp( const char *s1, const char *s2 ) {
int c1, c2;
do {
c1 = *s1++;
c2 = *s2++;
@ -2429,9 +2356,6 @@ void FS_Path_f( void ) {
/*
============
FS_TouchFile_f
The only purpose of this function is to allow game script files to copy
arbitrary files furing an "fs_copyfiles 1" run.
============
*/
void FS_TouchFile_f( void ) {
@ -2477,8 +2401,7 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
int numfiles;
char **pakfiles;
// this fixes the case where fs_basepath is the same as fs_cdpath
// which happens on full installs
// Unique
for ( sp = fs_searchpaths ; sp ; sp = sp->next ) {
if ( sp->dir && !Q_stricmp(sp->dir->path, path) && !Q_stricmp(sp->dir->gamedir, dir)) {
return; // we've already got this one
@ -2609,10 +2532,10 @@ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) {
// Make sure the server cannot make us write to non-quake3 directories.
if(FS_CheckDirTraversal(fs_serverReferencedPakNames[i]))
{
{
Com_Printf("WARNING: Invalid download name %s\n", fs_serverReferencedPakNames[i]);
continue;
}
continue;
}
for ( sp = fs_searchpaths ; sp ; sp = sp->next ) {
if ( sp->pack && sp->pack->checksum == fs_serverReferencedPaks[i] ) {
@ -2624,54 +2547,55 @@ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) {
if ( !havepak && fs_serverReferencedPakNames[i] && *fs_serverReferencedPakNames[i] ) {
// Don't got it
if (dlstring)
{
// We need this to make sure we won't hit the end of the buffer or the server could
// overwrite non-pk3 files on clients by writing so much crap into neededpaks that
// Q_strcat cuts off the .pk3 extension.
origpos += strlen(origpos);
// Remote name
Q_strcat( neededpaks, len, "@");
Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
Q_strcat( neededpaks, len, ".pk3" );
if (dlstring)
{
// We need this to make sure we won't hit the end of the buffer or the server could
// overwrite non-pk3 files on clients by writing so much crap into neededpaks that
// Q_strcat cuts off the .pk3 extension.
// Local name
Q_strcat( neededpaks, len, "@");
// Do we have one with the same name?
if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
{
char st[MAX_ZPATH];
// We already have one called this, we need to download it to another name
// Make something up with the checksum in it
Com_sprintf( st, sizeof( st ), "%s.%08x.pk3", fs_serverReferencedPakNames[i], fs_serverReferencedPaks[i] );
Q_strcat( neededpaks, len, st );
} else
{
Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
Q_strcat( neededpaks, len, ".pk3" );
}
// Find out whether it might have overflowed the buffer and don't add this file to the
// list if that is the case.
if(strlen(origpos) + (origpos - neededpaks) >= len - 1)
{
*origpos = '\0';
break;
}
}
else
{
Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
Q_strcat( neededpaks, len, ".pk3" );
// Do we have one with the same name?
if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
{
Q_strcat( neededpaks, len, " (local file exists with wrong checksum)");
}
Q_strcat( neededpaks, len, "\n");
}
origpos += strlen(origpos);
// Remote name
Q_strcat( neededpaks, len, "@");
Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
Q_strcat( neededpaks, len, ".pk3" );
// Local name
Q_strcat( neededpaks, len, "@");
// Do we have one with the same name?
if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
{
char st[MAX_ZPATH];
// We already have one called this, we need to download it to another name
// Make something up with the checksum in it
Com_sprintf( st, sizeof( st ), "%s.%08x.pk3", fs_serverReferencedPakNames[i], fs_serverReferencedPaks[i] );
Q_strcat( neededpaks, len, st );
}
else
{
Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
Q_strcat( neededpaks, len, ".pk3" );
}
// Find out whether it might have overflowed the buffer and don't add this file to the
// list if that is the case.
if(strlen(origpos) + (origpos - neededpaks) >= len - 1)
{
*origpos = '\0';
break;
}
}
else
{
Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
Q_strcat( neededpaks, len, ".pk3" );
// Do we have one with the same name?
if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
{
Q_strcat( neededpaks, len, " (local file exists with wrong checksum)");
}
Q_strcat( neededpaks, len, "\n");
}
}
}
@ -2731,7 +2655,7 @@ void FS_Shutdown( qboolean closemfp ) {
void Com_AppendCDKey( const char *filename );
void Com_ReadCDKey( const char *filename );
/*
================
FS_ReorderPurePaks
@ -2745,14 +2669,14 @@ static void FS_ReorderPurePaks( void )
int i;
searchpath_t **p_insert_index, // for linked list reordering
**p_previous; // when doing the scan
// only relevant when connected to pure server
if ( !fs_numServerPaks )
return;
fs_reordered = qfalse;
p_insert_index = &fs_searchpaths; // we insert in order at the beginning of the list
p_insert_index = &fs_searchpaths; // we insert in order at the beginning of the list
for ( i = 0 ; i < fs_numServerPaks ; i++ ) {
p_previous = p_insert_index; // track the pointer-to-current-item
for (s = *p_insert_index; s; s = s->next) {
@ -2767,7 +2691,7 @@ static void FS_ReorderPurePaks( void )
p_insert_index = &s->next;
break; // iterate to next server pack
}
p_previous = &s->next;
p_previous = &s->next;
}
}
}
@ -2777,43 +2701,35 @@ static void FS_ReorderPurePaks( void )
FS_Startup
================
*/
static void FS_Startup( const char *gameName ) {
const char *homePath;
static void FS_Startup( const char *gameName )
{
const char *homePath;
cvar_t *fs;
Com_Printf( "----- FS_Startup -----\n" );
fs_debug = Cvar_Get( "fs_debug", "0", 0 );
fs_copyfiles = Cvar_Get( "fs_copyfiles", "0", CVAR_INIT );
fs_cdpath = Cvar_Get ("fs_cdpath", Sys_DefaultCDPath(), CVAR_INIT );
fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT );
fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT );
homePath = Sys_DefaultHomePath();
if (!homePath || !homePath[0]) {
homePath = Sys_DefaultHomePath();
if (!homePath || !homePath[0]) {
homePath = fs_basepath->string;
}
fs_homepath = Cvar_Get ("fs_homepath", homePath, CVAR_INIT );
fs_gamedirvar = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
fs_restrict = Cvar_Get ("fs_restrict", "", CVAR_INIT );
// add search path elements in reverse priority order
if (fs_cdpath->string[0]) {
FS_AddGameDirectory( fs_cdpath->string, gameName );
}
if (fs_basepath->string[0]) {
FS_AddGameDirectory( fs_basepath->string, gameName );
}
// fs_homepath is somewhat particular to *nix systems, only add if relevant
// NOTE: same filtering below for mods and basegame
if (fs_basepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
// fs_homepath is somewhat particular to *nix systems, only add if relevant
// NOTE: same filtering below for mods and basegame
if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
FS_AddGameDirectory ( fs_homepath->string, gameName );
}
// check for additional base game so mods can be based upon other mods
if ( fs_basegame->string[0] && !Q_stricmp( gameName, BASEGAME ) && Q_stricmp( fs_basegame->string, gameName ) ) {
if (fs_cdpath->string[0]) {
FS_AddGameDirectory(fs_cdpath->string, fs_basegame->string);
}
if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_basegame->string);
}
@ -2824,9 +2740,6 @@ static void FS_Startup( const char *gameName ) {
// check for additional game folder for mods
if ( fs_gamedirvar->string[0] && !Q_stricmp( gameName, BASEGAME ) && Q_stricmp( fs_gamedirvar->string, gameName ) ) {
if (fs_cdpath->string[0]) {
FS_AddGameDirectory(fs_cdpath->string, fs_gamedirvar->string);
}
if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string);
}
@ -2850,7 +2763,7 @@ static void FS_Startup( const char *gameName ) {
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=506
// reorder the pure pk3 files according to server order
FS_ReorderPurePaks();
// print the current search paths
FS_Path_f();
@ -3326,12 +3239,9 @@ void FS_InitFilesystem( void ) {
// we have to specially handle this, because normal command
// line variable sets don't happen until after the filesystem
// has already been initialized
Com_StartupVariable( "fs_cdpath" );
Com_StartupVariable( "fs_basepath" );
Com_StartupVariable( "fs_homepath" );
Com_StartupVariable( "fs_game" );
Com_StartupVariable( "fs_copyfiles" );
Com_StartupVariable( "fs_restrict" );
// try to start up normally
FS_Startup( BASEGAME );
@ -3343,13 +3253,10 @@ void FS_InitFilesystem( void ) {
// graphics screen when the font fails to load
if ( FS_ReadFile( "default.cfg", NULL ) <= 0 ) {
Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
// bk001208 - SafeMode see below, FIXME?
}
Q_strncpyz(lastValidBase, fs_basepath->string, sizeof(lastValidBase));
Q_strncpyz(lastValidGame, fs_gamedirvar->string, sizeof(lastValidGame));
// bk001208 - SafeMode see below, FIXME?
}
@ -3386,7 +3293,6 @@ void FS_Restart( int checksumFeed ) {
Cvar_Set("fs_gamedirvar", lastValidGame);
lastValidBase[0] = '\0';
lastValidGame[0] = '\0';
Cvar_Set( "fs_restrict", "0" );
FS_Restart(checksumFeed);
Com_Error( ERR_DROP, "Invalid game folder\n" );
return;
@ -3394,7 +3300,6 @@ void FS_Restart( int checksumFeed ) {
Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
}
// bk010116 - new check before safeMode
if ( Q_stricmp(fs_gamedirvar->string, lastValidGame) ) {
// skip the q3config.cfg if "safe" is on the command line
if ( !Com_SafeMode() ) {
@ -3474,7 +3379,6 @@ int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
fsh[*f].streamed = qfalse;
if (mode == FS_READ) {
Sys_BeginStreamedFile( *f, 0x4000 );
fsh[*f].streamed = qtrue;
}
}

View file

@ -1026,28 +1026,22 @@ void NET_Shutdown( void ) {
====================
NET_Sleep
Sleeps msec or until net socket is ready
Sleeps msec or until something happens on the network or stdin
====================
*/
void NET_Sleep( int msec ) {
struct timeval timeout;
fd_set fdset;
#ifndef _WIN32 //FIXME
extern qboolean stdin_active;
#endif
int highestfd = 0;
if (!com_dedicated->integer)
return; // we're not a server, just run full speed
FD_ZERO(&fdset);
#ifndef _WIN32 //FIXME
if (stdin_active)
{
FD_SET(0, &fdset); // stdin is processed too
highestfd = 1;
}
#endif
FD_SET(fileno(stdin), &fdset);
highestfd = fileno(stdin) + 1;
if(ip_socket)
{
FD_SET(ip_socket, &fdset); // network socket

View file

@ -447,7 +447,7 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
inv_denom = DotProduct( normal, normal );
#ifndef Q3_VM
assert( Q_fabs(inv_denom) != 0.0f ); // bk010122 - zero vectors get here
assert( Q_fabs(inv_denom) != 0.0f ); // zero vectors get here
#endif
inv_denom = 1.0f / inv_denom;
@ -515,7 +515,6 @@ float Q_rsqrt( float number )
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
//assert( !isnan(y) ); // bk010122 - FPE?
return y;
}
@ -1110,17 +1109,11 @@ vec_t VectorNormalize2( const vec3_t v, vec3_t out) {
if (length)
{
#ifndef Q3_VM // bk0101022 - FPE related
// assert( ((Q_fabs(v[0])!=0.0f) || (Q_fabs(v[1])!=0.0f) || (Q_fabs(v[2])!=0.0f)) );
#endif
ilength = 1/length;
out[0] = v[0]*ilength;
out[1] = v[1]*ilength;
out[2] = v[2]*ilength;
} else {
#ifndef Q3_VM // bk0101022 - FPE related
// assert( ((Q_fabs(v[0])==0.0f) && (Q_fabs(v[1])==0.0f) && (Q_fabs(v[2])==0.0f)) );
#endif
VectorClear( out );
}

View file

@ -168,7 +168,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//=============================================================== FreeBSD ===
#ifdef __FreeBSD__ // rb010123
#ifdef __FreeBSD__
#include <machine/endian.h>

View file

@ -734,7 +734,6 @@ Safe strncpy that ensures a trailing zero
=============
*/
void Q_strncpyz( char *dest, const char *src, int destsize ) {
// bk001129 - also NULL dest
if ( !dest ) {
Com_Error( ERR_FATAL, "Q_strncpyz: NULL dest" );
}
@ -752,7 +751,6 @@ void Q_strncpyz( char *dest, const char *src, int destsize ) {
int Q_stricmpn (const char *s1, const char *s2, int n) {
int c1, c2;
// bk001129 - moved in 1.17 fix not in id codebase
if ( s1 == NULL ) {
if ( s2 == NULL )
return 0;
@ -846,6 +844,38 @@ void Q_strcat( char *dest, int size, const char *src ) {
Q_strncpyz( dest + l1, src, size - l1 );
}
/*
* Find the first occurrence of find in s.
*/
const char *Q_stristr( const char *s, const char *find)
{
char c, sc;
size_t len;
if ((c = *find++) != 0)
{
if (c >= 'a' && c <= 'z')
{
c -= ('a' - 'A');
}
len = strlen(find);
do
{
do
{
if ((sc = *s++) == 0)
return NULL;
if (sc >= 'a' && sc <= 'z')
{
sc -= ('a' - 'A');
}
} while (sc != c);
} while (Q_stricmpn(s, find, len) != 0);
s--;
}
return s;
}
int Q_PrintStrlen( const char *string ) {
int len;

View file

@ -26,14 +26,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file
#define Q3_VERSION "ioQ3 1.33"
#ifndef SVN_VERSION
#define SVN_VERSION Q3_VERSION
#define Q3_VERSION_BASE "ioq3 1.35"
#ifdef SVN_VERSION
# define Q3_VERSION Q3_VERSION_BASE "_SVN" SVN_VERSION
#else
# define Q3_VERSION Q3_VERSION_BASE
#endif
#define CLIENT_WINDOW_TITLE "ioquake3"
#define CLIENT_WINDOW_ICON "ioq3"
#define CONSOLE_WINDOW_TITLE "ioquake3 console"
#define CONSOLE_WINDOW_ICON "ioq3 console"
#define CLIENT_WINDOW_TITLE "ioquake3"
#define CLIENT_WINDOW_MIN_TITLE "ioq3"
// 1.32 released 7-10-2002
#define BASEGAME "baseq3"
@ -262,14 +263,6 @@ void *Hunk_AllocDebug( int size, ha_pref preference, char *label, char *file, in
void *Hunk_Alloc( int size, ha_pref preference );
#endif
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(MACOS_X)
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
// custom Snd_Memset implementation for glibc memset bug workaround
void Snd_Memset (void* dest, const int val, const size_t count);
#else
#define Snd_Memset Com_Memset
#endif
#define Com_Memset memset
#define Com_Memcpy memcpy
@ -678,6 +671,7 @@ int Q_stricmpn (const char *s1, const char *s2, int n);
char *Q_strlwr( char *s1 );
char *Q_strupr( char *s1 );
char *Q_strrchr( const char* string, int c );
const char *Q_stristr( const char *s, const char *find);
// buffer size safe library replacements
void Q_strncpyz( char *dest, const char *src, int destsize );

View file

@ -687,13 +687,11 @@ MISC
==============================================================
*/
// TTimo
// vsnprintf is ISO/IEC 9899:1999
// abstracting this to make it portable
#ifdef WIN32
#define Q_vsnprintf _vsnprintf
#else
// TODO: do we need Mac define?
#define Q_vsnprintf vsnprintf
#endif
@ -701,22 +699,46 @@ MISC
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470
extern char cl_cdkey[34];
// returnbed by Sys_GetProcessorId
#define CPUID_GENERIC 0 // any unrecognized processor
// returned by Sys_GetProcessorFeatures
typedef enum
{
CF_RDTSC = 1 << 0,
CF_MMX = 1 << 1,
CF_MMX_EXT = 1 << 2,
CF_3DNOW = 1 << 3,
CF_3DNOW_EXT = 1 << 4,
CF_SSE = 1 << 5,
CF_SSE2 = 1 << 6,
CF_ALTIVEC = 1 << 7
} cpuFeatures_t;
#define CPUID_AXP 0x10
#define CPUID_INTEL_UNSUPPORTED 0x20 // Intel 386/486
#define CPUID_INTEL_PENTIUM 0x21 // Intel Pentium or PPro
#define CPUID_INTEL_MMX 0x22 // Intel Pentium/MMX or P2/MMX
#define CPUID_INTEL_KATMAI 0x23 // Intel Katmai
#define CPUID_AMD_3DNOW 0x30 // AMD K6 3DNOW!
// TTimo
// centralized and cleaned, that's the max string you can send to a Com_Printf / Com_DPrintf (above gets truncated)
#define MAXPRINTMSG 4096
typedef enum {
// SE_NONE must be zero
SE_NONE = 0, // evTime is still valid
SE_KEY, // evValue is a key code, evValue2 is the down flag
SE_CHAR, // evValue is an ascii char
SE_MOUSE, // evValue and evValue2 are reletive signed x / y moves
SE_JOYSTICK_AXIS, // evValue is an axis number and evValue2 is the current state (-127 to 127)
SE_CONSOLE, // evPtr is a char*
SE_PACKET // evPtr is a netadr_t followed by data bytes to evPtrLength
} sysEventType_t;
typedef struct {
int evTime;
sysEventType_t evType;
int evValue, evValue2;
int evPtrLength; // bytes of data pointed to by evPtr, for journaling
void *evPtr; // this must be manually freed if not NULL
} sysEvent_t;
void Com_QueueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr );
int Com_EventLoop( void );
sysEvent_t Com_GetSystemEvent( void );
char *CopyString( const char *in );
void Info_Print( const char *s );
@ -726,7 +748,7 @@ void QDECL Com_Printf( const char *fmt, ... ) __attribute__ ((format (printf,
void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
void Com_Quit_f( void );
int Com_EventLoop( void );
int Com_Milliseconds( void ); // will be journaled properly
unsigned Com_BlockChecksum( const void *buffer, int length );
char *Com_MD5File(const char *filename, int length, const char *prefix, int prefix_len);
@ -748,12 +770,14 @@ extern cvar_t *com_speeds;
extern cvar_t *com_timescale;
extern cvar_t *com_sv_running;
extern cvar_t *com_cl_running;
extern cvar_t *com_viewlog; // 0 = hidden, 1 = visible, 2 = minimized
extern cvar_t *com_version;
extern cvar_t *com_blood;
extern cvar_t *com_buildScript; // for building release pak files
extern cvar_t *com_journal;
extern cvar_t *com_cameraMode;
extern cvar_t *com_ansiColor;
extern cvar_t *com_unfocused;
extern cvar_t *com_minimized;
extern cvar_t *com_altivec;
// both client and server must agree to pause
@ -897,7 +921,7 @@ void CL_ShutdownAll( void );
void CL_FlushMemory( void );
// dump all memory on an error
void CL_StartHunkUsers( void );
void CL_StartHunkUsers( qboolean rendererOnly );
// start all the client stuff using the hunk
void Key_WriteBindings( fileHandle_t f );
@ -942,31 +966,9 @@ typedef enum {
MAX_JOYSTICK_AXIS
} joystickAxis_t;
typedef enum {
// bk001129 - make sure SE_NONE is zero
SE_NONE = 0, // evTime is still valid
SE_KEY, // evValue is a key code, evValue2 is the down flag
SE_CHAR, // evValue is an ascii char
SE_MOUSE, // evValue and evValue2 are reletive signed x / y moves
SE_JOYSTICK_AXIS, // evValue is an axis number and evValue2 is the current state (-127 to 127)
SE_CONSOLE, // evPtr is a char*
SE_PACKET // evPtr is a netadr_t followed by data bytes to evPtrLength
} sysEventType_t;
typedef struct {
int evTime;
sysEventType_t evType;
int evValue, evValue2;
int evPtrLength; // bytes of data pointed to by evPtr, for journaling
void *evPtr; // this must be manually freed if not NULL
} sysEvent_t;
sysEvent_t Sys_GetEvent( void );
void Sys_Init (void);
// general development dll loading for virtual machine testing
// fqpath param added 7/20/02 by T.Ray - Sys_LoadDll is only called in vm.c at this time
void * QDECL Sys_LoadDll( const char *name, char *fqpath , intptr_t (QDECL **entryPoint)(int, ...),
intptr_t (QDECL *systemcalls)(intptr_t, ...) );
void Sys_UnloadDll( void *dllHandle );
@ -1003,17 +1005,12 @@ qboolean Sys_RandomBytes( byte *string, int len );
// the system console is shown when a dedicated server is running
void Sys_DisplaySystemConsole( qboolean show );
int Sys_GetProcessorId( void );
cpuFeatures_t Sys_GetProcessorFeatures( void );
void Sys_BeginStreamedFile( fileHandle_t f, int readahead );
void Sys_EndStreamedFile( fileHandle_t f );
int Sys_StreamedRead( void *buffer, int size, int count, fileHandle_t f );
void Sys_StreamSeek( fileHandle_t f, int offset, int origin );
void Sys_ShowConsole( int level, qboolean quitOnClose );
void Sys_SetErrorText( const char *text );
void Sys_SendPacket( int length, const void *data, netadr_t to );
qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message );
qboolean Sys_StringToAdr( const char *s, netadr_t *a );
//Does NOT parse port numbers, only base addresses.
@ -1021,29 +1018,20 @@ qboolean Sys_StringToAdr( const char *s, netadr_t *a );
qboolean Sys_IsLANAddress (netadr_t adr);
void Sys_ShowIP(void);
qboolean Sys_CheckCD( void );
void Sys_Mkdir( const char *path );
char *Sys_Cwd( void );
void Sys_SetDefaultCDPath(const char *path);
char *Sys_DefaultCDPath(void);
void Sys_SetDefaultInstallPath(const char *path);
char *Sys_DefaultInstallPath(void);
void Sys_SetDefaultHomePath(const char *path);
char *Sys_DefaultHomePath(void);
const char *Sys_Dirname( char *path );
const char *Sys_Basename( char *path );
char *Sys_ConsoleInput(void);
char **Sys_ListFiles( const char *directory, const char *extension, char *filter, int *numfiles, qboolean wantsubs );
void Sys_FreeFileList( char **list );
void Sys_BeginProfiling( void );
void Sys_EndProfiling( void );
qboolean Sys_LowPhysicalMemory( void );
unsigned int Sys_ProcessorCount( void );
int Sys_MonkeyShouldBeSpanked( void );
qboolean Sys_DetectAltivec( void );
/* This is based on the Adaptive Huffman algorithm described in Sayood's Data
* Compression book. The ranks are not actually stored, but implicitly defined

View file

@ -36,8 +36,8 @@ and one exported function: Perform
#include "vm_local.h"
vm_t *currentVM = NULL; // bk001212
vm_t *lastVM = NULL; // bk001212
vm_t *currentVM = NULL;
vm_t *lastVM = NULL;
int vm_debugLevel;
#define MAX_VM 3
@ -543,13 +543,6 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
Q_strncpyz( vm->name, module, sizeof( vm->name ) );
vm->systemCall = systemCalls;
// never allow dll loading with a demo
if ( interpret == VMI_NATIVE ) {
if ( Cvar_VariableValue( "fs_restrict" ) ) {
interpret = VMI_COMPILED;
}
}
if ( interpret == VMI_NATIVE ) {
// try to load as a system dll
Com_Printf( "Loading dll file %s.\n", vm->name );
@ -655,7 +648,7 @@ void *VM_ArgPtr( intptr_t intValue ) {
if ( !intValue ) {
return NULL;
}
// bk001220 - currentVM is missing on reconnect
// currentVM is missing on reconnect
if ( currentVM==NULL )
return NULL;
@ -672,7 +665,7 @@ void *VM_ExplicitArgPtr( vm_t *vm, intptr_t intValue ) {
return NULL;
}
// bk010124 - currentVM is missing on reconnect here as well?
// currentVM is missing on reconnect here as well?
if ( currentVM==NULL )
return NULL;
@ -773,7 +766,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
#endif
}
if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL
if ( oldVM != NULL )
currentVM = oldVM;
return r;
}

View file

@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "vm_local.h"
//#define DEBUG_VM
#ifdef DEBUG_VM // bk001204
#ifdef DEBUG_VM
static char *opnames[256] = {
"OP_UNDEF",

View file

@ -160,7 +160,6 @@ struct vm_s {
int breakFunction; // increment breakCount on function entry to this
int breakCount;
// fqpath member added 7/20/02 by T.Ray
char fqpath[MAX_QPATH+1] ;
byte *jumpTableTargets;

View file

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <windows.h>
#endif
#ifdef __FreeBSD__ // rb0101023
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
@ -77,13 +77,11 @@ static int asmCallPtr = (int)AsmCall;
#else // _MSC_VER
#if defined( FTOL_PTR )
// bk001213 - BEWARE: does not work! UI menu etc. broken - stack!
// bk001119 - added: int gftol( float x ) { return (int)x; }
int qftol( void ); // bk001213 - label, see unix/ftol.nasm
int qftol027F( void ); // bk001215 - fixed FPU control variants
int qftol( void );
int qftol027F( void );
int qftol037F( void );
int qftol0E7F( void ); // bk010102 - fixed bogus bits (duh)
int qftol0E7F( void );
int qftol0F7F( void );
@ -95,7 +93,7 @@ static int asmCallPtr = (int)doAsmCall;
#endif
static int callMask = 0; // bk001213 - init
static int callMask = 0;
static int instruction, pass;
static int lastConst = 0;
@ -1020,7 +1018,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
EmitString( "D9 1F" ); // fstp dword ptr [edi]
break;
case OP_CVFI:
#ifndef FTOL_PTR // WHENHELLISFROZENOVER // bk001213 - was used in 1.17
#ifndef FTOL_PTR // WHENHELLISFROZENOVER
// not IEEE complient, but simple and fast
EmitString( "D9 07" ); // fld dword ptr [edi]
EmitString( "DB 1F" ); // fistp dword ptr [edi]

View file

@ -109,7 +109,7 @@ static long callAsmCall(long callProgramStack, long callSyscallNum)
return ret;
}
#ifdef DEBUG_VM // bk001204
#ifdef DEBUG_VM
static char *opnames[256] = {
"OP_UNDEF",

View file

@ -26,11 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef __QGL_H__
#define __QGL_H__
#if defined( __LINT__ )
#include <GL/gl.h>
#elif defined( _WIN32 )
#if defined( _WIN32 )
#if _MSC_VER
#pragma warning (disable: 4201)
@ -43,6 +39,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <windows.h>
#include <GL/gl.h>
#include <GL/glext.h>
#elif defined(MACOS_X)
@ -53,41 +50,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <OpenGL/glext.h>
#endif
// This can be defined to use the CGLMacro.h support which avoids looking up
// the current context.
//#define USE_CGLMACROS
#ifdef USE_CGLMACROS
#include "macosx_local.h"
#define cgl_ctx glw_state._cgl_ctx
#include <OpenGL/CGLMacro.h>
#endif
#elif defined( __linux__ ) || defined(__FreeBSD__)
#include <GL/gl.h>
#include <GL/glx.h>
// bk001129 - from cvs1.17 (mkv)
#if defined(__FX__)
#include <GL/fxmesa.h>
#endif
#elif defined( __sun )
#include <GL/gl.h>
#include <GL/glx.h>
#else
#include <gl.h>
#include <GL/gl.h>
#include <GL/glext.h>
#endif
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef WINAPI
#define WINAPI
#endif
//===========================================================================
@ -109,6 +81,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#else
// FIXME GL_MAX_TEXTURE_UNITS_ARB?
#define GL_MAX_ACTIVE_TEXTURES_ARB 0x84E2
#endif /* defined(__sun) */
@ -122,9 +95,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define GL_CLAMP_TO_EDGE 0x812F
#endif
//===========================================================================
// S3TC compression constants
#define GL_RGB_S3TC 0x83A0
#define GL_RGB4_S3TC 0x83A1
// NOTE: some Linux platforms would need those prototypes
#if defined(MACOS_X) || ( defined(__sun) && defined(__sparc) )
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
@ -162,445 +136,351 @@ typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum target);
#endif
// TTimo - VC7 / XP ?
#ifdef WIN32
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum target);
#endif
/*
** extension constants
*/
// S3TC compression constants
#define GL_RGB_S3TC 0x83A0
#define GL_RGB4_S3TC 0x83A1
//===========================================================================
// extensions will be function pointers on all platforms
extern void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
extern void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
extern void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
extern void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
extern void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
extern void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
extern void ( APIENTRY * qglLockArraysEXT) (GLint, GLint);
extern void ( APIENTRY * qglUnlockArraysEXT) (void);
extern void ( APIENTRY * qglLockArraysEXT)( GLint, GLint);
extern void ( APIENTRY * qglUnlockArraysEXT) ( void );
//===========================================================================
// non-dlopening systems will just redefine qgl* to gl*
#if !defined( _WIN32 ) && !defined(MACOS_X) && !defined( __linux__ ) && !defined( __FreeBSD__ ) && !defined(__sun) // rb010123
#include "qgl_linked.h"
#elif (defined(MACOS_X) && !defined(USE_SDL_VIDEO))
// This includes #ifdefs for optional logging and GL error checking after every GL call as well as #defines to prevent incorrect usage of the non-'qgl' versions of the GL API.
#include "macosx_qgl.h"
#else
// windows systems use a function pointer for each call so we can load minidrivers
extern void ( APIENTRY * qglAccum )(GLenum op, GLfloat value);
extern void ( APIENTRY * qglAlphaFunc )(GLenum func, GLclampf ref);
extern GLboolean ( APIENTRY * qglAreTexturesResident )(GLsizei n, const GLuint *textures, GLboolean *residences);
extern void ( APIENTRY * qglArrayElement )(GLint i);
extern void ( APIENTRY * qglBegin )(GLenum mode);
extern void ( APIENTRY * qglBindTexture )(GLenum target, GLuint texture);
extern void ( APIENTRY * qglBitmap )(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
extern void ( APIENTRY * qglBlendFunc )(GLenum sfactor, GLenum dfactor);
extern void ( APIENTRY * qglCallList )(GLuint list);
extern void ( APIENTRY * qglCallLists )(GLsizei n, GLenum type, const GLvoid *lists);
extern void ( APIENTRY * qglClear )(GLbitfield mask);
extern void ( APIENTRY * qglClearAccum )(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
extern void ( APIENTRY * qglClearColor )(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
extern void ( APIENTRY * qglClearDepth )(GLclampd depth);
extern void ( APIENTRY * qglClearIndex )(GLfloat c);
extern void ( APIENTRY * qglClearStencil )(GLint s);
extern void ( APIENTRY * qglClipPlane )(GLenum plane, const GLdouble *equation);
extern void ( APIENTRY * qglColor3b )(GLbyte red, GLbyte green, GLbyte blue);
extern void ( APIENTRY * qglColor3bv )(const GLbyte *v);
extern void ( APIENTRY * qglColor3d )(GLdouble red, GLdouble green, GLdouble blue);
extern void ( APIENTRY * qglColor3dv )(const GLdouble *v);
extern void ( APIENTRY * qglColor3f )(GLfloat red, GLfloat green, GLfloat blue);
extern void ( APIENTRY * qglColor3fv )(const GLfloat *v);
extern void ( APIENTRY * qglColor3i )(GLint red, GLint green, GLint blue);
extern void ( APIENTRY * qglColor3iv )(const GLint *v);
extern void ( APIENTRY * qglColor3s )(GLshort red, GLshort green, GLshort blue);
extern void ( APIENTRY * qglColor3sv )(const GLshort *v);
extern void ( APIENTRY * qglColor3ub )(GLubyte red, GLubyte green, GLubyte blue);
extern void ( APIENTRY * qglColor3ubv )(const GLubyte *v);
extern void ( APIENTRY * qglColor3ui )(GLuint red, GLuint green, GLuint blue);
extern void ( APIENTRY * qglColor3uiv )(const GLuint *v);
extern void ( APIENTRY * qglColor3us )(GLushort red, GLushort green, GLushort blue);
extern void ( APIENTRY * qglColor3usv )(const GLushort *v);
extern void ( APIENTRY * qglColor4b )(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
extern void ( APIENTRY * qglColor4bv )(const GLbyte *v);
extern void ( APIENTRY * qglColor4d )(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
extern void ( APIENTRY * qglColor4dv )(const GLdouble *v);
extern void ( APIENTRY * qglColor4f )(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
extern void ( APIENTRY * qglColor4fv )(const GLfloat *v);
extern void ( APIENTRY * qglColor4i )(GLint red, GLint green, GLint blue, GLint alpha);
extern void ( APIENTRY * qglColor4iv )(const GLint *v);
extern void ( APIENTRY * qglColor4s )(GLshort red, GLshort green, GLshort blue, GLshort alpha);
extern void ( APIENTRY * qglColor4sv )(const GLshort *v);
extern void ( APIENTRY * qglColor4ub )(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
extern void ( APIENTRY * qglColor4ubv )(const GLubyte *v);
extern void ( APIENTRY * qglColor4ui )(GLuint red, GLuint green, GLuint blue, GLuint alpha);
extern void ( APIENTRY * qglColor4uiv )(const GLuint *v);
extern void ( APIENTRY * qglColor4us )(GLushort red, GLushort green, GLushort blue, GLushort alpha);
extern void ( APIENTRY * qglColor4usv )(const GLushort *v);
extern void ( APIENTRY * qglColorMask )(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
extern void ( APIENTRY * qglColorMaterial )(GLenum face, GLenum mode);
extern void ( APIENTRY * qglColorPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
extern void ( APIENTRY * qglCopyPixels )(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
extern void ( APIENTRY * qglCopyTexImage1D )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
extern void ( APIENTRY * qglCopyTexImage2D )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
extern void ( APIENTRY * qglCopyTexSubImage1D )(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
extern void ( APIENTRY * qglCopyTexSubImage2D )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
extern void ( APIENTRY * qglCullFace )(GLenum mode);
extern void ( APIENTRY * qglDeleteLists )(GLuint list, GLsizei range);
extern void ( APIENTRY * qglDeleteTextures )(GLsizei n, const GLuint *textures);
extern void ( APIENTRY * qglDepthFunc )(GLenum func);
extern void ( APIENTRY * qglDepthMask )(GLboolean flag);
extern void ( APIENTRY * qglDepthRange )(GLclampd zNear, GLclampd zFar);
extern void ( APIENTRY * qglDisable )(GLenum cap);
extern void ( APIENTRY * qglDisableClientState )(GLenum array);
extern void ( APIENTRY * qglDrawArrays )(GLenum mode, GLint first, GLsizei count);
extern void ( APIENTRY * qglDrawBuffer )(GLenum mode);
extern void ( APIENTRY * qglDrawElements )(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
extern void ( APIENTRY * qglDrawPixels )(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
extern void ( APIENTRY * qglEdgeFlag )(GLboolean flag);
extern void ( APIENTRY * qglEdgeFlagPointer )(GLsizei stride, const GLvoid *pointer);
extern void ( APIENTRY * qglEdgeFlagv )(const GLboolean *flag);
extern void ( APIENTRY * qglEnable )(GLenum cap);
extern void ( APIENTRY * qglEnableClientState )(GLenum array);
extern void ( APIENTRY * qglEnd )(void);
extern void ( APIENTRY * qglEndList )(void);
extern void ( APIENTRY * qglEvalCoord1d )(GLdouble u);
extern void ( APIENTRY * qglEvalCoord1dv )(const GLdouble *u);
extern void ( APIENTRY * qglEvalCoord1f )(GLfloat u);
extern void ( APIENTRY * qglEvalCoord1fv )(const GLfloat *u);
extern void ( APIENTRY * qglEvalCoord2d )(GLdouble u, GLdouble v);
extern void ( APIENTRY * qglEvalCoord2dv )(const GLdouble *u);
extern void ( APIENTRY * qglEvalCoord2f )(GLfloat u, GLfloat v);
extern void ( APIENTRY * qglEvalCoord2fv )(const GLfloat *u);
extern void ( APIENTRY * qglEvalMesh1 )(GLenum mode, GLint i1, GLint i2);
extern void ( APIENTRY * qglEvalMesh2 )(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
extern void ( APIENTRY * qglEvalPoint1 )(GLint i);
extern void ( APIENTRY * qglEvalPoint2 )(GLint i, GLint j);
extern void ( APIENTRY * qglFeedbackBuffer )(GLsizei size, GLenum type, GLfloat *buffer);
extern void ( APIENTRY * qglFinish )(void);
extern void ( APIENTRY * qglFlush )(void);
extern void ( APIENTRY * qglFogf )(GLenum pname, GLfloat param);
extern void ( APIENTRY * qglFogfv )(GLenum pname, const GLfloat *params);
extern void ( APIENTRY * qglFogi )(GLenum pname, GLint param);
extern void ( APIENTRY * qglFogiv )(GLenum pname, const GLint *params);
extern void ( APIENTRY * qglFrontFace )(GLenum mode);
extern void ( APIENTRY * qglFrustum )(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
extern GLuint ( APIENTRY * qglGenLists )(GLsizei range);
extern void ( APIENTRY * qglGenTextures )(GLsizei n, GLuint *textures);
extern void ( APIENTRY * qglGetBooleanv )(GLenum pname, GLboolean *params);
extern void ( APIENTRY * qglGetClipPlane )(GLenum plane, GLdouble *equation);
extern void ( APIENTRY * qglGetDoublev )(GLenum pname, GLdouble *params);
extern GLenum ( APIENTRY * qglGetError )(void);
extern void ( APIENTRY * qglGetFloatv )(GLenum pname, GLfloat *params);
extern void ( APIENTRY * qglGetIntegerv )(GLenum pname, GLint *params);
extern void ( APIENTRY * qglGetLightfv )(GLenum light, GLenum pname, GLfloat *params);
extern void ( APIENTRY * qglGetLightiv )(GLenum light, GLenum pname, GLint *params);
extern void ( APIENTRY * qglGetMapdv )(GLenum target, GLenum query, GLdouble *v);
extern void ( APIENTRY * qglGetMapfv )(GLenum target, GLenum query, GLfloat *v);
extern void ( APIENTRY * qglGetMapiv )(GLenum target, GLenum query, GLint *v);
extern void ( APIENTRY * qglGetMaterialfv )(GLenum face, GLenum pname, GLfloat *params);
extern void ( APIENTRY * qglGetMaterialiv )(GLenum face, GLenum pname, GLint *params);
extern void ( APIENTRY * qglGetPixelMapfv )(GLenum map, GLfloat *values);
extern void ( APIENTRY * qglGetPixelMapuiv )(GLenum map, GLuint *values);
extern void ( APIENTRY * qglGetPixelMapusv )(GLenum map, GLushort *values);
extern void ( APIENTRY * qglGetPointerv )(GLenum pname, GLvoid* *params);
extern void ( APIENTRY * qglGetPolygonStipple )(GLubyte *mask);
extern const GLubyte * ( APIENTRY * qglGetString )(GLenum name);
extern void ( APIENTRY * qglGetTexEnvfv )(GLenum target, GLenum pname, GLfloat *params);
extern void ( APIENTRY * qglGetTexEnviv )(GLenum target, GLenum pname, GLint *params);
extern void ( APIENTRY * qglGetTexGendv )(GLenum coord, GLenum pname, GLdouble *params);
extern void ( APIENTRY * qglGetTexGenfv )(GLenum coord, GLenum pname, GLfloat *params);
extern void ( APIENTRY * qglGetTexGeniv )(GLenum coord, GLenum pname, GLint *params);
extern void ( APIENTRY * qglGetTexImage )(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
extern void ( APIENTRY * qglGetTexLevelParameterfv )(GLenum target, GLint level, GLenum pname, GLfloat *params);
extern void ( APIENTRY * qglGetTexLevelParameteriv )(GLenum target, GLint level, GLenum pname, GLint *params);
extern void ( APIENTRY * qglGetTexParameterfv )(GLenum target, GLenum pname, GLfloat *params);
extern void ( APIENTRY * qglGetTexParameteriv )(GLenum target, GLenum pname, GLint *params);
extern void ( APIENTRY * qglHint )(GLenum target, GLenum mode);
extern void ( APIENTRY * qglIndexMask )(GLuint mask);
extern void ( APIENTRY * qglIndexPointer )(GLenum type, GLsizei stride, const GLvoid *pointer);
extern void ( APIENTRY * qglIndexd )(GLdouble c);
extern void ( APIENTRY * qglIndexdv )(const GLdouble *c);
extern void ( APIENTRY * qglIndexf )(GLfloat c);
extern void ( APIENTRY * qglIndexfv )(const GLfloat *c);
extern void ( APIENTRY * qglIndexi )(GLint c);
extern void ( APIENTRY * qglIndexiv )(const GLint *c);
extern void ( APIENTRY * qglIndexs )(GLshort c);
extern void ( APIENTRY * qglIndexsv )(const GLshort *c);
extern void ( APIENTRY * qglIndexub )(GLubyte c);
extern void ( APIENTRY * qglIndexubv )(const GLubyte *c);
extern void ( APIENTRY * qglInitNames )(void);
extern void ( APIENTRY * qglInterleavedArrays )(GLenum format, GLsizei stride, const GLvoid *pointer);
extern GLboolean ( APIENTRY * qglIsEnabled )(GLenum cap);
extern GLboolean ( APIENTRY * qglIsList )(GLuint list);
extern GLboolean ( APIENTRY * qglIsTexture )(GLuint texture);
extern void ( APIENTRY * qglLightModelf )(GLenum pname, GLfloat param);
extern void ( APIENTRY * qglLightModelfv )(GLenum pname, const GLfloat *params);
extern void ( APIENTRY * qglLightModeli )(GLenum pname, GLint param);
extern void ( APIENTRY * qglLightModeliv )(GLenum pname, const GLint *params);
extern void ( APIENTRY * qglLightf )(GLenum light, GLenum pname, GLfloat param);
extern void ( APIENTRY * qglLightfv )(GLenum light, GLenum pname, const GLfloat *params);
extern void ( APIENTRY * qglLighti )(GLenum light, GLenum pname, GLint param);
extern void ( APIENTRY * qglLightiv )(GLenum light, GLenum pname, const GLint *params);
extern void ( APIENTRY * qglLineStipple )(GLint factor, GLushort pattern);
extern void ( APIENTRY * qglLineWidth )(GLfloat width);
extern void ( APIENTRY * qglListBase )(GLuint base);
extern void ( APIENTRY * qglLoadIdentity )(void);
extern void ( APIENTRY * qglLoadMatrixd )(const GLdouble *m);
extern void ( APIENTRY * qglLoadMatrixf )(const GLfloat *m);
extern void ( APIENTRY * qglLoadName )(GLuint name);
extern void ( APIENTRY * qglLogicOp )(GLenum opcode);
extern void ( APIENTRY * qglMap1d )(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
extern void ( APIENTRY * qglMap1f )(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
extern void ( APIENTRY * qglMap2d )(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
extern void ( APIENTRY * qglMap2f )(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
extern void ( APIENTRY * qglMapGrid1d )(GLint un, GLdouble u1, GLdouble u2);
extern void ( APIENTRY * qglMapGrid1f )(GLint un, GLfloat u1, GLfloat u2);
extern void ( APIENTRY * qglMapGrid2d )(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
extern void ( APIENTRY * qglMapGrid2f )(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
extern void ( APIENTRY * qglMaterialf )(GLenum face, GLenum pname, GLfloat param);
extern void ( APIENTRY * qglMaterialfv )(GLenum face, GLenum pname, const GLfloat *params);
extern void ( APIENTRY * qglMateriali )(GLenum face, GLenum pname, GLint param);
extern void ( APIENTRY * qglMaterialiv )(GLenum face, GLenum pname, const GLint *params);
extern void ( APIENTRY * qglMatrixMode )(GLenum mode);
extern void ( APIENTRY * qglMultMatrixd )(const GLdouble *m);
extern void ( APIENTRY * qglMultMatrixf )(const GLfloat *m);
extern void ( APIENTRY * qglNewList )(GLuint list, GLenum mode);
extern void ( APIENTRY * qglNormal3b )(GLbyte nx, GLbyte ny, GLbyte nz);
extern void ( APIENTRY * qglNormal3bv )(const GLbyte *v);
extern void ( APIENTRY * qglNormal3d )(GLdouble nx, GLdouble ny, GLdouble nz);
extern void ( APIENTRY * qglNormal3dv )(const GLdouble *v);
extern void ( APIENTRY * qglNormal3f )(GLfloat nx, GLfloat ny, GLfloat nz);
extern void ( APIENTRY * qglNormal3fv )(const GLfloat *v);
extern void ( APIENTRY * qglNormal3i )(GLint nx, GLint ny, GLint nz);
extern void ( APIENTRY * qglNormal3iv )(const GLint *v);
extern void ( APIENTRY * qglNormal3s )(GLshort nx, GLshort ny, GLshort nz);
extern void ( APIENTRY * qglNormal3sv )(const GLshort *v);
extern void ( APIENTRY * qglNormalPointer )(GLenum type, GLsizei stride, const GLvoid *pointer);
extern void ( APIENTRY * qglOrtho )(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
extern void ( APIENTRY * qglPassThrough )(GLfloat token);
extern void ( APIENTRY * qglPixelMapfv )(GLenum map, GLsizei mapsize, const GLfloat *values);
extern void ( APIENTRY * qglPixelMapuiv )(GLenum map, GLsizei mapsize, const GLuint *values);
extern void ( APIENTRY * qglPixelMapusv )(GLenum map, GLsizei mapsize, const GLushort *values);
extern void ( APIENTRY * qglPixelStoref )(GLenum pname, GLfloat param);
extern void ( APIENTRY * qglPixelStorei )(GLenum pname, GLint param);
extern void ( APIENTRY * qglPixelTransferf )(GLenum pname, GLfloat param);
extern void ( APIENTRY * qglPixelTransferi )(GLenum pname, GLint param);
extern void ( APIENTRY * qglPixelZoom )(GLfloat xfactor, GLfloat yfactor);
extern void ( APIENTRY * qglPointSize )(GLfloat size);
extern void ( APIENTRY * qglPolygonMode )(GLenum face, GLenum mode);
extern void ( APIENTRY * qglPolygonOffset )(GLfloat factor, GLfloat units);
extern void ( APIENTRY * qglPolygonStipple )(const GLubyte *mask);
extern void ( APIENTRY * qglPopAttrib )(void);
extern void ( APIENTRY * qglPopClientAttrib )(void);
extern void ( APIENTRY * qglPopMatrix )(void);
extern void ( APIENTRY * qglPopName )(void);
extern void ( APIENTRY * qglPrioritizeTextures )(GLsizei n, const GLuint *textures, const GLclampf *priorities);
extern void ( APIENTRY * qglPushAttrib )(GLbitfield mask);
extern void ( APIENTRY * qglPushClientAttrib )(GLbitfield mask);
extern void ( APIENTRY * qglPushMatrix )(void);
extern void ( APIENTRY * qglPushName )(GLuint name);
extern void ( APIENTRY * qglRasterPos2d )(GLdouble x, GLdouble y);
extern void ( APIENTRY * qglRasterPos2dv )(const GLdouble *v);
extern void ( APIENTRY * qglRasterPos2f )(GLfloat x, GLfloat y);
extern void ( APIENTRY * qglRasterPos2fv )(const GLfloat *v);
extern void ( APIENTRY * qglRasterPos2i )(GLint x, GLint y);
extern void ( APIENTRY * qglRasterPos2iv )(const GLint *v);
extern void ( APIENTRY * qglRasterPos2s )(GLshort x, GLshort y);
extern void ( APIENTRY * qglRasterPos2sv )(const GLshort *v);
extern void ( APIENTRY * qglRasterPos3d )(GLdouble x, GLdouble y, GLdouble z);
extern void ( APIENTRY * qglRasterPos3dv )(const GLdouble *v);
extern void ( APIENTRY * qglRasterPos3f )(GLfloat x, GLfloat y, GLfloat z);
extern void ( APIENTRY * qglRasterPos3fv )(const GLfloat *v);
extern void ( APIENTRY * qglRasterPos3i )(GLint x, GLint y, GLint z);
extern void ( APIENTRY * qglRasterPos3iv )(const GLint *v);
extern void ( APIENTRY * qglRasterPos3s )(GLshort x, GLshort y, GLshort z);
extern void ( APIENTRY * qglRasterPos3sv )(const GLshort *v);
extern void ( APIENTRY * qglRasterPos4d )(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern void ( APIENTRY * qglRasterPos4dv )(const GLdouble *v);
extern void ( APIENTRY * qglRasterPos4f )(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern void ( APIENTRY * qglRasterPos4fv )(const GLfloat *v);
extern void ( APIENTRY * qglRasterPos4i )(GLint x, GLint y, GLint z, GLint w);
extern void ( APIENTRY * qglRasterPos4iv )(const GLint *v);
extern void ( APIENTRY * qglRasterPos4s )(GLshort x, GLshort y, GLshort z, GLshort w);
extern void ( APIENTRY * qglRasterPos4sv )(const GLshort *v);
extern void ( APIENTRY * qglReadBuffer )(GLenum mode);
extern void ( APIENTRY * qglReadPixels )(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
extern void ( APIENTRY * qglRectd )(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
extern void ( APIENTRY * qglRectdv )(const GLdouble *v1, const GLdouble *v2);
extern void ( APIENTRY * qglRectf )(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
extern void ( APIENTRY * qglRectfv )(const GLfloat *v1, const GLfloat *v2);
extern void ( APIENTRY * qglRecti )(GLint x1, GLint y1, GLint x2, GLint y2);
extern void ( APIENTRY * qglRectiv )(const GLint *v1, const GLint *v2);
extern void ( APIENTRY * qglRects )(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
extern void ( APIENTRY * qglRectsv )(const GLshort *v1, const GLshort *v2);
extern GLint ( APIENTRY * qglRenderMode )(GLenum mode);
extern void ( APIENTRY * qglRotated )(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
extern void ( APIENTRY * qglRotatef )(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
extern void ( APIENTRY * qglScaled )(GLdouble x, GLdouble y, GLdouble z);
extern void ( APIENTRY * qglScalef )(GLfloat x, GLfloat y, GLfloat z);
extern void ( APIENTRY * qglScissor )(GLint x, GLint y, GLsizei width, GLsizei height);
extern void ( APIENTRY * qglSelectBuffer )(GLsizei size, GLuint *buffer);
extern void ( APIENTRY * qglShadeModel )(GLenum mode);
extern void ( APIENTRY * qglStencilFunc )(GLenum func, GLint ref, GLuint mask);
extern void ( APIENTRY * qglStencilMask )(GLuint mask);
extern void ( APIENTRY * qglStencilOp )(GLenum fail, GLenum zfail, GLenum zpass);
extern void ( APIENTRY * qglTexCoord1d )(GLdouble s);
extern void ( APIENTRY * qglTexCoord1dv )(const GLdouble *v);
extern void ( APIENTRY * qglTexCoord1f )(GLfloat s);
extern void ( APIENTRY * qglTexCoord1fv )(const GLfloat *v);
extern void ( APIENTRY * qglTexCoord1i )(GLint s);
extern void ( APIENTRY * qglTexCoord1iv )(const GLint *v);
extern void ( APIENTRY * qglTexCoord1s )(GLshort s);
extern void ( APIENTRY * qglTexCoord1sv )(const GLshort *v);
extern void ( APIENTRY * qglTexCoord2d )(GLdouble s, GLdouble t);
extern void ( APIENTRY * qglTexCoord2dv )(const GLdouble *v);
extern void ( APIENTRY * qglTexCoord2f )(GLfloat s, GLfloat t);
extern void ( APIENTRY * qglTexCoord2fv )(const GLfloat *v);
extern void ( APIENTRY * qglTexCoord2i )(GLint s, GLint t);
extern void ( APIENTRY * qglTexCoord2iv )(const GLint *v);
extern void ( APIENTRY * qglTexCoord2s )(GLshort s, GLshort t);
extern void ( APIENTRY * qglTexCoord2sv )(const GLshort *v);
extern void ( APIENTRY * qglTexCoord3d )(GLdouble s, GLdouble t, GLdouble r);
extern void ( APIENTRY * qglTexCoord3dv )(const GLdouble *v);
extern void ( APIENTRY * qglTexCoord3f )(GLfloat s, GLfloat t, GLfloat r);
extern void ( APIENTRY * qglTexCoord3fv )(const GLfloat *v);
extern void ( APIENTRY * qglTexCoord3i )(GLint s, GLint t, GLint r);
extern void ( APIENTRY * qglTexCoord3iv )(const GLint *v);
extern void ( APIENTRY * qglTexCoord3s )(GLshort s, GLshort t, GLshort r);
extern void ( APIENTRY * qglTexCoord3sv )(const GLshort *v);
extern void ( APIENTRY * qglTexCoord4d )(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
extern void ( APIENTRY * qglTexCoord4dv )(const GLdouble *v);
extern void ( APIENTRY * qglTexCoord4f )(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
extern void ( APIENTRY * qglTexCoord4fv )(const GLfloat *v);
extern void ( APIENTRY * qglTexCoord4i )(GLint s, GLint t, GLint r, GLint q);
extern void ( APIENTRY * qglTexCoord4iv )(const GLint *v);
extern void ( APIENTRY * qglTexCoord4s )(GLshort s, GLshort t, GLshort r, GLshort q);
extern void ( APIENTRY * qglTexCoord4sv )(const GLshort *v);
extern void ( APIENTRY * qglTexCoordPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
extern void ( APIENTRY * qglTexEnvf )(GLenum target, GLenum pname, GLfloat param);
extern void ( APIENTRY * qglTexEnvfv )(GLenum target, GLenum pname, const GLfloat *params);
extern void ( APIENTRY * qglTexEnvi )(GLenum target, GLenum pname, GLint param);
extern void ( APIENTRY * qglTexEnviv )(GLenum target, GLenum pname, const GLint *params);
extern void ( APIENTRY * qglTexGend )(GLenum coord, GLenum pname, GLdouble param);
extern void ( APIENTRY * qglTexGendv )(GLenum coord, GLenum pname, const GLdouble *params);
extern void ( APIENTRY * qglTexGenf )(GLenum coord, GLenum pname, GLfloat param);
extern void ( APIENTRY * qglTexGenfv )(GLenum coord, GLenum pname, const GLfloat *params);
extern void ( APIENTRY * qglTexGeni )(GLenum coord, GLenum pname, GLint param);
extern void ( APIENTRY * qglTexGeniv )(GLenum coord, GLenum pname, const GLint *params);
extern void ( APIENTRY * qglTexImage1D )(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
extern void ( APIENTRY * qglTexImage2D )(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
extern void ( APIENTRY * qglTexParameterf )(GLenum target, GLenum pname, GLfloat param);
extern void ( APIENTRY * qglTexParameterfv )(GLenum target, GLenum pname, const GLfloat *params);
extern void ( APIENTRY * qglTexParameteri )(GLenum target, GLenum pname, GLint param);
extern void ( APIENTRY * qglTexParameteriv )(GLenum target, GLenum pname, const GLint *params);
extern void ( APIENTRY * qglTexSubImage1D )(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
extern void ( APIENTRY * qglTexSubImage2D )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
extern void ( APIENTRY * qglTranslated )(GLdouble x, GLdouble y, GLdouble z);
extern void ( APIENTRY * qglTranslatef )(GLfloat x, GLfloat y, GLfloat z);
extern void ( APIENTRY * qglVertex2d )(GLdouble x, GLdouble y);
extern void ( APIENTRY * qglVertex2dv )(const GLdouble *v);
extern void ( APIENTRY * qglVertex2f )(GLfloat x, GLfloat y);
extern void ( APIENTRY * qglVertex2fv )(const GLfloat *v);
extern void ( APIENTRY * qglVertex2i )(GLint x, GLint y);
extern void ( APIENTRY * qglVertex2iv )(const GLint *v);
extern void ( APIENTRY * qglVertex2s )(GLshort x, GLshort y);
extern void ( APIENTRY * qglVertex2sv )(const GLshort *v);
extern void ( APIENTRY * qglVertex3d )(GLdouble x, GLdouble y, GLdouble z);
extern void ( APIENTRY * qglVertex3dv )(const GLdouble *v);
extern void ( APIENTRY * qglVertex3f )(GLfloat x, GLfloat y, GLfloat z);
extern void ( APIENTRY * qglVertex3fv )(const GLfloat *v);
extern void ( APIENTRY * qglVertex3i )(GLint x, GLint y, GLint z);
extern void ( APIENTRY * qglVertex3iv )(const GLint *v);
extern void ( APIENTRY * qglVertex3s )(GLshort x, GLshort y, GLshort z);
extern void ( APIENTRY * qglVertex3sv )(const GLshort *v);
extern void ( APIENTRY * qglVertex4d )(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern void ( APIENTRY * qglVertex4dv )(const GLdouble *v);
extern void ( APIENTRY * qglVertex4f )(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern void ( APIENTRY * qglVertex4fv )(const GLfloat *v);
extern void ( APIENTRY * qglVertex4i )(GLint x, GLint y, GLint z, GLint w);
extern void ( APIENTRY * qglVertex4iv )(const GLint *v);
extern void ( APIENTRY * qglVertex4s )(GLshort x, GLshort y, GLshort z, GLshort w);
extern void ( APIENTRY * qglVertex4sv )(const GLshort *v);
extern void ( APIENTRY * qglVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
extern void ( APIENTRY * qglViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
#if defined( _WIN32 )
extern int ( WINAPI * qwglChoosePixelFormat )(HDC, CONST PIXELFORMATDESCRIPTOR *);
extern int ( WINAPI * qwglDescribePixelFormat) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
extern int ( WINAPI * qwglGetPixelFormat)(HDC);
extern BOOL ( WINAPI * qwglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
extern BOOL ( WINAPI * qwglSwapBuffers)(HDC);
extern BOOL ( WINAPI * qwglGetDeviceGammaRamp3DFX)( HDC, LPVOID );
extern BOOL ( WINAPI * qwglSetDeviceGammaRamp3DFX)( HDC, LPVOID );
extern BOOL ( WINAPI * qwglCopyContext)(HGLRC, HGLRC, UINT);
extern HGLRC ( WINAPI * qwglCreateContext)(HDC);
extern HGLRC ( WINAPI * qwglCreateLayerContext)(HDC, int);
extern BOOL ( WINAPI * qwglDeleteContext)(HGLRC);
extern HGLRC ( WINAPI * qwglGetCurrentContext)(VOID);
extern HDC ( WINAPI * qwglGetCurrentDC)(VOID);
extern PROC ( WINAPI * qwglGetProcAddress)(LPCSTR);
extern BOOL ( WINAPI * qwglMakeCurrent)(HDC, HGLRC);
extern BOOL ( WINAPI * qwglShareLists)(HGLRC, HGLRC);
extern BOOL ( WINAPI * qwglUseFontBitmaps)(HDC, DWORD, DWORD, DWORD);
extern BOOL ( WINAPI * qwglUseFontOutlines)(HDC, DWORD, DWORD, DWORD, FLOAT,
FLOAT, int, LPGLYPHMETRICSFLOAT);
extern BOOL ( WINAPI * qwglDescribeLayerPlane)(HDC, int, int, UINT,
LPLAYERPLANEDESCRIPTOR);
extern int ( WINAPI * qwglSetLayerPaletteEntries)(HDC, int, int, int,
CONST COLORREF *);
extern int ( WINAPI * qwglGetLayerPaletteEntries)(HDC, int, int, int,
COLORREF *);
extern BOOL ( WINAPI * qwglRealizeLayerPalette)(HDC, int, BOOL);
extern BOOL ( WINAPI * qwglSwapLayerBuffers)(HDC, UINT);
extern BOOL ( WINAPI * qwglSwapIntervalEXT)( int interval );
#endif // _WIN32
#if ( (defined __linux__ ) || (defined __FreeBSD__ ) || (defined __sun) ) // rb010123
//FX Mesa Functions
// bk001129 - from cvs1.17 (mkv)
#if defined (__FX__)
extern fxMesaContext (*qfxMesaCreateContext)(GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]);
extern fxMesaContext (*qfxMesaCreateBestContext)(GLuint win, GLint width, GLint height, const GLint attribList[]);
extern void (*qfxMesaDestroyContext)(fxMesaContext ctx);
extern void (*qfxMesaMakeCurrent)(fxMesaContext ctx);
extern fxMesaContext (*qfxMesaGetCurrentContext)(void);
extern void (*qfxMesaSwapBuffers)(void);
#endif
//GLX Functions
extern XVisualInfo * (*qglXChooseVisual)( Display *dpy, int screen, int *attribList );
extern GLXContext (*qglXCreateContext)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
extern void (*qglXDestroyContext)( Display *dpy, GLXContext ctx );
extern Bool (*qglXMakeCurrent)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
extern void (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
extern void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
#endif // __linux__ || __FreeBSD__ || __sun // rb010123
#endif // _WIN32 && __linux__
#define qglAccum glAccum
#define qglAlphaFunc glAlphaFunc
#define qglAreTexturesResident glAreTexturesResident
#define qglArrayElement glArrayElement
#define qglBegin glBegin
#define qglBindTexture glBindTexture
#define qglBitmap glBitmap
#define qglBlendFunc glBlendFunc
#define qglCallList glCallList
#define qglCallLists glCallLists
#define qglClear glClear
#define qglClearAccum glClearAccum
#define qglClearColor glClearColor
#define qglClearDepth glClearDepth
#define qglClearIndex glClearIndex
#define qglClearStencil glClearStencil
#define qglClipPlane glClipPlane
#define qglColor3b glColor3b
#define qglColor3bv glColor3bv
#define qglColor3d glColor3d
#define qglColor3dv glColor3dv
#define qglColor3f glColor3f
#define qglColor3fv glColor3fv
#define qglColor3i glColor3i
#define qglColor3iv glColor3iv
#define qglColor3s glColor3s
#define qglColor3sv glColor3sv
#define qglColor3ub glColor3ub
#define qglColor3ubv glColor3ubv
#define qglColor3ui glColor3ui
#define qglColor3uiv glColor3uiv
#define qglColor3us glColor3us
#define qglColor3usv glColor3usv
#define qglColor4b glColor4b
#define qglColor4bv glColor4bv
#define qglColor4d glColor4d
#define qglColor4dv glColor4dv
#define qglColor4f glColor4f
#define qglColor4fv glColor4fv
#define qglColor4i glColor4i
#define qglColor4iv glColor4iv
#define qglColor4s glColor4s
#define qglColor4sv glColor4sv
#define qglColor4ub glColor4ub
#define qglColor4ubv glColor4ubv
#define qglColor4ui glColor4ui
#define qglColor4uiv glColor4uiv
#define qglColor4us glColor4us
#define qglColor4usv glColor4usv
#define qglColorMask glColorMask
#define qglColorMaterial glColorMaterial
#define qglColorPointer glColorPointer
#define qglCopyPixels glCopyPixels
#define qglCopyTexImage1D glCopyTexImage1D
#define qglCopyTexImage2D glCopyTexImage2D
#define qglCopyTexSubImage1D glCopyTexSubImage1D
#define qglCopyTexSubImage2D glCopyTexSubImage2D
#define qglCullFace glCullFace
#define qglDeleteLists glDeleteLists
#define qglDeleteTextures glDeleteTextures
#define qglDepthFunc glDepthFunc
#define qglDepthMask glDepthMask
#define qglDepthRange glDepthRange
#define qglDisable glDisable
#define qglDisableClientState glDisableClientState
#define qglDrawArrays glDrawArrays
#define qglDrawBuffer glDrawBuffer
#define qglDrawElements glDrawElements
#define qglDrawPixels glDrawPixels
#define qglEdgeFlag glEdgeFlag
#define qglEdgeFlagPointer glEdgeFlagPointer
#define qglEdgeFlagv glEdgeFlagv
#define qglEnable glEnable
#define qglEnableClientState glEnableClientState
#define qglEnd glEnd
#define qglEndList glEndList
#define qglEvalCoord1d glEvalCoord1d
#define qglEvalCoord1dv glEvalCoord1dv
#define qglEvalCoord1f glEvalCoord1f
#define qglEvalCoord1fv glEvalCoord1fv
#define qglEvalCoord2d glEvalCoord2d
#define qglEvalCoord2dv glEvalCoord2dv
#define qglEvalCoord2f glEvalCoord2f
#define qglEvalCoord2fv glEvalCoord2fv
#define qglEvalMesh1 glEvalMesh1
#define qglEvalMesh2 glEvalMesh2
#define qglEvalPoint1 glEvalPoint1
#define qglEvalPoint2 glEvalPoint2
#define qglFeedbackBuffer glFeedbackBuffer
#define qglFinish glFinish
#define qglFlush glFlush
#define qglFogf glFogf
#define qglFogfv glFogfv
#define qglFogi glFogi
#define qglFogiv glFogiv
#define qglFrontFace glFrontFace
#define qglFrustum glFrustum
#define qglGenLists glGenLists
#define qglGenTextures glGenTextures
#define qglGetBooleanv glGetBooleanv
#define qglGetClipPlane glGetClipPlane
#define qglGetDoublev glGetDoublev
#define qglGetError glGetError
#define qglGetFloatv glGetFloatv
#define qglGetIntegerv glGetIntegerv
#define qglGetLightfv glGetLightfv
#define qglGetLightiv glGetLightiv
#define qglGetMapdv glGetMapdv
#define qglGetMapfv glGetMapfv
#define qglGetMapiv glGetMapiv
#define qglGetMaterialfv glGetMaterialfv
#define qglGetMaterialiv glGetMaterialiv
#define qglGetPixelMapfv glGetPixelMapfv
#define qglGetPixelMapuiv glGetPixelMapuiv
#define qglGetPixelMapusv glGetPixelMapusv
#define qglGetPointerv glGetPointerv
#define qglGetPolygonStipple glGetPolygonStipple
#define qglGetString glGetString
#define qglGetTexGendv glGetTexGendv
#define qglGetTexGenfv glGetTexGenfv
#define qglGetTexGeniv glGetTexGeniv
#define qglGetTexImage glGetTexImage
#define qglGetTexLevelParameterfv glGetTexLevelParameterfv
#define qglGetTexLevelParameteriv glGetTexLevelParameteriv
#define qglGetTexParameterfv glGetTexParameterfv
#define qglGetTexParameteriv glGetTexParameteriv
#define qglHint glHint
#define qglIndexMask glIndexMask
#define qglIndexPointer glIndexPointer
#define qglIndexd glIndexd
#define qglIndexdv glIndexdv
#define qglIndexf glIndexf
#define qglIndexfv glIndexfv
#define qglIndexi glIndexi
#define qglIndexiv glIndexiv
#define qglIndexs glIndexs
#define qglIndexsv glIndexsv
#define qglIndexub glIndexub
#define qglIndexubv glIndexubv
#define qglInitNames glInitNames
#define qglInterleavedArrays glInterleavedArrays
#define qglIsEnabled glIsEnabled
#define qglIsList glIsList
#define qglIsTexture glIsTexture
#define qglLightModelf glLightModelf
#define qglLightModelfv glLightModelfv
#define qglLightModeli glLightModeli
#define qglLightModeliv glLightModeliv
#define qglLightf glLightf
#define qglLightfv glLightfv
#define qglLighti glLighti
#define qglLightiv glLightiv
#define qglLineStipple glLineStipple
#define qglLineWidth glLineWidth
#define qglListBase glListBase
#define qglLoadIdentity glLoadIdentity
#define qglLoadMatrixd glLoadMatrixd
#define qglLoadMatrixf glLoadMatrixf
#define qglLoadName glLoadName
#define qglLogicOp glLogicOp
#define qglMap1d glMap1d
#define qglMap1f glMap1f
#define qglMap2d glMap2d
#define qglMap2f glMap2f
#define qglMapGrid1d glMapGrid1d
#define qglMapGrid1f glMapGrid1f
#define qglMapGrid2d glMapGrid2d
#define qglMapGrid2f glMapGrid2f
#define qglMaterialf glMaterialf
#define qglMaterialfv glMaterialfv
#define qglMateriali glMateriali
#define qglMaterialiv glMaterialiv
#define qglMatrixMode glMatrixMode
#define qglMultMatrixd glMultMatrixd
#define qglMultMatrixf glMultMatrixf
#define qglNewList glNewList
#define qglNormal3b glNormal3b
#define qglNormal3bv glNormal3bv
#define qglNormal3d glNormal3d
#define qglNormal3dv glNormal3dv
#define qglNormal3f glNormal3f
#define qglNormal3fv glNormal3fv
#define qglNormal3i glNormal3i
#define qglNormal3iv glNormal3iv
#define qglNormal3s glNormal3s
#define qglNormal3sv glNormal3sv
#define qglNormalPointer glNormalPointer
#define qglOrtho glOrtho
#define qglPassThrough glPassThrough
#define qglPixelMapfv glPixelMapfv
#define qglPixelMapuiv glPixelMapuiv
#define qglPixelMapusv glPixelMapusv
#define qglPixelStoref glPixelStoref
#define qglPixelStorei glPixelStorei
#define qglPixelTransferf glPixelTransferf
#define qglPixelTransferi glPixelTransferi
#define qglPixelZoom glPixelZoom
#define qglPointSize glPointSize
#define qglPolygonMode glPolygonMode
#define qglPolygonOffset glPolygonOffset
#define qglPolygonStipple glPolygonStipple
#define qglPopAttrib glPopAttrib
#define qglPopClientAttrib glPopClientAttrib
#define qglPopMatrix glPopMatrix
#define qglPopName glPopName
#define qglPrioritizeTextures glPrioritizeTextures
#define qglPushAttrib glPushAttrib
#define qglPushClientAttrib glPushClientAttrib
#define qglPushMatrix glPushMatrix
#define qglPushName glPushName
#define qglRasterPos2d glRasterPos2d
#define qglRasterPos2dv glRasterPos2dv
#define qglRasterPos2f glRasterPos2f
#define qglRasterPos2fv glRasterPos2fv
#define qglRasterPos2i glRasterPos2i
#define qglRasterPos2iv glRasterPos2iv
#define qglRasterPos2s glRasterPos2s
#define qglRasterPos2sv glRasterPos2sv
#define qglRasterPos3d glRasterPos3d
#define qglRasterPos3dv glRasterPos3dv
#define qglRasterPos3f glRasterPos3f
#define qglRasterPos3fv glRasterPos3fv
#define qglRasterPos3i glRasterPos3i
#define qglRasterPos3iv glRasterPos3iv
#define qglRasterPos3s glRasterPos3s
#define qglRasterPos3sv glRasterPos3sv
#define qglRasterPos4d glRasterPos4d
#define qglRasterPos4dv glRasterPos4dv
#define qglRasterPos4f glRasterPos4f
#define qglRasterPos4fv glRasterPos4fv
#define qglRasterPos4i glRasterPos4i
#define qglRasterPos4iv glRasterPos4iv
#define qglRasterPos4s glRasterPos4s
#define qglRasterPos4sv glRasterPos4sv
#define qglReadBuffer glReadBuffer
#define qglReadPixels glReadPixels
#define qglRectd glRectd
#define qglRectdv glRectdv
#define qglRectf glRectf
#define qglRectfv glRectfv
#define qglRecti glRecti
#define qglRectiv glRectiv
#define qglRects glRects
#define qglRectsv glRectsv
#define qglRenderMode glRenderMode
#define qglRotated glRotated
#define qglRotatef glRotatef
#define qglScaled glScaled
#define qglScalef glScalef
#define qglScissor glScissor
#define qglSelectBuffer glSelectBuffer
#define qglShadeModel glShadeModel
#define qglStencilFunc glStencilFunc
#define qglStencilMask glStencilMask
#define qglStencilOp glStencilOp
#define qglTexCoord1d glTexCoord1d
#define qglTexCoord1dv glTexCoord1dv
#define qglTexCoord1f glTexCoord1f
#define qglTexCoord1fv glTexCoord1fv
#define qglTexCoord1i glTexCoord1i
#define qglTexCoord1iv glTexCoord1iv
#define qglTexCoord1s glTexCoord1s
#define qglTexCoord1sv glTexCoord1sv
#define qglTexCoord2d glTexCoord2d
#define qglTexCoord2dv glTexCoord2dv
#define qglTexCoord2f glTexCoord2f
#define qglTexCoord2fv glTexCoord2fv
#define qglTexCoord2i glTexCoord2i
#define qglTexCoord2iv glTexCoord2iv
#define qglTexCoord2s glTexCoord2s
#define qglTexCoord2sv glTexCoord2sv
#define qglTexCoord3d glTexCoord3d
#define qglTexCoord3dv glTexCoord3dv
#define qglTexCoord3f glTexCoord3f
#define qglTexCoord3fv glTexCoord3fv
#define qglTexCoord3i glTexCoord3i
#define qglTexCoord3iv glTexCoord3iv
#define qglTexCoord3s glTexCoord3s
#define qglTexCoord3sv glTexCoord3sv
#define qglTexCoord4d glTexCoord4d
#define qglTexCoord4dv glTexCoord4dv
#define qglTexCoord4f glTexCoord4f
#define qglTexCoord4fv glTexCoord4fv
#define qglTexCoord4i glTexCoord4i
#define qglTexCoord4iv glTexCoord4iv
#define qglTexCoord4s glTexCoord4s
#define qglTexCoord4sv glTexCoord4sv
#define qglTexCoordPointer glTexCoordPointer
#define qglTexEnvf glTexEnvf
#define qglTexEnvfv glTexEnvfv
#define qglTexEnvi glTexEnvi
#define qglTexEnviv glTexEnviv
#define qglTexGend glTexGend
#define qglTexGendv glTexGendv
#define qglTexGenf glTexGenf
#define qglTexGenfv glTexGenfv
#define qglTexGeni glTexGeni
#define qglTexGeniv glTexGeniv
#define qglTexImage1D glTexImage1D
#define qglTexImage2D glTexImage2D
#define qglTexParameterf glTexParameterf
#define qglTexParameterfv glTexParameterfv
#define qglTexParameteri glTexParameteri
#define qglTexParameteriv glTexParameteriv
#define qglTexSubImage1D glTexSubImage1D
#define qglTexSubImage2D glTexSubImage2D
#define qglTranslated glTranslated
#define qglTranslatef glTranslatef
#define qglVertex2d glVertex2d
#define qglVertex2dv glVertex2dv
#define qglVertex2f glVertex2f
#define qglVertex2fv glVertex2fv
#define qglVertex2i glVertex2i
#define qglVertex2iv glVertex2iv
#define qglVertex2s glVertex2s
#define qglVertex2sv glVertex2sv
#define qglVertex3d glVertex3d
#define qglVertex3dv glVertex3dv
#define qglVertex3f glVertex3f
#define qglVertex3fv glVertex3fv
#define qglVertex3i glVertex3i
#define qglVertex3iv glVertex3iv
#define qglVertex3s glVertex3s
#define qglVertex3sv glVertex3sv
#define qglVertex4d glVertex4d
#define qglVertex4dv glVertex4dv
#define qglVertex4f glVertex4f
#define qglVertex4fv glVertex4fv
#define qglVertex4i glVertex4i
#define qglVertex4iv glVertex4iv
#define qglVertex4s glVertex4s
#define qglVertex4sv glVertex4sv
#define qglVertexPointer glVertexPointer
#define qglViewport glViewport
#endif

View file

@ -1,357 +0,0 @@
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code 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.
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#define qglAccum glAccum
#define qglAlphaFunc glAlphaFunc
#define qglAreTexturesResident glAreTexturesResident
#define qglArrayElement glArrayElement
#define qglBegin glBegin
#define qglBindTexture glBindTexture
#define qglBitmap glBitmap
#define qglBlendFunc glBlendFunc
#define qglCallList glCallList
#define qglCallLists glCallLists
#define qglClear glClear
#define qglClearAccum glClearAccum
#define qglClearColor glClearColor
#define qglClearDepth glClearDepth
#define qglClearIndex glClearIndex
#define qglClearStencil glClearStencil
#define qglClipPlane glClipPlane
#define qglColor3b glColor3b
#define qglColor3bv glColor3bv
#define qglColor3d glColor3d
#define qglColor3dv glColor3dv
#define qglColor3f glColor3f
#define qglColor3fv glColor3fv
#define qglColor3i glColor3i
#define qglColor3iv glColor3iv
#define qglColor3s glColor3s
#define qglColor3sv glColor3sv
#define qglColor3ub glColor3ub
#define qglColor3ubv glColor3ubv
#define qglColor3ui glColor3ui
#define qglColor3uiv glColor3uiv
#define qglColor3us glColor3us
#define qglColor3usv glColor3usv
#define qglColor4b glColor4b
#define qglColor4bv glColor4bv
#define qglColor4d glColor4d
#define qglColor4dv glColor4dv
#define qglColor4f glColor4f
#define qglColor4fv glColor4fv
#define qglColor4i glColor4i
#define qglColor4iv glColor4iv
#define qglColor4s glColor4s
#define qglColor4sv glColor4sv
#define qglColor4ub glColor4ub
#define qglColor4ubv glColor4ubv
#define qglColor4ui glColor4ui
#define qglColor4uiv glColor4uiv
#define qglColor4us glColor4us
#define qglColor4usv glColor4usv
#define qglColorMask glColorMask
#define qglColorMaterial glColorMaterial
#define qglColorPointer glColorPointer
#define qglCopyPixels glCopyPixels
#define qglCopyTexImage1D glCopyTexImage1D
#define qglCopyTexImage2D glCopyTexImage2D
#define qglCopyTexSubImage1D glCopyTexSubImage1D
#define qglCopyTexSubImage2D glCopyTexSubImage2D
#define qglCullFace glCullFace
#define qglDeleteLists glDeleteLists
#define qglDeleteTextures glDeleteTextures
#define qglDepthFunc glDepthFunc
#define qglDepthMask glDepthMask
#define qglDepthRange glDepthRange
#define qglDisable glDisable
#define qglDisableClientState glDisableClientState
#define qglDrawArrays glDrawArrays
#define qglDrawBuffer glDrawBuffer
#define qglDrawElements glDrawElements
#define qglDrawPixels glDrawPixels
#define qglEdgeFlag glEdgeFlag
#define qglEdgeFlagPointer glEdgeFlagPointer
#define qglEdgeFlagv glEdgeFlagv
#define qglEnable glEnable
#define qglEnableClientState glEnableClientState
#define qglEnd glEnd
#define qglEndList glEndList
#define qglEvalCoord1d glEvalCoord1d
#define qglEvalCoord1dv glEvalCoord1dv
#define qglEvalCoord1f glEvalCoord1f
#define qglEvalCoord1fv glEvalCoord1fv
#define qglEvalCoord2d glEvalCoord2d
#define qglEvalCoord2dv glEvalCoord2dv
#define qglEvalCoord2f glEvalCoord2f
#define qglEvalCoord2fv glEvalCoord2fv
#define qglEvalMesh1 glEvalMesh1
#define qglEvalMesh2 glEvalMesh2
#define qglEvalPoint1 glEvalPoint1
#define qglEvalPoint2 glEvalPoint2
#define qglFeedbackBuffer glFeedbackBuffer
#define qglFinish glFinish
#define qglFlush glFlush
#define qglFogf glFogf
#define qglFogfv glFogfv
#define qglFogi glFogi
#define qglFogiv glFogiv
#define qglFrontFace glFrontFace
#define qglFrustum glFrustum
#define qglGenLists glGenLists
#define qglGenTextures glGenTextures
#define qglGetBooleanv glGetBooleanv
#define qglGetClipPlane glGetClipPlane
#define qglGetDoublev glGetDoublev
#define qglGetError glGetError
#define qglGetFloatv glGetFloatv
#define qglGetIntegerv glGetIntegerv
#define qglGetLightfv glGetLightfv
#define qglGetLightiv glGetLightiv
#define qglGetMapdv glGetMapdv
#define qglGetMapfv glGetMapfv
#define qglGetMapiv glGetMapiv
#define qglGetMaterialfv glGetMaterialfv
#define qglGetMaterialiv glGetMaterialiv
#define qglGetPixelMapfv glGetPixelMapfv
#define qglGetPixelMapuiv glGetPixelMapuiv
#define qglGetPixelMapusv glGetPixelMapusv
#define qglGetPointerv glGetPointerv
#define qglGetPolygonStipple glGetPolygonStipple
#define qglGetString glGetString
#define qglGetTexGendv glGetTexGendv
#define qglGetTexGenfv glGetTexGenfv
#define qglGetTexGeniv glGetTexGeniv
#define qglGetTexImage glGetTexImage
#define qglGetTexLevelParameterfv glGetTexLevelParameterfv
#define qglGetTexLevelParameteriv glGetTexLevelParameteriv
#define qglGetTexParameterfv glGetTexParameterfv
#define qglGetTexParameteriv glGetTexParameteriv
#define qglHint glHint
#define qglIndexMask glIndexMask
#define qglIndexPointer glIndexPointer
#define qglIndexd glIndexd
#define qglIndexdv glIndexdv
#define qglIndexf glIndexf
#define qglIndexfv glIndexfv
#define qglIndexi glIndexi
#define qglIndexiv glIndexiv
#define qglIndexs glIndexs
#define qglIndexsv glIndexsv
#define qglIndexub glIndexub
#define qglIndexubv glIndexubv
#define qglInitNames glInitNames
#define qglInterleavedArrays glInterleavedArrays
#define qglIsEnabled glIsEnabled
#define qglIsList glIsList
#define qglIsTexture glIsTexture
#define qglLightModelf glLightModelf
#define qglLightModelfv glLightModelfv
#define qglLightModeli glLightModeli
#define qglLightModeliv glLightModeliv
#define qglLightf glLightf
#define qglLightfv glLightfv
#define qglLighti glLighti
#define qglLightiv glLightiv
#define qglLineStipple glLineStipple
#define qglLineWidth glLineWidth
#define qglListBase glListBase
#define qglLoadIdentity glLoadIdentity
#define qglLoadMatrixd glLoadMatrixd
#define qglLoadMatrixf glLoadMatrixf
#define qglLoadName glLoadName
#define qglLogicOp glLogicOp
#define qglMap1d glMap1d
#define qglMap1f glMap1f
#define qglMap2d glMap2d
#define qglMap2f glMap2f
#define qglMapGrid1d glMapGrid1d
#define qglMapGrid1f glMapGrid1f
#define qglMapGrid2d glMapGrid2d
#define qglMapGrid2f glMapGrid2f
#define qglMaterialf glMaterialf
#define qglMaterialfv glMaterialfv
#define qglMateriali glMateriali
#define qglMaterialiv glMaterialiv
#define qglMatrixMode glMatrixMode
#define qglMultMatrixd glMultMatrixd
#define qglMultMatrixf glMultMatrixf
#define qglNewList glNewList
#define qglNormal3b glNormal3b
#define qglNormal3bv glNormal3bv
#define qglNormal3d glNormal3d
#define qglNormal3dv glNormal3dv
#define qglNormal3f glNormal3f
#define qglNormal3fv glNormal3fv
#define qglNormal3i glNormal3i
#define qglNormal3iv glNormal3iv
#define qglNormal3s glNormal3s
#define qglNormal3sv glNormal3sv
#define qglNormalPointer glNormalPointer
#define qglOrtho glOrtho
#define qglPassThrough glPassThrough
#define qglPixelMapfv glPixelMapfv
#define qglPixelMapuiv glPixelMapuiv
#define qglPixelMapusv glPixelMapusv
#define qglPixelStoref glPixelStoref
#define qglPixelStorei glPixelStorei
#define qglPixelTransferf glPixelTransferf
#define qglPixelTransferi glPixelTransferi
#define qglPixelZoom glPixelZoom
#define qglPointSize glPointSize
#define qglPolygonMode glPolygonMode
#define qglPolygonOffset glPolygonOffset
#define qglPolygonStipple glPolygonStipple
#define qglPopAttrib glPopAttrib
#define qglPopClientAttrib glPopClientAttrib
#define qglPopMatrix glPopMatrix
#define qglPopName glPopName
#define qglPrioritizeTextures glPrioritizeTextures
#define qglPushAttrib glPushAttrib
#define qglPushClientAttrib glPushClientAttrib
#define qglPushMatrix glPushMatrix
#define qglPushName glPushName
#define qglRasterPos2d glRasterPos2d
#define qglRasterPos2dv glRasterPos2dv
#define qglRasterPos2f glRasterPos2f
#define qglRasterPos2fv glRasterPos2fv
#define qglRasterPos2i glRasterPos2i
#define qglRasterPos2iv glRasterPos2iv
#define qglRasterPos2s glRasterPos2s
#define qglRasterPos2sv glRasterPos2sv
#define qglRasterPos3d glRasterPos3d
#define qglRasterPos3dv glRasterPos3dv
#define qglRasterPos3f glRasterPos3f
#define qglRasterPos3fv glRasterPos3fv
#define qglRasterPos3i glRasterPos3i
#define qglRasterPos3iv glRasterPos3iv
#define qglRasterPos3s glRasterPos3s
#define qglRasterPos3sv glRasterPos3sv
#define qglRasterPos4d glRasterPos4d
#define qglRasterPos4dv glRasterPos4dv
#define qglRasterPos4f glRasterPos4f
#define qglRasterPos4fv glRasterPos4fv
#define qglRasterPos4i glRasterPos4i
#define qglRasterPos4iv glRasterPos4iv
#define qglRasterPos4s glRasterPos4s
#define qglRasterPos4sv glRasterPos4sv
#define qglReadBuffer glReadBuffer
#define qglReadPixels glReadPixels
#define qglRectd glRectd
#define qglRectdv glRectdv
#define qglRectf glRectf
#define qglRectfv glRectfv
#define qglRecti glRecti
#define qglRectiv glRectiv
#define qglRects glRects
#define qglRectsv glRectsv
#define qglRenderMode glRenderMode
#define qglRotated glRotated
#define qglRotatef glRotatef
#define qglScaled glScaled
#define qglScalef glScalef
#define qglScissor glScissor
#define qglSelectBuffer glSelectBuffer
#define qglShadeModel glShadeModel
#define qglStencilFunc glStencilFunc
#define qglStencilMask glStencilMask
#define qglStencilOp glStencilOp
#define qglTexCoord1d glTexCoord1d
#define qglTexCoord1dv glTexCoord1dv
#define qglTexCoord1f glTexCoord1f
#define qglTexCoord1fv glTexCoord1fv
#define qglTexCoord1i glTexCoord1i
#define qglTexCoord1iv glTexCoord1iv
#define qglTexCoord1s glTexCoord1s
#define qglTexCoord1sv glTexCoord1sv
#define qglTexCoord2d glTexCoord2d
#define qglTexCoord2dv glTexCoord2dv
#define qglTexCoord2f glTexCoord2f
#define qglTexCoord2fv glTexCoord2fv
#define qglTexCoord2i glTexCoord2i
#define qglTexCoord2iv glTexCoord2iv
#define qglTexCoord2s glTexCoord2s
#define qglTexCoord2sv glTexCoord2sv
#define qglTexCoord3d glTexCoord3d
#define qglTexCoord3dv glTexCoord3dv
#define qglTexCoord3f glTexCoord3f
#define qglTexCoord3fv glTexCoord3fv
#define qglTexCoord3i glTexCoord3i
#define qglTexCoord3iv glTexCoord3iv
#define qglTexCoord3s glTexCoord3s
#define qglTexCoord3sv glTexCoord3sv
#define qglTexCoord4d glTexCoord4d
#define qglTexCoord4dv glTexCoord4dv
#define qglTexCoord4f glTexCoord4f
#define qglTexCoord4fv glTexCoord4fv
#define qglTexCoord4i glTexCoord4i
#define qglTexCoord4iv glTexCoord4iv
#define qglTexCoord4s glTexCoord4s
#define qglTexCoord4sv glTexCoord4sv
#define qglTexCoordPointer glTexCoordPointer
#define qglTexEnvf glTexEnvf
#define qglTexEnvfv glTexEnvfv
#define qglTexEnvi glTexEnvi
#define qglTexEnviv glTexEnviv
#define qglTexGend glTexGend
#define qglTexGendv glTexGendv
#define qglTexGenf glTexGenf
#define qglTexGenfv glTexGenfv
#define qglTexGeni glTexGeni
#define qglTexGeniv glTexGeniv
#define qglTexImage1D glTexImage1D
#define qglTexImage2D glTexImage2D
#define qglTexParameterf glTexParameterf
#define qglTexParameterfv glTexParameterfv
#define qglTexParameteri glTexParameteri
#define qglTexParameteriv glTexParameteriv
#define qglTexSubImage1D glTexSubImage1D
#define qglTexSubImage2D glTexSubImage2D
#define qglTranslated glTranslated
#define qglTranslatef glTranslatef
#define qglVertex2d glVertex2d
#define qglVertex2dv glVertex2dv
#define qglVertex2f glVertex2f
#define qglVertex2fv glVertex2fv
#define qglVertex2i glVertex2i
#define qglVertex2iv glVertex2iv
#define qglVertex2s glVertex2s
#define qglVertex2sv glVertex2sv
#define qglVertex3d glVertex3d
#define qglVertex3dv glVertex3dv
#define qglVertex3f glVertex3f
#define qglVertex3fv glVertex3fv
#define qglVertex3i glVertex3i
#define qglVertex3iv glVertex3iv
#define qglVertex3s glVertex3s
#define qglVertex3sv glVertex3sv
#define qglVertex4d glVertex4d
#define qglVertex4dv glVertex4dv
#define qglVertex4f glVertex4f
#define qglVertex4fv glVertex4fv
#define qglVertex4i glVertex4i
#define qglVertex4iv glVertex4iv
#define qglVertex4s glVertex4s
#define qglVertex4sv glVertex4sv
#define qglVertexPointer glVertexPointer
#define qglViewport glViewport

View file

@ -118,7 +118,7 @@ void R_IssueRenderCommands( qboolean runPerformanceCounters ) {
renderCommandList_t *cmdList;
cmdList = &backEndData[tr.smpFrame]->commands;
assert(cmdList); // bk001205
assert(cmdList);
// add an end-of-list command
*(int *)(cmdList->cmds + cmdList->used) = RC_END_OF_LIST;

View file

@ -1358,7 +1358,6 @@ static void LoadTGA ( const char *name, byte **pic, int *width, int *height)
#if 0
// TTimo: this is the chunk of code to ensure a behavior that meets TGA specs
// bk0101024 - fix from Leonardo
// bit 5 set => top-down
if (targa_header.attributes & 0x20) {
unsigned char *flip = (unsigned char*)malloc (columns*4);
@ -4850,15 +4849,13 @@ void R_DeleteTextures( void ) {
tr.numImages = 0;
Com_Memset( glState.currenttextures, 0, sizeof( glState.currenttextures ) );
if ( qglBindTexture ) {
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
qglBindTexture( GL_TEXTURE_2D, 0 );
GL_SelectTexture( 0 );
qglBindTexture( GL_TEXTURE_2D, 0 );
} else {
qglBindTexture( GL_TEXTURE_2D, 0 );
}
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
qglBindTexture( GL_TEXTURE_2D, 0 );
GL_SelectTexture( 0 );
qglBindTexture( GL_TEXTURE_2D, 0 );
} else {
qglBindTexture( GL_TEXTURE_2D, 0 );
}
}

View file

@ -98,7 +98,6 @@ cvar_t *r_primitives;
cvar_t *r_texturebits;
cvar_t *r_drawBuffer;
cvar_t *r_glDriver;
cvar_t *r_lightmap;
cvar_t *r_vertexLight;
cvar_t *r_uiFullScreen;
@ -149,8 +148,6 @@ cvar_t *r_debugSort;
cvar_t *r_printShaders;
cvar_t *r_saveFontData;
cvar_t *r_GLlibCoolDownMsec;
cvar_t *r_maxpolys;
int max_polys;
cvar_t *r_maxpolyverts;
@ -197,7 +194,6 @@ static void InitOpenGL( void )
//
// GLimp_Init directly or indirectly references the following cvars:
// - r_fullscreen
// - r_glDriver
// - r_mode
// - r_(color|depth|stencil)bits
// - r_ignorehwgamma
@ -905,7 +901,6 @@ void R_Register( void )
//
// latched and archived variables
//
r_glDriver = ri.Cvar_Get( "r_glDriver", OPENGL_DRIVER_NAME, CVAR_ARCHIVE | CVAR_LATCH );
r_allowExtensions = ri.Cvar_Get( "r_allowExtensions", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_ext_compressed_textures = ri.Cvar_Get( "r_ext_compressed_textures", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_ext_gamma_control = ri.Cvar_Get( "r_ext_gamma_control", "1", CVAR_ARCHIVE | CVAR_LATCH );
@ -938,11 +933,7 @@ void R_Register( void )
r_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH );
#if USE_SDL_VIDEO
r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE );
#else
r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH );
#endif
r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
r_customPixelAspect = ri.Cvar_Get( "r_customPixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH );
@ -979,12 +970,8 @@ void R_Register( void )
r_dlightBacks = ri.Cvar_Get( "r_dlightBacks", "1", CVAR_ARCHIVE );
r_finish = ri.Cvar_Get ("r_finish", "0", CVAR_ARCHIVE);
r_textureMode = ri.Cvar_Get( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE );
#if USE_SDL_VIDEO
r_swapInterval = ri.Cvar_Get( "r_swapInterval", "0",
CVAR_ARCHIVE | CVAR_LATCH );
#else
r_swapInterval = ri.Cvar_Get( "r_swapInterval", "0", CVAR_ARCHIVE );
#endif
r_gamma = ri.Cvar_Get( "r_gamma", "1", CVAR_ARCHIVE );
r_facePlaneCull = ri.Cvar_Get ("r_facePlaneCull", "1", CVAR_ARCHIVE );
@ -1046,8 +1033,6 @@ void R_Register( void )
r_maxpolys = ri.Cvar_Get( "r_maxpolys", va("%d", MAX_POLYS), 0);
r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", va("%d", MAX_POLYVERTS), 0);
r_GLlibCoolDownMsec = ri.Cvar_Get( "r_GLlibCoolDownMsec", "0", CVAR_ARCHIVE );
// make sure all the commands added here are also
// removed in R_Shutdown
ri.Cmd_AddCommand( "imagelist", R_ImageList_f );

View file

@ -160,7 +160,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
VectorClear( ent->directedLight );
VectorClear( direction );
assert( tr.world->lightGridData ); // bk010103 - NULL with -nolight maps
assert( tr.world->lightGridData ); // NULL with -nolight maps
// trilerp the light value
gridStep[0] = 8;
@ -380,7 +380,6 @@ int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, ve
{
trRefEntity_t ent;
// bk010103 - this segfaults with -nolight maps
if ( tr.world->lightGridData == NULL )
return qfalse;

View file

@ -2360,7 +2360,7 @@ shader_t *R_FindShaderByName( const char *name ) {
int hash;
shader_t *sh;
if ( (name==NULL) || (name[0] == 0) ) { // bk001205
if ( (name==NULL) || (name[0] == 0) ) {
return tr.defaultShader;
}
@ -2770,7 +2770,7 @@ it and returns a valid (possibly default) shader_t to be used internally.
*/
shader_t *R_GetShaderByHandle( qhandle_t hShader ) {
if ( hShader < 0 ) {
ri.Printf( PRINT_WARNING, "R_GetShaderByHandle: out of range hShader '%d'\n", hShader ); // bk: FIXME name
ri.Printf( PRINT_WARNING, "R_GetShaderByHandle: out of range hShader '%d'\n", hShader );
return tr.defaultShader;
}
if ( hShader >= tr.numShaders ) {

View file

@ -202,33 +202,4 @@ typedef struct {
qboolean smpActive; // dual processor
} glconfig_t;
// FIXME: VM should be OS agnostic .. in theory
/*
#ifdef Q3_VM
#define _3DFX_DRIVER_NAME "Voodoo"
#define OPENGL_DRIVER_NAME "Default"
#elif defined(_WIN32)
*/
#if defined(Q3_VM) || defined(_WIN32)
#define _3DFX_DRIVER_NAME "3dfxvgl"
#define OPENGL_DRIVER_NAME "opengl32"
#elif defined(MACOS_X)
#define _3DFX_DRIVER_NAME "libMesaVoodooGL.dylib"
#define OPENGL_DRIVER_NAME "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
#else
#define _3DFX_DRIVER_NAME "libMesaVoodooGL.so"
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=524
#define OPENGL_DRIVER_NAME "libGL.so.1"
#endif // !defined _WIN32
#endif // __TR_TYPES_H

84
code/sdl/sdl_gamma.c Normal file
View file

@ -0,0 +1,84 @@
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code 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.
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "SDL.h"
#include "../renderer/tr_local.h"
#include "../qcommon/qcommon.h"
/*
=================
GLimp_SetGamma
=================
*/
void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned char blue[256] )
{
Uint16 table[3][256];
int i, j;
if( !glConfig.deviceSupportsGamma || r_ignorehwgamma->integer )
return;
for (i = 0; i < 256; i++)
{
table[0][i] = ( ( ( Uint16 ) red[i] ) << 8 ) | red[i];
table[1][i] = ( ( ( Uint16 ) green[i] ) << 8 ) | green[i];
table[2][i] = ( ( ( Uint16 ) blue[i] ) << 8 ) | blue[i];
}
#ifdef _WIN32
#include <windows.h>
// Win2K and newer put this odd restriction on gamma ramps...
OSVERSIONINFO vinfo;
vinfo.dwOSVersionInfoSize = sizeof( vinfo );
GetVersionEx( &vinfo );
if( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
{
Com_DPrintf( "performing gamma clamp.\n" );
for( j = 0 ; j < 3 ; j++ )
{
for( i = 0 ; i < 128 ; i++ )
{
if( table[ j ] [ i] > ( ( 128 + i ) << 8 ) )
table[ j ][ i ] = ( 128 + i ) << 8;
}
if( table[ j ] [127 ] > 254 << 8 )
table[ j ][ 127 ] = 254 << 8;
}
}
#endif
// enforce constantly increasing
for (j = 0; j < 3; j++)
{
for (i = 1; i < 256; i++)
{
if (table[j][i] < table[j][i-1])
table[j][i] = table[j][i-1];
}
}
SDL_SetGammaRamp(table[0], table[1], table[2]);
}

804
code/sdl/sdl_glimp.c Normal file
View file

@ -0,0 +1,804 @@
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code 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.
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "SDL.h"
#ifdef SMP
#include "SDL_thread.h"
#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "../renderer/tr_local.h"
#include "../client/client.h"
#include "../sys/sys_local.h"
#include "sdl_icon.h"
/* Just hack it for now. */
#ifdef MACOS_X
typedef CGLContextObj QGLContext;
#define GLimp_GetCurrentContext() CGLGetCurrentContext()
#define GLimp_SetCurrentContext(ctx) CGLSetCurrentContext(ctx)
#else
typedef void *QGLContext;
#define GLimp_GetCurrentContext() (NULL)
#define GLimp_SetCurrentContext(ctx)
#endif
static QGLContext opengl_context;
typedef enum
{
RSERR_OK,
RSERR_INVALID_FULLSCREEN,
RSERR_INVALID_MODE,
RSERR_UNKNOWN
} rserr_t;
static SDL_Surface *screen = NULL;
cvar_t *r_allowSoftwareGL; // Don't abort out if a hardware visual can't be obtained
void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
void ( APIENTRY * qglLockArraysEXT)( GLint, GLint);
void ( APIENTRY * qglUnlockArraysEXT) ( void );
/*
===============
GLimp_Shutdown
===============
*/
void GLimp_Shutdown( void )
{
IN_Shutdown();
SDL_QuitSubSystem( SDL_INIT_VIDEO );
screen = NULL;
memset( &glConfig, 0, sizeof( glConfig ) );
memset( &glState, 0, sizeof( glState ) );
}
/*
===============
GLimp_LogComment
===============
*/
void GLimp_LogComment( char *comment )
{
}
/*
===============
GLimp_SetMode
===============
*/
static int GLimp_SetMode( int mode, qboolean fullscreen )
{
const char* glstring;
int sdlcolorbits;
int colorbits, depthbits, stencilbits;
int tcolorbits, tdepthbits, tstencilbits;
int i = 0;
SDL_Surface *vidscreen = NULL;
ri.Printf( PRINT_ALL, "Initializing OpenGL display\n");
ri.Printf (PRINT_ALL, "...setting mode %d:", mode );
if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect, mode ) )
{
ri.Printf( PRINT_ALL, " invalid mode\n" );
return RSERR_INVALID_MODE;
}
ri.Printf( PRINT_ALL, " %d %d\n", glConfig.vidWidth, glConfig.vidHeight);
Uint32 flags = SDL_OPENGL;
if (fullscreen)
{
flags |= SDL_FULLSCREEN;
glConfig.isFullscreen = qtrue;
}
else
glConfig.isFullscreen = qfalse;
if (!r_colorbits->value)
colorbits = 24;
else
colorbits = r_colorbits->value;
if (!r_depthbits->value)
depthbits = 24;
else
depthbits = r_depthbits->value;
stencilbits = r_stencilbits->value;
for (i = 0; i < 16; i++)
{
// 0 - default
// 1 - minus colorbits
// 2 - minus depthbits
// 3 - minus stencil
if ((i % 4) == 0 && i)
{
// one pass, reduce
switch (i / 4)
{
case 2 :
if (colorbits == 24)
colorbits = 16;
break;
case 1 :
if (depthbits == 24)
depthbits = 16;
else if (depthbits == 16)
depthbits = 8;
case 3 :
if (stencilbits == 24)
stencilbits = 16;
else if (stencilbits == 16)
stencilbits = 8;
}
}
tcolorbits = colorbits;
tdepthbits = depthbits;
tstencilbits = stencilbits;
if ((i % 4) == 3)
{ // reduce colorbits
if (tcolorbits == 24)
tcolorbits = 16;
}
if ((i % 4) == 2)
{ // reduce depthbits
if (tdepthbits == 24)
tdepthbits = 16;
else if (tdepthbits == 16)
tdepthbits = 8;
}
if ((i % 4) == 1)
{ // reduce stencilbits
if (tstencilbits == 24)
tstencilbits = 16;
else if (tstencilbits == 16)
tstencilbits = 8;
else
tstencilbits = 0;
}
sdlcolorbits = 4;
if (tcolorbits == 24)
sdlcolorbits = 8;
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, sdlcolorbits );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, sdlcolorbits );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, sdlcolorbits );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, tdepthbits );
SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, tstencilbits );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
// If not allowing software GL, demand accelerated
if( !r_allowSoftwareGL->integer )
{
if( SDL_GL_SetAttribute( SDL_GL_ACCELERATED_VISUAL, 1 ) < 0 )
{
ri.Printf( PRINT_ALL, "Unable to guarantee accelerated "
"visual with libSDL < 1.2.10\n" );
}
}
if( SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, r_swapInterval->integer ) < 0 )
ri.Printf( PRINT_ALL, "r_swapInterval requires libSDL >= 1.2.10\n" );
#ifdef USE_ICON
{
SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(
(void *)CLIENT_WINDOW_ICON.pixel_data,
CLIENT_WINDOW_ICON.width,
CLIENT_WINDOW_ICON.height,
CLIENT_WINDOW_ICON.bytes_per_pixel * 8,
CLIENT_WINDOW_ICON.bytes_per_pixel * CLIENT_WINDOW_ICON.width,
#ifdef Q3_LITTLE_ENDIAN
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF
#else
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000
#endif
);
SDL_WM_SetIcon( icon, NULL );
SDL_FreeSurface( icon );
}
#endif
SDL_WM_SetCaption(CLIENT_WINDOW_TITLE, CLIENT_WINDOW_MIN_TITLE);
SDL_ShowCursor(0);
if (!(vidscreen = SDL_SetVideoMode(glConfig.vidWidth, glConfig.vidHeight, colorbits, flags)))
{
ri.Printf( PRINT_DEVELOPER, "SDL_SetVideoMode failed: %s\n", SDL_GetError( ) );
continue;
}
opengl_context = GLimp_GetCurrentContext();
ri.Printf( PRINT_ALL, "Using %d/%d/%d Color bits, %d depth, %d stencil display.\n",
sdlcolorbits, sdlcolorbits, sdlcolorbits, tdepthbits, tstencilbits);
glConfig.colorBits = tcolorbits;
glConfig.depthBits = tdepthbits;
glConfig.stencilBits = tstencilbits;
break;
}
if (!vidscreen)
{
ri.Printf( PRINT_ALL, "Couldn't get a visual\n" );
return RSERR_INVALID_MODE;
}
screen = vidscreen;
glstring = (char *) qglGetString (GL_RENDERER);
ri.Printf( PRINT_ALL, "GL_RENDERER: %s\n", glstring );
return RSERR_OK;
}
/*
===============
GLimp_StartDriverAndSetMode
===============
*/
static qboolean GLimp_StartDriverAndSetMode( int mode, qboolean fullscreen )
{
rserr_t err;
if (!SDL_WasInit(SDL_INIT_VIDEO))
{
ri.Printf( PRINT_ALL, "SDL_Init( SDL_INIT_VIDEO )... ");
if (SDL_Init(SDL_INIT_VIDEO) == -1)
{
ri.Printf( PRINT_ALL, "FAILED (%s)\n", SDL_GetError());
return qfalse;
}
ri.Printf( PRINT_ALL, "OK\n");
}
if (fullscreen && Cvar_VariableIntegerValue( "in_nograb" ) )
{
ri.Printf( PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n");
ri.Cvar_Set( "r_fullscreen", "0" );
r_fullscreen->modified = qfalse;
fullscreen = qfalse;
}
err = GLimp_SetMode( mode, fullscreen );
switch ( err )
{
case RSERR_INVALID_FULLSCREEN:
ri.Printf( PRINT_ALL, "...WARNING: fullscreen unavailable in this mode\n" );
return qfalse;
case RSERR_INVALID_MODE:
ri.Printf( PRINT_ALL, "...WARNING: could not set the given mode (%d)\n", mode );
return qfalse;
default:
break;
}
return qtrue;
}
/*
===============
GLimp_InitExtensions
===============
*/
static void GLimp_InitExtensions( void )
{
if ( !r_allowExtensions->integer )
{
ri.Printf( PRINT_ALL, "* IGNORING OPENGL EXTENSIONS *\n" );
return;
}
ri.Printf( PRINT_ALL, "Initializing OpenGL extensions\n" );
// GL_S3_s3tc
if ( Q_stristr( glConfig.extensions_string, "GL_S3_s3tc" ) )
{
if ( r_ext_compressed_textures->value )
{
glConfig.textureCompression = TC_S3TC;
ri.Printf( PRINT_ALL, "...using GL_S3_s3tc\n" );
}
else
{
glConfig.textureCompression = TC_NONE;
ri.Printf( PRINT_ALL, "...ignoring GL_S3_s3tc\n" );
}
}
else
{
glConfig.textureCompression = TC_NONE;
ri.Printf( PRINT_ALL, "...GL_S3_s3tc not found\n" );
}
// GL_EXT_texture_env_add
glConfig.textureEnvAddAvailable = qfalse;
if ( Q_stristr( glConfig.extensions_string, "EXT_texture_env_add" ) )
{
if ( r_ext_texture_env_add->integer )
{
glConfig.textureEnvAddAvailable = qtrue;
ri.Printf( PRINT_ALL, "...using GL_EXT_texture_env_add\n" );
}
else
{
glConfig.textureEnvAddAvailable = qfalse;
ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_env_add\n" );
}
}
else
{
ri.Printf( PRINT_ALL, "...GL_EXT_texture_env_add not found\n" );
}
// GL_ARB_multitexture
qglMultiTexCoord2fARB = NULL;
qglActiveTextureARB = NULL;
qglClientActiveTextureARB = NULL;
if ( Q_stristr( glConfig.extensions_string, "GL_ARB_multitexture" ) )
{
if ( r_ext_multitexture->value )
{
qglMultiTexCoord2fARB = ( PFNGLMULTITEXCOORD2FARBPROC ) SDL_GL_GetProcAddress( "glMultiTexCoord2fARB" );
qglActiveTextureARB = ( PFNGLACTIVETEXTUREARBPROC ) SDL_GL_GetProcAddress( "glActiveTextureARB" );
qglClientActiveTextureARB = ( PFNGLCLIENTACTIVETEXTUREARBPROC ) SDL_GL_GetProcAddress( "glClientActiveTextureARB" );
if ( qglActiveTextureARB )
{
GLint glint = 0;
qglGetIntegerv( GL_MAX_ACTIVE_TEXTURES_ARB, &glint );
glConfig.maxActiveTextures = (int) glint;
if ( glConfig.maxActiveTextures > 1 )
{
ri.Printf( PRINT_ALL, "...using GL_ARB_multitexture\n" );
}
else
{
qglMultiTexCoord2fARB = NULL;
qglActiveTextureARB = NULL;
qglClientActiveTextureARB = NULL;
ri.Printf( PRINT_ALL, "...not using GL_ARB_multitexture, < 2 texture units\n" );
}
}
}
else
{
ri.Printf( PRINT_ALL, "...ignoring GL_ARB_multitexture\n" );
}
}
else
{
ri.Printf( PRINT_ALL, "...GL_ARB_multitexture not found\n" );
}
// GL_EXT_compiled_vertex_array
if ( Q_stristr( glConfig.extensions_string, "GL_EXT_compiled_vertex_array" ) )
{
if ( r_ext_compiled_vertex_array->value )
{
ri.Printf( PRINT_ALL, "...using GL_EXT_compiled_vertex_array\n" );
qglLockArraysEXT = ( void ( APIENTRY * )( GLint, GLint ) ) SDL_GL_GetProcAddress( "glLockArraysEXT" );
qglUnlockArraysEXT = ( void ( APIENTRY * )( void ) ) SDL_GL_GetProcAddress( "glUnlockArraysEXT" );
if (!qglLockArraysEXT || !qglUnlockArraysEXT)
{
ri.Error (ERR_FATAL, "bad getprocaddress");
}
}
else
{
ri.Printf( PRINT_ALL, "...ignoring GL_EXT_compiled_vertex_array\n" );
}
}
else
{
ri.Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" );
}
textureFilterAnisotropic = qfalse;
if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) )
{
if ( r_ext_texture_filter_anisotropic->integer ) {
qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint *)&maxAnisotropy );
if ( maxAnisotropy <= 0 ) {
ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" );
maxAnisotropy = 0;
}
else
{
ri.Printf( PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", maxAnisotropy );
textureFilterAnisotropic = qtrue;
}
}
else
{
ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_filter_anisotropic\n" );
}
}
else
{
ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n" );
}
}
#define R_MODE_FALLBACK 3 // 640 * 480
/*
===============
GLimp_Init
This routine is responsible for initializing the OS specific portions
of OpenGL
===============
*/
void GLimp_Init( void )
{
qboolean success = qtrue;
r_allowSoftwareGL = ri.Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
// create the window and set up the context
if( !GLimp_StartDriverAndSetMode( r_mode->integer, r_fullscreen->integer ) )
{
if( r_mode->integer != R_MODE_FALLBACK )
{
ri.Printf( PRINT_ALL, "Setting r_mode %d failed, falling back on r_mode %d",
r_mode->integer, R_MODE_FALLBACK );
if( !GLimp_StartDriverAndSetMode( R_MODE_FALLBACK, r_fullscreen->integer ) )
success = qfalse;
}
else
success = qfalse;
}
if( !success )
ri.Error( ERR_FATAL, "GLimp_Init() - could not load OpenGL subsystem\n" );
// This values force the UI to disable driver selection
glConfig.driverType = GLDRV_ICD;
glConfig.hardwareType = GLHW_GENERIC;
glConfig.deviceSupportsGamma = !!( SDL_SetGamma( 1.0f, 1.0f, 1.0f ) >= 0 );
// get our config strings
Q_strncpyz( glConfig.vendor_string, (char *) qglGetString (GL_VENDOR), sizeof( glConfig.vendor_string ) );
Q_strncpyz( glConfig.renderer_string, (char *) qglGetString (GL_RENDERER), sizeof( glConfig.renderer_string ) );
if (*glConfig.renderer_string && glConfig.renderer_string[strlen(glConfig.renderer_string) - 1] == '\n')
glConfig.renderer_string[strlen(glConfig.renderer_string) - 1] = 0;
Q_strncpyz( glConfig.version_string, (char *) qglGetString (GL_VERSION), sizeof( glConfig.version_string ) );
Q_strncpyz( glConfig.extensions_string, (char *) qglGetString (GL_EXTENSIONS), sizeof( glConfig.extensions_string ) );
// initialize extensions
GLimp_InitExtensions( );
// This depends on SDL_INIT_VIDEO, hence having it here
IN_Init( );
return;
}
/*
===============
GLimp_EndFrame
Responsible for doing a swapbuffers
===============
*/
void GLimp_EndFrame( void )
{
// don't flip if drawing to front buffer
if ( Q_stricmp( r_drawBuffer->string, "GL_FRONT" ) != 0 )
{
SDL_GL_SwapBuffers();
}
if( r_fullscreen->modified )
{
qboolean fullscreen;
qboolean sdlToggled = qfalse;
SDL_Surface *s = SDL_GetVideoSurface( );
if( s )
{
// Find out the current state
if( s->flags & SDL_FULLSCREEN )
fullscreen = qtrue;
else
fullscreen = qfalse;
// Is the state we want different from the current state?
if( !!r_fullscreen->integer != fullscreen )
sdlToggled = SDL_WM_ToggleFullScreen( s );
else
sdlToggled = qtrue;
}
// SDL_WM_ToggleFullScreen didn't work, so do it the slow way
if( !sdlToggled )
Cbuf_AddText( "vid_restart" );
r_fullscreen->modified = qfalse;
}
}
#ifdef SMP
/*
===========================================================
SMP acceleration
===========================================================
*/
/*
* I have no idea if this will even work...most platforms don't offer
* thread-safe OpenGL libraries, and it looks like the original Linux
* code counted on each thread claiming the GL context with glXMakeCurrent(),
* which you can't currently do in SDL. We'll just have to hope for the best.
*/
static SDL_mutex *smpMutex = NULL;
static SDL_cond *renderCommandsEvent = NULL;
static SDL_cond *renderCompletedEvent = NULL;
static void (*glimpRenderThread)( void ) = NULL;
static SDL_Thread *renderThread = NULL;
/*
===============
GLimp_ShutdownRenderThread
===============
*/
static void GLimp_ShutdownRenderThread(void)
{
if (smpMutex != NULL)
{
SDL_DestroyMutex(smpMutex);
smpMutex = NULL;
}
if (renderCommandsEvent != NULL)
{
SDL_DestroyCond(renderCommandsEvent);
renderCommandsEvent = NULL;
}
if (renderCompletedEvent != NULL)
{
SDL_DestroyCond(renderCompletedEvent);
renderCompletedEvent = NULL;
}
glimpRenderThread = NULL;
}
/*
===============
GLimp_RenderThreadWrapper
===============
*/
static int GLimp_RenderThreadWrapper( void *arg )
{
Com_Printf( "Render thread starting\n" );
glimpRenderThread();
GLimp_SetCurrentContext(NULL);
Com_Printf( "Render thread terminating\n" );
return 0;
}
/*
===============
GLimp_SpawnRenderThread
===============
*/
qboolean GLimp_SpawnRenderThread( void (*function)( void ) )
{
static qboolean warned = qfalse;
if (!warned)
{
Com_Printf("WARNING: You enable r_smp at your own risk!\n");
warned = qtrue;
}
#ifndef MACOS_X
return qfalse; /* better safe than sorry for now. */
#endif
if (renderThread != NULL) /* hopefully just a zombie at this point... */
{
Com_Printf("Already a render thread? Trying to clean it up...\n");
SDL_WaitThread(renderThread, NULL);
renderThread = NULL;
GLimp_ShutdownRenderThread();
}
smpMutex = SDL_CreateMutex();
if (smpMutex == NULL)
{
Com_Printf( "smpMutex creation failed: %s\n", SDL_GetError() );
GLimp_ShutdownRenderThread();
return qfalse;
}
renderCommandsEvent = SDL_CreateCond();
if (renderCommandsEvent == NULL)
{
Com_Printf( "renderCommandsEvent creation failed: %s\n", SDL_GetError() );
GLimp_ShutdownRenderThread();
return qfalse;
}
renderCompletedEvent = SDL_CreateCond();
if (renderCompletedEvent == NULL)
{
Com_Printf( "renderCompletedEvent creation failed: %s\n", SDL_GetError() );
GLimp_ShutdownRenderThread();
return qfalse;
}
glimpRenderThread = function;
renderThread = SDL_CreateThread(GLimp_RenderThreadWrapper, NULL);
if ( renderThread == NULL )
{
ri.Printf( PRINT_ALL, "SDL_CreateThread() returned %s", SDL_GetError() );
GLimp_ShutdownRenderThread();
return qfalse;
}
else
{
// tma 01/09/07: don't think this is necessary anyway?
//
// !!! FIXME: No detach API available in SDL!
//ret = pthread_detach( renderThread );
//if ( ret ) {
//ri.Printf( PRINT_ALL, "pthread_detach returned %d: %s", ret, strerror( ret ) );
//}
}
return qtrue;
}
static volatile void *smpData = NULL;
static volatile qboolean smpDataReady;
/*
===============
GLimp_RendererSleep
===============
*/
void *GLimp_RendererSleep( void )
{
void *data = NULL;
GLimp_SetCurrentContext(NULL);
SDL_LockMutex(smpMutex);
{
smpData = NULL;
smpDataReady = qfalse;
// after this, the front end can exit GLimp_FrontEndSleep
SDL_CondSignal(renderCompletedEvent);
while ( !smpDataReady )
SDL_CondWait(renderCommandsEvent, smpMutex);
data = (void *)smpData;
}
SDL_UnlockMutex(smpMutex);
GLimp_SetCurrentContext(opengl_context);
return data;
}
/*
===============
GLimp_FrontEndSleep
===============
*/
void GLimp_FrontEndSleep( void )
{
SDL_LockMutex(smpMutex);
{
while ( smpData )
SDL_CondWait(renderCompletedEvent, smpMutex);
}
SDL_UnlockMutex(smpMutex);
GLimp_SetCurrentContext(opengl_context);
}
/*
===============
GLimp_WakeRenderer
===============
*/
void GLimp_WakeRenderer( void *data )
{
GLimp_SetCurrentContext(NULL);
SDL_LockMutex(smpMutex);
{
assert( smpData == NULL );
smpData = data;
smpDataReady = qtrue;
// after this, the renderer can continue through GLimp_RendererSleep
SDL_CondSignal(renderCommandsEvent);
}
SDL_UnlockMutex(smpMutex);
}
#else
// No SMP - stubs
void GLimp_RenderThreadWrapper( void *arg )
{
}
qboolean GLimp_SpawnRenderThread( void (*function)( void ) )
{
ri.Printf( PRINT_WARNING, "ERROR: SMP support was disabled at compile time\n");
return qfalse;
}
void *GLimp_RendererSleep( void )
{
return NULL;
}
void GLimp_FrontEndSleep( void )
{
}
void GLimp_WakeRenderer( void *data )
{
}
#endif

132
code/sdl/sdl_icon.h Normal file
View file

@ -0,0 +1,132 @@
/* GIMP RGBA C-Source image dump (sdl_icon.h) */
static const struct {
unsigned int width;
unsigned int height;
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
unsigned char pixel_data[32 * 32 * 4 + 1];
} CLIENT_WINDOW_ICON = {
32, 32, 4,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0w\0\0\377w\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0w\0\0\377w\0\0"
"\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0w\0\0\377w\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0w\0"
"\0\377w\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0w\0\0\377w\0\0\377\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0w\0\0\377w\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\0\0\377\210\0\0\377"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\210\0\0\377\210\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\210\0\0\377\210\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\231\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\0\0\377\210\0\0"
"\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\231\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\252\0\0"
"\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\231\0\0\377\210\0\0\377\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\252\0\0\377\0\0\0\0\273\0\0\377\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\231\0\0\377\231\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\273\0\0\377\314\0\0\377\231\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\231\0\0\377\231\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\231\0\0"
"\377\314\0\0\377\0\0\0\0\335\0\0\377\314\0\0\377\231\0\0\377\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\231\0\0\377\231\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\231\0\0\377\314\0\0\377\335"
"\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\231\0\0\377\314\0\0\377\335\0\0\377\335"
"\0\0\377\273\0\0\377\231\0\0\377\210\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\231\0\0\377\252\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252\0\0\377\273\0\0\377\335\0\0\377\335\0\0"
"\377\314\0\0\377\231\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\252\0\0\377\314\0\0\377\314\0\0\377\314\0\0\377\314\0\0\377"
"\314\0\0\377\314\0\0\377\314\0\0\377\314\0\0\377\0\0\0\0\252\0\0\377\252"
"\0\0\377\0\0\0\0\314\0\0\377\314\0\0\377\314\0\0\377\314\0\0\377\314\0\0"
"\377\314\0\0\377\314\0\0\377\314\0\0\377\252\0\0\377\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\210\0\0\377\231\0\0\377\273\0\0\377\314\0\0\377\314"
"\0\0\377\0\0\0\0\252\0\0\377\252\0\0\377\0\0\0\0\314\0\0\377\314\0\0\377"
"\273\0\0\377\231\0\0\377\210\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\0\0\377"
"\273\0\0\377\0\0\0\0\252\0\0\377\252\0\0\377\0\0\0\0\273\0\0\377\210\0\0"
"\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0w\0\0\377\273\0\0\377"
"\0\0\0\0\231\0\0\377\252\0\0\377\0\0\0\0\273\0\0\377w\0\0\377\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252\0\0\377\0\0\0\0\231\0\0"
"\377\231\0\0\377\0\0\0\0\252\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252\0\0\377\0\0\0\0\210\0\0\377\231\0\0\377"
"\0\0\0\0\252\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\231\0\0\377\0\0\0\0\210\0\0\377\210\0\0\377\0\0\0\0\231\0\0"
"\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\231"
"\0\0\377\0\0\0\0w\0\0\377\210\0\0\377\0\0\0\0\231\0\0\377\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\0\0\377\0\0\0\0\210"
"\0\0\377\210\0\0\377\0\0\0\0\210\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\0\0\377\0\0\0\0w\0\0\377\210\0\0\377"
"\0\0\0\0\210\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0w\0\0\377\0\0\0\0w\0\0\377w\0\0\377\0\0\0\0w\0\0\377\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0w\0\0\377\0\0\0\0"
"w\0\0\377w\0\0\377\0\0\0\0w\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0w\0\0\377\0\0\0\0w\0\0\377w\0\0\377\0\0\0\0w\0"
"\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0f\0\0\377f\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0f\0\0\377f\0\0\377"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0",
};

801
code/sdl/sdl_input.c Normal file
View file

@ -0,0 +1,801 @@
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code 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.
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "SDL.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "../renderer/tr_local.h"
#include "../client/client.h"
#include "../sys/sys_local.h"
#ifdef MACOS_X
// Mouse acceleration needs to be disabled
#define MACOS_X_ACCELERATION_HACK
// Cursor needs hack to hide
#define MACOS_X_CURSOR_HACK
#endif
#ifdef MACOS_X_ACCELERATION_HACK
#include <IOKit/hidsystem/IOHIDLib.h>
#include <IOKit/hidsystem/IOHIDParameter.h>
#include <drivers/event_status_driver.h>
#endif
//#define KBD_DBG
static SDL_Joystick *stick = NULL;
static qboolean mouseAvailable = qfalse;
static qboolean mouseActive = qfalse;
static qboolean keyRepeatEnabled = qfalse;
static cvar_t *in_mouse;
#ifdef MACOS_X_ACCELERATION_HACK
static cvar_t *in_disablemacosxmouseaccel;
static double originalMouseSpeed = -1.0;
#endif
static cvar_t *in_nograb;
static cvar_t *in_joystick = NULL;
static cvar_t *in_joystickDebug = NULL;
static cvar_t *in_joystickThreshold = NULL;
/*
===============
IN_TranslateSDLToQ3Key
===============
*/
static const char *IN_TranslateSDLToQ3Key(SDL_keysym *keysym, int *key)
{
static char buf[2] = { '\0', '\0' };
*buf = '\0';
*key = 0;
// these happen to match the ASCII chars.
if ((keysym->sym >= ' ') && (keysym->sym <= '~'))
{
*key = (int) keysym->sym;
}
else
{
switch (keysym->sym)
{
case SDLK_PAGEUP: *key = K_PGUP; break;
case SDLK_KP9: *key = K_KP_PGUP; break;
case SDLK_PAGEDOWN: *key = K_PGDN; break;
case SDLK_KP3: *key = K_KP_PGDN; break;
case SDLK_KP7: *key = K_KP_HOME; break;
case SDLK_HOME: *key = K_HOME; break;
case SDLK_KP1: *key = K_KP_END; break;
case SDLK_END: *key = K_END; break;
case SDLK_KP4: *key = K_KP_LEFTARROW; break;
case SDLK_LEFT: *key = K_LEFTARROW; break;
case SDLK_KP6: *key = K_KP_RIGHTARROW; break;
case SDLK_RIGHT: *key = K_RIGHTARROW; break;
case SDLK_KP2: *key = K_KP_DOWNARROW; break;
case SDLK_DOWN: *key = K_DOWNARROW; break;
case SDLK_KP8: *key = K_KP_UPARROW; break;
case SDLK_UP: *key = K_UPARROW; break;
case SDLK_ESCAPE: *key = K_ESCAPE; break;
case SDLK_KP_ENTER: *key = K_KP_ENTER; break;
case SDLK_RETURN: *key = K_ENTER; break;
case SDLK_TAB: *key = K_TAB; break;
case SDLK_F1: *key = K_F1; break;
case SDLK_F2: *key = K_F2; break;
case SDLK_F3: *key = K_F3; break;
case SDLK_F4: *key = K_F4; break;
case SDLK_F5: *key = K_F5; break;
case SDLK_F6: *key = K_F6; break;
case SDLK_F7: *key = K_F7; break;
case SDLK_F8: *key = K_F8; break;
case SDLK_F9: *key = K_F9; break;
case SDLK_F10: *key = K_F10; break;
case SDLK_F11: *key = K_F11; break;
case SDLK_F12: *key = K_F12; break;
case SDLK_F13: *key = K_F13; break;
case SDLK_F14: *key = K_F14; break;
case SDLK_F15: *key = K_F15; break;
case SDLK_BACKSPACE: *key = K_BACKSPACE; break; // ctrl-h
case SDLK_KP_PERIOD: *key = K_KP_DEL; break;
case SDLK_DELETE: *key = K_DEL; break;
case SDLK_PAUSE: *key = K_PAUSE; break;
case SDLK_LSHIFT:
case SDLK_RSHIFT: *key = K_SHIFT; break;
case SDLK_LCTRL:
case SDLK_RCTRL: *key = K_CTRL; break;
case SDLK_RMETA:
case SDLK_LMETA:
case SDLK_RALT:
case SDLK_LALT: *key = K_ALT; break;
case SDLK_LSUPER:
case SDLK_RSUPER: *key = K_SUPER; break;
case SDLK_KP5: *key = K_KP_5; break;
case SDLK_INSERT: *key = K_INS; break;
case SDLK_KP0: *key = K_KP_INS; break;
case SDLK_KP_MULTIPLY: *key = K_KP_STAR; break;
case SDLK_KP_PLUS: *key = K_KP_PLUS; break;
case SDLK_KP_MINUS: *key = K_KP_MINUS; break;
case SDLK_KP_DIVIDE: *key = K_KP_SLASH; break;
case SDLK_MODE: *key = K_MODE; break;
case SDLK_COMPOSE: *key = K_COMPOSE; break;
case SDLK_HELP: *key = K_HELP; break;
case SDLK_PRINT: *key = K_PRINT; break;
case SDLK_SYSREQ: *key = K_SYSREQ; break;
case SDLK_BREAK: *key = K_BREAK; break;
case SDLK_MENU: *key = K_MENU; break;
case SDLK_POWER: *key = K_POWER; break;
case SDLK_EURO: *key = K_EURO; break;
case SDLK_UNDO: *key = K_UNDO; break;
case SDLK_SCROLLOCK: *key = K_SCROLLOCK; break;
case SDLK_NUMLOCK: *key = K_KP_NUMLOCK; break;
case SDLK_CAPSLOCK: *key = K_CAPSLOCK; break;
default:
if (keysym->sym >= SDLK_WORLD_0 && keysym->sym <= SDLK_WORLD_95)
*key = (keysym->sym - SDLK_WORLD_0) + K_WORLD_0;
break;
}
}
if( keysym->unicode <= 127 ) // maps to ASCII?
{
char ch = (char) keysym->unicode;
if (ch == '~')
*key = '~'; // console HACK
// translate K_BACKSPACE to ctrl-h for MACOS_X (others?)
if (ch == K_BACKSPACE && keysym->sym != SDLK_DELETE)
{
*key = 'h' - 'a' + 1;
buf[0] = *key;
}
else
buf[0] = ch;
}
return buf;
}
/*
===============
IN_PrintKey
===============
*/
static void IN_PrintKey(const SDL_Event* event)
{
#ifdef KBD_DBG
fprintf( stderr, "key name: %s", SDL_GetKeyName (event->key.keysym.sym ) );
if(event->key.keysym.unicode)
{
fprintf( stderr, " unicode: %hx", event->key.keysym.unicode );
if( event->key.keysym.unicode >= '0' &&
event->key.keysym.unicode <= '~') // printable?
{
fprintf( stderr, " (%c)", (unsigned char)event->key.keysym.unicode );
}
}
fflush( stderr );
#endif
}
#ifdef MACOS_X_ACCELERATION_HACK
/*
===============
IN_GetIOHandle
===============
*/
static io_connect_t IN_GetIOHandle() // mac os x mouse accel hack
{
io_connect_t iohandle = MACH_PORT_NULL;
kern_return_t status;
io_service_t iohidsystem = MACH_PORT_NULL;
mach_port_t masterport;
status = IOMasterPort(MACH_PORT_NULL, &masterport);
if(status != KERN_SUCCESS)
return 0;
iohidsystem = IORegistryEntryFromPath(masterport, kIOServicePlane ":/IOResources/IOHIDSystem");
if(!iohidsystem)
return 0;
status = IOServiceOpen(iohidsystem, mach_task_self(), kIOHIDParamConnectType, &iohandle);
IOObjectRelease(iohidsystem);
return iohandle;
}
#endif
/*
===============
IN_ActivateMouse
===============
*/
static void IN_ActivateMouse( void )
{
if (!mouseAvailable || !SDL_WasInit( SDL_INIT_VIDEO ) )
return;
#ifdef MACOS_X_ACCELERATION_HACK
if (!mouseActive) // mac os x mouse accel hack
{
// Save the status of mouse acceleration
originalMouseSpeed = -1.0; // in case of error
if(in_disablemacosxmouseaccel->integer)
{
io_connect_t mouseDev = IN_GetIOHandle();
if(mouseDev != 0)
{
if(IOHIDGetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), &originalMouseSpeed) == kIOReturnSuccess)
{
Com_Printf("previous mouse acceleration: %f\n", originalMouseSpeed);
if(IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), -1.0) != kIOReturnSuccess)
{
Com_Printf("Could not disable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n");
Cvar_Set ("in_disablemacosxmouseaccel", 0);
}
}
else
{
Com_Printf("Could not disable mouse acceleration (failed at IOHIDGetAccelerationWithKey).\n");
Cvar_Set ("in_disablemacosxmouseaccel", 0);
}
IOServiceClose(mouseDev);
}
else
{
Com_Printf("Could not disable mouse acceleration (failed at IO_GetIOHandle).\n");
Cvar_Set ("in_disablemacosxmouseaccel", 0);
}
}
}
#endif
if( !mouseActive )
{
SDL_WM_GrabInput( SDL_GRAB_ON );
SDL_ShowCursor( 0 );
#ifdef MACOS_X_CURSOR_HACK
// This is a bug in the current SDL/macosx...have to toggle it a few
// times to get the cursor to hide.
SDL_ShowCursor( 1 );
SDL_ShowCursor( 0 );
#endif
}
// in_nograb makes no sense unless fullscreen
if( !r_fullscreen->integer )
{
if( in_nograb->modified || !mouseActive )
{
if( in_nograb->integer )
SDL_WM_GrabInput( SDL_GRAB_OFF );
else
SDL_WM_GrabInput( SDL_GRAB_ON );
in_nograb->modified = qfalse;
}
}
mouseActive = qtrue;
}
/*
===============
IN_DeactivateMouse
===============
*/
static void IN_DeactivateMouse( void )
{
if (!mouseAvailable || !SDL_WasInit( SDL_INIT_VIDEO ) )
return;
#ifdef MACOS_X_ACCELERATION_HACK
if (mouseActive) // mac os x mouse accel hack
{
if(originalMouseSpeed != -1.0)
{
io_connect_t mouseDev = IN_GetIOHandle();
if(mouseDev != 0)
{
Com_Printf("restoring mouse acceleration to: %f\n", originalMouseSpeed);
if(IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), originalMouseSpeed) != kIOReturnSuccess)
Com_Printf("Could not re-enable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n");
IOServiceClose(mouseDev);
}
else
Com_Printf("Could not re-enable mouse acceleration (failed at IO_GetIOHandle).\n");
}
}
#endif
if( mouseActive )
{
SDL_ShowCursor( 1 );
SDL_WM_GrabInput( SDL_GRAB_OFF );
mouseActive = qfalse;
}
}
// We translate axes movement into keypresses
static int joy_keys[16] = {
K_LEFTARROW, K_RIGHTARROW,
K_UPARROW, K_DOWNARROW,
K_JOY16, K_JOY17,
K_JOY18, K_JOY19,
K_JOY20, K_JOY21,
K_JOY22, K_JOY23,
K_JOY24, K_JOY25,
K_JOY26, K_JOY27
};
// translate hat events into keypresses
// the 4 highest buttons are used for the first hat ...
static int hat_keys[16] = {
K_JOY29, K_JOY30,
K_JOY31, K_JOY32,
K_JOY25, K_JOY26,
K_JOY27, K_JOY28,
K_JOY21, K_JOY22,
K_JOY23, K_JOY24,
K_JOY17, K_JOY18,
K_JOY19, K_JOY20
};
extern cvar_t * in_joystick;
extern cvar_t * in_joystickDebug;
extern cvar_t * in_joystickThreshold;
cvar_t *in_joystickNo;
#define ARRAYLEN(x) (sizeof (x) / sizeof (x[0]))
struct
{
qboolean buttons[16]; // !!! FIXME: these might be too many.
unsigned int oldaxes;
unsigned int oldhats;
} stick_state;
/*
===============
IN_StartupJoystick
===============
*/
static void IN_StartupJoystick( void )
{
int i = 0;
int total = 0;
if (stick != NULL)
SDL_JoystickClose(stick);
stick = NULL;
memset(&stick_state, '\0', sizeof (stick_state));
if( !in_joystick->integer ) {
Com_DPrintf( "Joystick is not active.\n" );
return;
}
if (!SDL_WasInit(SDL_INIT_JOYSTICK))
{
Com_DPrintf("Calling SDL_Init(SDL_INIT_JOYSTICK)...\n");
if (SDL_Init(SDL_INIT_JOYSTICK) == -1)
{
Com_DPrintf("SDL_Init(SDL_INIT_JOYSTICK) failed: %s\n", SDL_GetError());
return;
}
Com_DPrintf("SDL_Init(SDL_INIT_JOYSTICK) passed.\n");
}
total = SDL_NumJoysticks();
Com_DPrintf("%d possible joysticks\n", total);
for (i = 0; i < total; i++)
Com_DPrintf("[%d] %s\n", i, SDL_JoystickName(i));
in_joystickNo = Cvar_Get( "in_joystickNo", "0", CVAR_ARCHIVE );
if( in_joystickNo->integer < 0 || in_joystickNo->integer >= total )
Cvar_Set( "in_joystickNo", "0" );
stick = SDL_JoystickOpen( in_joystickNo->integer );
if (stick == NULL) {
Com_DPrintf( "No joystick opened.\n" );
return;
}
Com_DPrintf( "Joystick %d opened\n", in_joystickNo->integer );
Com_DPrintf( "Name: %s\n", SDL_JoystickName(in_joystickNo->integer) );
Com_DPrintf( "Axes: %d\n", SDL_JoystickNumAxes(stick) );
Com_DPrintf( "Hats: %d\n", SDL_JoystickNumHats(stick) );
Com_DPrintf( "Buttons: %d\n", SDL_JoystickNumButtons(stick) );
Com_DPrintf( "Balls: %d\n", SDL_JoystickNumBalls(stick) );
SDL_JoystickEventState(SDL_QUERY);
return;
}
/*
===============
IN_JoyMove
===============
*/
static void IN_JoyMove( void )
{
qboolean joy_pressed[ARRAYLEN(joy_keys)];
unsigned int axes = 0;
unsigned int hats = 0;
int total = 0;
int i = 0;
if (!stick)
return;
SDL_JoystickUpdate();
memset(joy_pressed, '\0', sizeof (joy_pressed));
// update the ball state.
total = SDL_JoystickNumBalls(stick);
if (total > 0)
{
int balldx = 0;
int balldy = 0;
for (i = 0; i < total; i++)
{
int dx = 0;
int dy = 0;
SDL_JoystickGetBall(stick, i, &dx, &dy);
balldx += dx;
balldy += dy;
}
if (balldx || balldy)
{
// !!! FIXME: is this good for stick balls, or just mice?
// Scale like the mouse input...
if (abs(balldx) > 1)
balldx *= 2;
if (abs(balldy) > 1)
balldy *= 2;
Com_QueueEvent( 0, SE_MOUSE, balldx, balldy, 0, NULL );
}
}
// now query the stick buttons...
total = SDL_JoystickNumButtons(stick);
if (total > 0)
{
if (total > ARRAYLEN(stick_state.buttons))
total = ARRAYLEN(stick_state.buttons);
for (i = 0; i < total; i++)
{
qboolean pressed = (SDL_JoystickGetButton(stick, i) != 0);
if (pressed != stick_state.buttons[i])
{
Com_QueueEvent( 0, SE_KEY, K_JOY1 + i, pressed, 0, NULL );
stick_state.buttons[i] = pressed;
}
}
}
// look at the hats...
total = SDL_JoystickNumHats(stick);
if (total > 0)
{
if (total > 4) total = 4;
for (i = 0; i < total; i++)
{
((Uint8 *)&hats)[i] = SDL_JoystickGetHat(stick, i);
}
}
// update hat state
if (hats != stick_state.oldhats)
{
for( i = 0; i < 4; i++ ) {
if( ((Uint8 *)&hats)[i] != ((Uint8 *)&stick_state.oldhats)[i] ) {
// release event
switch( ((Uint8 *)&stick_state.oldhats)[i] ) {
case SDL_HAT_UP:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 0], qfalse, 0, NULL );
break;
case SDL_HAT_RIGHT:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 1], qfalse, 0, NULL );
break;
case SDL_HAT_DOWN:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 2], qfalse, 0, NULL );
break;
case SDL_HAT_LEFT:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 3], qfalse, 0, NULL );
break;
case SDL_HAT_RIGHTUP:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 0], qfalse, 0, NULL );
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 1], qfalse, 0, NULL );
break;
case SDL_HAT_RIGHTDOWN:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 2], qfalse, 0, NULL );
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 1], qfalse, 0, NULL );
break;
case SDL_HAT_LEFTUP:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 0], qfalse, 0, NULL );
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 3], qfalse, 0, NULL );
break;
case SDL_HAT_LEFTDOWN:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 2], qfalse, 0, NULL );
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 3], qfalse, 0, NULL );
break;
default:
break;
}
// press event
switch( ((Uint8 *)&hats)[i] ) {
case SDL_HAT_UP:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 0], qtrue, 0, NULL );
break;
case SDL_HAT_RIGHT:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 1], qtrue, 0, NULL );
break;
case SDL_HAT_DOWN:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 2], qtrue, 0, NULL );
break;
case SDL_HAT_LEFT:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 3], qtrue, 0, NULL );
break;
case SDL_HAT_RIGHTUP:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 0], qtrue, 0, NULL );
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 1], qtrue, 0, NULL );
break;
case SDL_HAT_RIGHTDOWN:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 2], qtrue, 0, NULL );
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 1], qtrue, 0, NULL );
break;
case SDL_HAT_LEFTUP:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 0], qtrue, 0, NULL );
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 3], qtrue, 0, NULL );
break;
case SDL_HAT_LEFTDOWN:
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 2], qtrue, 0, NULL );
Com_QueueEvent( 0, SE_KEY, hat_keys[4*i + 3], qtrue, 0, NULL );
break;
default:
break;
}
}
}
}
// save hat state
stick_state.oldhats = hats;
// finally, look at the axes...
total = SDL_JoystickNumAxes(stick);
if (total > 0)
{
if (total > 16) total = 16;
for (i = 0; i < total; i++)
{
Sint16 axis = SDL_JoystickGetAxis(stick, i);
float f = ( (float) axis ) / 32767.0f;
if( f < -in_joystickThreshold->value ) {
axes |= ( 1 << ( i * 2 ) );
} else if( f > in_joystickThreshold->value ) {
axes |= ( 1 << ( ( i * 2 ) + 1 ) );
}
}
}
/* Time to update axes state based on old vs. new. */
if (axes != stick_state.oldaxes)
{
for( i = 0; i < 16; i++ ) {
if( ( axes & ( 1 << i ) ) && !( stick_state.oldaxes & ( 1 << i ) ) ) {
Com_QueueEvent( 0, SE_KEY, joy_keys[i], qtrue, 0, NULL );
}
if( !( axes & ( 1 << i ) ) && ( stick_state.oldaxes & ( 1 << i ) ) ) {
Com_QueueEvent( 0, SE_KEY, joy_keys[i], qfalse, 0, NULL );
}
}
}
/* Save for future generations. */
stick_state.oldaxes = axes;
}
/*
===============
IN_ProcessEvents
===============
*/
static void IN_ProcessEvents( void )
{
SDL_Event e;
const char *p = NULL;
int key = 0;
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
return;
if( cls.keyCatchers == 0 && keyRepeatEnabled )
{
SDL_EnableKeyRepeat( 0, 0 );
keyRepeatEnabled = qfalse;
}
else if( !keyRepeatEnabled )
{
SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY,
SDL_DEFAULT_REPEAT_INTERVAL );
keyRepeatEnabled = qtrue;
}
while (SDL_PollEvent(&e))
{
switch (e.type)
{
case SDL_KEYDOWN:
IN_PrintKey(&e);
p = IN_TranslateSDLToQ3Key(&e.key.keysym, &key);
if( key )
Com_QueueEvent( 0, SE_KEY, key, qtrue, 0, NULL );
if( p )
{
while( *p )
Com_QueueEvent( 0, SE_CHAR, *p++, 0, 0, NULL );
}
break;
case SDL_KEYUP:
IN_TranslateSDLToQ3Key(&e.key.keysym, &key);
Com_QueueEvent( 0, SE_KEY, key, qfalse, 0, NULL );
break;
case SDL_MOUSEMOTION:
if (mouseActive)
Com_QueueEvent( 0, SE_MOUSE, e.motion.xrel, e.motion.yrel, 0, NULL );
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
unsigned char b;
switch (e.button.button)
{
case 1: b = K_MOUSE1; break;
case 2: b = K_MOUSE3; break;
case 3: b = K_MOUSE2; break;
case 4: b = K_MWHEELUP; break;
case 5: b = K_MWHEELDOWN; break;
case 6: b = K_MOUSE4; break;
case 7: b = K_MOUSE5; break;
default: b = K_AUX1 + (e.button.button - 8)%16; break;
}
Com_QueueEvent( 0, SE_KEY, b,
( e.type == SDL_MOUSEBUTTONDOWN ? qtrue : qfalse ), 0, NULL );
}
break;
case SDL_QUIT:
Sys_Quit();
break;
default:
break;
}
}
}
/*
===============
IN_Frame
===============
*/
void IN_Frame (void)
{
IN_JoyMove( );
// Release the mouse if the console if down and we're windowed
if( ( cls.keyCatchers & KEYCATCH_CONSOLE ) && !r_fullscreen->integer )
IN_DeactivateMouse( );
else
IN_ActivateMouse( );
IN_ProcessEvents( );
}
/*
===============
IN_Init
===============
*/
void IN_Init(void)
{
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
{
Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )\n" );
return;
}
Com_DPrintf ("\n------- Input Initialization -------\n");
// mouse variables
in_mouse = Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
in_nograb = Cvar_Get ("in_nograb", "0", CVAR_ARCHIVE);
in_joystick = Cvar_Get ("in_joystick", "0", CVAR_ARCHIVE|CVAR_LATCH);
in_joystickDebug = Cvar_Get ("in_debugjoystick", "0", CVAR_TEMP);
in_joystickThreshold = Cvar_Get ("in_joystickThreshold", "0.15", CVAR_ARCHIVE);
#ifdef MACOS_X_ACCELERATION_HACK
in_disablemacosxmouseaccel = Cvar_Get ("in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE);
#endif
Cvar_Set( "cl_platformSensitivity", "1.0" );
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
keyRepeatEnabled = qtrue;
if (in_mouse->value)
mouseAvailable = qtrue;
else
mouseAvailable = qfalse;
IN_StartupJoystick( );
Com_DPrintf ("------------------------------------\n");
}
/*
===============
IN_Shutdown
===============
*/
void IN_Shutdown(void)
{
IN_DeactivateMouse();
mouseAvailable = qfalse;
if (stick)
{
SDL_JoystickClose(stick);
stick = NULL;
}
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}

View file

@ -1,32 +1,4 @@
#if USE_SDL_SOUND
/*
* SDL implementation for Quake 3: Arena's GPL source release.
*
* This is a replacement of the Linux/OpenSoundSystem code with
* an SDL backend, since it allows us to trivially point just about any
* existing 2D audio backend known to man on any platform at the code,
* plus it benefits from all of SDL's tapdancing to support buggy drivers,
* etc, and gets us free ALSA support, too.
*
* This is the best idea for a direct modernization of the Linux sound code
* in Quake 3. However, it would be nice to replace this with true 3D
* positional audio, compliments of OpenAL...
*
* Written by Ryan C. Gordon (icculus@icculus.org). Please refer to
* http://ioquake3.org/ for the latest version of this code.
*
* Patches and comments are welcome at the above address.
*
* I cut-and-pasted this from linux_snd.c, and moved it to SDL line-by-line.
* There is probably some cruft that could be removed here.
*
* You should define USE_SDL=1 and then add this to the makefile.
* USE_SDL will disable the Open Sound System target.
*/
/*
Original copyright on Q3A sources:
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
@ -64,55 +36,16 @@ cvar_t *s_sdlChannels;
cvar_t *s_sdlDevSamps;
cvar_t *s_sdlMixSamps;
static qboolean use_custom_memset = qfalse;
/*
===============
Snd_Memset
https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
<TTimo> some shitty mess with DMA buffers
<TTimo> the mmap'ing permissions were write only
<TTimo> and glibc optimized for mmx would do memcpy with a prefetch and a read
<TTimo> causing segfaults
<TTimo> some other systems would not let you mmap the DMA with read permissions
<TTimo> so I think I ended up attempting opening with read/write, then try write only
<TTimo> and use my own copy instead of the glibc crap
===============
*/
#ifdef Snd_Memset
#undef Snd_Memset
#endif
void Snd_Memset (void* dest, const int val, const size_t count)
{
int *pDest;
int i, iterate;
if (!use_custom_memset)
{
Com_Memset(dest,val,count);
return;
}
iterate = count / sizeof(int);
pDest = (int*)dest;
for(i=0; i<iterate; i++)
{
pDest[i] = val;
}
}
/* The audio callback. All the magic happens here. */
static int dmapos = 0;
static int dmasize = 0;
/*
===============
sdl_audio_callback
SNDDMA_AudioCallback
===============
*/
static void sdl_audio_callback(void *userdata, Uint8 *stream, int len)
static void SNDDMA_AudioCallback(void *userdata, Uint8 *stream, int len)
{
int pos = (dmapos * (dma.samplebits/8));
if (pos >= dmasize)
@ -167,10 +100,10 @@ static int formatToStringTableSize =
/*
===============
print_audiospec
SNDDMA_PrintAudiospec
===============
*/
static void print_audiospec(const char *str, const SDL_AudioSpec *spec)
static void SNDDMA_PrintAudiospec(const char *str, const SDL_AudioSpec *spec)
{
int i;
char *fmt = NULL;
@ -209,8 +142,6 @@ qboolean SNDDMA_Init(void)
if (snd_inited)
return qtrue;
Com_Printf("Initializing SDL audio driver...\n");
if (!s_sdlBits) {
s_sdlBits = Cvar_Get("s_sdlBits", "16", CVAR_ARCHIVE);
s_sdlSpeed = Cvar_Get("s_sdlSpeed", "0", CVAR_ARCHIVE);
@ -219,15 +150,19 @@ qboolean SNDDMA_Init(void)
s_sdlMixSamps = Cvar_Get("s_sdlMixSamps", "0", CVAR_ARCHIVE);
}
Com_Printf( "SDL_Init( SDL_INIT_AUDIO )... " );
if (!SDL_WasInit(SDL_INIT_AUDIO))
{
if (SDL_Init(SDL_INIT_AUDIO) == -1)
{
Com_Printf("SDL_Init(SDL_INIT_AUDIO) failed: %s\n", SDL_GetError());
Com_Printf( "FAILED (%s)\n", SDL_GetError( ) );
return qfalse;
}
}
Com_Printf( "OK\n" );
if (SDL_AudioDriverName(drivername, sizeof (drivername)) == NULL)
strcpy(drivername, "(UNKNOWN)");
Com_Printf("SDL audio driver is \"%s\".\n", drivername);
@ -261,16 +196,16 @@ qboolean SNDDMA_Init(void)
}
desired.channels = (int) s_sdlChannels->value;
desired.callback = sdl_audio_callback;
desired.callback = SNDDMA_AudioCallback;
if (SDL_OpenAudio(&desired, &obtained) == -1)
{
Com_Printf("SDL_OpenAudio() failed: %s\n", SDL_GetError());
SDL_QuitSubSystem(SDL_INIT_AUDIO);
return qfalse;
} // if
}
print_audiospec("SDL_AudioSpec", &obtained);
SNDDMA_PrintAudiospec("SDL_AudioSpec", &obtained);
// dma.samples needs to be big, or id's mixer will just refuse to
// work at all; we need to keep it significantly bigger than the
@ -358,5 +293,3 @@ void SNDDMA_BeginPainting (void)
{
SDL_LockAudio();
}
#endif // USE_SDL_SOUND

View file

@ -518,10 +518,6 @@ SV_BotInitBotLib
void SV_BotInitBotLib(void) {
botlib_import_t botlib_import;
if ( !Cvar_VariableValue("fs_restrict") && !Sys_CheckCD() ) {
Com_Error( ERR_NEED_CD, "Game CD not in drive" );
}
if (debugpolygons) Z_Free(debugpolygons);
bot_maxdebugpolys = Cvar_VariableIntegerValue("bot_maxdebugpolys");
debugpolygons = Z_Malloc(sizeof(bot_debugpoly_t) * bot_maxdebugpolys);
@ -558,7 +554,7 @@ void SV_BotInitBotLib(void) {
botlib_import.DebugPolygonDelete = BotImport_DebugPolygonDelete;
botlib_export = (botlib_export_t *)GetBotLibAPI( BOTLIB_API_VERSION, &botlib_import );
assert(botlib_export); // bk001129 - somehow we end up with a zero import.
assert(botlib_export); // somehow we end up with a zero import.
}

View file

@ -321,7 +321,7 @@ static void SV_MapRestart_f( void ) {
// this generally shouldn't happen, because the client
// was connected before the level change
SV_DropClient( client, denied );
Com_Printf( "SV_MapRestart_f(%d): dropped client %i - denied!\n", delay, i ); // bk010125
Com_Printf( "SV_MapRestart_f(%d): dropped client %i - denied!\n", delay, i );
continue;
}

View file

@ -173,12 +173,6 @@ void SV_AuthorizeIpPacket( netadr_t from ) {
r = Cmd_Argv( 3 ); // reason
if ( !Q_stricmp( s, "demo" ) ) {
if ( Cvar_VariableValue( "fs_restrict" ) ) {
// a demo client connecting to a demo server
NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr,
"challengeResponse %i", svs.challenges[i].challenge );
return;
}
// they are a demo client trying to connect to a real server
NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, "print\nServer is not a demo server\n" );
// clear the challenge record so it won't timeout and let them through

View file

@ -918,7 +918,7 @@ void SV_RestartGameProgs( void ) {
// do a restart instead of a free
gvm = VM_Restart( gvm );
if ( !gvm ) { // bk001212 - as done below
if ( !gvm ) {
Com_Error( ERR_FATAL, "VM_Restart on game failed" );
}

View file

@ -416,6 +416,11 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
// clear the whole hunk because we're (re)loading the server
Hunk_Clear();
#ifndef DEDICATED
// Restart renderer
CL_StartHunkUsers( qtrue );
#endif
// clear collision map data
CM_ClearMap();

Some files were not shown because too many files have changed in this diff Show more