r1144 - in branches/unified-sdl: . code code/asm code/botlib code/cgame code/client code/game code/jpeg-6 code/libs/win32 code/null code/q3_ui code/qcommon code/renderer code/sdl code/server code/sys code/ui misc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Sep 1 21:49:00 EDT 2007


Author: tma
Date: 2007-09-01 21:48:59 -0400 (Sat, 01 Sep 2007)
New Revision: 1144

Added:
   branches/unified-sdl/code/asm/
   branches/unified-sdl/code/asm/ftola.s
   branches/unified-sdl/code/asm/matha.s
   branches/unified-sdl/code/asm/qasm.h
   branches/unified-sdl/code/asm/snapvectora.s
   branches/unified-sdl/code/asm/snd_mixa.s
   branches/unified-sdl/code/libs/win32/libSDL.dll.a
   branches/unified-sdl/code/libs/win32/libSDL.la
   branches/unified-sdl/code/libs/win32/libSDLmain.a
   branches/unified-sdl/code/sdl/
   branches/unified-sdl/code/sdl/sdl_gamma.c
   branches/unified-sdl/code/sdl/sdl_glimp.c
   branches/unified-sdl/code/sdl/sdl_input.c
   branches/unified-sdl/code/sdl/sdl_snd.c
   branches/unified-sdl/code/sys/
   branches/unified-sdl/code/sys/sys_loadlib.h
   branches/unified-sdl/code/sys/sys_local.h
   branches/unified-sdl/code/sys/sys_main.c
   branches/unified-sdl/code/sys/sys_unix.c
   branches/unified-sdl/code/sys/sys_win32.c
   branches/unified-sdl/code/sys/tty_console.c
   branches/unified-sdl/code/sys/win_resource.h
   branches/unified-sdl/code/sys/win_resource.rc
   branches/unified-sdl/misc/
   branches/unified-sdl/misc/quake3.ico
   branches/unified-sdl/misc/quake3.png
   branches/unified-sdl/misc/quake3.svg
   branches/unified-sdl/misc/setup/
Removed:
   branches/unified-sdl/code/renderer/qgl_linked.h
   branches/unified-sdl/code/unix/
   branches/unified-sdl/code/win32/
Modified:
   branches/unified-sdl/Makefile
   branches/unified-sdl/README
   branches/unified-sdl/code/botlib/be_ai_chat.c
   branches/unified-sdl/code/botlib/be_ai_goal.c
   branches/unified-sdl/code/botlib/be_ai_move.c
   branches/unified-sdl/code/botlib/be_ai_move.h
   branches/unified-sdl/code/botlib/be_ai_weap.c
   branches/unified-sdl/code/botlib/be_interface.c
   branches/unified-sdl/code/botlib/l_memory.c
   branches/unified-sdl/code/botlib/l_precomp.c
   branches/unified-sdl/code/botlib/l_script.c
   branches/unified-sdl/code/cgame/cg_draw.c
   branches/unified-sdl/code/cgame/cg_drawtools.c
   branches/unified-sdl/code/cgame/cg_event.c
   branches/unified-sdl/code/cgame/cg_local.h
   branches/unified-sdl/code/cgame/cg_main.c
   branches/unified-sdl/code/cgame/cg_newdraw.c
   branches/unified-sdl/code/cgame/cg_players.c
   branches/unified-sdl/code/cgame/cg_servercmds.c
   branches/unified-sdl/code/client/cl_cgame.c
   branches/unified-sdl/code/client/cl_cin.c
   branches/unified-sdl/code/client/cl_console.c
   branches/unified-sdl/code/client/cl_curl.c
   branches/unified-sdl/code/client/cl_keys.c
   branches/unified-sdl/code/client/cl_main.c
   branches/unified-sdl/code/client/qal.c
   branches/unified-sdl/code/client/snd_dma.c
   branches/unified-sdl/code/client/snd_mix.c
   branches/unified-sdl/code/game/ai_chat.c
   branches/unified-sdl/code/game/ai_dmq3.c
   branches/unified-sdl/code/game/ai_main.c
   branches/unified-sdl/code/game/bg_lib.c
   branches/unified-sdl/code/game/bg_misc.c
   branches/unified-sdl/code/game/g_arenas.c
   branches/unified-sdl/code/game/g_bot.c
   branches/unified-sdl/code/game/g_client.c
   branches/unified-sdl/code/game/g_main.c
   branches/unified-sdl/code/game/g_mem.c
   branches/unified-sdl/code/game/g_session.c
   branches/unified-sdl/code/jpeg-6/jcdctmgr.c
   branches/unified-sdl/code/jpeg-6/jcmainct.c
   branches/unified-sdl/code/jpeg-6/jdmainct.c
   branches/unified-sdl/code/null/null_client.c
   branches/unified-sdl/code/null/null_snddma.c
   branches/unified-sdl/code/q3_ui/ui_atoms.c
   branches/unified-sdl/code/q3_ui/ui_connect.c
   branches/unified-sdl/code/q3_ui/ui_controls2.c
   branches/unified-sdl/code/q3_ui/ui_gameinfo.c
   branches/unified-sdl/code/q3_ui/ui_local.h
   branches/unified-sdl/code/q3_ui/ui_main.c
   branches/unified-sdl/code/q3_ui/ui_mods.c
   branches/unified-sdl/code/q3_ui/ui_qmenu.c
   branches/unified-sdl/code/q3_ui/ui_team.c
   branches/unified-sdl/code/q3_ui/ui_video.c
   branches/unified-sdl/code/qcommon/cm_trace.c
   branches/unified-sdl/code/qcommon/common.c
   branches/unified-sdl/code/qcommon/cvar.c
   branches/unified-sdl/code/qcommon/files.c
   branches/unified-sdl/code/qcommon/net_ip.c
   branches/unified-sdl/code/qcommon/q_math.c
   branches/unified-sdl/code/qcommon/q_platform.h
   branches/unified-sdl/code/qcommon/q_shared.c
   branches/unified-sdl/code/qcommon/q_shared.h
   branches/unified-sdl/code/qcommon/qcommon.h
   branches/unified-sdl/code/qcommon/vm.c
   branches/unified-sdl/code/qcommon/vm_interpreted.c
   branches/unified-sdl/code/qcommon/vm_local.h
   branches/unified-sdl/code/qcommon/vm_x86.c
   branches/unified-sdl/code/qcommon/vm_x86_64.c
   branches/unified-sdl/code/renderer/qgl.h
   branches/unified-sdl/code/renderer/tr_cmds.c
   branches/unified-sdl/code/renderer/tr_image.c
   branches/unified-sdl/code/renderer/tr_init.c
   branches/unified-sdl/code/renderer/tr_light.c
   branches/unified-sdl/code/renderer/tr_shader.c
   branches/unified-sdl/code/renderer/tr_types.h
   branches/unified-sdl/code/server/sv_bot.c
   branches/unified-sdl/code/server/sv_ccmds.c
   branches/unified-sdl/code/server/sv_client.c
   branches/unified-sdl/code/server/sv_game.c
   branches/unified-sdl/code/server/sv_main.c
   branches/unified-sdl/code/ui/ui_atoms.c
   branches/unified-sdl/code/ui/ui_gameinfo.c
   branches/unified-sdl/code/ui/ui_main.c
   branches/unified-sdl/code/ui/ui_shared.c
Log:
* SDL on windows, woo
  + Move SDL specific code to code/sdl/ directory
  + Write a portable main
  + Move system specific code into code/sys/ directory
  + Add Windows SDL libraries to code/libs/
* GL library dynamically linked at compile time as opposed to runtime
* Removal of legacy 3DFX minidriver support
* Removed a shedload of redundant comments and dead code
* Set SDL window icon via sdl_icon.h
* Moved Lokisetup scripts to misc/setup/
* Moved assembly source to code/asm/ directory
* Removed fs_restrict, fs_cdpath, fs_copyfiles and associated code


Modified: branches/unified-sdl/Makefile
===================================================================
--- branches/unified-sdl/Makefile	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/Makefile	2007-09-02 01:48:59 UTC (rev 1144)
@@ -32,12 +32,8 @@
 BUILD_GAME_SO    =
 BUILD_GAME_QVM   =
 
-ifeq ($(V),1)
-echo_cmd=@:
-Q=
-else
-echo_cmd=@echo
-Q=@
+ifneq ($(PLATFORM),darwin)
+  BUILD_CLIENT_SMP = 0
 endif
 
 #############################################################################
@@ -96,10 +92,6 @@
 endif
 export USE_CCACHE
 
-ifndef USE_SDL
-USE_SDL=1
-endif
-
 ifndef USE_OPENAL
 USE_OPENAL=1
 endif
@@ -136,8 +128,9 @@
 SDIR=$(MOUNT_DIR)/server
 RDIR=$(MOUNT_DIR)/renderer
 CMDIR=$(MOUNT_DIR)/qcommon
-UDIR=$(MOUNT_DIR)/unix
-W32DIR=$(MOUNT_DIR)/win32
+SDLDIR=$(MOUNT_DIR)/sdl
+ASMDIR=$(MOUNT_DIR)/asm
+SYSDIR=$(MOUNT_DIR)/sys
 GDIR=$(MOUNT_DIR)/game
 CGDIR=$(MOUNT_DIR)/cgame
 BLIBDIR=$(MOUNT_DIR)/botlib
@@ -146,7 +139,7 @@
 Q3UIDIR=$(MOUNT_DIR)/q3_ui
 JPDIR=$(MOUNT_DIR)/jpeg-6
 TOOLSDIR=$(MOUNT_DIR)/tools
-LOKISETUPDIR=$(UDIR)/setup
+LOKISETUPDIR=misc/setup
 SDLHDIR=$(MOUNT_DIR)/SDL12
 LIBSDIR=$(MOUNT_DIR)/libs
 
@@ -158,7 +151,7 @@
 ifeq ($(wildcard .svn),.svn)
   SVN_REV=$(shell LANG=C svnversion .)
   ifneq ($(SVN_REV),)
-    SVN_VERSION=$(VERSION)_SVN$(SVN_REV)
+    SVN_VERSION=$(SVN_REV)
     USE_SVN=1
   endif
 endif
@@ -215,11 +208,7 @@
     BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
   endif
 
-  ifeq ($(USE_SDL),1)
-    BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
-  else
-    BASE_CFLAGS += -I/usr/X11R6/include
-  endif
+  BASE_CFLAGS += $(shell sdl-config --cflags)
 
   OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer
 
@@ -258,18 +247,14 @@
   THREAD_LDFLAGS=-lpthread
   LDFLAGS=-ldl -lm
 
-  ifeq ($(USE_SDL),1)
-    CLIENT_LDFLAGS=$(shell sdl-config --libs)
-  else
-    CLIENT_LDFLAGS=-L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
-  endif
+  CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL
 
   ifeq ($(USE_OPENAL),1)
     ifneq ($(USE_OPENAL_DLOPEN),1)
       CLIENT_LDFLAGS += -lopenal
     endif
   endif
- 
+
   ifeq ($(USE_CURL),1)
     ifneq ($(USE_CURL_DLOPEN),1)
       CLIENT_LDFLAGS += -lcurl
@@ -384,19 +369,13 @@
     CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
   endif
 
-  ifeq ($(USE_SDL),1)
-    BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 \
-      -I$(SDLHDIR)/include
-    # We copy sdlmain before ranlib'ing it so that subversion doesn't think
-    #  the file has been modified by each build.
-    LIBSDLMAIN=$(B)/libSDLmain.a
-    LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
-    CLIENT_LDFLAGS += -framework Cocoa -framework IOKit -framework OpenGL \
-      $(LIBSDIR)/macosx/libSDL-1.2.0.dylib
-  else
-    # !!! FIXME: frameworks: OpenGL, Carbon, etc...
-    #CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
-  endif
+  BASE_CFLAGS += -D_THREAD_SAFE=1 -I$(SDLHDIR)/include
+  # We copy sdlmain before ranlib'ing it so that subversion doesn't think
+  #  the file has been modified by each build.
+  LIBSDLMAIN=$(B)/libSDLmain.a
+  LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
+  CLIENT_LDFLAGS += -framework Cocoa -framework IOKit -framework OpenGL \
+    $(LIBSDIR)/macosx/libSDL-1.2.0.dylib
 
   OPTIMIZE += -ffast-math -falign-loops=16
 
@@ -461,7 +440,7 @@
 
   BINEXT=.exe
 
-  LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32
+  LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32 -lopengl32
   CLIENT_LDFLAGS=
 
   ifeq ($(USE_CURL),1)
@@ -480,6 +459,13 @@
     LDFLAGS+=-m32
   endif
 
+  BASE_CFLAGS += -I$(SDLHDIR)/include
+
+  # libmingw32 must be linked before libSDLmain
+  CLIENT_LDFLAGS += -lmingw32 \
+                    $(LIBSDIR)/win32/libSDLmain.a \
+                    $(LIBSDIR)/win32/libSDL.dll.a
+
   BUILD_SERVER = 0
   BUILD_CLIENT_SMP = 0
 
@@ -514,9 +500,7 @@
     BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
   endif
 
-  ifeq ($(USE_SDL),1)
-    BASE_CFLAGS += $(shell sdl-config --cflags) -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1
-  endif
+  BASE_CFLAGS += $(shell sdl-config --cflags)
 
   ifeq ($(ARCH),axp)
     BASE_CFLAGS += -DNO_VM_COMPILED
@@ -544,11 +528,7 @@
 
   CLIENT_LDFLAGS =
 
-  ifeq ($(USE_SDL),1)
-    CLIENT_LDFLAGS += $(shell sdl-config --libs)
-  else
-    CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
-  endif
+  CLIENT_LDFLAGS += $(shell sdl-config --libs) -lGL
 
   ifeq ($(USE_OPENAL),1)
     ifneq ($(USE_OPENAL_DLOPEN),1)
@@ -639,11 +619,7 @@
 
   BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes -pipe
 
-  ifeq ($(USE_SDL),1)
-    BASE_CFLAGS += -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
-  else
-    BASE_CFLAGS += -I/usr/openwin/include
-  endif
+  BASE_CFLAGS += $(shell sdl-config --cflags)
 
   OPTIMIZE = -O3 -ffast-math -funroll-loops
 
@@ -681,11 +657,7 @@
 
   BOTCFLAGS=-O0
 
-  ifeq ($(USE_SDL),1)
-    CLIENT_LDFLAGS=$(shell sdl-config --libs) -L/usr/X11/lib -lGLU -lX11 -lXext
-  else
-    CLIENT_LDFLAGS=-L/usr/openwin/$(LIB) -L/usr/X11/lib -lGLU -lX11 -lXext
-  endif
+  CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL
 
 else # ifeq sunos
 
@@ -763,6 +735,14 @@
   BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\"
 endif
 
+ifeq ($(V),1)
+echo_cmd=@:
+Q=
+else
+echo_cmd=@echo
+Q=@
+endif
+
 define DO_CC       
 $(echo_cmd) "CC $<"
 $(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
@@ -1049,6 +1029,12 @@
   $(B)/client/tr_sky.o \
   $(B)/client/tr_surface.o \
   $(B)/client/tr_world.o \
+  \
+  $(B)/client/sdl_gamma.o \
+  $(B)/client/sdl_input.o \
+  $(B)/client/sdl_snd.o \
+  \
+  $(B)/client/sys_main.o
 
 ifeq ($(ARCH),i386)
   Q3OBJ += \
@@ -1082,44 +1068,19 @@
 
 ifeq ($(PLATFORM),mingw32)
   Q3OBJ += \
-    $(B)/client/win_gamma.o \
-    $(B)/client/win_glimp.o \
-    $(B)/client/win_input.o \
-    $(B)/client/win_main.o \
-    $(B)/client/win_qgl.o \
-    $(B)/client/win_shared.o \
-    $(B)/client/win_snd.o \
-    $(B)/client/win_syscon.o \
-    $(B)/client/win_wndproc.o \
-    $(B)/client/win_resource.o
+    $(B)/client/win_resource.o \
+    $(B)/client/sys_win32.o
 else
   Q3OBJ += \
-    $(B)/client/unix_main.o \
-    $(B)/client/unix_shared.o \
-    $(B)/client/linux_signals.o \
-    $(B)/client/linux_qgl.o \
-    $(B)/client/linux_snd.o \
-    $(B)/client/sdl_snd.o
+    $(B)/client/sys_unix.o
+endif
 
-  ifeq ($(PLATFORM),linux)
-    Q3OBJ += $(B)/client/linux_joystick.o
-  endif
+Q3POBJ += \
+  $(B)/client/sdl_glimp.o
 
-  ifeq ($(USE_SDL),1)
-    ifneq ($(PLATFORM),darwin)
-      BUILD_CLIENT_SMP = 0
-    endif
-  endif
+Q3POBJ_SMP += \
+  $(B)/clientsmp/sdl_glimp.o
 
-  Q3POBJ = \
-    $(B)/client/linux_glimp.o \
-    $(B)/client/sdl_glimp.o
-
-  Q3POBJ_SMP = \
-    $(B)/clientsmp/linux_glimp.o \
-    $(B)/clientsmp/sdl_glimp.o
-endif
-
 $(B)/ioquake3.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
 	$(echo_cmd) "LD $@"
 	$(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \
@@ -1206,13 +1167,14 @@
   $(B)/ded/l_script.o \
   $(B)/ded/l_struct.o \
   \
-  $(B)/ded/linux_signals.o \
-  $(B)/ded/unix_main.o \
-  $(B)/ded/unix_shared.o \
-  \
   $(B)/ded/null_client.o \
   $(B)/ded/null_input.o \
-  $(B)/ded/null_snddma.o
+  $(B)/ded/null_snddma.o \
+  \
+  $(B)/ded/tty_console.o \
+  $(B)/ded/sys_unix.o \
+  \
+  $(B)/ded/sys_main.o
 
 ifeq ($(ARCH),i386)
   Q3DOBJ += \
@@ -1529,7 +1491,7 @@
 ## CLIENT/SERVER RULES
 #############################################################################
 
-$(B)/client/%.o: $(UDIR)/%.s
+$(B)/client/%.o: $(ASMDIR)/%.s
 	$(DO_AS)
 
 $(B)/client/%.o: $(CDIR)/%.c
@@ -1550,20 +1512,20 @@
 $(B)/client/%.o: $(RDIR)/%.c
 	$(DO_CC)
 
-$(B)/client/%.o: $(UDIR)/%.c
+$(B)/client/%.o: $(SDLDIR)/%.c
 	$(DO_CC)
 
-$(B)/clientsmp/%.o: $(UDIR)/%.c
+$(B)/clientsmp/%.o: $(SDLDIR)/%.c
 	$(DO_SMP_CC)
 
-$(B)/client/%.o: $(W32DIR)/%.c
+$(B)/client/%.o: $(SYSDIR)/%.c
 	$(DO_CC)
 
-$(B)/client/%.o: $(W32DIR)/%.rc
+$(B)/client/%.o: $(SYSDIR)/%.rc
 	$(DO_WINDRES)
 
 
-$(B)/ded/%.o: $(UDIR)/%.s
+$(B)/ded/%.o: $(ASMDIR)/%.s
 	$(DO_AS)
 
 $(B)/ded/%.o: $(SDIR)/%.c
@@ -1575,7 +1537,7 @@
 $(B)/ded/%.o: $(BLIBDIR)/%.c
 	$(DO_BOT_CC)
 
-$(B)/ded/%.o: $(UDIR)/%.c
+$(B)/ded/%.o: $(SYSDIR)/%.c
 	$(DO_DED_CC)
 
 $(B)/ded/%.o: $(NDIR)/%.c

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

Copied: branches/unified-sdl/code/asm/ftola.s (from rev 1143, branches/unified-sdl/code/unix/ftola.s)
===================================================================
--- branches/unified-sdl/code/asm/ftola.s	                        (rev 0)
+++ branches/unified-sdl/code/asm/ftola.s	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,160 @@
+/*
+===========================================================================
+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 Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+===========================================================================
+*/
+
+//
+// qftol -- fast floating point to long conversion.
+//
+
+// 23/09/05 Ported to gas by intel2gas, best supporting actor Tim Angus
+// <tim at ngus.net>
+
+#include "qasm.h"
+
+#if id386
+
+.data
+
+temp:   .single   0.0
+fpucw:  .long     0
+
+// Precision Control Field , 2 bits / 0x0300
+// PC24 0x0000   Single precision (24 bits).
+// PC53 0x0200   Double precision (53 bits).
+// PC64 0x0300   Extended precision (64 bits).
+
+// Rounding Control Field, 2 bits / 0x0C00
+// RCN  0x0000   Rounding to nearest (even).
+// RCD  0x0400   Rounding down (directed, minus).
+// RCU  0x0800   Rounding up (directed plus).
+// RC0  0x0C00   Rounding towards zero (chop mode).
+
+
+// rounding towards nearest (even)
+cw027F: .long     0x027F
+cw037F: .long     0x037F
+
+// rounding towards zero (chop mode)
+cw0E7F: .long     0x0E7F
+cw0F7F: .long     0x0F7F
+
+
+.text
+
+//
+// int qftol( void ) - default control word
+//
+
+.globl C(qftol)
+
+C(qftol):
+        fistpl temp
+        movl temp,%eax
+        ret
+
+
+//
+// int qftol027F( void ) - DirectX FPU
+//
+
+.globl C(qftol027F)
+
+C(qftol027F):
+        fnstcw fpucw
+        fldcw  cw027F
+        fistpl temp
+        fldcw  fpucw
+        movl temp,%eax
+        ret
+
+//
+// int qftol037F( void ) - Linux FPU
+//
+
+.globl C(qftol037F)
+
+C(qftol037F):
+        fnstcw fpucw
+        fldcw  cw037F
+        fistpl temp
+        fldcw  fpucw
+        movl temp,%eax
+        ret
+
+
+//
+// int qftol0F7F( void ) - ANSI
+//
+
+.globl C(qftol0F7F)
+
+C(qftol0F7F):
+        fnstcw fpucw
+        fldcw  cw0F7F
+        fistpl temp
+        fldcw  fpucw
+        movl temp,%eax
+        ret
+
+//
+// int qftol0E7F( void )
+//
+
+.globl C(qftol0E7F)
+
+C(qftol0E7F):
+        fnstcw fpucw
+        fldcw  cw0E7F
+        fistpl temp
+        fldcw  fpucw
+        movl temp,%eax
+        ret
+
+
+
+//
+// long Q_ftol( float q )
+//
+
+.globl C(Q_ftol)
+
+C(Q_ftol):
+        flds 4(%esp)
+        fistpl temp
+        movl temp,%eax
+        ret
+
+
+//
+// long qftol0F7F( float q ) - Linux FPU
+//
+
+.globl C(Q_ftol0F7F)
+
+C(Q_ftol0F7F):
+        fnstcw fpucw
+        flds 4(%esp)
+        fldcw  cw0F7F
+        fistpl temp
+        fldcw  fpucw
+        movl temp,%eax
+        ret
+#endif

Copied: branches/unified-sdl/code/asm/matha.s (from rev 1143, branches/unified-sdl/code/unix/matha.s)
===================================================================
--- branches/unified-sdl/code/asm/matha.s	                        (rev 0)
+++ branches/unified-sdl/code/asm/matha.s	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,424 @@
+/*
+===========================================================================
+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 Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+===========================================================================
+*/
+//
+// math.s
+// x86 assembly-language math routines.
+
+#include "qasm.h"
+
+
+#if	id386
+
+	.data
+
+	.align	4
+Ljmptab:	.long	Lcase0, Lcase1, Lcase2, Lcase3
+			.long	Lcase4, Lcase5, Lcase6, Lcase7
+
+	.text
+
+// TODO: rounding needed?
+// stack parameter offset
+#define	val	4
+
+.globl C(Invert24To16)
+C(Invert24To16):
+
+	movl	val(%esp),%ecx
+	movl	$0x100,%edx		// 0x10000000000 as dividend
+	cmpl	%edx,%ecx
+	jle		LOutOfRange
+
+	subl	%eax,%eax
+	divl	%ecx
+
+	ret
+
+LOutOfRange:
+	movl	$0xFFFFFFFF,%eax
+	ret
+
+#if 0
+
+#define	in	4
+#define out	8
+
+	.align 2
+.globl C(TransformVector)
+C(TransformVector):
+	movl	in(%esp),%eax
+	movl	out(%esp),%edx
+
+	flds	(%eax)		// in[0]
+	fmuls	C(vright)		// in[0]*vright[0]
+	flds	(%eax)		// in[0] | in[0]*vright[0]
+	fmuls	C(vup)		// in[0]*vup[0] | in[0]*vright[0]
+	flds	(%eax)		// in[0] | in[0]*vup[0] | in[0]*vright[0]
+	fmuls	C(vpn)		// in[0]*vpn[0] | in[0]*vup[0] | in[0]*vright[0]
+
+	flds	4(%eax)		// in[1] | ...
+	fmuls	C(vright)+4	// in[1]*vright[1] | ...
+	flds	4(%eax)		// in[1] | in[1]*vright[1] | ...
+	fmuls	C(vup)+4		// in[1]*vup[1] | in[1]*vright[1] | ...
+	flds	4(%eax)		// in[1] | in[1]*vup[1] | in[1]*vright[1] | ...
+	fmuls	C(vpn)+4		// in[1]*vpn[1] | in[1]*vup[1] | in[1]*vright[1] | ...
+	fxch	%st(2)		// in[1]*vright[1] | in[1]*vup[1] | in[1]*vpn[1] | ...
+
+	faddp	%st(0),%st(5)	// in[1]*vup[1] | in[1]*vpn[1] | ...
+	faddp	%st(0),%st(3)	// in[1]*vpn[1] | ...
+	faddp	%st(0),%st(1)	// vpn_accum | vup_accum | vright_accum
+
+	flds	8(%eax)		// in[2] | ...
+	fmuls	C(vright)+8	// in[2]*vright[2] | ...
+	flds	8(%eax)		// in[2] | in[2]*vright[2] | ...
+	fmuls	C(vup)+8		// in[2]*vup[2] | in[2]*vright[2] | ...
+	flds	8(%eax)		// in[2] | in[2]*vup[2] | in[2]*vright[2] | ...
+	fmuls	C(vpn)+8		// in[2]*vpn[2] | in[2]*vup[2] | in[2]*vright[2] | ...
+	fxch	%st(2)		// in[2]*vright[2] | in[2]*vup[2] | in[2]*vpn[2] | ...
+
+	faddp	%st(0),%st(5)	// in[2]*vup[2] | in[2]*vpn[2] | ...
+	faddp	%st(0),%st(3)	// in[2]*vpn[2] | ...
+	faddp	%st(0),%st(1)	// vpn_accum | vup_accum | vright_accum
+
+	fstps	8(%edx)		// out[2]
+	fstps	4(%edx)		// out[1]
+	fstps	(%edx)		// out[0]
+
+	ret
+
+#endif
+
+#define EMINS	4+4
+#define EMAXS	4+8
+#define P		4+12
+
+	.align 2
+.globl C(BoxOnPlaneSide)
+C(BoxOnPlaneSide):
+	pushl	%ebx
+
+	movl	P(%esp),%edx
+	movl	EMINS(%esp),%ecx
+	xorl	%eax,%eax
+	movl	EMAXS(%esp),%ebx
+	movb	pl_signbits(%edx),%al
+	cmpb	$8,%al
+	jge		Lerror
+	flds	pl_normal(%edx)		// p->normal[0]
+	fld		%st(0)				// p->normal[0] | p->normal[0]
+	// bk000422 - warning: missing prefix `*' in absolute indirect address, maybe misassembled!
+	// bk001129 - fix from Andrew Henderson, was: Ljmptab(,%eax,4) 
+	jmp		*Ljmptab(,%eax,4)
+
+
+//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
+//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
+Lcase0:
+	fmuls	(%ebx)				// p->normal[0]*emaxs[0] | p->normal[0]
+	flds	pl_normal+4(%edx)	// p->normal[1] | p->normal[0]*emaxs[0] |
+								//  p->normal[0]
+	fxch	%st(2)				// p->normal[0] | p->normal[0]*emaxs[0] |
+								//  p->normal[1]
+	fmuls	(%ecx)				// p->normal[0]*emins[0] |
+								//  p->normal[0]*emaxs[0] | p->normal[1]
+	fxch	%st(2)				// p->normal[1] | p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	fld		%st(0)				// p->normal[1] | p->normal[1] |
+								//  p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	fmuls	4(%ebx)				// p->normal[1]*emaxs[1] | p->normal[1] |
+								//  p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	flds	pl_normal+8(%edx)	// p->normal[2] | p->normal[1]*emaxs[1] |
+								//  p->normal[1] | p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	fxch	%st(2)				// p->normal[1] | p->normal[1]*emaxs[1] |
+								//  p->normal[2] | p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	fmuls	4(%ecx)				// p->normal[1]*emins[1] |
+								//  p->normal[1]*emaxs[1] |
+								//  p->normal[2] | p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	fxch	%st(2)				// p->normal[2] | p->normal[1]*emaxs[1] |
+								//  p->normal[1]*emins[1] |
+								//  p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	fld		%st(0)				// p->normal[2] | p->normal[2] |
+								//  p->normal[1]*emaxs[1] |
+								//  p->normal[1]*emins[1] |
+								//  p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	fmuls	8(%ebx)				// p->normal[2]*emaxs[2] |
+								//  p->normal[2] |
+								//  p->normal[1]*emaxs[1] |
+								//  p->normal[1]*emins[1] |
+								//  p->normal[0]*emaxs[0] |
+								//  p->normal[0]*emins[0]
+	fxch	%st(5)				// p->normal[0]*emins[0] |
+								//  p->normal[2] |
+								//  p->normal[1]*emaxs[1] |
+								//  p->normal[1]*emins[1] |
+								//  p->normal[0]*emaxs[0] |
+								//  p->normal[2]*emaxs[2]
+	faddp	%st(0),%st(3)		//p->normal[2] |
+								// p->normal[1]*emaxs[1] |
+								// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
+								// p->normal[0]*emaxs[0] |
+								// p->normal[2]*emaxs[2]
+	fmuls	8(%ecx)				//p->normal[2]*emins[2] |
+								// p->normal[1]*emaxs[1] |
+								// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
+								// p->normal[0]*emaxs[0] |
+								// p->normal[2]*emaxs[2]
+	fxch	%st(1)				//p->normal[1]*emaxs[1] |
+								// p->normal[2]*emins[2] |
+								// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
+								// p->normal[0]*emaxs[0] |
+								// p->normal[2]*emaxs[2]
+	faddp	%st(0),%st(3)		//p->normal[2]*emins[2] |
+								// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
+								// p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]|
+								// p->normal[2]*emaxs[2]
+	fxch	%st(3)				//p->normal[2]*emaxs[2] +
+								// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
+								// p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]|
+								// p->normal[2]*emins[2]
+	faddp	%st(0),%st(2)		//p->normal[1]*emins[1]+p->normal[0]*emins[0]|
+								// dist1 | p->normal[2]*emins[2]
+
+	jmp		LSetSides
+
+//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
+//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
+Lcase1:
+	fmuls	(%ecx)				// emins[0]
+	flds	pl_normal+4(%edx)
+	fxch	%st(2)
+	fmuls	(%ebx)				// emaxs[0]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	4(%ebx)				// emaxs[1]
+	flds	pl_normal+8(%edx)
+	fxch	%st(2)
+	fmuls	4(%ecx)				// emins[1]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	8(%ebx)				// emaxs[2]
+	fxch	%st(5)
+	faddp	%st(0),%st(3)
+	fmuls	8(%ecx)				// emins[2]
+	fxch	%st(1)
+	faddp	%st(0),%st(3)
+	fxch	%st(3)
+	faddp	%st(0),%st(2)
+
+	jmp		LSetSides
+
+//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
+//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
+Lcase2:
+	fmuls	(%ebx)				// emaxs[0]
+	flds	pl_normal+4(%edx)
+	fxch	%st(2)
+	fmuls	(%ecx)				// emins[0]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	4(%ecx)				// emins[1]
+	flds	pl_normal+8(%edx)
+	fxch	%st(2)
+	fmuls	4(%ebx)				// emaxs[1]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	8(%ebx)				// emaxs[2]
+	fxch	%st(5)
+	faddp	%st(0),%st(3)
+	fmuls	8(%ecx)				// emins[2]
+	fxch	%st(1)
+	faddp	%st(0),%st(3)
+	fxch	%st(3)
+	faddp	%st(0),%st(2)
+
+	jmp		LSetSides
+
+//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
+//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
+Lcase3:
+	fmuls	(%ecx)				// emins[0]
+	flds	pl_normal+4(%edx)
+	fxch	%st(2)
+	fmuls	(%ebx)				// emaxs[0]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	4(%ecx)				// emins[1]
+	flds	pl_normal+8(%edx)
+	fxch	%st(2)
+	fmuls	4(%ebx)				// emaxs[1]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	8(%ebx)				// emaxs[2]
+	fxch	%st(5)
+	faddp	%st(0),%st(3)
+	fmuls	8(%ecx)				// emins[2]
+	fxch	%st(1)
+	faddp	%st(0),%st(3)
+	fxch	%st(3)
+	faddp	%st(0),%st(2)
+
+	jmp		LSetSides
+
+//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
+//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
+Lcase4:
+	fmuls	(%ebx)				// emaxs[0]
+	flds	pl_normal+4(%edx)
+	fxch	%st(2)
+	fmuls	(%ecx)				// emins[0]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	4(%ebx)				// emaxs[1]
+	flds	pl_normal+8(%edx)
+	fxch	%st(2)
+	fmuls	4(%ecx)				// emins[1]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	8(%ecx)				// emins[2]
+	fxch	%st(5)
+	faddp	%st(0),%st(3)
+	fmuls	8(%ebx)				// emaxs[2]
+	fxch	%st(1)
+	faddp	%st(0),%st(3)
+	fxch	%st(3)
+	faddp	%st(0),%st(2)
+
+	jmp		LSetSides
+
+//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
+//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
+Lcase5:
+	fmuls	(%ecx)				// emins[0]
+	flds	pl_normal+4(%edx)
+	fxch	%st(2)
+	fmuls	(%ebx)				// emaxs[0]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	4(%ebx)				// emaxs[1]
+	flds	pl_normal+8(%edx)
+	fxch	%st(2)
+	fmuls	4(%ecx)				// emins[1]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	8(%ecx)				// emins[2]
+	fxch	%st(5)
+	faddp	%st(0),%st(3)
+	fmuls	8(%ebx)				// emaxs[2]
+	fxch	%st(1)
+	faddp	%st(0),%st(3)
+	fxch	%st(3)
+	faddp	%st(0),%st(2)
+
+	jmp		LSetSides
+
+//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
+//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
+Lcase6:
+	fmuls	(%ebx)				// emaxs[0]
+	flds	pl_normal+4(%edx)
+	fxch	%st(2)
+	fmuls	(%ecx)				// emins[0]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	4(%ecx)				// emins[1]
+	flds	pl_normal+8(%edx)
+	fxch	%st(2)
+	fmuls	4(%ebx)				// emaxs[1]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	8(%ecx)				// emins[2]
+	fxch	%st(5)
+	faddp	%st(0),%st(3)
+	fmuls	8(%ebx)				// emaxs[2]
+	fxch	%st(1)
+	faddp	%st(0),%st(3)
+	fxch	%st(3)
+	faddp	%st(0),%st(2)
+
+	jmp		LSetSides
+
+//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
+//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
+Lcase7:
+	fmuls	(%ecx)				// emins[0]
+	flds	pl_normal+4(%edx)
+	fxch	%st(2)
+	fmuls	(%ebx)				// emaxs[0]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	4(%ecx)				// emins[1]
+	flds	pl_normal+8(%edx)
+	fxch	%st(2)
+	fmuls	4(%ebx)				// emaxs[1]
+	fxch	%st(2)
+	fld		%st(0)
+	fmuls	8(%ecx)				// emins[2]
+	fxch	%st(5)
+	faddp	%st(0),%st(3)
+	fmuls	8(%ebx)				// emaxs[2]
+	fxch	%st(1)
+	faddp	%st(0),%st(3)
+	fxch	%st(3)
+	faddp	%st(0),%st(2)
+
+LSetSides:
+
+//	sides = 0;
+//	if (dist1 >= p->dist)
+//		sides = 1;
+//	if (dist2 < p->dist)
+//		sides |= 2;
+
+	faddp	%st(0),%st(2)		// dist1 | dist2
+	fcomps	pl_dist(%edx)
+	xorl	%ecx,%ecx
+	fnstsw	%ax
+	fcomps	pl_dist(%edx)
+	andb	$1,%ah
+	xorb	$1,%ah
+	addb	%ah,%cl
+
+	fnstsw	%ax
+	andb	$1,%ah
+	addb	%ah,%ah
+	addb	%ah,%cl
+
+//	return sides;
+
+	popl	%ebx
+	movl	%ecx,%eax	// return status
+
+	ret
+
+
+Lerror:
+	movl	1, %eax
+	ret
+
+#endif	// id386

Copied: branches/unified-sdl/code/asm/qasm.h (from rev 1143, branches/unified-sdl/code/unix/qasm.h)
===================================================================
--- branches/unified-sdl/code/asm/qasm.h	                        (rev 0)
+++ branches/unified-sdl/code/asm/qasm.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,50 @@
+/*
+===========================================================================
+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
+===========================================================================
+*/
+#ifndef __ASM_I386__
+#define __ASM_I386__
+
+#include "../qcommon/q_platform.h"
+
+#if defined(__MINGW32__) || defined(MACOS_X)
+#undef ELF
+#endif
+
+#ifdef __ELF__
+.section .note.GNU-stack,"", at progbits
+#endif
+
+#ifdef ELF
+#define C(label) label
+#else
+#define C(label) _##label
+#endif
+
+// plane_t structure
+// !!! if this is changed, it must be changed in q_shared.h too !!!
+#define pl_normal	0
+#define pl_dist		12
+#define pl_type		16
+#define pl_signbits	17
+#define pl_pad		18
+#define pl_size		20
+
+#endif

Copied: branches/unified-sdl/code/asm/snapvectora.s (from rev 1143, branches/unified-sdl/code/unix/snapvectora.s)
===================================================================
--- branches/unified-sdl/code/asm/snapvectora.s	                        (rev 0)
+++ branches/unified-sdl/code/asm/snapvectora.s	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,103 @@
+/*
+===========================================================================
+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 Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+===========================================================================
+*/
+
+//
+// Sys_SnapVector NASM code (Andrew Henderson)
+// See win32/win_shared.c for the Win32 equivalent
+// This code is provided to ensure that the
+//  rounding behavior (and, if necessary, the
+//  precision) of DLL and QVM code are identical
+//  e.g. for network-visible operations.
+// See ftol.nasm for operations on a single float,
+//  as used in compiled VM and DLL code that does
+//  not use this system trap.
+//
+
+// 23/09/05 Ported to gas by intel2gas, best supporting actor Tim Angus
+// <tim at ngus.net>
+
+#include "qasm.h"
+
+#if id386
+.data
+
+fpucw:  .long   0
+cw037F: .long   0x037F
+
+.text
+
+// void Sys_SnapVector( float *v )
+.globl C(Sys_SnapVector)
+C(Sys_SnapVector):
+        pushl   %eax
+        pushl   %ebp
+        movl    %esp,%ebp
+
+        fnstcw  fpucw
+        movl    12(%ebp),%eax
+        fldcw   cw037F
+        flds    (%eax)
+        fistpl  (%eax)
+        fildl   (%eax)
+        fstps   (%eax)
+        flds    4(%eax)
+        fistpl  4(%eax)
+        fildl   4(%eax)
+        fstps   4(%eax)
+        flds    8(%eax)
+        fistpl  8(%eax)
+        fildl   8(%eax)
+        fstps   8(%eax)
+        fldcw   fpucw
+
+        popl %ebp
+        popl %eax
+        ret
+
+// void Sys_SnapVectorCW( float *v, unsigned short int cw )
+.globl C(Sys_SnapVectorCW)
+C(Sys_SnapVectorCW):
+        pushl   %eax
+        pushl   %ebp
+        movl    %esp,%ebp
+
+        fnstcw  fpucw
+        movl    12(%ebp),%eax
+        fldcw   16(%ebp)
+        flds    (%eax)
+        fistpl  (%eax)
+        fildl   (%eax)
+        fstps   (%eax)
+        flds    4(%eax)
+        fistpl  4(%eax)
+        fildl   4(%eax)
+        fstps   4(%eax)
+        flds    8(%eax)
+        fistpl  8(%eax)
+        fildl   8(%eax)
+        fstps   8(%eax)
+        fldcw   fpucw
+
+        popl %ebp
+        popl %eax
+        ret
+#endif

Copied: branches/unified-sdl/code/asm/snd_mixa.s (from rev 1143, branches/unified-sdl/code/unix/snd_mixa.s)
===================================================================
--- branches/unified-sdl/code/asm/snd_mixa.s	                        (rev 0)
+++ branches/unified-sdl/code/asm/snd_mixa.s	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,217 @@
+/*
+===========================================================================
+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 Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+===========================================================================
+*/
+//
+// snd_mixa.s
+// x86 assembly-language sound code
+//
+
+#include "qasm.h"
+
+#if	id386
+
+	.text
+
+#if 0 
+//----------------------------------------------------------------------
+// 8-bit sound-mixing code
+//----------------------------------------------------------------------
+
+#define ch		4+16
+#define sc		8+16
+#define count	12+16
+
+.globl C(S_PaintChannelFrom8)
+C(S_PaintChannelFrom8):
+	pushl	%esi				// preserve register variables
+	pushl	%edi
+	pushl	%ebx
+	pushl	%ebp
+
+//	int 	data;
+//	short	*lscale, *rscale;
+//	unsigned char *sfx;
+//	int		i;
+
+	movl	ch(%esp),%ebx
+	movl	sc(%esp),%esi
+
+//	if (ch->leftvol > 255)
+//		ch->leftvol = 255;
+//	if (ch->rightvol > 255)
+//		ch->rightvol = 255;
+	movl	ch_leftvol(%ebx),%eax
+	movl	ch_rightvol(%ebx),%edx
+	cmpl	$255,%eax
+	jna		LLeftSet
+	movl	$255,%eax
+LLeftSet:
+	cmpl	$255,%edx
+	jna		LRightSet
+	movl	$255,%edx
+LRightSet:
+
+//	lscale = snd_scaletable[ch->leftvol >> 3];
+//	rscale = snd_scaletable[ch->rightvol >> 3];
+//	sfx = (signed char *)sc->data + ch->pos;
+//	ch->pos += count;
+	andl	$0xF8,%eax
+	addl	$20,%esi
+	movl	(%esi),%esi
+	andl	$0xF8,%edx
+	movl	ch_pos(%ebx),%edi
+	movl	count(%esp),%ecx
+	addl	%edi,%esi
+	shll	$7,%eax
+	addl	%ecx,%edi
+	shll	$7,%edx
+	movl	%edi,ch_pos(%ebx)
+	addl	$(C(snd_scaletable)),%eax
+	addl	$(C(snd_scaletable)),%edx
+	subl	%ebx,%ebx
+	movb	-1(%esi,%ecx,1),%bl
+
+	testl	$1,%ecx
+	jz		LMix8Loop
+
+	movl	(%eax,%ebx,4),%edi
+	movl	(%edx,%ebx,4),%ebp
+	addl	C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size),%edi
+	addl	C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size),%ebp
+	movl	%edi,C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size)
+	movl	%ebp,C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size)
+	movb	-2(%esi,%ecx,1),%bl
+
+	decl	%ecx
+	jz		LDone
+
+//	for (i=0 ; i<count ; i++)
+//	{
+LMix8Loop:
+
+//		data = sfx[i];
+//		paintbuffer[i].left += lscale[data];
+//		paintbuffer[i].right += rscale[data];
+	movl	(%eax,%ebx,4),%edi
+	movl	(%edx,%ebx,4),%ebp
+	addl	C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size),%edi
+	addl	C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size),%ebp
+	movb	-2(%esi,%ecx,1),%bl
+	movl	%edi,C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size)
+	movl	%ebp,C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size)
+
+	movl	(%eax,%ebx,4),%edi
+	movl	(%edx,%ebx,4),%ebp
+	movb	-3(%esi,%ecx,1),%bl
+	addl	C(paintbuffer)+psp_left-psp_size*2(,%ecx,psp_size),%edi
+	addl	C(paintbuffer)+psp_right-psp_size*2(,%ecx,psp_size),%ebp
+	movl	%edi,C(paintbuffer)+psp_left-psp_size*2(,%ecx,psp_size)
+	movl	%ebp,C(paintbuffer)+psp_right-psp_size*2(,%ecx,psp_size)
+
+//	}
+	subl	$2,%ecx
+	jnz		LMix8Loop
+
+LDone:
+	popl	%ebp
+	popl	%ebx
+	popl	%edi
+	popl	%esi
+
+	ret
+
+
+#endif
+
+//----------------------------------------------------------------------
+// Transfer of stereo buffer to 16-bit DMA buffer code
+//----------------------------------------------------------------------
+
+.globl C(S_WriteLinearBlastStereo16)
+C(S_WriteLinearBlastStereo16):
+	pushl	%edi
+	pushl	%ebx
+
+//	int		i;
+//	int		val;
+	movl	C(snd_linear_count),%ecx
+	movl	C(snd_p),%ebx
+	movl	C(snd_out),%edi
+
+//	for (i=0 ; i<snd_linear_count ; i+=2)
+//	{
+LWLBLoopTop:
+
+//		val = (snd_p[i]*snd_vol)>>8;
+//		if (val > 0x7fff)
+//			snd_out[i] = 0x7fff;
+//		else if (val < (short)0x8000)
+//			snd_out[i] = (short)0x8000;
+//		else
+//			snd_out[i] = val;
+	movl	-8(%ebx,%ecx,4),%eax
+	sarl	$8,%eax
+	cmpl	$0x7FFF,%eax
+	jg		LClampHigh
+	cmpl	$0xFFFF8000,%eax
+	jnl		LClampDone
+	movl	$0xFFFF8000,%eax
+	jmp		LClampDone
+LClampHigh:
+	movl	$0x7FFF,%eax
+LClampDone:
+
+//		val = (snd_p[i+1]*snd_vol)>>8;
+//		if (val > 0x7fff)
+//			snd_out[i+1] = 0x7fff;
+//		else if (val < (short)0x8000)
+//			snd_out[i+1] = (short)0x8000;
+//		else
+//			snd_out[i+1] = val;
+	movl	-4(%ebx,%ecx,4),%edx
+	sarl	$8,%edx
+	cmpl	$0x7FFF,%edx
+	jg		LClampHigh2
+	cmpl	$0xFFFF8000,%edx
+	jnl		LClampDone2
+	movl	$0xFFFF8000,%edx
+	jmp		LClampDone2
+LClampHigh2:
+	movl	$0x7FFF,%edx
+LClampDone2:
+	shll	$16,%edx
+	andl	$0xFFFF,%eax
+	orl		%eax,%edx
+	movl	%edx,-4(%edi,%ecx,2)
+
+//	}
+	subl	$2,%ecx
+	jnz		LWLBLoopTop
+
+//	snd_p += snd_linear_count;
+
+	popl	%ebx
+	popl	%edi
+
+	ret
+
+#endif	// id386
+

Modified: branches/unified-sdl/code/botlib/be_ai_chat.c
===================================================================
--- branches/unified-sdl/code/botlib/be_ai_chat.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/be_ai_chat.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1439,7 +1439,7 @@
 		//if the last piece was a variable string
 		if (lastvariable >= 0)
 		{
-        		assert( match->variables[lastvariable].offset >= 0 ); // bk001204
+        		assert( match->variables[lastvariable].offset >= 0 );
 			match->variables[lastvariable].length =
 				strlen(&match->string[ (int) match->variables[lastvariable].offset]);
 		} //end if
@@ -1500,7 +1500,7 @@
 	{
 		if (match->variables[variable].length < size)
 			size = match->variables[variable].length+1;
-		assert( match->variables[variable].offset >= 0 ); // bk001204
+		assert( match->variables[variable].offset >= 0 );
 		strncpy(buf, &match->string[ (int) match->variables[variable].offset], size-1);
 		buf[size-1] = '\0';
 	} //end if
@@ -2316,7 +2316,7 @@
 					} //end if
 					if (match->variables[num].offset >= 0)
 					{
-					        assert( match->variables[num].offset >= 0 ); // bk001204
+					        assert( match->variables[num].offset >= 0 );
 						ptr = &match->string[ (int) match->variables[num].offset];
 						for (i = 0; i < match->variables[num].length; i++)
 						{

Modified: branches/unified-sdl/code/botlib/be_ai_goal.c
===================================================================
--- branches/unified-sdl/code/botlib/be_ai_goal.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/be_ai_goal.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -176,22 +176,22 @@
 	float avoidgoaltimes[MAX_AVOIDGOALS];		//times to avoid the goals
 } bot_goalstate_t;
 
-bot_goalstate_t *botgoalstates[MAX_CLIENTS + 1]; // bk001206 - FIXME: init?
+bot_goalstate_t *botgoalstates[MAX_CLIENTS + 1]; // FIXME: init?
 //item configuration
-itemconfig_t *itemconfig = NULL; // bk001206 - init
+itemconfig_t *itemconfig = NULL;
 //level items
-levelitem_t *levelitemheap = NULL; // bk001206 - init
-levelitem_t *freelevelitems = NULL; // bk001206 - init
-levelitem_t *levelitems = NULL; // bk001206 - init
+levelitem_t *levelitemheap = NULL;
+levelitem_t *freelevelitems = NULL;
+levelitem_t *levelitems = NULL;
 int numlevelitems = 0;
 //map locations
-maplocation_t *maplocations = NULL; // bk001206 - init
+maplocation_t *maplocations = NULL;
 //camp spots
-campspot_t *campspots = NULL; // bk001206 - init
+campspot_t *campspots = NULL;
 //the game type
-int g_gametype = 0; // bk001206 - init
+int g_gametype = 0;
 //additional dropped item weight
-libvar_t *droppedweight = NULL; // bk001206 - init
+libvar_t *droppedweight = NULL;
 
 //========================================================================
 //

Modified: branches/unified-sdl/code/botlib/be_ai_move.c
===================================================================
--- branches/unified-sdl/code/botlib/be_ai_move.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/be_ai_move.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -51,8 +51,6 @@
 //#define DEBUG_ELEVATOR
 //#define DEBUG_GRAPPLE
 
-// bk001204 - redundant bot_avoidspot_t, see be_ai_move.h
-
 //movement state
 //NOTE: the moveflags MFL_ONGROUND, MFL_TELEPORTED, MFL_WATERJUMP and
 //		MFL_GRAPPLEPULL must be set outside the movement code

Modified: branches/unified-sdl/code/botlib/be_ai_move.h
===================================================================
--- branches/unified-sdl/code/botlib/be_ai_move.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/be_ai_move.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -102,8 +102,6 @@
 
 #define bot_moveresult_t_cleared(x) bot_moveresult_t (x) = {0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, {0, 0, 0}}
 
-// bk001204: from code/botlib/be_ai_move.c
-// TTimo 04/12/2001 was moved here to avoid dup defines
 typedef struct bot_avoidspot_s
 {
 	vec3_t origin;

Modified: branches/unified-sdl/code/botlib/be_ai_weap.c
===================================================================
--- branches/unified-sdl/code/botlib/be_ai_weap.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/be_ai_weap.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -51,7 +51,7 @@
 #define WEAPON_OFS(x) (size_t)&(((weaponinfo_t *)0)->x)
 #define PROJECTILE_OFS(x) (size_t)&(((projectileinfo_t *)0)->x)
 
-//weapon definition // bk001212 - static
+//weapon definition
 static fielddef_t weaponinfo_fields[] =
 {
 {"number", WEAPON_OFS(number), FT_INT},						//weapon number

Modified: branches/unified-sdl/code/botlib/be_interface.c
===================================================================
--- branches/unified-sdl/code/botlib/be_interface.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/be_interface.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -21,7 +21,7 @@
 */
 
 /*****************************************************************************
- * name:		be_interface.c // bk010221 - FIXME - DEAD code elimination
+ * name:		be_interface.c
  *
  * desc:		bot library interface
  *
@@ -140,7 +140,7 @@
 	char		*homedir, *gamedir;
 	
 	bot_developer = LibVarGetValue("bot_developer");
-  memset( &botlibglobals, 0, sizeof(botlibglobals) ); // bk001207 - init
+ 	memset( &botlibglobals, 0, sizeof(botlibglobals) );
 	//initialize byte swapping (litte endian etc.)
 //	Swap_Init();
 	homedir = LibVarGetString("homedir");
@@ -860,9 +860,9 @@
 ============
 */
 botlib_export_t *GetBotLibAPI(int apiVersion, botlib_import_t *import) {
-	assert(import);   // bk001129 - this wasn't set for baseq3/
-  botimport = *import;
-  assert(botimport.Print);   // bk001129 - pars pro toto
+	assert(import);
+	botimport = *import;
+	assert(botimport.Print);
 
 	Com_Memset( &be_botlib_export, 0, sizeof( be_botlib_export ) );
 

Modified: branches/unified-sdl/code/botlib/l_memory.c
===================================================================
--- branches/unified-sdl/code/botlib/l_memory.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/l_memory.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -100,7 +100,7 @@
 {
 	void *ptr;
 	memoryblock_t *block;
-  assert(botimport.GetMemory); // bk001129 - was NULL'ed
+	assert(botimport.GetMemory);
 	ptr = botimport.GetMemory(size + sizeof(memoryblock_t));
 	block = (memoryblock_t *) ptr;
 	block->id = MEM_ID;

Modified: branches/unified-sdl/code/botlib/l_precomp.c
===================================================================
--- branches/unified-sdl/code/botlib/l_precomp.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/l_precomp.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -669,7 +669,7 @@
 	{
 		char *string;
 		int builtin;
-	} builtin[] = { // bk001204 - brackets
+	} builtin[] = {
 		{ "__LINE__",	BUILTIN_LINE },
 		{ "__FILE__",	BUILTIN_FILE },
 		{ "__DATE__",	BUILTIN_DATE },

Modified: branches/unified-sdl/code/botlib/l_script.c
===================================================================
--- branches/unified-sdl/code/botlib/l_script.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/botlib/l_script.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -706,14 +706,14 @@
 	{
 		c = *script->script_p;
 		//check for a LONG number
-		if ( (c == 'l' || c == 'L') // bk001204 - brackets 
+		if ( (c == 'l' || c == 'L')
 		     && !(token->subtype & TT_LONG))
 		{
 			script->script_p++;
 			token->subtype |= TT_LONG;
 		} //end if
 		//check for an UNSIGNED number
-		else if ( (c == 'u' || c == 'U') // bk001204 - brackets 
+		else if ( (c == 'u' || c == 'U')
 			  && !(token->subtype & (TT_UNSIGNED | TT_FLOAT)))
 		{
 			script->script_p++;

Modified: branches/unified-sdl/code/cgame/cg_draw.c
===================================================================
--- branches/unified-sdl/code/cgame/cg_draw.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/cgame/cg_draw.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1596,18 +1596,18 @@
 	int			cmdNum;
 	usercmd_t	cmd;
 	const char		*s;
-	int			w;  // bk010215 - FIXME char message[1024];
+	int			w;
 
 	// draw the phone jack if we are completely past our buffers
 	cmdNum = trap_GetCurrentCmdNumber() - CMD_BACKUP + 1;
 	trap_GetUserCmd( cmdNum, &cmd );
 	if ( cmd.serverTime <= cg.snap->ps.commandTime
-		|| cmd.serverTime > cg.time ) {	// special check for map_restart // bk 0102165 - FIXME
+		|| cmd.serverTime > cg.time ) {	// special check for map_restart
 		return;
 	}
 
 	// also add text in center of screen
-	s = "Connection Interrupted"; // bk 010215 - FIXME
+	s = "Connection Interrupted";
 	w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
 	CG_DrawBigString( 320 - w/2, 100, s, 1.0F);
 
@@ -1786,8 +1786,8 @@
 	char	*start;
 	int		l;
 	int		x, y, w;
-#ifdef MISSIONPACK // bk010221 - unused else
-  int h;
+#ifdef MISSIONPACK
+	int h;
 #endif
 	float	*color;
 

Modified: branches/unified-sdl/code/cgame/cg_drawtools.c
===================================================================
--- branches/unified-sdl/code/cgame/cg_drawtools.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/cgame/cg_drawtools.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -431,10 +431,6 @@
 }
 
 
-
-
-// bk001205 - code below duplicated in q3_ui/ui-atoms.c
-// bk001205 - FIXME: does this belong in ui_shared.c?
 /*
 =================
 UI_DrawProportionalString2
@@ -594,7 +590,7 @@
 static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color )
 {
 	const char* s;
-	unsigned char	ch; // bk001204 : array subscript
+	unsigned char	ch;
 	float	ax;
 	float	ay;
 	float	aw;
@@ -704,7 +700,7 @@
 static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset )
 {
 	const char* s;
-	unsigned char	ch; // bk001204 - unsigned
+	unsigned char	ch;
 	float	ax;
 	float	ay;
 	float	aw;

Modified: branches/unified-sdl/code/cgame/cg_event.c
===================================================================
--- branches/unified-sdl/code/cgame/cg_event.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/cgame/cg_event.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -25,7 +25,7 @@
 #include "cg_local.h"
 
 // for the voice chats
-#ifdef MISSIONPACK // bk001205
+#ifdef MISSIONPACK
 #include "../../ui/menudef.h"
 #endif
 //==========================================================================

Modified: branches/unified-sdl/code/cgame/cg_local.h
===================================================================
--- branches/unified-sdl/code/cgame/cg_local.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/cgame/cg_local.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1635,7 +1635,7 @@
   SYSTEM_PRINT,
   CHAT_PRINT,
   TEAMCHAT_PRINT
-} q3print_t; // bk001201 - warning: useless keyword or type name in empty declaration
+} q3print_t;
 
 
 int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);

Modified: branches/unified-sdl/code/cgame/cg_main.c
===================================================================
--- branches/unified-sdl/code/cgame/cg_main.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/cgame/cg_main.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -204,7 +204,7 @@
 	int			cvarFlags;
 } cvarTable_t;
 
-static cvarTable_t cvarTable[] = { // bk001129
+static cvarTable_t cvarTable[] = {
 	{ &cg_ignore, "cg_ignore", "0", 0 },	// used for debugging
 	{ &cg_autoswitch, "cg_autoswitch", "1", CVAR_ARCHIVE },
 	{ &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
@@ -1357,7 +1357,7 @@
 			continue;
 		}
 	}
-	return qfalse; // bk001204 - why not?
+	return qfalse;
 }
 
 void CG_ParseMenu(const char *menuFile) {
@@ -1690,7 +1690,7 @@
 }
 #endif
 
-#ifdef MISSIONPACK // bk001204 - only needed there
+#ifdef MISSIONPACK
 static float CG_Cvar_Get(const char *cvar) {
 	char buff[128];
 	memset(buff, 0, sizeof(buff));

Modified: branches/unified-sdl/code/cgame/cg_newdraw.c
===================================================================
--- branches/unified-sdl/code/cgame/cg_newdraw.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/cgame/cg_newdraw.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -20,7 +20,7 @@
 ===========================================================================
 */
 
-#ifndef MISSIONPACK // bk001204
+#ifndef MISSIONPACK
 #error This file not be used for classic Q3A.
 #endif
 
@@ -172,7 +172,7 @@
 	cent = &cg_entities[cg.snap->ps.clientNum];
 	ps = &cg.snap->ps;
 
-	if ( draw2D || ( !cg_draw3dIcons.integer && cg_drawIcons.integer) ) { // bk001206 - parentheses
+	if ( draw2D || ( !cg_draw3dIcons.integer && cg_drawIcons.integer) ) {
 		CG_DrawPic( rect->x, rect->y + rect->h/2 + 1, rect->w, rect->h, cgs.media.armorIcon );
   } else if (cg_draw3dIcons.integer) {
 	  VectorClear( angles );
@@ -209,10 +209,9 @@
 	}
 }
 
-#ifndef MISSIONPACK // bk001206 
+#ifndef MISSIONPACK
 static float healthColors[4][4] = { 
 //		{ 0.2, 1.0, 0.2, 1.0 } , { 1.0, 0.2, 0.2, 1.0 }, {0.5, 0.5, 0.5, 1} };
-  // bk0101016 - float const
   { 1.0f, 0.69f, 0.0f, 1.0f } ,		// normal
   { 1.0f, 0.2f, 0.2f, 1.0f },		// low health
   { 0.5f, 0.5f, 0.5f, 1.0f},		// weapon firing
@@ -228,7 +227,7 @@
 	cent = &cg_entities[cg.snap->ps.clientNum];
 	ps = &cg.snap->ps;
 
-	if ( draw2D || (!cg_draw3dIcons.integer && cg_drawIcons.integer) ) { // bk001206 - parentheses
+	if ( draw2D || (!cg_draw3dIcons.integer && cg_drawIcons.integer) ) {
 	  qhandle_t	icon;
     icon = cg_weapons[ cg.predictedPlayerState.weapon ].ammoIcon;
 		if ( icon ) {
@@ -1214,8 +1213,6 @@
 	vec4_t newColor;
 	glyphInfo_t *glyph;
   if (text) {
-// TTimo: FIXME
-//    const unsigned char *s = text; // bk001206 - unsigned
     const char *s = text;
 		float max = *maxX;
 		float useScale;

Modified: branches/unified-sdl/code/cgame/cg_players.c
===================================================================
--- branches/unified-sdl/code/cgame/cg_players.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/cgame/cg_players.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1752,7 +1752,7 @@
 }
 
 
-#ifdef MISSIONPACK // bk001204
+#ifdef MISSIONPACK
 /*
 ===============
 CG_PlayerTokens
@@ -2025,7 +2025,7 @@
 	// fade the shadow out with height
 	alpha = 1.0 - trace.fraction;
 
-	// bk0101022 - hack / FPE - bogus planes?
+	// hack / FPE - bogus planes?
 	//assert( DotProduct( trace.plane.normal, trace.plane.normal ) != 0.0f ) 
 
 	// add the mark as a temporary, so it goes directly to the renderer

Modified: branches/unified-sdl/code/cgame/cg_servercmds.c
===================================================================
--- branches/unified-sdl/code/cgame/cg_servercmds.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/cgame/cg_servercmds.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -25,7 +25,7 @@
 // be a valid snapshot this frame
 
 #include "cg_local.h"
-#include "../../ui/menudef.h" // bk001205 - for Q3_ui as well
+#include "../../ui/menudef.h"
 
 typedef struct {
 	const char *order;
@@ -46,7 +46,7 @@
 
 static const int numValidOrders = sizeof(validOrders) / sizeof(orderTask_t);
 
-#ifdef MISSIONPACK // bk001204
+#ifdef MISSIONPACK
 static int CG_ValidOrder(const char *p) {
 	int i;
 	for (i = 0; i < numValidOrders; i++) {

Modified: branches/unified-sdl/code/client/cl_cgame.c
===================================================================
--- branches/unified-sdl/code/client/cl_cgame.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/cl_cgame.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -697,7 +697,7 @@
 		return re.inPVS( VMA(1), VMA(2) );
 
 	default:
-	        assert(0); // bk010102
+	        assert(0);
 		Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] );
 	}
 	return 0;
@@ -906,8 +906,6 @@
 		Cbuf_AddText( cl_activeAction->string );
 		Cvar_Set( "activeAction", "" );
 	}
-	
-	Sys_BeginProfiling();
 }
 
 /*

Modified: branches/unified-sdl/code/client/cl_cin.c
===================================================================
--- branches/unified-sdl/code/client/cl_cin.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/cl_cin.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1072,12 +1072,10 @@
 	
 	if (currentHandle < 0) return;
 
-	Sys_EndStreamedFile(cinTable[currentHandle].iFile);
 	FS_FCloseFile( cinTable[currentHandle].iFile );
 	FS_FOpenFileRead (cinTable[currentHandle].fileName, &cinTable[currentHandle].iFile, qtrue);
 	// let the background thread start reading ahead
-	Sys_BeginStreamedFile( cinTable[currentHandle].iFile, 0x10000 );
-	Sys_StreamedRead (cin.file, 16, 1, cinTable[currentHandle].iFile);
+	FS_Read (cin.file, 16, cinTable[currentHandle].iFile);
 	RoQ_init();
 	cinTable[currentHandle].status = FMV_LOOPED;
 }
@@ -1098,7 +1096,7 @@
         
 	if (currentHandle < 0) return;
 
-	Sys_StreamedRead( cin.file, cinTable[currentHandle].RoQFrameSize+8, 1, cinTable[currentHandle].iFile );
+	FS_Read( cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile );
 	if ( cinTable[currentHandle].RoQPlayed >= cinTable[currentHandle].ROQSize ) { 
 		if (cinTable[currentHandle].holdAtEnd==qfalse) {
 			if (cinTable[currentHandle].looping) {
@@ -1214,7 +1212,7 @@
 // one more frame hits the dust
 //
 //	assert(cinTable[currentHandle].RoQFrameSize <= 65536);
-//	r = Sys_StreamedRead( cin.file, cinTable[currentHandle].RoQFrameSize+8, 1, cinTable[currentHandle].iFile );
+//	r = FS_Read( cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile );
 	cinTable[currentHandle].RoQPlayed	+= cinTable[currentHandle].RoQFrameSize+8;
 }
 
@@ -1272,7 +1270,6 @@
 	cinTable[currentHandle].status = FMV_IDLE;
 
 	if (cinTable[currentHandle].iFile) {
-		Sys_EndStreamedFile( cinTable[currentHandle].iFile );
 		FS_FCloseFile( cinTable[currentHandle].iFile );
 		cinTable[currentHandle].iFile = 0;
 	}
@@ -1332,7 +1329,6 @@
 
 e_status CIN_RunCinematic (int handle)
 {
-        // bk001204 - init
 	int	start = 0;
 	int     thisTime = 0;
 
@@ -1472,8 +1468,6 @@
 	{
 		RoQ_init();
 //		FS_Read (cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile);
-		// let the background thread start reading ahead
-		Sys_BeginStreamedFile( cinTable[currentHandle].iFile, 0x10000 );
 
 		cinTable[currentHandle].status = FMV_PLAY;
 		Com_DPrintf("trFMV::play(), playing %s\n", arg);

Modified: branches/unified-sdl/code/client/cl_console.c
===================================================================
--- branches/unified-sdl/code/client/cl_console.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/cl_console.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -619,13 +619,13 @@
 
 	re.SetColor( g_color_table[ColorIndex(COLOR_RED)] );
 
-	i = strlen( SVN_VERSION );
+	i = strlen( Q3_VERSION );
 
 	for (x=0 ; x<i ; x++) {
 
 		SCR_DrawSmallChar( cls.glconfig.vidWidth - ( i - x ) * SMALLCHAR_WIDTH, 
 
-			(lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), SVN_VERSION[x] );
+			(lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), Q3_VERSION[x] );
 
 	}
 

Modified: branches/unified-sdl/code/client/cl_curl.c
===================================================================
--- branches/unified-sdl/code/client/cl_curl.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/cl_curl.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -25,38 +25,8 @@
 cvar_t *cl_cURLLib;
 
 #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);
 
 CURL* (*qcurl_easy_init)(void);
@@ -85,7 +55,7 @@
                                                 int *msgs_in_queue);
 const char *(*qcurl_multi_strerror)(CURLMcode);
 
-static OBJTYPE cURLLib = NULL;
+static void *cURLLib = NULL;
 
 /*
 =================
@@ -96,7 +66,7 @@
 {
 	void *rv;
 
-	rv = SYMLOAD(cURLLib, str);
+	rv = Sys_LoadFunction(cURLLib, str);
 	if(!rv)
 	{
 		Com_Printf("Can't load symbol %s\n", str);
@@ -124,17 +94,17 @@
 
 
 	Com_Printf("Loading \"%s\"...", cl_cURLLib->string);
-	if( (cURLLib = OBJLOAD(cl_cURLLib->string)) == 0 )
+	if( (cURLLib = Sys_LoadLibrary(cl_cURLLib->string)) == 0 )
 	{
 #ifdef _WIN32
 		return qfalse;
 #else
 		char fn[1024];
-		getcwd(fn, sizeof(fn));
+		Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
 		strncat(fn, "/", sizeof(fn)-strlen(fn)-1);
 		strncat(fn, cl_cURLLib->string, sizeof(fn)-strlen(fn)-1);
 
-		if( (cURLLib = OBJLOAD(fn)) == 0 )
+		if( (cURLLib = Sys_LoadLibrary(fn)) == 0 )
 		{
 			return qfalse;
 		}
@@ -189,7 +159,7 @@
 #if USE_CURL_DLOPEN
 	if(cURLLib)
 	{
-		OBJFREE(cURLLib);
+		Sys_UnloadLibrary(cURLLib);
 		cURLLib = NULL;
 	}
 	qcurl_easy_init = NULL;

Modified: branches/unified-sdl/code/client/cl_keys.c
===================================================================
--- branches/unified-sdl/code/client/cl_keys.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/cl_keys.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1147,7 +1147,6 @@
 		}
 	}
 
-#ifndef _WIN32
 	if (key == K_ENTER)
 	{
 		if (down)
@@ -1157,14 +1156,10 @@
 				Key_ClearStates();
 				Cvar_SetValue( "r_fullscreen",
 						!Cvar_VariableIntegerValue( "r_fullscreen" ) );
-#if !USE_SDL_VIDEO // This is handled in sdl_glimp.c/GLimp_EndFrame
-				Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n");
-#endif
 				return;
 			}
 		}
 	}
-#endif
 
 	// console key is hardcoded, so the user can never unbind it
 	if (key == '`' || key == '~' ||

Modified: branches/unified-sdl/code/client/cl_main.c
===================================================================
--- branches/unified-sdl/code/client/cl_main.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/cl_main.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -830,7 +830,7 @@
 	}
 
 	if ( clc.demoplaying || cls.state < CA_CONNECTED || cmd[0] == '+' ) {
-		Com_Printf ("Unknown command \"%s\"\n", cmd);
+		Com_Printf ("Unknown command \"%s^7\"\n", cmd);
 		return;
 	}
 
@@ -939,26 +939,22 @@
 		return;
 	}
 
-	if ( Cvar_VariableValue( "fs_restrict" ) ) {
-		Q_strncpyz( nums, "demota", sizeof( nums ) );
-	} else {
-		// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
-		j = 0;
-		l = strlen( cl_cdkey );
-		if ( l > 32 ) {
-			l = 32;
-		}
-		for ( i = 0 ; i < l ; i++ ) {
-			if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
+	// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
+	j = 0;
+	l = strlen( cl_cdkey );
+	if ( l > 32 ) {
+		l = 32;
+	}
+	for ( i = 0 ; i < l ; i++ ) {
+		if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
 				|| ( cl_cdkey[i] >= 'a' && cl_cdkey[i] <= 'z' )
 				|| ( cl_cdkey[i] >= 'A' && cl_cdkey[i] <= 'Z' )
-				) {
-				nums[j] = cl_cdkey[i];
-				j++;
-			}
+			 ) {
+			nums[j] = cl_cdkey[i];
+			j++;
 		}
-		nums[j] = 0;
 	}
+	nums[j] = 0;
 
 	fs = Cvar_Get ("cl_anonymous", "0", CVAR_INIT|CVAR_SYSTEMINFO );
 
@@ -3203,11 +3199,6 @@
 	for (i=3; i<count; i++)
 		buffptr += sprintf( buffptr, " %s", Cmd_Argv(i) );
 
-	// if we are a demo, automatically add a "demo" keyword
-	if ( Cvar_VariableValue( "fs_restrict" ) ) {
-		buffptr += sprintf( buffptr, " demo" );
-	}
-
 	NET_OutOfBandPrint( NS_SERVER, to, command );
 }
 

Modified: branches/unified-sdl/code/client/qal.c
===================================================================
--- branches/unified-sdl/code/client/qal.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/qal.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -29,37 +29,8 @@
 
 #if USE_OPENAL_DLOPEN
 
-#if USE_SDL_VIDEO
-#include "SDL.h"
-#include "SDL_loadso.h"
-#define OBJTYPE void *
-#define OBJLOAD(x) SDL_LoadObject(x)
-#define SYMLOAD(x,y) SDL_LoadFunction(x,y)
-#define OBJFREE(x) SDL_UnloadObject(x)
+#include "../sys/sys_loadlib.h"
 
-#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;
 LPALDISABLE qalDisable;
 LPALISENABLED qalIsEnabled;
@@ -131,7 +102,7 @@
 LPALCGETSTRING qalcGetString;
 LPALCGETINTEGERV qalcGetIntegerv;
 
-static OBJTYPE OpenALLib = NULL;
+static void *OpenALLib = NULL;
 
 static qboolean alinit_fail = qfalse;
 
@@ -144,7 +115,7 @@
 {
 	void *rv;
 
-	rv = SYMLOAD(OpenALLib, str);
+	rv = Sys_LoadFunction(OpenALLib, str);
 	if(!rv)
 	{
 		Com_Printf( " Can't load symbol %s\n", str);
@@ -169,17 +140,17 @@
 		return qtrue;
 
 	Com_Printf( "Loading \"%s\"...\n", libname);
-	if( (OpenALLib = OBJLOAD(libname)) == 0 )
+	if( (OpenALLib = Sys_LoadLibrary(libname)) == 0 )
 	{
 #ifdef _WIN32
 		return qfalse;
 #else
 		char fn[1024];
-		getcwd(fn, sizeof(fn));
+		Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
 		strncat(fn, "/", sizeof(fn) - strlen(fn) - 1);
 		strncat(fn, libname, sizeof(fn) - strlen(fn) - 1);
 
-		if( (OpenALLib = OBJLOAD(fn)) == 0 )
+		if( (OpenALLib = Sys_LoadLibrary(fn)) == 0 )
 		{
 			return qfalse;
 		}
@@ -278,7 +249,7 @@
 {
 	if(OpenALLib)
 	{
-		OBJFREE(OpenALLib);
+		Sys_UnloadLibrary(OpenALLib);
 		OpenALLib = NULL;
 	}
 

Modified: branches/unified-sdl/code/client/snd_dma.c
===================================================================
--- branches/unified-sdl/code/client/snd_dma.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/snd_dma.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -616,11 +616,7 @@
 
 	SNDDMA_BeginPainting ();
 	if (dma.buffer)
-    // TTimo: due to a particular bug workaround in linux sound code,
-    //   have to optionally use a custom C implementation of Com_Memset
-    //   not affecting win32, we have #define Snd_Memset Com_Memset
-    // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
-		Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
+		Com_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
 	SNDDMA_Submit ();
 }
 

Modified: branches/unified-sdl/code/client/snd_mix.c
===================================================================
--- branches/unified-sdl/code/client/snd_mix.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/client/snd_mix.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -30,7 +30,6 @@
 static portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
 static int snd_vol;
 
-// bk001119 - these not static, required by unix/snd_mixa.s
 int*     snd_p;  
 int      snd_linear_count;
 short*   snd_out;

Modified: branches/unified-sdl/code/game/ai_chat.c
===================================================================
--- branches/unified-sdl/code/game/ai_chat.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/ai_chat.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -53,7 +53,7 @@
 #include "match.h"				//string matching types and vars
 
 // for the voice chats
-#ifdef MISSIONPACK // bk001205
+#ifdef MISSIONPACK
 #include "../../ui/menudef.h"
 #endif
 

Modified: branches/unified-sdl/code/game/ai_dmq3.c
===================================================================
--- branches/unified-sdl/code/game/ai_dmq3.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/ai_dmq3.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -3751,7 +3751,6 @@
 BotSetMovedir
 ==================
 */
-// bk001205 - made these static
 static vec3_t VEC_UP		= {0, -1,  0};
 static vec3_t MOVEDIR_UP	= {0,  0,  1};
 static vec3_t VEC_DOWN		= {0, -2,  0};

Modified: branches/unified-sdl/code/game/ai_main.c
===================================================================
--- branches/unified-sdl/code/game/ai_main.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/ai_main.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1626,9 +1626,6 @@
 	//game directory
 	trap_Cvar_VariableStringBuffer("fs_game", buf, sizeof(buf));
 	if (strlen(buf)) trap_BotLibVarSet("gamedir", buf);
-	//cd directory
-	trap_Cvar_VariableStringBuffer("fs_cdpath", buf, sizeof(buf));
-	if (strlen(buf)) trap_BotLibVarSet("cddir", buf);
 	//home directory
 	trap_Cvar_VariableStringBuffer("fs_homepath", buf, sizeof(buf));
 	if (strlen(buf)) trap_BotLibVarSet("homedir", buf);

Modified: branches/unified-sdl/code/game/bg_lib.c
===================================================================
--- branches/unified-sdl/code/game/bg_lib.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/bg_lib.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -43,7 +43,6 @@
 static const char rcsid[] =
 #endif /* LIBC_SCCS and not lint */
 
-// bk001127 - needed for DLL's
 #if !defined( Q3_VM )
 typedef int		 cmp_t(const void *, const void *);
 #endif
@@ -189,8 +188,6 @@
 
 
 // this file is excluded from release builds because of intrinsics
-
-// bk001211 - gcc errors on compiling strcpy:  parse error before `__extension__'
 #if defined ( Q3_VM )
 
 size_t strlen( const char *string ) {
@@ -265,7 +262,7 @@
 	}
 	return (char *)0;
 }
-#endif // bk001211
+#endif
 
 #if defined ( Q3_VM )
 int tolower( int c ) {
@@ -754,8 +751,6 @@
 #endif
 
 #ifdef Q3_VM
-// bk001127 - guarded this tan replacement 
-// ld: undefined versioned symbol name tan@@GLIBC_2.0
 double tan( double x ) {
 	return sin(x) / cos(x);
 }
@@ -844,7 +839,7 @@
 	const char	*string;
 	float sign;
 	float value;
-	int		c = '0'; // bk001211 - uninitialized use possible
+	int		c = '0';
 
 	string = *stringPtr;
 

Modified: branches/unified-sdl/code/game/bg_misc.c
===================================================================
--- branches/unified-sdl/code/game/bg_misc.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/bg_misc.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1177,7 +1177,7 @@
             Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: IT_BAD" );
         default:
 #ifndef Q3_VM
-#ifndef NDEBUG // bk0001204
+#ifndef NDEBUG
           Com_Printf("BG_CanItemBeGrabbed: unknown enum %d\n", item->giType );
 #endif
 #endif

Modified: branches/unified-sdl/code/game/g_arenas.c
===================================================================
--- branches/unified-sdl/code/game/g_arenas.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/g_arenas.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -43,7 +43,7 @@
 	int			playerClientNum;
 	int			n, accuracy, perfect,	msglen;
 	int			buflen;
-#ifdef MISSIONPACK // bk001205
+#ifdef MISSIONPACK
   int score1, score2;
 	qboolean won;
 #endif

Modified: branches/unified-sdl/code/game/g_bot.c
===================================================================
--- branches/unified-sdl/code/game/g_bot.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/g_bot.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -43,7 +43,6 @@
 	int		spawnTime;
 } botSpawnQueue_t;
 
-//static int			botBeginDelay = 0;  // bk001206 - unused, init
 static botSpawnQueue_t	botSpawnQueue[BOT_SPAWN_QUEUE_DEPTH];
 
 vmCvar_t bot_minplayers;

Modified: branches/unified-sdl/code/game/g_client.c
===================================================================
--- branches/unified-sdl/code/game/g_client.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/g_client.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1129,7 +1129,7 @@
 	}
 	eventSequence = client->ps.eventSequence;
 
-	memset (client, 0, sizeof(*client)); // bk FIXME: Com_Memset?
+	Com_Memset (client, 0, sizeof(*client));
 
 	client->pers = saved;
 	client->sess = savedSess;

Modified: branches/unified-sdl/code/game/g_main.c
===================================================================
--- branches/unified-sdl/code/game/g_main.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/g_main.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -95,7 +95,6 @@
 vmCvar_t	g_proxMineTimeout;
 #endif
 
-// bk001129 - made static to avoid aliasing
 static cvarTable_t		gameCvarTable[] = {
 	// don't override the cheat state set by the system
 	{ &g_cheats, "sv_cheats", "", 0, 0, qfalse },
@@ -182,7 +181,6 @@
 
 };
 
-// bk001129 - made static to avoid aliasing
 static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[0] );
 
 
@@ -1118,7 +1116,7 @@
 void LogExit( const char *string ) {
 	int				i, numSorted;
 	gclient_t		*cl;
-#ifdef MISSIONPACK // bk001205
+#ifdef MISSIONPACK
 	qboolean won = qtrue;
 #endif
 	G_LogPrintf( "Exit: %s\n", string );

Modified: branches/unified-sdl/code/game/g_mem.c
===================================================================
--- branches/unified-sdl/code/game/g_mem.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/g_mem.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -41,7 +41,7 @@
 	}
 
 	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;
 	}
 

Modified: branches/unified-sdl/code/game/g_session.c
===================================================================
--- branches/unified-sdl/code/game/g_session.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/game/g_session.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -69,8 +69,6 @@
 void G_ReadSessionData( gclient_t *client ) {
 	char	s[MAX_STRING_CHARS];
 	const char	*var;
-
-	// bk001205 - format
 	int teamLeader;
 	int spectatorState;
 	int sessionTeam;
@@ -79,16 +77,15 @@
 	trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );
 
 	sscanf( s, "%i %i %i %i %i %i %i",
-		&sessionTeam,                 // bk010221 - format
+		&sessionTeam,
 		&client->sess.spectatorTime,
-		&spectatorState,              // bk010221 - format
+		&spectatorState,
 		&client->sess.spectatorClient,
 		&client->sess.wins,
 		&client->sess.losses,
-		&teamLeader                   // bk010221 - format
+		&teamLeader
 		);
 
-	// bk001205 - format issues
 	client->sess.sessionTeam = (team_t)sessionTeam;
 	client->sess.spectatorState = (spectatorState_t)spectatorState;
 	client->sess.teamLeader = (qboolean)teamLeader;

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

Modified: branches/unified-sdl/code/jpeg-6/jcmainct.c
===================================================================
--- branches/unified-sdl/code/jpeg-6/jcmainct.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/jpeg-6/jcmainct.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -68,7 +68,6 @@
 METHODDEF void
 start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
 {
-  // bk001204 - don't use main...
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
 
   /* Do nothing in raw-data mode. */
@@ -115,7 +114,6 @@
 			  JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
 			  JDIMENSION in_rows_avail)
 {
-  // bk001204 - don't use main
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
 
   while (jmain->cur_iMCU_row < cinfo->total_iMCU_rows) {
@@ -246,7 +244,6 @@
 GLOBAL void
 jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
 {
-  // bk001204 - don't use main
   my_main_ptr jmain;
   int ci;
   jpeg_component_info *compptr;

Modified: branches/unified-sdl/code/jpeg-6/jdmainct.c
===================================================================
--- branches/unified-sdl/code/jpeg-6/jdmainct.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/jpeg-6/jdmainct.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -159,7 +159,6 @@
  * This is done only once, not once per pass.
  */
 {
-  // bk001204 - no use main
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
   int ci, rgroup;
   int M = cinfo->min_DCT_scaled_size;
@@ -201,7 +200,6 @@
  * This will be repeated at the beginning of each pass.
  */
 {
- // bk001204 - no use main
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
   int ci, i, rgroup;
   int M = cinfo->min_DCT_scaled_size;
@@ -242,7 +240,6 @@
  * This changes the pointer list state from top-of-image to the normal state.
  */
 {
- // bk001204 - no use main
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
   int ci, i, rgroup;
   int M = cinfo->min_DCT_scaled_size;
@@ -272,7 +269,6 @@
  * Also sets rowgroups_avail to indicate number of nondummy row groups in row.
  */
 {
- // bk001204 - no use main
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
   int ci, i, rgroup, iMCUheight, rows_left;
   jpeg_component_info *compptr;
@@ -310,7 +306,6 @@
 METHODDEF void
 start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
 {
-  // bk001204 - no use main
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
 
   switch (pass_mode) {
@@ -351,7 +346,6 @@
 			  JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
 			  JDIMENSION out_rows_avail)
 {
-  // bk001204 - no use main
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
   JDIMENSION rowgroups_avail;
 
@@ -392,7 +386,6 @@
 			   JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
 			   JDIMENSION out_rows_avail)
 {
-  // bk001204 - no use main
   my_main_ptr jmain = (my_main_ptr) cinfo->main;
 
   /* Read input data if we haven't filled the main buffer yet */
@@ -482,7 +475,6 @@
 GLOBAL void
 jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
 {
-  // bk001204 - no use main
   my_main_ptr jmain;
   int ci, rgroup, ngroups;
   jpeg_component_info *compptr;

Added: branches/unified-sdl/code/libs/win32/libSDL.dll.a
===================================================================
(Binary files differ)


Property changes on: branches/unified-sdl/code/libs/win32/libSDL.dll.a
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + application/octet-stream

Added: branches/unified-sdl/code/libs/win32/libSDL.la
===================================================================
--- branches/unified-sdl/code/libs/win32/libSDL.la	                        (rev 0)
+++ branches/unified-sdl/code/libs/win32/libSDL.la	2007-09-02 01:48:59 UTC (rev 1144)
@@ -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'


Property changes on: branches/unified-sdl/code/libs/win32/libSDL.la
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/unified-sdl/code/libs/win32/libSDLmain.a
===================================================================
(Binary files differ)


Property changes on: branches/unified-sdl/code/libs/win32/libSDLmain.a
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: branches/unified-sdl/code/null/null_client.c
===================================================================
--- branches/unified-sdl/code/null/null_client.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/null/null_client.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -53,7 +53,7 @@
 }
 
 qboolean CL_GameCommand( void ) {
-  return qfalse; // bk001204 - non-void
+  return qfalse;
 }
 
 void CL_KeyEvent (int key, qboolean down, unsigned time) {
@@ -84,8 +84,6 @@
 void CL_StartHunkUsers( void ) {
 }
 
-// bk001119 - added new dummy for sv_init.c
 void CL_ShutdownAll(void) {}
 
-// bk001208 - added new dummy (RC4)
 qboolean CL_CDKeyValidate( const char *key, const char *checksum ) { return qtrue; }

Modified: branches/unified-sdl/code/null/null_snddma.c
===================================================================
--- branches/unified-sdl/code/null/null_snddma.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/null/null_snddma.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -47,7 +47,6 @@
 {
 }
 
-// bk001119 - added boolean flag, match client/snd_public.h
 sfxHandle_t S_RegisterSound( const char *name, qboolean compressed ) 
 {
 	return 0;

Modified: branches/unified-sdl/code/q3_ui/ui_atoms.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_atoms.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_atoms.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -330,8 +330,6 @@
 #define PROPB_SPACE_WIDTH	12
 #define PROPB_HEIGHT		36
 
-// bk001205 - code below duplicated in cgame/cg_drawtools.c
-// bk001205 - FIXME: does this belong in ui_shared.c?
 /*
 =================
 UI_DrawBannerString
@@ -340,7 +338,7 @@
 static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color )
 {
 	const char* s;
-	unsigned char	ch; // bk001204 - unsigned
+	unsigned char	ch;
 	float	ax;
 	float	ay;
 	float	aw;
@@ -450,10 +448,10 @@
 static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset )
 {
 	const char* s;
-	unsigned char	ch; // bk001204 - unsigned
+	unsigned char	ch;
 	float	ax;
 	float	ay;
-	float	aw = 0; // bk001204 - init
+	float	aw = 0;
 	float	ah;
 	float	frow;
 	float	fcol;
@@ -831,7 +829,6 @@
 		UI_InGameMenu();
 		return;
 		
-	// bk001204
 	case UIMENU_TEAM:
 	case UIMENU_POSTGAME:
 	default:

Modified: branches/unified-sdl/code/q3_ui/ui_connect.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_connect.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_connect.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -82,15 +82,6 @@
 	downloadCount = trap_Cvar_VariableValue( "cl_downloadCount" );
 	downloadTime = trap_Cvar_VariableValue( "cl_downloadTime" );
 
-#if 0 // bk010104
-	fprintf( stderr, "\n\n-----------------------------------------------\n");
-	fprintf( stderr, "DB: downloadSize:  %16d\n", downloadSize );
-	fprintf( stderr, "DB: downloadCount: %16d\n", downloadCount );
-	fprintf( stderr, "DB: downloadTime:  %16d\n", downloadTime );  
-  	fprintf( stderr, "DB: UI realtime:   %16d\n", uis.realtime );	// bk
-	fprintf( stderr, "DB: UI frametime:  %16d\n", uis.frametime );	// bk
-#endif
-
 	leftWidth = width = UI_ProportionalStringWidth( dlText ) * UI_ProportionalSizeScale( style );
 	width = UI_ProportionalStringWidth( etaText ) * UI_ProportionalSizeScale( style );
 	if (width > leftWidth) leftWidth = width;
@@ -118,10 +109,6 @@
 		UI_DrawProportionalString( leftWidth, 192, 
 			va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), style, color_white );
 	} else {
-	  // bk010108
-	  //float elapsedTime = (float)(uis.realtime - downloadTime); // current - start (msecs)
-	  //elapsedTime = elapsedTime * 0.001f; // in seconds
-	  //if ( elapsedTime <= 0.0f ) elapsedTime == 0.0f;
 	  if ( (uis.realtime - downloadTime) / 1000) {
 			xferRate = downloadCount / ((uis.realtime - downloadTime) / 1000);
 		  //xferRate = (int)( ((float)downloadCount) / elapsedTime);
@@ -129,9 +116,6 @@
 			xferRate = 0;
 		}
 
-	  //fprintf( stderr, "DB: elapsedTime:  %16.8f\n", elapsedTime );	// bk
-	  //fprintf( stderr, "DB: xferRate:   %16d\n", xferRate );	// bk
-
 		UI_ReadableSize( xferRateBuf, sizeof xferRateBuf, xferRate );
 
 		// Extrapolate estimated completion time
@@ -141,7 +125,7 @@
 			// We do it in K (/1024) because we'd overflow around 4MB
 			n = (n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000;
 			
-			UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf, n ); // bk010104
+			UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf, n );
 				//(n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000);
 
 			UI_DrawProportionalString( leftWidth, 160, 

Modified: branches/unified-sdl/code/q3_ui/ui_controls2.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_controls2.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_controls2.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -223,7 +223,7 @@
 
 static controls_t s_controls;
 
-static vec4_t controls_binding_color  = {1.00f, 0.43f, 0.00f, 1.00f}; // bk: Win32 C4305
+static vec4_t controls_binding_color  = {1.00f, 0.43f, 0.00f, 1.00f};
 
 static bind_t g_bindings[] = 
 {
@@ -561,7 +561,6 @@
 	// disable all controls in all groups
 	for( i = 0; i < C_MAX; i++ ) {
 		controls = g_controls[i];
-		// bk001204 - parentheses
 		for( j = 0;  (control = controls[j]) ; j++ ) {
 			control->flags |= (QMF_HIDDEN|QMF_INACTIVE);
 		}
@@ -570,14 +569,12 @@
 	controls = g_controls[s_controls.section];
 
 	// enable controls in active group (and count number of items for vertical centering)
-	// bk001204 - parentheses
 	for( j = 0;  (control = controls[j]) ; j++ ) {
 		control->flags &= ~(QMF_GRAYED|QMF_HIDDEN|QMF_INACTIVE);
 	}
 
 	// position controls
 	y = ( SCREEN_HEIGHT - j * SMALLCHAR_HEIGHT ) / 2;
-	// bk001204 - parentheses
 	for( j = 0;	(control = controls[j]) ; j++, y += SMALLCHAR_HEIGHT ) {
 		control->x      = 320;
 		control->y      = y;

Modified: branches/unified-sdl/code/q3_ui/ui_gameinfo.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_gameinfo.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_gameinfo.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -811,10 +811,5 @@
 	UI_LoadArenas();
 	UI_LoadBots();
 
-	if( (trap_Cvar_VariableValue( "fs_restrict" )) || (ui_numSpecialSinglePlayerArenas == 0 && ui_numSinglePlayerArenas == 4) ) {
-		uis.demoversion = qtrue;
-	}
-	else {
-		uis.demoversion = qfalse;
-	}
+	uis.demoversion = qfalse;
 }

Modified: branches/unified-sdl/code/q3_ui/ui_local.h
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_local.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_local.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -26,7 +26,7 @@
 #include "../qcommon/q_shared.h"
 #include "../renderer/tr_types.h"
 //NOTE: include the ui_public.h from the new UI
-#include "../ui/ui_public.h" // bk001205 - yes, do have to use this
+#include "../ui/ui_public.h"
 //redefine to old API version
 #undef UI_API_VERSION
 #define UI_API_VERSION	4
@@ -678,7 +678,7 @@
 void			trap_GetCDKey( char *buf, int buflen );
 void			trap_SetCDKey( char *buf );
 
-qboolean               trap_VerifyCDKey( const char *key, const char *chksum); // bk001208 - RC4
+qboolean               trap_VerifyCDKey( const char *key, const char *chksum);
 
 void			trap_SetPbClStatus( int status );
 

Modified: branches/unified-sdl/code/q3_ui/ui_main.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_main.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_main.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -79,7 +79,7 @@
 		UI_DrawConnectScreen( arg0 );
 		return 0;
 	case UI_HASUNIQUECDKEY:				// mod authors need to observe this
-		return qtrue;  // bk010117 - change this to qfalse for mods!
+		return qtrue;  // change this to qfalse for mods!
 	}
 
 	return -1;
@@ -156,7 +156,6 @@
 
 vmCvar_t	ui_cdkeychecked;
 
-// bk001129 - made static to avoid aliasing.
 static cvarTable_t		cvarTable[] = {
 	{ &ui_ffa_fraglimit, "ui_ffa_fraglimit", "20", CVAR_ARCHIVE },
 	{ &ui_ffa_timelimit, "ui_ffa_timelimit", "0", CVAR_ARCHIVE },
@@ -216,7 +215,6 @@
 	{ &ui_cdkeychecked, "ui_cdkeychecked", "0", CVAR_ROM }
 };
 
-// bk001129 - made static to avoid aliasing
 static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);
 
 

Modified: branches/unified-sdl/code/q3_ui/ui_mods.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_mods.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_mods.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -106,44 +106,8 @@
 }
 
 
-#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
 ===============
 */

Modified: branches/unified-sdl/code/q3_ui/ui_qmenu.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_qmenu.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_qmenu.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -327,7 +327,6 @@
 		if (b->shader)
 			UI_DrawHandlePic( x, y, w, h, b->shader );
 
-		// bk001204 - parentheses
 		if (  ( (b->generic.flags & QMF_PULSE) 
 			|| (b->generic.flags & QMF_PULSEIFFOCUS) )
 		      && (Menu_ItemAtCursor( b->generic.parent ) == b))

Modified: branches/unified-sdl/code/q3_ui/ui_team.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_team.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_team.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -47,16 +47,6 @@
 
 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

Modified: branches/unified-sdl/code/q3_ui/ui_video.c
===================================================================
--- branches/unified-sdl/code/q3_ui/ui_video.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/q3_ui/ui_video.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -238,13 +238,6 @@
 #define GRAPHICSOPTIONS_ACCEPT0	"menu/art/accept_0"
 #define GRAPHICSOPTIONS_ACCEPT1	"menu/art/accept_1"
 
-static const char *s_drivers[] =
-{
-	OPENGL_DRIVER_NAME,
-	_3DFX_DRIVER_NAME,
-	NULL
-};
-
 #define ID_BACK2		101
 #define ID_FULLSCREEN	102
 #define ID_LIST			103
@@ -489,24 +482,9 @@
 	trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue );
 	trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue );
 	trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue );
-	trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] );
-	switch ( s_graphicsoptions.colordepth.curvalue )
-	{
-	case 0:
-		trap_Cvar_SetValue( "r_colorbits", 0 );
-		trap_Cvar_SetValue( "r_depthbits", 0 );
-		trap_Cvar_SetValue( "r_stencilbits", 0 );
-		break;
-	case 1:
-		trap_Cvar_SetValue( "r_colorbits", 16 );
-		trap_Cvar_SetValue( "r_depthbits", 16 );
-		trap_Cvar_SetValue( "r_stencilbits", 0 );
-		break;
-	case 2:
-		trap_Cvar_SetValue( "r_colorbits", 32 );
-		trap_Cvar_SetValue( "r_depthbits", 24 );
-		break;
-	}
+	trap_Cvar_SetValue( "r_colorbits", 0 );
+	trap_Cvar_SetValue( "r_depthbits", 0 );
+	trap_Cvar_SetValue( "r_stencilbits", 0 );
 	trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue );
 
 	if ( s_graphicsoptions.geometry.curvalue == 2 )

Modified: branches/unified-sdl/code/qcommon/cm_trace.c
===================================================================
--- branches/unified-sdl/code/qcommon/cm_trace.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/cm_trace.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -41,7 +41,7 @@
 RotatePoint
 ================
 */
-void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // bk: FIXME 
+void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // FIXME 
 	vec3_t tvec;
 
 	VectorCopy(point, tvec);
@@ -55,7 +55,7 @@
 TransposeMatrix
 ================
 */
-void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]) { // bk: FIXME
+void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]) { // FIXME
 	int i, j;
 	for (i = 0; i < 3; i++) {
 		for (j = 0; j < 3; j++) {
@@ -1067,17 +1067,6 @@
 		if ( tw->isPoint ) {
 			offset = 0;
 		} else {
-#if 0 // bk010201 - DEAD
-			// an axial brush right behind a slanted bsp plane
-			// will poke through when expanded, so adjust
-			// by sqrt(3)
-			offset = fabs(tw->extents[0]*plane->normal[0]) +
-				fabs(tw->extents[1]*plane->normal[1]) +
-				fabs(tw->extents[2]*plane->normal[2]);
-
-			offset *= 2;
-			offset = tw->maxOffset;
-#endif
 			// this is silly
 			offset = 2048;
 		}
@@ -1276,7 +1265,7 @@
 	//
 	if (start[0] == end[0] && start[1] == end[1] && start[2] == end[2]) {
 		if ( model ) {
-#ifdef ALWAYS_BBOX_VS_BBOX // bk010201 - FIXME - compile time flag?
+#ifdef ALWAYS_BBOX_VS_BBOX // FIXME - compile time flag?
 			if ( model == BOX_MODEL_HANDLE || model == CAPSULE_MODEL_HANDLE) {
 				tw.sphere.use = qfalse;
 				CM_TestInLeaf( &tw, &cmod->leaf );

Modified: branches/unified-sdl/code/qcommon/common.c
===================================================================
--- branches/unified-sdl/code/qcommon/common.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/common.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -80,9 +80,6 @@
 cvar_t  *cl_packetdelay;
 cvar_t  *sv_packetdelay;
 cvar_t	*com_cameraMode;
-#if defined(_WIN32) && defined(_DEBUG)
-cvar_t	*com_noErrorInterrupt;
-#endif
 
 // com_speeds times
 int		time_game;
@@ -246,16 +243,6 @@
 	static int	errorCount;
 	int			currentTime;
 
-#if defined(_WIN32) && defined(_DEBUG)
-	if ( code != ERR_DISCONNECT && code != ERR_NEED_CD ) {
-		if (!com_noErrorInterrupt->integer) {
-			__asm {
-				int 0x03
-			}
-		}
-	}
-#endif
-
 	// when we are running automated scripts, make sure we
 	// know if anything failed
 	if ( com_buildScript && com_buildScript->integer ) {
@@ -1126,7 +1113,6 @@
 	byte mem[2];
 } memstatic_t;
 
-// bk001204 - initializer brackets
 memstatic_t emptystring =
 	{ {(sizeof(memblock_t)+2 + 3) & ~3, TAG_STATIC, NULL, NULL, ZONEID}, {'\0', '\0'} };
 memstatic_t numberstring[] = {
@@ -1385,7 +1371,6 @@
 */
 void Com_InitSmallZoneMemory( void ) {
 	s_smallZoneTotal = 512 * 1024;
-	// bk001205 - was malloc
 	smallzone = calloc( s_smallZoneTotal, 1 );
 	if ( !smallzone ) {
 		Com_Error( ERR_FATAL, "Small zone data failed to allocate %1.1f megs", (float)s_smallZoneTotal / (1024*1024) );
@@ -1411,7 +1396,6 @@
 		s_zoneTotal = cv->integer * 1024 * 1024;
 	}
 
-	// bk001205 - was malloc
 	mainzone = calloc( s_zoneTotal, 1 );
 	if ( !mainzone ) {
 		Com_Error( ERR_FATAL, "Zone data failed to allocate %i megs", s_zoneTotal / (1024*1024) );
@@ -1536,8 +1520,6 @@
 		s_hunkTotal = cv->integer * 1024 * 1024;
 	}
 
-
-	// bk001205 - was malloc
 	s_hunkData = calloc( s_hunkTotal + 31, 1 );
 	if ( !s_hunkData ) {
 		Com_Error( ERR_FATAL, "Hunk data failed to allocate %i megs", s_hunkTotal / (1024*1024) );
@@ -1901,14 +1883,9 @@
 ===================================================================
 */
 
-// bk001129 - here we go again: upped from 64
-// FIXME TTimo blunt upping from 256 to 1024
-// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=5
 #define	MAX_PUSHED_EVENTS	            1024
-// bk001129 - init, also static
 static int com_pushedEventsHead = 0;
 static int com_pushedEventsTail = 0;
-// bk001129 - static
 static sysEvent_t	com_pushedEvents[MAX_PUSHED_EVENTS];
 
 /*
@@ -1990,7 +1967,6 @@
 Com_InitPushEvent
 =================
 */
-// bk001129 - added
 void Com_InitPushEvent( void ) {
   // clear the static buffer array
   // this requires SE_NONE to be accepted as a valid but NOP event
@@ -2009,7 +1985,7 @@
 */
 void Com_PushEvent( sysEvent_t *event ) {
 	sysEvent_t		*ev;
-	static int printedWarning = 0; // bk001129 - init, bk001204 - explicit int
+	static int printedWarning = 0;
 
 	ev = &com_pushedEvents[ com_pushedEventsHead & (MAX_PUSHED_EVENTS-1) ];
 
@@ -2110,7 +2086,6 @@
 
 		switch ( ev.evType ) {
 		default:
-		  // bk001129 - was ev.evTime
 			Com_Error( ERR_FATAL, "Com_EventLoop: bad event type %i", ev.evType );
 			break;
         case SE_NONE:
@@ -2322,7 +2297,7 @@
 	}
 }
 
-#ifndef DEDICATED // bk001204
+#ifndef DEDICATED
 /*
 =================
 Com_WriteCDKey
@@ -2378,7 +2353,7 @@
 		static qboolean altivec = qfalse;
 		static qboolean detected = qfalse;
 		if (!detected) {
-			altivec = Sys_DetectAltivec();
+			altivec = ( Sys_GetProcessorFeatures( ) & CF_ALTIVEC );
 			detected = qtrue;
 		}
 
@@ -2397,13 +2372,13 @@
 void Com_Init( char *commandLine ) {
 	char	*s;
 
-	Com_Printf( "%s %s %s\n", SVN_VERSION, PLATFORM_STRING, __DATE__ );
+	Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ );
 
 	if ( setjmp (abortframe) ) {
 		Sys_Error ("Error during initialization");
 	}
 
-  // bk001129 - do this before anything else decides to push events
+  // do this before anything else decides to push events
   Com_InitPushEvent();
 
 	Com_InitSmallZoneMemory();
@@ -2488,10 +2463,6 @@
 
 	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" );
@@ -2550,9 +2521,9 @@
 
 	// always set the cvar, but only print the info if it makes sense.
 	Com_DetectAltivec();
-	#if idppc
+#if idppc
 	Com_Printf ("Altivec support is %s\n", com_altivec->integer ? "enabled" : "disabled");
-	#endif
+#endif
 
 	Com_Printf ("--- Common Initialization Complete ---\n");
 }
@@ -2583,7 +2554,7 @@
 ===============
 */
 void Com_WriteConfiguration( void ) {
-#ifndef DEDICATED // bk001204
+#ifndef DEDICATED
 	cvar_t	*fs;
 #endif
 	// if we are quiting without fully initializing, make sure
@@ -2599,7 +2570,7 @@
 
 	Com_WriteConfigToFile( "q3config.cfg" );
 
-	// bk001119 - tentative "not needed for dedicated"
+	// not needed for dedicated
 #ifndef DEDICATED
 	fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
 	if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
@@ -2708,8 +2679,6 @@
 		return;			// an ERR_DROP was thrown
 	}
 
-	// bk001204 - init to zero.
-	//  also:  might be clobbered by `longjmp' or `vfork'
 	timeBeforeFirstEvents =0;
 	timeBeforeServer =0;
 	timeBeforeEvents =0;

Modified: branches/unified-sdl/code/qcommon/cvar.c
===================================================================
--- branches/unified-sdl/code/qcommon/cvar.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/cvar.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -895,8 +895,8 @@
 =====================
 */
 void	Cvar_Update( vmCvar_t *vmCvar ) {
-	cvar_t	*cv = NULL; // bk001129
-	assert(vmCvar); // bk
+	cvar_t	*cv = NULL;
+	assert(vmCvar);
 
 	if ( (unsigned)vmCvar->handle >= cvar_numIndexes ) {
 		Com_Error( ERR_DROP, "Cvar_Update: handle out of range" );
@@ -911,16 +911,10 @@
 		return;		// variable might have been cleared by a cvar_restart
 	}
 	vmCvar->modificationCount = cv->modificationCount;
-	// bk001129 - mismatches.
 	if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING ) 
 	  Com_Error( ERR_DROP, "Cvar_Update: src %s length %zd exceeds MAX_CVAR_VALUE_STRING",
 		     cv->string, 
 		     strlen(cv->string));
-	// bk001212 - Q_strncpyz guarantees zero padding and dest[MAX_CVAR_VALUE_STRING-1]==0 
-	// bk001129 - paranoia. Never trust the destination string.
-	// bk001129 - beware, sizeof(char*) is always 4 (for cv->string). 
-	//            sizeof(vmCvar->string) always MAX_CVAR_VALUE_STRING
-	//Q_strncpyz( vmCvar->string, cv->string, sizeof( vmCvar->string ) ); // id
 	Q_strncpyz( vmCvar->string, cv->string,  MAX_CVAR_VALUE_STRING ); 
 
 	vmCvar->value = cv->value;

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

Modified: branches/unified-sdl/code/qcommon/net_ip.c
===================================================================
--- branches/unified-sdl/code/qcommon/net_ip.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/net_ip.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1032,22 +1032,12 @@
 void NET_Sleep( int msec ) {
 	struct timeval timeout;
 	fd_set	fdset;
-#ifndef _WIN32 //FIXME
-	extern qboolean stdin_active;
-#endif
 	int highestfd = 0;
 
 	if (!com_dedicated->integer)
 		return; // we're not a server, just run full speed
 
 	FD_ZERO(&fdset);
-#ifndef _WIN32 //FIXME
-	if (stdin_active)
-	{
-		FD_SET(0, &fdset); // stdin is processed too
-		highestfd = 1;
-	}
-#endif
 	if(ip_socket)
 	{
 		FD_SET(ip_socket, &fdset); // network socket

Modified: branches/unified-sdl/code/qcommon/q_math.c
===================================================================
--- branches/unified-sdl/code/qcommon/q_math.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/q_math.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -447,7 +447,7 @@
 
 	inv_denom =  DotProduct( normal, normal );
 #ifndef Q3_VM
-	assert( Q_fabs(inv_denom) != 0.0f ); // bk010122 - zero vectors get here
+	assert( Q_fabs(inv_denom) != 0.0f ); // zero vectors get here
 #endif
 	inv_denom = 1.0f / inv_denom;
 
@@ -515,7 +515,6 @@
 	y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
 //	y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed
 
-	//assert( !isnan(y) ); // bk010122 - FPE?
 	return y;
 }
 
@@ -1110,17 +1109,11 @@
 
 	if (length)
 	{
-#ifndef Q3_VM // bk0101022 - FPE related
-//	  assert( ((Q_fabs(v[0])!=0.0f) || (Q_fabs(v[1])!=0.0f) || (Q_fabs(v[2])!=0.0f)) );
-#endif
 		ilength = 1/length;
 		out[0] = v[0]*ilength;
 		out[1] = v[1]*ilength;
 		out[2] = v[2]*ilength;
 	} else {
-#ifndef Q3_VM // bk0101022 - FPE related
-//	  assert( ((Q_fabs(v[0])==0.0f) && (Q_fabs(v[1])==0.0f) && (Q_fabs(v[2])==0.0f)) );
-#endif
 		VectorClear( out );
 	}
 		

Modified: branches/unified-sdl/code/qcommon/q_platform.h
===================================================================
--- branches/unified-sdl/code/qcommon/q_platform.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/q_platform.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -168,7 +168,7 @@
 
 //=============================================================== FreeBSD ===
 
-#ifdef __FreeBSD__ // rb010123
+#ifdef __FreeBSD__
 
 #include <machine/endian.h>
 

Modified: branches/unified-sdl/code/qcommon/q_shared.c
===================================================================
--- branches/unified-sdl/code/qcommon/q_shared.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/q_shared.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -734,7 +734,6 @@
 =============
 */
 void Q_strncpyz( char *dest, const char *src, int destsize ) {
-  // bk001129 - also NULL dest
   if ( !dest ) {
     Com_Error( ERR_FATAL, "Q_strncpyz: NULL dest" );
   }
@@ -752,7 +751,6 @@
 int Q_stricmpn (const char *s1, const char *s2, int n) {
 	int		c1, c2;
 
-	// bk001129 - moved in 1.17 fix not in id codebase
         if ( s1 == NULL ) {
            if ( s2 == NULL )
              return 0;
@@ -846,7 +844,39 @@
 	Q_strncpyz( dest + l1, src, size - l1 );
 }
 
+/*
+* Find the first occurrence of find in s.
+*/
+const char *Q_stristr( const char *s, const char *find)
+{
+  char c, sc;
+  size_t len;
 
+  if ((c = *find++) != 0)
+  {
+    if (c >= 'a' && c <= 'z')
+    {
+      c -= ('a' - 'A');
+    }
+    len = strlen(find);
+    do
+    {
+      do
+      {
+        if ((sc = *s++) == 0)
+          return NULL;
+        if (sc >= 'a' && sc <= 'z')
+        {
+          sc -= ('a' - 'A');
+        }
+      } while (sc != c);
+    } while (Q_stricmpn(s, find, len) != 0);
+    s--;
+  }
+  return s;
+}
+
+
 int Q_PrintStrlen( const char *string ) {
 	int			len;
 	const char	*p;

Modified: branches/unified-sdl/code/qcommon/q_shared.h
===================================================================
--- branches/unified-sdl/code/qcommon/q_shared.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/q_shared.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -26,14 +26,15 @@
 // q_shared.h -- included first by ALL program modules.
 // A user mod should never modify this file
 
-#define Q3_VERSION            "ioQ3 1.33"
-#ifndef SVN_VERSION
-  #define SVN_VERSION Q3_VERSION
+#define Q3_VERSION_BASE         "ioq3 1.33"
+#ifdef SVN_VERSION
+# define Q3_VERSION Q3_VERSION_BASE "_SVN" SVN_VERSION
+#else
+# define Q3_VERSION Q3_VERSION_BASE
 #endif
-#define CLIENT_WINDOW_TITLE   "ioquake3"
-#define CLIENT_WINDOW_ICON    "ioq3"
-#define CONSOLE_WINDOW_TITLE  "ioquake3 console"
-#define CONSOLE_WINDOW_ICON   "ioq3 console"
+
+#define CLIENT_WINDOW_TITLE     "ioquake3"
+#define CLIENT_WINDOW_MIN_TITLE "ioq3"
 // 1.32 released 7-10-2002
 
 #define BASEGAME              "baseq3"
@@ -262,14 +263,6 @@
 void *Hunk_Alloc( int size, ha_pref preference );
 #endif
 
-#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(MACOS_X)
-// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
-// custom Snd_Memset implementation for glibc memset bug workaround
-void Snd_Memset (void* dest, const int val, const size_t count);
-#else
-#define Snd_Memset Com_Memset
-#endif
-
 #define Com_Memset memset
 #define Com_Memcpy memcpy
 
@@ -678,6 +671,7 @@
 char	*Q_strlwr( char *s1 );
 char	*Q_strupr( char *s1 );
 char	*Q_strrchr( const char* string, int c );
+const char	*Q_stristr( const char *s, const char *find);
 
 // buffer size safe library replacements
 void	Q_strncpyz( char *dest, const char *src, int destsize );

Modified: branches/unified-sdl/code/qcommon/qcommon.h
===================================================================
--- branches/unified-sdl/code/qcommon/qcommon.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/qcommon.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -687,13 +687,11 @@
 ==============================================================
 */
 
-// TTimo
 // vsnprintf is ISO/IEC 9899:1999
 // abstracting this to make it portable
 #ifdef WIN32
 #define Q_vsnprintf _vsnprintf
 #else
-// TODO: do we need Mac define?
 #define Q_vsnprintf vsnprintf
 #endif
 
@@ -701,19 +699,19 @@
 // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470
 extern char cl_cdkey[34];
 
-// returnbed by Sys_GetProcessorId
-#define CPUID_GENERIC			0			// any unrecognized processor
+// returned by Sys_GetProcessorFeatures
+typedef enum
+{
+  CF_RDTSC      = 1 << 0,
+  CF_MMX        = 1 << 1,
+  CF_MMX_EXT    = 1 << 2,
+  CF_3DNOW      = 1 << 3,
+  CF_3DNOW_EXT  = 1 << 4,
+  CF_SSE        = 1 << 5,
+  CF_SSE2       = 1 << 6,
+  CF_ALTIVEC    = 1 << 7
+} cpuFeatures_t;
 
-#define CPUID_AXP				0x10
-
-#define CPUID_INTEL_UNSUPPORTED	0x20			// Intel 386/486
-#define CPUID_INTEL_PENTIUM		0x21			// Intel Pentium or PPro
-#define CPUID_INTEL_MMX			0x22			// Intel Pentium/MMX or P2/MMX
-#define CPUID_INTEL_KATMAI		0x23			// Intel Katmai
-
-#define CPUID_AMD_3DNOW			0x30			// AMD K6 3DNOW!
-
-// TTimo
 // centralized and cleaned, that's the max string you can send to a Com_Printf / Com_DPrintf (above gets truncated)
 #define	MAXPRINTMSG	4096
 
@@ -943,7 +941,7 @@
 } joystickAxis_t;
 
 typedef enum {
-  // bk001129 - make sure SE_NONE is zero
+	// 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
@@ -966,7 +964,6 @@
 void	Sys_Init (void);
 
 // general development dll loading for virtual machine testing
-// fqpath param added 7/20/02 by T.Ray - Sys_LoadDll is only called in vm.c at this time
 void	* QDECL Sys_LoadDll( const char *name, char *fqpath , intptr_t (QDECL **entryPoint)(int, ...),
 				  intptr_t (QDECL *systemcalls)(intptr_t, ...) );
 void	Sys_UnloadDll( void *dllHandle );
@@ -1003,13 +1000,8 @@
 // the system console is shown when a dedicated server is running
 void	Sys_DisplaySystemConsole( qboolean show );
 
-int		Sys_GetProcessorId( void );
+cpuFeatures_t Sys_GetProcessorFeatures( void );
 
-void	Sys_BeginStreamedFile( fileHandle_t f, int readahead );
-void	Sys_EndStreamedFile( fileHandle_t f );
-int		Sys_StreamedRead( void *buffer, int size, int count, fileHandle_t f );
-void	Sys_StreamSeek( fileHandle_t f, int offset, int origin );
-
 void	Sys_ShowConsole( int level, qboolean quitOnClose );
 void	Sys_SetErrorText( const char *text );
 
@@ -1021,30 +1013,19 @@
 qboolean	Sys_IsLANAddress (netadr_t adr);
 void		Sys_ShowIP(void);
 
-qboolean	Sys_CheckCD( void );
-
 void	Sys_Mkdir( const char *path );
 char	*Sys_Cwd( void );
-void	Sys_SetDefaultCDPath(const char *path);
-char	*Sys_DefaultCDPath(void);
 void	Sys_SetDefaultInstallPath(const char *path);
 char	*Sys_DefaultInstallPath(void);
 void  Sys_SetDefaultHomePath(const char *path);
 char	*Sys_DefaultHomePath(void);
+const char *Sys_Dirname( char *path );
 
 char **Sys_ListFiles( const char *directory, const char *extension, char *filter, int *numfiles, qboolean wantsubs );
 void	Sys_FreeFileList( char **list );
 
-void	Sys_BeginProfiling( void );
-void	Sys_EndProfiling( void );
-
 qboolean Sys_LowPhysicalMemory( void );
-unsigned int Sys_ProcessorCount( void );
 
-int Sys_MonkeyShouldBeSpanked( void );
-
-qboolean Sys_DetectAltivec( void );
-
 /* This is based on the Adaptive Huffman algorithm described in Sayood's Data
  * Compression book.  The ranks are not actually stored, but implicitly defined
  * by the location of a node within a doubly-linked list */

Modified: branches/unified-sdl/code/qcommon/vm.c
===================================================================
--- branches/unified-sdl/code/qcommon/vm.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/vm.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -36,8 +36,8 @@
 #include "vm_local.h"
 
 
-vm_t	*currentVM = NULL; // bk001212
-vm_t	*lastVM    = NULL; // bk001212
+vm_t	*currentVM = NULL;
+vm_t	*lastVM    = NULL;
 int		vm_debugLevel;
 
 #define	MAX_VM		3
@@ -543,14 +543,7 @@
 	Q_strncpyz( vm->name, module, sizeof( vm->name ) );
 	vm->systemCall = systemCalls;
 
-	// never allow dll loading with a demo
 	if ( interpret == VMI_NATIVE ) {
-		if ( Cvar_VariableValue( "fs_restrict" ) ) {
-			interpret = VMI_COMPILED;
-		}
-	}
-
-	if ( interpret == VMI_NATIVE ) {
 		// try to load as a system dll
 		Com_Printf( "Loading dll file %s.\n", vm->name );
 		vm->dllHandle = Sys_LoadDll( module, vm->fqpath , &vm->entryPoint, VM_DllSyscall );
@@ -655,7 +648,7 @@
 	if ( !intValue ) {
 		return NULL;
 	}
-	// bk001220 - currentVM is missing on reconnect
+	// currentVM is missing on reconnect
 	if ( currentVM==NULL )
 	  return NULL;
 
@@ -672,7 +665,7 @@
 		return NULL;
 	}
 
-	// bk010124 - currentVM is missing on reconnect here as well?
+	// currentVM is missing on reconnect here as well?
 	if ( currentVM==NULL )
 	  return NULL;
 
@@ -773,7 +766,7 @@
 #endif
 	}
 
-	if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL
+	if ( oldVM != NULL )
 	  currentVM = oldVM;
 	return r;
 }

Modified: branches/unified-sdl/code/qcommon/vm_interpreted.c
===================================================================
--- branches/unified-sdl/code/qcommon/vm_interpreted.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/vm_interpreted.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -22,7 +22,7 @@
 #include "vm_local.h"
 
 //#define	DEBUG_VM
-#ifdef DEBUG_VM // bk001204
+#ifdef DEBUG_VM
 static char	*opnames[256] = {
 	"OP_UNDEF", 
 

Modified: branches/unified-sdl/code/qcommon/vm_local.h
===================================================================
--- branches/unified-sdl/code/qcommon/vm_local.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/vm_local.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -160,7 +160,6 @@
 	int			breakFunction;		// increment breakCount on function entry to this
 	int			breakCount;
 
-// fqpath member added 7/20/02 by T.Ray
 	char		fqpath[MAX_QPATH+1] ;
 
 	byte		*jumpTableTargets;

Modified: branches/unified-sdl/code/qcommon/vm_x86.c
===================================================================
--- branches/unified-sdl/code/qcommon/vm_x86.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/vm_x86.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -26,7 +26,7 @@
 #include <windows.h>
 #endif
 
-#ifdef __FreeBSD__ // rb0101023
+#ifdef __FreeBSD__
 #include <sys/types.h>
 #endif
 
@@ -77,13 +77,11 @@
 #else // _MSC_VER
 
 #if defined( FTOL_PTR )
-// bk001213 - BEWARE: does not work! UI menu etc. broken - stack!
-// bk001119 - added: int gftol( float x ) { return (int)x; }
 
-int qftol( void );     // bk001213 - label, see unix/ftol.nasm
-int qftol027F( void ); // bk001215 - fixed FPU control variants
+int qftol( void );
+int qftol027F( void );
 int qftol037F( void );
-int qftol0E7F( void ); // bk010102 - fixed bogus bits (duh)
+int qftol0E7F( void );
 int qftol0F7F( void );
 
 
@@ -95,7 +93,7 @@
 #endif
 
 
-static	int		callMask = 0; // bk001213 - init
+static	int		callMask = 0;
 
 static	int	instruction, pass;
 static	int	lastConst = 0;
@@ -1020,7 +1018,7 @@
 			EmitString( "D9 1F" );		// fstp dword ptr [edi]
 			break;
 		case OP_CVFI:
-#ifndef FTOL_PTR // WHENHELLISFROZENOVER  // bk001213 - was used in 1.17
+#ifndef FTOL_PTR // WHENHELLISFROZENOVER
 			// not IEEE complient, but simple and fast
 			EmitString( "D9 07" );		// fld dword ptr [edi]
 			EmitString( "DB 1F" );		// fistp dword ptr [edi]

Modified: branches/unified-sdl/code/qcommon/vm_x86_64.c
===================================================================
--- branches/unified-sdl/code/qcommon/vm_x86_64.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/qcommon/vm_x86_64.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -109,7 +109,7 @@
 	return ret;
 }
 
-#ifdef DEBUG_VM // bk001204
+#ifdef DEBUG_VM
 static char	*opnames[256] = {
 	"OP_UNDEF", 
 

Modified: branches/unified-sdl/code/renderer/qgl.h
===================================================================
--- branches/unified-sdl/code/renderer/qgl.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/renderer/qgl.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -26,12 +26,8 @@
 #ifndef __QGL_H__
 #define __QGL_H__
 
-#if defined( __LINT__ )
+#if defined( _WIN32 )
 
-#include <GL/gl.h>
-
-#elif defined( _WIN32 )
-
 #if _MSC_VER
 #pragma warning (disable: 4201)
 #pragma warning (disable: 4214)
@@ -43,6 +39,7 @@
 
 #include <windows.h>
 #include <GL/gl.h>
+#include <GL/glext.h>
 
 #elif defined(MACOS_X)
 
@@ -53,41 +50,16 @@
 #include <OpenGL/glext.h>
 #endif
 
-// This can be defined to use the CGLMacro.h support which avoids looking up
-// the current context.
-//#define USE_CGLMACROS
+#else
 
-#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
+#include <GL/glext.h>
 
-#elif defined( __sun )
-#include <GL/gl.h>
-#include <GL/glx.h>
-
-#else
-
-#include <gl.h>
-
 #endif
 
 #ifndef APIENTRY
 #define APIENTRY
 #endif
-#ifndef WINAPI
-#define WINAPI
-#endif
 
 
 //===========================================================================
@@ -109,6 +81,7 @@
 
 #else
 
+// FIXME GL_MAX_TEXTURE_UNITS_ARB?
 #define GL_MAX_ACTIVE_TEXTURES_ARB          0x84E2
 
 #endif /* defined(__sun) */
@@ -122,9 +95,10 @@
    #define GL_CLAMP_TO_EDGE                  0x812F
 #endif
 
-//===========================================================================
+// S3TC compression constants
+#define GL_RGB_S3TC                          0x83A0
+#define GL_RGB4_S3TC                         0x83A1
 
-// NOTE: some Linux platforms would need those prototypes
 #if defined(MACOS_X) || ( defined(__sun) && defined(__sparc) )
 typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
 typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
@@ -162,445 +136,351 @@
 typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum target);
 #endif
 
-// TTimo - VC7 / XP ?
-#ifdef WIN32
-typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
-typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum target);
-#endif
+//===========================================================================
 
-/*
-** extension constants
-*/
-
-
-// S3TC compression constants
-#define GL_RGB_S3TC							0x83A0
-#define GL_RGB4_S3TC						0x83A1
-
-
 // extensions will be function pointers on all platforms
+void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
+void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
+void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
 
-extern	void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
-extern	void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
-extern	void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
+void ( APIENTRY * qglLockArraysEXT)( GLint, GLint);
+void ( APIENTRY * qglUnlockArraysEXT) ( void );
 
-extern	void ( APIENTRY * qglLockArraysEXT) (GLint, GLint);
-extern	void ( APIENTRY * qglUnlockArraysEXT) (void);
-
 //===========================================================================
 
-// non-dlopening systems will just redefine qgl* to gl*
-#if !defined( _WIN32 ) && !defined(MACOS_X) && !defined( __linux__ ) && !defined( __FreeBSD__ ) && !defined(__sun) // rb010123
+#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
 
-#include "qgl_linked.h"
-
-#elif (defined(MACOS_X) && !defined(USE_SDL_VIDEO))
-// This includes #ifdefs for optional logging and GL error checking after every GL call as well as #defines to prevent incorrect usage of the non-'qgl' versions of the GL API.
-#include "macosx_qgl.h"
-
-#else
-
-// windows systems use a function pointer for each call so we can load minidrivers
-
-extern  void ( APIENTRY * qglAccum )(GLenum op, GLfloat value);
-extern  void ( APIENTRY * qglAlphaFunc )(GLenum func, GLclampf ref);
-extern  GLboolean ( APIENTRY * qglAreTexturesResident )(GLsizei n, const GLuint *textures, GLboolean *residences);
-extern  void ( APIENTRY * qglArrayElement )(GLint i);
-extern  void ( APIENTRY * qglBegin )(GLenum mode);
-extern  void ( APIENTRY * qglBindTexture )(GLenum target, GLuint texture);
-extern  void ( APIENTRY * qglBitmap )(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
-extern  void ( APIENTRY * qglBlendFunc )(GLenum sfactor, GLenum dfactor);
-extern  void ( APIENTRY * qglCallList )(GLuint list);
-extern  void ( APIENTRY * qglCallLists )(GLsizei n, GLenum type, const GLvoid *lists);
-extern  void ( APIENTRY * qglClear )(GLbitfield mask);
-extern  void ( APIENTRY * qglClearAccum )(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-extern  void ( APIENTRY * qglClearColor )(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-extern  void ( APIENTRY * qglClearDepth )(GLclampd depth);
-extern  void ( APIENTRY * qglClearIndex )(GLfloat c);
-extern  void ( APIENTRY * qglClearStencil )(GLint s);
-extern  void ( APIENTRY * qglClipPlane )(GLenum plane, const GLdouble *equation);
-extern  void ( APIENTRY * qglColor3b )(GLbyte red, GLbyte green, GLbyte blue);
-extern  void ( APIENTRY * qglColor3bv )(const GLbyte *v);
-extern  void ( APIENTRY * qglColor3d )(GLdouble red, GLdouble green, GLdouble blue);
-extern  void ( APIENTRY * qglColor3dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglColor3f )(GLfloat red, GLfloat green, GLfloat blue);
-extern  void ( APIENTRY * qglColor3fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglColor3i )(GLint red, GLint green, GLint blue);
-extern  void ( APIENTRY * qglColor3iv )(const GLint *v);
-extern  void ( APIENTRY * qglColor3s )(GLshort red, GLshort green, GLshort blue);
-extern  void ( APIENTRY * qglColor3sv )(const GLshort *v);
-extern  void ( APIENTRY * qglColor3ub )(GLubyte red, GLubyte green, GLubyte blue);
-extern  void ( APIENTRY * qglColor3ubv )(const GLubyte *v);
-extern  void ( APIENTRY * qglColor3ui )(GLuint red, GLuint green, GLuint blue);
-extern  void ( APIENTRY * qglColor3uiv )(const GLuint *v);
-extern  void ( APIENTRY * qglColor3us )(GLushort red, GLushort green, GLushort blue);
-extern  void ( APIENTRY * qglColor3usv )(const GLushort *v);
-extern  void ( APIENTRY * qglColor4b )(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
-extern  void ( APIENTRY * qglColor4bv )(const GLbyte *v);
-extern  void ( APIENTRY * qglColor4d )(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
-extern  void ( APIENTRY * qglColor4dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglColor4f )(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-extern  void ( APIENTRY * qglColor4fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglColor4i )(GLint red, GLint green, GLint blue, GLint alpha);
-extern  void ( APIENTRY * qglColor4iv )(const GLint *v);
-extern  void ( APIENTRY * qglColor4s )(GLshort red, GLshort green, GLshort blue, GLshort alpha);
-extern  void ( APIENTRY * qglColor4sv )(const GLshort *v);
-extern  void ( APIENTRY * qglColor4ub )(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-extern  void ( APIENTRY * qglColor4ubv )(const GLubyte *v);
-extern  void ( APIENTRY * qglColor4ui )(GLuint red, GLuint green, GLuint blue, GLuint alpha);
-extern  void ( APIENTRY * qglColor4uiv )(const GLuint *v);
-extern  void ( APIENTRY * qglColor4us )(GLushort red, GLushort green, GLushort blue, GLushort alpha);
-extern  void ( APIENTRY * qglColor4usv )(const GLushort *v);
-extern  void ( APIENTRY * qglColorMask )(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-extern  void ( APIENTRY * qglColorMaterial )(GLenum face, GLenum mode);
-extern  void ( APIENTRY * qglColorPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-extern  void ( APIENTRY * qglCopyPixels )(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
-extern  void ( APIENTRY * qglCopyTexImage1D )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-extern  void ( APIENTRY * qglCopyTexImage2D )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-extern  void ( APIENTRY * qglCopyTexSubImage1D )(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-extern  void ( APIENTRY * qglCopyTexSubImage2D )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-extern  void ( APIENTRY * qglCullFace )(GLenum mode);
-extern  void ( APIENTRY * qglDeleteLists )(GLuint list, GLsizei range);
-extern  void ( APIENTRY * qglDeleteTextures )(GLsizei n, const GLuint *textures);
-extern  void ( APIENTRY * qglDepthFunc )(GLenum func);
-extern  void ( APIENTRY * qglDepthMask )(GLboolean flag);
-extern  void ( APIENTRY * qglDepthRange )(GLclampd zNear, GLclampd zFar);
-extern  void ( APIENTRY * qglDisable )(GLenum cap);
-extern  void ( APIENTRY * qglDisableClientState )(GLenum array);
-extern  void ( APIENTRY * qglDrawArrays )(GLenum mode, GLint first, GLsizei count);
-extern  void ( APIENTRY * qglDrawBuffer )(GLenum mode);
-extern  void ( APIENTRY * qglDrawElements )(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
-extern  void ( APIENTRY * qglDrawPixels )(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-extern  void ( APIENTRY * qglEdgeFlag )(GLboolean flag);
-extern  void ( APIENTRY * qglEdgeFlagPointer )(GLsizei stride, const GLvoid *pointer);
-extern  void ( APIENTRY * qglEdgeFlagv )(const GLboolean *flag);
-extern  void ( APIENTRY * qglEnable )(GLenum cap);
-extern  void ( APIENTRY * qglEnableClientState )(GLenum array);
-extern  void ( APIENTRY * qglEnd )(void);
-extern  void ( APIENTRY * qglEndList )(void);
-extern  void ( APIENTRY * qglEvalCoord1d )(GLdouble u);
-extern  void ( APIENTRY * qglEvalCoord1dv )(const GLdouble *u);
-extern  void ( APIENTRY * qglEvalCoord1f )(GLfloat u);
-extern  void ( APIENTRY * qglEvalCoord1fv )(const GLfloat *u);
-extern  void ( APIENTRY * qglEvalCoord2d )(GLdouble u, GLdouble v);
-extern  void ( APIENTRY * qglEvalCoord2dv )(const GLdouble *u);
-extern  void ( APIENTRY * qglEvalCoord2f )(GLfloat u, GLfloat v);
-extern  void ( APIENTRY * qglEvalCoord2fv )(const GLfloat *u);
-extern  void ( APIENTRY * qglEvalMesh1 )(GLenum mode, GLint i1, GLint i2);
-extern  void ( APIENTRY * qglEvalMesh2 )(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
-extern  void ( APIENTRY * qglEvalPoint1 )(GLint i);
-extern  void ( APIENTRY * qglEvalPoint2 )(GLint i, GLint j);
-extern  void ( APIENTRY * qglFeedbackBuffer )(GLsizei size, GLenum type, GLfloat *buffer);
-extern  void ( APIENTRY * qglFinish )(void);
-extern  void ( APIENTRY * qglFlush )(void);
-extern  void ( APIENTRY * qglFogf )(GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglFogfv )(GLenum pname, const GLfloat *params);
-extern  void ( APIENTRY * qglFogi )(GLenum pname, GLint param);
-extern  void ( APIENTRY * qglFogiv )(GLenum pname, const GLint *params);
-extern  void ( APIENTRY * qglFrontFace )(GLenum mode);
-extern  void ( APIENTRY * qglFrustum )(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-extern  GLuint ( APIENTRY * qglGenLists )(GLsizei range);
-extern  void ( APIENTRY * qglGenTextures )(GLsizei n, GLuint *textures);
-extern  void ( APIENTRY * qglGetBooleanv )(GLenum pname, GLboolean *params);
-extern  void ( APIENTRY * qglGetClipPlane )(GLenum plane, GLdouble *equation);
-extern  void ( APIENTRY * qglGetDoublev )(GLenum pname, GLdouble *params);
-extern  GLenum ( APIENTRY * qglGetError )(void);
-extern  void ( APIENTRY * qglGetFloatv )(GLenum pname, GLfloat *params);
-extern  void ( APIENTRY * qglGetIntegerv )(GLenum pname, GLint *params);
-extern  void ( APIENTRY * qglGetLightfv )(GLenum light, GLenum pname, GLfloat *params);
-extern  void ( APIENTRY * qglGetLightiv )(GLenum light, GLenum pname, GLint *params);
-extern  void ( APIENTRY * qglGetMapdv )(GLenum target, GLenum query, GLdouble *v);
-extern  void ( APIENTRY * qglGetMapfv )(GLenum target, GLenum query, GLfloat *v);
-extern  void ( APIENTRY * qglGetMapiv )(GLenum target, GLenum query, GLint *v);
-extern  void ( APIENTRY * qglGetMaterialfv )(GLenum face, GLenum pname, GLfloat *params);
-extern  void ( APIENTRY * qglGetMaterialiv )(GLenum face, GLenum pname, GLint *params);
-extern  void ( APIENTRY * qglGetPixelMapfv )(GLenum map, GLfloat *values);
-extern  void ( APIENTRY * qglGetPixelMapuiv )(GLenum map, GLuint *values);
-extern  void ( APIENTRY * qglGetPixelMapusv )(GLenum map, GLushort *values);
-extern  void ( APIENTRY * qglGetPointerv )(GLenum pname, GLvoid* *params);
-extern  void ( APIENTRY * qglGetPolygonStipple )(GLubyte *mask);
-extern  const GLubyte * ( APIENTRY * qglGetString )(GLenum name);
-extern  void ( APIENTRY * qglGetTexEnvfv )(GLenum target, GLenum pname, GLfloat *params);
-extern  void ( APIENTRY * qglGetTexEnviv )(GLenum target, GLenum pname, GLint *params);
-extern  void ( APIENTRY * qglGetTexGendv )(GLenum coord, GLenum pname, GLdouble *params);
-extern  void ( APIENTRY * qglGetTexGenfv )(GLenum coord, GLenum pname, GLfloat *params);
-extern  void ( APIENTRY * qglGetTexGeniv )(GLenum coord, GLenum pname, GLint *params);
-extern  void ( APIENTRY * qglGetTexImage )(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
-extern  void ( APIENTRY * qglGetTexLevelParameterfv )(GLenum target, GLint level, GLenum pname, GLfloat *params);
-extern  void ( APIENTRY * qglGetTexLevelParameteriv )(GLenum target, GLint level, GLenum pname, GLint *params);
-extern  void ( APIENTRY * qglGetTexParameterfv )(GLenum target, GLenum pname, GLfloat *params);
-extern  void ( APIENTRY * qglGetTexParameteriv )(GLenum target, GLenum pname, GLint *params);
-extern  void ( APIENTRY * qglHint )(GLenum target, GLenum mode);
-extern  void ( APIENTRY * qglIndexMask )(GLuint mask);
-extern  void ( APIENTRY * qglIndexPointer )(GLenum type, GLsizei stride, const GLvoid *pointer);
-extern  void ( APIENTRY * qglIndexd )(GLdouble c);
-extern  void ( APIENTRY * qglIndexdv )(const GLdouble *c);
-extern  void ( APIENTRY * qglIndexf )(GLfloat c);
-extern  void ( APIENTRY * qglIndexfv )(const GLfloat *c);
-extern  void ( APIENTRY * qglIndexi )(GLint c);
-extern  void ( APIENTRY * qglIndexiv )(const GLint *c);
-extern  void ( APIENTRY * qglIndexs )(GLshort c);
-extern  void ( APIENTRY * qglIndexsv )(const GLshort *c);
-extern  void ( APIENTRY * qglIndexub )(GLubyte c);
-extern  void ( APIENTRY * qglIndexubv )(const GLubyte *c);
-extern  void ( APIENTRY * qglInitNames )(void);
-extern  void ( APIENTRY * qglInterleavedArrays )(GLenum format, GLsizei stride, const GLvoid *pointer);
-extern  GLboolean ( APIENTRY * qglIsEnabled )(GLenum cap);
-extern  GLboolean ( APIENTRY * qglIsList )(GLuint list);
-extern  GLboolean ( APIENTRY * qglIsTexture )(GLuint texture);
-extern  void ( APIENTRY * qglLightModelf )(GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglLightModelfv )(GLenum pname, const GLfloat *params);
-extern  void ( APIENTRY * qglLightModeli )(GLenum pname, GLint param);
-extern  void ( APIENTRY * qglLightModeliv )(GLenum pname, const GLint *params);
-extern  void ( APIENTRY * qglLightf )(GLenum light, GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglLightfv )(GLenum light, GLenum pname, const GLfloat *params);
-extern  void ( APIENTRY * qglLighti )(GLenum light, GLenum pname, GLint param);
-extern  void ( APIENTRY * qglLightiv )(GLenum light, GLenum pname, const GLint *params);
-extern  void ( APIENTRY * qglLineStipple )(GLint factor, GLushort pattern);
-extern  void ( APIENTRY * qglLineWidth )(GLfloat width);
-extern  void ( APIENTRY * qglListBase )(GLuint base);
-extern  void ( APIENTRY * qglLoadIdentity )(void);
-extern  void ( APIENTRY * qglLoadMatrixd )(const GLdouble *m);
-extern  void ( APIENTRY * qglLoadMatrixf )(const GLfloat *m);
-extern  void ( APIENTRY * qglLoadName )(GLuint name);
-extern  void ( APIENTRY * qglLogicOp )(GLenum opcode);
-extern  void ( APIENTRY * qglMap1d )(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
-extern  void ( APIENTRY * qglMap1f )(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
-extern  void ( APIENTRY * qglMap2d )(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
-extern  void ( APIENTRY * qglMap2f )(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
-extern  void ( APIENTRY * qglMapGrid1d )(GLint un, GLdouble u1, GLdouble u2);
-extern  void ( APIENTRY * qglMapGrid1f )(GLint un, GLfloat u1, GLfloat u2);
-extern  void ( APIENTRY * qglMapGrid2d )(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
-extern  void ( APIENTRY * qglMapGrid2f )(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
-extern  void ( APIENTRY * qglMaterialf )(GLenum face, GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglMaterialfv )(GLenum face, GLenum pname, const GLfloat *params);
-extern  void ( APIENTRY * qglMateriali )(GLenum face, GLenum pname, GLint param);
-extern  void ( APIENTRY * qglMaterialiv )(GLenum face, GLenum pname, const GLint *params);
-extern  void ( APIENTRY * qglMatrixMode )(GLenum mode);
-extern  void ( APIENTRY * qglMultMatrixd )(const GLdouble *m);
-extern  void ( APIENTRY * qglMultMatrixf )(const GLfloat *m);
-extern  void ( APIENTRY * qglNewList )(GLuint list, GLenum mode);
-extern  void ( APIENTRY * qglNormal3b )(GLbyte nx, GLbyte ny, GLbyte nz);
-extern  void ( APIENTRY * qglNormal3bv )(const GLbyte *v);
-extern  void ( APIENTRY * qglNormal3d )(GLdouble nx, GLdouble ny, GLdouble nz);
-extern  void ( APIENTRY * qglNormal3dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglNormal3f )(GLfloat nx, GLfloat ny, GLfloat nz);
-extern  void ( APIENTRY * qglNormal3fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglNormal3i )(GLint nx, GLint ny, GLint nz);
-extern  void ( APIENTRY * qglNormal3iv )(const GLint *v);
-extern  void ( APIENTRY * qglNormal3s )(GLshort nx, GLshort ny, GLshort nz);
-extern  void ( APIENTRY * qglNormal3sv )(const GLshort *v);
-extern  void ( APIENTRY * qglNormalPointer )(GLenum type, GLsizei stride, const GLvoid *pointer);
-extern  void ( APIENTRY * qglOrtho )(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-extern  void ( APIENTRY * qglPassThrough )(GLfloat token);
-extern  void ( APIENTRY * qglPixelMapfv )(GLenum map, GLsizei mapsize, const GLfloat *values);
-extern  void ( APIENTRY * qglPixelMapuiv )(GLenum map, GLsizei mapsize, const GLuint *values);
-extern  void ( APIENTRY * qglPixelMapusv )(GLenum map, GLsizei mapsize, const GLushort *values);
-extern  void ( APIENTRY * qglPixelStoref )(GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglPixelStorei )(GLenum pname, GLint param);
-extern  void ( APIENTRY * qglPixelTransferf )(GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglPixelTransferi )(GLenum pname, GLint param);
-extern  void ( APIENTRY * qglPixelZoom )(GLfloat xfactor, GLfloat yfactor);
-extern  void ( APIENTRY * qglPointSize )(GLfloat size);
-extern  void ( APIENTRY * qglPolygonMode )(GLenum face, GLenum mode);
-extern  void ( APIENTRY * qglPolygonOffset )(GLfloat factor, GLfloat units);
-extern  void ( APIENTRY * qglPolygonStipple )(const GLubyte *mask);
-extern  void ( APIENTRY * qglPopAttrib )(void);
-extern  void ( APIENTRY * qglPopClientAttrib )(void);
-extern  void ( APIENTRY * qglPopMatrix )(void);
-extern  void ( APIENTRY * qglPopName )(void);
-extern  void ( APIENTRY * qglPrioritizeTextures )(GLsizei n, const GLuint *textures, const GLclampf *priorities);
-extern  void ( APIENTRY * qglPushAttrib )(GLbitfield mask);
-extern  void ( APIENTRY * qglPushClientAttrib )(GLbitfield mask);
-extern  void ( APIENTRY * qglPushMatrix )(void);
-extern  void ( APIENTRY * qglPushName )(GLuint name);
-extern  void ( APIENTRY * qglRasterPos2d )(GLdouble x, GLdouble y);
-extern  void ( APIENTRY * qglRasterPos2dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglRasterPos2f )(GLfloat x, GLfloat y);
-extern  void ( APIENTRY * qglRasterPos2fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglRasterPos2i )(GLint x, GLint y);
-extern  void ( APIENTRY * qglRasterPos2iv )(const GLint *v);
-extern  void ( APIENTRY * qglRasterPos2s )(GLshort x, GLshort y);
-extern  void ( APIENTRY * qglRasterPos2sv )(const GLshort *v);
-extern  void ( APIENTRY * qglRasterPos3d )(GLdouble x, GLdouble y, GLdouble z);
-extern  void ( APIENTRY * qglRasterPos3dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglRasterPos3f )(GLfloat x, GLfloat y, GLfloat z);
-extern  void ( APIENTRY * qglRasterPos3fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglRasterPos3i )(GLint x, GLint y, GLint z);
-extern  void ( APIENTRY * qglRasterPos3iv )(const GLint *v);
-extern  void ( APIENTRY * qglRasterPos3s )(GLshort x, GLshort y, GLshort z);
-extern  void ( APIENTRY * qglRasterPos3sv )(const GLshort *v);
-extern  void ( APIENTRY * qglRasterPos4d )(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern  void ( APIENTRY * qglRasterPos4dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglRasterPos4f )(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern  void ( APIENTRY * qglRasterPos4fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglRasterPos4i )(GLint x, GLint y, GLint z, GLint w);
-extern  void ( APIENTRY * qglRasterPos4iv )(const GLint *v);
-extern  void ( APIENTRY * qglRasterPos4s )(GLshort x, GLshort y, GLshort z, GLshort w);
-extern  void ( APIENTRY * qglRasterPos4sv )(const GLshort *v);
-extern  void ( APIENTRY * qglReadBuffer )(GLenum mode);
-extern  void ( APIENTRY * qglReadPixels )(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
-extern  void ( APIENTRY * qglRectd )(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
-extern  void ( APIENTRY * qglRectdv )(const GLdouble *v1, const GLdouble *v2);
-extern  void ( APIENTRY * qglRectf )(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
-extern  void ( APIENTRY * qglRectfv )(const GLfloat *v1, const GLfloat *v2);
-extern  void ( APIENTRY * qglRecti )(GLint x1, GLint y1, GLint x2, GLint y2);
-extern  void ( APIENTRY * qglRectiv )(const GLint *v1, const GLint *v2);
-extern  void ( APIENTRY * qglRects )(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
-extern  void ( APIENTRY * qglRectsv )(const GLshort *v1, const GLshort *v2);
-extern  GLint ( APIENTRY * qglRenderMode )(GLenum mode);
-extern  void ( APIENTRY * qglRotated )(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-extern  void ( APIENTRY * qglRotatef )(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-extern  void ( APIENTRY * qglScaled )(GLdouble x, GLdouble y, GLdouble z);
-extern  void ( APIENTRY * qglScalef )(GLfloat x, GLfloat y, GLfloat z);
-extern  void ( APIENTRY * qglScissor )(GLint x, GLint y, GLsizei width, GLsizei height);
-extern  void ( APIENTRY * qglSelectBuffer )(GLsizei size, GLuint *buffer);
-extern  void ( APIENTRY * qglShadeModel )(GLenum mode);
-extern  void ( APIENTRY * qglStencilFunc )(GLenum func, GLint ref, GLuint mask);
-extern  void ( APIENTRY * qglStencilMask )(GLuint mask);
-extern  void ( APIENTRY * qglStencilOp )(GLenum fail, GLenum zfail, GLenum zpass);
-extern  void ( APIENTRY * qglTexCoord1d )(GLdouble s);
-extern  void ( APIENTRY * qglTexCoord1dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglTexCoord1f )(GLfloat s);
-extern  void ( APIENTRY * qglTexCoord1fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglTexCoord1i )(GLint s);
-extern  void ( APIENTRY * qglTexCoord1iv )(const GLint *v);
-extern  void ( APIENTRY * qglTexCoord1s )(GLshort s);
-extern  void ( APIENTRY * qglTexCoord1sv )(const GLshort *v);
-extern  void ( APIENTRY * qglTexCoord2d )(GLdouble s, GLdouble t);
-extern  void ( APIENTRY * qglTexCoord2dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglTexCoord2f )(GLfloat s, GLfloat t);
-extern  void ( APIENTRY * qglTexCoord2fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglTexCoord2i )(GLint s, GLint t);
-extern  void ( APIENTRY * qglTexCoord2iv )(const GLint *v);
-extern  void ( APIENTRY * qglTexCoord2s )(GLshort s, GLshort t);
-extern  void ( APIENTRY * qglTexCoord2sv )(const GLshort *v);
-extern  void ( APIENTRY * qglTexCoord3d )(GLdouble s, GLdouble t, GLdouble r);
-extern  void ( APIENTRY * qglTexCoord3dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglTexCoord3f )(GLfloat s, GLfloat t, GLfloat r);
-extern  void ( APIENTRY * qglTexCoord3fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglTexCoord3i )(GLint s, GLint t, GLint r);
-extern  void ( APIENTRY * qglTexCoord3iv )(const GLint *v);
-extern  void ( APIENTRY * qglTexCoord3s )(GLshort s, GLshort t, GLshort r);
-extern  void ( APIENTRY * qglTexCoord3sv )(const GLshort *v);
-extern  void ( APIENTRY * qglTexCoord4d )(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-extern  void ( APIENTRY * qglTexCoord4dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglTexCoord4f )(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-extern  void ( APIENTRY * qglTexCoord4fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglTexCoord4i )(GLint s, GLint t, GLint r, GLint q);
-extern  void ( APIENTRY * qglTexCoord4iv )(const GLint *v);
-extern  void ( APIENTRY * qglTexCoord4s )(GLshort s, GLshort t, GLshort r, GLshort q);
-extern  void ( APIENTRY * qglTexCoord4sv )(const GLshort *v);
-extern  void ( APIENTRY * qglTexCoordPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-extern  void ( APIENTRY * qglTexEnvf )(GLenum target, GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglTexEnvfv )(GLenum target, GLenum pname, const GLfloat *params);
-extern  void ( APIENTRY * qglTexEnvi )(GLenum target, GLenum pname, GLint param);
-extern  void ( APIENTRY * qglTexEnviv )(GLenum target, GLenum pname, const GLint *params);
-extern  void ( APIENTRY * qglTexGend )(GLenum coord, GLenum pname, GLdouble param);
-extern  void ( APIENTRY * qglTexGendv )(GLenum coord, GLenum pname, const GLdouble *params);
-extern  void ( APIENTRY * qglTexGenf )(GLenum coord, GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglTexGenfv )(GLenum coord, GLenum pname, const GLfloat *params);
-extern  void ( APIENTRY * qglTexGeni )(GLenum coord, GLenum pname, GLint param);
-extern  void ( APIENTRY * qglTexGeniv )(GLenum coord, GLenum pname, const GLint *params);
-extern  void ( APIENTRY * qglTexImage1D )(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-extern  void ( APIENTRY * qglTexImage2D )(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-extern  void ( APIENTRY * qglTexParameterf )(GLenum target, GLenum pname, GLfloat param);
-extern  void ( APIENTRY * qglTexParameterfv )(GLenum target, GLenum pname, const GLfloat *params);
-extern  void ( APIENTRY * qglTexParameteri )(GLenum target, GLenum pname, GLint param);
-extern  void ( APIENTRY * qglTexParameteriv )(GLenum target, GLenum pname, const GLint *params);
-extern  void ( APIENTRY * qglTexSubImage1D )(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
-extern  void ( APIENTRY * qglTexSubImage2D )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-extern  void ( APIENTRY * qglTranslated )(GLdouble x, GLdouble y, GLdouble z);
-extern  void ( APIENTRY * qglTranslatef )(GLfloat x, GLfloat y, GLfloat z);
-extern  void ( APIENTRY * qglVertex2d )(GLdouble x, GLdouble y);
-extern  void ( APIENTRY * qglVertex2dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglVertex2f )(GLfloat x, GLfloat y);
-extern  void ( APIENTRY * qglVertex2fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglVertex2i )(GLint x, GLint y);
-extern  void ( APIENTRY * qglVertex2iv )(const GLint *v);
-extern  void ( APIENTRY * qglVertex2s )(GLshort x, GLshort y);
-extern  void ( APIENTRY * qglVertex2sv )(const GLshort *v);
-extern  void ( APIENTRY * qglVertex3d )(GLdouble x, GLdouble y, GLdouble z);
-extern  void ( APIENTRY * qglVertex3dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglVertex3f )(GLfloat x, GLfloat y, GLfloat z);
-extern  void ( APIENTRY * qglVertex3fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglVertex3i )(GLint x, GLint y, GLint z);
-extern  void ( APIENTRY * qglVertex3iv )(const GLint *v);
-extern  void ( APIENTRY * qglVertex3s )(GLshort x, GLshort y, GLshort z);
-extern  void ( APIENTRY * qglVertex3sv )(const GLshort *v);
-extern  void ( APIENTRY * qglVertex4d )(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern  void ( APIENTRY * qglVertex4dv )(const GLdouble *v);
-extern  void ( APIENTRY * qglVertex4f )(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern  void ( APIENTRY * qglVertex4fv )(const GLfloat *v);
-extern  void ( APIENTRY * qglVertex4i )(GLint x, GLint y, GLint z, GLint w);
-extern  void ( APIENTRY * qglVertex4iv )(const GLint *v);
-extern  void ( APIENTRY * qglVertex4s )(GLshort x, GLshort y, GLshort z, GLshort w);
-extern  void ( APIENTRY * qglVertex4sv )(const GLshort *v);
-extern  void ( APIENTRY * qglVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-extern  void ( APIENTRY * qglViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
-
-#if defined( _WIN32 )
-
-extern  int   ( WINAPI * qwglChoosePixelFormat )(HDC, CONST PIXELFORMATDESCRIPTOR *);
-extern  int   ( WINAPI * qwglDescribePixelFormat) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
-extern  int   ( WINAPI * qwglGetPixelFormat)(HDC);
-extern  BOOL  ( WINAPI * qwglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
-extern  BOOL  ( WINAPI * qwglSwapBuffers)(HDC);
-
-extern	BOOL  ( WINAPI * qwglGetDeviceGammaRamp3DFX)( HDC, LPVOID );
-extern	BOOL  ( WINAPI * qwglSetDeviceGammaRamp3DFX)( HDC, LPVOID );
-
-extern BOOL  ( WINAPI * qwglCopyContext)(HGLRC, HGLRC, UINT);
-extern HGLRC ( WINAPI * qwglCreateContext)(HDC);
-extern HGLRC ( WINAPI * qwglCreateLayerContext)(HDC, int);
-extern BOOL  ( WINAPI * qwglDeleteContext)(HGLRC);
-extern HGLRC ( WINAPI * qwglGetCurrentContext)(VOID);
-extern HDC   ( WINAPI * qwglGetCurrentDC)(VOID);
-extern PROC  ( WINAPI * qwglGetProcAddress)(LPCSTR);
-extern BOOL  ( WINAPI * qwglMakeCurrent)(HDC, HGLRC);
-extern BOOL  ( WINAPI * qwglShareLists)(HGLRC, HGLRC);
-extern BOOL  ( WINAPI * qwglUseFontBitmaps)(HDC, DWORD, DWORD, DWORD);
-
-extern BOOL  ( WINAPI * qwglUseFontOutlines)(HDC, DWORD, DWORD, DWORD, FLOAT,
-                                           FLOAT, int, LPGLYPHMETRICSFLOAT);
-
-extern BOOL ( WINAPI * qwglDescribeLayerPlane)(HDC, int, int, UINT,
-                                            LPLAYERPLANEDESCRIPTOR);
-extern int  ( WINAPI * qwglSetLayerPaletteEntries)(HDC, int, int, int,
-                                                CONST COLORREF *);
-extern int  ( WINAPI * qwglGetLayerPaletteEntries)(HDC, int, int, int,
-                                                COLORREF *);
-extern BOOL ( WINAPI * qwglRealizeLayerPalette)(HDC, int, BOOL);
-extern BOOL ( WINAPI * qwglSwapLayerBuffers)(HDC, UINT);
-
-extern BOOL ( WINAPI * qwglSwapIntervalEXT)( int interval );
-
-#endif	// _WIN32
-
-#if ( (defined __linux__ )  || (defined __FreeBSD__ ) || (defined __sun) ) // rb010123
-
-//FX Mesa Functions
-// bk001129 - from cvs1.17 (mkv)
-#if defined (__FX__)
-extern fxMesaContext (*qfxMesaCreateContext)(GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]);
-extern fxMesaContext (*qfxMesaCreateBestContext)(GLuint win, GLint width, GLint height, const GLint attribList[]);
-extern void (*qfxMesaDestroyContext)(fxMesaContext ctx);
-extern void (*qfxMesaMakeCurrent)(fxMesaContext ctx);
-extern fxMesaContext (*qfxMesaGetCurrentContext)(void);
-extern void (*qfxMesaSwapBuffers)(void);
 #endif
-
-//GLX Functions
-extern XVisualInfo * (*qglXChooseVisual)( Display *dpy, int screen, int *attribList );
-extern GLXContext (*qglXCreateContext)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
-extern void (*qglXDestroyContext)( Display *dpy, GLXContext ctx );
-extern Bool (*qglXMakeCurrent)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
-extern void (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
-extern void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
-
-#endif // __linux__ || __FreeBSD__ || __sun // rb010123
-
-#endif	// _WIN32 && __linux__
-
-#endif

Deleted: branches/unified-sdl/code/renderer/qgl_linked.h
===================================================================
--- branches/unified-sdl/code/renderer/qgl_linked.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/renderer/qgl_linked.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -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
-

Modified: branches/unified-sdl/code/renderer/tr_cmds.c
===================================================================
--- branches/unified-sdl/code/renderer/tr_cmds.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/renderer/tr_cmds.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -118,7 +118,7 @@
 	renderCommandList_t	*cmdList;
 
 	cmdList = &backEndData[tr.smpFrame]->commands;
-	assert(cmdList); // bk001205
+	assert(cmdList);
 	// add an end-of-list command
 	*(int *)(cmdList->cmds + cmdList->used) = RC_END_OF_LIST;
 

Modified: branches/unified-sdl/code/renderer/tr_image.c
===================================================================
--- branches/unified-sdl/code/renderer/tr_image.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/renderer/tr_image.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -1358,7 +1358,6 @@
 
 #if 0 
   // TTimo: this is the chunk of code to ensure a behavior that meets TGA specs 
-  // bk0101024 - fix from Leonardo
   // bit 5 set => top-down
   if (targa_header.attributes & 0x20) {
     unsigned char *flip = (unsigned char*)malloc (columns*4);
@@ -4850,15 +4849,13 @@
 	tr.numImages = 0;
 
 	Com_Memset( glState.currenttextures, 0, sizeof( glState.currenttextures ) );
-	if ( qglBindTexture ) {
-		if ( qglActiveTextureARB ) {
-			GL_SelectTexture( 1 );
-			qglBindTexture( GL_TEXTURE_2D, 0 );
-			GL_SelectTexture( 0 );
-			qglBindTexture( GL_TEXTURE_2D, 0 );
-		} else {
-			qglBindTexture( GL_TEXTURE_2D, 0 );
-		}
+	if ( qglActiveTextureARB ) {
+		GL_SelectTexture( 1 );
+		qglBindTexture( GL_TEXTURE_2D, 0 );
+		GL_SelectTexture( 0 );
+		qglBindTexture( GL_TEXTURE_2D, 0 );
+	} else {
+		qglBindTexture( GL_TEXTURE_2D, 0 );
 	}
 }
 

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

Modified: branches/unified-sdl/code/renderer/tr_light.c
===================================================================
--- branches/unified-sdl/code/renderer/tr_light.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/renderer/tr_light.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -160,7 +160,7 @@
 	VectorClear( ent->directedLight );
 	VectorClear( direction );
 
-	assert( tr.world->lightGridData ); // bk010103 - NULL with -nolight maps
+	assert( tr.world->lightGridData ); // NULL with -nolight maps
 
 	// trilerp the light value
 	gridStep[0] = 8;
@@ -380,7 +380,6 @@
 {
 	trRefEntity_t ent;
 	
-	// bk010103 - this segfaults with -nolight maps
 	if ( tr.world->lightGridData == NULL )
 	  return qfalse;
 

Modified: branches/unified-sdl/code/renderer/tr_shader.c
===================================================================
--- branches/unified-sdl/code/renderer/tr_shader.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/renderer/tr_shader.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -2360,7 +2360,7 @@
 	int			hash;
 	shader_t	*sh;
 
-	if ( (name==NULL) || (name[0] == 0) ) {  // bk001205
+	if ( (name==NULL) || (name[0] == 0) ) {
 		return tr.defaultShader;
 	}
 
@@ -2770,7 +2770,7 @@
 */
 shader_t *R_GetShaderByHandle( qhandle_t hShader ) {
 	if ( hShader < 0 ) {
-	  ri.Printf( PRINT_WARNING, "R_GetShaderByHandle: out of range hShader '%d'\n", hShader ); // bk: FIXME name
+	  ri.Printf( PRINT_WARNING, "R_GetShaderByHandle: out of range hShader '%d'\n", hShader );
 		return tr.defaultShader;
 	}
 	if ( hShader >= tr.numShaders ) {

Modified: branches/unified-sdl/code/renderer/tr_types.h
===================================================================
--- branches/unified-sdl/code/renderer/tr_types.h	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/renderer/tr_types.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -202,33 +202,4 @@
 	qboolean				smpActive;		// dual processor
 } glconfig_t;
 
-// FIXME: VM should be OS agnostic .. in theory
-
-/*
-#ifdef Q3_VM
-
-#define _3DFX_DRIVER_NAME	"Voodoo"
-#define OPENGL_DRIVER_NAME	"Default"
-
-#elif defined(_WIN32)
-*/
-
-#if defined(Q3_VM) || defined(_WIN32)
-
-#define _3DFX_DRIVER_NAME	"3dfxvgl"
-#define OPENGL_DRIVER_NAME	"opengl32"
-
-#elif defined(MACOS_X)
-
-#define _3DFX_DRIVER_NAME	"libMesaVoodooGL.dylib"
-#define OPENGL_DRIVER_NAME	"/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
-
-#else
-
-#define _3DFX_DRIVER_NAME	"libMesaVoodooGL.so"
-// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=524
-#define OPENGL_DRIVER_NAME	"libGL.so.1"
-
-#endif	// !defined _WIN32
-
 #endif	// __TR_TYPES_H

Added: branches/unified-sdl/code/sdl/sdl_gamma.c
===================================================================
--- branches/unified-sdl/code/sdl/sdl_gamma.c	                        (rev 0)
+++ branches/unified-sdl/code/sdl/sdl_gamma.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,59 @@
+/*
+===========================================================================
+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(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];
+	}
+
+	// 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]);
+}
+

Copied: branches/unified-sdl/code/sdl/sdl_glimp.c (from rev 1143, branches/unified-sdl/code/unix/sdl_glimp.c)
===================================================================
--- branches/unified-sdl/code/sdl/sdl_glimp.c	                        (rev 0)
+++ branches/unified-sdl/code/sdl/sdl_glimp.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,793 @@
+/*
+===========================================================================
+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
+
+/*
+===============
+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;
+	SDL_Surface *icon = 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" );
+
+		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 );
+
+		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 = qtrue;
+
+	// 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

Added: branches/unified-sdl/code/sdl/sdl_input.c
===================================================================
--- branches/unified-sdl/code/sdl/sdl_input.c	                        (rev 0)
+++ branches/unified-sdl/code/sdl/sdl_input.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,818 @@
+/*
+===========================================================================
+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 mouse_avail = qfalse;
+static qboolean mouse_active = qfalse;
+static qboolean sdlrepeatenabled = qfalse;
+
+static cvar_t *in_mouse;
+#ifdef MACOS_X_ACCELERATION_HACK
+static cvar_t *in_disablemacosxmouseaccel;
+static double originalMouseSpeed = -1.0;
+#endif
+cvar_t *in_nograb; // this is strictly for developers
+
+cvar_t *in_joystick          = NULL;
+cvar_t *in_joystickDebug     = NULL;
+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
+===============
+*/
+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
+===============
+*/
+void IN_ActivateMouse( void )
+{
+	if (!mouse_avail || !SDL_WasInit( SDL_INIT_VIDEO ) )
+		return;
+
+#ifdef MACOS_X_ACCELERATION_HACK
+	if (!mouse_active && mouse_avail) // 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 (!mouse_active)
+	{
+		if (!in_nograb->value)
+		{
+			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
+		}
+
+		mouse_active = qtrue;
+	}
+}
+
+/*
+===============
+IN_DeactivateMouse
+===============
+*/
+void IN_DeactivateMouse( void )
+{
+	if (!mouse_avail || !SDL_WasInit( SDL_INIT_VIDEO ) )
+		return;
+
+#ifdef MACOS_X_ACCELERATION_HACK
+	if (mouse_active) // 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 (mouse_active)
+	{
+		if (!in_nograb->value)
+		{
+			SDL_ShowCursor(1);
+			SDL_WM_GrabInput(SDL_GRAB_OFF);
+		}
+
+		mouse_active = qfalse;
+	}
+}
+
+/*
+===============
+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);
+
+	// developer feature, allows to break without loosing mouse pointer
+	in_nograb = Cvar_Get ("in_nograb", "0", 0);
+
+	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);
+	Cvar_Set( "cl_platformSensitivity", "1.0" );
+#else
+	Cvar_Set( "cl_platformSensitivity", "2.0" );
+#endif
+
+	SDL_EnableUNICODE(1);
+	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+	sdlrepeatenabled = qtrue;
+
+	if (in_mouse->value)
+		mouse_avail = qtrue;
+	else
+		mouse_avail = qfalse;
+
+	IN_StartupJoystick( );
+	Com_DPrintf ("------------------------------------\n");
+}
+
+/*
+===============
+IN_Shutdown
+===============
+*/
+void IN_Shutdown(void)
+{
+	IN_DeactivateMouse();
+
+	mouse_avail = qfalse;
+
+	if (stick)
+	{
+		SDL_JoystickClose(stick);
+		stick = NULL;
+	}
+
+	SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+}
+
+/*
+===============
+IN_Frame
+===============
+*/
+void IN_Frame (void)
+{
+	IN_JoyMove(); // FIXME: disable if on desktop?
+
+	if ( cls.keyCatchers & KEYCATCH_CONSOLE )
+	{
+		// temporarily deactivate if not in the game and
+		// running on the desktop
+		// voodoo always counts as full screen
+		if( Cvar_VariableValue ("r_fullscreen") == 0 )
+		{
+			IN_DeactivateMouse ();
+			return;
+		}
+	}
+
+	IN_ActivateMouse();
+}
+
+/*
+===============
+IN_Activate
+===============
+*/
+void IN_Activate(void)
+{
+}
+
+/*
+===============
+Sys_SendKeyEvents
+===============
+*/
+void Sys_SendKeyEvents (void)
+{
+	const int t = 0;  // always just use the current time.
+	SDL_Event e;
+	const char *p = NULL;
+	int key = 0;
+
+	if( !SDL_WasInit( SDL_INIT_VIDEO ) )
+			return;
+
+	if (cls.keyCatchers == 0)
+	{
+		if (sdlrepeatenabled)
+		{
+			SDL_EnableKeyRepeat(0, 0);
+			sdlrepeatenabled = qfalse;
+		}
+	}
+	else
+	{
+		if (!sdlrepeatenabled)
+		{
+			SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+			sdlrepeatenabled = qtrue;
+		}
+	}
+
+	while (SDL_PollEvent(&e))
+	{
+		switch (e.type)
+		{
+			case SDL_KEYDOWN:
+				IN_PrintKey(&e);
+				p = IN_TranslateSDLToQ3Key(&e.key.keysym, &key);
+				if (key)
+				{
+					Sys_QueEvent( t, SE_KEY, key, qtrue, 0, NULL );
+				}
+				if (p)
+				{
+					while (*p)
+					{
+						Sys_QueEvent( t, SE_CHAR, *p++, 0, 0, NULL );
+					}
+				}
+				break;
+
+			case SDL_KEYUP:
+				IN_TranslateSDLToQ3Key(&e.key.keysym, &key);
+				Sys_QueEvent( t, SE_KEY, key, qfalse, 0, NULL );
+				break;
+
+			case SDL_MOUSEMOTION:
+				if (mouse_active)
+				{
+					Sys_QueEvent( t, 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;
+					}
+					Sys_QueEvent( t, SE_KEY, b, (e.type == SDL_MOUSEBUTTONDOWN?qtrue:qfalse), 0, NULL );
+				}
+				break;
+
+			case SDL_QUIT:
+				Sys_Quit();
+				break;
+		}
+	}
+}
+
+
+// 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
+===============
+*/
+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
+===============
+*/
+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;
+			Sys_QueEvent( 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])
+			{
+				Sys_QueEvent( 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:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 0], qfalse, 0, NULL );
+						break;
+					case SDL_HAT_RIGHT:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 1], qfalse, 0, NULL );
+						break;
+					case SDL_HAT_DOWN:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 2], qfalse, 0, NULL );
+						break;
+					case SDL_HAT_LEFT:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 3], qfalse, 0, NULL );
+						break;
+					case SDL_HAT_RIGHTUP:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 0], qfalse, 0, NULL );
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 1], qfalse, 0, NULL );
+						break;
+					case SDL_HAT_RIGHTDOWN:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 2], qfalse, 0, NULL );
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 1], qfalse, 0, NULL );
+						break;
+					case SDL_HAT_LEFTUP:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 0], qfalse, 0, NULL );
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 3], qfalse, 0, NULL );
+						break;
+					case SDL_HAT_LEFTDOWN:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 2], qfalse, 0, NULL );
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 3], qfalse, 0, NULL );
+						break;
+					default:
+						break;
+				}
+				// press event
+				switch( ((Uint8 *)&hats)[i] ) {
+					case SDL_HAT_UP:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 0], qtrue, 0, NULL );
+						break;
+					case SDL_HAT_RIGHT:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 1], qtrue, 0, NULL );
+						break;
+					case SDL_HAT_DOWN:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 2], qtrue, 0, NULL );
+						break;
+					case SDL_HAT_LEFT:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 3], qtrue, 0, NULL );
+						break;
+					case SDL_HAT_RIGHTUP:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 0], qtrue, 0, NULL );
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 1], qtrue, 0, NULL );
+						break;
+					case SDL_HAT_RIGHTDOWN:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 2], qtrue, 0, NULL );
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 1], qtrue, 0, NULL );
+						break;
+					case SDL_HAT_LEFTUP:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 0], qtrue, 0, NULL );
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 3], qtrue, 0, NULL );
+						break;
+					case SDL_HAT_LEFTDOWN:
+						Sys_QueEvent( 0, SE_KEY, hat_keys[4*i + 2], qtrue, 0, NULL );
+						Sys_QueEvent( 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 ) ) ) {
+				Sys_QueEvent( 0, SE_KEY, joy_keys[i], qtrue, 0, NULL );
+			}
+
+			if( !( axes & ( 1 << i ) ) && ( stick_state.oldaxes & ( 1 << i ) ) ) {
+				Sys_QueEvent( 0, SE_KEY, joy_keys[i], qfalse, 0, NULL );
+			}
+		}
+	}
+
+	/* Save for future generations. */
+	stick_state.oldaxes = axes;
+}

Copied: branches/unified-sdl/code/sdl/sdl_snd.c (from rev 1143, branches/unified-sdl/code/unix/sdl_snd.c)
===================================================================
--- branches/unified-sdl/code/sdl/sdl_snd.c	                        (rev 0)
+++ branches/unified-sdl/code/sdl/sdl_snd.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,295 @@
+/*
+===========================================================================
+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 <stdlib.h>
+#include <stdio.h>
+
+#include "SDL.h"
+
+#include "../qcommon/q_shared.h"
+#include "../client/snd_local.h"
+
+qboolean snd_inited = qfalse;
+
+cvar_t *s_sdlBits;
+cvar_t *s_sdlSpeed;
+cvar_t *s_sdlChannels;
+cvar_t *s_sdlDevSamps;
+cvar_t *s_sdlMixSamps;
+
+/* The audio callback. All the magic happens here. */
+static int dmapos = 0;
+static int dmasize = 0;
+
+/*
+===============
+SNDDMA_AudioCallback
+===============
+*/
+static void SNDDMA_AudioCallback(void *userdata, Uint8 *stream, int len)
+{
+	int pos = (dmapos * (dma.samplebits/8));
+	if (pos >= dmasize)
+		dmapos = pos = 0;
+
+	if (!snd_inited)  /* shouldn't happen, but just in case... */
+	{
+		memset(stream, '\0', len);
+		return;
+	}
+	else
+	{
+		int tobufend = dmasize - pos;  /* bytes to buffer's end. */
+		int len1 = len;
+		int len2 = 0;
+
+		if (len1 > tobufend)
+		{
+			len1 = tobufend;
+			len2 = len - len1;
+		}
+		memcpy(stream, dma.buffer + pos, len1);
+		if (len2 <= 0)
+			dmapos += (len1 / (dma.samplebits/8));
+		else  /* wraparound? */
+		{
+			memcpy(stream+len1, dma.buffer, len2);
+			dmapos = (len2 / (dma.samplebits/8));
+		}
+	}
+
+	if (dmapos >= dmasize)
+		dmapos = 0;
+}
+
+static struct
+{
+	Uint16	enumFormat;
+	char		*stringFormat;
+} formatToStringTable[ ] =
+{
+	{ AUDIO_U8,     "AUDIO_U8" },
+	{ AUDIO_S8,     "AUDIO_S8" },
+	{ AUDIO_U16LSB, "AUDIO_U16LSB" },
+	{ AUDIO_S16LSB, "AUDIO_S16LSB" },
+	{ AUDIO_U16MSB, "AUDIO_U16MSB" },
+	{ AUDIO_S16MSB, "AUDIO_S16MSB" }
+};
+
+static int formatToStringTableSize =
+  sizeof( formatToStringTable ) / sizeof( formatToStringTable[ 0 ] );
+
+/*
+===============
+SNDDMA_PrintAudiospec
+===============
+*/
+static void SNDDMA_PrintAudiospec(const char *str, const SDL_AudioSpec *spec)
+{
+	int		i;
+	char	*fmt = NULL;
+
+	Com_Printf("%s:\n", str);
+
+	for( i = 0; i < formatToStringTableSize; i++ ) {
+		if( spec->format == formatToStringTable[ i ].enumFormat ) {
+			fmt = formatToStringTable[ i ].stringFormat;
+		}
+	}
+
+	if( fmt ) {
+		Com_Printf( "  Format:   %s\n", fmt );
+	} else {
+		Com_Printf( "  Format:   " S_COLOR_RED "UNKNOWN\n");
+	}
+
+	Com_Printf( "  Freq:     %d\n", (int) spec->freq );
+	Com_Printf( "  Samples:  %d\n", (int) spec->samples );
+	Com_Printf( "  Channels: %d\n", (int) spec->channels );
+}
+
+/*
+===============
+SNDDMA_Init
+===============
+*/
+qboolean SNDDMA_Init(void)
+{
+	char drivername[128];
+	SDL_AudioSpec desired;
+	SDL_AudioSpec obtained;
+	int tmp;
+
+	if (snd_inited)
+		return qtrue;
+
+	if (!s_sdlBits) {
+		s_sdlBits = Cvar_Get("s_sdlBits", "16", CVAR_ARCHIVE);
+		s_sdlSpeed = Cvar_Get("s_sdlSpeed", "0", CVAR_ARCHIVE);
+		s_sdlChannels = Cvar_Get("s_sdlChannels", "2", CVAR_ARCHIVE);
+		s_sdlDevSamps = Cvar_Get("s_sdlDevSamps", "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_Init(SDL_INIT_AUDIO) == -1)
+		{
+			Com_Printf( "FAILED (%s)\n", SDL_GetError( ) );
+			return qfalse;
+		}
+	}
+
+	Com_Printf( "OK\n" );
+
+	if (SDL_AudioDriverName(drivername, sizeof (drivername)) == NULL)
+		strcpy(drivername, "(UNKNOWN)");
+	Com_Printf("SDL audio driver is \"%s\".\n", drivername);
+
+	memset(&desired, '\0', sizeof (desired));
+	memset(&obtained, '\0', sizeof (obtained));
+
+	tmp = ((int) s_sdlBits->value);
+	if ((tmp != 16) && (tmp != 8))
+		tmp = 16;
+
+	desired.freq = (int) s_sdlSpeed->value;
+	if(!desired.freq) desired.freq = 22050;
+	desired.format = ((tmp == 16) ? AUDIO_S16SYS : AUDIO_U8);
+
+	// I dunno if this is the best idea, but I'll give it a try...
+	//  should probably check a cvar for this...
+	if (s_sdlDevSamps->value)
+		desired.samples = s_sdlDevSamps->value;
+	else
+	{
+		// just pick a sane default.
+		if (desired.freq <= 11025)
+			desired.samples = 256;
+		else if (desired.freq <= 22050)
+			desired.samples = 512;
+		else if (desired.freq <= 44100)
+			desired.samples = 1024;
+		else
+			desired.samples = 2048;  // (*shrug*)
+	}
+
+	desired.channels = (int) s_sdlChannels->value;
+	desired.callback = SNDDMA_AudioCallback;
+
+	if (SDL_OpenAudio(&desired, &obtained) == -1)
+	{
+		Com_Printf("SDL_OpenAudio() failed: %s\n", SDL_GetError());
+		SDL_QuitSubSystem(SDL_INIT_AUDIO);
+		return qfalse;
+	}
+
+	SNDDMA_PrintAudiospec("SDL_AudioSpec", &obtained);
+
+	// dma.samples needs to be big, or id's mixer will just refuse to
+	//  work at all; we need to keep it significantly bigger than the
+	//  amount of SDL callback samples, and just copy a little each time
+	//  the callback runs.
+	// 32768 is what the OSS driver filled in here on my system. I don't
+	//  know if it's a good value overall, but at least we know it's
+	//  reasonable...this is why I let the user override.
+	tmp = s_sdlMixSamps->value;
+	if (!tmp)
+		tmp = (obtained.samples * obtained.channels) * 10;
+
+	if (tmp & (tmp - 1))  // not a power of two? Seems to confuse something.
+	{
+		int val = 1;
+		while (val < tmp)
+			val <<= 1;
+
+		tmp = val;
+	}
+
+	dmapos = 0;
+	dma.samplebits = obtained.format & 0xFF;  // first byte of format is bits.
+	dma.channels = obtained.channels;
+	dma.samples = tmp;
+	dma.submission_chunk = 1;
+	dma.speed = obtained.freq;
+	dmasize = (dma.samples * (dma.samplebits/8));
+	dma.buffer = calloc(1, dmasize);
+
+	Com_Printf("Starting SDL audio callback...\n");
+	SDL_PauseAudio(0);  // start callback.
+
+	Com_Printf("SDL audio initialized.\n");
+	snd_inited = qtrue;
+	return qtrue;
+}
+
+/*
+===============
+SNDDMA_GetDMAPos
+===============
+*/
+int SNDDMA_GetDMAPos(void)
+{
+	return dmapos;
+}
+
+/*
+===============
+SNDDMA_Shutdown
+===============
+*/
+void SNDDMA_Shutdown(void)
+{
+	Com_Printf("Closing SDL audio device...\n");
+	SDL_PauseAudio(1);
+	SDL_CloseAudio();
+	SDL_QuitSubSystem(SDL_INIT_AUDIO);
+	free(dma.buffer);
+	dma.buffer = NULL;
+	dmapos = dmasize = 0;
+	snd_inited = qfalse;
+	Com_Printf("SDL audio device shut down.\n");
+}
+
+/*
+===============
+SNDDMA_Submit
+
+Send sound to device if buffer isn't really the dma buffer
+===============
+*/
+void SNDDMA_Submit(void)
+{
+	SDL_UnlockAudio();
+}
+
+/*
+===============
+SNDDMA_BeginPainting
+===============
+*/
+void SNDDMA_BeginPainting (void)
+{
+	SDL_LockAudio();
+}

Modified: branches/unified-sdl/code/server/sv_bot.c
===================================================================
--- branches/unified-sdl/code/server/sv_bot.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/server/sv_bot.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -518,10 +518,6 @@
 void SV_BotInitBotLib(void) {
 	botlib_import_t	botlib_import;
 
-	if ( !Cvar_VariableValue("fs_restrict") && !Sys_CheckCD() ) {
-		Com_Error( ERR_NEED_CD, "Game CD not in drive" );
-	}
-
 	if (debugpolygons) Z_Free(debugpolygons);
 	bot_maxdebugpolys = Cvar_VariableIntegerValue("bot_maxdebugpolys");
 	debugpolygons = Z_Malloc(sizeof(bot_debugpoly_t) * bot_maxdebugpolys);
@@ -558,7 +554,7 @@
 	botlib_import.DebugPolygonDelete = BotImport_DebugPolygonDelete;
 
 	botlib_export = (botlib_export_t *)GetBotLibAPI( BOTLIB_API_VERSION, &botlib_import );
-	assert(botlib_export); 	// bk001129 - somehow we end up with a zero import.
+	assert(botlib_export); 	// somehow we end up with a zero import.
 }
 
 

Modified: branches/unified-sdl/code/server/sv_ccmds.c
===================================================================
--- branches/unified-sdl/code/server/sv_ccmds.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/server/sv_ccmds.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -321,7 +321,7 @@
 			// this generally shouldn't happen, because the client
 			// was connected before the level change
 			SV_DropClient( client, denied );
-			Com_Printf( "SV_MapRestart_f(%d): dropped client %i - denied!\n", delay, i ); // bk010125
+			Com_Printf( "SV_MapRestart_f(%d): dropped client %i - denied!\n", delay, i );
 			continue;
 		}
 

Modified: branches/unified-sdl/code/server/sv_client.c
===================================================================
--- branches/unified-sdl/code/server/sv_client.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/server/sv_client.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -173,12 +173,6 @@
 	r = Cmd_Argv( 3 );			// reason
 
 	if ( !Q_stricmp( s, "demo" ) ) {
-		if ( Cvar_VariableValue( "fs_restrict" ) ) {
-			// a demo client connecting to a demo server
-			NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, 
-				"challengeResponse %i", svs.challenges[i].challenge );
-			return;
-		}
 		// they are a demo client trying to connect to a real server
 		NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, "print\nServer is not a demo server\n" );
 		// clear the challenge record so it won't timeout and let them through

Modified: branches/unified-sdl/code/server/sv_game.c
===================================================================
--- branches/unified-sdl/code/server/sv_game.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/server/sv_game.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -918,7 +918,7 @@
 
 	// do a restart instead of a free
 	gvm = VM_Restart( gvm );
-	if ( !gvm ) { // bk001212 - as done below
+	if ( !gvm ) {
 		Com_Error( ERR_FATAL, "VM_Restart on game failed" );
 	}
 

Modified: branches/unified-sdl/code/server/sv_main.c
===================================================================
--- branches/unified-sdl/code/server/sv_main.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/server/sv_main.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -24,7 +24,7 @@
 
 serverStatic_t	svs;				// persistant server info
 server_t		sv;					// local server
-vm_t			*gvm = NULL;				// game virtual machine // bk001212 init
+vm_t			*gvm = NULL;				// game virtual machine
 
 cvar_t	*sv_fps;				// time rate for running non-clients
 cvar_t	*sv_timeout;			// seconds without any message
@@ -335,15 +335,6 @@
 	// to prevent timed spoofed reply packets that add ghost servers
 	Info_SetValueForKey( infostring, "challenge", Cmd_Argv(1) );
 
-	// add "demo" to the sv_keywords if restricted
-	if ( Cvar_VariableValue( "fs_restrict" ) ) {
-		char	keywords[MAX_INFO_STRING];
-
-		Com_sprintf( keywords, sizeof( keywords ), "demo %s",
-			Info_ValueForKey( infostring, "sv_keywords" ) );
-		Info_SetValueForKey( infostring, "sv_keywords", keywords );
-	}
-
 	status[0] = 0;
 	statusLength = 0;
 

Added: branches/unified-sdl/code/sys/sys_loadlib.h
===================================================================
--- branches/unified-sdl/code/sys/sys_loadlib.h	                        (rev 0)
+++ branches/unified-sdl/code/sys/sys_loadlib.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,36 @@
+/*
+===========================================================================
+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
+===========================================================================
+*/
+
+#ifdef DEDICATED
+#	include <dlfcn.h>
+#	define Sys_LoadLibrary(f) dlopen(f,RTLD_NOW)
+#	define Sys_UnloadLibrary(h) dlclose(h)
+#	define Sys_LoadFunction(h,fn) dlsym(h,fn)
+#	define Sys_LibraryError() dlerror()
+#else
+#	include "SDL.h"
+#	include "SDL_loadso.h"
+#	define Sys_LoadLibrary(f) SDL_LoadObject(f)
+#	define Sys_UnloadLibrary(h) SDL_UnloadObject(h)
+#	define Sys_LoadFunction(h,fn) SDL_LoadFunction(h,fn)
+#	define Sys_LibraryError() SDL_GetError()
+#endif

Added: branches/unified-sdl/code/sys/sys_local.h
===================================================================
--- branches/unified-sdl/code/sys/sys_local.h	                        (rev 0)
+++ branches/unified-sdl/code/sys/sys_local.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,43 @@
+/*
+===========================================================================
+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 "../qcommon/q_shared.h"
+#include "../qcommon/qcommon.h"
+
+// Queue subsystem
+void Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr );
+qboolean Sys_GetPacket ( netadr_t *net_from, msg_t *net_message );
+void Sys_SendKeyEvents (void);
+
+// Input subsystem
+void IN_Init (void);
+void IN_Frame (void);
+void IN_Shutdown (void);
+void IN_JoyMove( void );
+void IN_StartupJoystick( void );
+
+// TTY console
+void TTY_Hide( void );
+void TTY_Show( void );
+void TTY_Shutdown( void );
+void TTY_Init( void );
+char *TTY_ConsoleInput(void);

Copied: branches/unified-sdl/code/sys/sys_main.c (from rev 1143, branches/unified-sdl/code/unix/unix_main.c)
===================================================================
--- branches/unified-sdl/code/sys/sys_main.c	                        (rev 0)
+++ branches/unified-sdl/code/sys/sys_main.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,778 @@
+/*
+===========================================================================
+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 <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#ifndef DEDICATED
+#include "SDL.h"
+#endif
+
+#include "sys_local.h"
+#include "sys_loadlib.h"
+
+#include "../qcommon/q_shared.h"
+#include "../qcommon/qcommon.h"
+
+static char binaryPath[ MAX_OSPATH ];
+static char installPath[ MAX_OSPATH ];
+
+/*
+=================
+Sys_SetBinaryPath
+=================
+*/
+void Sys_SetBinaryPath(const char *path)
+{
+	Q_strncpyz(binaryPath, path, sizeof(binaryPath));
+}
+
+/*
+=================
+Sys_BinaryPath
+=================
+*/
+char *Sys_BinaryPath(void)
+{
+	return binaryPath;
+}
+
+/*
+=================
+Sys_SetDefaultInstallPath
+=================
+*/
+void Sys_SetDefaultInstallPath(const char *path)
+{
+	Q_strncpyz(installPath, path, sizeof(installPath));
+}
+
+/*
+=================
+Sys_DefaultInstallPath
+=================
+*/
+char *Sys_DefaultInstallPath(void)
+{
+	if (*installPath)
+		return installPath;
+	else
+		return Sys_Cwd();
+}
+
+/*
+=================
+Sys_In_Restart_f
+
+Restart the input subsystem
+=================
+*/
+void Sys_In_Restart_f( void )
+{
+	IN_Shutdown();
+	IN_Init();
+}
+
+/*
+=================
+Sys_ConsoleInputInit
+
+Start the console input subsystem
+=================
+*/
+void Sys_ConsoleInputInit( void )
+{
+#ifdef DEDICATED
+	TTY_Init( );
+#endif
+}
+
+/*
+=================
+Sys_ConsoleInputShutdown
+
+Shutdown the console input subsystem
+=================
+*/
+void Sys_ConsoleInputShutdown( void )
+{
+#ifdef DEDICATED
+	TTY_Shutdown( );
+#endif
+}
+
+/*
+=================
+Sys_ConsoleInput
+
+Handle new console input
+=================
+*/
+char *Sys_ConsoleInput(void)
+{
+#ifdef DEDICATED
+	return TTY_ConsoleInput( );
+#endif
+
+	return NULL;
+}
+
+/*
+=================
+Sys_Exit
+
+Single exit point (regular exit or in case of error)
+=================
+*/
+void Sys_Exit( int ex )
+{
+	Sys_ConsoleInputShutdown();
+
+#ifndef DEDICATED
+	SDL_Quit( );
+#endif
+
+#ifdef NDEBUG
+	// _exit is called instead of exit since there are rumours of
+	// GL libraries installing atexit calls that we don't want to call
+	// FIXME: get some testing done with plain exit
+	_exit(ex);
+#else
+	// Cause a backtrace on error exits
+	assert( ex == 0 );
+	exit(ex);
+#endif
+}
+
+/*
+=================
+Sys_Quit
+=================
+*/
+void Sys_Quit (void)
+{
+	CL_Shutdown ();
+	Sys_Exit(0);
+}
+
+/*
+=================
+Sys_GetProcessorFeatures
+=================
+*/
+cpuFeatures_t Sys_GetProcessorFeatures( void )
+{
+	cpuFeatures_t features = 0;
+
+#ifndef DEDICATED
+	if( SDL_HasRDTSC( ) )    features |= CF_RDTSC;
+	if( SDL_HasMMX( ) )      features |= CF_MMX;
+	if( SDL_HasMMXExt( ) )   features |= CF_MMX_EXT;
+	if( SDL_Has3DNow( ) )    features |= CF_3DNOW;
+	if( SDL_Has3DNowExt( ) ) features |= CF_3DNOW_EXT;
+	if( SDL_HasSSE( ) )      features |= CF_SSE;
+	if( SDL_HasSSE2( ) )     features |= CF_SSE2;
+	if( SDL_HasAltiVec( ) )  features |= CF_ALTIVEC;
+#endif
+
+	return features;
+}
+
+/*
+=================
+Sys_Init
+=================
+*/
+void Sys_Init(void)
+{
+	Cmd_AddCommand( "in_restart", Sys_In_Restart_f );
+	Cvar_Set( "arch", OS_STRING " " ARCH_STRING );
+	Cvar_Set( "username", Sys_GetCurrentUser( ) );
+}
+
+static struct Q3ToAnsiColorTable_s
+{
+	char Q3color;
+	char *ANSIcolor;
+} TTY_colorTable[ ] =
+{
+	{ COLOR_BLACK,    "30" },
+	{ COLOR_RED,      "31" },
+	{ COLOR_GREEN,    "32" },
+	{ COLOR_YELLOW,   "33" },
+	{ COLOR_BLUE,     "34" },
+	{ COLOR_CYAN,     "36" },
+	{ COLOR_MAGENTA,  "35" },
+	{ COLOR_WHITE,    "0" }
+};
+
+static int TTY_colorTableSize =
+	sizeof( TTY_colorTable ) / sizeof( TTY_colorTable[ 0 ] );
+
+/*
+=================
+Sys_ANSIColorify
+
+Transform Q3 colour codes to ANSI escape sequences
+=================
+*/
+static void Sys_ANSIColorify( const char *msg, char *buffer, int bufferSize )
+{
+	int   msgLength, pos;
+	int   i, j;
+	char  *escapeCode;
+	char  tempBuffer[ 7 ];
+
+	if( !msg || !buffer )
+		return;
+
+	msgLength = strlen( msg );
+	pos = 0;
+	i = 0;
+	buffer[ 0 ] = '\0';
+
+	while( i < msgLength )
+	{
+		if( msg[ i ] == '\n' )
+		{
+			Com_sprintf( tempBuffer, 7, "%c[0m\n", 0x1B );
+			strncat( buffer, tempBuffer, bufferSize );
+			i++;
+		}
+		else if( msg[ i ] == Q_COLOR_ESCAPE )
+		{
+			i++;
+
+			if( i < msgLength )
+			{
+				escapeCode = NULL;
+				for( j = 0; j < TTY_colorTableSize; j++ )
+				{
+					if( msg[ i ] == TTY_colorTable[ j ].Q3color )
+					{
+						escapeCode = TTY_colorTable[ j ].ANSIcolor;
+						break;
+					}
+				}
+
+				if( escapeCode )
+				{
+					Com_sprintf( tempBuffer, 7, "%c[%sm", 0x1B, escapeCode );
+					strncat( buffer, tempBuffer, bufferSize );
+				}
+
+				i++;
+			}
+		}
+		else
+		{
+			Com_sprintf( tempBuffer, 7, "%c", msg[ i++ ] );
+			strncat( buffer, tempBuffer, bufferSize );
+		}
+	}
+}
+
+/*
+=================
+Sys_Print
+=================
+*/
+void Sys_Print( const char *msg )
+{
+#ifdef DEDICATED
+	TTY_Hide();
+#endif
+
+	if( Cvar_VariableIntegerValue( "com_ansicolor" ) )
+	{
+		char ansiColorString[ MAXPRINTMSG ];
+		Sys_ANSIColorify( msg, ansiColorString, MAXPRINTMSG );
+		fputs( ansiColorString, stderr );
+	}
+	else
+		fputs(msg, stderr);
+
+#ifdef DEDICATED
+	TTY_Show();
+#endif
+}
+
+/*
+=================
+Sys_Error
+=================
+*/
+void Sys_Error( const char *error, ... )
+{
+	va_list argptr;
+	char    string[1024];
+
+#ifdef DEDICATED
+	TTY_Hide();
+#endif
+
+	CL_Shutdown ();
+
+	va_start (argptr,error);
+	Q_vsnprintf (string, sizeof(string), error, argptr);
+	va_end (argptr);
+	fprintf(stderr, "Sys_Error: %s\n", string);
+
+	Sys_Exit( 1 );
+}
+
+/*
+=================
+Sys_Warn
+=================
+*/
+void Sys_Warn( char *warning, ... )
+{
+	va_list argptr;
+	char    string[1024];
+
+	va_start (argptr,warning);
+	Q_vsnprintf (string, sizeof(string), warning, argptr);
+	va_end (argptr);
+
+#ifdef DEDICATED
+	TTY_Hide();
+#endif
+
+	fprintf(stderr, "Warning: %s", string);
+
+#ifdef DEDICATED
+	TTY_Show();
+#endif
+}
+
+/*
+============
+Sys_FileTime
+
+returns -1 if not present
+============
+*/
+int Sys_FileTime( char *path )
+{
+	struct stat buf;
+
+	if (stat (path,&buf) == -1)
+		return -1;
+
+	return buf.st_mtime;
+}
+
+/*
+=================
+Sys_UnloadDll
+=================
+*/
+void Sys_UnloadDll( void *dllHandle )
+{
+	if( !dllHandle )
+	{
+		Com_Printf("Sys_UnloadDll(NULL)\n");
+		return;
+	}
+
+	Sys_UnloadLibrary(dllHandle);
+}
+
+/*
+=================
+Sys_TryLibraryLoad
+=================
+*/
+static void* Sys_TryLibraryLoad(const char* base, const char* gamedir, const char* fname, char* fqpath )
+{
+	void* libHandle;
+	char* fn;
+
+	*fqpath = 0;
+
+	fn = FS_BuildOSPath( base, gamedir, fname );
+	Com_Printf( "Sys_LoadDll(%s)... \n", fn );
+
+	libHandle = Sys_LoadLibrary(fn);
+
+	if(!libHandle) {
+		Com_Printf( "Sys_LoadDll(%s) failed:\n\"%s\"\n", fn, Sys_LibraryError() );
+		return NULL;
+	}
+
+	Com_Printf ( "Sys_LoadDll(%s): succeeded ...\n", fn );
+	Q_strncpyz ( fqpath , fn , MAX_QPATH ) ;
+
+	return libHandle;
+}
+
+/*
+=================
+Sys_LoadDll
+
+Used to load a development dll instead of a virtual machine
+#1 look down current path
+#2 look in fs_homepath
+#3 look in fs_basepath
+=================
+*/
+void *Sys_LoadDll( const char *name, char *fqpath ,
+	intptr_t (**entryPoint)(int, ...),
+	intptr_t (*systemcalls)(intptr_t, ...) )
+{
+	void  *libHandle;
+	void  (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
+	char  curpath[MAX_OSPATH];
+	char  fname[MAX_OSPATH];
+	char  *basepath;
+	char  *homepath;
+	char  *pwdpath;
+	char  *gamedir;
+
+	assert( name );
+
+	getcwd(curpath, sizeof(curpath));
+	snprintf (fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name);
+
+	// TODO: use fs_searchpaths from files.c
+	pwdpath = Sys_Cwd();
+	basepath = Cvar_VariableString( "fs_basepath" );
+	homepath = Cvar_VariableString( "fs_homepath" );
+	gamedir = Cvar_VariableString( "fs_game" );
+
+	libHandle = Sys_TryLibraryLoad(pwdpath, gamedir, fname, fqpath);
+
+	if(!libHandle && homepath)
+		libHandle = Sys_TryLibraryLoad(homepath, gamedir, fname, fqpath);
+
+	if(!libHandle && basepath)
+		libHandle = Sys_TryLibraryLoad(basepath, gamedir, fname, fqpath);
+
+	if(!libHandle) {
+		Com_Printf ( "Sys_LoadDll(%s) failed to load library\n", name );
+		return NULL;
+	}
+
+	dllEntry = Sys_LoadFunction( libHandle, "dllEntry" );
+	*entryPoint = Sys_LoadFunction( libHandle, "vmMain" );
+
+	if ( !*entryPoint || !dllEntry )
+	{
+		Com_Printf ( "Sys_LoadDll(%s) failed to find vmMain function:\n\"%s\" !\n", name, Sys_LibraryError( ) );
+		Sys_UnloadLibrary(libHandle);
+
+		return NULL;
+	}
+
+	Com_Printf ( "Sys_LoadDll(%s) found vmMain function at %p\n", name, *entryPoint );
+	dllEntry( systemcalls );
+
+	return libHandle;
+}
+
+/*
+========================================================================
+
+EVENT LOOP
+
+========================================================================
+*/
+
+#define MAX_QUED_EVENTS  256
+#define MASK_QUED_EVENTS ( MAX_QUED_EVENTS - 1 )
+
+sysEvent_t  eventQue[ MAX_QUED_EVENTS ];
+int         eventHead = 0;
+int         eventTail = 0;
+byte        sys_packetReceived[ MAX_MSGLEN ];
+
+/*
+================
+Sys_QueEvent
+
+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 Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr )
+{
+	sysEvent_t  *ev;
+
+	ev = &eventQue[ eventHead & MASK_QUED_EVENTS ];
+
+	if ( eventHead - eventTail >= MAX_QUED_EVENTS )
+	{
+		Com_Printf("Sys_QueEvent: 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;
+}
+
+/*
+================
+Sys_GetEvent
+
+================
+*/
+sysEvent_t Sys_GetEvent( void )
+{
+	sysEvent_t  ev;
+	char        *s;
+	msg_t       netmsg;
+	netadr_t    adr;
+
+	// return if we have data
+	if ( eventHead > eventTail )
+	{
+		eventTail++;
+		return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
+	}
+
+	// pump the message loop
+	// in vga this calls KBD_Update, under X, it calls GetEvent
+	Sys_SendKeyEvents ();
+
+	// check for console commands
+	s = Sys_ConsoleInput();
+	if ( s )
+	{
+		char  *b;
+		int   len;
+
+		len = strlen( s ) + 1;
+		b = Z_Malloc( len );
+		strcpy( b, s );
+		Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b );
+	}
+
+	// check for other input devices
+	IN_Frame();
+
+	// 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 );
+		Sys_QueEvent( 0, SE_PACKET, 0, 0, len, buf );
+	}
+
+	// return if we have data
+	if ( eventHead > eventTail )
+	{
+		eventTail++;
+		return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
+	}
+
+	// create an empty event to return
+
+	memset( &ev, 0, sizeof( ev ) );
+	ev.evTime = Sys_Milliseconds();
+
+	return ev;
+}
+
+/*
+=================
+Sys_ParseArgs
+=================
+*/
+void Sys_ParseArgs( int argc, char **argv )
+{
+	if( argc == 2 )
+	{
+		if( !strcmp( argv[1], "--version" ) ||
+				!strcmp( argv[1], "-v" ) )
+		{
+			const char* date = __DATE__;
+#ifdef DEDICATED
+			fprintf( stdout, Q3_VERSION " dedicated server (%s)\n", date );
+#else
+			fprintf( stdout, Q3_VERSION " client (%s)\n", date );
+#endif
+			Sys_Exit(0);
+		}
+	}
+}
+
+#ifndef DEFAULT_BASEDIR
+# ifdef MACOS_X
+/*
+=================
+Sys_EscapeAppBundle
+
+Discovers if passed dir is suffixed with the directory structure of a Mac OS X
+.app bundle. If it is, the .app directory structure is stripped off the end and
+the result is returned. If not, dir is returned untouched.
+=================
+*/
+char *Sys_StripAppBundle( char *dir )
+{
+	static char cwd[MAX_OSPATH];
+
+	Q_strncpyz(cwd, dir, sizeof(cwd));
+	if(strcmp(basename(cwd), "MacOS"))
+		return dir;
+	Q_strncpyz(cwd, dirname(cwd), sizeof(cwd));
+	if(strcmp(basename(cwd), "Contents"))
+		return dir;
+	Q_strncpyz(cwd, dirname(cwd), sizeof(cwd));
+	if(!strstr(basename(cwd), ".app"))
+		return dir;
+	Q_strncpyz(cwd, dirname(cwd), sizeof(cwd));
+	return cwd;
+}
+		// if run from an .app bundle, we want to also search its containing dir
+#		define DEFAULT_BASEDIR Sys_StripAppBundle(Sys_BinaryPath())
+#	else
+#		define DEFAULT_BASEDIR Sys_BinaryPath()
+#	endif
+#endif
+
+/*
+=================
+Sys_SigHandler
+=================
+*/
+static void Sys_SigHandler( int signal )
+{
+	static qboolean signalcaught = qfalse;
+
+	if( signalcaught )
+	{
+		printf( "DOUBLE SIGNAL FAULT: Received signal %d, exiting...\n", signal );
+	}
+	else
+	{
+		signalcaught = qtrue;
+		printf( "Received signal %d, exiting...\n", signal );
+#ifndef DEDICATED
+		CL_Shutdown();
+#endif
+		SV_Shutdown( "Signal caught" );
+	}
+
+	Sys_Exit( 0 ); // Exit with 0 to avoid recursive signals
+}
+
+/*
+=================
+main
+=================
+*/
+int main( int argc, char **argv )
+{
+	int   i;
+	char  commandLine[ MAX_STRING_CHARS ] = { 0 };
+
+	Sys_ParseArgs( argc, argv );
+	Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) );
+	Sys_SetDefaultInstallPath( DEFAULT_BASEDIR );
+
+	// Concatenate the command line for passing to Com_Init
+	for( i = 1; i < argc; i++ )
+	{
+		Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] );
+		Q_strcat( commandLine, sizeof( commandLine ), " " );
+	}
+
+	// Clear queues
+	memset( &eventQue[ 0 ], 0, MAX_QUED_EVENTS * sizeof( sysEvent_t ) );
+	memset( &sys_packetReceived[ 0 ], 0, MAX_MSGLEN * sizeof( byte ) );
+
+	Com_Init( commandLine );
+	NET_Init();
+
+	Sys_ConsoleInputInit();
+
+#ifndef _WIN32
+	// Windows doesn't have these signals
+	signal( SIGHUP, Sys_SigHandler );
+	signal( SIGQUIT, Sys_SigHandler );
+	signal( SIGTRAP, Sys_SigHandler );
+	signal( SIGIOT, Sys_SigHandler );
+	signal( SIGBUS, Sys_SigHandler );
+#endif
+
+	signal( SIGILL, Sys_SigHandler );
+	signal( SIGFPE, Sys_SigHandler );
+	signal( SIGSEGV, Sys_SigHandler );
+	signal( SIGTERM, Sys_SigHandler );
+
+	Cvar_Get( "com_ansicolor", "0", CVAR_ARCHIVE );
+
+	while( 1 )
+	{
+#ifndef DEDICATED
+		int appState = SDL_GetAppState( );
+
+		// If we have no input focus at all, sleep a bit
+		if( !( appState & ( SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS ) ) )
+			SDL_Delay( 16 );
+
+		// If we're minimised, sleep a bit more
+		if( !( appState & SDL_APPACTIVE ) )
+			SDL_Delay( 32 );
+#endif
+
+		Com_Frame( );
+	}
+
+	return 0;
+}
+

Copied: branches/unified-sdl/code/sys/sys_unix.c (from rev 1143, branches/unified-sdl/code/unix/unix_shared.c)
===================================================================
--- branches/unified-sdl/code/sys/sys_unix.c	                        (rev 0)
+++ branches/unified-sdl/code/sys/sys_unix.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,417 @@
+/*
+===========================================================================
+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 <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <pwd.h>
+#include <libgen.h>
+
+#include "../qcommon/q_shared.h"
+#include "../qcommon/qcommon.h"
+
+// Used to determine where to store user-specific files
+static char homePath[MAX_OSPATH];
+
+/*
+================
+Sys_Milliseconds
+================
+*/
+/* base time in seconds, that's our origin
+   timeval:tv_sec is an int:
+   assuming this wraps every 0x7fffffff - ~68 years since the Epoch (1970) - we're safe till 2038
+   using unsigned long data type to work right with Sys_XTimeToSysTime */
+unsigned long sys_timeBase = 0;
+/* current time in ms, using sys_timeBase as origin
+   NOTE: sys_timeBase*1000 + curtime -> ms since the Epoch
+     0x7fffffff ms - ~24 days
+   although timeval:tv_usec is an int, I'm not sure wether it is actually used as an unsigned int
+     (which would affect the wrap period) */
+int curtime;
+int Sys_Milliseconds (void)
+{
+	struct timeval tp;
+
+	gettimeofday(&tp, NULL);
+
+	if (!sys_timeBase)
+	{
+		sys_timeBase = tp.tv_sec;
+		return tp.tv_usec/1000;
+	}
+
+	curtime = (tp.tv_sec - sys_timeBase)*1000 + tp.tv_usec/1000;
+
+	return curtime;
+}
+
+#if !id386
+/*
+==================
+fastftol
+==================
+*/
+long fastftol( float f )
+{
+	return (long)f;
+}
+
+/*
+==================
+Sys_SnapVector
+==================
+*/
+void Sys_SnapVector( float *v )
+{
+	v[0] = rint(v[0]);
+	v[1] = rint(v[1]);
+	v[2] = rint(v[2]);
+}
+#endif
+
+
+/*
+==================
+Sys_RandomBytes
+==================
+*/
+qboolean Sys_RandomBytes( byte *string, int len )
+{
+	FILE *fp;
+
+	fp = fopen( "/dev/urandom", "r" );
+	if( !fp )
+		return qfalse;
+
+	if( !fread( string, sizeof( byte ), len, fp ) )
+	{
+		fclose( fp );
+		return qfalse;
+	}
+
+	fclose( fp );
+	return qtrue;
+}
+
+/*
+==================
+Sys_GetCurrentUser
+==================
+*/
+char *Sys_GetCurrentUser( void )
+{
+	struct passwd *p;
+
+	if ( (p = getpwuid( getuid() )) == NULL ) {
+		return "player";
+	}
+	return p->pw_name;
+}
+
+/*
+==================
+Sys_DefaultHomePath
+==================
+*/
+char *Sys_DefaultHomePath(void)
+{
+	char *p;
+
+	if (*homePath)
+		return homePath;
+
+	if ((p = getenv("HOME")) != NULL) {
+		Q_strncpyz(homePath, p, sizeof(homePath));
+#ifdef MACOS_X
+		Q_strcat(homePath, sizeof(homePath), "/Library/Application Support/Quake3");
+#else
+		Q_strcat(homePath, sizeof(homePath), "/.q3a");
+#endif
+		if (mkdir(homePath, 0777)) {
+			if (errno != EEXIST)
+				Sys_Error("Unable to create directory \"%s\", error is %s(%d)\n", homePath, strerror(errno), errno);
+		}
+		return homePath;
+	}
+	return ""; // assume current dir
+}
+
+/*
+==================
+Sys_ShowConsole
+==================
+*/
+void Sys_ShowConsole( int visLevel, qboolean quitOnClose )
+{
+}
+
+/*
+==================
+Sys_GetClipboardData
+==================
+*/
+char *Sys_GetClipboardData(void)
+{
+	return NULL;
+}
+
+#define MEM_THRESHOLD 96*1024*1024
+
+/*
+==================
+Sys_LowPhysicalMemory
+
+TODO
+==================
+*/
+qboolean Sys_LowPhysicalMemory( void )
+{
+	return qfalse;
+}
+
+/*
+==================
+Sys_Dirname
+==================
+*/
+const char *Sys_Dirname( char *path )
+{
+	return dirname( path );
+}
+
+/*
+==================
+Sys_Mkdir
+==================
+*/
+void Sys_Mkdir( const char *path )
+{
+	mkdir( path, 0777 );
+}
+
+/*
+==================
+Sys_Cwd
+==================
+*/
+char *Sys_Cwd( void )
+{
+	static char cwd[MAX_OSPATH];
+
+	getcwd( cwd, sizeof( cwd ) - 1 );
+	cwd[MAX_OSPATH-1] = 0;
+
+	return cwd;
+}
+
+/*
+==============================================================
+
+DIRECTORY SCANNING
+
+==============================================================
+*/
+
+#define MAX_FOUND_FILES 0x1000
+
+/*
+==================
+Sys_ListFilteredFiles
+==================
+*/
+void Sys_ListFilteredFiles( const char *basedir, char *subdirs, char *filter, char **list, int *numfiles )
+{
+	char          search[MAX_OSPATH], newsubdirs[MAX_OSPATH];
+	char          filename[MAX_OSPATH];
+	DIR           *fdir;
+	struct dirent *d;
+	struct stat   st;
+
+	if ( *numfiles >= MAX_FOUND_FILES - 1 ) {
+		return;
+	}
+
+	if (strlen(subdirs)) {
+		Com_sprintf( search, sizeof(search), "%s/%s", basedir, subdirs );
+	}
+	else {
+		Com_sprintf( search, sizeof(search), "%s", basedir );
+	}
+
+	if ((fdir = opendir(search)) == NULL) {
+		return;
+	}
+
+	while ((d = readdir(fdir)) != NULL) {
+		Com_sprintf(filename, sizeof(filename), "%s/%s", search, d->d_name);
+		if (stat(filename, &st) == -1)
+			continue;
+
+		if (st.st_mode & S_IFDIR) {
+			if (Q_stricmp(d->d_name, ".") && Q_stricmp(d->d_name, "..")) {
+				if (strlen(subdirs)) {
+					Com_sprintf( newsubdirs, sizeof(newsubdirs), "%s/%s", subdirs, d->d_name);
+				}
+				else {
+					Com_sprintf( newsubdirs, sizeof(newsubdirs), "%s", d->d_name);
+				}
+				Sys_ListFilteredFiles( basedir, newsubdirs, filter, list, numfiles );
+			}
+		}
+		if ( *numfiles >= MAX_FOUND_FILES - 1 ) {
+			break;
+		}
+		Com_sprintf( filename, sizeof(filename), "%s/%s", subdirs, d->d_name );
+		if (!Com_FilterPath( filter, filename, qfalse ))
+			continue;
+		list[ *numfiles ] = CopyString( filename );
+		(*numfiles)++;
+	}
+
+	closedir(fdir);
+}
+
+/*
+==================
+Sys_ListFiles
+==================
+*/
+char **Sys_ListFiles( const char *directory, const char *extension, char *filter, int *numfiles, qboolean wantsubs )
+{
+	struct dirent *d;
+	DIR           *fdir;
+	qboolean      dironly = wantsubs;
+	char          search[MAX_OSPATH];
+	int           nfiles;
+	char          **listCopy;
+	char          *list[MAX_FOUND_FILES];
+	int           i;
+	struct stat   st;
+
+	int           extLen;
+
+	if (filter) {
+
+		nfiles = 0;
+		Sys_ListFilteredFiles( directory, "", filter, list, &nfiles );
+
+		list[ nfiles ] = NULL;
+		*numfiles = nfiles;
+
+		if (!nfiles)
+			return NULL;
+
+		listCopy = Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ) );
+		for ( i = 0 ; i < nfiles ; i++ ) {
+			listCopy[i] = list[i];
+		}
+		listCopy[i] = NULL;
+
+		return listCopy;
+	}
+
+	if ( !extension)
+		extension = "";
+
+	if ( extension[0] == '/' && extension[1] == 0 ) {
+		extension = "";
+		dironly = qtrue;
+	}
+
+	extLen = strlen( extension );
+	
+	// search
+	nfiles = 0;
+
+	if ((fdir = opendir(directory)) == NULL) {
+		*numfiles = 0;
+		return NULL;
+	}
+
+	while ((d = readdir(fdir)) != NULL) {
+		Com_sprintf(search, sizeof(search), "%s/%s", directory, d->d_name);
+		if (stat(search, &st) == -1)
+			continue;
+		if ((dironly && !(st.st_mode & S_IFDIR)) ||
+			(!dironly && (st.st_mode & S_IFDIR)))
+			continue;
+
+		if (*extension) {
+			if ( strlen( d->d_name ) < strlen( extension ) ||
+				Q_stricmp(
+					d->d_name + strlen( d->d_name ) - strlen( extension ),
+					extension ) ) {
+				continue; // didn't match
+			}
+		}
+
+		if ( nfiles == MAX_FOUND_FILES - 1 )
+			break;
+		list[ nfiles ] = CopyString( d->d_name );
+		nfiles++;
+	}
+
+	list[ nfiles ] = NULL;
+
+	closedir(fdir);
+
+	// return a copy of the list
+	*numfiles = nfiles;
+
+	if ( !nfiles ) {
+		return NULL;
+	}
+
+	listCopy = Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ) );
+	for ( i = 0 ; i < nfiles ; i++ ) {
+		listCopy[i] = list[i];
+	}
+	listCopy[i] = NULL;
+
+	return listCopy;
+}
+
+/*
+==================
+Sys_FreeFileList
+==================
+*/
+void Sys_FreeFileList( char **list )
+{
+	int i;
+
+	if ( !list ) {
+		return;
+	}
+
+	for ( i = 0 ; list[i] ; i++ ) {
+		Z_Free( list[i] );
+	}
+
+	Z_Free( list );
+}
+

Copied: branches/unified-sdl/code/sys/sys_win32.c (from rev 1143, branches/unified-sdl/code/win32/win_shared.c)
===================================================================
--- branches/unified-sdl/code/sys/sys_win32.c	                        (rev 0)
+++ branches/unified-sdl/code/sys/sys_win32.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,482 @@
+/*
+===========================================================================
+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 "../qcommon/q_shared.h"
+#include "../qcommon/qcommon.h"
+#include "sys_local.h"
+
+#include <windows.h>
+#include <lmerr.h>
+#include <lmcons.h>
+#include <lmwksta.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <direct.h>
+#include <io.h>
+#include <conio.h>
+#include <wincrypt.h>
+#include <shlobj.h>
+
+/*
+================
+Sys_Milliseconds
+================
+*/
+int sys_timeBase;
+int Sys_Milliseconds (void)
+{
+	int             sys_curtime;
+	static qboolean initialized = qfalse;
+
+	if (!initialized) {
+		sys_timeBase = timeGetTime();
+		initialized = qtrue;
+	}
+	sys_curtime = timeGetTime() - sys_timeBase;
+
+	return sys_curtime;
+}
+
+#ifndef __GNUC__ //see snapvectora.s
+/*
+================
+Sys_SnapVector
+================
+*/
+void Sys_SnapVector( float *v )
+{
+	int i;
+	float f;
+
+	f = *v;
+	__asm	fld		f;
+	__asm	fistp	i;
+	*v = i;
+	v++;
+	f = *v;
+	__asm	fld		f;
+	__asm	fistp	i;
+	*v = i;
+	v++;
+	f = *v;
+	__asm	fld		f;
+	__asm	fistp	i;
+	*v = i;
+}
+#endif
+
+/*
+================
+Sys_RandomBytes
+================
+*/
+qboolean Sys_RandomBytes( byte *string, int len )
+{
+	HCRYPTPROV  prov;
+
+	if( !CryptAcquireContext( &prov, NULL, NULL,
+		PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) )  {
+
+		return qfalse;
+	}
+
+	if( !CryptGenRandom( prov, len, (BYTE *)string ) )  {
+		CryptReleaseContext( prov, 0 );
+		return qfalse;
+	}
+	CryptReleaseContext( prov, 0 );
+	return qtrue;
+}
+
+/*
+================
+Sys_GetCurrentUser
+================
+*/
+char *Sys_GetCurrentUser( void )
+{
+	static char s_userName[1024];
+	unsigned long size = sizeof( s_userName );
+
+	if( !GetUserName( s_userName, &size ) )
+		strcpy( s_userName, "player" );
+
+	if( !s_userName[0] )
+	{
+		strcpy( s_userName, "player" );
+	}
+
+	return s_userName;
+}
+
+/*
+================
+Sys_DefaultHomePath
+================
+*/
+char *Sys_DefaultHomePath( void )
+{
+	TCHAR szPath[MAX_PATH];
+	static char path[MAX_OSPATH];
+	FARPROC qSHGetFolderPath;
+	HMODULE shfolder = LoadLibrary("shfolder.dll");
+	
+	if(shfolder == NULL) {
+		Com_Printf("Unable to load SHFolder.dll\n");
+		return NULL;
+	}
+
+	qSHGetFolderPath = GetProcAddress(shfolder, "SHGetFolderPathA");
+	if(qSHGetFolderPath == NULL)
+	{
+		Com_Printf("Unable to find SHGetFolderPath in SHFolder.dll\n");
+		FreeLibrary(shfolder);
+		return NULL;
+	}
+
+	if( !SUCCEEDED( qSHGetFolderPath( NULL, CSIDL_APPDATA,
+		NULL, 0, szPath ) ) )
+	{
+		Com_Printf("Unable to detect CSIDL_APPDATA\n");
+		FreeLibrary(shfolder);
+		return NULL;
+	}
+	Q_strncpyz( path, szPath, sizeof(path) );
+	Q_strcat( path, sizeof(path), "\\Quake3" );
+	FreeLibrary(shfolder);
+	if( !CreateDirectory( path, NULL ) )
+	{
+		if( GetLastError() != ERROR_ALREADY_EXISTS )
+		{
+			Com_Printf("Unable to create directory \"%s\"\n", path);
+			return NULL;
+		}
+	}
+	return path;
+}
+
+/*
+================
+Sys_ShowConsole
+================
+*/
+void Sys_ShowConsole( int visLevel, qboolean quitOnClose )
+{
+}
+
+/*
+================
+Sys_GetClipboardData
+================
+*/
+char *Sys_GetClipboardData( void )
+{
+	char *data = NULL;
+	char *cliptext;
+
+	if ( OpenClipboard( NULL ) != 0 ) {
+		HANDLE hClipboardData;
+
+		if ( ( hClipboardData = GetClipboardData( CF_TEXT ) ) != 0 ) {
+			if ( ( cliptext = GlobalLock( hClipboardData ) ) != 0 ) {
+				data = Z_Malloc( GlobalSize( hClipboardData ) + 1 );
+				Q_strncpyz( data, cliptext, GlobalSize( hClipboardData ) );
+				GlobalUnlock( hClipboardData );
+				
+				strtok( data, "\n\r\b" );
+			}
+		}
+		CloseClipboard();
+	}
+	return data;
+}
+
+#define MEM_THRESHOLD 96*1024*1024
+
+/*
+==================
+Sys_LowPhysicalMemory
+==================
+*/
+qboolean Sys_LowPhysicalMemory( void )
+{
+	MEMORYSTATUS stat;
+	GlobalMemoryStatus (&stat);
+	return (stat.dwTotalPhys <= MEM_THRESHOLD) ? qtrue : qfalse;
+}
+
+/*
+==============
+Sys_Dirname
+==============
+*/
+const char *Sys_Dirname( char *path )
+{
+	static char dir[ MAX_OSPATH ] = { 0 };
+	int length;
+
+	Q_strncpyz( dir, path, sizeof( dir ) );
+	length = strlen( dir ) - 1;
+
+	while( length > 0 && dir[ length ] != '\\' )
+		length--;
+
+	dir[ length ] = '\0';
+
+	return dir;
+}
+
+/*
+==============
+Sys_Mkdir
+==============
+*/
+void Sys_Mkdir( const char *path )
+{
+	_mkdir (path);
+}
+
+/*
+==============
+Sys_Cwd
+==============
+*/
+char *Sys_Cwd( void ) {
+	static char cwd[MAX_OSPATH];
+
+	_getcwd( cwd, sizeof( cwd ) - 1 );
+	cwd[MAX_OSPATH-1] = 0;
+
+	return cwd;
+}
+
+/*
+==============================================================
+
+DIRECTORY SCANNING
+
+==============================================================
+*/
+
+#define MAX_FOUND_FILES 0x1000
+
+/*
+==============
+Sys_ListFilteredFiles
+==============
+*/
+void Sys_ListFilteredFiles( const char *basedir, char *subdirs, char *filter, char **list, int *numfiles )
+{
+	char		search[MAX_OSPATH], newsubdirs[MAX_OSPATH];
+	char		filename[MAX_OSPATH];
+	int			findhandle;
+	struct _finddata_t findinfo;
+
+	if ( *numfiles >= MAX_FOUND_FILES - 1 ) {
+		return;
+	}
+
+	if (strlen(subdirs)) {
+		Com_sprintf( search, sizeof(search), "%s\\%s\\*", basedir, subdirs );
+	}
+	else {
+		Com_sprintf( search, sizeof(search), "%s\\*", basedir );
+	}
+
+	findhandle = _findfirst (search, &findinfo);
+	if (findhandle == -1) {
+		return;
+	}
+
+	do {
+		if (findinfo.attrib & _A_SUBDIR) {
+			if (Q_stricmp(findinfo.name, ".") && Q_stricmp(findinfo.name, "..")) {
+				if (strlen(subdirs)) {
+					Com_sprintf( newsubdirs, sizeof(newsubdirs), "%s\\%s", subdirs, findinfo.name);
+				}
+				else {
+					Com_sprintf( newsubdirs, sizeof(newsubdirs), "%s", findinfo.name);
+				}
+				Sys_ListFilteredFiles( basedir, newsubdirs, filter, list, numfiles );
+			}
+		}
+		if ( *numfiles >= MAX_FOUND_FILES - 1 ) {
+			break;
+		}
+		Com_sprintf( filename, sizeof(filename), "%s\\%s", subdirs, findinfo.name );
+		if (!Com_FilterPath( filter, filename, qfalse ))
+			continue;
+		list[ *numfiles ] = CopyString( filename );
+		(*numfiles)++;
+	} while ( _findnext (findhandle, &findinfo) != -1 );
+
+	_findclose (findhandle);
+}
+
+/*
+==============
+strgtr
+==============
+*/
+static qboolean strgtr(const char *s0, const char *s1)
+{
+	int l0, l1, i;
+
+	l0 = strlen(s0);
+	l1 = strlen(s1);
+
+	if (l1<l0) {
+		l0 = l1;
+	}
+
+	for(i=0;i<l0;i++) {
+		if (s1[i] > s0[i]) {
+			return qtrue;
+		}
+		if (s1[i] < s0[i]) {
+			return qfalse;
+		}
+	}
+	return qfalse;
+}
+
+/*
+==============
+Sys_ListFiles
+==============
+*/
+char **Sys_ListFiles( const char *directory, const char *extension, char *filter, int *numfiles, qboolean wantsubs )
+{
+	char		search[MAX_OSPATH];
+	int			nfiles;
+	char		**listCopy;
+	char		*list[MAX_FOUND_FILES];
+	struct _finddata_t findinfo;
+	int			findhandle;
+	int			flag;
+	int			i;
+
+	if (filter) {
+
+		nfiles = 0;
+		Sys_ListFilteredFiles( directory, "", filter, list, &nfiles );
+
+		list[ nfiles ] = 0;
+		*numfiles = nfiles;
+
+		if (!nfiles)
+			return NULL;
+
+		listCopy = Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ) );
+		for ( i = 0 ; i < nfiles ; i++ ) {
+			listCopy[i] = list[i];
+		}
+		listCopy[i] = NULL;
+
+		return listCopy;
+	}
+
+	if ( !extension) {
+		extension = "";
+	}
+
+	// passing a slash as extension will find directories
+	if ( extension[0] == '/' && extension[1] == 0 ) {
+		extension = "";
+		flag = 0;
+	} else {
+		flag = _A_SUBDIR;
+	}
+
+	Com_sprintf( search, sizeof(search), "%s\\*%s", directory, extension );
+
+	// search
+	nfiles = 0;
+
+	findhandle = _findfirst (search, &findinfo);
+	if (findhandle == -1) {
+		*numfiles = 0;
+		return NULL;
+	}
+
+	do {
+		if ( (!wantsubs && flag ^ ( findinfo.attrib & _A_SUBDIR )) || (wantsubs && findinfo.attrib & _A_SUBDIR) ) {
+			if ( nfiles == MAX_FOUND_FILES - 1 ) {
+				break;
+			}
+			list[ nfiles ] = CopyString( findinfo.name );
+			nfiles++;
+		}
+	} while ( _findnext (findhandle, &findinfo) != -1 );
+
+	list[ nfiles ] = 0;
+
+	_findclose (findhandle);
+
+	// return a copy of the list
+	*numfiles = nfiles;
+
+	if ( !nfiles ) {
+		return NULL;
+	}
+
+	listCopy = Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ) );
+	for ( i = 0 ; i < nfiles ; i++ ) {
+		listCopy[i] = list[i];
+	}
+	listCopy[i] = NULL;
+
+	do {
+		flag = 0;
+		for(i=1; i<nfiles; i++) {
+			if (strgtr(listCopy[i-1], listCopy[i])) {
+				char *temp = listCopy[i];
+				listCopy[i] = listCopy[i-1];
+				listCopy[i-1] = temp;
+				flag = 1;
+			}
+		}
+	} while(flag);
+
+	return listCopy;
+}
+
+/*
+==============
+Sys_FreeFileList
+==============
+*/
+void Sys_FreeFileList( char **list )
+{
+	int i;
+
+	if ( !list ) {
+		return;
+	}
+
+	for ( i = 0 ; list[i] ; i++ ) {
+		Z_Free( list[i] );
+	}
+
+	Z_Free( list );
+}

Added: branches/unified-sdl/code/sys/tty_console.c
===================================================================
--- branches/unified-sdl/code/sys/tty_console.c	                        (rev 0)
+++ branches/unified-sdl/code/sys/tty_console.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,440 @@
+/*
+===========================================================================
+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 "../qcommon/q_shared.h"
+#include "../qcommon/qcommon.h"
+
+#include <unistd.h>
+#include <signal.h>
+#include <termios.h>
+#include <fcntl.h>
+
+/*
+=============================================================
+tty console routines
+
+NOTE: if the user is editing a line when something gets printed to the early
+console then it won't look good so we provide TTY_Hide and TTY_Show to be
+called before and after a stdout or stderr output
+=============================================================
+*/
+
+// general flag to tell about tty console mode
+static qboolean ttycon_on = qfalse;
+static int ttycon_hide = 0;
+
+// some key codes that the terminal may be using, initialised on start up
+static int TTY_erase;
+static int TTY_eof;
+
+static struct termios TTY_tc;
+
+static field_t TTY_con;
+
+// This is somewhat of aduplicate of the graphical console history
+// but it's safer more modular to have our own here
+#define TTY_HISTORY 32
+static field_t ttyEditLines[ TTY_HISTORY ];
+static int hist_current = -1, hist_count = 0;
+
+/*
+==================
+TTY_FlushIn
+
+Flush stdin, I suspect some terminals are sending a LOT of shit
+FIXME relevant?
+==================
+*/
+static void TTY_FlushIn( void )
+{
+	char key;
+	while (read(0, &key, 1)!=-1);
+}
+
+/*
+==================
+TTY_Back
+
+Output a backspace
+
+NOTE: it seems on some terminals just sending '\b' is not enough so instead we
+send "\b \b"
+(FIXME there may be a way to find out if '\b' alone would work though)
+==================
+*/
+static void TTY_Back( void )
+{
+	char key;
+	key = '\b';
+	write(1, &key, 1);
+	key = ' ';
+	write(1, &key, 1);
+	key = '\b';
+	write(1, &key, 1);
+}
+
+/*
+==================
+TTY_Hide
+
+Clear the display of the line currently edited
+bring cursor back to beginning of line
+==================
+*/
+void TTY_Hide( void )
+{
+	if( ttycon_on )
+	{
+		int i;
+		if (ttycon_hide)
+		{
+			ttycon_hide++;
+			return;
+		}
+		if (TTY_con.cursor>0)
+		{
+			for (i=0; i<TTY_con.cursor; i++)
+			{
+				TTY_Back();
+			}
+		}
+		TTY_Back(); // Delete "]"
+		ttycon_hide++;
+	}
+}
+
+/*
+==================
+TTY_Show
+
+Show the current line
+FIXME need to position the cursor if needed?
+==================
+*/
+void TTY_Show( void )
+{
+	if( ttycon_on )
+	{
+		int i;
+
+		assert(ttycon_hide>0);
+		ttycon_hide--;
+		if (ttycon_hide == 0)
+		{
+			write( 1, "]", 1 );
+			if (TTY_con.cursor)
+			{
+				for (i=0; i<TTY_con.cursor; i++)
+				{
+					write(1, TTY_con.buffer+i, 1);
+				}
+			}
+		}
+	}
+}
+
+/*
+==================
+TTY_Shutdown
+
+Never exit without calling this, or your terminal will be left in a pretty bad state
+==================
+*/
+void TTY_Shutdown( void )
+{
+	if (ttycon_on)
+	{
+		TTY_Back(); // Delete "]"
+		tcsetattr (0, TCSADRAIN, &TTY_tc);
+
+		// Restore blocking to stdin reads
+		fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) & ~O_NDELAY );
+	}
+}
+
+/*
+==================
+Hist_Add
+==================
+*/
+void Hist_Add(field_t *field)
+{
+	int i;
+	assert(hist_count <= TTY_HISTORY);
+	assert(hist_count >= 0);
+	assert(hist_current >= -1);
+	assert(hist_current <= hist_count);
+	// make some room
+	for (i=TTY_HISTORY-1; i>0; i--)
+	{
+		ttyEditLines[i] = ttyEditLines[i-1];
+	}
+	ttyEditLines[0] = *field;
+	if (hist_count<TTY_HISTORY)
+	{
+		hist_count++;
+	}
+	hist_current = -1; // re-init
+}
+
+/*
+==================
+Hist_Prev
+==================
+*/
+field_t *Hist_Prev( void )
+{
+	int hist_prev;
+	assert(hist_count <= TTY_HISTORY);
+	assert(hist_count >= 0);
+	assert(hist_current >= -1);
+	assert(hist_current <= hist_count);
+	hist_prev = hist_current + 1;
+	if (hist_prev >= hist_count)
+	{
+		return NULL;
+	}
+	hist_current++;
+	return &(ttyEditLines[hist_current]);
+}
+
+/*
+==================
+Hist_Next
+==================
+*/
+field_t *Hist_Next( void )
+{
+	assert(hist_count <= TTY_HISTORY);
+	assert(hist_count >= 0);
+	assert(hist_current >= -1);
+	assert(hist_current <= hist_count);
+	if (hist_current >= 0)
+	{
+		hist_current--;
+	}
+	if (hist_current == -1)
+	{
+		return NULL;
+	}
+	return &(ttyEditLines[hist_current]);
+}
+
+/*
+==================
+TTY_Init
+
+Initialize the console input (tty mode if possible)
+==================
+*/
+void TTY_Init( void )
+{
+	struct termios tc;
+
+	// If the process is backgrounded (running non interactively)
+	// then SIGTTIN or SIGTOU is emitted, if not caught, turns into a SIGSTP
+	signal(SIGTTIN, SIG_IGN);
+	signal(SIGTTOU, SIG_IGN);
+
+	// Make stdin reads non-blocking
+	fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | O_NDELAY );
+
+	if (isatty(STDIN_FILENO)!=1)
+	{
+		Com_Printf( "stdin is not a tty, tty console mode disabled\n");
+		ttycon_on = qfalse;
+		return;
+	}
+
+	Field_Clear(&TTY_con);
+	tcgetattr (0, &TTY_tc);
+	TTY_erase = TTY_tc.c_cc[VERASE];
+	TTY_eof = TTY_tc.c_cc[VEOF];
+	tc = TTY_tc;
+
+	/*
+	ECHO: don't echo input characters
+	ICANON: enable canonical mode.  This  enables  the  special
+	characters  EOF,  EOL,  EOL2, ERASE, KILL, REPRINT,
+	STATUS, and WERASE, and buffers by lines.
+	ISIG: when any of the characters  INTR,  QUIT,  SUSP,  or
+	DSUSP are received, generate the corresponding sig­
+	nal
+	*/
+	tc.c_lflag &= ~(ECHO | ICANON);
+
+	/*
+	ISTRIP strip off bit 8
+	INPCK enable input parity checking
+	*/
+	tc.c_iflag &= ~(ISTRIP | INPCK);
+	tc.c_cc[VMIN] = 1;
+	tc.c_cc[VTIME] = 0;
+	tcsetattr (0, TCSADRAIN, &tc);
+	ttycon_on = qtrue;
+}
+
+/*
+==================
+TTY_ConsoleInput
+==================
+*/
+char *TTY_ConsoleInput( void )
+{
+	// we use this when sending back commands
+	static char text[256];
+	int avail;
+	char key;
+	field_t *history;
+
+	if( ttycon_on )
+	{
+		avail = read(0, &key, 1);
+		if (avail != -1)
+		{
+			// we have something
+			// backspace?
+			// NOTE TTimo testing a lot of values .. seems it's the only way to get it to work everywhere
+			if ((key == TTY_erase) || (key == 127) || (key == 8))
+			{
+				if (TTY_con.cursor > 0)
+				{
+					TTY_con.cursor--;
+					TTY_con.buffer[TTY_con.cursor] = '\0';
+					TTY_Back();
+				}
+				return NULL;
+			}
+			// check if this is a control char
+			if ((key) && (key) < ' ')
+			{
+				if (key == '\n')
+				{
+					// push it in history
+					Hist_Add(&TTY_con);
+					strcpy(text, TTY_con.buffer);
+					Field_Clear(&TTY_con);
+					key = '\n';
+					write(1, &key, 1);
+					write( 1, "]", 1 );
+					return text;
+				}
+				if (key == '\t')
+				{
+					TTY_Hide();
+					Field_AutoComplete( &TTY_con );
+					TTY_Show();
+					return NULL;
+				}
+				avail = read(0, &key, 1);
+				if (avail != -1)
+				{
+					// VT 100 keys
+					if (key == '[' || key == 'O')
+					{
+						avail = read(0, &key, 1);
+						if (avail != -1)
+						{
+							switch (key)
+							{
+								case 'A':
+									history = Hist_Prev();
+									if (history)
+									{
+										TTY_Hide();
+										TTY_con = *history;
+										TTY_Show();
+									}
+									TTY_FlushIn();
+									return NULL;
+									break;
+								case 'B':
+									history = Hist_Next();
+									TTY_Hide();
+									if (history)
+									{
+										TTY_con = *history;
+									} else
+									{
+										Field_Clear(&TTY_con);
+									}
+									TTY_Show();
+									TTY_FlushIn();
+									return NULL;
+									break;
+								case 'C':
+									return NULL;
+								case 'D':
+									return NULL;
+							}
+						}
+					}
+				}
+				Com_DPrintf("droping ISCTL sequence: %d, TTY_erase: %d\n", key, TTY_erase);
+				TTY_FlushIn();
+				return NULL;
+			}
+			// push regular character
+			TTY_con.buffer[TTY_con.cursor] = key;
+			TTY_con.cursor++;
+			// print the current line (this is differential)
+			write(1, &key, 1);
+		}
+
+		return NULL;
+	}
+	else
+	{
+		int     len;
+		fd_set  fdset;
+		struct timeval timeout;
+		static qboolean stdin_active;
+
+		if (!com_dedicated || !com_dedicated->value)
+			return NULL;
+
+		if (!stdin_active)
+			return NULL;
+
+		FD_ZERO(&fdset);
+		FD_SET(0, &fdset); // stdin
+		timeout.tv_sec = 0;
+		timeout.tv_usec = 0;
+		if (select (1, &fdset, NULL, NULL, &timeout) == -1 || !FD_ISSET(0, &fdset))
+		{
+			return NULL;
+		}
+
+		len = read (0, text, sizeof(text));
+		if (len == 0)
+		{ // eof!
+			stdin_active = qfalse;
+			return NULL;
+		}
+
+		if (len < 1)
+			return NULL;
+		text[len-1] = 0;    // rip off the /n and terminate
+
+		return text;
+	}
+}

Copied: branches/unified-sdl/code/sys/win_resource.h (from rev 1143, branches/unified-sdl/code/win32/resource.h)
===================================================================
--- branches/unified-sdl/code/sys/win_resource.h	                        (rev 0)
+++ branches/unified-sdl/code/sys/win_resource.h	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,44 @@
+/*
+===========================================================================
+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
+===========================================================================
+*/
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by winquake.rc
+//
+#define IDS_STRING1                     1
+#define IDI_ICON1                       1
+#define IDB_BITMAP1                     1
+#define IDB_BITMAP2                     128
+#define IDC_CURSOR1                     129
+#define IDC_CURSOR2                     130
+#define IDC_CURSOR3                     131
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NO_MFC                     1
+#define _APS_NEXT_RESOURCE_VALUE        132
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1005
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif

Copied: branches/unified-sdl/code/sys/win_resource.rc (from rev 1143, branches/unified-sdl/code/win32/win_resource.rc)
===================================================================
--- branches/unified-sdl/code/sys/win_resource.rc	                        (rev 0)
+++ branches/unified-sdl/code/sys/win_resource.rc	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,75 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "win_resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef __MINGW32__
+#include "winres.h"
+#else
+#include <winresrc.h>
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""winres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1               ICON    DISCARDABLE     "misc/quake3.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_STRING1             "Quake3"
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+

Modified: branches/unified-sdl/code/ui/ui_atoms.c
===================================================================
--- branches/unified-sdl/code/ui/ui_atoms.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/ui/ui_atoms.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -76,7 +76,7 @@
 }
 
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static void NeedCDAction( qboolean result ) {
 	if ( !result ) {
 		trap_Cmd_ExecuteText( EXEC_APPEND, "quit\n" );
@@ -84,7 +84,7 @@
 }
 #endif // MISSIONPACK
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static void NeedCDKeyAction( qboolean result ) {
 	if ( !result ) {
 		trap_Cmd_ExecuteText( EXEC_APPEND, "quit\n" );

Modified: branches/unified-sdl/code/ui/ui_gameinfo.c
===================================================================
--- branches/unified-sdl/code/ui/ui_gameinfo.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/ui/ui_gameinfo.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -38,7 +38,7 @@
 static int		ui_numArenas;
 static char		*ui_arenaInfos[MAX_ARENAS];
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static int		ui_numSinglePlayerArenas;
 static int		ui_numSpecialSinglePlayerArenas;
 #endif

Modified: branches/unified-sdl/code/ui/ui_main.c
===================================================================
--- branches/unified-sdl/code/ui/ui_main.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/ui/ui_main.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -119,7 +119,7 @@
 	NULL
 };
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static char quake3worldMessage[] = "Visit www.quake3world.com - News, Community, Events, Files";
 #endif
 
@@ -203,7 +203,7 @@
 		  UI_DrawConnectScreen( arg0 );
 		  return 0;
 	  case UI_HASUNIQUECDKEY: // mod authors need to observe this
-	    return qtrue; // bk010117 - change this to qfalse for mods!
+	    return qtrue; // change this to qfalse for mods!
 
 	}
 
@@ -312,7 +312,7 @@
 	float max;
 	glyphInfo_t *glyph;
 	float useScale;
-	const char *s = text; // bk001206 - unsigned
+	const char *s = text;
 	fontInfo_t *font = &uiInfo.uiDC.Assets.textFont;
 	if (scale <= ui_smallFont.value) {
 		font = &uiInfo.uiDC.Assets.smallFont;
@@ -365,7 +365,7 @@
 	}
 	useScale = scale * font->glyphScale;
   if (text) {
-    const char *s = text; // bk001206 - unsigned
+    const char *s = text;
 		trap_R_SetColor( color );
 		memcpy(&newColor[0], &color[0], sizeof(vec4_t));
     len = strlen(text);
@@ -434,7 +434,7 @@
 	}
 	useScale = scale * font->glyphScale;
   if (text) {
-    const char *s = text; // bk001206 - unsigned
+    const char *s = text;
 		trap_R_SetColor( color );
 		memcpy(&newColor[0], &color[0], sizeof(vec4_t));
     len = strlen(text);
@@ -442,7 +442,7 @@
 			len = limit;
 		}
 		count = 0;
-		glyph2 = &font->glyphs[ (int) cursor]; // bk001206 - possible signed char
+		glyph2 = &font->glyphs[ (int) cursor];
 		while (s && *s && count < len) {
 			glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
       //int yadj = Assets.textFont.glyphs[text[i]].bottom + Assets.textFont.glyphs[text[i]].top;
@@ -524,7 +524,7 @@
 	vec4_t newColor;
 	glyphInfo_t *glyph;
   if (text) {
-    const char *s = text; // bk001206 - unsigned
+    const char *s = text;
 		float max = *maxX;
 		float useScale;
 		fontInfo_t *font = &uiInfo.uiDC.Assets.textFont;
@@ -1007,7 +1007,7 @@
 }
 
 static const char *handicapValues[] = {"None","95","90","85","80","75","70","65","60","55","50","45","40","35","30","25","20","15","10","5",NULL};
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static int numHandicaps = sizeof(handicapValues) / sizeof(const char*);
 #endif
 
@@ -1412,7 +1412,7 @@
 }
 
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static const char *UI_OpponentLeaderName(void) {
   int i = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_opponentName"));
 	return uiInfo.teamList[i].teamMembers[0];
@@ -1429,7 +1429,7 @@
 	return "James";
 }
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static const int UI_AIIndex(const char *name) {
 	int j;
 	for (j = 0; j < uiInfo.characterCount; j++) {
@@ -1441,7 +1441,7 @@
 }
 #endif
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static const int UI_AIIndexFromName(const char *name) {
 	int j;
 	for (j = 0; j < uiInfo.aliasCount; j++) {
@@ -1454,14 +1454,14 @@
 #endif
 
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static const char *UI_OpponentLeaderHead(void) {
 	const char *leader = UI_OpponentLeaderName();
 	return UI_AIFromName(leader);
 }
 #endif
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static const char *UI_OpponentLeaderModel(void) {
 	int i;
 	const char *head = UI_OpponentLeaderHead();
@@ -4897,9 +4897,8 @@
 	}
 }
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static int UI_OwnerDraw_Width(int ownerDraw) {
-  // bk001205 - LCC missing return value
   return 0;
 }
 #endif
@@ -5131,7 +5130,7 @@
 #if 0
 	if (uiInfo.inGameLoad) {
 		UI_LoadMenus("ui/ingame.txt", qtrue);
-	} else { // bk010222: left this: UI_LoadMenus(menuSet, qtrue);
+	} else {
 	}
 #else 
 	UI_LoadMenus(menuSet, qtrue);
@@ -5697,8 +5696,6 @@
 vmCvar_t	ui_realWarmUp;
 vmCvar_t	ui_serverStatusTimeOut;
 
-
-// bk001129 - made static to avoid aliasing
 static cvarTable_t		cvarTable[] = {
 	{ &ui_ffa_fraglimit, "ui_ffa_fraglimit", "20", CVAR_ARCHIVE },
 	{ &ui_ffa_timelimit, "ui_ffa_timelimit", "0", CVAR_ARCHIVE },
@@ -5821,7 +5818,6 @@
 
 };
 
-// bk001129 - made static to avoid aliasing
 static int		cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);
 
 
@@ -5885,7 +5881,7 @@
 ArenaServers_MaxPing
 =================
 */
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static int ArenaServers_MaxPing( void ) {
 	int		maxPing;
 

Modified: branches/unified-sdl/code/ui/ui_shared.c
===================================================================
--- branches/unified-sdl/code/ui/ui_shared.c	2007-08-31 17:33:12 UTC (rev 1143)
+++ branches/unified-sdl/code/ui/ui_shared.c	2007-09-02 01:48:59 UTC (rev 1144)
@@ -534,7 +534,7 @@
 		}
 		Q_strcat(script, 1024, " ");
 	}
-	return qfalse; 	// bk001105 - LCC   missing return value
+	return qfalse;
 }
 
 // display, window, menu, item code
@@ -1342,13 +1342,13 @@
 	itemDef_t *oldFocus;
 	sfxHandle_t *sfx = &DC->Assets.itemFocusSound;
 	qboolean playSound = qfalse;
-	menuDef_t *parent; // bk001206: = (menuDef_t*)item->parent;
+	menuDef_t *parent;
 	// sanity check, non-null, not a decoration and does not already have the focus
 	if (item == NULL || item->window.flags & WINDOW_DECORATION || item->window.flags & WINDOW_HASFOCUS || !(item->window.flags & WINDOW_VISIBLE)) {
 		return qfalse;
 	}
 
-	// bk001206 - this can be NULL.
+	// this can be NULL
 	parent = (menuDef_t*)item->parent; 
       
 	// items can be enabled and disabled based on cvars
@@ -2374,7 +2374,6 @@
 		captureFunc = 0;
 		captureData = NULL;
 	} else {
-	  // bk001206 - parentheses
 		if ( down && ( key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3 ) ) {
 			Item_StartCapture(item, key);
 		}
@@ -2629,7 +2628,6 @@
 		// see if the mouse is within the window bounds and if so is this a mouse click
 	if (down && !(menu->window.flags & WINDOW_POPUP) && !Rect_ContainsPoint(&menu->window.rect, DC->cursorx, DC->cursory)) {
 		static qboolean inHandleKey = qfalse;
-		// bk001206 - parentheses
 		if (!inHandleKey && ( key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3 ) ) {
 			inHandleKey = qtrue;
 			Menus_HandleOOBClick(menu, key, down);
@@ -3188,7 +3186,6 @@
 	{"tauntGauntlet", K_F5,			-1,		-1, -1},
 	{"scoresUp", K_KP_PGUP,			-1,		-1, -1},
 	{"scoresDown", K_KP_PGDN,			-1,		-1, -1},
-	// bk001205 - this one below was:  '-1' 
 	{"messagemode",  -1,					-1,		-1, -1},
 	{"messagemode2", -1,						-1,		-1, -1},
 	{"messagemode3", -1,						-1,		-1, -1},
@@ -3198,7 +3195,7 @@
 
 static const int g_bindCount = sizeof(g_bindings) / sizeof(bind_t);
 
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static configcvar_t g_configcvars[] =
 {
 	{"cl_run",			0,					0},
@@ -3842,7 +3839,7 @@
 		}
 
 		if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
-		  memcpy(color, parent->disableColor, sizeof(vec4_t)); // bk001207 - FIXME: Com_Memcpy
+		  Com_Memcpy(color, parent->disableColor, sizeof(vec4_t));
 		}
 	
 		if (item->text) {
@@ -4964,7 +4961,7 @@
 		}
 
 	}
-	return qfalse; 	// bk001205 - LCC missing return value
+	return qfalse;
 }
 
 qboolean ItemParse_cvarFloatList( itemDef_t *item, int handle ) {
@@ -5009,7 +5006,7 @@
 		}
 
 	}
-	return qfalse; 	// bk001205 - LCC missing return value
+	return qfalse;
 }
 
 
@@ -5188,7 +5185,7 @@
 			return qfalse;
 		}
 	}
-	return qfalse; 	// bk001205 - LCC missing return value
+	return qfalse;
 }
 
 
@@ -5242,7 +5239,7 @@
 
 qboolean MenuParse_fullscreen( itemDef_t *item, int handle ) {
 	menuDef_t *menu = (menuDef_t*)item;
-	if (!PC_Int_Parse(handle, (int*) &menu->fullScreen)) { // bk001206 - cast qboolean
+	if (!PC_Int_Parse(handle, (int*) &menu->fullScreen)) {
 		return qfalse;
 	}
 	return qtrue;
@@ -5591,7 +5588,7 @@
 			return qfalse;
 		}
 	}
-	return qfalse; 	// bk001205 - LCC missing return value
+	return qfalse;
 }
 
 /*
@@ -5639,7 +5636,7 @@
 	return DC;
 }
  
-#ifndef MISSIONPACK // bk001206
+#ifndef MISSIONPACK
 static float captureX;
 static float captureY;
 #endif

Copied: branches/unified-sdl/misc/quake3.ico (from rev 1143, branches/unified-sdl/code/win32/qe3.ico)
===================================================================
(Binary files differ)

Copied: branches/unified-sdl/misc/quake3.png (from rev 1143, branches/unified-sdl/code/unix/quake3.png)
===================================================================
(Binary files differ)

Copied: branches/unified-sdl/misc/quake3.svg (from rev 1143, branches/unified-sdl/code/unix/quake3.svg)
===================================================================
--- branches/unified-sdl/misc/quake3.svg	                        (rev 0)
+++ branches/unified-sdl/misc/quake3.svg	2007-09-02 01:48:59 UTC (rev 1144)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   version="1.0"
+   width="64"
+   height="64"
+   id="svg1306">
+  <defs
+     id="defs1308">
+    <linearGradient
+       id="linearGradient2180">
+      <stop
+         style="stop-color:#ff0000;stop-opacity:1"
+         offset="0"
+         id="stop2182" />
+      <stop
+         style="stop-color:#590000;stop-opacity:1"
+         offset="1"
+         id="stop2184" />
+    </linearGradient>
+    <linearGradient
+       x1="14.860399"
+       y1="19.054131"
+       x2="15.042735"
+       y2="59"
+       id="linearGradient2190"
+       xlink:href="#linearGradient2180"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       x1="14.860399"
+       y1="19.054131"
+       x2="15.042735"
+       y2="59"
+       id="linearGradient2194"
+       xlink:href="#linearGradient2180"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       x1="32"
+       y1="64.091171"
+       x2="32"
+       y2="0"
+       id="linearGradient3077"
+       xlink:href="#linearGradient2180"
+       gradientUnits="userSpaceOnUse" />
+  </defs>
+  <g
+     id="layer1">
+    <g
+       id="g1327">
+      <path
+         d="M 34.538626,32.090265 L 32.538627,64 L 30.538626,32 L 32.538627,0 L 34.538626,32.090265 z "
+         style="opacity:1;fill:url(#linearGradient3077);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.5261631;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path1329" />
+      <path
+         d="M 28.059562,59 L 25.612281,34.036677 C 25.612281,34.036677 2.1281775,31.218199 2.0010765,25.064561 C 1.9155925,21.016997 6.9421265,19.095215 9.6946005,19.095215 C 12.000721,19.095215 4.2082195,19.143464 4.1713675,24.287073 C 4.1405475,28.679913 29.3599,30.346963 29.3599,30.346963 L 28.059562,59 z "
+         style="fill:url(#linearGradient2190);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path1307" />
+      <path
+         d="M 36.940438,59 L 39.387719,34.036677 C 39.387719,34.036677 62.871823,31.218199 62.998924,25.064561 C 63.084408,21.016997 58.057873,19.095215 55.305399,19.095215 C 52.999279,19.095215 60.79178,19.143464 60.828632,24.287073 C 60.859452,28.679913 35.6401,30.346963 35.6401,30.346963 L 36.940438,59 z "
+         style="fill:url(#linearGradient2194);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path2192" />
+    </g>
+  </g>
+</svg>

Copied: branches/unified-sdl/misc/setup (from rev 1143, branches/unified-sdl/code/unix/setup)




More information about the quake3-commits mailing list