* 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_SO =
BUILD_GAME_QVM = BUILD_GAME_QVM =
ifeq ($(V),1) ifneq ($(PLATFORM),darwin)
echo_cmd=@: BUILD_CLIENT_SMP = 0
Q=
else
echo_cmd=@echo
Q=@
endif endif
############################################################################# #############################################################################
@ -96,10 +92,6 @@ USE_CCACHE=0
endif endif
export USE_CCACHE export USE_CCACHE
ifndef USE_SDL
USE_SDL=1
endif
ifndef USE_OPENAL ifndef USE_OPENAL
USE_OPENAL=1 USE_OPENAL=1
endif endif
@ -136,8 +128,9 @@ CDIR=$(MOUNT_DIR)/client
SDIR=$(MOUNT_DIR)/server SDIR=$(MOUNT_DIR)/server
RDIR=$(MOUNT_DIR)/renderer RDIR=$(MOUNT_DIR)/renderer
CMDIR=$(MOUNT_DIR)/qcommon CMDIR=$(MOUNT_DIR)/qcommon
UDIR=$(MOUNT_DIR)/unix SDLDIR=$(MOUNT_DIR)/sdl
W32DIR=$(MOUNT_DIR)/win32 ASMDIR=$(MOUNT_DIR)/asm
SYSDIR=$(MOUNT_DIR)/sys
GDIR=$(MOUNT_DIR)/game GDIR=$(MOUNT_DIR)/game
CGDIR=$(MOUNT_DIR)/cgame CGDIR=$(MOUNT_DIR)/cgame
BLIBDIR=$(MOUNT_DIR)/botlib BLIBDIR=$(MOUNT_DIR)/botlib
@ -146,7 +139,7 @@ UIDIR=$(MOUNT_DIR)/ui
Q3UIDIR=$(MOUNT_DIR)/q3_ui Q3UIDIR=$(MOUNT_DIR)/q3_ui
JPDIR=$(MOUNT_DIR)/jpeg-6 JPDIR=$(MOUNT_DIR)/jpeg-6
TOOLSDIR=$(MOUNT_DIR)/tools TOOLSDIR=$(MOUNT_DIR)/tools
LOKISETUPDIR=$(UDIR)/setup LOKISETUPDIR=misc/setup
SDLHDIR=$(MOUNT_DIR)/SDL12 SDLHDIR=$(MOUNT_DIR)/SDL12
LIBSDIR=$(MOUNT_DIR)/libs LIBSDIR=$(MOUNT_DIR)/libs
@ -158,7 +151,7 @@ USE_SVN=
ifeq ($(wildcard .svn),.svn) ifeq ($(wildcard .svn),.svn)
SVN_REV=$(shell LANG=C svnversion .) SVN_REV=$(shell LANG=C svnversion .)
ifneq ($(SVN_REV),) ifneq ($(SVN_REV),)
SVN_VERSION=$(VERSION)_SVN$(SVN_REV) SVN_VERSION=$(SVN_REV)
USE_SVN=1 USE_SVN=1
endif endif
endif endif
@ -195,7 +188,8 @@ ifeq ($(PLATFORM),linux)
endif endif
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) ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1 BASE_CFLAGS += -DUSE_OPENAL=1
@ -215,12 +209,6 @@ ifeq ($(PLATFORM),linux)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif 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 OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer
ifeq ($(ARCH),x86_64) ifeq ($(ARCH),x86_64)
@ -247,10 +235,6 @@ ifeq ($(PLATFORM),linux)
BASE_CFLAGS += -DNO_VM_COMPILED BASE_CFLAGS += -DNO_VM_COMPILED
endif endif
DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
SHLIBEXT=so SHLIBEXT=so
SHLIBCFLAGS=-fPIC SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS) SHLIBLDFLAGS=-shared $(LDFLAGS)
@ -258,18 +242,14 @@ ifeq ($(PLATFORM),linux)
THREAD_LDFLAGS=-lpthread THREAD_LDFLAGS=-lpthread
LDFLAGS=-ldl -lm LDFLAGS=-ldl -lm
ifeq ($(USE_SDL),1) CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL
CLIENT_LDFLAGS=$(shell sdl-config --libs)
else
CLIENT_LDFLAGS=-L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
endif
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1) ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LDFLAGS += -lopenal CLIENT_LDFLAGS += -lopenal
endif endif
endif endif
ifeq ($(USE_CURL),1) ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1) ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LDFLAGS += -lcurl CLIENT_LDFLAGS += -lcurl
@ -286,6 +266,9 @@ ifeq ($(PLATFORM),linux)
LDFLAGS+=-m32 LDFLAGS+=-m32
endif endif
DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
else # ifeq Linux else # ifeq Linux
############################################################################# #############################################################################
@ -384,19 +367,13 @@ ifeq ($(PLATFORM),darwin)
CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
endif endif
ifeq ($(USE_SDL),1) BASE_CFLAGS += -D_THREAD_SAFE=1 -I$(SDLHDIR)/include
BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 \ # We copy sdlmain before ranlib'ing it so that subversion doesn't think
-I$(SDLHDIR)/include # the file has been modified by each build.
# We copy sdlmain before ranlib'ing it so that subversion doesn't think LIBSDLMAIN=$(B)/libSDLmain.a
# the file has been modified by each build. LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
LIBSDLMAIN=$(B)/libSDLmain.a CLIENT_LDFLAGS += -framework Cocoa -framework IOKit -framework OpenGL \
LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a $(LIBSDIR)/macosx/libSDL-1.2.0.dylib
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
OPTIMIZE += -ffast-math -falign-loops=16 OPTIMIZE += -ffast-math -falign-loops=16
@ -429,7 +406,8 @@ endif
ARCH=x86 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) ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN=1 BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN=1
@ -446,22 +424,19 @@ endif
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif endif
OPTIMIZE = -O3 -march=i586 -fomit-frame-pointer -ffast-math -falign-loops=2 \ OPTIMIZE = -O3 -march=i586 -fno-omit-frame-pointer -ffast-math \
-funroll-loops -falign-jumps=2 -falign-functions=2 -fstrength-reduce -falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \
-fstrength-reduce
HAVE_VM_COMPILED = true HAVE_VM_COMPILED = true
DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
SHLIBEXT=dll SHLIBEXT=dll
SHLIBCFLAGS= SHLIBCFLAGS=
SHLIBLDFLAGS=-shared $(LDFLAGS) SHLIBLDFLAGS=-shared $(LDFLAGS)
BINEXT=.exe BINEXT=.exe
LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32 LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32 -lopengl32
CLIENT_LDFLAGS= CLIENT_LDFLAGS=
ifeq ($(USE_CURL),1) ifeq ($(USE_CURL),1)
@ -480,6 +455,14 @@ endif
LDFLAGS+=-m32 LDFLAGS+=-m32
endif 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_SERVER = 0
BUILD_CLIENT_SMP = 0 BUILD_CLIENT_SMP = 0
@ -499,9 +482,7 @@ ifeq ($(PLATFORM),freebsd)
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-I/usr/X11R6/include -DUSE_ICON $(shell sdl-config --cflags)
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1 BASE_CFLAGS += -DUSE_OPENAL=1
@ -514,10 +495,6 @@ ifeq ($(PLATFORM),freebsd)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif endif
ifeq ($(USE_SDL),1)
BASE_CFLAGS += $(shell sdl-config --cflags) -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1
endif
ifeq ($(ARCH),axp) ifeq ($(ARCH),axp)
BASE_CFLAGS += -DNO_VM_COMPILED BASE_CFLAGS += -DNO_VM_COMPILED
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -ffast-math -funroll-loops \ RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -ffast-math -funroll-loops \
@ -534,6 +511,8 @@ ifeq ($(PLATFORM),freebsd)
endif endif
endif endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
SHLIBEXT=so SHLIBEXT=so
SHLIBCFLAGS=-fPIC SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS) SHLIBLDFLAGS=-shared $(LDFLAGS)
@ -544,11 +523,7 @@ ifeq ($(PLATFORM),freebsd)
CLIENT_LDFLAGS = CLIENT_LDFLAGS =
ifeq ($(USE_SDL),1) CLIENT_LDFLAGS += $(shell sdl-config --libs) -lGL
CLIENT_LDFLAGS += $(shell sdl-config --libs)
else
CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
endif
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1) ifneq ($(USE_OPENAL_DLOPEN),1)
@ -580,12 +555,13 @@ ifeq ($(PLATFORM),netbsd)
THREAD_LDFLAGS=-lpthread THREAD_LDFLAGS=-lpthread
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
ifneq ($(ARCH),i386) ifneq ($(ARCH),i386)
BASE_CFLAGS += -DNO_VM_COMPILED BASE_CFLAGS += -DNO_VM_COMPILED
endif endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
BUILD_CLIENT = 0 BUILD_CLIENT = 0
BUILD_GAME_QVM = 0 BUILD_GAME_QVM = 0
@ -637,13 +613,8 @@ ifeq ($(PLATFORM),sunos)
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_SDL),1)
BASE_CFLAGS += -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
else
BASE_CFLAGS += -I/usr/openwin/include
endif
OPTIMIZE = -O3 -ffast-math -funroll-loops OPTIMIZE = -O3 -ffast-math -funroll-loops
@ -681,11 +652,7 @@ ifeq ($(PLATFORM),sunos)
BOTCFLAGS=-O0 BOTCFLAGS=-O0
ifeq ($(USE_SDL),1) CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL
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
else # ifeq sunos else # ifeq sunos
@ -763,6 +730,14 @@ ifeq ($(USE_SVN),1)
BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\" BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\"
endif endif
ifeq ($(V),1)
echo_cmd=@:
Q=
else
echo_cmd=@echo
Q=@
endif
define DO_CC define DO_CC
$(echo_cmd) "CC $<" $(echo_cmd) "CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $< $(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
@ -1049,6 +1024,12 @@ Q3OBJ = \
$(B)/client/tr_sky.o \ $(B)/client/tr_sky.o \
$(B)/client/tr_surface.o \ $(B)/client/tr_surface.o \
$(B)/client/tr_world.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) ifeq ($(ARCH),i386)
Q3OBJ += \ Q3OBJ += \
@ -1082,44 +1063,19 @@ endif
ifeq ($(PLATFORM),mingw32) ifeq ($(PLATFORM),mingw32)
Q3OBJ += \ Q3OBJ += \
$(B)/client/win_gamma.o \ $(B)/client/win_resource.o \
$(B)/client/win_glimp.o \ $(B)/client/sys_win32.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
else else
Q3OBJ += \ Q3OBJ += \
$(B)/client/unix_main.o \ $(B)/client/sys_unix.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
endif endif
Q3POBJ += \
$(B)/client/sdl_glimp.o
Q3POBJ_SMP += \
$(B)/clientsmp/sdl_glimp.o
$(B)/ioquake3.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) $(B)/ioquake3.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \ $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \
@ -1206,13 +1162,14 @@ Q3DOBJ = \
$(B)/ded/l_script.o \ $(B)/ded/l_script.o \
$(B)/ded/l_struct.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_client.o \
$(B)/ded/null_input.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) ifeq ($(ARCH),i386)
Q3DOBJ += \ Q3DOBJ += \
@ -1529,7 +1486,7 @@ $(B)/missionpack/vm/ui.qvm: $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm
## CLIENT/SERVER RULES ## CLIENT/SERVER RULES
############################################################################# #############################################################################
$(B)/client/%.o: $(UDIR)/%.s $(B)/client/%.o: $(ASMDIR)/%.s
$(DO_AS) $(DO_AS)
$(B)/client/%.o: $(CDIR)/%.c $(B)/client/%.o: $(CDIR)/%.c
@ -1550,20 +1507,20 @@ $(B)/client/%.o: $(JPDIR)/%.c
$(B)/client/%.o: $(RDIR)/%.c $(B)/client/%.o: $(RDIR)/%.c
$(DO_CC) $(DO_CC)
$(B)/client/%.o: $(UDIR)/%.c $(B)/client/%.o: $(SDLDIR)/%.c
$(DO_CC) $(DO_CC)
$(B)/clientsmp/%.o: $(UDIR)/%.c $(B)/clientsmp/%.o: $(SDLDIR)/%.c
$(DO_SMP_CC) $(DO_SMP_CC)
$(B)/client/%.o: $(W32DIR)/%.c $(B)/client/%.o: $(SYSDIR)/%.c
$(DO_CC) $(DO_CC)
$(B)/client/%.o: $(W32DIR)/%.rc $(B)/client/%.o: $(SYSDIR)/%.rc
$(DO_WINDRES) $(DO_WINDRES)
$(B)/ded/%.o: $(UDIR)/%.s $(B)/ded/%.o: $(ASMDIR)/%.s
$(DO_AS) $(DO_AS)
$(B)/ded/%.o: $(SDIR)/%.c $(B)/ded/%.o: $(SDIR)/%.c
@ -1575,7 +1532,7 @@ $(B)/ded/%.o: $(CMDIR)/%.c
$(B)/ded/%.o: $(BLIBDIR)/%.c $(B)/ded/%.o: $(BLIBDIR)/%.c
$(DO_BOT_CC) $(DO_BOT_CC)
$(B)/ded/%.o: $(UDIR)/%.c $(B)/ded/%.o: $(SYSDIR)/%.c
$(DO_DED_CC) $(DO_DED_CC)
$(B)/ded/%.o: $(NDIR)/%.c $(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 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: 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 * OpenAL sound API support (multiple speaker support and better sound
quality) quality)
* Full x86_64 support on Linux * Full x86_64 support on Linux
@ -46,17 +46,7 @@ For *nix
For Windows, using MinGW For Windows, using MinGW
1. Download and install MinGW and MSys from http://www.mingw.org/. 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 2. Open an MSys terminal, and follow the instructions for compiling on *nix.
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.
For Mac OS X, building a Universal Binary For Mac OS X, building a Universal Binary
1. Install the MacOSX10.2.8.sdk and MacOSX10.4u.sdk which are included in 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 Installation, for *nix
1. Set the COPYDIR variable in the shell to be where you installed Quake 3 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 This is the path as used by the original Linux Q3 installer and subsequent
point releases. point releases.
2. Run 'make copyfiles'. 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 though you may find you need to change the value of the variables in this
script to match your environment. script to match your environment.
If the make based build system is being used (i.e. *nix or MinGW), the The following variables may be set, either on the command line or in
following variables may be set, either on the command line or in
Makefile.local: Makefile.local:
OPTIMIZE - use this for custom CFLAGS CFLAGS - use this for custom CFLAGS
V - set to show cc command line when building V - set to show cc command line when building
DEFAULT_BASEDIR - extra path to search for baseq3 and such DEFAULT_BASEDIR - extra path to search for baseq3 and such
BUILD_SERVER - build the 'ioq3ded' server binary BUILD_SERVER - build the 'ioq3ded' server binary
@ -95,7 +84,6 @@ Makefile.local:
BUILD_CLIENT_SMP - build the 'ioquake3-smp' client binary BUILD_CLIENT_SMP - build the 'ioquake3-smp' client binary
BUILD_GAME_SO - build the game shared libraries BUILD_GAME_SO - build the game shared libraries
BUILD_GAME_QVM - build the game qvms BUILD_GAME_QVM - build the game qvms
USE_SDL - use the SDL backend where available
USE_OPENAL - use OpenAL where available USE_OPENAL - use OpenAL where available
USE_OPENAL_DLOPEN - link with OpenAL at runtime USE_OPENAL_DLOPEN - link with OpenAL at runtime
USE_CURL - use libcurl for http/ftp download support USE_CURL - use libcurl for http/ftp download support
@ -140,15 +128,12 @@ New cvars
s_sdlDevSamps - SDL DMA buffer size override s_sdlDevSamps - SDL DMA buffer size override
s_sdlMixSamps - SDL mix buffer size override s_sdlMixSamps - SDL mix buffer size override
ttycon_ansicolor - enable use of ANSI escape codes in the tty com_ansiColor - enable use of ANSI escape codes in the tty
r_GLlibCoolDownMsec - wait for some milliseconds to close GL
library
com_altivec - enable use of altivec on PowerPC systems com_altivec - enable use of altivec on PowerPC systems
s_backend - read only, indicates the current sound s_backend - read only, indicates the current sound
backend backend
in_shiftedKeys - non-SDL Linux only; enables binding to s_muteWhenMinimized - mute sound when minimized
shifted keys in_joystickNo - select which joystick to use
in_joystickNo - SDL only; select which joystick to use
cl_consoleHistory - read only, stores the console history cl_consoleHistory - read only, stores the console history
cl_platformSensitivity - read only, indicates the mouse input cl_platformSensitivity - read only, indicates the mouse input
scaling scaling
@ -292,8 +277,8 @@ Multiuser Support on Windows systems
Note that this cvar MUST be set as a command line parameter. Note that this cvar MUST be set as a command line parameter.
SDL Keyboard Differences SDL Keyboard Differences
ioquake3 clients built againt SDL (e.g. Linux and Mac OS X) have different ioquake3 clients have different keyboard behaviour compared to the original
keyboard behaviour than the original Quake3 clients. Quake3 clients.
* "Caps Lock" and "Num Lock" can not be used as normal binds since they * "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. 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 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 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 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 patches will be accepted as long as they are entirely optional, do not
require new media and are off by default. 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 providing pak0.pk3 and the patch pk3s are not refered to or included in the
installer. installer.
* Please include at least an SDL so/dylib on every platform but Windows * Please include at least an SDL so/dylib on every platform.
(which doesn't use it yet).
* Please include an OpenAL so/dylib/dll, since every platform should be using * Please include an OpenAL so/dylib/dll, since every platform should be using
it by now. it by now.

1
TODO
View file

@ -19,7 +19,6 @@ MacOS X
For 1.35+: For 1.35+:
* IPv6 support * IPv6 support
* Replace windows DirectX backend with SDL
* Graphical "ioquake3" watermark in videos, optional, on by default * Graphical "ioquake3" watermark in videos, optional, on by default
* Gamma stuff while recording videos. * Gamma stuff while recording videos.
* Application for OS X at least to launch mods with appropriate hunkmegs, etc. * 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 the last piece was a variable string
if (lastvariable >= 0) if (lastvariable >= 0)
{ {
assert( match->variables[lastvariable].offset >= 0 ); // bk001204 assert( match->variables[lastvariable].offset >= 0 );
match->variables[lastvariable].length = match->variables[lastvariable].length =
strlen(&match->string[ (int) match->variables[lastvariable].offset]); strlen(&match->string[ (int) match->variables[lastvariable].offset]);
} //end if } //end if
@ -1500,7 +1500,7 @@ void BotMatchVariable(bot_match_t *match, int variable, char *buf, int size)
{ {
if (match->variables[variable].length < size) if (match->variables[variable].length < size)
size = match->variables[variable].length+1; 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); strncpy(buf, &match->string[ (int) match->variables[variable].offset], size-1);
buf[size-1] = '\0'; buf[size-1] = '\0';
} //end if } //end if
@ -2316,7 +2316,7 @@ int BotExpandChatMessage(char *outmessage, char *message, unsigned long mcontext
} //end if } //end if
if (match->variables[num].offset >= 0) 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]; ptr = &match->string[ (int) match->variables[num].offset];
for (i = 0; i < match->variables[num].length; i++) 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 float avoidgoaltimes[MAX_AVOIDGOALS]; //times to avoid the goals
} bot_goalstate_t; } bot_goalstate_t;
bot_goalstate_t *botgoalstates[MAX_CLIENTS + 1]; // bk001206 - FIXME: init? bot_goalstate_t *botgoalstates[MAX_CLIENTS + 1]; // FIXME: init?
//item configuration //item configuration
itemconfig_t *itemconfig = NULL; // bk001206 - init itemconfig_t *itemconfig = NULL;
//level items //level items
levelitem_t *levelitemheap = NULL; // bk001206 - init levelitem_t *levelitemheap = NULL;
levelitem_t *freelevelitems = NULL; // bk001206 - init levelitem_t *freelevelitems = NULL;
levelitem_t *levelitems = NULL; // bk001206 - init levelitem_t *levelitems = NULL;
int numlevelitems = 0; int numlevelitems = 0;
//map locations //map locations
maplocation_t *maplocations = NULL; // bk001206 - init maplocation_t *maplocations = NULL;
//camp spots //camp spots
campspot_t *campspots = NULL; // bk001206 - init campspot_t *campspots = NULL;
//the game type //the game type
int g_gametype = 0; // bk001206 - init int g_gametype = 0;
//additional dropped item weight //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_ELEVATOR
//#define DEBUG_GRAPPLE //#define DEBUG_GRAPPLE
// bk001204 - redundant bot_avoidspot_t, see be_ai_move.h
//movement state //movement state
//NOTE: the moveflags MFL_ONGROUND, MFL_TELEPORTED, MFL_WATERJUMP and //NOTE: the moveflags MFL_ONGROUND, MFL_TELEPORTED, MFL_WATERJUMP and
// MFL_GRAPPLEPULL must be set outside the movement code // 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}} #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 typedef struct bot_avoidspot_s
{ {
vec3_t origin; 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 WEAPON_OFS(x) (size_t)&(((weaponinfo_t *)0)->x)
#define PROJECTILE_OFS(x) (size_t)&(((projectileinfo_t *)0)->x) #define PROJECTILE_OFS(x) (size_t)&(((projectileinfo_t *)0)->x)
//weapon definition // bk001212 - static //weapon definition
static fielddef_t weaponinfo_fields[] = static fielddef_t weaponinfo_fields[] =
{ {
{"number", WEAPON_OFS(number), FT_INT}, //weapon number {"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 * desc: bot library interface
* *
@ -140,7 +140,7 @@ int Export_BotLibSetup(void)
char *homedir, *gamedir; char *homedir, *gamedir;
bot_developer = LibVarGetValue("bot_developer"); bot_developer = LibVarGetValue("bot_developer");
memset( &botlibglobals, 0, sizeof(botlibglobals) ); // bk001207 - init memset( &botlibglobals, 0, sizeof(botlibglobals) );
//initialize byte swapping (litte endian etc.) //initialize byte swapping (litte endian etc.)
// Swap_Init(); // Swap_Init();
homedir = LibVarGetString("homedir"); homedir = LibVarGetString("homedir");
@ -860,9 +860,9 @@ GetBotLibAPI
============ ============
*/ */
botlib_export_t *GetBotLibAPI(int apiVersion, botlib_import_t *import) { botlib_export_t *GetBotLibAPI(int apiVersion, botlib_import_t *import) {
assert(import); // bk001129 - this wasn't set for baseq3/ assert(import);
botimport = *import; botimport = *import;
assert(botimport.Print); // bk001129 - pars pro toto assert(botimport.Print);
Com_Memset( &be_botlib_export, 0, sizeof( be_botlib_export ) ); Com_Memset( &be_botlib_export, 0, sizeof( be_botlib_export ) );

View file

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

View file

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

View file

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

View file

@ -1596,18 +1596,18 @@ static void CG_DrawDisconnect( void ) {
int cmdNum; int cmdNum;
usercmd_t cmd; usercmd_t cmd;
const char *s; const char *s;
int w; // bk010215 - FIXME char message[1024]; int w;
// draw the phone jack if we are completely past our buffers // draw the phone jack if we are completely past our buffers
cmdNum = trap_GetCurrentCmdNumber() - CMD_BACKUP + 1; cmdNum = trap_GetCurrentCmdNumber() - CMD_BACKUP + 1;
trap_GetUserCmd( cmdNum, &cmd ); trap_GetUserCmd( cmdNum, &cmd );
if ( cmd.serverTime <= cg.snap->ps.commandTime 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; return;
} }
// also add text in center of screen // also add text in center of screen
s = "Connection Interrupted"; // bk 010215 - FIXME s = "Connection Interrupted";
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
CG_DrawBigString( 320 - w/2, 100, s, 1.0F); CG_DrawBigString( 320 - w/2, 100, s, 1.0F);
@ -1786,8 +1786,8 @@ static void CG_DrawCenterString( void ) {
char *start; char *start;
int l; int l;
int x, y, w; int x, y, w;
#ifdef MISSIONPACK // bk010221 - unused else #ifdef MISSIONPACK
int h; int h;
#endif #endif
float *color; 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 UI_DrawProportionalString2
@ -594,7 +590,7 @@ UI_DrawBannerString
static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color ) static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color )
{ {
const char* s; const char* s;
unsigned char ch; // bk001204 : array subscript unsigned char ch;
float ax; float ax;
float ay; float ay;
float aw; 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 ) static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset )
{ {
const char* s; const char* s;
unsigned char ch; // bk001204 - unsigned unsigned char ch;
float ax; float ax;
float ay; float ay;
float aw; float aw;

View file

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

View file

@ -1635,7 +1635,7 @@ typedef enum {
SYSTEM_PRINT, SYSTEM_PRINT,
CHAT_PRINT, CHAT_PRINT,
TEAMCHAT_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); 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; int cvarFlags;
} cvarTable_t; } cvarTable_t;
static cvarTable_t cvarTable[] = { // bk001129 static cvarTable_t cvarTable[] = {
{ &cg_ignore, "cg_ignore", "0", 0 }, // used for debugging { &cg_ignore, "cg_ignore", "0", 0 }, // used for debugging
{ &cg_autoswitch, "cg_autoswitch", "1", CVAR_ARCHIVE }, { &cg_autoswitch, "cg_autoswitch", "1", CVAR_ARCHIVE },
{ &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE }, { &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
@ -1357,7 +1357,7 @@ qboolean CG_Asset_Parse(int handle) {
continue; continue;
} }
} }
return qfalse; // bk001204 - why not? return qfalse;
} }
void CG_ParseMenu(const char *menuFile) { void CG_ParseMenu(const char *menuFile) {
@ -1690,7 +1690,7 @@ static void CG_FeederSelection(float feederID, int index) {
} }
#endif #endif
#ifdef MISSIONPACK // bk001204 - only needed there #ifdef MISSIONPACK
static float CG_Cvar_Get(const char *cvar) { static float CG_Cvar_Get(const char *cvar) {
char buff[128]; char buff[128];
memset(buff, 0, sizeof(buff)); 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. #error This file not be used for classic Q3A.
#endif #endif
@ -172,7 +172,7 @@ static void CG_DrawPlayerArmorIcon( rectDef_t *rect, qboolean draw2D ) {
cent = &cg_entities[cg.snap->ps.clientNum]; cent = &cg_entities[cg.snap->ps.clientNum];
ps = &cg.snap->ps; 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 ); CG_DrawPic( rect->x, rect->y + rect->h/2 + 1, rect->w, rect->h, cgs.media.armorIcon );
} else if (cg_draw3dIcons.integer) { } else if (cg_draw3dIcons.integer) {
VectorClear( angles ); 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] = { 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} }; // { 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.69f, 0.0f, 1.0f } , // normal
{ 1.0f, 0.2f, 0.2f, 1.0f }, // low health { 1.0f, 0.2f, 0.2f, 1.0f }, // low health
{ 0.5f, 0.5f, 0.5f, 1.0f}, // weapon firing { 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]; cent = &cg_entities[cg.snap->ps.clientNum];
ps = &cg.snap->ps; 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; qhandle_t icon;
icon = cg_weapons[ cg.predictedPlayerState.weapon ].ammoIcon; icon = cg_weapons[ cg.predictedPlayerState.weapon ].ammoIcon;
if ( icon ) { if ( icon ) {
@ -1214,8 +1213,6 @@ static void CG_Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4
vec4_t newColor; vec4_t newColor;
glyphInfo_t *glyph; glyphInfo_t *glyph;
if (text) { if (text) {
// TTimo: FIXME
// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; const char *s = text;
float max = *maxX; float max = *maxX;
float useScale; 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 CG_PlayerTokens
@ -2025,7 +2025,7 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane ) {
// fade the shadow out with height // fade the shadow out with height
alpha = 1.0 - trace.fraction; alpha = 1.0 - trace.fraction;
// bk0101022 - hack / FPE - bogus planes? // hack / FPE - bogus planes?
//assert( DotProduct( trace.plane.normal, trace.plane.normal ) != 0.0f ) //assert( DotProduct( trace.plane.normal, trace.plane.normal ) != 0.0f )
// add the mark as a temporary, so it goes directly to the renderer // 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 // be a valid snapshot this frame
#include "cg_local.h" #include "cg_local.h"
#include "../../ui/menudef.h" // bk001205 - for Q3_ui as well #include "../../ui/menudef.h"
typedef struct { typedef struct {
const char *order; const char *order;
@ -46,7 +46,7 @@ static const orderTask_t validOrders[] = {
static const int numValidOrders = sizeof(validOrders) / sizeof(orderTask_t); static const int numValidOrders = sizeof(validOrders) / sizeof(orderTask_t);
#ifdef MISSIONPACK // bk001204 #ifdef MISSIONPACK
static int CG_ValidOrder(const char *p) { static int CG_ValidOrder(const char *p) {
int i; int i;
for (i = 0; i < numValidOrders; 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) ); return re.inPVS( VMA(1), VMA(2) );
default: default:
assert(0); // bk010102 assert(0);
Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] ); Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] );
} }
return 0; return 0;
@ -906,8 +906,6 @@ void CL_FirstSnapshot( void ) {
Cbuf_AddText( cl_activeAction->string ); Cbuf_AddText( cl_activeAction->string );
Cvar_Set( "activeAction", "" ); Cvar_Set( "activeAction", "" );
} }
Sys_BeginProfiling();
} }
/* /*
@ -1010,9 +1008,35 @@ void CL_SetCGameTime( void ) {
// while a normal demo may have different time samples // while a normal demo may have different time samples
// each time it is played back // each time it is played back
if ( cl_timedemo->integer ) { if ( cl_timedemo->integer ) {
int now = Sys_Milliseconds( );
int frameDuration;
if (!clc.timeDemoStart) { 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++; clc.timeDemoFrames++;
cl.serverTime = clc.timeDemoBaseTime + clc.timeDemoFrames * 50; cl.serverTime = clc.timeDemoBaseTime + clc.timeDemoFrames * 50;
} }

View file

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

View file

@ -71,9 +71,8 @@ Con_ToggleConsole_f
================ ================
*/ */
void Con_ToggleConsole_f (void) { 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 ) { if ( cls.state == CA_DISCONNECTED && cls.keyCatchers == KEYCATCH_CONSOLE ) {
CL_StartDemoLoop();
return; return;
} }
@ -619,13 +618,13 @@ void Con_DrawSolidConsole( float frac ) {
re.SetColor( g_color_table[ColorIndex(COLOR_RED)] ); re.SetColor( g_color_table[ColorIndex(COLOR_RED)] );
i = strlen( SVN_VERSION ); i = strlen( Q3_VERSION );
for (x=0 ; x<i ; x++) { for (x=0 ; x<i ; x++) {
SCR_DrawSmallChar( cls.glconfig.vidWidth - ( i - x ) * SMALLCHAR_WIDTH, 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; cvar_t *cl_cURLLib;
#if USE_CURL_DLOPEN #if USE_CURL_DLOPEN
#include "../sys/sys_loadlib.h"
#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
char* (*qcurl_version)(void); char* (*qcurl_version)(void);
@ -85,7 +55,7 @@ CURLMsg *(*qcurl_multi_info_read)(CURLM *multi_handle,
int *msgs_in_queue); int *msgs_in_queue);
const char *(*qcurl_multi_strerror)(CURLMcode); 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; void *rv;
rv = SYMLOAD(cURLLib, str); rv = Sys_LoadFunction(cURLLib, str);
if(!rv) if(!rv)
{ {
Com_Printf("Can't load symbol %s\n", str); Com_Printf("Can't load symbol %s\n", str);
@ -124,17 +94,17 @@ qboolean CL_cURL_Init()
Com_Printf("Loading \"%s\"...", cl_cURLLib->string); Com_Printf("Loading \"%s\"...", cl_cURLLib->string);
if( (cURLLib = OBJLOAD(cl_cURLLib->string)) == 0 ) if( (cURLLib = Sys_LoadLibrary(cl_cURLLib->string)) == 0 )
{ {
#ifdef _WIN32 #ifdef _WIN32
return qfalse; return qfalse;
#else #else
char fn[1024]; char fn[1024];
getcwd(fn, sizeof(fn)); Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
strncat(fn, "/", sizeof(fn)-strlen(fn)-1); strncat(fn, "/", sizeof(fn)-strlen(fn)-1);
strncat(fn, cl_cURLLib->string, 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; return qfalse;
} }
@ -189,7 +159,7 @@ void CL_cURL_Shutdown( void )
#if USE_CURL_DLOPEN #if USE_CURL_DLOPEN
if(cURLLib) if(cURLLib)
{ {
OBJFREE(cURLLib); Sys_UnloadLibrary(cURLLib);
cURLLib = NULL; cURLLib = NULL;
} }
qcurl_easy_init = 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 (key == K_ENTER)
{ {
if (down) if (down)
@ -1157,14 +1156,10 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
Key_ClearStates(); Key_ClearStates();
Cvar_SetValue( "r_fullscreen", Cvar_SetValue( "r_fullscreen",
!Cvar_VariableIntegerValue( "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; return;
} }
} }
} }
#endif
// console key is hardcoded, so the user can never unbind it // console key is hardcoded, so the user can never unbind it
if (key == '`' || key == '~' || if (key == '`' || key == '~' ||
@ -1207,7 +1202,7 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
if ( cls.state == CA_ACTIVE && !clc.demoplaying ) { if ( cls.state == CA_ACTIVE && !clc.demoplaying ) {
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME ); VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
} }
else { else if ( cls.state != CA_DISCONNECTED ) {
CL_Disconnect_f(); CL_Disconnect_f();
S_StopAllSounds(); S_StopAllSounds();
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN ); 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 // key up events only perform actions if the game key binding is
// a button command (leading + sign). These will be processed even in // 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. // an action started before a mode switch.
// //
if (!down) { if (!down ) {
kb = keys[key].binding; 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 ) { if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
VM_Call( uivm, UI_KEY_EVENT, key, down ); VM_Call( uivm, UI_KEY_EVENT, key, down );
} else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) { } else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) {
VM_Call( cgvm, CG_KEY_EVENT, key, down ); VM_Call( cgvm, CG_KEY_EVENT, key, down );
} }
}
return; 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" Com_Printf ("%s is unbound, use controls menu to set.\n"
, Key_KeynumToString( key ) ); , Key_KeynumToString( key ) );
} }
} else if (kb[0] == '+') { } else if (kb[0] == '+') {
int i; int i;
char button[1024], *buttonPtr; char button[1024], *buttonPtr;
buttonPtr = button; buttonPtr = button;

View file

@ -43,6 +43,7 @@ cvar_t *cl_freezeDemo;
cvar_t *cl_shownet; cvar_t *cl_shownet;
cvar_t *cl_showSend; cvar_t *cl_showSend;
cvar_t *cl_timedemo; cvar_t *cl_timedemo;
cvar_t *cl_timedemoLog;
cvar_t *cl_autoRecordDemo; cvar_t *cl_autoRecordDemo;
cvar_t *cl_aviFrameRate; cvar_t *cl_aviFrameRate;
cvar_t *cl_aviMotionJpeg; 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 CL_DemoCompleted
================= =================
*/ */
void CL_DemoCompleted( void ) { void CL_DemoCompleted( void )
if (cl_timedemo && cl_timedemo->integer) { {
char buffer[ MAX_STRING_CHARS ];
if( cl_timedemo && cl_timedemo->integer )
{
int time; int time;
time = Sys_Milliseconds() - clc.timeDemoStart; time = Sys_Milliseconds() - clc.timeDemoStart;
if ( time > 0 ) { if( time > 0 )
Com_Printf ("%i frames, %3.1f seconds: %3.1f fps\n", clc.timeDemoFrames, {
time/1000.0, clc.timeDemoFrames*1000.0 / time); // 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(); Hunk_ClearToMark();
} }
CL_StartHunkUsers(); CL_StartHunkUsers( qfalse );
} }
/* /*
@ -671,6 +749,12 @@ memory on the hunk from cgame, ui, and renderer
===================== =====================
*/ */
void CL_MapLoading( void ) { void CL_MapLoading( void ) {
if ( com_dedicated->integer ) {
cls.state = CA_DISCONNECTED;
cls.keyCatchers = KEYCATCH_CONSOLE;
return;
}
if ( !com_cl_running->integer ) { if ( !com_cl_running->integer ) {
return; return;
} }
@ -830,7 +914,7 @@ void CL_ForwardCommandToServer( const char *string ) {
} }
if ( clc.demoplaying || cls.state < CA_CONNECTED || cmd[0] == '+' ) { 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; return;
} }
@ -939,26 +1023,22 @@ void CL_RequestAuthorization( void ) {
return; return;
} }
if ( Cvar_VariableValue( "fs_restrict" ) ) { // only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
Q_strncpyz( nums, "demota", sizeof( nums ) ); j = 0;
} else { l = strlen( cl_cdkey );
// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces if ( l > 32 ) {
j = 0; l = 32;
l = strlen( cl_cdkey ); }
if ( l > 32 ) { for ( i = 0 ; i < l ; i++ ) {
l = 32; if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
}
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' )
|| ( cl_cdkey[i] >= 'A' && cl_cdkey[i] <= 'Z' ) || ( cl_cdkey[i] >= 'A' && cl_cdkey[i] <= 'Z' )
) { ) {
nums[j] = cl_cdkey[i]; nums[j] = cl_cdkey[i];
j++; j++;
}
} }
nums[j] = 0;
} }
nums[j] = 0;
fs = Cvar_Get ("cl_anonymous", "0", CVAR_INIT|CVAR_SYSTEMINFO ); fs = Cvar_Get ("cl_anonymous", "0", CVAR_INIT|CVAR_SYSTEMINFO );
@ -1276,7 +1356,7 @@ void CL_Vid_Restart_f( void ) {
CL_InitRef(); CL_InitRef();
// startup all the client stuff // startup all the client stuff
CL_StartHunkUsers(); CL_StartHunkUsers( qfalse );
// start the cgame if connected // start the cgame if connected
if ( cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) { 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 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) { if (!com_cl_running) {
return; return;
} }
@ -2330,6 +2410,10 @@ void CL_StartHunkUsers( void ) {
CL_InitRenderer(); CL_InitRenderer();
} }
if ( rendererOnly ) {
return;
}
if ( !cls.soundStarted ) { if ( !cls.soundStarted ) {
cls.soundStarted = qtrue; cls.soundStarted = qtrue;
S_Init(); S_Init();
@ -2590,6 +2674,7 @@ void CL_Init( void ) {
cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP ); cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP );
cl_timedemo = Cvar_Get ("timedemo", "0", 0); 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_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE); cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", 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++) for (i=3; i<count; i++)
buffptr += sprintf( buffptr, " %s", Cmd_Argv(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 ); 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 // if the menu is going to cover the entire screen, we
// don't need to render anything under it // 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 ) { switch( cls.state ) {
default: default:
Com_Error( ERR_FATAL, "SCR_DrawScreenField: bad cls.state" ); Com_Error( ERR_FATAL, "SCR_DrawScreenField: bad cls.state" );

View file

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

View file

@ -153,6 +153,7 @@ demo through a file.
============================================================================= =============================================================================
*/ */
#define MAX_TIMEDEMO_DURATIONS 4096
typedef struct { typedef struct {
@ -219,6 +220,10 @@ typedef struct {
int timeDemoFrames; // counter of rendered frames int timeDemoFrames; // counter of rendered frames
int timeDemoStart; // cls.realtime before first frame int timeDemoStart; // cls.realtime before first frame
int timeDemoBaseTime; // each frame will be at this time + frameNum * 50 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 // big stuff at end of structure so most offsets are 15 bits or less
netchan_t netchan; netchan_t netchan;
@ -384,7 +389,7 @@ void CL_FlushMemory(void);
void CL_ShutdownAll(void); void CL_ShutdownAll(void);
void CL_AddReliableCommand( const char *cmd ); void CL_AddReliableCommand( const char *cmd );
void CL_StartHunkUsers( void ); void CL_StartHunkUsers( qboolean rendererOnly );
void CL_Disconnect_f (void); void CL_Disconnect_f (void);
void CL_GetChallengePacket (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_OPENAL_DLOPEN
#if USE_SDL_VIDEO #include "../sys/sys_loadlib.h"
#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
LPALENABLE qalEnable; LPALENABLE qalEnable;
LPALDISABLE qalDisable; LPALDISABLE qalDisable;
@ -131,7 +102,7 @@ LPALCGETENUMVALUE qalcGetEnumValue;
LPALCGETSTRING qalcGetString; LPALCGETSTRING qalcGetString;
LPALCGETINTEGERV qalcGetIntegerv; LPALCGETINTEGERV qalcGetIntegerv;
static OBJTYPE OpenALLib = NULL; static void *OpenALLib = NULL;
static qboolean alinit_fail = qfalse; static qboolean alinit_fail = qfalse;
@ -144,7 +115,7 @@ static void *GPA(char *str)
{ {
void *rv; void *rv;
rv = SYMLOAD(OpenALLib, str); rv = Sys_LoadFunction(OpenALLib, str);
if(!rv) if(!rv)
{ {
Com_Printf( " Can't load symbol %s\n", str); Com_Printf( " Can't load symbol %s\n", str);
@ -169,17 +140,17 @@ qboolean QAL_Init(const char *libname)
return qtrue; return qtrue;
Com_Printf( "Loading \"%s\"...\n", libname); Com_Printf( "Loading \"%s\"...\n", libname);
if( (OpenALLib = OBJLOAD(libname)) == 0 ) if( (OpenALLib = Sys_LoadLibrary(libname)) == 0 )
{ {
#ifdef _WIN32 #ifdef _WIN32
return qfalse; return qfalse;
#else #else
char fn[1024]; char fn[1024];
getcwd(fn, sizeof(fn)); Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
strncat(fn, "/", sizeof(fn) - strlen(fn) - 1); strncat(fn, "/", sizeof(fn) - strlen(fn) - 1);
strncat(fn, libname, 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; return qfalse;
} }
@ -278,7 +249,7 @@ void QAL_Shutdown( void )
{ {
if(OpenALLib) if(OpenALLib)
{ {
OBJFREE(OpenALLib); Sys_UnloadLibrary(OpenALLib);
OpenALLib = NULL; OpenALLib = NULL;
} }

View file

@ -616,11 +616,7 @@ void S_Base_ClearSoundBuffer( void ) {
SNDDMA_BeginPainting (); SNDDMA_BeginPainting ();
if (dma.buffer) if (dma.buffer)
// TTimo: due to a particular bug workaround in linux sound code, Com_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
// 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);
SNDDMA_Submit (); SNDDMA_Submit ();
} }

View file

@ -30,6 +30,7 @@ cvar_t *s_volume;
cvar_t *s_musicVolume; cvar_t *s_musicVolume;
cvar_t *s_doppler; cvar_t *s_doppler;
cvar_t *s_backend; cvar_t *s_backend;
cvar_t *s_muteWhenMinimized;
static soundInterface_t si; static soundInterface_t si;
@ -219,6 +220,11 @@ S_Update
*/ */
void S_Update( void ) void S_Update( void )
{ {
if( s_muteWhenMinimized->integer && com_minimized->integer ) {
S_StopAllSounds( );
return;
}
if( si.Update ) { if( si.Update ) {
si.Update( ); si.Update( );
} }
@ -372,6 +378,7 @@ void S_Init( void )
s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE ); s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE );
s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE ); s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE );
s_backend = Cvar_Get( "s_backend", "", CVAR_ROM ); s_backend = Cvar_Get( "s_backend", "", CVAR_ROM );
s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE );
cv = Cvar_Get( "s_initsound", "1", 0 ); cv = Cvar_Get( "s_initsound", "1", 0 );
if( !cv->integer ) { 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 portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
static int snd_vol; static int snd_vol;
// bk001119 - these not static, required by unix/snd_mixa.s
int* snd_p; int* snd_p;
int snd_linear_count; int snd_linear_count;
short* snd_out; 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 #include "match.h" //string matching types and vars
// for the voice chats // for the voice chats
#ifdef MISSIONPACK // bk001205 #ifdef MISSIONPACK
#include "../../ui/menudef.h" #include "../../ui/menudef.h"
#endif #endif

View file

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

View file

@ -1626,9 +1626,6 @@ int BotInitLibrary(void) {
//game directory //game directory
trap_Cvar_VariableStringBuffer("fs_game", buf, sizeof(buf)); trap_Cvar_VariableStringBuffer("fs_game", buf, sizeof(buf));
if (strlen(buf)) trap_BotLibVarSet("gamedir", 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 //home directory
trap_Cvar_VariableStringBuffer("fs_homepath", buf, sizeof(buf)); trap_Cvar_VariableStringBuffer("fs_homepath", buf, sizeof(buf));
if (strlen(buf)) trap_BotLibVarSet("homedir", 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[] = static const char rcsid[] =
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
// bk001127 - needed for DLL's
#if !defined( Q3_VM ) #if !defined( Q3_VM )
typedef int cmp_t(const void *, const void *); typedef int cmp_t(const void *, const void *);
#endif #endif
@ -189,8 +188,6 @@ loop: SWAPINIT(a, es);
// this file is excluded from release builds because of intrinsics // this file is excluded from release builds because of intrinsics
// bk001211 - gcc errors on compiling strcpy: parse error before `__extension__'
#if defined ( Q3_VM ) #if defined ( Q3_VM )
size_t strlen( const char *string ) { size_t strlen( const char *string ) {
@ -265,7 +262,7 @@ char *strstr( const char *string, const char *strCharSet ) {
} }
return (char *)0; return (char *)0;
} }
#endif // bk001211 #endif
#if defined ( Q3_VM ) #if defined ( Q3_VM )
int tolower( int c ) { int tolower( int c ) {
@ -754,8 +751,6 @@ double atan2( double y, double x ) {
#endif #endif
#ifdef Q3_VM #ifdef Q3_VM
// bk001127 - guarded this tan replacement
// ld: undefined versioned symbol name tan@@GLIBC_2.0
double tan( double x ) { double tan( double x ) {
return sin(x) / cos(x); return sin(x) / cos(x);
} }
@ -844,7 +839,7 @@ double _atof( const char **stringPtr ) {
const char *string; const char *string;
float sign; float sign;
float value; float value;
int c = '0'; // bk001211 - uninitialized use possible int c = '0';
string = *stringPtr; 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" ); Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: IT_BAD" );
default: default:
#ifndef Q3_VM #ifndef Q3_VM
#ifndef NDEBUG // bk0001204 #ifndef NDEBUG
Com_Printf("BG_CanItemBeGrabbed: unknown enum %d\n", item->giType ); Com_Printf("BG_CanItemBeGrabbed: unknown enum %d\n", item->giType );
#endif #endif
#endif #endif

View file

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

View file

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

View file

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

View file

@ -95,7 +95,6 @@ vmCvar_t g_enableBreath;
vmCvar_t g_proxMineTimeout; vmCvar_t g_proxMineTimeout;
#endif #endif
// bk001129 - made static to avoid aliasing
static cvarTable_t gameCvarTable[] = { static cvarTable_t gameCvarTable[] = {
// don't override the cheat state set by the system // don't override the cheat state set by the system
{ &g_cheats, "sv_cheats", "", 0, 0, qfalse }, { &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] ); 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 ) { void LogExit( const char *string ) {
int i, numSorted; int i, numSorted;
gclient_t *cl; gclient_t *cl;
#ifdef MISSIONPACK // bk001205 #ifdef MISSIONPACK
qboolean won = qtrue; qboolean won = qtrue;
#endif #endif
G_LogPrintf( "Exit: %s\n", string ); G_LogPrintf( "Exit: %s\n", string );

View file

@ -41,7 +41,7 @@ void *G_Alloc( int size ) {
} }
if ( allocPoint + size > POOLSIZE ) { 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; return NULL;
} }

View file

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

View file

@ -68,7 +68,6 @@ METHODDEF void process_data_buffer_main
METHODDEF void METHODDEF void
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) 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; my_main_ptr jmain = (my_main_ptr) cinfo->main;
/* Do nothing in raw-data mode. */ /* 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, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
JDIMENSION in_rows_avail) JDIMENSION in_rows_avail)
{ {
// bk001204 - don't use main
my_main_ptr jmain = (my_main_ptr) cinfo->main; my_main_ptr jmain = (my_main_ptr) cinfo->main;
while (jmain->cur_iMCU_row < cinfo->total_iMCU_rows) { while (jmain->cur_iMCU_row < cinfo->total_iMCU_rows) {
@ -246,7 +244,6 @@ process_data_buffer_main (j_compress_ptr cinfo,
GLOBAL void GLOBAL void
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
{ {
// bk001204 - don't use main
my_main_ptr jmain; my_main_ptr jmain;
int ci; int ci;
jpeg_component_info *compptr; 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. * This is done only once, not once per pass.
*/ */
{ {
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main; my_main_ptr jmain = (my_main_ptr) cinfo->main;
int ci, rgroup; int ci, rgroup;
int M = cinfo->min_DCT_scaled_size; 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. * This will be repeated at the beginning of each pass.
*/ */
{ {
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main; my_main_ptr jmain = (my_main_ptr) cinfo->main;
int ci, i, rgroup; int ci, i, rgroup;
int M = cinfo->min_DCT_scaled_size; 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. * 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; my_main_ptr jmain = (my_main_ptr) cinfo->main;
int ci, i, rgroup; int ci, i, rgroup;
int M = cinfo->min_DCT_scaled_size; 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. * 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; my_main_ptr jmain = (my_main_ptr) cinfo->main;
int ci, i, rgroup, iMCUheight, rows_left; int ci, i, rgroup, iMCUheight, rows_left;
jpeg_component_info *compptr; jpeg_component_info *compptr;
@ -310,7 +306,6 @@ set_bottom_pointers (j_decompress_ptr cinfo)
METHODDEF void METHODDEF void
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) 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; my_main_ptr jmain = (my_main_ptr) cinfo->main;
switch (pass_mode) { switch (pass_mode) {
@ -351,7 +346,6 @@ process_data_simple_main (j_decompress_ptr cinfo,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail) JDIMENSION out_rows_avail)
{ {
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main; my_main_ptr jmain = (my_main_ptr) cinfo->main;
JDIMENSION rowgroups_avail; JDIMENSION rowgroups_avail;
@ -392,7 +386,6 @@ process_data_context_main (j_decompress_ptr cinfo,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail) JDIMENSION out_rows_avail)
{ {
// bk001204 - no use main
my_main_ptr jmain = (my_main_ptr) cinfo->main; my_main_ptr jmain = (my_main_ptr) cinfo->main;
/* Read input data if we haven't filled the main buffer yet */ /* 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 GLOBAL void
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
{ {
// bk001204 - no use main
my_main_ptr jmain; my_main_ptr jmain;
int ci, rgroup, ngroups; int ci, rgroup, ngroups;
jpeg_component_info *compptr; 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 ) { qboolean CL_GameCommand( void ) {
return qfalse; // bk001204 - non-void return qfalse;
} }
void CL_KeyEvent (int key, qboolean down, unsigned time) { void CL_KeyEvent (int key, qboolean down, unsigned time) {
@ -81,11 +81,9 @@ void CL_CDDialog( void ) {
void CL_FlushMemory( 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) {} void CL_ShutdownAll(void) {}
// bk001208 - added new dummy (RC4)
qboolean CL_CDKeyValidate( const char *key, const char *checksum ) { return qtrue; } 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 ) sfxHandle_t S_RegisterSound( const char *name, qboolean compressed )
{ {
return 0; return 0;

View file

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

View file

@ -82,15 +82,6 @@ static void UI_DisplayDownloadInfo( const char *downloadName ) {
downloadCount = trap_Cvar_VariableValue( "cl_downloadCount" ); downloadCount = trap_Cvar_VariableValue( "cl_downloadCount" );
downloadTime = trap_Cvar_VariableValue( "cl_downloadTime" ); 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 ); leftWidth = width = UI_ProportionalStringWidth( dlText ) * UI_ProportionalSizeScale( style );
width = UI_ProportionalStringWidth( etaText ) * UI_ProportionalSizeScale( style ); width = UI_ProportionalStringWidth( etaText ) * UI_ProportionalSizeScale( style );
if (width > leftWidth) leftWidth = width; if (width > leftWidth) leftWidth = width;
@ -118,10 +109,6 @@ static void UI_DisplayDownloadInfo( const char *downloadName ) {
UI_DrawProportionalString( leftWidth, 192, UI_DrawProportionalString( leftWidth, 192,
va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), style, color_white ); va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), style, color_white );
} else { } 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) { if ( (uis.realtime - downloadTime) / 1000) {
xferRate = downloadCount / ((uis.realtime - downloadTime) / 1000); xferRate = downloadCount / ((uis.realtime - downloadTime) / 1000);
//xferRate = (int)( ((float)downloadCount) / elapsedTime); //xferRate = (int)( ((float)downloadCount) / elapsedTime);
@ -129,9 +116,6 @@ static void UI_DisplayDownloadInfo( const char *downloadName ) {
xferRate = 0; 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 ); UI_ReadableSize( xferRateBuf, sizeof xferRateBuf, xferRate );
// Extrapolate estimated completion time // 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 // We do it in K (/1024) because we'd overflow around 4MB
n = (n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000; 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); //(n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000);
UI_DrawProportionalString( leftWidth, 160, UI_DrawProportionalString( leftWidth, 160,

View file

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

View file

@ -811,10 +811,5 @@ void UI_InitGameinfo( void ) {
UI_LoadArenas(); UI_LoadArenas();
UI_LoadBots(); UI_LoadBots();
if( (trap_Cvar_VariableValue( "fs_restrict" )) || (ui_numSpecialSinglePlayerArenas == 0 && ui_numSinglePlayerArenas == 4) ) { uis.demoversion = qfalse;
uis.demoversion = qtrue;
}
else {
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 "../qcommon/q_shared.h"
#include "../renderer/tr_types.h" #include "../renderer/tr_types.h"
//NOTE: include the ui_public.h from the new UI //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 //redefine to old API version
#undef UI_API_VERSION #undef UI_API_VERSION
#define UI_API_VERSION 4 #define UI_API_VERSION 4
@ -678,7 +678,7 @@ int trap_MemoryRemaining( void );
void trap_GetCDKey( char *buf, int buflen ); void trap_GetCDKey( char *buf, int buflen );
void trap_SetCDKey( char *buf ); 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 ); 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 ); UI_DrawConnectScreen( arg0 );
return 0; return 0;
case UI_HASUNIQUECDKEY: // mod authors need to observe this 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; return -1;
@ -156,7 +156,6 @@ vmCvar_t ui_server16;
vmCvar_t ui_cdkeychecked; vmCvar_t ui_cdkeychecked;
// bk001129 - made static to avoid aliasing.
static cvarTable_t cvarTable[] = { static cvarTable_t cvarTable[] = {
{ &ui_ffa_fraglimit, "ui_ffa_fraglimit", "20", CVAR_ARCHIVE }, { &ui_ffa_fraglimit, "ui_ffa_fraglimit", "20", CVAR_ARCHIVE },
{ &ui_ffa_timelimit, "ui_ffa_timelimit", "0", 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 } { &ui_cdkeychecked, "ui_cdkeychecked", "0", CVAR_ROM }
}; };
// bk001129 - made static to avoid aliasing
static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]); 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 UI_Mods_LoadMods

View file

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

View file

@ -47,16 +47,6 @@ typedef struct
static teammain_t s_teammain; 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 TeamMain_MenuEvent

View file

@ -238,13 +238,6 @@ GRAPHICS OPTIONS MENU
#define GRAPHICSOPTIONS_ACCEPT0 "menu/art/accept_0" #define GRAPHICSOPTIONS_ACCEPT0 "menu/art/accept_0"
#define GRAPHICSOPTIONS_ACCEPT1 "menu/art/accept_1" #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_BACK2 101
#define ID_FULLSCREEN 102 #define ID_FULLSCREEN 102
#define ID_LIST 103 #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_allowExtensions", s_graphicsoptions.allow_extensions.curvalue );
trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue ); trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue );
trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue ); trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue );
trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] ); trap_Cvar_SetValue( "r_colorbits", 0 );
switch ( s_graphicsoptions.colordepth.curvalue ) trap_Cvar_SetValue( "r_depthbits", 0 );
{ trap_Cvar_SetValue( "r_stencilbits", 0 );
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_vertexLight", s_graphicsoptions.lighting.curvalue ); trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue );
if ( s_graphicsoptions.geometry.curvalue == 2 ) if ( s_graphicsoptions.geometry.curvalue == 2 )

View file

@ -41,7 +41,7 @@ BASIC MATH
RotatePoint 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; vec3_t tvec;
VectorCopy(point, tvec); VectorCopy(point, tvec);
@ -55,7 +55,7 @@ void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // bk: FIXME
TransposeMatrix 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; int i, j;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) { 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 ) { if ( tw->isPoint ) {
offset = 0; offset = 0;
} else { } 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 // this is silly
offset = 2048; 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 (start[0] == end[0] && start[1] == end[1] && start[2] == end[2]) {
if ( model ) { 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) { if ( model == BOX_MODEL_HANDLE || model == CAPSULE_MODEL_HANDLE) {
tw.sphere.use = qfalse; tw.sphere.use = qfalse;
CM_TestInLeaf( &tw, &cmod->leaf ); 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_journalFile; // events are written here
fileHandle_t com_journalDataFile; // config files are written here fileHandle_t com_journalDataFile; // config files are written here
cvar_t *com_viewlog;
cvar_t *com_speeds; cvar_t *com_speeds;
cvar_t *com_developer; cvar_t *com_developer;
cvar_t *com_dedicated; cvar_t *com_dedicated;
@ -80,9 +79,9 @@ cvar_t *sv_paused;
cvar_t *cl_packetdelay; cvar_t *cl_packetdelay;
cvar_t *sv_packetdelay; cvar_t *sv_packetdelay;
cvar_t *com_cameraMode; cvar_t *com_cameraMode;
#if defined(_WIN32) && defined(_DEBUG) cvar_t *com_ansiColor;
cvar_t *com_noErrorInterrupt; cvar_t *com_unfocused;
#endif cvar_t *com_minimized;
// com_speeds times // com_speeds times
int time_game; int time_game;
@ -161,10 +160,9 @@ void QDECL Com_Printf( const char *fmt, ... ) {
return; return;
} }
// echo to console if we're not a dedicated server #ifndef DEDICATED
if ( com_dedicated && !com_dedicated->integer ) { CL_ConsolePrint( msg );
CL_ConsolePrint( msg ); #endif
}
// echo to dedicated console and early console // echo to dedicated console and early console
Sys_Print( msg ); Sys_Print( msg );
@ -246,16 +244,6 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
static int errorCount; static int errorCount;
int currentTime; 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 // when we are running automated scripts, make sure we
// know if anything failed // know if anything failed
if ( com_buildScript && com_buildScript->integer ) { if ( com_buildScript && com_buildScript->integer ) {
@ -1126,7 +1114,6 @@ typedef struct memstatic_s {
byte mem[2]; byte mem[2];
} memstatic_t; } memstatic_t;
// bk001204 - initializer brackets
memstatic_t emptystring = memstatic_t emptystring =
{ {(sizeof(memblock_t)+2 + 3) & ~3, TAG_STATIC, NULL, NULL, ZONEID}, {'\0', '\0'} }; { {(sizeof(memblock_t)+2 + 3) & ~3, TAG_STATIC, NULL, NULL, ZONEID}, {'\0', '\0'} };
memstatic_t numberstring[] = { memstatic_t numberstring[] = {
@ -1385,7 +1372,6 @@ Com_InitZoneMemory
*/ */
void Com_InitSmallZoneMemory( void ) { void Com_InitSmallZoneMemory( void ) {
s_smallZoneTotal = 512 * 1024; s_smallZoneTotal = 512 * 1024;
// bk001205 - was malloc
smallzone = calloc( s_smallZoneTotal, 1 ); smallzone = calloc( s_smallZoneTotal, 1 );
if ( !smallzone ) { if ( !smallzone ) {
Com_Error( ERR_FATAL, "Small zone data failed to allocate %1.1f megs", (float)s_smallZoneTotal / (1024*1024) ); 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; s_zoneTotal = cv->integer * 1024 * 1024;
} }
// bk001205 - was malloc
mainzone = calloc( s_zoneTotal, 1 ); mainzone = calloc( s_zoneTotal, 1 );
if ( !mainzone ) { if ( !mainzone ) {
Com_Error( ERR_FATAL, "Zone data failed to allocate %i megs", s_zoneTotal / (1024*1024) ); 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; s_hunkTotal = cv->integer * 1024 * 1024;
} }
// bk001205 - was malloc
s_hunkData = calloc( s_hunkTotal + 31, 1 ); s_hunkData = calloc( s_hunkTotal + 31, 1 );
if ( !s_hunkData ) { if ( !s_hunkData ) {
Com_Error( ERR_FATAL, "Hunk data failed to allocate %i megs", s_hunkTotal / (1024*1024) ); 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 #define MAX_PUSHED_EVENTS 1024
// bk001129 - init, also static
static int com_pushedEventsHead = 0; static int com_pushedEventsHead = 0;
static int com_pushedEventsTail = 0; static int com_pushedEventsTail = 0;
// bk001129 - static
static sysEvent_t com_pushedEvents[MAX_PUSHED_EVENTS]; 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 Com_GetRealEvent
@ -1964,7 +2061,7 @@ sysEvent_t Com_GetRealEvent( void ) {
} }
} }
} else { } else {
ev = Sys_GetEvent(); ev = Com_GetSystemEvent();
// write the journal value out if needed // write the journal value out if needed
if ( com_journal->integer == 1 ) { if ( com_journal->integer == 1 ) {
@ -1990,7 +2087,6 @@ sysEvent_t Com_GetRealEvent( void ) {
Com_InitPushEvent Com_InitPushEvent
================= =================
*/ */
// bk001129 - added
void Com_InitPushEvent( void ) { void Com_InitPushEvent( void ) {
// clear the static buffer array // clear the static buffer array
// this requires SE_NONE to be accepted as a valid but NOP event // 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 ) { void Com_PushEvent( sysEvent_t *event ) {
sysEvent_t *ev; 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) ]; ev = &com_pushedEvents[ com_pushedEventsHead & (MAX_PUSHED_EVENTS-1) ];
@ -2110,7 +2206,6 @@ int Com_EventLoop( void ) {
switch ( ev.evType ) { switch ( ev.evType ) {
default: default:
// bk001129 - was ev.evTime
Com_Error( ERR_FATAL, "Com_EventLoop: bad event type %i", ev.evType ); Com_Error( ERR_FATAL, "Com_EventLoop: bad event type %i", ev.evType );
break; break;
case SE_NONE: case SE_NONE:
@ -2322,7 +2417,7 @@ void Com_AppendCDKey( const char *filename ) {
} }
} }
#ifndef DEDICATED // bk001204 #ifndef DEDICATED
/* /*
================= =================
Com_WriteCDKey Com_WriteCDKey
@ -2378,7 +2473,7 @@ static void Com_DetectAltivec(void)
static qboolean altivec = qfalse; static qboolean altivec = qfalse;
static qboolean detected = qfalse; static qboolean detected = qfalse;
if (!detected) { if (!detected) {
altivec = Sys_DetectAltivec(); altivec = ( Sys_GetProcessorFeatures( ) & CF_ALTIVEC );
detected = qtrue; detected = qtrue;
} }
@ -2397,13 +2492,17 @@ Com_Init
void Com_Init( char *commandLine ) { void Com_Init( char *commandLine ) {
char *s; 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) ) { if ( setjmp (abortframe) ) {
Sys_Error ("Error during initialization"); 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_InitPushEvent();
Com_InitSmallZoneMemory(); Com_InitSmallZoneMemory();
@ -2473,7 +2572,6 @@ void Com_Init( char *commandLine ) {
com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT); com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT);
com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT); com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT);
com_dropsim = Cvar_Get ("com_dropsim", "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_speeds = Cvar_Get ("com_speeds", "0", 0);
com_timedemo = Cvar_Get ("timedemo", "0", CVAR_CHEAT); com_timedemo = Cvar_Get ("timedemo", "0", CVAR_CHEAT);
com_cameraMode = Cvar_Get ("com_cameraMode", "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_sv_running = Cvar_Get ("sv_running", "0", CVAR_ROM);
com_cl_running = Cvar_Get ("cl_running", "0", CVAR_ROM); com_cl_running = Cvar_Get ("cl_running", "0", CVAR_ROM);
com_buildScript = Cvar_Get( "com_buildScript", "0", 0 ); 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); 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 ) { if ( com_developer && com_developer->integer ) {
Cmd_AddCommand ("error", Com_Error_f); Cmd_AddCommand ("error", Com_Error_f);
Cmd_AddCommand ("crash", Com_Crash_f ); Cmd_AddCommand ("crash", Com_Crash_f );
@ -2516,10 +2608,9 @@ void Com_Init( char *commandLine ) {
SV_Init(); SV_Init();
com_dedicated->modified = qfalse; com_dedicated->modified = qfalse;
if ( !com_dedicated->integer ) { #ifndef DEDICATED
CL_Init(); CL_Init();
Sys_ShowConsole( com_viewlog->integer, qfalse ); #endif
}
// set com_frameTime so that if a map is started on the // set com_frameTime so that if a map is started on the
// command line it will still be able to count on com_frameTime // 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 // start in full screen ui mode
Cvar_Set("r_uiFullScreen", "1"); Cvar_Set("r_uiFullScreen", "1");
CL_StartHunkUsers(); CL_StartHunkUsers( qfalse );
// make sure single player is off by default // make sure single player is off by default
Cvar_Set("ui_singlePlayerActive", "0"); 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. // always set the cvar, but only print the info if it makes sense.
Com_DetectAltivec(); Com_DetectAltivec();
#if idppc #if idppc
Com_Printf ("Altivec support is %s\n", com_altivec->integer ? "enabled" : "disabled"); Com_Printf ("Altivec support is %s\n", com_altivec->integer ? "enabled" : "disabled");
#endif #endif
Com_Printf ("--- Common Initialization Complete ---\n"); 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 ) { void Com_WriteConfiguration( void ) {
#ifndef DEDICATED // bk001204 #ifndef DEDICATED
cvar_t *fs; cvar_t *fs;
#endif #endif
// if we are quiting without fully initializing, make sure // if we are quiting without fully initializing, make sure
@ -2599,7 +2690,7 @@ void Com_WriteConfiguration( void ) {
Com_WriteConfigToFile( "q3config.cfg" ); Com_WriteConfigToFile( "q3config.cfg" );
// bk001119 - tentative "not needed for dedicated" // not needed for dedicated
#ifndef DEDICATED #ifndef DEDICATED
fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO ); fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) { if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
@ -2708,8 +2799,6 @@ void Com_Frame( void ) {
return; // an ERR_DROP was thrown return; // an ERR_DROP was thrown
} }
// bk001204 - init to zero.
// also: might be clobbered by `longjmp' or `vfork'
timeBeforeFirstEvents =0; timeBeforeFirstEvents =0;
timeBeforeServer =0; timeBeforeServer =0;
timeBeforeEvents =0; timeBeforeEvents =0;
@ -2723,14 +2812,6 @@ void Com_Frame( void ) {
// write config file if anything changed // write config file if anything changed
Com_WriteConfiguration(); 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 // main event loop
// //
@ -2783,42 +2864,39 @@ void Com_Frame( void ) {
Cvar_Get( "dedicated", "0", 0 ); Cvar_Get( "dedicated", "0", 0 );
com_dedicated->modified = qfalse; com_dedicated->modified = qfalse;
if ( !com_dedicated->integer ) { if ( !com_dedicated->integer ) {
CL_Init(); SV_Shutdown( "dedicated set to 0" );
Sys_ShowConsole( com_viewlog->integer, qfalse ); CL_FlushMemory();
} else {
CL_Shutdown();
Sys_ShowConsole( 1, qtrue );
} }
} }
#ifndef DEDICATED
// //
// client system // client system
// //
if ( !com_dedicated->integer ) { //
// // run event loop a second time to get server to client packets
// run event loop a second time to get server to client packets // without a frame of latency
// without a frame of latency //
// if ( com_speeds->integer ) {
if ( com_speeds->integer ) { timeBeforeEvents = Sys_Milliseconds ();
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 ();
}
} }
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 // report timing information

View file

@ -511,8 +511,20 @@ qboolean Cvar_Command( void ) {
if ( Cmd_Argc() == 1 ) { if ( Cmd_Argc() == 1 ) {
Com_TruncateLongString( string, v->string ); Com_TruncateLongString( string, v->string );
Com_TruncateLongString( resetString, v->resetString ); Com_TruncateLongString( resetString, v->resetString );
Com_Printf ("\"%s\" is:\"%s" S_COLOR_WHITE "\" default:\"%s" S_COLOR_WHITE "\"\n", Com_Printf ("\"%s\" is:\"%s" S_COLOR_WHITE "\"",
v->name, string, resetString ); 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 ) { if ( v->latchedString ) {
Com_TruncateLongString( latchedString, v->latchedString ); Com_TruncateLongString( latchedString, v->latchedString );
Com_Printf( "latched: \"%s\"\n", 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 ) { void Cvar_Update( vmCvar_t *vmCvar ) {
cvar_t *cv = NULL; // bk001129 cvar_t *cv = NULL;
assert(vmCvar); // bk assert(vmCvar);
if ( (unsigned)vmCvar->handle >= cvar_numIndexes ) { if ( (unsigned)vmCvar->handle >= cvar_numIndexes ) {
Com_Error( ERR_DROP, "Cvar_Update: handle out of range" ); 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 return; // variable might have been cleared by a cvar_restart
} }
vmCvar->modificationCount = cv->modificationCount; vmCvar->modificationCount = cv->modificationCount;
// bk001129 - mismatches.
if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING ) if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING )
Com_Error( ERR_DROP, "Cvar_Update: src %s length %zd exceeds MAX_CVAR_VALUE_STRING", Com_Error( ERR_DROP, "Cvar_Update: src %s length %zd exceeds MAX_CVAR_VALUE_STRING",
cv->string, cv->string,
strlen(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 ); Q_strncpyz( vmCvar->string, cv->string, MAX_CVAR_VALUE_STRING );
vmCvar->value = cv->value; 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, 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. 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" 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", but on *nix systems the base installation is usually readonly, and
"home path" points to ~/.q3a or similar "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 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. 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 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 structure and stop on the first successful hit. fs_searchpaths is built with successive
calls to FS_AddGameDirectory calls to FS_AddGameDirectory
@ -260,10 +236,7 @@ static cvar_t *fs_debug;
static cvar_t *fs_homepath; static cvar_t *fs_homepath;
static cvar_t *fs_basepath; static cvar_t *fs_basepath;
static cvar_t *fs_basegame; static cvar_t *fs_basegame;
static cvar_t *fs_cdpath;
static cvar_t *fs_copyfiles;
static cvar_t *fs_gamedirvar; static cvar_t *fs_gamedirvar;
static cvar_t *fs_restrict;
static searchpath_t *fs_searchpaths; static searchpath_t *fs_searchpaths;
static int fs_readCount; // total bytes read static int fs_readCount; // total bytes read
static int fs_loadCount; // total files read static int fs_loadCount; // total files read
@ -362,7 +335,7 @@ int FS_LoadStack( void )
{ {
return fs_loadStack; return fs_loadStack;
} }
/* /*
================ ================
return a hash value for the filename return a hash value for the filename
@ -676,8 +649,9 @@ fileHandle_t FS_SV_FOpenFileWrite( const char *filename ) {
/* /*
=========== ===========
FS_SV_FOpenFileRead 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 ) { 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 // don't let sound stutter
S_ClearSoundBuffer(); S_ClearSoundBuffer();
// search homepath // search homepath
ospath = FS_BuildOSPath( fs_homepath->string, filename, "" ); ospath = FS_BuildOSPath( fs_homepath->string, filename, "" );
// remove trailing slash // remove trailing slash
ospath[strlen(ospath)-1] = '\0'; 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].handleFiles.file.o = fopen( ospath, "rb" );
fsh[f].handleSync = qfalse; fsh[f].handleSync = qfalse;
if (!fsh[f].handleFiles.file.o) if (!fsh[f].handleFiles.file.o)
{ {
// NOTE TTimo on non *nix systems, fs_homepath == fs_basepath, might want to avoid // If fs_homepath == fs_basepath, don't bother
if (Q_stricmp(fs_homepath->string,fs_basepath->string)) if (Q_stricmp(fs_homepath->string,fs_basepath->string))
{ {
// search basepath // search basepath
ospath = FS_BuildOSPath( fs_basepath->string, filename, "" ); ospath = FS_BuildOSPath( fs_basepath->string, filename, "" );
ospath[strlen(ospath)-1] = '\0'; ospath[strlen(ospath)-1] = '\0';
if ( fs_debug->integer ) if ( fs_debug->integer )
{ {
Com_Printf( "FS_SV_FOpenFileRead (fs_basepath): %s\n", ospath ); Com_Printf( "FS_SV_FOpenFileRead (fs_basepath): %s\n", ospath );
} }
fsh[f].handleFiles.file.o = fopen( ospath, "rb" ); fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
fsh[f].handleSync = qfalse; fsh[f].handleSync = qfalse;
}
if ( !fsh[f].handleFiles.file.o ) if ( !fsh[f].handleFiles.file.o )
{ {
f = 0; 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; *fp = f;
if (f) { if (f) {
return FS_filelength(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" ); Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
} }
if (fsh[f].streamed) {
Sys_EndStreamedFile(f);
}
if (fsh[f].zipFile == qtrue) { if (fsh[f].zipFile == qtrue) {
unzCloseCurrentFile( fsh[f].handleFiles.file.z ); unzCloseCurrentFile( fsh[f].handleFiles.file.z );
if ( fsh[f].handleFiles.unique ) { 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 // if we are running restricted, the only files we
// will allow to come from the directory are .cfg files // will allow to come from the directory are .cfg files
l = strlen( filename ); l = strlen( filename );
// FIXME TTimo I'm not sure about the fs_numServerPaks test // FIXME TTimo I'm not sure about the fs_numServerPaks test
// if you are using FS_ReadFile to find out if a file exists, // 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 // 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 // I had the problem on https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=8
// turned out I used FS_FileExists instead // turned out I used FS_FileExists instead
if ( fs_restrict->integer || fs_numServerPaks ) { if ( fs_numServerPaks ) {
if ( Q_stricmp( filename + l - 4, ".cfg" ) // for config files if ( Q_stricmp( filename + l - 4, ".cfg" ) // for config files
&& Q_stricmp( filename + l - 5, ".menu" ) // menu 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 && Q_stricmp( filename + l - 4, ".dat" ) ) { // for journal files
fs_fakeChkSum = random(); fs_fakeChkSum = random();
} }
Q_strncpyz( fsh[*file].name, filename, sizeof( fsh[*file].name ) ); Q_strncpyz( fsh[*file].name, filename, sizeof( fsh[*file].name ) );
fsh[*file].zipFile = qfalse; fsh[*file].zipFile = qfalse;
if ( fs_debug->integer ) { if ( fs_debug->integer ) {
@ -1194,15 +1147,6 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
dir->path, dir->gamedir ); 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); return FS_filelength (*file);
} }
} }
@ -1235,7 +1179,7 @@ int FS_Read2( void *buffer, int len, fileHandle_t f ) {
if (fsh[f].streamed) { if (fsh[f].streamed) {
int r; int r;
fsh[f].streamed = qfalse; fsh[f].streamed = qfalse;
r = Sys_StreamedRead( buffer, len, 1, f); r = FS_Read( buffer, len, f );
fsh[f].streamed = qtrue; fsh[f].streamed = qtrue;
return r; return r;
} else { } else {
@ -1371,7 +1315,7 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) {
if (fsh[f].streamed) { if (fsh[f].streamed) {
fsh[f].streamed = qfalse; fsh[f].streamed = qfalse;
Sys_StreamSeek( f, offset, origin ); FS_Seek( f, offset, origin );
fsh[f].streamed = qtrue; fsh[f].streamed = qtrue;
} }
@ -1946,7 +1890,7 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
char *name; char *name;
// don't scan directories for files if we are pure or restricted // don't scan directories for files if we are pure or restricted
if ( fs_restrict->integer || fs_numServerPaks ) { if ( fs_numServerPaks ) {
continue; continue;
} else { } else {
netpath = FS_BuildOSPath( search->dir->path, search->dir->gamedir, path ); 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) static unsigned int Sys_CountFileList(char **list)
{ {
int i = 0; int i = 0;
if (list) if (list)
{ {
while (*list) while (*list)
{ {
list++; list++;
i++; i++;
} }
} }
return i; return i;
} }
static char** Sys_ConcatenateFileLists( char **list0, char **list1, char **list2 ) static char** Sys_ConcatenateFileLists( char **list0, char **list1 )
{ {
int totalLength = 0; int totalLength = 0;
char** cat = NULL, **dst, **src; char** cat = NULL, **dst, **src;
totalLength += Sys_CountFileList(list0); totalLength += Sys_CountFileList(list0);
totalLength += Sys_CountFileList(list1); totalLength += Sys_CountFileList(list1);
totalLength += Sys_CountFileList(list2);
/* Create new list. */ /* Create new list. */
dst = cat = Z_Malloc( ( totalLength + 1 ) * sizeof( char* ) ); dst = cat = Z_Malloc( ( totalLength + 1 ) * sizeof( char* ) );
/* Copy over lists. */ /* Copy over lists. */
if (list0) if (list0)
{ {
for (src = list0; *src; src++, dst++) for (src = list0; *src; src++, dst++)
*dst = *src; *dst = *src;
} }
if (list1) if (list1)
{ {
for (src = list1; *src; src++, dst++) for (src = list1; *src; src++, dst++)
*dst = *src; *dst = *src;
} }
if (list2)
{
for (src = list2; *src; src++, dst++)
*dst = *src;
}
// Terminate the list // Terminate the list
*dst = NULL; *dst = NULL;
// Free our old lists. // Free our old lists.
// NOTE: not freeing their content, it's been merged in dst and still being used // NOTE: not freeing their content, it's been merged in dst and still being used
if (list0) Z_Free( list0 ); if (list0) Z_Free( list0 );
if (list1) Z_Free( list1 ); if (list1) Z_Free( list1 );
if (list2) Z_Free( list2 );
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 FS_GetModList( char *listbuf, int bufsize ) {
int nMods, i, j, nTotal, nLen, nPaks, nPotential, nDescLen; int nMods, i, j, nTotal, nLen, nPaks, nPotential, nDescLen;
char **pFiles = NULL; char **pFiles = NULL;
char **pPaks = NULL; char **pPaks = NULL;
char *name, *path; char *name, *path;
char descPath[MAX_OSPATH]; char descPath[MAX_OSPATH];
fileHandle_t descHandle; fileHandle_t descHandle;
int dummy; int dummy;
char **pFiles0 = NULL; char **pFiles0 = NULL;
char **pFiles1 = NULL; char **pFiles1 = NULL;
char **pFiles2 = NULL; qboolean bDrop = qfalse;
qboolean bDrop = qfalse;
*listbuf = 0; *listbuf = 0;
nMods = nPotential = nTotal = 0; nMods = nPotential = nTotal = 0;
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue ); pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
pFiles1 = Sys_ListFiles( fs_basepath->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
// we searched for mods in the three paths // it is likely that we have duplicate names now, which we will cleanup below
// it is likely that we have duplicate names now, which we will cleanup below pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1, pFiles2 ); nPotential = Sys_CountFileList(pFiles);
nPotential = Sys_CountFileList(pFiles);
for ( i = 0 ; i < nPotential ; i++ ) { for ( i = 0 ; i < nPotential ; i++ ) {
name = pFiles[i]; name = pFiles[i];
// NOTE: cleaner would involve more changes // NOTE: cleaner would involve more changes
// ignore duplicate mod directories // ignore duplicate mod directories
if (i!=0) { if (i!=0) {
bDrop = qfalse; bDrop = qfalse;
for(j=0; j<i; j++) for(j=0; j<i; j++)
{ {
if (Q_stricmp(pFiles[j],name)==0) { if (Q_stricmp(pFiles[j],name)==0) {
// this one can be dropped // this one can be dropped
bDrop = qtrue; bDrop = qtrue;
break; break;
} }
} }
} }
if (bDrop) { if (bDrop) {
continue; continue;
} }
// we drop "baseq3" "." and ".." // we drop "baseq3" "." and ".."
if (Q_stricmp(name, BASEGAME) && Q_stricmpn(name, ".", 1)) { if (Q_stricmp(name, BASEGAME) && Q_stricmpn(name, ".", 1)) {
// now we need to find some .pk3 files to validate the mod // 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?) // 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 // 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 // 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) // we will try each three of them here (yes, it's a bit messy)
path = FS_BuildOSPath( fs_basepath->string, name, "" ); path = FS_BuildOSPath( fs_basepath->string, name, "" );
nPaks = 0; nPaks = 0;
pPaks = Sys_ListFiles(path, ".pk3", NULL, &nPaks, qfalse); pPaks = Sys_ListFiles(path, ".pk3", NULL, &nPaks, qfalse);
Sys_FreeFileList( pPaks ); // we only use Sys_ListFiles to check wether .pk3 files are present Sys_FreeFileList( pPaks ); // we only use Sys_ListFiles to check wether .pk3 files are present
/* Try on cd path */ /* try on home path */
if( nPaks <= 0 ) { if ( nPaks <= 0 )
path = FS_BuildOSPath( fs_cdpath->string, name, "" ); {
nPaks = 0; path = FS_BuildOSPath( fs_homepath->string, name, "" );
pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse ); nPaks = 0;
Sys_FreeFileList( pPaks ); pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
} Sys_FreeFileList( pPaks );
}
/* try on home path */ if (nPaks > 0) {
if ( nPaks <= 0 ) nLen = strlen(name) + 1;
{ // nLen is the length of the mod path
path = FS_BuildOSPath( fs_homepath->string, name, "" ); // we need to see if there is a description available
nPaks = 0; descPath[0] = '\0';
pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse ); strcpy(descPath, name);
Sys_FreeFileList( pPaks ); 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) { if (nTotal + nLen + 1 + nDescLen + 1 < bufsize) {
nLen = strlen(name) + 1; strcpy(listbuf, name);
// nLen is the length of the mod path listbuf += nLen;
// we need to see if there is a description available strcpy(listbuf, descPath);
descPath[0] = '\0'; listbuf += nDescLen;
strcpy(descPath, name); nTotal += nLen + nDescLen;
strcat(descPath, "/description.txt"); nMods++;
nDescLen = FS_SV_FOpenFileRead( descPath, &descHandle ); }
if ( nDescLen > 0 && descHandle) { else {
FILE *file; break;
file = FS_FileForHandle(descHandle); }
Com_Memset( descPath, 0, sizeof( descPath ) ); }
nDescLen = fread(descPath, 1, 48, file); }
if (nDescLen >= 0) { }
descPath[nDescLen] = '\0'; Sys_FreeFileList( pFiles );
}
FS_FCloseFile(descHandle);
} else {
strcpy(descPath, name);
}
nDescLen = strlen(descPath) + 1;
if (nTotal + nLen + 1 + nDescLen + 1 < bufsize) { return nMods;
strcpy(listbuf, name);
listbuf += nLen;
strcpy(listbuf, descPath);
listbuf += nDescLen;
nTotal += nLen + nDescLen;
nMods++;
}
else {
break;
}
}
}
}
Sys_FreeFileList( pFiles );
return nMods;
} }
@ -2300,7 +2227,7 @@ Ignore case and seprator char distinctions
*/ */
int FS_PathCmp( const char *s1, const char *s2 ) { int FS_PathCmp( const char *s1, const char *s2 ) {
int c1, c2; int c1, c2;
do { do {
c1 = *s1++; c1 = *s1++;
c2 = *s2++; c2 = *s2++;
@ -2429,9 +2356,6 @@ void FS_Path_f( void ) {
/* /*
============ ============
FS_TouchFile_f 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 ) { void FS_TouchFile_f( void ) {
@ -2477,8 +2401,7 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
int numfiles; int numfiles;
char **pakfiles; char **pakfiles;
// this fixes the case where fs_basepath is the same as fs_cdpath // Unique
// which happens on full installs
for ( sp = fs_searchpaths ; sp ; sp = sp->next ) { for ( sp = fs_searchpaths ; sp ; sp = sp->next ) {
if ( sp->dir && !Q_stricmp(sp->dir->path, path) && !Q_stricmp(sp->dir->gamedir, dir)) { if ( sp->dir && !Q_stricmp(sp->dir->path, path) && !Q_stricmp(sp->dir->gamedir, dir)) {
return; // we've already got this one 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. // Make sure the server cannot make us write to non-quake3 directories.
if(FS_CheckDirTraversal(fs_serverReferencedPakNames[i])) if(FS_CheckDirTraversal(fs_serverReferencedPakNames[i]))
{ {
Com_Printf("WARNING: Invalid download name %s\n", fs_serverReferencedPakNames[i]); Com_Printf("WARNING: Invalid download name %s\n", fs_serverReferencedPakNames[i]);
continue; continue;
} }
for ( sp = fs_searchpaths ; sp ; sp = sp->next ) { for ( sp = fs_searchpaths ; sp ; sp = sp->next ) {
if ( sp->pack && sp->pack->checksum == fs_serverReferencedPaks[i] ) { 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] ) { if ( !havepak && fs_serverReferencedPakNames[i] && *fs_serverReferencedPakNames[i] ) {
// Don't got it // Don't got it
if (dlstring) if (dlstring)
{ {
// We need this to make sure we won't hit the end of the buffer or the server could // 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 // overwrite non-pk3 files on clients by writing so much crap into neededpaks that
// Q_strcat cuts off the .pk3 extension. // 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" );
// Local name origpos += strlen(origpos);
Q_strcat( neededpaks, len, "@");
// Do we have one with the same name? // Remote name
if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) ) Q_strcat( neededpaks, len, "@");
{ Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
char st[MAX_ZPATH]; Q_strcat( neededpaks, len, ".pk3" );
// We already have one called this, we need to download it to another name
// Make something up with the checksum in it // Local name
Com_sprintf( st, sizeof( st ), "%s.%08x.pk3", fs_serverReferencedPakNames[i], fs_serverReferencedPaks[i] ); Q_strcat( neededpaks, len, "@");
Q_strcat( neededpaks, len, st ); // Do we have one with the same name?
} else if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
{ {
Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] ); char st[MAX_ZPATH];
Q_strcat( neededpaks, len, ".pk3" ); // 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] );
// Find out whether it might have overflowed the buffer and don't add this file to the Q_strcat( neededpaks, len, st );
// list if that is the case. }
if(strlen(origpos) + (origpos - neededpaks) >= len - 1) else
{ {
*origpos = '\0'; Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
break; Q_strcat( neededpaks, len, ".pk3" );
} }
}
else // Find out whether it might have overflowed the buffer and don't add this file to the
{ // list if that is the case.
Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] ); if(strlen(origpos) + (origpos - neededpaks) >= len - 1)
Q_strcat( neededpaks, len, ".pk3" ); {
// Do we have one with the same name? *origpos = '\0';
if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) ) break;
{ }
Q_strcat( neededpaks, len, " (local file exists with wrong checksum)"); }
} else
Q_strcat( neededpaks, len, "\n"); {
} 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_AppendCDKey( const char *filename );
void Com_ReadCDKey( const char *filename ); void Com_ReadCDKey( const char *filename );
/* /*
================ ================
FS_ReorderPurePaks FS_ReorderPurePaks
@ -2745,14 +2669,14 @@ static void FS_ReorderPurePaks( void )
int i; int i;
searchpath_t **p_insert_index, // for linked list reordering searchpath_t **p_insert_index, // for linked list reordering
**p_previous; // when doing the scan **p_previous; // when doing the scan
// only relevant when connected to pure server // only relevant when connected to pure server
if ( !fs_numServerPaks ) if ( !fs_numServerPaks )
return; return;
fs_reordered = qfalse; 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++ ) { for ( i = 0 ; i < fs_numServerPaks ; i++ ) {
p_previous = p_insert_index; // track the pointer-to-current-item p_previous = p_insert_index; // track the pointer-to-current-item
for (s = *p_insert_index; s; s = s->next) { for (s = *p_insert_index; s; s = s->next) {
@ -2767,7 +2691,7 @@ static void FS_ReorderPurePaks( void )
p_insert_index = &s->next; p_insert_index = &s->next;
break; // iterate to next server pack 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 FS_Startup
================ ================
*/ */
static void FS_Startup( const char *gameName ) { static void FS_Startup( const char *gameName )
const char *homePath; {
const char *homePath;
cvar_t *fs; cvar_t *fs;
Com_Printf( "----- FS_Startup -----\n" ); Com_Printf( "----- FS_Startup -----\n" );
fs_debug = Cvar_Get( "fs_debug", "0", 0 ); 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_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT );
fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT ); fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT );
homePath = Sys_DefaultHomePath(); homePath = Sys_DefaultHomePath();
if (!homePath || !homePath[0]) { if (!homePath || !homePath[0]) {
homePath = fs_basepath->string; homePath = fs_basepath->string;
} }
fs_homepath = Cvar_Get ("fs_homepath", homePath, CVAR_INIT ); fs_homepath = Cvar_Get ("fs_homepath", homePath, CVAR_INIT );
fs_gamedirvar = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO ); 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 // add search path elements in reverse priority order
if (fs_cdpath->string[0]) {
FS_AddGameDirectory( fs_cdpath->string, gameName );
}
if (fs_basepath->string[0]) { if (fs_basepath->string[0]) {
FS_AddGameDirectory( fs_basepath->string, gameName ); FS_AddGameDirectory( fs_basepath->string, gameName );
} }
// fs_homepath is somewhat particular to *nix systems, only add if relevant // fs_homepath is somewhat particular to *nix systems, only add if relevant
// NOTE: same filtering below for mods and basegame // NOTE: same filtering below for mods and basegame
if (fs_basepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) { if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
FS_AddGameDirectory ( fs_homepath->string, gameName ); FS_AddGameDirectory ( fs_homepath->string, gameName );
} }
// check for additional base game so mods can be based upon other mods // 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_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]) { if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_basegame->string); 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 // check for additional game folder for mods
if ( fs_gamedirvar->string[0] && !Q_stricmp( gameName, BASEGAME ) && Q_stricmp( fs_gamedirvar->string, gameName ) ) { 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]) { if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string); 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 // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=506
// reorder the pure pk3 files according to server order // reorder the pure pk3 files according to server order
FS_ReorderPurePaks(); FS_ReorderPurePaks();
// print the current search paths // print the current search paths
FS_Path_f(); FS_Path_f();
@ -3326,12 +3239,9 @@ void FS_InitFilesystem( void ) {
// we have to specially handle this, because normal command // we have to specially handle this, because normal command
// line variable sets don't happen until after the filesystem // line variable sets don't happen until after the filesystem
// has already been initialized // has already been initialized
Com_StartupVariable( "fs_cdpath" );
Com_StartupVariable( "fs_basepath" ); Com_StartupVariable( "fs_basepath" );
Com_StartupVariable( "fs_homepath" ); Com_StartupVariable( "fs_homepath" );
Com_StartupVariable( "fs_game" ); Com_StartupVariable( "fs_game" );
Com_StartupVariable( "fs_copyfiles" );
Com_StartupVariable( "fs_restrict" );
// try to start up normally // try to start up normally
FS_Startup( BASEGAME ); FS_Startup( BASEGAME );
@ -3343,13 +3253,10 @@ void FS_InitFilesystem( void ) {
// graphics screen when the font fails to load // graphics screen when the font fails to load
if ( FS_ReadFile( "default.cfg", NULL ) <= 0 ) { if ( FS_ReadFile( "default.cfg", NULL ) <= 0 ) {
Com_Error( ERR_FATAL, "Couldn't load default.cfg" ); Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
// bk001208 - SafeMode see below, FIXME?
} }
Q_strncpyz(lastValidBase, fs_basepath->string, sizeof(lastValidBase)); Q_strncpyz(lastValidBase, fs_basepath->string, sizeof(lastValidBase));
Q_strncpyz(lastValidGame, fs_gamedirvar->string, sizeof(lastValidGame)); 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); Cvar_Set("fs_gamedirvar", lastValidGame);
lastValidBase[0] = '\0'; lastValidBase[0] = '\0';
lastValidGame[0] = '\0'; lastValidGame[0] = '\0';
Cvar_Set( "fs_restrict", "0" );
FS_Restart(checksumFeed); FS_Restart(checksumFeed);
Com_Error( ERR_DROP, "Invalid game folder\n" ); Com_Error( ERR_DROP, "Invalid game folder\n" );
return; return;
@ -3394,7 +3300,6 @@ void FS_Restart( int checksumFeed ) {
Com_Error( ERR_FATAL, "Couldn't load default.cfg" ); Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
} }
// bk010116 - new check before safeMode
if ( Q_stricmp(fs_gamedirvar->string, lastValidGame) ) { if ( Q_stricmp(fs_gamedirvar->string, lastValidGame) ) {
// skip the q3config.cfg if "safe" is on the command line // skip the q3config.cfg if "safe" is on the command line
if ( !Com_SafeMode() ) { if ( !Com_SafeMode() ) {
@ -3474,7 +3379,6 @@ int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
fsh[*f].streamed = qfalse; fsh[*f].streamed = qfalse;
if (mode == FS_READ) { if (mode == FS_READ) {
Sys_BeginStreamedFile( *f, 0x4000 );
fsh[*f].streamed = qtrue; fsh[*f].streamed = qtrue;
} }
} }

View file

@ -1026,28 +1026,22 @@ void NET_Shutdown( void ) {
==================== ====================
NET_Sleep 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 ) { void NET_Sleep( int msec ) {
struct timeval timeout; struct timeval timeout;
fd_set fdset; fd_set fdset;
#ifndef _WIN32 //FIXME
extern qboolean stdin_active;
#endif
int highestfd = 0; int highestfd = 0;
if (!com_dedicated->integer) if (!com_dedicated->integer)
return; // we're not a server, just run full speed return; // we're not a server, just run full speed
FD_ZERO(&fdset); FD_ZERO(&fdset);
#ifndef _WIN32 //FIXME
if (stdin_active) FD_SET(fileno(stdin), &fdset);
{ highestfd = fileno(stdin) + 1;
FD_SET(0, &fdset); // stdin is processed too
highestfd = 1;
}
#endif
if(ip_socket) if(ip_socket)
{ {
FD_SET(ip_socket, &fdset); // network 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 ); inv_denom = DotProduct( normal, normal );
#ifndef Q3_VM #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 #endif
inv_denom = 1.0f / inv_denom; 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 ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed // y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
//assert( !isnan(y) ); // bk010122 - FPE?
return y; return y;
} }
@ -1110,17 +1109,11 @@ vec_t VectorNormalize2( const vec3_t v, vec3_t out) {
if (length) 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; ilength = 1/length;
out[0] = v[0]*ilength; out[0] = v[0]*ilength;
out[1] = v[1]*ilength; out[1] = v[1]*ilength;
out[2] = v[2]*ilength; out[2] = v[2]*ilength;
} else { } 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 ); VectorClear( out );
} }

View file

@ -168,7 +168,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//=============================================================== FreeBSD === //=============================================================== FreeBSD ===
#ifdef __FreeBSD__ // rb010123 #ifdef __FreeBSD__
#include <machine/endian.h> #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 ) { void Q_strncpyz( char *dest, const char *src, int destsize ) {
// bk001129 - also NULL dest
if ( !dest ) { if ( !dest ) {
Com_Error( ERR_FATAL, "Q_strncpyz: NULL 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 Q_stricmpn (const char *s1, const char *s2, int n) {
int c1, c2; int c1, c2;
// bk001129 - moved in 1.17 fix not in id codebase
if ( s1 == NULL ) { if ( s1 == NULL ) {
if ( s2 == NULL ) if ( s2 == NULL )
return 0; return 0;
@ -846,6 +844,38 @@ void Q_strcat( char *dest, int size, const char *src ) {
Q_strncpyz( dest + l1, src, size - l1 ); 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 Q_PrintStrlen( const char *string ) {
int len; 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. // q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file // A user mod should never modify this file
#define Q3_VERSION "ioQ3 1.33" #define Q3_VERSION_BASE "ioq3 1.35"
#ifndef SVN_VERSION #ifdef SVN_VERSION
#define SVN_VERSION Q3_VERSION # define Q3_VERSION Q3_VERSION_BASE "_SVN" SVN_VERSION
#else
# define Q3_VERSION Q3_VERSION_BASE
#endif #endif
#define CLIENT_WINDOW_TITLE "ioquake3"
#define CLIENT_WINDOW_ICON "ioq3" #define CLIENT_WINDOW_TITLE "ioquake3"
#define CONSOLE_WINDOW_TITLE "ioquake3 console" #define CLIENT_WINDOW_MIN_TITLE "ioq3"
#define CONSOLE_WINDOW_ICON "ioq3 console"
// 1.32 released 7-10-2002 // 1.32 released 7-10-2002
#define BASEGAME "baseq3" #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 ); void *Hunk_Alloc( int size, ha_pref preference );
#endif #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_Memset memset
#define Com_Memcpy memcpy #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_strlwr( char *s1 );
char *Q_strupr( char *s1 ); char *Q_strupr( char *s1 );
char *Q_strrchr( const char* string, int c ); char *Q_strrchr( const char* string, int c );
const char *Q_stristr( const char *s, const char *find);
// buffer size safe library replacements // buffer size safe library replacements
void Q_strncpyz( char *dest, const char *src, int destsize ); void Q_strncpyz( char *dest, const char *src, int destsize );

View file

@ -687,13 +687,11 @@ MISC
============================================================== ==============================================================
*/ */
// TTimo
// vsnprintf is ISO/IEC 9899:1999 // vsnprintf is ISO/IEC 9899:1999
// abstracting this to make it portable // abstracting this to make it portable
#ifdef WIN32 #ifdef WIN32
#define Q_vsnprintf _vsnprintf #define Q_vsnprintf _vsnprintf
#else #else
// TODO: do we need Mac define?
#define Q_vsnprintf vsnprintf #define Q_vsnprintf vsnprintf
#endif #endif
@ -701,22 +699,46 @@ MISC
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470 // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470
extern char cl_cdkey[34]; extern char cl_cdkey[34];
// returnbed by Sys_GetProcessorId // returned by Sys_GetProcessorFeatures
#define CPUID_GENERIC 0 // any unrecognized processor 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) // centralized and cleaned, that's the max string you can send to a Com_Printf / Com_DPrintf (above gets truncated)
#define MAXPRINTMSG 4096 #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 ); char *CopyString( const char *in );
void Info_Print( const char *s ); 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_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3))); void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
void Com_Quit_f( void ); void Com_Quit_f( void );
int Com_EventLoop( void );
int Com_Milliseconds( void ); // will be journaled properly int Com_Milliseconds( void ); // will be journaled properly
unsigned Com_BlockChecksum( const void *buffer, int length ); unsigned Com_BlockChecksum( const void *buffer, int length );
char *Com_MD5File(const char *filename, int length, const char *prefix, int prefix_len); 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_timescale;
extern cvar_t *com_sv_running; extern cvar_t *com_sv_running;
extern cvar_t *com_cl_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_version;
extern cvar_t *com_blood; extern cvar_t *com_blood;
extern cvar_t *com_buildScript; // for building release pak files extern cvar_t *com_buildScript; // for building release pak files
extern cvar_t *com_journal; extern cvar_t *com_journal;
extern cvar_t *com_cameraMode; 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; extern cvar_t *com_altivec;
// both client and server must agree to pause // both client and server must agree to pause
@ -897,7 +921,7 @@ void CL_ShutdownAll( void );
void CL_FlushMemory( void ); void CL_FlushMemory( void );
// dump all memory on an error // dump all memory on an error
void CL_StartHunkUsers( void ); void CL_StartHunkUsers( qboolean rendererOnly );
// start all the client stuff using the hunk // start all the client stuff using the hunk
void Key_WriteBindings( fileHandle_t f ); void Key_WriteBindings( fileHandle_t f );
@ -942,31 +966,9 @@ typedef enum {
MAX_JOYSTICK_AXIS MAX_JOYSTICK_AXIS
} joystickAxis_t; } 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); void Sys_Init (void);
// general development dll loading for virtual machine testing // 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, ...), void * QDECL Sys_LoadDll( const char *name, char *fqpath , intptr_t (QDECL **entryPoint)(int, ...),
intptr_t (QDECL *systemcalls)(intptr_t, ...) ); intptr_t (QDECL *systemcalls)(intptr_t, ...) );
void Sys_UnloadDll( void *dllHandle ); 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 // the system console is shown when a dedicated server is running
void Sys_DisplaySystemConsole( qboolean show ); 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_SetErrorText( const char *text );
void Sys_SendPacket( int length, const void *data, netadr_t to ); 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 ); qboolean Sys_StringToAdr( const char *s, netadr_t *a );
//Does NOT parse port numbers, only base addresses. //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); qboolean Sys_IsLANAddress (netadr_t adr);
void Sys_ShowIP(void); void Sys_ShowIP(void);
qboolean Sys_CheckCD( void );
void Sys_Mkdir( const char *path ); void Sys_Mkdir( const char *path );
char *Sys_Cwd( void ); char *Sys_Cwd( void );
void Sys_SetDefaultCDPath(const char *path);
char *Sys_DefaultCDPath(void);
void Sys_SetDefaultInstallPath(const char *path); void Sys_SetDefaultInstallPath(const char *path);
char *Sys_DefaultInstallPath(void); char *Sys_DefaultInstallPath(void);
void Sys_SetDefaultHomePath(const char *path); void Sys_SetDefaultHomePath(const char *path);
char *Sys_DefaultHomePath(void); 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 ); char **Sys_ListFiles( const char *directory, const char *extension, char *filter, int *numfiles, qboolean wantsubs );
void Sys_FreeFileList( char **list ); void Sys_FreeFileList( char **list );
void Sys_BeginProfiling( void );
void Sys_EndProfiling( void );
qboolean Sys_LowPhysicalMemory( 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 /* This is based on the Adaptive Huffman algorithm described in Sayood's Data
* Compression book. The ranks are not actually stored, but implicitly defined * 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" #include "vm_local.h"
vm_t *currentVM = NULL; // bk001212 vm_t *currentVM = NULL;
vm_t *lastVM = NULL; // bk001212 vm_t *lastVM = NULL;
int vm_debugLevel; int vm_debugLevel;
#define MAX_VM 3 #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 ) ); Q_strncpyz( vm->name, module, sizeof( vm->name ) );
vm->systemCall = systemCalls; 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 ) { if ( interpret == VMI_NATIVE ) {
// try to load as a system dll // try to load as a system dll
Com_Printf( "Loading dll file %s.\n", vm->name ); Com_Printf( "Loading dll file %s.\n", vm->name );
@ -655,7 +648,7 @@ void *VM_ArgPtr( intptr_t intValue ) {
if ( !intValue ) { if ( !intValue ) {
return NULL; return NULL;
} }
// bk001220 - currentVM is missing on reconnect // currentVM is missing on reconnect
if ( currentVM==NULL ) if ( currentVM==NULL )
return NULL; return NULL;
@ -672,7 +665,7 @@ void *VM_ExplicitArgPtr( vm_t *vm, intptr_t intValue ) {
return NULL; return NULL;
} }
// bk010124 - currentVM is missing on reconnect here as well? // currentVM is missing on reconnect here as well?
if ( currentVM==NULL ) if ( currentVM==NULL )
return NULL; return NULL;
@ -773,7 +766,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
#endif #endif
} }
if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL if ( oldVM != NULL )
currentVM = oldVM; currentVM = oldVM;
return r; return r;
} }

View file

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

View file

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

View file

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef __FreeBSD__ // rb0101023 #ifdef __FreeBSD__
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -77,13 +77,11 @@ static int asmCallPtr = (int)AsmCall;
#else // _MSC_VER #else // _MSC_VER
#if defined( FTOL_PTR ) #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 qftol( void );
int qftol027F( void ); // bk001215 - fixed FPU control variants int qftol027F( void );
int qftol037F( void ); int qftol037F( void );
int qftol0E7F( void ); // bk010102 - fixed bogus bits (duh) int qftol0E7F( void );
int qftol0F7F( void ); int qftol0F7F( void );
@ -95,7 +93,7 @@ static int asmCallPtr = (int)doAsmCall;
#endif #endif
static int callMask = 0; // bk001213 - init static int callMask = 0;
static int instruction, pass; static int instruction, pass;
static int lastConst = 0; static int lastConst = 0;
@ -1020,7 +1018,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
EmitString( "D9 1F" ); // fstp dword ptr [edi] EmitString( "D9 1F" ); // fstp dword ptr [edi]
break; break;
case OP_CVFI: case OP_CVFI:
#ifndef FTOL_PTR // WHENHELLISFROZENOVER // bk001213 - was used in 1.17 #ifndef FTOL_PTR // WHENHELLISFROZENOVER
// not IEEE complient, but simple and fast // not IEEE complient, but simple and fast
EmitString( "D9 07" ); // fld dword ptr [edi] EmitString( "D9 07" ); // fld dword ptr [edi]
EmitString( "DB 1F" ); // fistp 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; return ret;
} }
#ifdef DEBUG_VM // bk001204 #ifdef DEBUG_VM
static char *opnames[256] = { static char *opnames[256] = {
"OP_UNDEF", "OP_UNDEF",

View file

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

View file

@ -98,7 +98,6 @@ cvar_t *r_primitives;
cvar_t *r_texturebits; cvar_t *r_texturebits;
cvar_t *r_drawBuffer; cvar_t *r_drawBuffer;
cvar_t *r_glDriver;
cvar_t *r_lightmap; cvar_t *r_lightmap;
cvar_t *r_vertexLight; cvar_t *r_vertexLight;
cvar_t *r_uiFullScreen; cvar_t *r_uiFullScreen;
@ -149,8 +148,6 @@ cvar_t *r_debugSort;
cvar_t *r_printShaders; cvar_t *r_printShaders;
cvar_t *r_saveFontData; cvar_t *r_saveFontData;
cvar_t *r_GLlibCoolDownMsec;
cvar_t *r_maxpolys; cvar_t *r_maxpolys;
int max_polys; int max_polys;
cvar_t *r_maxpolyverts; cvar_t *r_maxpolyverts;
@ -197,7 +194,6 @@ static void InitOpenGL( void )
// //
// GLimp_Init directly or indirectly references the following cvars: // GLimp_Init directly or indirectly references the following cvars:
// - r_fullscreen // - r_fullscreen
// - r_glDriver
// - r_mode // - r_mode
// - r_(color|depth|stencil)bits // - r_(color|depth|stencil)bits
// - r_ignorehwgamma // - r_ignorehwgamma
@ -905,7 +901,6 @@ void R_Register( void )
// //
// latched and archived variables // 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_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_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 ); 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_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", 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 ); 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 ); 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_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
r_customheight = ri.Cvar_Get( "r_customheight", "1024", 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 ); 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_dlightBacks = ri.Cvar_Get( "r_dlightBacks", "1", CVAR_ARCHIVE );
r_finish = ri.Cvar_Get ("r_finish", "0", 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 ); 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", r_swapInterval = ri.Cvar_Get( "r_swapInterval", "0",
CVAR_ARCHIVE | CVAR_LATCH ); 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_gamma = ri.Cvar_Get( "r_gamma", "1", CVAR_ARCHIVE );
r_facePlaneCull = ri.Cvar_Get ("r_facePlaneCull", "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_maxpolys = ri.Cvar_Get( "r_maxpolys", va("%d", MAX_POLYS), 0);
r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", va("%d", MAX_POLYVERTS), 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 // make sure all the commands added here are also
// removed in R_Shutdown // removed in R_Shutdown
ri.Cmd_AddCommand( "imagelist", R_ImageList_f ); ri.Cmd_AddCommand( "imagelist", R_ImageList_f );

View file

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

View file

@ -2360,7 +2360,7 @@ shader_t *R_FindShaderByName( const char *name ) {
int hash; int hash;
shader_t *sh; shader_t *sh;
if ( (name==NULL) || (name[0] == 0) ) { // bk001205 if ( (name==NULL) || (name[0] == 0) ) {
return tr.defaultShader; 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 ) { shader_t *R_GetShaderByHandle( qhandle_t hShader ) {
if ( hShader < 0 ) { 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; return tr.defaultShader;
} }
if ( hShader >= tr.numShaders ) { if ( hShader >= tr.numShaders ) {

View file

@ -202,33 +202,4 @@ typedef struct {
qboolean smpActive; // dual processor qboolean smpActive; // dual processor
} glconfig_t; } 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 #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. Copyright (C) 1999-2005 Id Software, Inc.
@ -64,55 +36,16 @@ cvar_t *s_sdlChannels;
cvar_t *s_sdlDevSamps; cvar_t *s_sdlDevSamps;
cvar_t *s_sdlMixSamps; 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. */ /* The audio callback. All the magic happens here. */
static int dmapos = 0; static int dmapos = 0;
static int dmasize = 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)); int pos = (dmapos * (dma.samplebits/8));
if (pos >= dmasize) 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; int i;
char *fmt = NULL; char *fmt = NULL;
@ -209,8 +142,6 @@ qboolean SNDDMA_Init(void)
if (snd_inited) if (snd_inited)
return qtrue; return qtrue;
Com_Printf("Initializing SDL audio driver...\n");
if (!s_sdlBits) { if (!s_sdlBits) {
s_sdlBits = Cvar_Get("s_sdlBits", "16", CVAR_ARCHIVE); s_sdlBits = Cvar_Get("s_sdlBits", "16", CVAR_ARCHIVE);
s_sdlSpeed = Cvar_Get("s_sdlSpeed", "0", 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); s_sdlMixSamps = Cvar_Get("s_sdlMixSamps", "0", CVAR_ARCHIVE);
} }
Com_Printf( "SDL_Init( SDL_INIT_AUDIO )... " );
if (!SDL_WasInit(SDL_INIT_AUDIO)) if (!SDL_WasInit(SDL_INIT_AUDIO))
{ {
if (SDL_Init(SDL_INIT_AUDIO) == -1) 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; return qfalse;
} }
} }
Com_Printf( "OK\n" );
if (SDL_AudioDriverName(drivername, sizeof (drivername)) == NULL) if (SDL_AudioDriverName(drivername, sizeof (drivername)) == NULL)
strcpy(drivername, "(UNKNOWN)"); strcpy(drivername, "(UNKNOWN)");
Com_Printf("SDL audio driver is \"%s\".\n", drivername); Com_Printf("SDL audio driver is \"%s\".\n", drivername);
@ -261,16 +196,16 @@ qboolean SNDDMA_Init(void)
} }
desired.channels = (int) s_sdlChannels->value; desired.channels = (int) s_sdlChannels->value;
desired.callback = sdl_audio_callback; desired.callback = SNDDMA_AudioCallback;
if (SDL_OpenAudio(&desired, &obtained) == -1) if (SDL_OpenAudio(&desired, &obtained) == -1)
{ {
Com_Printf("SDL_OpenAudio() failed: %s\n", SDL_GetError()); Com_Printf("SDL_OpenAudio() failed: %s\n", SDL_GetError());
SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_QuitSubSystem(SDL_INIT_AUDIO);
return qfalse; 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 // 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 // work at all; we need to keep it significantly bigger than the
@ -358,5 +293,3 @@ void SNDDMA_BeginPainting (void)
{ {
SDL_LockAudio(); SDL_LockAudio();
} }
#endif // USE_SDL_SOUND

View file

@ -518,10 +518,6 @@ SV_BotInitBotLib
void SV_BotInitBotLib(void) { void SV_BotInitBotLib(void) {
botlib_import_t botlib_import; 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); if (debugpolygons) Z_Free(debugpolygons);
bot_maxdebugpolys = Cvar_VariableIntegerValue("bot_maxdebugpolys"); bot_maxdebugpolys = Cvar_VariableIntegerValue("bot_maxdebugpolys");
debugpolygons = Z_Malloc(sizeof(bot_debugpoly_t) * 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_import.DebugPolygonDelete = BotImport_DebugPolygonDelete;
botlib_export = (botlib_export_t *)GetBotLibAPI( BOTLIB_API_VERSION, &botlib_import ); 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 // this generally shouldn't happen, because the client
// was connected before the level change // was connected before the level change
SV_DropClient( client, denied ); 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; continue;
} }

View file

@ -173,12 +173,6 @@ void SV_AuthorizeIpPacket( netadr_t from ) {
r = Cmd_Argv( 3 ); // reason r = Cmd_Argv( 3 ); // reason
if ( !Q_stricmp( s, "demo" ) ) { 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 // 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" ); 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 // 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 // do a restart instead of a free
gvm = VM_Restart( gvm ); gvm = VM_Restart( gvm );
if ( !gvm ) { // bk001212 - as done below if ( !gvm ) {
Com_Error( ERR_FATAL, "VM_Restart on game failed" ); 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 // clear the whole hunk because we're (re)loading the server
Hunk_Clear(); Hunk_Clear();
#ifndef DEDICATED
// Restart renderer
CL_StartHunkUsers( qtrue );
#endif
// clear collision map data // clear collision map data
CM_ClearMap(); CM_ClearMap();

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