summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--build/mod_ui.mk2
-rw-r--r--build/q2pro.mk4
-rw-r--r--build/q2proded.mk2
-rw-r--r--build/ref_gl.mk2
-rw-r--r--build/ref_soft.mk2
-rw-r--r--build/target.mk12
-rwxr-xr-xconfigure128
-rw-r--r--debian/changelog10
-rw-r--r--debian/control29
-rw-r--r--debian/q2pro-client.install3
-rw-r--r--debian/q2pro-client.menu1
-rw-r--r--debian/q2pro-common.install1
-rw-r--r--source/cl_aastat.c360
-rw-r--r--source/cl_console.c44
-rw-r--r--source/cl_draw.c401
-rw-r--r--source/cl_fx.c168
-rw-r--r--source/cl_input.c10
-rw-r--r--source/cl_keys.c32
-rw-r--r--source/cl_local.h20
-rw-r--r--source/cl_locs.c2
-rw-r--r--source/cl_main.c69
-rw-r--r--source/cl_parse.c174
-rw-r--r--source/cl_pred.c18
-rw-r--r--source/cl_ref.c24
-rw-r--r--source/cl_scrn.c158
-rw-r--r--source/cl_view.c79
-rw-r--r--source/cmodel.c193
-rw-r--r--source/com_local.h8
-rw-r--r--source/com_public.h90
-rw-r--r--source/common.c78
-rw-r--r--source/cvar.c15
-rw-r--r--source/files.c36
-rw-r--r--source/gl_local.h2
-rw-r--r--source/gl_main.c2
-rw-r--r--source/ioapi.c2
-rw-r--r--source/m_flash.c4
-rw-r--r--source/mdfour.c2
-rw-r--r--source/mod_ui.rc2
-rw-r--r--source/mvd_client.c16
-rw-r--r--source/pmove.c2
-rw-r--r--source/prompt.c130
-rw-r--r--source/prompt.h2
-rw-r--r--source/q2pro.rc2
-rw-r--r--source/q2proded.rc2
-rw-r--r--source/q_field.c2
-rw-r--r--source/q_msg.c2
-rw-r--r--source/q_shared.c198
-rw-r--r--source/q_shared.h14
-rw-r--r--source/q_uis.c2
-rw-r--r--source/qgl_api.c2
-rw-r--r--source/r_bsp.c4
-rw-r--r--source/ref_gl.rc2
-rw-r--r--source/ref_soft.rc2
-rw-r--r--source/snd_main.c4
-rw-r--r--source/snd_oss.c8
-rw-r--r--source/sv_ac.c9
-rw-r--r--source/sv_ccmds.c49
-rw-r--r--source/sv_game.c27
-rw-r--r--source/sv_main.c2
-rw-r--r--source/sv_mvd.c6
-rw-r--r--source/sv_user.c16
-rw-r--r--source/sv_world.c16
-rw-r--r--source/sys_unix.c22
-rw-r--r--source/sys_win.c2
-rw-r--r--source/ui_menu.c12
-rw-r--r--source/ui_multiplayer.c79
-rw-r--r--source/vid_sdl.c37
-rw-r--r--source/win_glimp.c2
-rw-r--r--wiki/index.mdwn14
70 files changed, 1503 insertions, 1375 deletions
diff --git a/Makefile b/Makefile
index faeede0..b77ebdf 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ include config.mk
.PHONY: default all binaries clean distclean install strip tags
default: all
-all: binaries strip
+all: binaries
binaries:
for t in $(TARGETS) ; do \
diff --git a/build/mod_ui.mk b/build/mod_ui.mk
index 0f127a3..4912f4c 100644
--- a/build/mod_ui.mk
+++ b/build/mod_ui.mk
@@ -4,7 +4,7 @@
include ../config.mk
-TARGET=$(OUTDIR)/mod_ui$(LIBSUFFIX)
+TARGET=../mod_ui$(LIBSUFFIX)
LDFLAGS+=-lm -shared
diff --git a/build/q2pro.mk b/build/q2pro.mk
index 6be17b8..1a3fc6e 100644
--- a/build/q2pro.mk
+++ b/build/q2pro.mk
@@ -4,7 +4,7 @@
include ../config.mk
-TARGET=$(OUTDIR)/q2pro$(EXESUFFIX)
+TARGET=../q2pro$(EXESUFFIX)
LDFLAGS+=-lm
@@ -16,7 +16,7 @@ SRCFILES=cmd.c cmodel.c common.c prompt.c crc.c cvar.c \
q_msg.c q_shared.c q_uis.c q_field.c \
m_flash.c cl_demo.c cl_draw.c cl_ents.c cl_fx.c cl_input.c \
cl_locs.c cl_main.c cl_newfx.c cl_parse.c cl_pred.c cl_ref.c \
- cl_scrn.c cl_tent.c cl_ui.c cl_view.c cl_console.c cl_keys.c \
+ cl_scrn.c cl_tent.c cl_ui.c cl_view.c cl_console.c cl_keys.c cl_aastat.c \
snd_main.c snd_mem.c snd_mix.c
ifdef USE_ANTICHEAT
diff --git a/build/q2proded.mk b/build/q2proded.mk
index fd988f0..88fad39 100644
--- a/build/q2proded.mk
+++ b/build/q2proded.mk
@@ -4,7 +4,7 @@
include ../config.mk
-TARGET=$(OUTDIR)/q2proded$(EXESUFFIX)
+TARGET=../q2proded$(EXESUFFIX)
CFLAGS+=-DDEDICATED_ONLY
LDFLAGS+=-lm
diff --git a/build/ref_gl.mk b/build/ref_gl.mk
index 6a0c285..0de7bd9 100644
--- a/build/ref_gl.mk
+++ b/build/ref_gl.mk
@@ -4,7 +4,7 @@
include ../config.mk
-TARGET=$(OUTDIR)/ref_gl$(LIBSUFFIX)
+TARGET=../ref_gl$(LIBSUFFIX)
LDFLAGS+=-lm -shared
CFLAGS+=-DOPENGL_RENDERER=1 -DTRUECOLOR_RENDERER=1
diff --git a/build/ref_soft.mk b/build/ref_soft.mk
index 08a4d89..26ba7f2 100644
--- a/build/ref_soft.mk
+++ b/build/ref_soft.mk
@@ -4,7 +4,7 @@
include ../config.mk
-TARGET=$(OUTDIR)/ref_soft$(LIBSUFFIX)
+TARGET=../ref_soft$(LIBSUFFIX)
LDFLAGS+=-lm -shared
CFLAGS+=-DSOFTWARE_RENDERER
diff --git a/build/target.mk b/build/target.mk
index d8cb659..8e580f1 100644
--- a/build/target.mk
+++ b/build/target.mk
@@ -16,16 +16,20 @@ clean:
.PHONY: clean
%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
+ @echo [CC] $@
+ @$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.s
- $(CC) $(CFLAGS) $(ASMFLAGS) -x assembler-with-cpp -c -o $@ $<
+ @echo [AS] $@
+ @$(CC) $(CFLAGS) $(ASMFLAGS) -x assembler-with-cpp -c -o $@ $<
%.o: %.rc
- $(WINDRES) $(RESFLAGS) -o $@ $<
+ @echo [RC] $@
+ @$(WINDRES) $(RESFLAGS) -o $@ $<
$(TARGET): $(OBJFILES)
- $(CC) -o $@ $^ $(LDFLAGS)
+ @echo [LD] $@
+ @$(CC) -o $@ $^ $(LDFLAGS)
-include *.d
diff --git a/configure b/configure
index 0e60b33..ad24495 100755
--- a/configure
+++ b/configure
@@ -4,12 +4,20 @@
# q2pro configuration script by [SkulleR]
# -----------------------------
-# defaults
+# build directories
sources=$(dirname $0)
if [ "$sources" = "." ]; then
sources=`pwd`
fi
+
+if [ ! -f $sources/source/common.c ] ; then
+ echo "ERROR: $sources does not look like Q2PRO source tree"
+ exit 1
+fi
+
outdir=`pwd`
+
+# defaults
prefix="/usr/local"
datadir="share/games/quake2"
libdir="lib/games/quake2"
@@ -23,6 +31,7 @@ windres="windres"
strip="strip"
mingw="no"
pngconfig="libpng-config"
+sdlconfig="sdl-config"
exesuffix=""
libsuffix=".so"
dsound="no"
@@ -66,9 +75,11 @@ scoreshots="scoreshots"
revision="226"
tmpc="/tmp/q2pro-${RANDOM}.c"
tmpo="/tmp/q2pro-${RANDOM}.o"
+config_mk="config.mk"
+config_h="config.h"
if [ -z "$CFLAGS" ]; then
- CFLAGS="-ffast-math -O2"
+ CFLAGS="-O2 -Wall -Wstrict-prototypes"
fi
# detect host CPU
@@ -77,6 +88,7 @@ case $cpu in
i386|i486|i586|i686)
cpu="i386"
asm="yes"
+CFLAGS="-ffloat-store -ffast-math $CFLAGS"
;;
ia64)
cpu="ia64"
@@ -84,6 +96,9 @@ cpu="ia64"
x86_64|amd64)
cpu="x86_64"
;;
+arm*)
+cpu="arm"
+;;
*)
cpu="unknown"
;;
@@ -93,17 +108,11 @@ esac
targetos=`uname -s`
case $targetos in
CYGWIN*)
-targetos="Windows"
mingw="yes"
-sdl="no"
-wave="yes"
CFLAGS="-mno-cygwin $CFLAGS"
;;
MINGW*)
-targetos="Windows"
mingw="yes"
-sdl="no"
-wave="yes"
;;
*BSD)
make="gmake"
@@ -219,43 +228,47 @@ echo "Object files are built in the directory from which configure is run."
exit 1
fi
-if [ "$singleuser" = "yes" ]; then
- prefix=""
- datadir="."
- libdir="."
- refdir="."
- bindir=""
- mandir=""
- homedir=""
-fi
-
if [ "$mingw" = "yes" ]; then
- targetos="Windows"
+ if [ "$cpu" = "i386" ]; then
+ cpu="x86"
+ targetos="Win32"
+ else
+ targetos="Win64"
+ fi
pathsep='\\'
exesuffix=".exe"
libsuffix=".dll"
oss="no"
evdev="no"
+ sdl="no"
gldriver="opengl32"
- gamelib="gamex86.dll"
exported="__attribute__((dllexport))"
homedir=""
asmflags="-DUNDERSCORES"
cfgfile="q2config.cfg"
- if [ "$wave" = "???" ]; then
+ if [ "$wave" != "no" ]; then
wave="yes"
fi
else
pathsep="/"
- gamelib="game$cpu.so"
exported="__attribute__((visibility(\"default\")))"
- if [ ! -z "$prefix" ]; then
- datadir="$prefix/$datadir"
- libdir="$prefix/$libdir"
- refdir="$prefix/$refdir"
- bindir="$prefix/$bindir"
- mandir="$prefix/$mandir"
+ if [ "$singleuser" = "yes" ]; then
+ prefix=""
+ datadir="."
+ libdir="."
+ refdir="."
+ bindir=""
+ mandir=""
+ homedir=""
+ else
+ if [ ! -z "$prefix" ]; then
+ datadir="$prefix/$datadir"
+ libdir="$prefix/$libdir"
+ refdir="$prefix/$refdir"
+ bindir="$prefix/$bindir"
+ mandir="$prefix/$mandir"
+ fi
fi
# check if -fvisibility is supported
@@ -268,6 +281,13 @@ else
LDFLAGS="-Wl,--no-undefined $LDFLAGS"
fi
+gamelib="game$cpu.so"
+
+vpath="\$(SRCDIR)/source"
+if [ "$client" = "yes" ]; then
+ vpath="$vpath \$(SRCDIR)/asm"
+fi
+
if [ ! -z "$cross_prefix" ]; then
cc="$cross_prefix-$cc"
windres="$cross_prefix-$windres"
@@ -275,6 +295,7 @@ if [ ! -z "$cross_prefix" ]; then
pngconfig="$cross_prefix-$pngconfig"
fi
+# echo configuration info
echo "Build client $client"
if [ "$client" = "yes" ]; then
if [ "$hardlink" = "yes" ]; then
@@ -316,31 +337,11 @@ if [ "$client" = "yes" ]; then
fi
test "$cpu" = "i386" && echo "i386 assembly $asm"
-CFLAGS="-I\$(OUTDIR) -MF \$*.d -MMD -Wall -Wno-missing-braces -Wno-strict-aliasing -Wstrict-prototypes -pipe -ffloat-store $CFLAGS"
+CFLAGS="-I\$(OUTDIR) -MF \$*.d -MMD -pipe $CFLAGS -Wno-strict-aliasing"
#LDFLAGS="$LDFLAGS"
-config_mk="config.mk"
-config_h="config.h"
-
-echo "# Generated by configure - do not modify" > $config_mk
-echo "// Generated by configure - do not modify" > $config_h
-
-test "$mingw" = "yes" && echo "MINGW=$mingw" >> $config_mk
-echo "CC=$cc" >> $config_mk
-echo "WINDRES=$windres" >> $config_mk
-echo "STRIP=$strip" >> $config_mk
-echo "MAKE=$make" >> $config_mk
-echo "SRCDIR=$sources" >> $config_mk
-echo "OUTDIR=$outdir" >> $config_mk
-echo "EXESUFFIX=$exesuffix" >> $config_mk
-echo "LIBSUFFIX=$libsuffix" >> $config_mk
-echo "#define LIBSUFFIX \"$libsuffix\"" >> $config_h
-echo "VPATH=\$(SRCDIR)/source \$(SRCDIR)/asm" >> $config_mk
-echo "CFLAGS=$CFLAGS" >> $config_mk
-echo "LDFLAGS=$LDFLAGS" >> $config_mk
-test "$mingw" = "yes" && echo "RESFLAGS=-I\$(OUTDIR) -I\$(SRCDIR)/source" >> $config_mk
-test "$asm" = "yes" && echo "ASMFLAGS=$asmflags" >> $config_mk
+# determine what needs to be built
if [ "$client" = "yes" ]; then
targets="$targets q2pro"
executables="$executables q2pro$exesuffix"
@@ -372,9 +373,30 @@ fi
if [ "$openffa" = "yes" ]; then
targets="$targets openffa"
- #libraries="$libraries $gamelib"
+ libraries="$libraries $gamelib"
fi
+
+# build configuration files
+echo "# Generated by configure - do not modify" > $config_mk
+echo "// Generated by configure - do not modify" > $config_h
+
+test "$mingw" = "yes" && echo "MINGW=$mingw" >> $config_mk
+echo "CC=$cc" >> $config_mk
+echo "WINDRES=$windres" >> $config_mk
+echo "STRIP=$strip" >> $config_mk
+echo "MAKE=$make" >> $config_mk
+echo "SRCDIR=$sources" >> $config_mk
+echo "OUTDIR=$outdir" >> $config_mk
+echo "EXESUFFIX=$exesuffix" >> $config_mk
+echo "LIBSUFFIX=$libsuffix" >> $config_mk
+echo "#define LIBSUFFIX \"$libsuffix\"" >> $config_h
+echo "VPATH=$vpath" >> $config_mk
+echo "CFLAGS=$CFLAGS" >> $config_mk
+echo "LDFLAGS=$LDFLAGS" >> $config_mk
+test "$mingw" = "yes" && echo "RESFLAGS=-I\$(OUTDIR) -I\$(SRCDIR)/source" >> $config_mk
+test "$asm" = "yes" && echo "ASMFLAGS=$asmflags" >> $config_mk
+
echo "TARGETS=$targets" >> $config_mk
echo "BINARIES=$executables $libraries" >> $config_mk
echo "EXECUTABLES=$executables" >> $config_mk
@@ -458,8 +480,8 @@ fi
if [ "$sdl" = "yes" ]; then
echo "USE_SDL=yes" >> $config_mk
- echo "SDL_LDFLAGS=`sdl-config --libs`" >> $config_mk
- echo "SDL_CFLAGS=`sdl-config --cflags`" >> $config_mk
+ echo "SDL_LDFLAGS=$($sdlconfig --libs)" >> $config_mk
+ echo "SDL_CFLAGS=$($sdlconfig --cflags)" >> $config_mk
echo "#define USE_SDL 1" >> $config_h
if [ "$x11" = "yes" ]; then
echo "USE_X11=yes" >> $config_mk
diff --git a/debian/changelog b/debian/changelog
index 6587729..9ff3f45 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,5 @@
-q2pro (0.170) unstable; urgency=low
+q2pro (0.226) unstable; urgency=low
* New release.
- -- Andrey Nazarov <skuller-vidnoe@yandex.ru> Fri, 28 Dec 2007 00:14:34 +0300
-
-q2pro (0.166) unstable; urgency=low
-
- * Initial Release.
-
- -- Andrey Nazarov <skuller-vidnoe@yandex.ru> Sat, 8 Dec 2007 00:43:59 +0300
+ -- Andrey Nazarov <skuller-vidnoe@yandex.ru> Tue, 22 Apr 2008 16:05:52 +0400
diff --git a/debian/control b/debian/control
index 1e70735..27fa70f 100644
--- a/debian/control
+++ b/debian/control
@@ -7,9 +7,8 @@ Build-Depends: cdbs, debhelper (>= 5), libx11-dev, libsdl1.2-dev,
Standards-Version: 3.7.2
Package: q2pro-client
-Architecture: i386 amd64
-Depends: ${shlibs:Depends}, quake2-data
-Suggests: quake2-mod-openffa
+Architecture: i386 amd64 armel
+Depends: ${shlibs:Depends}, quake2-data, q2pro-common
Description: Enhanced Quake 2 client for multiplayer
Q2PRO is a Quake 2 engine modification designed for online play,
fully compatible with original Quake 2 clients and servers.
@@ -20,15 +19,15 @@ Description: Enhanced Quake 2 client for multiplayer
capabilities, built-in server and demo browsers.
.
Both OpenGL and software refresh modules are included, so that 3D graphics
- accelerator is not mandatory to play Q2PRO, although highly recommended to
+ accelerator is not mandatory to play Q2PRO, although recommended to
take most of Q2PRO features.
.
- Homepage: http://q2pro.sourceforge.net/
+ Homepage: http://q2pro.sf.net/
Package: q2pro-server
-Architecture: i386 amd64
-Depends: ${shlibs:Depends}
-Recommends: quake2-mod-openffa
+Architecture: i386 amd64 armel
+Depends: ${shlibs:Depends}, q2pro-common
+Recommends: quake2-data
Description: Dedicated Quake 2 server
Q2PRO is a Quake 2 engine modification designed for online play,
fully compatible with original Quake 2 clients and servers.
@@ -40,13 +39,17 @@ Description: Dedicated Quake 2 server
This package contains streamlined server executable, with all client side
code stripped out. Use it for hosting long running Quake 2 servers.
.
- Homepage: http://q2pro.sourceforge.net/
+ Homepage: http://q2pro.sf.net/
-Package: quake2-mod-openffa
-Architecture: i386 amd64
+Package: q2pro-common
+Architecture: i386 amd64 armel
Depends: ${shlibs:Depends}
-Description: Simple Quake 2 deathmatch mod
+Description: Common files for Q2PRO
+ This package contains common files between Q2PRO server and client.
+ Currently, OpenFFA deathmatch mod is packaged, which provides game
+ library essential for server startup.
+ .
OpenFFA is a simple deathmatch mod for Quake 2. It features familiar
scoreboard, voting system, map rotation support, high scores logging.
.
- Homepage: http://q2pro.sourceforge.net/
+ Homepage: http://q2pro.sf.net/
diff --git a/debian/q2pro-client.install b/debian/q2pro-client.install
index a7aebbf..8c23bc2 100644
--- a/debian/q2pro-client.install
+++ b/debian/q2pro-client.install
@@ -1,2 +1,3 @@
-usr/lib/games/q2pro/*
+usr/lib/games/q2pro/ref_*.so
+usr/lib/games/q2pro/mod_*.so
usr/games/q2pro
diff --git a/debian/q2pro-client.menu b/debian/q2pro-client.menu
new file mode 100644
index 0000000..cdcaf8a
--- /dev/null
+++ b/debian/q2pro-client.menu
@@ -0,0 +1 @@
+?package(q2pro-client):needs="x11" section="Games/Arcade" title="Q2PRO" command="q2pro"
diff --git a/debian/q2pro-common.install b/debian/q2pro-common.install
new file mode 100644
index 0000000..0f7940c
--- /dev/null
+++ b/debian/q2pro-common.install
@@ -0,0 +1 @@
+usr/lib/games/q2pro/game*.so
diff --git a/source/cl_aastat.c b/source/cl_aastat.c
new file mode 100644
index 0000000..f864a97
--- /dev/null
+++ b/source/cl_aastat.c
@@ -0,0 +1,360 @@
+/*
+Copyright (C) 1997-2001 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "cl_local.h"
+
+/*
+===============================================================================
+
+STAT PROGRAMS TO TEXT
+
+===============================================================================
+*/
+
+#define TH_WIDTH 80
+#define TH_HEIGHT 40
+
+static void TH_DrawString( char *dst, int x, int y, char *src, size_t len ) {
+ int c;
+
+ if( x + len > TH_WIDTH ) {
+ len = TH_WIDTH - x;
+ }
+
+ dst += y * ( TH_WIDTH + 1 ) + x;
+ while( len-- ) {
+ c = *src++;
+ c &= 127;
+ switch( c ) {
+ case 13: c = '>'; break;
+ case 16: c = '['; break;
+ case 17: c = ']'; break;
+ case 29: c = '<'; break;
+ case 30: c = '='; break;
+ case 31: c = '>'; break;
+ default:
+ if( c < 32 ) {
+ c = 32;
+ }
+ break;
+ }
+ *dst++ = c;
+ }
+}
+
+static void TH_DrawCenterString( char *dst, int x, int y, char *src, size_t len ) {
+ x -= len / 2;
+ if( x < 0 ) {
+ src -= x;
+ x = 0;
+ }
+
+ TH_DrawString( dst, x, y, src, len );
+}
+
+static void TH_DrawNumber( char *dst, int x, int y, int width, int value ) {
+ char num[16];
+ int l;
+
+ if( width < 1 )
+ return;
+
+ // draw number string
+ if( width > 5 )
+ width = 5;
+
+ l = Com_sprintf( num, sizeof( num ), "%d", value );
+ if( l > width )
+ l = width;
+ x += width - l;
+
+ TH_DrawString( dst, x, y, num, l );
+}
+
+static void TH_DrawLayoutString( char *dst, const char *s ) {
+ char buffer[MAX_QPATH];
+ int x, y;
+ int value;
+ char *token;
+ size_t len;
+ int width, index;
+ clientinfo_t *ci;
+
+ if( !s[0] )
+ return;
+
+ x = 0;
+ y = 0;
+ width = 3;
+
+ while( s ) {
+ token = COM_Parse( &s );
+ if( token[2] == 0 ) {
+ if( token[0] == 'x' ) {
+ if( token[1] == 'l' ) {
+ token = COM_Parse( &s );
+ x = atoi( token ) / 8;
+ continue;
+ }
+
+ if( token[1] == 'r' ) {
+ token = COM_Parse( &s );
+ x = TH_WIDTH + atoi( token ) / 8;
+ continue;
+ }
+
+ if( token[1] == 'v' ) {
+ token = COM_Parse( &s );
+ x = TH_WIDTH / 2 - 20 + atoi( token ) / 8;
+ continue;
+ }
+ }
+
+ if( token[0] == 'y' ) {
+ if( token[1] == 't' ) {
+ token = COM_Parse( &s );
+ y = atoi( token ) / 8;
+ continue;
+ }
+
+ if( token[1] == 'b' ) {
+ token = COM_Parse( &s );
+ y = TH_HEIGHT + atoi( token ) / 8;
+ continue;
+ }
+
+ if( token[1] == 'v' ) {
+ token = COM_Parse( &s );
+ y = TH_HEIGHT / 2 - 15 + atoi( token ) / 8;
+ continue;
+ }
+ }
+ }
+
+ if( !strcmp( token, "pic" ) ) {
+ // draw a pic from a stat number
+ COM_Parse( &s );
+ continue;
+ }
+
+ if( !strcmp( token, "client" ) ) {
+ // draw a deathmatch client block
+ int score, ping, time;
+
+ token = COM_Parse( &s );
+ x = TH_WIDTH / 2 - 20 + atoi( token ) / 8;
+ token = COM_Parse( &s );
+ y = TH_HEIGHT / 2 - 15 + atoi( token ) / 8;
+
+ token = COM_Parse( &s );
+ value = atoi( token );
+ if( value < 0 || value >= MAX_CLIENTS ) {
+ Com_Error( ERR_DROP, "%s: invalid client index", __func__ );
+ }
+ ci = &cl.clientinfo[value];
+
+ token = COM_Parse( &s );
+ score = atoi( token );
+
+ token = COM_Parse( &s );
+ ping = atoi( token );
+
+ token = COM_Parse( &s );
+ time = atoi( token );
+
+ len = strlen( ci->name );
+ TH_DrawString( dst, x + 4, y, ci->name, len );
+ len = Com_sprintf( buffer, sizeof( buffer ), "Score: %i", score );
+ TH_DrawString( dst, x + 4, y + 1, buffer, len );
+ len = Com_sprintf( buffer, sizeof( buffer ), "Ping: %i", ping );
+ TH_DrawString( dst, x + 4, y + 2, buffer, len );
+ len = Com_sprintf( buffer, sizeof( buffer ), "Time: %i", time );
+ TH_DrawString( dst, x + 4, y + 3, buffer, len );
+ continue;
+ }
+
+ if( !strcmp( token, "ctf" ) ) {
+ // draw a ctf client block
+ int score, ping;
+
+ token = COM_Parse( &s );
+ x = TH_WIDTH / 2 - 20 + atoi( token ) / 8;
+ token = COM_Parse( &s );
+ y = TH_HEIGHT / 2 - 15 + atoi( token ) / 8;
+
+ token = COM_Parse( &s );
+ value = atoi( token );
+ if( value < 0 || value >= MAX_CLIENTS ) {
+ Com_Error( ERR_DROP, "%s: invalid client index", __func__ );
+ }
+ ci = &cl.clientinfo[value];
+
+ token = COM_Parse( &s );
+ score = atoi( token );
+
+ token = COM_Parse( &s );
+ ping = atoi( token );
+ if( ping > 999 )
+ ping = 999;
+
+ len = Com_sprintf( buffer, sizeof( buffer ), "%3d %3d %-12.12s",
+ score, ping, ci->name );
+ TH_DrawString( dst, x, y, buffer, len );
+ continue;
+ }
+
+ if( !strcmp( token, "picn" ) ) {
+ // draw a pic from a name
+ COM_Parse( &s );
+ continue;
+ }
+
+ if( !strcmp( token, "num" ) ) {
+ // draw a number
+ token = COM_Parse( &s );
+ width = atoi( token );
+ token = COM_Parse( &s );
+ value = atoi( token );
+ if( value < 0 || value >= MAX_STATS ) {
+ Com_Error( ERR_DROP, "%s: invalid stat index", __func__ );
+ }
+ value = cl.frame.ps.stats[value];
+ TH_DrawNumber( dst, x, y, width, value );
+ continue;
+ }
+
+ if( !strcmp( token, "stat_string" ) ) {
+ token = COM_Parse( &s );
+ index = atoi( token );
+ if( index < 0 || index >= MAX_STATS ) {
+ Com_Error( ERR_DROP, "%s: invalid string index", __func__ );
+ }
+ index = cl.frame.ps.stats[index];
+ if( index < 0 || index >= MAX_CONFIGSTRINGS ) {
+ Com_Error( ERR_DROP, "%s: invalid string index", __func__ );
+ }
+ len = strlen( cl.configstrings[index] );
+ TH_DrawString( dst, x, y, cl.configstrings[index], len );
+ continue;
+ }
+
+ if( !strncmp( token, "cstring", 7 ) ) {
+ token = COM_Parse( &s );
+ len = strlen( token );
+ TH_DrawCenterString( dst, x + 40 / 2, y, token, len );
+ continue;
+ }
+
+ if( !strncmp( token, "string", 6 ) ) {
+ token = COM_Parse( &s );
+ len = strlen( token );
+ TH_DrawString( dst, x, y, token, len );
+ continue;
+ }
+
+ if( !strcmp( token, "if" ) ) {
+ token = COM_Parse( &s );
+ value = atoi( token );
+ if( value < 0 || value >= MAX_STATS ) {
+ Com_Error( ERR_DROP, "%s: invalid stat index", __func__ );
+ }
+ value = cl.frame.ps.stats[value];
+ if( !value ) { // skip to endif
+ while( strcmp( token, "endif" ) ) {
+ token = COM_Parse( &s );
+ if( !s ) {
+ break;
+ }
+ }
+ }
+ continue;
+ }
+ }
+}
+
+static void SCR_ScoreShot_f( void ) {
+ char buffer[( TH_WIDTH + 1 ) * TH_HEIGHT];
+ char path[MAX_QPATH];
+ fileHandle_t f;
+ int i;
+
+ if( cls.state != ca_active ) {
+ Com_Printf( "Must be in a level.\n" );
+ return;
+ }
+
+ if( Cmd_Argc() > 1 ) {
+ Q_concat( path, sizeof( path ), SCORESHOTS_DIRECTORY "/", Cmd_Argv( 1 ), NULL );
+ COM_AppendExtension( path, ".txt", sizeof( path ) );
+ } else {
+ for( i = 0; i < 1000; i++ ) {
+ Com_sprintf( path, sizeof( path ), SCORESHOTS_DIRECTORY "/quake%03d.txt", i );
+ if( FS_LoadFileEx( path, NULL, FS_PATH_GAME, TAG_FREE ) == INVALID_LENGTH ) {
+ break; // file doesn't exist
+ }
+ }
+
+ if( i == 1000 ) {
+ Com_Printf( "All scoreshot slots are full.\n" );
+ return;
+ }
+ }
+
+ FS_FOpenFile( path, &f, FS_MODE_WRITE );
+ if( !f ) {
+ Com_EPrintf( "Couldn't open %s for writing.\n", path );
+ return;
+ }
+
+ memset( buffer, ' ', sizeof( buffer ) );
+ for( i = 0; i < TH_HEIGHT; i++ ) {
+ buffer[ i * ( TH_WIDTH + 1 ) + TH_WIDTH ] = '\n';
+ }
+
+ TH_DrawLayoutString( buffer, cl.configstrings[CS_STATUSBAR] );
+ TH_DrawLayoutString( buffer, cl.layout );
+
+ FS_Write( buffer, sizeof( buffer ), f );
+
+ FS_FCloseFile( f );
+
+ Com_Printf( "Wrote %s.\n", path );
+}
+
+static void SCR_ScoreDump_f( void ) {
+ char buffer[( TH_WIDTH + 1 ) * TH_HEIGHT];
+ int i;
+
+ memset( buffer, ' ', sizeof( buffer ) );
+ for( i = 0; i < TH_HEIGHT; i++ ) {
+ buffer[ i * ( TH_WIDTH + 1 ) + TH_WIDTH ] = '\n';
+ }
+
+ TH_DrawLayoutString( buffer, cl.configstrings[CS_STATUSBAR] );
+ TH_DrawLayoutString( buffer, cl.layout );
+
+ Com_Printf( "%s", buffer );
+}
+
+void CL_InitAscii( void ) {
+ Cmd_AddCommand( "aashot", SCR_ScoreShot_f );
+ Cmd_AddCommand( "aadump", SCR_ScoreDump_f );
+}
+
diff --git a/source/cl_console.c b/source/cl_console.c
index aed69d4..a7833d1 100644
--- a/source/cl_console.c
+++ b/source/cl_console.c
@@ -58,7 +58,7 @@ typedef struct console_s {
// for transparent notify lines
qboolean skipNotify;
- qhandle_t conbackImage;
+ qhandle_t backImage;
qhandle_t charsetImage;
float currentHeight; // aproaches scr_conlines at scr_conspeed
@@ -107,7 +107,7 @@ Con_ClearTyping
void Con_ClearTyping( void ) {
// clear any typing
IF_Clear( &con.prompt.inputLine );
- con.prompt.tooMany = qfalse;
+ Prompt_ClearState( &con.prompt );
}
/*
@@ -361,7 +361,7 @@ static void Con_CheckTop( void ) {
static void con_param_changed( cvar_t *self ) {
if( con.initialized && cls.ref_initialized ) {
- Con_SetupDC();
+ Con_RegisterMedia();
}
}
@@ -576,21 +576,24 @@ void Con_Printf( const char *fmt, ... ) {
/*
================
-Con_SetupDC
+Con_RegisterMedia
================
*/
-void Con_SetupDC( void ) {
- if( !( con.charsetImage = ref.RegisterFont( con_font->string ) ) ) {
- /* fall back to default */
- Com_WPrintf( "Couldn't load %s, falling back to default...\n", con_font->string );
+void Con_RegisterMedia( void ) {
+ con.charsetImage = ref.RegisterFont( con_font->string );
+ if( !con.charsetImage && strcmp( con_font->string, "conchars" ) ) {
+ Com_WPrintf( "Couldn't load console font: %s\n", con_font->string );
con.charsetImage = ref.RegisterFont( "conchars" );
}
if( !con.charsetImage ) {
Com_Error( ERR_FATAL, "Couldn't load pics/conchars.pcx" );
}
- con.conbackImage = ref.RegisterPic( con_background->string );
-
+ con.backImage = ref.RegisterPic( con_background->string );
+ if( !con.backImage && strcmp( con_background->string, "conback" ) ) {
+ Com_WPrintf( "Couldn't load console background: %s\n", con_background->string );
+ con.backImage = ref.RegisterFont( "conback" );
+ }
}
/*
@@ -722,10 +725,9 @@ void Con_DrawSolidConsole( void ) {
// draw the background
if( cls.state != ca_active || ( cls.key_dest & KEY_MENU ) || con_alpha->value ) {
ref.DrawStretchPic( 0, vislines - con.vidHeight,
- con.vidWidth, con.vidHeight, con.conbackImage );
+ con.vidWidth, con.vidHeight, con.backImage );
}
-
// draw the text
y = vislines - CON_PRESTEP;
rows = y / CHAR_HEIGHT + 1; // rows of text to draw
@@ -1085,7 +1087,9 @@ void Key_Console( int key ) {
return;
}
- IF_KeyEvent( &con.prompt.inputLine, key );
+ if( IF_KeyEvent( &con.prompt.inputLine, key ) ) {
+ Prompt_ClearState( &con.prompt );
+ }
scroll:
if( con_scroll->integer & 1 ) {
@@ -1124,6 +1128,16 @@ void Key_Message( int key ) {
return;
}
+ if( key == 'r' && Key_IsDown( K_CTRL ) ) {
+ Prompt_CompleteHistory( &con.chatPrompt, qfalse );
+ return;
+ }
+
+ if( key == 's' && Key_IsDown( K_CTRL ) ) {
+ Prompt_CompleteHistory( &con.chatPrompt, qtrue );
+ return;
+ }
+
if( key == K_UPARROW || ( key == 'p' && Key_IsDown( K_CTRL ) ) ) {
Prompt_HistoryUp( &con.chatPrompt );
return;
@@ -1134,7 +1148,9 @@ void Key_Message( int key ) {
return;
}
- IF_KeyEvent( &con.chatPrompt.inputLine, key );
+ if( IF_KeyEvent( &con.chatPrompt.inputLine, key ) ) {
+ Prompt_ClearState( &con.chatPrompt );
+ }
}
void Char_Message( int key ) {
diff --git a/source/cl_draw.c b/source/cl_draw.c
index eed8b0a..338fb9b 100644
--- a/source/cl_draw.c
+++ b/source/cl_draw.c
@@ -61,324 +61,6 @@ void SCR_LoadingString( const char *string ) {
/*
===============================================================================
-STAT PROGRAMS TO TEXT
-
-===============================================================================
-*/
-
-#define TH_WIDTH 80
-#define TH_HEIGHT 40
-
-static void TH_DrawString( char *dst, int x, int y, char *src, size_t len ) {
- int c;
-
- if( x + len > TH_WIDTH ) {
- len = TH_WIDTH - x;
- }
-
- dst += y * ( TH_WIDTH + 1 ) + x;
- while( len-- ) {
- c = *src++;
- c &= 127;
- switch( c ) {
- case 16: c = '['; break;
- case 17: c = ']'; break;
- case 29: c = '<'; break;
- case 30: c = '='; break;
- case 31: c = '>'; break;
- default:
- if( c < 32 ) {
- c = 32;
- }
- break;
- }
- *dst++ = c;
- }
-}
-
-static void TH_DrawCenterString( char *dst, int x, int y, char *src, size_t len ) {
- x -= len / 2;
- if( x < 0 ) {
- src -= x;
- x = 0;
- }
-
- TH_DrawString( dst, x, y, src, len );
-}
-
-static void TH_DrawNumber( char *dst, int x, int y, int width, int value ) {
- char num[16];
- int l;
-
- if( width < 1 )
- return;
-
- // draw number string
- if( width > 5 )
- width = 5;
-
- l = Com_sprintf( num, sizeof( num ), "%d", value );
- if( l > width )
- l = width;
- x += width - l;
-
- TH_DrawString( dst, x, y, num, l );
-}
-
-static void TH_DrawLayoutString( char *dst, const char *s ) {
- char buffer[MAX_QPATH];
- int x, y;
- int value;
- char *token;
- size_t len;
- int width, index;
- clientinfo_t *ci;
-
- if( !s[0] )
- return;
-
- x = 0;
- y = 0;
- width = 3;
-
- while( s ) {
- token = COM_Parse( &s );
- if( token[2] == 0 ) {
- if( token[0] == 'x' ) {
- if( token[1] == 'l' ) {
- token = COM_Parse( &s );
- x = atoi( token ) / 8;
- continue;
- }
-
- if( token[1] == 'r' ) {
- token = COM_Parse( &s );
- x = TH_WIDTH + atoi( token ) / 8;
- continue;
- }
-
- if( token[1] == 'v' ) {
- token = COM_Parse( &s );
- x = TH_WIDTH / 2 - 20 + atoi( token ) / 8;
- continue;
- }
- }
-
- if( token[0] == 'y' ) {
- if( token[1] == 't' ) {
- token = COM_Parse( &s );
- y = atoi( token ) / 8;
- continue;
- }
-
- if( token[1] == 'b' ) {
- token = COM_Parse( &s );
- y = TH_HEIGHT + atoi( token ) / 8;
- continue;
- }
-
- if( token[1] == 'v' ) {
- token = COM_Parse( &s );
- y = TH_HEIGHT / 2 - 15 + atoi( token ) / 8;
- continue;
- }
- }
- }
-
- if( !strcmp( token, "pic" ) ) {
- // draw a pic from a stat number
- COM_Parse( &s );
- continue;
- }
-
- if( !strcmp( token, "client" ) ) {
- // draw a deathmatch client block
- int score, ping, time;
-
- token = COM_Parse( &s );
- x = TH_WIDTH / 2 - 20 + atoi( token ) / 8;
- token = COM_Parse( &s );
- y = TH_HEIGHT / 2 - 15 + atoi( token ) / 8;
-
- token = COM_Parse( &s );
- value = atoi( token );
- if( value < 0 || value >= MAX_CLIENTS ) {
- Com_Error( ERR_DROP, "%s: invalid client index", __func__ );
- }
- ci = &cl.clientinfo[value];
-
- token = COM_Parse( &s );
- score = atoi( token );
-
- token = COM_Parse( &s );
- ping = atoi( token );
-
- token = COM_Parse( &s );
- time = atoi( token );
-
- len = strlen( ci->name );
- TH_DrawString( dst, x + 4, y, ci->name, len );
- len = Com_sprintf( buffer, sizeof( buffer ), "Score: %i", score );
- TH_DrawString( dst, x + 4, y + 1, buffer, len );
- len = Com_sprintf( buffer, sizeof( buffer ), "Ping: %i", ping );
- TH_DrawString( dst, x + 4, y + 2, buffer, len );
- len = Com_sprintf( buffer, sizeof( buffer ), "Time: %i", time );
- TH_DrawString( dst, x + 4, y + 3, buffer, len );
- continue;
- }
-
- if( !strcmp( token, "ctf" ) ) {
- // draw a ctf client block
- int score, ping;
-
- token = COM_Parse( &s );
- x = TH_WIDTH / 2 - 20 + atoi( token ) / 8;
- token = COM_Parse( &s );
- y = TH_HEIGHT / 2 - 15 + atoi( token ) / 8;
-
- token = COM_Parse( &s );
- value = atoi( token );
- if( value < 0 || value >= MAX_CLIENTS ) {
- Com_Error( ERR_DROP, "%s: invalid client index", __func__ );
- }
- ci = &cl.clientinfo[value];
-
- token = COM_Parse( &s );
- score = atoi( token );
-
- token = COM_Parse( &s );
- ping = atoi( token );
- if( ping > 999 )
- ping = 999;
-
- len = Com_sprintf( buffer, sizeof( buffer ), "%3d %3d %-12.12s",
- score, ping, ci->name );
- TH_DrawString( dst, x, y, buffer, len );
- continue;
- }
-
- if( !strcmp( token, "picn" ) ) {
- // draw a pic from a name
- COM_Parse( &s );
- continue;
- }
-
- if( !strcmp( token, "num" ) ) {
- // draw a number
- token = COM_Parse( &s );
- width = atoi( token );
- token = COM_Parse( &s );
- value = atoi( token );
- if( value < 0 || value >= MAX_STATS ) {
- Com_Error( ERR_DROP, "%s: invalid stat index", __func__ );
- }
- value = cl.frame.ps.stats[value];
- TH_DrawNumber( dst, x, y, width, value );
- continue;
- }
-
- if( !strcmp( token, "stat_string" ) ) {
- token = COM_Parse( &s );
- index = atoi( token );
- if( index < 0 || index >= MAX_STATS ) {
- Com_Error( ERR_DROP, "%s: invalid string index", __func__ );
- }
- index = cl.frame.ps.stats[index];
- if( index < 0 || index >= MAX_CONFIGSTRINGS ) {
- Com_Error( ERR_DROP, "%s: invalid string index", __func__ );
- }
- len = strlen( cl.configstrings[index] );
- TH_DrawString( dst, x, y, cl.configstrings[index], len );
- continue;
- }
-
- if( !strncmp( token, "cstring", 7 ) ) {
- token = COM_Parse( &s );
- len = strlen( token );
- TH_DrawCenterString( dst, x + 40 / 2, y, token, len );
- continue;
- }
-
- if( !strncmp( token, "string", 6 ) ) {
- token = COM_Parse( &s );
- len = strlen( token );
- TH_DrawString( dst, x, y, token, len );
- continue;
- }
-
- if( !strcmp( token, "if" ) ) {
- token = COM_Parse( &s );
- value = atoi( token );
- if( value < 0 || value >= MAX_STATS ) {
- Com_Error( ERR_DROP, "%s: invalid stat index", __func__ );
- }
- value = cl.frame.ps.stats[value];
- if( !value ) { // skip to endif
- while( strcmp( token, "endif" ) ) {
- token = COM_Parse( &s );
- if( !s ) {
- break;
- }
- }
- }
- continue;
- }
- }
-}
-
-static void SCR_ScoreShot_f( void ) {
- char buffer[( TH_WIDTH + 1 ) * TH_HEIGHT];
- char path[MAX_QPATH];
- fileHandle_t f;
- int i;
-
- if( cls.state != ca_active ) {
- Com_Printf( "Must be in a level.\n" );
- return;
- }
-
- if( Cmd_Argc() > 1 ) {
- Q_concat( path, sizeof( path ), SCORESHOTS_DIRECTORY "/", Cmd_Argv( 1 ), NULL );
- COM_AppendExtension( path, ".txt", sizeof( path ) );
- } else {
- for( i = 0; i < 1000; i++ ) {
- Com_sprintf( path, sizeof( path ), SCORESHOTS_DIRECTORY "/quake%03d.txt", i );
- if( FS_LoadFileEx( path, NULL, FS_PATH_GAME ) == INVALID_LENGTH ) {
- break; // file doesn't exist
- }
- }
-
- if( i == 1000 ) {
- Com_Printf( "All scoreshot slots are full.\n" );
- return;
- }
- }
-
- FS_FOpenFile( path, &f, FS_MODE_WRITE );
- if( !f ) {
- Com_EPrintf( "Couldn't open %s for writing.\n", path );
- return;
- }
-
- memset( buffer, ' ', sizeof( buffer ) );
- for( i = 0; i < TH_HEIGHT; i++ ) {
- buffer[ i * ( TH_WIDTH + 1 ) + TH_WIDTH ] = '\n';
- }
-
- TH_DrawLayoutString( buffer, cl.configstrings[CS_STATUSBAR] );
- TH_DrawLayoutString( buffer, cl.layout );
-
- FS_Write( buffer, sizeof( buffer ), f );
-
- FS_FCloseFile( f );
-
- Com_Printf( "Wrote %s.\n", path );
-}
-
-
-/*
-===============================================================================
-
LAGOMETER
===============================================================================
@@ -467,16 +149,13 @@ DRAW OBJECTS
typedef struct {
list_t entry;
int x, y;
- //int type;
- //union {
- cvar_t *cvar;
- cmd_macro_t *macro;
- // int stat;
- //};
- unsigned color;
+ cvar_t *cvar;
+ cmd_macro_t *macro;
+ int flags;
+ color_t color;
} drawobj_t;
-static list_t scr_objects;
+static LIST_DECL( scr_objects );
static void SCR_Color_g( genctx_t *ctx ) {
int color;
@@ -504,7 +183,8 @@ static void SCR_Draw_f( void ) {
drawobj_t *obj;
cmd_macro_t *macro;
// int stat;
- int color = COLOR_RESET;
+ color_t color = { 0, 0, 0, 0 };
+ int flags = UI_IGNORECOLOR;
int argc = Cmd_Argc();
if( argc == 1 ) {
@@ -528,46 +208,37 @@ static void SCR_Draw_f( void ) {
s = Cmd_Argv( 1 );
x = atoi( Cmd_Argv( 2 ) );
+ if( x < 0 ) {
+ flags |= UI_RIGHT;
+ }
y = atoi( Cmd_Argv( 3 ) );
if( argc > 4 ) {
c = Cmd_Argv( 4 );
- for( color = 0; color < 10; color++ ) {
- if( !strcmp( colorNames[color], c ) ) {
- break;
+ if( !strcmp( c, "alt" ) ) {
+ flags |= UI_ALTCOLOR;
+ } else {
+ if( !COM_ParseColor( c, color ) ) {
+ Com_Printf( "Unknown color '%s'\n", c );
+ return;
}
- }
- if( color == 10 ) {
- Com_Printf( "Unknown color '%s'\n", c );
- return;
+ flags &= ~UI_IGNORECOLOR;
}
}
obj = Z_Malloc( sizeof( *obj ) );
obj->x = x;
obj->y = y;
- obj->color = color;
+ obj->flags = flags;
+ *( uint32_t * )obj->color = *( uint32_t * )color;
-#if 0
- if( *s == '!' || *s == '#' ) {
- stat = atoi( s + 1 );
- if( stat < 0 || stat >= MAX_STATS ) {
- Com_Printf( "Invalid stat index: %d\n", stat );
- }
- obj->stat = stat;
+ macro = Cmd_FindMacro( s );
+ if( macro ) {
obj->cvar = NULL;
+ obj->macro = macro;
+ } else {
+ obj->cvar = Cvar_Get( s, NULL, CVAR_USER_CREATED );
obj->macro = NULL;
- } else
-#endif
- {
- macro = Cmd_FindMacro( s );
- if( macro ) {
- obj->cvar = NULL;
- obj->macro = macro;
- } else {
- obj->cvar = Cvar_Get( s, NULL, CVAR_USER_CREATED );
- obj->macro = NULL;
- }
}
List_Append( &scr_objects, &obj->entry );
@@ -646,30 +317,26 @@ static void SCR_UnDraw_f( void ) {
static void draw_objects( void ) {
char buffer[MAX_QPATH];
- int x, y, flags;
+ int x, y;
drawobj_t *obj;
LIST_FOR_EACH( drawobj_t, obj, &scr_objects, entry ) {
x = obj->x;
y = obj->y;
- flags = 0;
if( x < 0 ) {
x += scr_hudWidth + 1;
- flags |= UI_RIGHT;
}
if( y < 0 ) {
y += scr_hudHeight - CHAR_HEIGHT + 1;
}
- if( obj->color == 8 ) {
- flags |= UI_ALTCOLOR;
- } else if( obj->color < 8 ) {
- ref.SetColor( DRAW_COLOR_RGB, colorTable[obj->color] );
+ if( !( obj->flags & UI_IGNORECOLOR ) ) {
+ ref.SetColor( DRAW_COLOR_RGBA, obj->color );
}
if( obj->macro ) {
obj->macro->function( buffer, sizeof( buffer ) );
- SCR_DrawString( x, y, flags, buffer );
+ SCR_DrawString( x, y, obj->flags, buffer );
} else {
- SCR_DrawString( x, y, flags, obj->cvar->string );
+ SCR_DrawString( x, y, obj->flags, obj->cvar->string );
}
ref.SetColor( DRAW_COLOR_CLEAR, NULL );
}
@@ -970,13 +637,12 @@ void SCR_Draw2D( void ) {
}
}
-cmdreg_t scr_drawcmds[] = {
+static const cmdreg_t scr_drawcmds[] = {
#if USE_CHATHUD
{ "clearchat", SCR_ClearChatHUD_f },
#endif
{ "draw", SCR_Draw_f, SCR_Draw_c },
{ "undraw", SCR_UnDraw_f, SCR_UnDraw_c },
- { "scoreshot", SCR_ScoreShot_f },
{ NULL }
};
@@ -986,8 +652,6 @@ SCR_InitDraw
================
*/
void SCR_InitDraw( void ) {
- List_Init( &scr_objects );
-
scr_draw2d = Cvar_Get( "scr_draw2d", "2", 0 );
scr_showturtle = Cvar_Get( "scr_showturtle", "1", 0 );
scr_showfollowing = Cvar_Get( "scr_showfollowing", "1", 0 );
@@ -1001,3 +665,8 @@ void SCR_InitDraw( void ) {
Cmd_Register( scr_drawcmds );
}
+void SCR_ShutdownDraw( void ) {
+ Cmd_Deregister( scr_drawcmds );
+}
+
+
diff --git a/source/cl_fx.c b/source/cl_fx.c
index f959ff9..5336ba2 100644
--- a/source/cl_fx.c
+++ b/source/cl_fx.c
@@ -1682,27 +1682,35 @@ void CL_OldRailTrail (vec3_t start, vec3_t end)
}
}
+static color_t railcore_color;
+static color_t railspiral_color;
-void CL_RailTrail( vec3_t start, vec3_t end ) {
- vec3_t move;
- vec3_t vec;
- float len;
- int j;
- cparticle_t *p;
-// float dec;
- vec3_t right, up;
- int i;
- float d, c, s;
- vec3_t dir;
- laser_t *l;
- color_t color;
+static cvar_t *cl_railtrail_type;
+static cvar_t *cl_railtrail_time;
+static cvar_t *cl_railcore_color;
+static cvar_t *cl_railcore_width;
+static cvar_t *cl_railspiral_color;
+static cvar_t *cl_railspiral_radius;
- if( !cl_railtrail_type->integer || scr_glconfig.renderer == GL_RENDERER_SOFTWARE ) {
- CL_OldRailTrail( start, end );
- return;
- }
- if( !( l = CL_AllocLaser() ) ) {
+static void cl_railcore_color_changed( cvar_t *self ) {
+ if( !COM_ParseColor( self->string, railcore_color ) ) {
+ Com_WPrintf( "Invalid value '%s' for '%s'\n", self->string, self->name );
+ *( uint32_t *)railcore_color = *( uint32_t * )colorRed;
+ }
+}
+
+static void cl_railspiral_color_changed( cvar_t *self ) {
+ if( !COM_ParseColor( self->string, railspiral_color ) ) {
+ Com_WPrintf( "Invalid value '%s' for '%s'\n", self->string, self->name );
+ *( uint32_t *)railspiral_color = *( uint32_t * )colorBlue;
+ }
+}
+
+static void CL_NewRailCore( vec3_t start, vec3_t end ) {
+ laser_t *l = CL_AllocLaser();
+
+ if( !l ) {
return;
}
@@ -1712,58 +1720,68 @@ void CL_RailTrail( vec3_t start, vec3_t end ) {
l->lifeTime = 1000 * cl_railtrail_time->value;
l->indexed = qfalse;
l->width = cl_railcore_width->value;
+ *( uint32_t * )l->color = *( uint32_t * )railcore_color;
+}
- l->color[0] = ( cl_railcore_color->integer >> 16 ) & 0xff;
- l->color[1] = ( cl_railcore_color->integer >> 8 ) & 0xff;
- l->color[2] = ( cl_railcore_color->integer ) & 0xff;
- l->color[3] = 255 * cl_railtrail_alpha->value;
-
- color[0] = ( cl_railspiral_color->integer >> 16 ) & 0xff;
- color[1] = ( cl_railspiral_color->integer >> 8 ) & 0xff;
- color[2] = ( cl_railspiral_color->integer ) & 0xff;
- color[3] = 255;
-
- VectorCopy( start, move );
- VectorSubtract( end, start, vec );
- len = VectorNormalize( vec );
-
- MakeNormalVectors( vec, right, up );
-
- if( cl_railtrail_type->integer > 1 ) {
- for( i=0 ; i<len ; i++ ) {
- if( !free_particles )
- return;
-
- p = free_particles;
- free_particles = p->next;
- p->next = active_particles;
- active_particles = p;
-
- p->time = cl.time;
- VectorClear( p->accel );
-
- d = i * 0.1;
- c = cos( d );
- s = sin( d );
-
- VectorScale( right, c, dir );
- VectorMA( dir, s, up, dir );
-
- p->alpha = cl_railtrail_alpha->value;
- p->alphavel = -1.0 / ( cl_railtrail_time->value + frand() * 0.2 );
- p->color = 0xff;
- *( uint32_t * )p->rgb = *( uint32_t * )color;
- for( j=0 ; j<3 ; j++ ) {
- p->org[j] = move[j] + dir[j] * cl_railspiral_radius->value;
- p->vel[j] = dir[j] * 6;
- }
+static void CL_NewRailSpiral( vec3_t start, vec3_t end ) {
+ vec3_t move;
+ vec3_t vec;
+ float len;
+ int j;
+ cparticle_t *p;
+// float dec;
+ vec3_t right, up;
+ int i;
+ float d, c, s;
+ vec3_t dir;
- VectorAdd( move, vec, move );
- }
- }
-
+ VectorCopy( start, move );
+ VectorSubtract( end, start, vec );
+ len = VectorNormalize( vec );
+
+ MakeNormalVectors( vec, right, up );
+
+ for( i=0 ; i<len ; i++ ) {
+ if( !free_particles )
+ return;
+
+ p = free_particles;
+ free_particles = p->next;
+ p->next = active_particles;
+ active_particles = p;
+
+ p->time = cl.time;
+ VectorClear( p->accel );
+
+ d = i * 0.1;
+ c = cos( d );
+ s = sin( d );
+
+ VectorScale( right, c, dir );
+ VectorMA( dir, s, up, dir );
+
+ p->alpha = railspiral_color[3] / 255.0f;
+ p->alphavel = -1.0 / ( cl_railtrail_time->value + frand() * 0.2 );
+ p->color = 0xff;
+ *( uint32_t * )p->rgb = *( uint32_t * )railspiral_color;
+ for( j=0 ; j<3 ; j++ ) {
+ p->org[j] = move[j] + dir[j] * cl_railspiral_radius->value;
+ p->vel[j] = dir[j] * 6;
+ }
+
+ VectorAdd( move, vec, move );
+ }
+}
-
+void CL_RailTrail( vec3_t start, vec3_t end ) {
+ if( !cl_railtrail_type->integer || scr_glconfig.renderer == GL_RENDERER_SOFTWARE ) {
+ CL_OldRailTrail( start, end );
+ } else {
+ CL_NewRailCore( start, end );
+ if( cl_railtrail_type->integer > 1 ) {
+ CL_NewRailSpiral( start, end );
+ }
+ }
}
@@ -2385,3 +2403,19 @@ void CL_ClearEffects (void)
CL_ClearDlights ();
CL_ClearLightStyles ();
}
+
+void CL_InitEffects( void ) {
+ cl_railtrail_type = Cvar_Get( "cl_railtrail_type", "0", 0 );
+ cl_railtrail_time = Cvar_Get( "cl_railtrail_time", "1.0", 0 );
+ cl_railcore_color = Cvar_Get( "cl_railcore_color", "red", 0 );
+ cl_railcore_color->changed = cl_railcore_color_changed;
+ cl_railcore_color->generator = Com_Color_g;
+ cl_railcore_color_changed( cl_railcore_color );
+ cl_railcore_width = Cvar_Get( "cl_railcore_width", "2", 0 );
+ cl_railspiral_color = Cvar_Get( "cl_railspiral_color", "blue", 0 );
+ cl_railspiral_color->changed = cl_railspiral_color_changed;
+ cl_railspiral_color->generator = Com_Color_g;
+ cl_railspiral_color_changed( cl_railspiral_color );
+ cl_railspiral_radius = Cvar_Get( "cl_railspiral_radius", "3", 0 );
+}
+
diff --git a/source/cl_input.c b/source/cl_input.c
index bfbd8e8..77184f6 100644
--- a/source/cl_input.c
+++ b/source/cl_input.c
@@ -68,23 +68,23 @@ typedef struct inputDriver_s {
void (*FillAPI)( inputAPI_t *api );
} inputDriver_t;
-#ifdef USE_DINPUT
+#if USE_DINPUT
void DI_FillAPI( inputAPI_t *api );
#endif
-#ifdef USE_EVDEV
+#if USE_EVDEV
void Evdev_FillAPI( inputAPI_t *api );
#endif
static inputDriver_t in_driverTable[] = {
- /* fallback driver should be present on all systems */
+ // fallback driver should be present on all systems
{ "video", Video_FillInputAPI },
/* DirectInput driver */
-#ifdef USE_DINPUT
+#if USE_DINPUT
{ "dinput", DI_FillAPI },
#endif
-#ifdef USE_EVDEV
+#if USE_EVDEV
{ "evdev", Evdev_FillAPI },
#endif
};
diff --git a/source/cl_keys.c b/source/cl_keys.c
index 166146b..4539bb6 100644
--- a/source/cl_keys.c
+++ b/source/cl_keys.c
@@ -56,7 +56,7 @@ typedef struct keyname_s {
int keynum;
} keyname_t;
-static keyname_t keynames[] = {
+static const keyname_t keynames[] = {
{"TAB", K_TAB},
{"ENTER", K_ENTER},
{"ESCAPE", K_ESCAPE},
@@ -273,7 +273,7 @@ the K_* names are matched up.
===================
*/
int Key_StringToKeynum( const char *str ) {
- keyname_t *kn;
+ const keyname_t *kn;
if( !str || !str[0] )
return -1;
@@ -297,8 +297,8 @@ FIXME: handle quote special (general escape sequence?)
===================
*/
char *Key_KeynumToString( int keynum ) {
- keyname_t *kn;
- static char tinystr[2];
+ const keyname_t *kn;
+ static char tinystr[2];
if( keynum == -1 )
return "<KEY NOT FOUND>";
@@ -309,7 +309,7 @@ char *Key_KeynumToString( int keynum ) {
return tinystr;
}
- for( kn=keynames ; kn->name ; kn++ )
+ for( kn = keynames; kn->name; kn++ )
if( keynum == kn->keynum )
return kn->name;
@@ -366,7 +366,7 @@ void Key_SetBinding( int keynum, const char *binding ) {
if( keynum < 0 || keynum > 255 )
return;
-// free old bindings
+// free old binding
if( keybindings[keynum] ) {
Z_Free( keybindings[keynum] );
}
@@ -376,15 +376,29 @@ void Key_SetBinding( int keynum, const char *binding ) {
}
static void Key_Name_g( genctx_t *ctx ) {
- keyname_t *k;
+ const keyname_t *k;
+ ctx->ignorecase = qtrue;
for( k = keynames; k->name; k++ ) {
- if( !Prompt_AddMatchCase( ctx, k->name ) ) {
+ if( !Prompt_AddMatch( ctx, k->name ) ) {
break;
}
}
}
+static void Key_Bound_g( genctx_t *ctx ) {
+ int i;
+
+ ctx->ignorecase = qtrue;
+ for( i = 0; i < 256; i++ ) {
+ if( keybindings[i] ) {
+ if( !Prompt_AddMatch( ctx, Key_KeynumToString( i ) ) ) {
+ break;
+ }
+ }
+ }
+}
+
static void Key_Bind_c( genctx_t *ctx, int argnum ) {
if( argnum == 1 ) {
Key_Name_g( ctx );
@@ -395,7 +409,7 @@ static void Key_Bind_c( genctx_t *ctx, int argnum ) {
static void Key_Unbind_c( genctx_t *ctx, int argnum ) {
if( argnum == 1 ) {
- Key_Name_g( ctx );
+ Key_Bound_g( ctx );
}
}
diff --git a/source/cl_local.h b/source/cl_local.h
index 6baaf50..9b57cef 100644
--- a/source/cl_local.h
+++ b/source/cl_local.h
@@ -316,14 +316,6 @@ extern cvar_t *cl_showclamp;
extern cvar_t *cl_vwep;
-extern cvar_t *cl_railtrail_type;
-extern cvar_t *cl_railtrail_time;
-extern cvar_t *cl_railtrail_alpha;
-extern cvar_t *cl_railcore_color;
-extern cvar_t *cl_railcore_width;
-extern cvar_t *cl_railspiral_color;
-extern cvar_t *cl_railspiral_radius;
-
extern cvar_t *cl_disable_particles;
extern cvar_t *cl_disable_explosions;
@@ -434,6 +426,7 @@ typedef struct cparticle_s
// PGM
// ========
+void CL_InitEffects (void);
void CL_ClearEffects (void);
void CL_ClearTEnts (void);
void CL_BlasterTrail (vec3_t start, vec3_t end);
@@ -541,7 +534,8 @@ void CL_DeltaFrame( void );
extern int gun_frame;
extern qhandle_t gun_model;
-void V_Init (void);
+void V_Init( void );
+void V_Shutdown( void );
void V_RenderView( void );
void V_AddEntity (entity_t *ent);
void V_AddParticle( particle_t *p );
@@ -632,7 +626,7 @@ void Con_ClearNotify_f( void );
void Con_ToggleConsole_f (void);
void Con_Close( void );
void Con_SkipNotify( qboolean skip );
-void Con_SetupDC( void );
+void Con_RegisterMedia( void );
void Key_Console( int key );
void Key_Message( int key );
@@ -672,6 +666,7 @@ extern int scr_hudWidth;
extern int scr_hudHeight;
void SCR_Init (void);
+void SCR_Shutdown( void );
void SCR_UpdateScreen (void);
void SCR_SizeUp( void );
void SCR_SizeDown( void );
@@ -703,6 +698,7 @@ void SCR_FinishCinematic( void );
// cl_draw.c
//
void SCR_InitDraw( void );
+void SCR_ShutdownDraw( void );
void SCR_Draw2D( void );
void SCR_LoadingString( const char *string );
float SCR_FadeAlpha( unsigned startTime, unsigned visTime, unsigned fadeTime );
@@ -739,6 +735,10 @@ int Key_EnumBindings( int key, const char *binding );
void Key_FillAPI( keyAPI_t *api );
+//
+// cl_aastat.c
+//
+void CL_InitAscii( void );
diff --git a/source/cl_locs.c b/source/cl_locs.c
index d17897a..cb5b8c9 100644
--- a/source/cl_locs.c
+++ b/source/cl_locs.c
@@ -30,7 +30,7 @@ typedef struct {
char name[1];
} location_t;
-static list_t cl_locations = { &cl_locations, &cl_locations };
+static LIST_DECL( cl_locations );
static cvar_t *loc_draw;
static cvar_t *loc_trace;
diff --git a/source/cl_main.c b/source/cl_main.c
index 39202e8..6ddf6f2 100644
--- a/source/cl_main.c
+++ b/source/cl_main.c
@@ -58,14 +58,6 @@ cvar_t *cl_thirdperson;
cvar_t *cl_thirdperson_angle;
cvar_t *cl_thirdperson_range;
-cvar_t *cl_railtrail_type;
-cvar_t *cl_railtrail_time;
-cvar_t *cl_railtrail_alpha;
-cvar_t *cl_railcore_color;
-cvar_t *cl_railcore_width;
-cvar_t *cl_railspiral_color;
-cvar_t *cl_railspiral_radius;
-
cvar_t *cl_disable_particles;
cvar_t *cl_disable_explosions;
cvar_t *cl_chat_notify;
@@ -1559,6 +1551,22 @@ static void CL_Snd_Restart_f ( void ) {
CL_RegisterSounds ();
}
+static void CL_RegisterModels( void ) {
+ int i;
+ char *name;
+
+ for ( i = 1; i < MAX_MODELS; i++ ) {
+ name = cl.configstrings[CS_MODELS+i];
+ if( !name[0] ) {
+ break;
+ }
+ if( name[0] == '*' )
+ cl.model_clip[i] = CM_InlineModel( &cl.cm, name );
+ else
+ cl.model_clip[i] = NULL;
+ }
+}
+
static int precache_check; // for autodownload of precache items
static int precache_spawncount;
static int precache_tex;
@@ -1843,6 +1851,7 @@ void CL_RequestNextDownload ( void ) {
SCR_LoadingString( "sounds" );
CL_RegisterSounds ();
+ CL_RegisterModels();
CL_PrepRefresh ();
LOC_LoadLocations();
@@ -1887,6 +1896,7 @@ static void CL_Precache_f( void ) {
CM_LOAD_CLIENT, &map_checksum );
SCR_LoadingString( "sounds" );
CL_RegisterSounds();
+ CL_RegisterModels();
CL_PrepRefresh();
cls.state = ca_precached;
return;
@@ -2181,20 +2191,25 @@ void CL_RestartFilesystem( void ) {
S_StopAllSounds();
S_FreeAllSounds();
- ref.Shutdown( qfalse );
+ if( cls.ref_initialized ) {
+ ref.Shutdown( qfalse );
- FS_Restart();
+ FS_Restart();
- ref.Init( qfalse );
+ ref.Init( qfalse );
- SCR_RegisterMedia();
- Con_SetupDC();
- CL_InitUI();
+ SCR_RegisterMedia();
+ Con_RegisterMedia();
+ CL_InitUI();
+ } else {
+ FS_Restart();
+ }
if ( cls_state == ca_disconnected ) {
UI_OpenMenu( UIMENU_MAIN );
} else if ( cls_state >= ca_loading ) {
CL_RegisterSounds();
+ CL_RegisterModels();
CL_PrepRefresh();
}
@@ -2211,6 +2226,10 @@ CL_RestartRefresh
static void CL_RestartRefresh_f( void ) {
int cls_state;
+ if( !cls.ref_initialized ) {
+ return;
+ }
+
// temporary switch to loading state
cls_state = cls.state;
if ( cls.state >= ca_precached ) {
@@ -2228,10 +2247,6 @@ static void CL_RestartRefresh_f( void ) {
CL_InitRefresh();
CL_InitInput();
- SCR_RegisterMedia();
- Con_SetupDC();
- CL_InitUI();
-
if ( cls_state == ca_disconnected ) {
UI_OpenMenu( UIMENU_MAIN );
} else if ( cls_state >= ca_loading ) {
@@ -2353,15 +2368,14 @@ static void CL_InitLocal ( void ) {
int i;
cls.state = ca_disconnected;
- cls.realtime = 0xffffffff-15*1000;
CL_FillAPI( &client );
CL_RegisterInput();
-
CL_InitDemos();
-
LOC_Init();
+ CL_InitAscii();
+ CL_InitEffects();
Cmd_Register( c_client );
@@ -2403,14 +2417,6 @@ static void CL_InitLocal ( void ) {
cl_thirdperson_angle = Cvar_Get( "cl_thirdperson_angle", "0", 0 );
cl_thirdperson_range = Cvar_Get( "cl_thirdperson_range", "60", 0 );
- cl_railtrail_type = Cvar_Get( "cl_railtrail_type", "0", 0 );
- cl_railtrail_time = Cvar_Get( "cl_railtrail_time", "1.0", 0 );
- cl_railtrail_alpha = Cvar_Get( "cl_railtrail_alpha", "1.0", 0 );
- cl_railcore_color = Cvar_Get( "cl_railcore_color", "0xFF0000", 0 );
- cl_railcore_width = Cvar_Get( "cl_railcore_width", "2", 0 );
- cl_railspiral_color = Cvar_Get( "cl_railspiral_color", "0x0000FF", 0 );
- cl_railspiral_radius = Cvar_Get( "cl_railspiral_radius", "3", 0 );
-
cl_disable_particles = Cvar_Get( "cl_disable_particles", "0", 0 );
cl_disable_explosions = Cvar_Get( "cl_disable_explosions", "0", 0 );
cl_gibs = Cvar_Get( "cl_gibs", "1", 0 );
@@ -2815,13 +2821,8 @@ void CL_Init( void ) {
CL_InitRefresh();
#endif
- V_Init();
- SCR_Init();
CL_InitLocal();
CL_InitInput();
- SCR_RegisterMedia();
- Con_SetupDC();
- CL_InitUI();
#if USE_ZLIB
if( inflateInit2( &cls.z, -15 ) != Z_OK ) {
diff --git a/source/cl_parse.c b/source/cl_parse.c
index 63ecb31..32a01b0 100644
--- a/source/cl_parse.c
+++ b/source/cl_parse.c
@@ -920,6 +920,8 @@ static void CL_ParseServerData( void ) {
Con_Printf( "\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n" );
Con_Printf( S_COLOR_ALT "%s\n\n", str );
+ Sys_Printf( "\n\n%s\n", str );
+
// make sure clientNum is in range
if( cl.clientNum < 0 || cl.clientNum >= MAX_CLIENTS ) {
cl.clientNum = CLIENTNUM_NONE;
@@ -970,103 +972,97 @@ void CL_LoadClientinfo( clientinfo_t *ci, char *s ) {
s = t + 1;
}
- if( cl_noskins->integer || *s == 0 ) {
-noskin:
- strcpy( model_filename, "players/male/tris.md2" );
- strcpy( weapon_filename, "players/male/weapon.md2" );
- strcpy( skin_filename, "players/male/grunt.pcx" );
- strcpy( icon_filename, "/players/male/grunt_i.pcx" );
- ci->model = ref.RegisterModel( model_filename );
- for( i = 0; i < cl.numWeaponModels; i++ ) {
- Q_concat( weapon_filename, sizeof( weapon_filename ),
- "players/male/", cl.weaponModels[i], NULL );
- ci->weaponmodel[i] = ref.RegisterModel( weapon_filename );
- }
- ci->skin = ref.RegisterSkin( skin_filename );
- ci->icon = ref.RegisterPic( icon_filename );
- strcpy( ci->model_name, "male" );
- } else {
- strcpy( model_name, s );
-
- // isolate the model name
- t = strchr( model_name, '/' );
- if( !t )
- t = strchr( model_name, '\\' );
- if( !t )
- t = model_name;
- if( t == model_name ) {
- goto noskin;
- }
- *t = 0;
-
- // isolate the skin name
- strcpy( skin_name, t + 1 );
-
- // model file
- Q_concat( model_filename, sizeof( model_filename ),
- "players/", model_name, "/tris.md2", NULL );
- ci->model = ref.RegisterModel( model_filename );
- if( !ci->model && Q_stricmp( model_name, "male" ) ) {
- strcpy( model_name, "male" );
- strcpy( model_filename, "players/male/tris.md2" );
- ci->model = ref.RegisterModel( model_filename );
- }
-
- // skin file
- Q_concat( skin_filename, sizeof( skin_filename ),
- "players/", model_name, "/", skin_name, ".pcx", NULL );
- ci->skin = ref.RegisterSkin( skin_filename );
+ strcpy( model_name, s );
+
+ // isolate the model name
+ t = strchr( model_name, '/' );
+ if( !t )
+ t = strchr( model_name, '\\' );
+ if( !t )
+ t = model_name;
+ if( t == model_name ) {
+ strcpy( model_name, "male" );
+ strcpy( skin_name, "grunt" );
+ } else {
+ *t = 0;
- // if we don't have the skin and the model was female,
- // see if athena skin exists
- if( !ci->skin && !Q_stricmp( model_name, "female" ) ) {
+ // apply restictions on skins
+ if( cl_noskins->integer == 2 && !Q_stricmp( model_name, "female" ) ) {
+ strcpy( model_name, "female" );
strcpy( skin_name, "athena" );
- strcpy( skin_filename, "players/female/athena.pcx" );
- ci->skin = ref.RegisterSkin( skin_filename );
+ } else if( cl_noskins->integer ) {
+ strcpy( model_name, "male" );
+ strcpy( skin_name, "grunt" );
+ } else {
+ // isolate the skin name
+ strcpy( skin_name, t + 1 );
}
+ }
- // if we don't have the skin and the model wasn't male,
- // see if the male has it (this is for CTF's skins)
- if( !ci->skin && Q_stricmp( model_name, "male" ) ) {
- // change model to male
- strcpy( model_name, "male" );
- strcpy( model_filename, "players/male/tris.md2" );
- ci->model = ref.RegisterModel( model_filename );
-
- // see if the skin exists for the male model
- Q_concat( skin_filename, sizeof( skin_filename ),
- "players/male/", skin_name, ".pcx", NULL );
- ci->skin = ref.RegisterSkin( skin_filename );
- }
+ // model file
+ Q_concat( model_filename, sizeof( model_filename ),
+ "players/", model_name, "/tris.md2", NULL );
+ ci->model = ref.RegisterModel( model_filename );
+ if( !ci->model && Q_stricmp( model_name, "male" ) ) {
+ strcpy( model_name, "male" );
+ strcpy( model_filename, "players/male/tris.md2" );
+ ci->model = ref.RegisterModel( model_filename );
+ }
- // if we still don't have a skin, it means that the male model
- // didn't have it, so default to grunt
- if( !ci->skin ) {
- // see if the skin exists for the male model
- strcpy( skin_filename, "players/male/grunt.pcx" );
- ci->skin = ref.RegisterSkin( skin_filename );
- }
+ // skin file
+ Q_concat( skin_filename, sizeof( skin_filename ),
+ "players/", model_name, "/", skin_name, ".pcx", NULL );
+ ci->skin = ref.RegisterSkin( skin_filename );
+
+ // if we don't have the skin and the model was female,
+ // see if athena skin exists
+ if( !ci->skin && !Q_stricmp( model_name, "female" ) ) {
+ strcpy( skin_name, "athena" );
+ strcpy( skin_filename, "players/female/athena.pcx" );
+ ci->skin = ref.RegisterSkin( skin_filename );
+ }
- // weapon file
- for( i = 0; i < cl.numWeaponModels; i++ ) {
- Q_concat( weapon_filename, sizeof( weapon_filename ),
- "players/", model_name, "/", cl.weaponModels[i], NULL );
- ci->weaponmodel[i] = ref.RegisterModel( weapon_filename );
- if( !ci->weaponmodel[i] && Q_stricmp( model_name, "male" ) ) {
- // try male
- Q_concat( weapon_filename, sizeof( weapon_filename ),
- "players/male/", cl.weaponModels[i], NULL );
- ci->weaponmodel[i] = ref.RegisterModel( weapon_filename );
- }
- }
+ // if we don't have the skin and the model wasn't male,
+ // see if the male has it (this is for CTF's skins)
+ if( !ci->skin && Q_stricmp( model_name, "male" ) ) {
+ // change model to male
+ strcpy( model_name, "male" );
+ strcpy( model_filename, "players/male/tris.md2" );
+ ci->model = ref.RegisterModel( model_filename );
+
+ // see if the skin exists for the male model
+ Q_concat( skin_filename, sizeof( skin_filename ),
+ "players/male/", skin_name, ".pcx", NULL );
+ ci->skin = ref.RegisterSkin( skin_filename );
+ }
+
+ // if we still don't have a skin, it means that the male model
+ // didn't have it, so default to grunt
+ if( !ci->skin ) {
+ // see if the skin exists for the male model
+ strcpy( skin_filename, "players/male/grunt.pcx" );
+ ci->skin = ref.RegisterSkin( skin_filename );
+ }
+
+ // weapon file
+ for( i = 0; i < cl.numWeaponModels; i++ ) {
+ Q_concat( weapon_filename, sizeof( weapon_filename ),
+ "players/", model_name, "/", cl.weaponModels[i], NULL );
+ ci->weaponmodel[i] = ref.RegisterModel( weapon_filename );
+ if( !ci->weaponmodel[i] && Q_stricmp( model_name, "male" ) ) {
+ // try male
+ Q_concat( weapon_filename, sizeof( weapon_filename ),
+ "players/male/", cl.weaponModels[i], NULL );
+ ci->weaponmodel[i] = ref.RegisterModel( weapon_filename );
+ }
+ }
- // icon file
- Q_concat( icon_filename, sizeof( icon_filename ),
- "/players/", model_name, "/", skin_name, "_i.pcx", NULL );
- ci->icon = ref.RegisterPic( icon_filename );
+ // icon file
+ Q_concat( icon_filename, sizeof( icon_filename ),
+ "/players/", model_name, "/", skin_name, "_i.pcx", NULL );
+ ci->icon = ref.RegisterPic( icon_filename );
- strcpy( ci->model_name, model_name );
- }
+ strcpy( ci->model_name, model_name );
// must have loaded all data types to be valid
if( !ci->skin || !ci->icon || !ci->model || !ci->weaponmodel[0] ) {
diff --git a/source/cl_pred.c b/source/cl_pred.c
index 36e4e9b..f79d3de 100644
--- a/source/cl_pred.c
+++ b/source/cl_pred.c
@@ -109,7 +109,6 @@ static void CL_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3
int i, x, zd, zu;
trace_t trace;
cnode_t *headnode;
- float *angles;
entity_state_t *ent;
cmodel_t *cmodel;
vec3_t bmins, bmaxs;
@@ -123,7 +122,6 @@ static void CL_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3
if (!cmodel)
continue;
headnode = cmodel->headnode;
- angles = ent->angles;
} else {
// encoded bbox
x = 8*(ent->solid & 31);
@@ -136,7 +134,6 @@ static void CL_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3
bmaxs[2] = zu;
headnode = CM_HeadnodeForBox (bmins, bmaxs);
- angles = vec3_origin; // boxes don't rotate
}
if (tr->allsolid)
@@ -144,18 +141,9 @@ static void CL_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3
CM_TransformedBoxTrace (&trace, start, end,
mins, maxs, headnode, MASK_PLAYERSOLID,
- ent->origin, angles);
-
- tr->allsolid |= trace.allsolid;
- tr->startsolid |= trace.startsolid;
- if( trace.fraction < tr->fraction ) {
- tr->fraction = trace.fraction;
- VectorCopy( trace.endpos, tr->endpos );
- tr->plane = trace.plane;
- tr->surface = trace.surface;
- tr->contents |= trace.contents;
- tr->ent = ( struct edict_s * )ent;
- }
+ ent->origin, ent->angles);
+
+ CM_ClipEntity( tr, &trace, ( struct edict_s * )ent );
}
}
diff --git a/source/cl_ref.c b/source/cl_ref.c
index 6fcc92a..bcce301 100644
--- a/source/cl_ref.c
+++ b/source/cl_ref.c
@@ -393,7 +393,7 @@ void CL_InitRefresh( void ) {
Cvar_Set( "_vid_fullscreen", "1" );
}
-#ifdef REF_HARD_LINKED
+#if REF_HARD_LINKED
vid_ref = Cvar_Get( "vid_ref", DEFAULT_REFRESH_DRIVER, CVAR_ROM );
if( !CL_LoadRefresh( "ref_" DEFAULT_REFRESH_DRIVER ) ) {
Com_Error( ERR_FATAL, "Couldn't load built-in video driver!" );
@@ -417,16 +417,22 @@ void CL_InitRefresh( void ) {
Com_Printf( "Falling back to default refresh...\n" );
Cvar_Set( "vid_ref", DEFAULT_REFRESH_DRIVER );
}
-#endif
+ vid_ref->changed = vid_ref_changed;
+#endif
vid_placement->changed = vid_placement_changed;
vid_fullscreen->changed = vid_fullscreen_changed;
vid_modelist->changed = vid_modelist_changed;
-#ifndef REF_HARD_LINKED
- vid_ref->changed = vid_ref_changed;
-#endif
mode_changed = 0;
+
+ // Initialize the rest of graphics subsystems
+ V_Init();
+ SCR_Init();
+ CL_InitUI();
+
+ SCR_RegisterMedia();
+ Con_RegisterMedia();
}
/*
@@ -439,10 +445,15 @@ void CL_ShutdownRefresh( void ) {
return;
}
+ // Shutdown the rest of graphics subsystems
+ V_Shutdown();
+ SCR_Shutdown();
+ CL_ShutdownUI();
+
vid_placement->changed = NULL;
vid_fullscreen->changed = NULL;
vid_modelist->changed = NULL;
-#ifndef REF_HARD_LINKED
+#if !REF_HARD_LINKED
vid_ref->changed = NULL;
#endif
@@ -450,6 +461,7 @@ void CL_ShutdownRefresh( void ) {
CL_FreeRefresh();
Z_LeakTest( TAG_RENDERER );
+
}
diff --git a/source/cl_scrn.c b/source/cl_scrn.c
index 8ec5d46..c36f2b0 100644
--- a/source/cl_scrn.c
+++ b/source/cl_scrn.c
@@ -77,7 +77,6 @@ static qhandle_t sb_field;
#define DIGIT_WIDTH 16
#define ICON_SPACE 8
-void SCR_TimeRefresh_f (void);
void SCR_Loading_f (void);
@@ -102,6 +101,9 @@ void CL_AddNetgraph (void)
int in;
int ping;
+ if (!scr_initialized)
+ return;
+
// if using the debuggraph for something else, don't
// add the net lines
if (scr_debuggraph->integer || scr_timegraph->integer)
@@ -334,12 +336,10 @@ SCR_SizeUp_f
Keybinding command
=================
*/
-void SCR_SizeUp_f (void)
-{
- Cvar_SetInteger("viewsize",scr_viewsize->integer+10);
+static void SCR_SizeUp_f( void ) {
+ Cvar_SetInteger( "viewsize", scr_viewsize->integer + 10 );
}
-
/*
=================
SCR_SizeDown_f
@@ -347,9 +347,8 @@ SCR_SizeDown_f
Keybinding command
=================
*/
-void SCR_SizeDown_f (void)
-{
- Cvar_SetInteger ("viewsize",scr_viewsize->integer-10);
+static void SCR_SizeDown_f( void ) {
+ Cvar_SetInteger( "viewsize", scr_viewsize->integer - 10 );
}
/*
@@ -359,36 +358,68 @@ SCR_Sky_f
Set a specific sky and rotation speed
=================
*/
-void SCR_Sky_f (void)
-{
- float rotate;
- vec3_t axis;
+static void SCR_Sky_f( void ) {
+ float rotate = 0;
+ vec3_t axis = { 0, 0, 1 };
+ int argc = Cmd_Argc();
- if (Cmd_Argc() < 2)
- {
+ if( argc < 2 ) {
Com_Printf ("Usage: sky <basename> [rotate] [axis x y z]\n");
return;
}
- if (Cmd_Argc() > 2)
+
+ if( argc > 2 )
rotate = atof(Cmd_Argv(2));
- else
- rotate = 0;
- if (Cmd_Argc() == 6)
- {
+ if( argc == 6 ) {
axis[0] = atof(Cmd_Argv(3));
axis[1] = atof(Cmd_Argv(4));
axis[2] = atof(Cmd_Argv(5));
}
- else
- {
- axis[0] = 0;
- axis[1] = 0;
- axis[2] = 1;
- }
ref.SetSky (Cmd_Argv(1), rotate, axis);
}
+/*
+================
+SCR_TimeRefresh_f
+================
+*/
+static void SCR_TimeRefresh_f (void) {
+ int i;
+ unsigned start, stop;
+ float time;
+
+ if( cls.state != ca_active ) {
+ Com_Printf( "No map loaded.\n" );
+ return;
+ }
+
+ start = Sys_Milliseconds ();
+
+ if (Cmd_Argc() == 2) {
+ // run without page flipping
+ ref.BeginFrame();
+ for (i=0 ; i<128 ; i++) {
+ cl.refdef.viewangles[1] = i/128.0f*360.0f;
+ ref.RenderFrame (&cl.refdef);
+ }
+ ref.EndFrame();
+ } else {
+ for (i=0 ; i<128 ; i++) {
+ cl.refdef.viewangles[1] = i/128.0f*360.0f;
+
+ ref.BeginFrame();
+ ref.RenderFrame (&cl.refdef);
+ ref.EndFrame();
+ }
+ }
+
+ stop = Sys_Milliseconds();
+ time = (stop-start)*0.001f;
+ Com_Printf ("%f seconds (%f fps)\n", time, 128.0f/time);
+}
+
+
//============================================================================
/*
@@ -447,13 +478,20 @@ static void scr_fontvar_changed( cvar_t *self ) {
scr_font = ref.RegisterFont( self->string );
}
+static const cmdreg_t scr_cmds[] = {
+ { "timerefresh", SCR_TimeRefresh_f },
+ { "sizeup", SCR_SizeUp_f },
+ { "sizedown", SCR_SizeDown_f },
+ { "sky", SCR_Sky_f },
+ { NULL }
+};
+
/*
==================
SCR_Init
==================
*/
-void SCR_Init (void)
-{
+void SCR_Init( void ) {
scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE);
scr_showpause = Cvar_Get ("scr_showpause", "1", 0);
scr_centertime = Cvar_Get ("scr_centertime", "2.5", 0);
@@ -468,25 +506,25 @@ void SCR_Init (void)
scr_fontvar = Cvar_Get( "scr_font", "conchars", CVAR_ARCHIVE );
scr_fontvar->changed = scr_fontvar_changed;
scr_scale = Cvar_Get( "scr_scale", "1", CVAR_ARCHIVE );
+ crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE);
- SCR_InitDraw();
+ Cmd_Register( scr_cmds );
-//
-// register our commands
-//
- Cmd_AddCommand ("timerefresh",SCR_TimeRefresh_f);
- Cmd_AddCommand ("sizeup",SCR_SizeUp_f);
- Cmd_AddCommand ("sizedown",SCR_SizeDown_f);
- Cmd_AddCommand ("sky",SCR_Sky_f);
+ SCR_InitDraw();
- scr_glconfig.vidWidth = 320;
- scr_glconfig.vidHeight = 240;
+ scr_glconfig.vidWidth = 640;
+ scr_glconfig.vidHeight = 480;
scr_initialized = qtrue;
}
+void SCR_Shutdown( void ) {
+ Cmd_Deregister( scr_cmds );
+ SCR_ShutdownDraw();
+ scr_initialized = qfalse;
+}
/*
==============
@@ -534,50 +572,6 @@ void SCR_EndLoadingPlaque( void ) {
Con_ClearNotify_f();
}
-
-/*
-================
-SCR_TimeRefresh_f
-================
-*/
-void SCR_TimeRefresh_f (void)
-{
- int i;
- unsigned start, stop;
- float time;
-
- if( cls.state != ca_active ) {
- Com_Printf( "No map loaded.\n" );
- return;
- }
-
- start = Sys_Milliseconds ();
-
- if (Cmd_Argc() == 2) {
- // run without page flipping
- ref.BeginFrame();
- for (i=0 ; i<128 ; i++) {
- cl.refdef.viewangles[1] = i/128.0f*360.0f;
- ref.RenderFrame (&cl.refdef);
- }
- ref.EndFrame();
- } else {
- for (i=0 ; i<128 ; i++) {
- cl.refdef.viewangles[1] = i/128.0f*360.0f;
-
- ref.BeginFrame();
- ref.RenderFrame (&cl.refdef);
- ref.EndFrame();
- }
- }
-
- stop = Sys_Milliseconds();
- time = (stop-start)*0.001f;
- Com_Printf ("%f seconds (%f fps)\n", time, 128.0f/time);
-}
-
-
-
/*
==============
SCR_TileClear
@@ -585,7 +579,7 @@ SCR_TileClear
Clear any parts of the tiled background that were drawn on last frame
==============
*/
-void SCR_TileClear( void ) {
+static void SCR_TileClear( void ) {
int top, bottom, left, right;
//if( con.currentHeight == 1 )
diff --git a/source/cl_view.c b/source/cl_view.c
index acd3ba4..93d5c95 100644
--- a/source/cl_view.c
+++ b/source/cl_view.c
@@ -56,8 +56,7 @@ V_ClearScene
Specifies the model that will be used as the world
====================
*/
-void V_ClearScene (void)
-{
+static void V_ClearScene (void) {
r_numdlights = 0;
r_numentities = 0;
r_numparticles = 0;
@@ -70,8 +69,7 @@ V_AddEntity
=====================
*/
-void V_AddEntity (entity_t *ent)
-{
+void V_AddEntity (entity_t *ent) {
if (r_numentities >= MAX_ENTITIES)
return;
@@ -85,12 +83,10 @@ V_AddParticle
=====================
*/
-void V_AddParticle( particle_t *p )
-{
+void V_AddParticle( particle_t *p ) {
if (r_numparticles >= MAX_PARTICLES)
return;
r_particles[r_numparticles++] = *p;
-
}
/*
@@ -99,8 +95,7 @@ V_AddLight
=====================
*/
-void V_AddLight (vec3_t org, float intensity, float r, float g, float b)
-{
+void V_AddLight (vec3_t org, float intensity, float r, float g, float b) {
dlight_t *dl;
if (r_numdlights >= MAX_DLIGHTS)
@@ -120,8 +115,7 @@ V_AddLightStyle
=====================
*/
-void V_AddLightStyle (int style, vec4_t value)
-{
+void V_AddLightStyle (int style, vec4_t value) {
lightstyle_t *ls;
if (style < 0 || style > MAX_LIGHTSTYLES)
@@ -142,8 +136,7 @@ V_TestParticles
If cl_testparticles is set, create 4096 particles in the view
================
*/
-void V_TestParticles (void)
-{
+static void V_TestParticles (void) {
particle_t *p;
int i, j;
float d, r, u;
@@ -172,8 +165,7 @@ V_TestEntities
If cl_testentities is set, create 32 player models
================
*/
-void V_TestEntities (void)
-{
+static void V_TestEntities (void) {
int i, j;
float f, r;
entity_t *ent;
@@ -204,8 +196,7 @@ V_TestLights
If cl_testlights is set, create 32 lights models
================
*/
-void V_TestLights (void)
-{
+static void V_TestLights (void) {
int i, j;
float f, r;
dlight_t *dl;
@@ -249,14 +240,16 @@ CL_PrepRefresh
Call before entering a new level, or after changing dlls
=================
*/
-void CL_PrepRefresh (void)
-{
+void CL_PrepRefresh (void) {
int i;
char *name;
float rotate;
vec3_t axis;
unsigned time_start, time_map, time_models, time_clients, time_total;
+ if( !cls.ref_initialized ) {
+ return;
+ }
if (!cl.mapname[0])
return; // no map loaded
@@ -293,10 +286,6 @@ void CL_PrepRefresh (void)
}
} else {
cl.model_draw[i] = ref.RegisterModel( name );
- if( name[0] == '*' )
- cl.model_clip[i] = CM_InlineModel( &cl.cm, name );
- else
- cl.model_clip[i] = NULL;
}
}
time_models = Sys_Milliseconds();
@@ -311,8 +300,7 @@ void CL_PrepRefresh (void)
}
SCR_LoadingString( "clients" );
- for (i=0 ; i<MAX_CLIENTS ; i++)
- {
+ for (i=0 ; i<MAX_CLIENTS ; i++) {
name = cl.configstrings[CS_PLAYERSKINS+i];
if( !name[0] )
continue;
@@ -351,26 +339,22 @@ void CL_PrepRefresh (void)
//============================================================================
// gun frame debugging functions
-void V_Gun_Next_f (void)
-{
+static void V_Gun_Next_f (void) {
gun_frame++;
Com_Printf ("frame %i\n", gun_frame);
}
-void V_Gun_Prev_f (void)
-{
+static void V_Gun_Prev_f (void) {
gun_frame--;
if (gun_frame < 0)
gun_frame = 0;
Com_Printf ("frame %i\n", gun_frame);
}
-void V_Gun_Model_f (void)
-{
+static void V_Gun_Model_f (void) {
char name[MAX_QPATH];
- if (Cmd_Argc() != 2)
- {
+ if (Cmd_Argc() != 2) {
gun_model = 0;
return;
}
@@ -395,7 +379,7 @@ static int QDECL entitycmpfnc( const entity_t *a, const entity_t *b )
}
}
-void V_SetLightLevel( void ) {
+static void V_SetLightLevel( void ) {
vec3_t shadelight;
// save off light value for server to look at (BIG HACK!)
@@ -509,27 +493,27 @@ void V_RenderView( void ) {
V_Viewpos_f
=============
*/
-void V_Viewpos_f (void)
-{
+static void V_Viewpos_f (void) {
Com_Printf ("(%i %i %i) : %i\n", (int)cl.refdef.vieworg[0],
(int)cl.refdef.vieworg[1], (int)cl.refdef.vieworg[2],
(int)cl.refdef.viewangles[YAW]);
}
+static const cmdreg_t v_cmds[] = {
+ { "gun_next", V_Gun_Next_f },
+ { "gun_prev", V_Gun_Prev_f },
+ { "gun_model", V_Gun_Model_f },
+ { "viewpos", V_Viewpos_f },
+ { NULL }
+};
+
/*
=============
V_Init
=============
*/
-void V_Init (void)
-{
- Cmd_AddCommand ("gun_next", V_Gun_Next_f);
- Cmd_AddCommand ("gun_prev", V_Gun_Prev_f);
- Cmd_AddCommand ("gun_model", V_Gun_Model_f);
-
- Cmd_AddCommand ("viewpos", V_Viewpos_f);
-
- crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE);
+void V_Init( void ) {
+ Cmd_Register( v_cmds );
cl_testblend = Cvar_Get ("cl_testblend", "0", 0);
cl_testparticles = Cvar_Get ("cl_testparticles", "0", 0);
@@ -539,4 +523,9 @@ void V_Init (void)
cl_stats = Cvar_Get ("cl_stats", "0", 0);
}
+void V_Shutdown( void ) {
+ Cmd_Deregister( v_cmds );
+}
+
+
diff --git a/source/cmodel.c b/source/cmodel.c
index d65ca67..999186b 100644
--- a/source/cmodel.c
+++ b/source/cmodel.c
@@ -32,7 +32,7 @@ static int floodvalid;
static int checkcount;
static cvar_t *map_noareas;
-static cvar_t *map_load_entities;
+static cvar_t *map_override;
void CM_FloodAreaConnections( cm_t *cm );
@@ -466,130 +466,6 @@ CM_FUNC( EntityString ) {
return qtrue;
}
-#if 0
-/*
-==================
-CM_Concat
-==================
-*/
-static void CM_Concat( const char *text ) {
- int len = strlen( text );
-
- if( numEntityChars + len >= sizeof( cache->entitystring ) ) {
- Com_Error( ERR_DROP, "CM_Concat: oversize entity lump" );
- }
-
- memcpy( cache->entitystring + numEntityChars, text, len );
- numEntityChars += len;
-}
-
-/*
-==================
-CM_ParseMap
-
-Parses complete *.map file
-==================
-*/
-static qboolean CM_ParseMap( const char *data ) {
- char *token;
- int numInlineModels;
- qboolean inlineModel;
- char buffer[MAX_STRING_CHARS];
-
- numInlineModels = 0;
-
- while( 1 ) {
- token = COM_Parse( &data );
- if( !data ) {
- break;
- }
-
- if( *token != '{' ) {
- Com_WPrintf( "%s: expected '{', found '%s'\n", __func__, token );
- return qfalse;
- }
-
- CM_Concat( "{ " );
-
- inlineModel = qfalse;
-
- // Parse entity
- while( 1 ) {
- token = COM_Parse( &data );
- if( !data ) {
- Com_WPrintf( "%s: expected key, found EOF\n", __func__ );
- return qfalse;
- }
-
- if( *token == '}' ) {
- // FIXME HACK: restore inline model number
- // This may not work properly if the entity order is different!!!
- if( inlineModel && numInlineModels ) {
- Com_sprintf( buffer, sizeof( buffer ), "\"model\" \"*%i\" } ", numInlineModels );
- CM_Concat( buffer );
- } else {
- CM_Concat( "} " );
- }
-
- numInlineModels += inlineModel;
- break;
- }
-
- if( *token == '{' ) {
- inlineModel = qtrue;
-
- // Parse brush
- while( 1 ) {
- token = COM_Parse( &data );
- if( !data ) {
- Com_WPrintf( "%s: expected brush data, found EOF\n", __func__ );
- return qfalse;
- }
-
- if( *token == '}' ) {
- break;
- }
-
- if( *token == '{' ) {
- Com_WPrintf( "%s: expected brush data, found '{'\n", __func__ );
- return qfalse;
- }
-
- }
- continue;
- }
-
- CM_Concat( "\"" );
- CM_Concat( token );
- CM_Concat( "\" \"" );
-
- token = COM_Parse( &data );
- if( !data ) {
- Com_WPrintf( "%s: expected value, found EOF\n", __func__ );
- return qfalse;
- }
-
- if( *token == '}' || *token == '{' ) {
- Com_WPrintf( "%s: expected value, found '%s'\n", __func__, token );
- return qfalse;
- }
-
- CM_Concat( token );
- CM_Concat( "\" " );
- }
- }
-
- cmod->entitystring[numEntityChars] = 0;
-
- if( numInlineModels != numcmodels + 1 ) {
- Com_WPrintf( "%s: inline models count mismatch\n", __func__ );
- return qfalse;
- }
-
- return qtrue;
-}
-#endif
-
#define CM_CACHESIZE 16
static cmcache_t cm_cache[CM_CACHESIZE];
@@ -686,8 +562,6 @@ const char *CM_LoadMapEx( cm_t *cm, const char *name, int flags, uint32_t *check
const lump_load_t *load;
size_t length, endpos, fileofs, filelen;
char *error;
-// char *entstring;
-// char buffer[MAX_QPATH];
if( !name || !name[0] ) {
Com_Error( ERR_FATAL, "CM_LoadMap: NULL name" );
@@ -728,7 +602,7 @@ const char *CM_LoadMapEx( cm_t *cm, const char *name, int flags, uint32_t *check
//
// load the file
//
- length = FS_LoadFileEx( name, (void **)&buf, FS_FLAG_CACHE );
+ length = FS_LoadFileEx( name, (void **)&buf, FS_FLAG_CACHE, TAG_FREE );
if( !buf ) {
return "file not found";
}
@@ -787,28 +661,24 @@ const char *CM_LoadMapEx( cm_t *cm, const char *name, int flags, uint32_t *check
}
}
-#if 0
- // Load the entity string from file, if specified
- entstring = NULL;
- if( cm_override_entities->integer && !( flags & CM_LOAD_CLIENT ) ) {
- COM_StripExtension( name, buffer, sizeof( buffer ) );
- Q_strcat( buffer, sizeof( buffer ), ".map" );
- FS_LoadFile( buffer, ( void ** )&entstring );
- }
+ // optionally load the entity string from external source
+ if( map_override->integer && !( flags & CM_LOAD_CLIENT ) ) {
+ char *entstring;
+ char buffer[MAX_QPATH];
- if( entstring ) {
- Com_Printf( "Loading entity string from %s...\n", buffer );
- cm
- if( !CM_ParseMapFile( entstring ) ) {
- CM_LOAD( EntityString, ENTITIES );
+ COM_StripExtension( name, buffer, sizeof( buffer ) );
+ Q_strcat( buffer, sizeof( buffer ), ".ent" );
+ length = FS_LoadFileEx( buffer, ( void ** )&entstring, 0, TAG_CMODEL );
+ if( entstring ) {
+ Com_DPrintf( "Loaded entity string from %s\n", buffer );
+ cache->entitystring = entstring;
+ cache->numEntityChars = length;
+ } else {
+ CM_LoadEntityString( cache, &lumps[LUMP_ENTITIES] );
}
- FS_FreeFile( entstring );
} else {
- CM_LOAD( EntityString, ENTITIES );
+ CM_LoadEntityString( cache, &lumps[LUMP_ENTITIES] );
}
-#else
- CM_LoadEntityString( cache, &lumps[LUMP_ENTITIES] );
-#endif
FS_FreeFile( buf );
@@ -845,14 +715,14 @@ cmodel_t *CM_InlineModel( cm_t *cm, const char *name ) {
cmodel_t *cmodel;
if( !name || name[0] != '*' ) {
- Com_Error( ERR_DROP, "CM_InlineModel: bad name: %s", name );
+ Com_Error( ERR_DROP, "%s: bad name: %s", __func__, name );
}
if( !cm->cache ) {
- Com_Error( ERR_DROP, "CM_InlineModel: NULL cache" );
+ Com_Error( ERR_DROP, "%s: NULL cache", __func__ );
}
num = atoi( name + 1 );
if( num < 1 || num >= cm->cache->numcmodels ) {
- Com_Error ( ERR_DROP, "CM_InlineModel: bad number: %d", num );
+ Com_Error ( ERR_DROP, "%s: bad number: %d", __func__, num );
}
cmodel = &cm->cache->cmodels[num];
@@ -886,23 +756,23 @@ char *CM_EntityString( cm_t *cm ) {
cnode_t *CM_NodeNum( cm_t *cm, int number ) {
if( !cm->cache ) {
- Com_Error( ERR_DROP, "CM_NodeNum: NULL cache" );
+ Com_Error( ERR_DROP, "%s: NULL cache", __func__ );
}
if( number == -1 ) {
return ( cnode_t * )cm->cache->leafs; // special case for solid leaf
}
if( number < 0 || number >= cm->cache->numnodes ) {
- Com_Error( ERR_DROP, "CM_NodeNum: bad number: %d", number );
+ Com_Error( ERR_DROP, "%s: bad number: %d", __func__, number );
}
return cm->cache->nodes + number;
}
cleaf_t *CM_LeafNum( cm_t *cm, int number ) {
if( !cm->cache ) {
- Com_Error( ERR_DROP, "CM_LeafNum: NULL cache" );
+ Com_Error( ERR_DROP, "%s: NULL cache", __func__ );
}
if( number < 0 || number >= cm->cache->numleafs ) {
- Com_Error( ERR_DROP, "CM_LeafNum: bad number: %d", number );
+ Com_Error( ERR_DROP, "%s: bad number: %d", __func__, number );
}
return cm->cache->leafs + number;
}
@@ -1673,6 +1543,21 @@ void CM_TransformedBoxTrace ( trace_t *trace, vec3_t start, vec3_t end,
trace->endpos[2] = start[2] + trace->fraction * (end[2] - start[2]);
}
+
+void CM_ClipEntity( trace_t *dst, trace_t *src, struct edict_s *ent ) {
+ dst->allsolid |= src->allsolid;
+ dst->startsolid |= src->startsolid;
+ if( src->fraction < dst->fraction ) {
+ dst->fraction = src->fraction;
+ VectorCopy( src->endpos, dst->endpos );
+ dst->plane = src->plane;
+ dst->surface = src->surface;
+ dst->contents |= src->contents;
+ dst->ent = ent;
+ }
+}
+
+
/*
===============================================================================
@@ -2013,6 +1898,6 @@ void CM_Init( void ) {
CM_InitBoxHull();
map_noareas = Cvar_Get( "map_noareas", "0", 0 );
- map_load_entities = Cvar_Get( "map_load_entities", "0", 0 );
+ map_override = Cvar_Get( "map_override", "0", 0 );
}
diff --git a/source/com_local.h b/source/com_local.h
index 9e8be04..bcc6903 100644
--- a/source/com_local.h
+++ b/source/com_local.h
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// qcommon.h -- definitions common between client and server, but not game.dll
-#include "config.h"
+#include <config.h>
#include "q_shared.h"
#include "q_files.h"
#include "com_public.h"
@@ -777,6 +777,7 @@ void CM_TransformedBoxTrace( trace_t *trace, vec3_t start, vec3_t end,
vec3_t mins, vec3_t maxs,
cnode_t * headnode, int brushmask,
vec3_t origin, vec3_t angles );
+void CM_ClipEntity( trace_t *dst, trace_t *src, struct edict_s *ent );
byte *CM_ClusterPVS( cm_t *cm, int cluster);
byte *CM_ClusterPHS( cm_t *cm, int cluster );
@@ -862,7 +863,7 @@ size_t FS_FOpenFile( const char *filename, fileHandle_t *f, int mode );
void FS_FCloseFile( fileHandle_t hFile );
size_t FS_LoadFile( const char *path, void **buffer );
-size_t FS_LoadFileEx( const char *path, void **buffer, int flags );
+size_t FS_LoadFileEx( const char *path, void **buffer, int flags, memtag_t tag );
void *FS_AllocTempMem( size_t length );
void FS_FreeFile( void *buffer );
// a null buffer will just return the file length without loading
@@ -948,9 +949,9 @@ void Com_ProcessEvents( void );
void Com_Address_g( genctx_t *ctx );
void Com_Generic_c( genctx_t *ctx, int argnum );
+void Com_Color_g( genctx_t *ctx );
qboolean Prompt_AddMatch( genctx_t *ctx, const char *s );
-qboolean Prompt_AddMatchCase( genctx_t *ctx, const char *s );
size_t Com_Time_m( char *buffer, size_t size );
size_t Com_Uptime_m( char *buffer, size_t size );
@@ -1047,6 +1048,7 @@ void Sys_AddDefaultConfig( void );
void Sys_RunConsole( void );
void Sys_ConsoleOutput( const char *string );
void Sys_SetConsoleTitle( const char *title );
+void Sys_Printf( const char *fmt, ... ) q_printf( 1, 2 );
void Sys_Error( const char *error, ... ) q_noreturn q_printf( 1, 2 );
void Sys_Quit( void );
diff --git a/source/com_public.h b/source/com_public.h
index 9ac3fb5..c387b54 100644
--- a/source/com_public.h
+++ b/source/com_public.h
@@ -26,6 +26,50 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/*
==============================================================
+COMMON
+
+==============================================================
+*/
+
+#define MAXPRINTMSG 4096
+
+// memory tags to allow dynamic memory to be cleaned up
+typedef enum memtag_e {
+ TAG_FREE, // should have never been set
+ TAG_STATIC,
+
+ TAG_GENERAL,
+ TAG_CMD,
+ TAG_CVAR,
+ TAG_FILESYSTEM,
+ TAG_RENDERER,
+ TAG_UI,
+ TAG_SERVER,
+ TAG_MVD,
+ TAG_SOUND,
+ TAG_CMODEL,
+
+ TAG_MAX,
+
+ TAG_GAME = 765, // clear when unloading the dll
+ TAG_LEVEL = 766 // clear when loading a new level
+} memtag_t;
+
+typedef struct commonAPI_s {
+ void (* q_noreturn Error)( comErrorType_t code, const char *str );
+ void (*Print)( comPrintType_t type, const char *str );
+
+ void *(*TagMalloc)( size_t size, memtag_t tag );
+ void *(*Realloc)( void *ptr, size_t size );
+ void (*Free)( void *ptr );
+} commonAPI_t;
+
+extern commonAPI_t com;
+
+
+/*
+==============================================================
+
CMD
==============================================================
@@ -48,6 +92,7 @@ typedef struct genctx_s {
char **matches;
int count, size;
void *data;
+ qboolean ignorecase;
} genctx_t;
typedef struct cmdreg_s {
@@ -177,7 +222,7 @@ typedef struct fsAPI_s {
int (*Tell)( fileHandle_t f );
int (*RawTell)( fileHandle_t f );
size_t (*LoadFile)( const char *path, void **buffer );
- size_t (*LoadFileEx)( const char *path, void **buffer, int flags );
+ size_t (*LoadFileEx)( const char *path, void **buffer, int flags, memtag_t tag );
void *(*AllocTempMem)( size_t length );
void (*FreeFile)( void *buffer );
void **(*ListFiles)( const char *path, const char *extension, int flags, int *numFiles );
@@ -189,49 +234,6 @@ extern fsAPI_t fs;
/*
==============================================================
-COMMON
-
-==============================================================
-*/
-
-#define MAXPRINTMSG 4096
-
-// memory tags to allow dynamic memory to be cleaned up
-typedef enum memtag_e {
- TAG_FREE, // should have never been set
- TAG_STATIC,
-
- TAG_GENERAL,
- TAG_CMD,
- TAG_CVAR,
- TAG_FILESYSTEM,
- TAG_RENDERER,
- TAG_UI,
- TAG_SERVER,
- TAG_MVD,
- TAG_SOUND,
- TAG_CMODEL,
-
- TAG_MAX,
-
- TAG_GAME = 765, // clear when unloading the dll
- TAG_LEVEL = 766 // clear when loading a new level
-} memtag_t;
-
-typedef struct commonAPI_s {
- void (* q_noreturn Error)( comErrorType_t code, const char *str );
- void (*Print)( comPrintType_t type, const char *str );
-
- void *(*TagMalloc)( size_t size, memtag_t tag );
- void *(*Realloc)( void *ptr, size_t size );
- void (*Free)( void *ptr );
-} commonAPI_t;
-
-extern commonAPI_t com;
-
-/*
-==============================================================
-
SYSTEM
==============================================================
diff --git a/source/common.c b/source/common.c
index e1a2cfb..1510696 100644
--- a/source/common.c
+++ b/source/common.c
@@ -443,7 +443,15 @@ do the apropriate things.
=============
*/
void Com_Quit( void ) {
- SV_Shutdown( "Server quit\n", KILL_DROP );
+ if( Cmd_Argc() > 1 ) {
+ char buffer[MAX_STRING_TOKENS];
+
+ Com_sprintf( buffer, sizeof( buffer ),
+ "Server quit: %s\n", Cmd_Args() );
+ SV_Shutdown( buffer, KILL_DROP );
+ } else {
+ SV_Shutdown( "Server quit\n", KILL_DROP );
+ }
CL_Shutdown();
Qcommon_Shutdown( qfalse );
@@ -487,17 +495,17 @@ static zhead_t z_chain;
static cvar_t *z_perturb;
-#pragma pack( push, 1 )
typedef struct {
zhead_t z;
char data[2];
uint16_t tail;
} zstatic_t;
-#pragma pack( pop )
-
-#define Z_STATIC( x ) { { Z_MAGIC, TAG_STATIC, sizeof( zstatic_t ) }, x, Z_TAIL }
static const zstatic_t z_static[] = {
+#define Z_STATIC( x ) \
+ { { Z_MAGIC, TAG_STATIC, q_offsetof( zstatic_t, tail ) + \
+ sizeof( uint16_t ) }, x, Z_TAIL }
+
Z_STATIC( "0" ),
Z_STATIC( "1" ),
Z_STATIC( "2" ),
@@ -509,11 +517,11 @@ static const zstatic_t z_static[] = {
Z_STATIC( "8" ),
Z_STATIC( "9" ),
Z_STATIC( "" )
-};
#undef Z_STATIC
+};
-typedef struct zstats_s {
+typedef struct {
size_t count;
size_t bytes;
} zstats_t;
@@ -830,29 +838,30 @@ Cvar_CopyString
================
*/
char *Cvar_CopyString( const char *in ) {
- size_t len;
+ size_t len;
zstatic_t *z;
+ zstats_t *s;
+ int i;
if( !in ) {
return NULL;
}
if( !in[0] ) {
- z = ( zstatic_t * )&z_static[10];
- z_stats[TAG_STATIC].count++;
- z_stats[TAG_STATIC].bytes += z->z.size;
- return z->data;
- }
-
- if( !in[1] && Q_isdigit( in[0] ) ) {
- z = ( zstatic_t * )&z_static[ in[0] - '0' ];
- z_stats[TAG_STATIC].count++;
- z_stats[TAG_STATIC].bytes += z->z.size;
- return z->data;
- }
+ i = 10;
+ } else if( !in[1] && Q_isdigit( in[0] ) ) {
+ i = in[0] - '0';
+ } else {
+ len = strlen( in ) + 1;
+ return memcpy( Z_TagMalloc( len, TAG_CVAR ), in, len );
+ }
- len = strlen( in ) + 1;
- return memcpy( Z_TagMalloc( len, TAG_CVAR ), in, len );
+ // return static storage
+ z = ( zstatic_t * )&z_static[i];
+ s = &z_stats[TAG_STATIC];
+ s->count++;
+ s->bytes += z->z.size;
+ return z->data;
}
/*
@@ -1095,6 +1104,7 @@ void Com_Address_g( genctx_t *ctx ) {
void Com_Generic_c( genctx_t *ctx, int argnum ) {
xcompleter_t c;
xgenerator_t g;
+ cvar_t *var;
char *s;
// complete command, alias or cvar name
@@ -1110,8 +1120,22 @@ void Com_Generic_c( genctx_t *ctx, int argnum ) {
// complete command argument or cvar value
if( ( c = Cmd_FindCompleter( s ) ) != NULL ) {
c( ctx, argnum );
- } else if( argnum == 1 && ( g = Cvar_FindGenerator( s ) ) != NULL ) {
- g( ctx );
+ } else if( argnum == 1 && ( var = Cvar_FindVar( s ) ) != NULL ) {
+ g = var->generator;
+ if( g ) {
+ ctx->data = var;
+ g( ctx );
+ }
+ }
+}
+
+void Com_Color_g( genctx_t *ctx ) {
+ int color;
+
+ for( color = 0; color < 8; color++ ) {
+ if( !Prompt_AddMatch( ctx, colorNames[color] ) ) {
+ break;
+ }
}
}
@@ -1278,9 +1302,6 @@ void Qcommon_Init( int argc, char **argv ) {
// the settings of the config files
Com_AddEarlyCommands( qfalse );
- // do not accept CVAR_NOSET variable changes anymore
- com_initialized = qtrue;
-
Sys_Init();
Sys_RunConsole();
@@ -1289,6 +1310,9 @@ void Qcommon_Init( int argc, char **argv ) {
Sys_RunConsole();
+ // do not accept CVAR_NOSET variable changes anymore
+ com_initialized = qtrue;
+
// after FS is initialized, open logfile
logfile_active->changed = logfile_active_changed;
logfile_flush->changed = logfile_param_changed;
diff --git a/source/cvar.c b/source/cvar.c
index cf09eca..2d22ea4 100644
--- a/source/cvar.c
+++ b/source/cvar.c
@@ -43,7 +43,7 @@ Cvar_FindVar
*/
cvar_t *Cvar_FindVar( const char *var_name ) {
cvar_t *var;
- int hash;
+ unsigned hash;
hash = Com_HashString( var_name, CVARHASH_SIZE );
@@ -235,6 +235,8 @@ cvar_t *Cvar_Get( const char *var_name, const char *var_value, int flags ) {
&& strcmp( var_value, var->string ) )
{
// reset cvar back to default value
+ Com_DPrintf( "Cvar '%s' was reset from '%s' to default '%s'\n",
+ var->name, var->string, var->default_string );
Cvar_UpdateString( var, var_value, CVAR_SET_DIRECT );
}
var->flags &= ~CVAR_USER_CREATED;
@@ -648,14 +650,19 @@ void Cvar_Command( cvar_t *v ) {
static void Cvar_Set_c( genctx_t *ctx, int argnum ) {
char *s;
+ cvar_t *var;
xgenerator_t g;
if( argnum == 1 ) {
Cvar_Variable_g( ctx );
} else if( argnum == 2 ) {
s = Cmd_Argv( ctx->argnum - 1 );
- if( ( g = Cvar_FindGenerator( s ) ) != NULL ) {
- g( ctx );
+ if( ( var = Cvar_FindVar( s ) ) != NULL ) {
+ g = var->generator;
+ if( g ) {
+ ctx->data = var;
+ g( ctx );
+ }
}
}
}
@@ -991,7 +998,7 @@ static void Cvar_Inc_f( void ) {
return;
}
- if( !COM_IsNumeric( var->string ) ) {
+ if( !COM_IsFloat( var->string ) ) {
Com_Printf( "\"%s\" is \"%s\", can't %s\n",
var->name, var->string, Cmd_Argv( 0 ) );
return;
diff --git a/source/files.c b/source/files.c
index 88c7684..34a07d5 100644
--- a/source/files.c
+++ b/source/files.c
@@ -989,11 +989,11 @@ Filenames are relative to the quake search path
a null buffer will just return the file length without loading
============
*/
-size_t FS_LoadFileEx( const char *path, void **buffer, int flags ) {
+size_t FS_LoadFileEx( const char *path, void **buffer, int flags, memtag_t tag ) {
fsFile_t *file;
fileHandle_t f;
byte *buf;
- size_t length;
+ size_t len;
if( !path ) {
Com_Error( ERR_FATAL, "FS_LoadFile: NULL" );
@@ -1024,31 +1024,45 @@ size_t FS_LoadFileEx( const char *path, void **buffer, int flags ) {
file->mode = flags | FS_MODE_READ;
// look for it in the filesystem or pack files
- length = FS_FOpenFileRead( file, path, qfalse );
- if( length == INVALID_LENGTH ) {
- return length;
+ len = FS_FOpenFileRead( file, path, qfalse );
+ if( len == INVALID_LENGTH ) {
+ return len;
}
if( buffer ) {
#if USE_ZLIB
if( file->type == FS_GZIP ) {
- length = INVALID_LENGTH; // unknown length
+ len = INVALID_LENGTH; // unknown length
} else
#endif
{
- *buffer = buf = FS_AllocTempMem( length + 1 );
- FS_Read( buf, length, f );
- buf[length] = 0;
+ if( tag == TAG_FREE ) {
+ buf = FS_AllocTempMem( len + 1 );
+ } else {
+ buf = Z_TagMalloc( len + 1, tag );
+ }
+ if( FS_Read( buf, len, f ) == len ) {
+ *buffer = buf;
+ buf[len] = 0;
+ } else {
+ Com_EPrintf( "FS_LoadFile: error reading file: %s\n", path );
+ if( tag == TAG_FREE ) {
+ FS_FreeFile( buf );
+ } else {
+ Z_Free( buf );
+ }
+ len = INVALID_LENGTH;
+ }
}
}
FS_FCloseFile( f );
- return length;
+ return len;
}
size_t FS_LoadFile( const char *path, void **buffer ) {
- return FS_LoadFileEx( path, buffer, 0 );
+ return FS_LoadFileEx( path, buffer, 0, TAG_FREE );
}
void *FS_AllocTempMem( size_t length ) {
diff --git a/source/gl_local.h b/source/gl_local.h
index 5d91611..d42e908 100644
--- a/source/gl_local.h
+++ b/source/gl_local.h
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "config.h"
+#include <config.h>
#include "qgl_local.h"
#include "q_shared.h"
#include "q_files.h"
diff --git a/source/gl_main.c b/source/gl_main.c
index 02b9b74..5c1e7fc 100644
--- a/source/gl_main.c
+++ b/source/gl_main.c
@@ -542,7 +542,7 @@ static char *screenshot_path( char *buffer, const char *ext ) {
//
for( i = 0; i < 1000; i++ ) {
Com_sprintf( buffer, MAX_OSPATH, SCREENSHOTS_DIRECTORY"/quake%03d%s", i, ext );
- if( fs.LoadFileEx( buffer, NULL, FS_PATH_GAME ) == INVALID_LENGTH ) {
+ if( fs.LoadFileEx( buffer, NULL, FS_PATH_GAME, TAG_FREE ) == INVALID_LENGTH ) {
return buffer; // file doesn't exist
}
}
diff --git a/source/ioapi.c b/source/ioapi.c
index 9282aae..d66025b 100644
--- a/source/ioapi.c
+++ b/source/ioapi.c
@@ -5,7 +5,7 @@
Copyright (C) 1998-2002 Gilles Vollant
*/
-#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/source/m_flash.c b/source/m_flash.c
index 75e537b..cf14046 100644
--- a/source/m_flash.c
+++ b/source/m_flash.c
@@ -19,13 +19,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// m_flash.c
-#include "config.h"
+#include <config.h>
#include "q_shared.h"
// this file is included in both the game dll and quake2 },
// the game needs it to source shot locations, the client
// needs it to position muzzle flashes
-vec3_t monster_flash_offset[255] =
+const vec3_t monster_flash_offset[255] =
{
// flash 0 is not used
{ 0.0, 0.0, 0.0 },
diff --git a/source/mdfour.c b/source/mdfour.c
index 320351b..933a02b 100644
--- a/source/mdfour.c
+++ b/source/mdfour.c
@@ -25,7 +25,7 @@
Boston, MA 02111-1307, USA
*/
-#include "config.h"
+#include <config.h>
#include "q_shared.h"
#include "mdfour.h"
diff --git a/source/mod_ui.rc b/source/mod_ui.rc
index 5154c3e..ed36bbd 100644
--- a/source/mod_ui.rc
+++ b/source/mod_ui.rc
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <windows.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
diff --git a/source/mvd_client.c b/source/mvd_client.c
index c5a436d..ba68ec6 100644
--- a/source/mvd_client.c
+++ b/source/mvd_client.c
@@ -26,8 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mvd_local.h"
#include <setjmp.h>
-list_t mvd_channels;
-list_t mvd_ready;
+LIST_DECL( mvd_channels );
+LIST_DECL( mvd_ready );
+
mvd_t mvd_waitingRoom;
qboolean mvd_dirty;
int mvd_chanid;
@@ -227,7 +228,7 @@ static void MVD_EmitGamestate( mvd_t *mvd ) {
entity_state_t *es;
player_state_t *ps;
size_t length;
- uint16_t *patch;
+ uint8_t *patch;
int flags, extra, portalbytes;
byte portalbits[MAX_MAP_AREAS/8];
@@ -302,7 +303,9 @@ static void MVD_EmitGamestate( mvd_t *mvd ) {
// TODO: write private layouts/configstrings
- *patch = LittleShort( msg_write.cursize - 2 );
+ length = msg_write.cursize - 2;
+ patch[0] = length & 255;
+ patch[1] = ( length >> 8 ) & 255;
}
void MVD_SendGamestate( tcpClient_t *client ) {
@@ -806,7 +809,7 @@ mvd_t *MVD_SetChannel( int arg ) {
return NULL;
}
- if( COM_IsNumeric( s ) ) {
+ if( COM_IsUint( s ) ) {
id = atoi( s );
LIST_FOR_EACH( mvd_t, mvd, &mvd_channels, entry ) {
if( mvd->id == id ) {
@@ -1398,8 +1401,5 @@ void MVD_Register( void ) {
mvd_wait_percent = Cvar_Get( "mvd_wait_percent", "50", 0 );
Cmd_Register( c_mvd );
-
- List_Init( &mvd_channels );
- List_Init( &mvd_ready );
}
diff --git a/source/pmove.c b/source/pmove.c
index 331a800..bc6b925 100644
--- a/source/pmove.c
+++ b/source/pmove.c
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "config.h"
+#include <config.h>
#include "com_local.h"
diff --git a/source/prompt.c b/source/prompt.c
index 2e349b2..8386ef3 100644
--- a/source/prompt.c
+++ b/source/prompt.c
@@ -124,20 +124,17 @@ static void Prompt_ShowIndividualMatches(
}
qboolean Prompt_AddMatch( genctx_t *ctx, const char *s ) {
- if( ctx->count >= ctx->size ) {
- return qfalse;
- }
- if( !strncmp( ctx->partial, s, ctx->length ) ) {
- ctx->matches[ctx->count++] = Z_CopyString( s );
- }
- return qtrue;
-}
+ int r;
-qboolean Prompt_AddMatchCase( genctx_t *ctx, const char *s ) {
if( ctx->count >= ctx->size ) {
return qfalse;
}
- if( !Q_strncasecmp( ctx->partial, s, ctx->length ) ) {
+ if( ctx->ignorecase ) {
+ r = Q_strncasecmp( ctx->partial, s, ctx->length );
+ } else {
+ r = strncmp( ctx->partial, s, ctx->length );
+ }
+ if( !r ) {
ctx->matches[ctx->count++] = Z_CopyString( s );
}
return qtrue;
@@ -260,7 +257,8 @@ void Prompt_CompleteCommand( commandPrompt_t *prompt, qboolean backslash ) {
for( i = 0; i < ctx.count; i++ ) {
sortedMatches[i] = matches[i];
}
- qsort( sortedMatches, ctx.count, sizeof( sortedMatches[0] ), SortStrcmp );
+ qsort( sortedMatches, ctx.count, sizeof( sortedMatches[0] ),
+ ctx.ignorecase ? SortStricmp : SortStrcmp );
// copy matching part
first = sortedMatches[0];
@@ -268,7 +266,9 @@ void Prompt_CompleteCommand( commandPrompt_t *prompt, qboolean backslash ) {
len = 0;
do {
if( *first != *last ) {
- break;
+ if( !ctx.ignorecase || Q_tolower( *first ) != Q_tolower( *last ) ) {
+ break;
+ }
}
text[len++] = *first;
if( len == size - 1 ) {
@@ -322,37 +322,27 @@ finish:
}
void Prompt_CompleteHistory( commandPrompt_t *prompt, qboolean forward ) {
- inputField_t *inputLine = &prompt->inputLine;
- int i, j, k;
- char *s, *text, *first, *last;
- size_t len;
- char *matches[HISTORY_SIZE], *sortedMatches[HISTORY_SIZE];
- int numMatches = 0;
-
- text = inputLine->text;
- len = strlen( text );
+ char *s, *m = NULL;
+ int i, j;
- if( *text != '\\' && *text != '/' ) {
- memmove( text + 1, text, len + 1 );
- *text = '\\';
- len++;
+ if( !prompt->search ) {
+ s = prompt->inputLine.text;
+ if( *s == '/' || *s == '\\' ) {
+ s++;
+ }
+ if( !*s ) {
+ return;
+ }
+ prompt->search = Z_CopyString( s );
}
if( forward ) {
- i = prompt->inputLineNum - HISTORY_SIZE;
- if( i < 0 ) {
- i = 0;
- }
- for( ; i < prompt->inputLineNum; i++ ) {
+ for( i = prompt->historyLineNum + 1; i < prompt->inputLineNum; i++ ) {
s = prompt->history[i & HISTORY_MASK];
- if( s && !strncmp( text, s, len ) ) {
- for( k = 0; k < numMatches; k++ ) {
- if( !strcmp( matches[k], s ) ) {
- break;
- }
- }
- if( k == numMatches ) {
- matches[numMatches++] = s;
+ if( s && strstr( s, prompt->search ) ) {
+ if( strcmp( s, prompt->inputLine.text ) ) {
+ m = s;
+ break;
}
}
}
@@ -361,57 +351,31 @@ void Prompt_CompleteHistory( commandPrompt_t *prompt, qboolean forward ) {
if( j < 0 ) {
j = 0;
}
- for( i = prompt->inputLineNum - 1; i >= j; i-- ) {
+ for( i = prompt->historyLineNum - 1; i >= j; i-- ) {
s = prompt->history[i & HISTORY_MASK];
- if( s && !strncmp( text, s, len ) ) {
- for( k = 0; k < numMatches; k++ ) {
- if( !strcmp( matches[k], s ) ) {
- break;
- }
- }
- if( k == numMatches ) {
- matches[numMatches++] = s;
+ if( s && strstr( s, prompt->search ) ) {
+ if( strcmp( s, prompt->inputLine.text ) ) {
+ m = s;
+ break;
}
}
}
}
- if( !numMatches ) {
- inputLine->cursorPos = len;
- return; // nothing found
- }
-
- if( numMatches == 1 ) {
- // we have finished completion!
- memcpy( text, s, len + 1 );
- inputLine->cursorPos = len;
+ if( !m ) {
return;
}
- // sort matches alphabethically
- for( i = 0; i < numMatches; i++ ) {
- sortedMatches[i] = matches[i];
- }
- qsort( sortedMatches, numMatches, sizeof( sortedMatches[0] ), SortStrcmp );
-
- // copy matching part
- first = sortedMatches[0];
- last = sortedMatches[ numMatches - 1 ];
- len = 0;
- do {
- if( *first != *last ) {
- break;
- }
- text[len++] = *first;
-
- first++;
- last++;
- } while( *first );
-
- text[len] = 0;
- inputLine->cursorPos = len;
+ prompt->historyLineNum = i;
+ IF_Replace( &prompt->inputLine, prompt->history[i & HISTORY_MASK] );
+}
- Prompt_ShowMatches( prompt, matches, 0, numMatches );
+void Prompt_ClearState( commandPrompt_t *prompt ) {
+ prompt->tooMany = qfalse;
+ if( prompt->search ) {
+ Z_Free( prompt->search );
+ prompt->search = NULL;
+ }
}
/*
@@ -425,7 +389,7 @@ char *Prompt_Action( commandPrompt_t *prompt ) {
char *s = prompt->inputLine.text;
int i, j;
- prompt->tooMany = qfalse;
+ Prompt_ClearState( prompt );
if( s[0] == 0 || ( ( s[0] == '/' || s[0] == '\\' ) && s[1] == 0 ) ) {
IF_Clear( &prompt->inputLine );
return NULL; // empty line
@@ -460,6 +424,8 @@ Prompt_HistoryUp
void Prompt_HistoryUp( commandPrompt_t *prompt ) {
int i;
+ Prompt_ClearState( prompt );
+
if( prompt->historyLineNum == prompt->inputLineNum ) {
// save current line in history
i = prompt->inputLineNum & HISTORY_MASK;
@@ -487,6 +453,8 @@ Prompt_HistoryDown
void Prompt_HistoryDown( commandPrompt_t *prompt ) {
int i;
+ Prompt_ClearState( prompt );
+
if( prompt->historyLineNum == prompt->inputLineNum ) {
return;
}
@@ -504,6 +472,8 @@ Prompt_Clear
*/
void Prompt_Clear( commandPrompt_t *prompt ) {
int i;
+
+ Prompt_ClearState( prompt );
for( i = 0; i < HISTORY_SIZE; i++ ) {
if( prompt->history[i] ) {
diff --git a/source/prompt.h b/source/prompt.h
index ce0e2d1..33d0426 100644
--- a/source/prompt.h
+++ b/source/prompt.h
@@ -34,6 +34,7 @@ typedef struct commandPrompt_s {
inputField_t inputLine;
char *history[HISTORY_SIZE];
+ char *search;
int widthInChars;
qboolean tooMany;
@@ -45,6 +46,7 @@ typedef struct commandPrompt_s {
void Prompt_Init( void );
void Prompt_CompleteCommand( commandPrompt_t *prompt, qboolean backslash );
void Prompt_CompleteHistory( commandPrompt_t *prompt, qboolean forward );
+void Prompt_ClearState( commandPrompt_t *prompt );
char *Prompt_Action( commandPrompt_t *prompt );
void Prompt_HistoryUp( commandPrompt_t *prompt );
void Prompt_HistoryDown( commandPrompt_t *prompt );
diff --git a/source/q2pro.rc b/source/q2pro.rc
index 8047518..ef5ff27 100644
--- a/source/q2pro.rc
+++ b/source/q2pro.rc
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <windows.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
diff --git a/source/q2proded.rc b/source/q2proded.rc
index 878b095..0f4e8a3 100644
--- a/source/q2proded.rc
+++ b/source/q2proded.rc
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <windows.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
diff --git a/source/q_field.c b/source/q_field.c
index 7400434..664448f 100644
--- a/source/q_field.c
+++ b/source/q_field.c
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// field.c
//
-#include "config.h"
+#include <config.h>
#include "q_shared.h"
#include "com_public.h"
#include "key_public.h"
diff --git a/source/q_msg.c b/source/q_msg.c
index 69bb044..d78fb25 100644
--- a/source/q_msg.c
+++ b/source/q_msg.c
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "config.h"
+#include <config.h>
#include "q_shared.h"
#include "com_public.h"
#include "protocol.h"
diff --git a/source/q_shared.c b/source/q_shared.c
index 4d830f7..2e6b523 100644
--- a/source/q_shared.c
+++ b/source/q_shared.c
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "config.h"
+#include <config.h>
#include "q_shared.h"
static const char hexchars[] = "0123456789ABCDEF";
@@ -846,51 +846,61 @@ void COM_AppendExtension( char *path, const char *extension, int pathSize ) {
/*
==================
-COM_IsNumeric
+COM_IsFloat
Returns true if the given string is valid representation
-of floating point or integer number.
+of floating point number.
==================
*/
-qboolean COM_IsNumeric( const char *string ) {
- int c;
+qboolean COM_IsFloat( const char *s ) {
+ int c, dot = '.';
- if( !string ) {
+ if( *s == '-' ) {
+ s++;
+ }
+ if( !*s ) {
return qfalse;
}
- if( !*string ) {
+ do {
+ c = *s++;
+ if( c == dot ) {
+ dot = 0;
+ } else if( !Q_isdigit( c ) ) {
+ return qfalse;
+ }
+ } while( *s );
+
+ return qtrue;
+}
+
+qboolean COM_IsUint( const char *s ) {
+ int c;
+
+ if( !*s ) {
return qfalse;
}
do {
- c = *string++;
- if( Q_isdigit( c ) ) {
- continue;
- }
- if( c != '-' && c != '.' && c != ' ' ) {
+ c = *s++;
+ if( !Q_isdigit( c ) ) {
return qfalse;
}
- } while( *string );
+ } while( *s );
return qtrue;
-
}
-qboolean COM_HasSpaces( const char *string ) {
- while( *string ) {
- if( *string <= 32 ) {
+qboolean COM_HasSpaces( const char *s ) {
+ while( *s ) {
+ if( *s <= 32 ) {
return qtrue;
}
- string++;
+ s++;
}
return qfalse;
}
-/* Parses hexadecimal number until it encounters
- * illegible symbol or end of string.
- * Does not check for overflow.
- */
unsigned COM_ParseHex( const char *s ) {
int c;
unsigned result;
@@ -899,24 +909,80 @@ unsigned COM_ParseHex( const char *s ) {
if( ( c = Q_charhex( *s ) ) == -1 ) {
break;
}
+ if( result & ~( UINT_MAX >> 4 ) ) {
+ return UINT_MAX;
+ }
result = c | ( result << 4 );
}
return result;
}
+qboolean COM_ParseColor( const char *s, color_t color ) {
+ int i;
+ int c[8];
+
+ if( *s == '#' ) {
+ s++;
+ for( i = 0; s[i]; i++ ) {
+ c[i] = Q_charhex( s[i] );
+ if( c[i] == -1 ) {
+ return qfalse;
+ }
+ }
+ switch( i ) {
+ case 3:
+ color[0] = c[0] | ( c[0] << 4 );
+ color[1] = c[1] | ( c[1] << 4 );
+ color[2] = c[2] | ( c[2] << 4 );
+ color[3] = 255;
+ break;
+ case 6:
+ color[0] = c[1] | ( c[0] << 4 );
+ color[1] = c[3] | ( c[2] << 4 );
+ color[2] = c[5] | ( c[4] << 4 );
+ color[3] = 255;
+ break;
+ case 8:
+ color[0] = c[1] | ( c[0] << 4 );
+ color[1] = c[3] | ( c[2] << 4 );
+ color[2] = c[5] | ( c[4] << 4 );
+ color[3] = c[7] | ( c[6] << 4 );
+ break;
+ default:
+ return qfalse;
+ }
+ return qtrue;
+ } else {
+ for( i = 0; i < 8; i++ ) {
+ if( !strcmp( colorNames[i], s ) ) {
+ *( uint32_t * )color = *( uint32_t * )colorTable[i];
+ return qtrue;
+ }
+ }
+ return qfalse;
+ }
+}
+
/*
=================
SortStrcmp
=================
*/
int QDECL SortStrcmp( const void *p1, const void *p2 ) {
- const char *s1 = *(const char **)p1;
- const char *s2 = *(const char **)p2;
+ const char *s1 = *( const char ** )p1;
+ const char *s2 = *( const char ** )p2;
return strcmp( s1, s2 );
}
+int QDECL SortStricmp( const void *p1, const void *p2 ) {
+ const char *s1 = *( const char ** )p1;
+ const char *s2 = *( const char ** )p2;
+
+ return Q_stricmp( s1, s2 );
+}
+
/*
=================
Com_WildCmp
@@ -1194,51 +1260,64 @@ char *Q_FormatString( const char *string ) {
return buffer;
}
+#if 0
+
+typedef enum {
+ ESC_CHR = ( 1 << 0 ),
+ ESC_CLR = ( 1 << 1 )
+} escape_t;
+
/*
================
Q_UnescapeString
================
*/
-char *Q_UnescapeString( const char *string ) {
- static char buffer[MAX_STRING_CHARS];
+size_t Q_UnescapeString( char *out, const char *in, size_t bufsize, escape_t flags ) {
char *dst, *last;
int c;
- dst = buffer;
- last = buffer + MAX_STRING_CHARS - 1;
- while( *string && dst != last ) {
- c = *string++;
-
- if( c != '\\' ) {
- *dst++ = c;
- continue;
- }
+ if( bufsize < 1 ) {
+ Com_Error( ERR_FATAL, "%s: bad bufsize: %d", __func__, bufsize );
+ }
- c = *string++;
- if( c == 0 ) {
- break;
- }
- switch( c ) {
- case 't':
- c = '\t';
- break;
- case 'b':
- c = '\b';
- break;
- case 'r':
- c = '\r';
- break;
- case 'n':
- c = '\n';
- break;
- case '\\':
- c = '\\';
- break;
- default:
- break;
- }
+ p = out;
+ m = out + bufsize - 1;
+ while( *in && p < m ) {
+ c = *in++;
+
+ if( ( flags & ESC_CHR ) && c == '\\' ) {
+ c = *in++;
+ switch( c ) {
+ case 0:
+ goto breakOut;
+ case 't':
+ c = '\t';
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 'n':
+ c = '\n';
+ break;
+ case '\\':
+ c = '\\';
+ break;
+ case 'x':
+ if( ( c = Q_charhex( in[0] ) ) == -1 ) {
+ goto breakOut;
+ }
+ result = c | ( r << 4 );
+ }
+ break;
+ default:
+ break;
+ }
- *dst++ = c;
+ *p++ = c;
+ }
}
*dst = 0;
@@ -1246,6 +1325,7 @@ char *Q_UnescapeString( const char *string ) {
return buffer;
}
+#endif
int Q_EscapeMarkup( char *out, const char *in, int bufsize ) {
char *p, *m, *s;
diff --git a/source/q_shared.h b/source/q_shared.h
index 197ef8f..625daef 100644
--- a/source/q_shared.h
+++ b/source/q_shared.h
@@ -27,8 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
+#include <limits.h>
#include <time.h>
+#if HAVE_ENDIAN_H
#include <endian.h>
+#endif
#ifdef __GNUC__
@@ -153,7 +156,7 @@ typedef vec_t vec5_t[5];
typedef float mat4_t[16];
-typedef byte color_t[4];
+typedef unsigned char color_t[4];
typedef int fixed4_t;
typedef int fixed8_t;
@@ -473,8 +476,9 @@ void COM_DefaultExtension( char *path, const char *extension, int pathSize );
void COM_AppendExtension( char *path, const char *extension, int pathSize );
char *COM_FileExtension( const char *in );
-qboolean COM_IsNumeric( const char *string );
-qboolean COM_HasSpaces( const char *string );
+qboolean COM_IsFloat( const char *s );
+qboolean COM_IsUint( const char *s );
+qboolean COM_HasSpaces( const char *s );
char *COM_SimpleParse( const char **data_p, int *length );
char *COM_Parse( const char **data_p );
@@ -483,6 +487,7 @@ int COM_Compress( char *data );
int Com_WildCmp( const char *filter, const char *string, qboolean ignoreCase );
int QDECL SortStrcmp( const void *p1, const void *p2 );
+int QDECL SortStricmp( const void *p1, const void *p2 );
unsigned Com_HashString( const char *string, int hashSize );
unsigned Com_HashPath( const char *string, int hashSize );
@@ -497,6 +502,7 @@ size_t Q_vsnprintf( char *dest, size_t destsize, const char *fmt, va_list argptr
void Com_PageInMemory (void *buffer, int size);
unsigned COM_ParseHex( const char *string );
+qboolean COM_ParseColor( const char *s, color_t color );
char *va( const char *format, ... ) q_printf( 1, 2 );
@@ -1222,7 +1228,7 @@ typedef struct
// ROGUE
-extern vec3_t monster_flash_offset [];
+extern const vec3_t monster_flash_offset [];
// temp entity events
diff --git a/source/q_uis.c b/source/q_uis.c
index 5fac151..26d4801 100644
--- a/source/q_uis.c
+++ b/source/q_uis.c
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ui_shared.c - basic UI support for client modules
//
-#include "config.h"
+#include <config.h>
#include "q_shared.h"
#include "com_public.h"
#include "ref_public.h"
diff --git a/source/qgl_api.c b/source/qgl_api.c
index 3eb3298..122a45b 100644
--- a/source/qgl_api.c
+++ b/source/qgl_api.c
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
** QGL_Shutdown() - unloads libraries, NULLs function pointers
*/
-#include "config.h"
+#include <config.h>
#include "qgl_local.h"
#include "q_shared.h"
#include "com_public.h"
diff --git a/source/r_bsp.c b/source/r_bsp.c
index 82d2372..2c10438 100644
--- a/source/r_bsp.c
+++ b/source/r_bsp.c
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// r_bsp.c -- map loading functions common for both renderers
//
-#include "config.h"
+#include <config.h>
#include "q_shared.h"
#include "com_public.h"
#include "q_files.h"
@@ -589,7 +589,7 @@ void Bsp_LoadWorld( const char *path ) {
byte *data;
size_t length, endpos;
- length = fs.LoadFileEx( path, ( void ** )&data, FS_FLAG_CACHE );
+ length = fs.LoadFileEx( path, ( void ** )&data, FS_FLAG_CACHE, TAG_FREE );
if( !data ) {
Com_Error( ERR_DROP, "%s: couldn't load %s", __func__, path );
}
diff --git a/source/ref_gl.rc b/source/ref_gl.rc
index 4571ad5..09ac880 100644
--- a/source/ref_gl.rc
+++ b/source/ref_gl.rc
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <windows.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
diff --git a/source/ref_soft.rc b/source/ref_soft.rc
index af603e8..d355539 100644
--- a/source/ref_soft.rc
+++ b/source/ref_soft.rc
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
#include <windows.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
diff --git a/source/snd_main.c b/source/snd_main.c
index 2e72247..48317f5 100644
--- a/source/snd_main.c
+++ b/source/snd_main.c
@@ -312,7 +312,9 @@ void S_Shutdown( void ) {
void S_Activate( qboolean active ) {
if( sound_started ) {
- S_StopAllSounds();
+#ifdef _WIN32
+ S_StopAllSounds(); // FIXME
+#endif
snddma.Activate( active );
}
}
diff --git a/source/snd_oss.c b/source/snd_oss.c
index 182cb38..10b092f 100644
--- a/source/snd_oss.c
+++ b/source/snd_oss.c
@@ -106,7 +106,7 @@ static sndinitstat_t OSS_Init ( void ) {
break;
}
if ( i == sizeof ( tryrates ) / 4 ) {
- Com_WPrintf ( "%s supports no valid bitrates", snddevice->string );
+ Com_WPrintf ( "%s supports no valid bitrates\n", snddevice->string );
goto fail;
}
dma.speed = tryrates[i];
@@ -121,7 +121,7 @@ static sndinitstat_t OSS_Init ( void ) {
tmp = 1;
rc = ioctl ( audio_fd, SNDCTL_DSP_STEREO, &tmp );
if ( rc < 0 ) {
- Com_WPrintf ( "Could not set %s to %d channels: %s", snddevice->string,
+ Com_WPrintf ( "Could not set %s to %d channels: %s\n", snddevice->string,
dma.channels, strerror ( errno ) );
goto fail;
}
@@ -132,7 +132,7 @@ static sndinitstat_t OSS_Init ( void ) {
rc = ioctl ( audio_fd, SNDCTL_DSP_SPEED, &dma.speed );
if ( rc < 0 ) {
- Com_WPrintf ( "Could not set %s speed to %d: %s", snddevice->string,
+ Com_WPrintf ( "Could not set %s speed to %d: %s\n", snddevice->string,
dma.speed, strerror ( errno ) );
goto fail;
}
@@ -152,7 +152,7 @@ static sndinitstat_t OSS_Init ( void ) {
goto fail;
}
} else {
- Com_WPrintf ( "%d-bit sound not supported.", dma.samplebits );
+ Com_WPrintf ( "%d-bit sound not supported.\n", dma.samplebits );
goto fail;
}
diff --git a/source/sv_ac.c b/source/sv_ac.c
index d01eae8..fae15df 100644
--- a/source/sv_ac.c
+++ b/source/sv_ac.c
@@ -131,8 +131,8 @@ typedef struct {
static ac_locals_t ac;
static ac_static_t acs;
-static list_t ac_required_list;
-static list_t ac_exempt_list;
+static LIST_DECL( ac_required_list );
+static LIST_DECL( ac_exempt_list );
static byte ac_send_buffer[AC_SEND_SIZE];
static byte ac_recv_buffer[AC_RECV_SIZE];
@@ -1466,7 +1466,7 @@ void AC_Info_f( void ) {
substring = Cmd_Argv( 1 );
filesubstring = Cmd_Argv( 2 );
- if( COM_IsNumeric( substring ) ) {
+ if( COM_IsUint( substring ) ) {
clientID = atoi( substring );
if( clientID < 0 || clientID >= sv_maxclients->integer ) {
Com_Printf( "Invalid client ID.\n" );
@@ -1609,9 +1609,6 @@ void AC_Register( void ) {
ac_disable_play->changed = ac_disable_play_changed;
Cmd_Register( c_ac );
-
- List_Init( &ac_required_list );
- List_Init( &ac_exempt_list );
}
diff --git a/source/sv_ccmds.c b/source/sv_ccmds.c
index 6380ddf..2031639 100644
--- a/source/sv_ccmds.c
+++ b/source/sv_ccmds.c
@@ -121,7 +121,6 @@ Sets sv_client and sv_player to the player with idnum Cmd_Argv(1)
*/
static qboolean SV_SetPlayer( void ) {
client_t *cl;
- int i;
int idnum;
char *s;
@@ -130,13 +129,14 @@ static qboolean SV_SetPlayer( void ) {
return qfalse;
}
+ // allow numeric value escape
+ if( *s == '\\' ) {
+ s++;
+ goto namecmp;
+ }
+
// numeric values are just slot numbers
- for( i = 0; s[i]; i++ ) {
- if( !Q_isdigit( s[i] ) ) {
- break;
- }
- }
- if( !s[i] ) {
+ if( COM_IsUint( s ) ) {
idnum = atoi( s );
if( idnum < 0 || idnum >= sv_maxclients->integer ) {
Com_Printf( "Bad client slot: %i\n", idnum );
@@ -152,6 +152,7 @@ static qboolean SV_SetPlayer( void ) {
return qtrue;
}
+namecmp:
// check for a name match
FOR_EACH_CLIENT( cl ) {
if( !strcmp( cl->name, s ) ) {
@@ -231,6 +232,39 @@ static void SV_Map_c( genctx_t *ctx, int argnum ) {
}
}
+static void SV_DumpEnts_f( void ) {
+ cmcache_t *c = sv.cm.cache;
+ fileHandle_t f;
+ char *s, buffer[MAX_QPATH];
+
+ if( !c || !c->entitystring ) {
+ Com_Printf( "No map loaded.\n" );
+ return;
+ }
+
+ if( Cmd_Argc() != 2 ) {
+ Com_Printf( "Usage: %s <entname>\n", Cmd_Argv( 0 ) );
+ return;
+ }
+
+ s = Cmd_Argv( 1 );
+ if( *s == '/' ) {
+ Q_strncpyz( buffer, s + 1, sizeof( buffer ) );
+ } else {
+ Q_concat( buffer, sizeof( buffer ), "maps/", s, NULL );
+ COM_AppendExtension( buffer, ".ent", sizeof( buffer ) );
+ }
+
+ FS_FOpenFile( buffer, &f, FS_MODE_WRITE );
+ if( f ) {
+ FS_Write( c->entitystring, c->numEntityChars, f );
+ FS_FCloseFile( f );
+ Com_Printf( "Dumped entity string to %s\n", buffer );
+ } else {
+ Com_Printf( "Failed to dump entity string to %s\n", buffer );
+ }
+}
+
//===============================================================
/*
@@ -919,6 +953,7 @@ static const cmdreg_t c_server[] = {
{ "map", SV_Map_f, SV_Map_c },
{ "demomap", SV_DemoMap_f },
{ "gamemap", SV_GameMap_f, SV_Map_c },
+ { "dumpents", SV_DumpEnts_f },
{ "setmaster", SV_SetMaster_f },
{ "killserver", SV_KillServer_f },
{ "sv", SV_ServerCommand_f },
diff --git a/source/sv_game.c b/source/sv_game.c
index 9a12d2a..db1b72a 100644
--- a/source/sv_game.c
+++ b/source/sv_game.c
@@ -795,22 +795,21 @@ void SV_InitGameProgs ( void ) {
if( !entry )
#endif
{
- // try refdir first for development purposes
- Q_concat( path, sizeof( path ), sys_refdir->string,
- PATH_SEP_STRING GAMELIB, NULL );
- entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
+ // try gamedir first
+ if( fs_game->string[0] ) {
+ Q_concat( path, sizeof( path ), sys_libdir->string,
+ PATH_SEP_STRING, fs_game->string, PATH_SEP_STRING GAMELIB, NULL );
+ entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
+ }
if( !entry ) {
- // try gamedir
- if( fs_game->string[0] ) {
- Q_concat( path, sizeof( path ), sys_libdir->string,
- PATH_SEP_STRING, fs_game->string, PATH_SEP_STRING GAMELIB, NULL );
- entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
- }
-
+ // then try baseq2
+ Q_concat( path, sizeof( path ), sys_libdir->string,
+ PATH_SEP_STRING BASEGAME PATH_SEP_STRING GAMELIB, NULL );
+ entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
if( !entry ) {
- // try baseq2
- Q_concat( path, sizeof( path ), sys_libdir->string,
- PATH_SEP_STRING BASEGAME PATH_SEP_STRING GAMELIB, NULL );
+ // then try to fall back to refdir
+ Q_concat( path, sizeof( path ), sys_refdir->string,
+ PATH_SEP_STRING GAMELIB, NULL );
entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
if( !entry ) {
Com_Error( ERR_DROP, "Failed to load game DLL" );
diff --git a/source/sv_main.c b/source/sv_main.c
index a046439..425d14c 100644
--- a/source/sv_main.c
+++ b/source/sv_main.c
@@ -135,7 +135,7 @@ void SV_CleanClient( client_t *client ) {
#endif
if( client->download ) {
- FS_FreeFile( client->download );
+ Z_Free( client->download );
client->download = NULL;
}
diff --git a/source/sv_mvd.c b/source/sv_mvd.c
index 535a0ba..446a7fe 100644
--- a/source/sv_mvd.c
+++ b/source/sv_mvd.c
@@ -660,7 +660,7 @@ static void SV_MvdEmitGamestate( void ) {
player_state_t *ps;
entity_state_t *es;
size_t length;
- uint16_t *patch;
+ uint8_t *patch;
int flags, extra, portalbytes;
byte portalbits[MAX_MAP_AREAS/8];
@@ -731,7 +731,9 @@ static void SV_MvdEmitGamestate( void ) {
}
MSG_WriteShort( 0 );
- *patch = LittleShort( msg_write.cursize - 2 );
+ length = msg_write.cursize - 2;
+ patch[0] = length & 255;
+ patch[1] = ( length >> 8 ) & 255;
}
void SV_MvdClientNew( tcpClient_t *client ) {
diff --git a/source/sv_user.c b/source/sv_user.c
index 38a9807..ebe3137 100644
--- a/source/sv_user.c
+++ b/source/sv_user.c
@@ -146,7 +146,7 @@ static void write_compressed_gamestate( void ) {
entity_state_t *base;
int i, j;
size_t length;
- uint16_t *patch;
+ uint8_t *patch;
char *string;
MSG_WriteByte( svc_gamestate );
@@ -204,7 +204,8 @@ static void write_compressed_gamestate( void ) {
sv_client->name, svs.z.total_in, svs.z.total_out );
}
- *patch = LittleShort( svs.z.total_out );
+ patch[0] = svs.z.total_out & 255;
+ patch[1] = ( svs.z.total_out >> 8 ) & 255;
buf->cursize += svs.z.total_out;
}
@@ -531,7 +532,7 @@ static void SV_NextDownload_f( void ) {
MSG_WriteData( sv_client->download + sv_client->downloadcount - r, r );
if( sv_client->downloadcount == sv_client->downloadsize ) {
- FS_FreeFile( sv_client->download );
+ Z_Free( sv_client->download );
sv_client->download = NULL;
}
@@ -615,7 +616,7 @@ static void SV_BeginDownload_f( void ) {
filename = name;
- downloadsize = FS_LoadFileEx( filename, NULL, FS_FLAG_RAW );
+ downloadsize = FS_LoadFileEx( filename, NULL, FS_FLAG_RAW, TAG_SERVER );
if( downloadsize == INVALID_LENGTH || downloadsize == 0
// special check for maps, if it came from a pak file, don't allow
@@ -648,7 +649,8 @@ static void SV_BeginDownload_f( void ) {
return;
}
- sv_client->downloadsize = FS_LoadFileEx( filename, ( void ** )&sv_client->download, FS_FLAG_RAW );
+ sv_client->downloadsize = FS_LoadFileEx( filename,
+ ( void ** )&sv_client->download, FS_FLAG_RAW, TAG_SERVER );
sv_client->downloadcount = offset;
Com_DPrintf( "Downloading %s to %s\n", name, sv_client->name );
@@ -676,7 +678,7 @@ static void SV_StopDownload_f( void ) {
SV_ClientAddMessage( sv_client, MSG_RELIABLE|MSG_CLEAR );
Com_DPrintf( "Download for %s stopped by user request\n", sv_client->name );
- FS_FreeFile( sv_client->download );
+ Z_Free( sv_client->download );
sv_client->download = NULL;
}
@@ -935,7 +937,7 @@ static void SV_NewClientExecuteMove( int c, int net_drop ) {
numDups = c >> SVCMD_BITS;
c &= SVCMD_MASK;
- if( numDups > MAX_PACKET_FRAMES - 1 ) {
+ if( numDups >= MAX_PACKET_FRAMES ) {
SV_DropClient( sv_client, "too many frames in packet" );
return;
}
diff --git a/source/sv_world.c b/source/sv_world.c
index ca0a039..52c6b8b 100644
--- a/source/sv_world.c
+++ b/source/sv_world.c
@@ -113,7 +113,7 @@ void SV_ClearWorld( void ) {
SV_CreateAreaNode( 0, cm->mins, cm->maxs );
}
- /* make sure all entities are unlinked */
+ // make sure all entities are unlinked
for( i = 0; i < MAX_EDICTS; i++ ) {
ent = EDICT_NUM( i );
ent->area.prev = ent->area.next = NULL;
@@ -475,8 +475,7 @@ SV_ClipMoveToEntities
====================
*/
-void SV_ClipMoveToEntities ( moveclip_t *clip )
-{
+static void SV_ClipMoveToEntities( moveclip_t *clip ) {
int i, num;
edict_t *touchlist[MAX_EDICTS], *touch;
trace_t trace;
@@ -515,16 +514,7 @@ void SV_ClipMoveToEntities ( moveclip_t *clip )
clip->mins, clip->maxs, headnode, clip->contentmask,
touch->s.origin, touch->s.angles);
- clip->trace->allsolid |= trace.allsolid;
- clip->trace->startsolid |= trace.startsolid;
- if( trace.fraction < clip->trace->fraction ) {
- clip->trace->fraction = trace.fraction;
- VectorCopy( trace.endpos, clip->trace->endpos );
- clip->trace->plane = trace.plane;
- clip->trace->surface = trace.surface;
- clip->trace->contents |= trace.contents;
- clip->trace->ent = touch;
- }
+ CM_ClipEntity( clip->trace, &trace, touch );
}
}
diff --git a/source/sys_unix.c b/source/sys_unix.c
index 2f48063..293f2ca 100644
--- a/source/sys_unix.c
+++ b/source/sys_unix.c
@@ -73,8 +73,6 @@ static struct termios tty_orig;
static commandPrompt_t tty_prompt;
static int tty_hidden;
-void Sys_Printf( const char *fmt, ... );
-
/*
===============================================================================
@@ -150,6 +148,8 @@ static void Sys_InitTTY( void ) {
#endif
tty_prompt.printf = Sys_Printf;
tty_enabled = qtrue;
+
+ Sys_ConsoleWrite( " ", 1 );
}
static void Sys_ShutdownTTY( void ) {
@@ -727,19 +727,17 @@ void Sys_AddDefaultConfig( void ) {
struct stat st;
char *text;
- if( stat( DEFCFG, &st ) == -1 ) {
- return;
- }
-
fp = fopen( DEFCFG, "r" );
if( !fp ) {
return;
}
- Com_Printf( "Execing " DEFCFG "\n" );
- text = Cbuf_Alloc( &cmd_buffer, st.st_size );
- if( text ) {
- fread( text, st.st_size, 1, fp );
+ if( fstat( fileno( fp ), &st ) == 0 ) {
+ text = Cbuf_Alloc( &cmd_buffer, st.st_size );
+ if( text ) {
+ Com_Printf( "Execing " DEFCFG "\n" );
+ fread( text, st.st_size, 1, fp );
+ }
}
fclose( fp );
@@ -748,8 +746,8 @@ void Sys_AddDefaultConfig( void ) {
void Sys_Sleep( int msec ) {
struct timespec req;
- req.tv_sec = msec / 1000; msec %= 1000;
- req.tv_nsec = msec * 1000000;
+ req.tv_sec = msec / 1000;
+ req.tv_nsec = ( msec % 1000 ) * 1000000;
nanosleep( &req, NULL );
}
diff --git a/source/sys_win.c b/source/sys_win.c
index 06d6ebd..b1c4c09 100644
--- a/source/sys_win.c
+++ b/source/sys_win.c
@@ -631,7 +631,7 @@ MISC
static inline time_t Sys_FileTimeToUnixTime( FILETIME *f ) {
ULARGE_INTEGER u = *( ULARGE_INTEGER * )f;
- return ( time_t )( ( u.QuadPart - 116444736000000000U ) / 10000000 );
+ return ( time_t )( ( u.QuadPart - 116444736000000000ULL ) / 10000000 );
}
unsigned Sys_Milliseconds( void ) {
diff --git a/source/ui_menu.c b/source/ui_menu.c
index 44795a8..510f037 100644
--- a/source/ui_menu.c
+++ b/source/ui_menu.c
@@ -575,20 +575,21 @@ MenuList_Key
=================
*/
static int MenuList_Key( menuList_t *l, int key ) {
- int i;
+ //int i;
if( !l->items ) {
return QMS_NOTHANDLED;
}
- if( keys.IsDown( K_CTRL ) && key >= '1' && key <= '9' ) {
- int col = key - '0' - 1;
+ if( keys.IsDown( K_ALT ) && Q_isdigit( key ) ) {
+ int col = key == '0' ? 9 : key - '0' - 1;
if( l->sortdir && col < l->numcolumns ) {
return MenuList_SetColumn( l, col );
}
return QMS_NOTHANDLED;
}
+#if 0
if( key > 32 && key < 127 ) {
if( uis.realtime > l->scratchTime + 1300 ) {
l->scratchCount = 0;
@@ -620,11 +621,13 @@ static int MenuList_Key( menuList_t *l, int key ) {
return QMS_NOTHANDLED;
}
+#endif
l->scratchCount = 0;
switch( key ) {
case K_LEFTARROW:
+ case 'h':
if( l->sortdir ) {
if( l->sortcol > 0 ) {
return MenuList_SetColumn( l, l->sortcol - 1 );
@@ -633,6 +636,7 @@ static int MenuList_Key( menuList_t *l, int key ) {
}
break;
case K_RIGHTARROW:
+ case 'l':
if( l->sortdir ) {
if( l->sortcol < l->numcolumns - 1 ) {
return MenuList_SetColumn( l, l->sortcol + 1 );
@@ -642,6 +646,7 @@ static int MenuList_Key( menuList_t *l, int key ) {
break;
case K_UPARROW:
case K_KP_UPARROW:
+ case 'k':
if( l->curvalue > 0 ) {
l->curvalue--;
UI_CALLBACK( l, QM_CHANGE, l->curvalue );
@@ -652,6 +657,7 @@ static int MenuList_Key( menuList_t *l, int key ) {
case K_DOWNARROW:
case K_KP_DOWNARROW:
+ case 'j':
if( l->curvalue < l->numItems - 1 ) {
l->curvalue++;
UI_CALLBACK( l, QM_CHANGE, l->curvalue );
diff --git a/source/ui_multiplayer.c b/source/ui_multiplayer.c
index 61aa0f5..7139c66 100644
--- a/source/ui_multiplayer.c
+++ b/source/ui_multiplayer.c
@@ -58,9 +58,7 @@ typedef struct m_joinServer_s {
static m_joinServer_t m_join;
static void UpdateSelection( void ) {
- serverSlot_t *s;
-
- s = &m_join.servers[m_join.list.curvalue];
+ serverSlot_t *s = &m_join.servers[m_join.list.curvalue];
if( s->valid ) {
m_join.info.generic.flags &= ~QMF_HIDDEN;
@@ -108,7 +106,7 @@ static void ClearSlot( serverSlot_t *slot ) {
void UI_AddToServerList( const serverStatus_t *status ) {
serverSlot_t *slot;
- int i, j;
+ int i, j, k;
char *host, *map;
const char *info = status->infostring;
char key[MAX_STRING_CHARS];
@@ -149,10 +147,19 @@ void UI_AddToServerList( const serverStatus_t *status ) {
map = Info_ValueForKey( info, "mapname" );
if( !map[0] ) {
map = "???";
+ } else {
+ Com_sprintf( value, sizeof( value ), "maps/%s.bsp", map );
+ if( fs.LoadFile( value, NULL ) == INVALID_LENGTH ) {
+ Q_concat( value, sizeof( value ), S_COLOR_RED, map, NULL );
+ map = value;
+ }
}
j = atoi( Info_ValueForKey( info, "maxclients" ) );
- Com_sprintf( key, sizeof( key ), "%d/%d", status->numPlayers, j );
+ k = atoi( Info_ValueForKey( info, "needpass" ) );
+ Com_sprintf( key, sizeof( key ), "%s%d/%d",
+ status->numPlayers < j ? k > 0 ? S_COLOR_YELLOW : "" : S_COLOR_RED,
+ status->numPlayers, j );
if( m_join.names[i] ) {
com.Free( m_join.names[i] );
@@ -180,25 +187,25 @@ void UI_AddToServerList( const serverStatus_t *status ) {
slot->valid = qtrue;
- UpdateSelection();
+ UpdateSelection();
}
static void PingSelected( void ) {
- serverSlot_t *slot = &m_join.servers[m_join.list.curvalue];
+ serverSlot_t *s = &m_join.servers[m_join.list.curvalue];
if( m_join.names[m_join.list.curvalue] ) {
com.Free( m_join.names[m_join.list.curvalue] );
}
m_join.names[m_join.list.curvalue] = UI_FormatColumns( 0,
- slot->address, "???", "?/?", NULL );
+ s->address, "???", "?/?", NULL );
- ClearSlot( slot );
+ ClearSlot( s );
UpdateSelection();
m_join.menu.statusbar = "Pinging servers, please wait...";
client.UpdateScreen();
- client.SendStatusRequest( slot->realAddress, 0 );
+ client.SendStatusRequest( s->realAddress, 0 );
UpdateSelection();
}
@@ -325,51 +332,47 @@ static void Resize( void ) {
}
static int JoinServer_MenuCallback( int id, int msg, int param ) {
+ serverSlot_t *s = &m_join.servers[m_join.list.curvalue];
+
switch( msg ) {
case QM_ACTIVATE:
- if( id != ID_LIST ) {
- break;
- }
- cmd.ExecuteText( EXEC_APPEND, va( "connect \"%s\"\n",
- m_join.servers[m_join.list.curvalue].realAddress ) );
- UI_PopMenu();
- return QMS_IN;
-
+ if( id == ID_LIST ) {
+ cmd.ExecuteText( EXEC_APPEND,
+ va( "connect \"%s\"\n", s->realAddress ) );
+ UI_PopMenu();
+ return QMS_IN;
+ }
+ break;
case QM_KEY:
if( param == 'r' ) {
- cvar.Set( "rcon_address", m_join.servers[m_join.list.curvalue].realAddress );
- break;
+ cvar.Set( "rcon_address", s->realAddress );
+ return QMS_SILENT;
}
- if( param != 32 ) {
- break;
- }
- if( !keys.IsDown( K_ALT ) ) {
- PingSelected();
- } else {
- PingServers();
+ if( param == ' ' ) {
+ if( !keys.IsDown( K_ALT ) ) {
+ PingSelected();
+ } else {
+ PingServers();
+ }
+ return QMS_SILENT;
}
- return QMS_SILENT;
-
+ break;
case QM_CHANGE:
- if( id != ID_LIST ) {
- break;
- }
- UpdateSelection();
- return QMS_MOVE;
-
+ if( id == ID_LIST ) {
+ UpdateSelection();
+ return QMS_MOVE;
+ }
+ break;
case QM_DESTROY:
FreeListedServers();
break;
-
case QM_DESTROY_CHILD:
FreeListedServers();
AddUnlistedServers();
break;
-
case QM_SIZE:
Resize();
break;
-
default:
break;
}
diff --git a/source/vid_sdl.c b/source/vid_sdl.c
index ee15282..7e48223 100644
--- a/source/vid_sdl.c
+++ b/source/vid_sdl.c
@@ -80,7 +80,7 @@ static qboolean QSDL_SetMode( int flags, int forcedepth ) {
sdl.flags |= QVF_FULLSCREEN;
goto success;
}
- Com_EPrintf( "FS video mode failed: %s\n", SDL_GetError() );
+ Com_EPrintf( "Fullscreen video mode failed: %s\n", SDL_GetError() );
Cvar_Set( "vid_fullscreen", "0" );
}
@@ -99,6 +99,13 @@ success:
return qtrue;
}
+static void QSDL_Activate( SDL_Event *event ) {
+ // state is actually a bitmask!
+ if( event->active.state & SDL_APPACTIVE ) {
+ CL_AppActivate( event->active.gain ? qtrue : qfalse );
+ }
+}
+
void Video_ModeChanged( void ) {
SDL_Event event;
@@ -106,8 +113,17 @@ void Video_ModeChanged( void ) {
Com_Error( ERR_FATAL, "Couldn't change video mode: %s", SDL_GetError() );
}
- while( SDL_PollEvent( &event ) )
- ;
+ // ignore any pending resize events
+ while( SDL_PollEvent( &event ) ) {
+ switch( event.type ) {
+ case SDL_ACTIVEEVENT:
+ QSDL_Activate( &event );
+ break;
+ case SDL_QUIT:
+ Com_Quit();
+ break;
+ }
+ }
}
static qboolean QSDL_InitVideo( void ) {
@@ -319,20 +335,11 @@ void Video_PumpEvents( void ) {
while( SDL_PollEvent( &event ) ) {
switch( event.type ) {
case SDL_ACTIVEEVENT:
- // state is actually a bitmask!
- if( event.active.state & SDL_APPACTIVE ) {
- if( event.active.gain ) {
- CL_AppActivate( qtrue );
- } else {
- CL_AppActivate( qfalse );
- }
- }
+ QSDL_Activate( &event );
break;
-
case SDL_QUIT:
Com_Quit();
break;
-
case SDL_VIDEORESIZE:
if( sdl.surface->flags & SDL_RESIZABLE ) {
event.resize.w &= ~7;
@@ -343,19 +350,15 @@ void Video_PumpEvents( void ) {
return;
}
break;
-
case SDL_KEYDOWN:
QSDL_KeyEvent( &event.key.keysym, qtrue );
break;
-
case SDL_KEYUP:
QSDL_KeyEvent( &event.key.keysym, qfalse );
break;
-
case SDL_MOUSEBUTTONDOWN:
QSDL_MouseButtonEvent( event.button.button, qtrue );
break;
-
case SDL_MOUSEBUTTONUP:
QSDL_MouseButtonEvent( event.button.button, qfalse );
break;
diff --git a/source/win_glimp.c b/source/win_glimp.c
index a05babe..caffca5 100644
--- a/source/win_glimp.c
+++ b/source/win_glimp.c
@@ -158,7 +158,7 @@ static qboolean GLimp_InitGL( void ) {
return qtrue;
fail1:
- Com_DPrintf( "failed with error %#x\n", GetLastError() );
+ Com_DPrintf( "failed with error %#lx\n", GetLastError() );
fail2:
if( glw.hGLRC && qwglDeleteContext ) {
qwglDeleteContext( glw.hGLRC );
diff --git a/wiki/index.mdwn b/wiki/index.mdwn
index 3b7a9af..4c9f452 100644
--- a/wiki/index.mdwn
+++ b/wiki/index.mdwn
@@ -1,9 +1,9 @@
Introduction
-----------------
-Q2PRO is a [Quake2][] engine modification, based on source code released
+Q2PRO is a [Quake 2][] engine modification, based on source code released
under the GPL by id Software. This is not a standalone game as it does not
-provide own media content, but rather an enhancement over original Quake2
+provide own media content, but rather an enhancement over original Quake 2
release designed for everyday use.
@@ -11,13 +11,13 @@ Feature highlights
-----------------
* __Improved security and stability.__ Q2PRO client and server, being in
- development since 2003, addresses all critical Quake2 engine vulnerabilities
+ development since 2003, addresses all critical Quake 2 engine vulnerabilities
known to the author.
* __Performance increases.__ OpenGL refresh module has been completely
rewritten to take full advantage of capabilities of modern hardware.
By greatly reducing driver overhead, Q2PRO provides performace
- increases up to 200% of default Quake2 renderer speed.
+ increases up to 200% of default Quake 2 renderer speed.
* __Enhanced console input.__ Q2PRO supports bash(1)-like autocompletion not of
just commands and cvars, but also agruments of many frequently used commands.
@@ -25,7 +25,7 @@ Feature highlights
command line editing much more convenient.
* __Basic demo editing.__ Good news for those frustrated of inability of
- Quake2 client to record demos while playing back: Q2PRO supports this
+ Quake 2 client to record demos while playing back: Q2PRO supports this
natively. There is no longer need for external demo editor to perform some
basic operations like cutting interesting frags out of a demo.
@@ -40,7 +40,7 @@ Feature highlights
* __Multi View Demo support.__ Q2PRO server is capable of recording and playing
back demos is special MVD format, which captures view updates of all players.
Clients themselves choose which view they would like to watch during playback,
- which is completely transparent and supported for _all_ Quake2 clients.
+ which is completely transparent and supported for _all_ Quake 2 clients.
* __Game TeleVision support.__ Q2PRO server may act as game retranslator node,
allowing massive amount of spectators watch game match in real time without
@@ -50,7 +50,7 @@ Feature highlights
unlike many other GTV implementations.
* __Frame rates separation.__ Q2PRO client provides "true" networking, physics,
- rendering and input polling frame rates separation. Unlike other Quake2 clients,
+ rendering and input polling frame rates separation. Unlike other Quake 2 clients,
Q2PRO will not waste CPU cycles drawing frames never actually seen on screen,
but will poll for user input instead in order to minimize input latency.