Merge pull request #3 from zturtleman/update

Update ioq3, fix OS X, minor fixes
This commit is contained in:
Tomi Isoaho 2015-10-04 21:39:39 +03:00
commit c3cc9fb7f7
172 changed files with 4995 additions and 4506 deletions

2
.gitignore vendored
View file

@ -35,3 +35,5 @@ profile
# Microsoft Visual Studio
####################
*.sdf
*.opensdf
*.suo

297
Makefile
View file

@ -6,7 +6,7 @@
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]'|sed -e 's/\//_/g')
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/)
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/ | sed -e 's/^arm.*/arm/')
ifeq ($(COMPILE_PLATFORM),sunos)
# Solaris uname and GNU uname differ
@ -52,11 +52,22 @@ endif
#############################################################################
-include Makefile.local
ifeq ($(COMPILE_PLATFORM),cygwin)
PLATFORM=mingw32
endif
ifndef PLATFORM
PLATFORM=$(COMPILE_PLATFORM)
endif
export PLATFORM
ifeq ($(PLATFORM),mingw32)
MINGW=1
endif
ifeq ($(PLATFORM),mingw64)
MINGW=1
endif
ifeq ($(COMPILE_ARCH),i86pc)
COMPILE_ARCH=x86
endif
@ -160,7 +171,7 @@ USE_CURL=1
endif
ifndef USE_CURL_DLOPEN
ifeq ($(PLATFORM),mingw32)
ifdef MINGW
USE_CURL_DLOPEN=0
else
USE_CURL_DLOPEN=1
@ -187,32 +198,36 @@ ifndef USE_FREETYPE
USE_FREETYPE=0
endif
ifndef USE_INTERNAL_LIBS
USE_INTERNAL_LIBS=1
endif
ifndef USE_INTERNAL_SPEEX
USE_INTERNAL_SPEEX=1
USE_INTERNAL_SPEEX=$(USE_INTERNAL_LIBS)
endif
ifndef USE_INTERNAL_OGG
USE_INTERNAL_OGG=1
USE_INTERNAL_OGG=$(USE_INTERNAL_LIBS)
endif
ifndef USE_INTERNAL_VORBIS
USE_INTERNAL_VORBIS=1
USE_INTERNAL_VORBIS=$(USE_INTERNAL_LIBS)
endif
ifndef USE_INTERNAL_OPUS
USE_INTERNAL_OPUS=1
USE_INTERNAL_OPUS=$(USE_INTERNAL_LIBS)
endif
ifndef USE_INTERNAL_ZLIB
USE_INTERNAL_ZLIB=1
USE_INTERNAL_ZLIB=$(USE_INTERNAL_LIBS)
endif
ifndef USE_INTERNAL_JPEG
USE_INTERNAL_JPEG=1
USE_INTERNAL_JPEG=$(USE_INTERNAL_LIBS)
endif
ifndef USE_LOCAL_HEADERS
USE_LOCAL_HEADERS=1
USE_LOCAL_HEADERS=$(USE_INTERNAL_LIBS)
endif
ifndef USE_RENDERER_DLOPEN
@ -266,19 +281,23 @@ ifneq ($(BUILD_CLIENT),0)
# set PKG_CONFIG_PATH to influence this, e.g.
# PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig
ifneq ($(call bin_path, pkg-config),)
CURL_CFLAGS=$(shell pkg-config --silence-errors --cflags libcurl)
CURL_LIBS=$(shell pkg-config --silence-errors --libs libcurl)
OPENAL_CFLAGS=$(shell pkg-config --silence-errors --cflags openal)
OPENAL_LIBS=$(shell pkg-config --silence-errors --libs openal)
SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//')
SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl2)
FREETYPE_CFLAGS=$(shell pkg-config --silence-errors --cflags freetype2)
CURL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags libcurl)
CURL_LIBS ?= $(shell pkg-config --silence-errors --libs libcurl)
OPENAL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags openal)
OPENAL_LIBS ?= $(shell pkg-config --silence-errors --libs openal)
SDL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//')
SDL_LIBS ?= $(shell pkg-config --silence-errors --libs sdl2)
FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2)
else
# assume they're in the system default paths (no -I or -L needed)
CURL_LIBS ?= -lcurl
OPENAL_LIBS ?= -lopenal
endif
# Use sdl-config if all else fails
# Use sdl2-config if all else fails
ifeq ($(SDL_CFLAGS),)
ifneq ($(call bin_path, sdl2-config),)
SDL_CFLAGS=$(shell sdl2-config --cflags)
SDL_LIBS=$(shell sdl2-config --libs)
SDL_CFLAGS ?= $(shell sdl2-config --cflags)
SDL_LIBS ?= $(shell sdl2-config --libs)
endif
endif
endif
@ -298,42 +317,30 @@ endif
# SETUP AND BUILD -- LINUX
#############################################################################
## Defaults
LIB=lib
INSTALL=install
MKDIR=mkdir
EXTRA_FILES=
CLIENT_EXTRA_FILES=
ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
ifeq ($(ARCH),x86_64)
LIB=lib64
else
ifeq ($(ARCH),ppc64)
LIB=lib64
else
ifeq ($(ARCH),s390x)
LIB=lib64
endif
endif
endif
ifneq (,$(findstring "$(COMPILE_PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
TOOLS_CFLAGS += -DARCH_STRING=\"$(COMPILE_ARCH)\"
endif
ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-pipe -DUSE_ICON -DREACTION
-pipe -DUSE_ICON -DARCH_STRING=\\\"$(ARCH)\\\" -DREACTION
CLIENT_CFLAGS += $(SDL_CFLAGS) -DREACTION
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
OPTIMIZEVM = -O3
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
ifeq ($(ARCH),x86_64)
OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops \
-falign-functions=2 -fstrength-reduce
OPTIMIZEVM = -O3
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED = true
else
ifeq ($(ARCH),x86)
OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer \
-funroll-loops -falign-functions=2 -fstrength-reduce
OPTIMIZEVM = -O3 -march=i586
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED=true
else
@ -370,13 +377,14 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += -lopenal
CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
endif
endif
ifeq ($(USE_CURL),1)
CLIENT_CFLAGS += $(CURL_CFLAGS)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
CLIENT_LIBS += $(CURL_LIBS)
endif
endif
@ -384,10 +392,6 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
CLIENT_LIBS += -lrt
endif
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += $(FREETYPE_CFLAGS)
endif
ifeq ($(ARCH),x86)
# linux32 make ...
BASE_CFLAGS += -m32
@ -409,14 +413,15 @@ ifeq ($(PLATFORM),darwin)
RENDERER_LIBS=
OPTIMIZEVM=
BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes -DREACTION
BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes -mmacosx-version-min=10.5 \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 -DREACTION
ifeq ($(ARCH),ppc)
BASE_CFLAGS += -arch ppc -faltivec -mmacosx-version-min=10.2
BASE_CFLAGS += -arch ppc -faltivec
OPTIMIZEVM += -O3
endif
ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -arch ppc64 -faltivec -mmacosx-version-min=10.2
BASE_CFLAGS += -arch ppc64 -faltivec
endif
ifeq ($(ARCH),x86)
OPTIMIZEVM += -march=prescott -mfpmath=sse
@ -436,13 +441,13 @@ ifeq ($(PLATFORM),darwin)
endif
ifeq ($(CROSS_COMPILING),1)
ifeq ($(ARCH),ppc)
CC=powerpc-apple-darwin10-gcc
RANLIB=powerpc-apple-darwin10-ranlib
ifeq ($(ARCH),x86_64)
CC=x86_64-apple-darwin13-cc
RANLIB=x86_64-apple-darwin13-ranlib
else
ifeq ($(ARCH),x86)
CC=i686-apple-darwin10-gcc
RANLIB=i686-apple-darwin10-ranlib
CC=i386-apple-darwin13-cc
RANLIB=i386-apple-darwin13-ranlib
else
$(error Architecture $(ARCH) is not supported when cross compiling)
endif
@ -460,15 +465,12 @@ ifeq ($(PLATFORM),darwin)
endif
ifeq ($(USE_CURL),1)
CLIENT_CFLAGS += $(CURL_CFLAGS)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
CLIENT_LIBS += $(CURL_LIBS)
endif
endif
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += $(FREETYPE_CFLAGS)
endif
BASE_CFLAGS += -D_THREAD_SAFE=1
ifeq ($(USE_LOCAL_HEADERS),1)
@ -482,6 +484,7 @@ ifeq ($(PLATFORM),darwin)
CLIENT_LIBS += -framework IOKit \
$(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
RENDERER_LIBS += -framework OpenGL $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
@ -498,7 +501,7 @@ else # ifeq darwin
# SETUP AND BUILD -- MINGW32
#############################################################################
ifeq ($(PLATFORM),mingw32)
ifdef MINGW
ifeq ($(CROSS_COMPILING),1)
# If CC is already set to something generic, we probably want to use
@ -512,7 +515,7 @@ ifeq ($(PLATFORM),mingw32)
MINGW_PREFIXES=amd64-mingw32msvc x86_64-w64-mingw32
endif
ifeq ($(ARCH),x86)
MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32
MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32 i686-pc-mingw32
endif
ifndef CC
@ -556,14 +559,12 @@ ifeq ($(PLATFORM),mingw32)
endif
ifeq ($(ARCH),x86_64)
OPTIMIZEVM = -O3 -fno-omit-frame-pointer \
-funroll-loops -falign-functions=2 -fstrength-reduce
OPTIMIZE = $(OPTIMIZEVM) --fast-math
OPTIMIZEVM = -O3
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED = true
endif
ifeq ($(ARCH),x86)
OPTIMIZEVM = -O3 -march=i586 -fno-omit-frame-pointer \
-funroll-loops -falign-functions=2 -fstrength-reduce
OPTIMIZEVM = -O3 -march=i586
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED = true
endif
@ -578,13 +579,21 @@ ifeq ($(PLATFORM),mingw32)
TOOLS_BINEXT=.exe
endif
ifeq ($(COMPILE_PLATFORM),cygwin)
TOOLS_BINEXT=.exe
TOOLS_CC=$(CC)
endif
LIBS= -lws2_32 -lwinmm -lpsapi
# clang 3.4 doesn't support this
ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
CLIENT_LDFLAGS += -mwindows
endif
CLIENT_LIBS = -lgdi32 -lole32
RENDERER_LIBS = -lgdi32 -lole32 -lopengl32
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -Ifreetype2
FREETYPE_CFLAGS = -Ifreetype2
endif
ifeq ($(USE_CURL),1)
@ -622,12 +631,14 @@ ifeq ($(PLATFORM),mingw32)
RENDERER_LIBS += $(LIBSDIR)/win32/libSDL2main.a \
$(LIBSDIR)/win32/libSDL2.dll.a
SDLDLL=SDL2.dll
CLIENT_EXTRA_FILES += $(LIBSDIR)/win32/SDL2.dll
else
CLIENT_LIBS += $(LIBSDIR)/win64/libSDL264main.a \
$(LIBSDIR)/win64/libSDL264.dll.a
RENDERER_LIBS += $(LIBSDIR)/win64/libSDL264main.a \
$(LIBSDIR)/win64/libSDL264.dll.a
SDLDLL=SDL264.dll
CLIENT_EXTRA_FILES += $(LIBSDIR)/win64/SDL264.dll
endif
else
CLIENT_CFLAGS += $(SDL_CFLAGS)
@ -636,7 +647,7 @@ ifeq ($(PLATFORM),mingw32)
SDLDLL=SDL2.dll
endif
else # ifeq mingw32
else # ifdef MINGW
#############################################################################
# SETUP AND BUILD -- FREEBSD
@ -651,7 +662,7 @@ ifeq ($(PLATFORM),freebsd)
CLIENT_CFLAGS += $(SDL_CFLAGS)
HAVE_VM_COMPILED = true
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
OPTIMIZEVM = -O3
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
SHLIBEXT=so
@ -670,13 +681,14 @@ ifeq ($(PLATFORM),freebsd)
# optional features/libraries
ifeq ($(USE_OPENAL),1)
ifeq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += $(THREAD_LIBS) -lopenal
CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
endif
endif
ifeq ($(USE_CURL),1)
CLIENT_CFLAGS += $(CURL_CFLAGS)
ifeq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
CLIENT_LIBS += $(CURL_LIBS)
endif
endif
@ -703,18 +715,16 @@ ifeq ($(PLATFORM),openbsd)
-pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON -DREACTION
CLIENT_CFLAGS += $(SDL_CFLAGS)
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
OPTIMIZEVM = -O3
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
ifeq ($(ARCH),x86_64)
OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops \
-falign-functions=2 -fstrength-reduce
OPTIMIZEVM = -O3
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED = true
else
ifeq ($(ARCH),x86)
OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer \
-funroll-loops -falign-functions=2 -fstrength-reduce
OPTIMIZEVM = -O3 -march=i586
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED=true
else
@ -761,13 +771,13 @@ ifeq ($(PLATFORM),openbsd)
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += $(THREAD_LIBS) -lopenal
CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
endif
endif
ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
CLIENT_LIBS += $(CURL_LIBS)
endif
endif
else # ifeq openbsd
@ -798,6 +808,7 @@ else # ifeq netbsd
#############################################################################
ifeq ($(PLATFORM),irix64)
LIB=lib
ARCH=mips
@ -888,7 +899,7 @@ else # ifeq sunos
endif #Linux
endif #darwin
endif #mingw32
endif #MINGW
endif #FreeBSD
endif #OpenBSD
endif #NetBSD
@ -910,10 +921,6 @@ endif
TARGETS =
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -DBUILD_FREETYPE
endif
ifndef FULLBINEXT
FULLBINEXT=.$(ARCH)$(BINEXT)
endif
@ -929,12 +936,12 @@ endif
ifneq ($(BUILD_CLIENT),0)
ifneq ($(USE_RENDERER_DLOPEN),0)
TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT) $(B)/renderer_opengl1_$(SHLIBNAME)
ifneq ($(BUILD_RENDERER_OPENGL2), 0)
ifneq ($(BUILD_RENDERER_OPENGL2),0)
TARGETS += $(B)/renderer_opengl2_$(SHLIBNAME)
endif
else
TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT)
ifneq ($(BUILD_RENDERER_OPENGL2), 0)
ifneq ($(BUILD_RENDERER_OPENGL2),0)
TARGETS += $(B)/$(CLIENTBIN)_opengl2$(FULLBINEXT)
endif
endif
@ -984,40 +991,43 @@ ifeq ($(USE_CURL),1)
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
NEED_OGG=1
endif
ifeq ($(USE_CODEC_OPUS),1)
CLIENT_CFLAGS += -DUSE_CODEC_OPUS
ifeq ($(USE_INTERNAL_OPUS),1)
CLIENT_CFLAGS += -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DUSE_ALLOCA \
OPUS_CFLAGS = -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DUSE_ALLOCA \
-I$(OPUSDIR)/include -I$(OPUSDIR)/celt -I$(OPUSDIR)/silk \
-I$(OPUSDIR)/silk/float
CLIENT_CFLAGS += -I$(OPUSFILEDIR)/include
-I$(OPUSDIR)/silk/float -I$(OPUSFILEDIR)/include
else
CLIENT_LIBS += -lopusfile -lopus
OPUS_CFLAGS ?= $(shell pkg-config --silence-errors --cflags opusfile opus || true)
OPUS_LIBS ?= $(shell pkg-config --silence-errors --libs opusfile opus || echo -lopusfile -lopus)
endif
CLIENT_CFLAGS += $(OPUS_CFLAGS)
CLIENT_LIBS += $(OPUS_LIBS)
NEED_OGG=1
endif
ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
ifeq ($(USE_INTERNAL_VORBIS),1)
CLIENT_CFLAGS += -I$(VORBISDIR)/include -I$(VORBISDIR)/lib
else
VORBIS_CFLAGS ?= $(shell pkg-config --silence-errors --cflags vorbisfile vorbis || true)
VORBIS_LIBS ?= $(shell pkg-config --silence-errors --libs vorbisfile vorbis || echo -lvorbisfile -lvorbis)
endif
CLIENT_CFLAGS += $(VORBIS_CFLAGS)
CLIENT_LIBS += $(VORBIS_LIBS)
NEED_OGG=1
endif
ifeq ($(NEED_OGG),1)
ifeq ($(USE_INTERNAL_OGG),1)
CLIENT_CFLAGS += -I$(OGGDIR)/include
OGG_CFLAGS = -I$(OGGDIR)/include
else
CLIENT_LIBS += -logg
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
ifeq ($(USE_INTERNAL_VORBIS),1)
CLIENT_CFLAGS += -I$(VORBISDIR)/include -I$(VORBISDIR)/lib
else
CLIENT_LIBS += -lvorbisfile -lvorbis
OGG_CFLAGS ?= $(shell pkg-config --silence-errors --cflags ogg || true)
OGG_LIBS ?= $(shell pkg-config --silence-errors --libs ogg || echo -logg)
endif
CLIENT_CFLAGS += $(OGG_CFLAGS)
CLIENT_LIBS += $(OGG_LIBS)
endif
ifeq ($(USE_RENDERER_DLOPEN),1)
@ -1032,28 +1042,42 @@ ifeq ($(USE_VOIP),1)
CLIENT_CFLAGS += -DUSE_VOIP
SERVER_CFLAGS += -DUSE_VOIP
ifeq ($(USE_INTERNAL_SPEEX),1)
CLIENT_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include
SPEEX_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include
else
CLIENT_LIBS += -lspeex -lspeexdsp
SPEEX_CFLAGS ?= $(shell pkg-config --silence-errors --cflags speex speexdsp || true)
SPEEX_LIBS ?= $(shell pkg-config --silence-errors --libs speex speexdsp || echo -lspeex -lspeexdsp)
endif
CLIENT_CFLAGS += $(SPEEX_CFLAGS)
CLIENT_LIBS += $(SPEEX_LIBS)
endif
ifeq ($(USE_INTERNAL_ZLIB),1)
BASE_CFLAGS += -DNO_GZIP
BASE_CFLAGS += -I$(ZDIR)
ZLIB_CFLAGS = -DNO_GZIP -I$(ZDIR)
else
LIBS += -lz
ZLIB_CFLAGS ?= $(shell pkg-config --silence-errors --cflags zlib || true)
ZLIB_LIBS ?= $(shell pkg-config --silence-errors --libs zlib || echo -lz)
endif
BASE_CFLAGS += $(ZLIB_CFLAGS)
LIBS += $(ZLIB_LIBS)
ifeq ($(USE_INTERNAL_JPEG),1)
BASE_CFLAGS += -DUSE_INTERNAL_JPEG
BASE_CFLAGS += -I$(JPDIR)
else
RENDERER_LIBS += -ljpeg
# IJG libjpeg doesn't have pkg-config, but libjpeg-turbo uses libjpeg.pc;
# we fall back to hard-coded answers if libjpeg.pc is unavailable
JPEG_CFLAGS ?= $(shell pkg-config --silence-errors --cflags libjpeg || true)
JPEG_LIBS ?= $(shell pkg-config --silence-errors --libs libjpeg || echo -ljpeg)
BASE_CFLAGS += $(JPEG_CFLAGS)
RENDERER_LIBS += $(JPEG_LIBS)
endif
ifeq ($(USE_FREETYPE),1)
RENDERER_LIBS += -lfreetype
FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2 || true)
FREETYPE_LIBS ?= $(shell pkg-config --silence-errors --libs freetype2 || echo -lfreetype)
BASE_CFLAGS += -DBUILD_FREETYPE $(FREETYPE_CFLAGS)
RENDERER_LIBS += $(FREETYPE_LIBS)
endif
ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
@ -1207,11 +1231,34 @@ release:
CLIENT_CFLAGS="$(CLIENT_CFLAGS)" SERVER_CFLAGS="$(SERVER_CFLAGS)" V=$(V)
ifneq ($(call bin_path, tput),)
TERM_COLUMNS=$(shell echo $$((`tput cols`-4)))
TERM_COLUMNS=$(shell if c=`tput cols`; then echo $$(($$c-4)); else echo 76; fi)
else
TERM_COLUMNS=76
endif
define ADD_COPY_TARGET
TARGETS += $2
$2: $1
$(echo_cmd) "CP $$<"
@cp $1 $2
endef
# These functions allow us to generate rules for copying a list of files
# into the base directory of the build; this is useful for bundling libs,
# README files or whatever else
define GENERATE_COPY_TARGETS
$(foreach FILE,$1, \
$(eval $(call ADD_COPY_TARGET, \
$(FILE), \
$(addprefix $(B)/,$(notdir $(FILE))))))
endef
$(call GENERATE_COPY_TARGETS,$(EXTRA_FILES))
ifneq ($(BUILD_CLIENT),0)
$(call GENERATE_COPY_TARGETS,$(CLIENT_EXTRA_FILES))
endif
NAKED_TARGETS=$(shell echo $(TARGETS) | sed -e "s!$(B)/!!g")
print_list=@for i in $(1); \
@ -1591,7 +1638,7 @@ Q3OBJ = \
$(B)/client/con_log.o \
$(B)/client/sys_main.o
ifeq ($(PLATFORM),mingw32)
ifdef MINGW
Q3OBJ += \
$(B)/client/con_passive.o
else
@ -1612,11 +1659,11 @@ Q3R2OBJ = \
$(B)/renderergl2/tr_font.o \
$(B)/renderergl2/tr_glsl.o \
$(B)/renderergl2/tr_image.o \
$(B)/renderergl2/tr_image_png.o \
$(B)/renderergl2/tr_image_jpg.o \
$(B)/renderergl2/tr_image_bmp.o \
$(B)/renderergl2/tr_image_tga.o \
$(B)/renderergl2/tr_image_jpg.o \
$(B)/renderergl2/tr_image_pcx.o \
$(B)/renderergl2/tr_image_png.o \
$(B)/renderergl2/tr_image_tga.o \
$(B)/renderergl2/tr_init.o \
$(B)/renderergl2/tr_light.o \
$(B)/renderergl2/tr_main.o \
@ -1678,11 +1725,11 @@ Q3ROBJ = \
$(B)/renderergl1/tr_flares.o \
$(B)/renderergl1/tr_font.o \
$(B)/renderergl1/tr_image.o \
$(B)/renderergl1/tr_image_png.o \
$(B)/renderergl1/tr_image_jpg.o \
$(B)/renderergl1/tr_image_bmp.o \
$(B)/renderergl1/tr_image_tga.o \
$(B)/renderergl1/tr_image_jpg.o \
$(B)/renderergl1/tr_image_pcx.o \
$(B)/renderergl1/tr_image_png.o \
$(B)/renderergl1/tr_image_tga.o \
$(B)/renderergl1/tr_init.o \
$(B)/renderergl1/tr_light.o \
$(B)/renderergl1/tr_main.o \
@ -2035,7 +2082,7 @@ ifeq ($(HAVE_VM_COMPILED),true)
endif
endif
ifeq ($(PLATFORM),mingw32)
ifdef MINGW
Q3OBJ += \
$(B)/client/win_resource.o \
$(B)/client/sys_win32.o
@ -2203,7 +2250,7 @@ ifeq ($(HAVE_VM_COMPILED),true)
endif
endif
ifeq ($(PLATFORM),mingw32)
ifdef MINGW
Q3DOBJ += \
$(B)/ded/win_resource.o \
$(B)/ded/sys_win32.o \
@ -2795,7 +2842,7 @@ distclean: clean toolsclean
@rm -rf $(BUILD_DIR)
installer: release
ifeq ($(PLATFORM),mingw32)
ifdef MINGW
@$(MAKE) VERSION=$(VERSION) -C $(NSISDIR) V=$(V) \
SDLDLL=$(SDLDLL) \
USE_RENDERER_DLOPEN=$(USE_RENDERER_DLOPEN) \

274
README.md
View file

@ -38,6 +38,8 @@ The original id software readme that accompanied the Q3 source release has been
renamed to id-readme.txt so as to prevent confusion. Please refer to the
web-site for updated status.
More documentation is on:
http://wiki.ioquake3.org/
# Compilation and installation
@ -86,6 +88,7 @@ Makefile.local:
BUILD_STANDALONE - build binaries suited for stand-alone games
SERVERBIN - rename 'ioq3ded' server binary
CLIENTBIN - rename 'ioquake3' client binary
USE_RENDERER_DLOPEN - build and use the renderer in a library
BASEGAME - rename 'baseq3'
BASEGAME_CFLAGS - custom CFLAGS for basegame
MISSIONPACK - rename 'missionpack'
@ -98,6 +101,10 @@ Makefile.local:
USE_CODEC_OPUS - enable Ogg Opus support
USE_MUMBLE - enable Mumble support
USE_VOIP - enable built-in VoIP support
USE_INTERNAL_LIBS - build internal libraries instead of dynamically
linking against system libraries; this just sets
the default for USE_INTERNAL_SPEEX etc.
and USE_LOCAL_HEADERS
USE_INTERNAL_SPEEX - build internal speex library instead of dynamically
linking against system libspeex
USE_FREETYPE - enable FreeType support for rendering fonts
@ -314,210 +321,12 @@ The defaults for these variables differ depending on the target platform.
all bots even if someone is named "allbots")
tell <client num> <msg> - send message to a single client (new to server)
cvar_modified [filter] - list modified cvars, can filter results (such as "r*"
for renderer cvars) like cvarlist which lists all cvars
```
# README for Users
## Using shared libraries instead of qvm
To force Q3 to use shared libraries instead of qvms run it with the following
parameters: `+set sv_pure 0 +set vm_cgame 0 +set vm_game 0 +set vm_ui 0`
## Using Demo Data Files
Copy demoq3/pak0.pk3 from the demo installer to your baseq3 directory. The
qvm files in this pak0.pk3 will not work, so you have to use the native
shared libraries or qvms from this project. To use the new qvms, they must be
put into a pk3 file. A pk3 file is just a zip file, so any compression tool
that can create such files will work. The shared libraries should already be
in the correct place. Use the instructions above to use them.
Please bear in mind that you will not be able to play online using the demo
data, nor is it something that we like to spend much time maintaining or
supporting.
## Help! Ioquake3 won't give me an fps of X anymore when setting com_maxfps!
Ioquake3 now uses the select() system call to wait for the rendering of the
next frame when com_maxfps was hit. This will improve your CPU load
considerably in these cases. However, not all systems may support a
granularity for its timing functions that is required to perform this waiting
correctly. For instance, ioquake3 tells select() to wait 2 milliseconds, but
really it can only wait for a multiple of 5ms, i.e. 5, 10, 15, 20... ms.
In this case you can always revert back to the old behaviour by setting the
cvar com_busyWait to 1.
## Using HTTP/FTP Download Support (Server)
You can enable redirected downloads on your server even if it's not
an ioquake3 server. You simply need to use the 'sets' command to put
the sv_dlURL cvar into your SERVERINFO string and ensure sv_allowDownloads
is set to 1
sv_dlURL is the base of the URL that contains your custom .pk3 files
the client will append both fs_game and the filename to the end of
this value. For example, if you have sv_dlURL set to
`"http://ioquake3.org"`, fs_game is `"baseq3"`, and the client is
missing `"test.pk3"`, it will attempt to download from the URL
`"http://ioquake3.org/baseq3/test.pk3"`
sv_allowDownload's value is now a bitmask made up of the following
flags:
* 1 - ENABLE
* 4 - do not use UDP downloads
* 8 - do not ask the client to disconnect when using HTTP/FTP
Server operators who are concerned about potential "leeching" from their
HTTP servers from other ioquake3 servers can make use of the HTTP_REFERER
that ioquake3 sets which is `"ioQ3://{SERVER_IP}:{SERVER_PORT}"`. For,
example, Apache's mod_rewrite can restrict access based on HTTP_REFERER.
On a sidenote, downloading via UDP has been improved and yields higher data
rates now. You can configure the maximum bandwidth for UDP downloads via the
cvar sv_dlRate. Due to system-specific limits the download rate is capped
at about 1 Mbyte/s per client, so curl downloading may still be faster.
## Using HTTP/FTP Download Support (Client)
Simply setting cl_allowDownload to 1 will enable HTTP/FTP downloads
assuming ioquake3 was compiled with USE_CURL=1 (the default).
like sv_allowDownload, cl_allowDownload also uses a bitmask value
supporting the following flags:
* 1 - ENABLE
* 2 - do not use HTTP/FTP downloads
* 4 - do not use UDP downloads
When ioquake3 is built with USE_CURL_DLOPEN=1 (default on some platforms),
it will use the value of the cvar cl_cURLLib as the filename of the cURL
library to dynamically load.
## Multiuser Support on Windows systems
On Windows, all user specific files such as autogenerated configuration,
demos, videos, screenshots, and autodownloaded pk3s are now saved in a
directory specific to the user who is running ioquake3.
On NT-based such as Windows XP, this is usually a directory named:
C:\Documents and Settings\%USERNAME%\Application Data\Quake3\
Windows 95, Windows 98, and Windows ME will use a directory like:
C:\Windows\Application Data\Quake3
in single-user mode, or:
C:\Windows\Profiles\%USERNAME%\Application Data\Quake3
if multiple logins have been enabled.
In order to access this directory more easily, the installer may create a
Shortcut which has its target set to:
%APPDATA%\Quake3\
This Shortcut would work for all users on the system regardless of the
locale settings. Unfortunately, this environment variable is only
present on Windows NT based systems.
You can revert to the old single-user behaviour by setting the fs_homepath
cvar to the directory where ioquake3 is installed. For example:
ioquake3.exe +set fs_homepath "c:\ioquake3"
Note that this cvar MUST be set as a command line parameter.
## SDL Keyboard Differences
ioquake3 clients have different keyboard behaviour compared to the original
Quake3 clients.
* "Caps Lock" and "Num Lock" can not be used as normal binds since they
do not send a KEYUP event until the key is pressed again.
* SDL > 1.2.9 does not support disabling dead key recognition. In order to
send dead key characters (e.g. ~, ', `, and ^), you must key a Space (or
sometimes the same character again) after the character to send it on
many international keyboard layouts.
* The SDL client supports many more keys than the original Quake3 client.
For example the keys: "Windows", "SysReq", "ScrollLock", and "Break".
For non-US keyboards, all of the so called "World" keys are now supported
as well as F13, F14, F15, and the country-specific mode/meta keys.
On many international layouts the default console toggle keys are also dead
keys, meaning that dropping the console potentially results in
unintentionally initiating the keying of a dead key. Furthermore SDL 1.2's
dead key support is broken by design and Q3 doesn't support non-ASCII text
entry, so the chances are you won't get the correct character anyway.
If you use such a keyboard layout, you can set the cvar cl_consoleKeys. This
is a space delimited list of key names that will toggle the console. The key
names are the usual Q3 names e.g. "~", "`", "c", "BACKSPACE", "PAUSE",
"WINDOWS" etc. It's also possible to use ASCII characters, by hexadecimal
number. Some example values for cl_consoleKeys:
"~ ` 0x7e 0x60" Toggle on ~ or ` (the default)
"WINDOWS" Toggle on the Windows key
"c" Toggle on the c key
"0x43" Toggle on the C character (Shift-c)
"PAUSE F1 PGUP" Toggle on the Pause, F1 or Page Up keys
Note that when you elect a set of console keys or characters, they cannot
then be used for binding, nor will they generate characters when entering
text. Also, in addition to the nominated console keys, Shift-ESC is hard
coded to always toggle the console.
## QuakeLive mouse acceleration
(patch and this text written by TTimo from id)
I've been using an experimental mouse acceleration code for a while, and
decided to make it available to everyone. Don't be too worried if you don't
understand the explanations below, this is mostly intended for advanced
players:
To enable it, set cl_mouseAccelStyle 1 (0 is the default/legacy behavior)
New style is controlled with 3 cvars:
sensitivity
cl_mouseAccel
cl_mouseAccelOffset
The old code (cl_mouseAccelStyle 0) can be difficult to calibrate because if
you have a base sensitivity setup, as soon as you set a non zero acceleration
your base sensitivity at low speeds will change as well. The other problem
with style 0 is that you are stuck on a square (power of two) acceleration
curve.
The new code tries to solve both problems:
Once you setup your sensitivity to feel comfortable and accurate enough for
low mouse deltas with no acceleration (cl_mouseAccel 0), you can start
increasing cl_mouseAccel and tweaking cl_mouseAccelOffset to get the
amplification you want for high deltas with little effect on low mouse deltas.
cl_mouseAccel is a power value. Should be >= 1, 2 will be the same power curve
as style 0. The higher the value, the faster the amplification grows with the
mouse delta.
cl_mouseAccelOffset sets how much base mouse delta will be doubled by
acceleration. The closer to zero you bring it, the more acceleration will
happen at low speeds. This is also very useful if you are changing to a new
mouse with higher dpi, if you go from 500 to 1000 dpi, you can divide your
cl_mouseAccelOffset by two to keep the same overall 'feel' (you will likely
gain in precision when you do that, but that is not related to mouse
acceleration).
Mouse acceleration is tricky to configure, and when you do you'll have to
re-learn your aiming. But you will find that it's very much forth it in the
long run.
If you try the new acceleration code and start using it, I'd be very
interested by your feedback.
# README for Developers
## pk3dir
@ -630,55 +439,6 @@ not prohibit commercial exploitation and all assets (e.g. textures, sounds,
maps) created by yourself are your property and can be sold like every other
game you find in stores.
## Network protocols
There are now two cvars that give you some degree of freedom over the reported
protocol versions between clients and servers: "com_protocol" and
"com_legacyprotocol".
The reason for this is that some standalone games increased the protocol
number even though nothing really changed in their protocol and the ioquake3
engine is still fully compatible.
In order to harden the network protocol against UDP spoofing attacks a new
network protocol was introduced that defends against such attacks.
Unfortunately, this protocol will be incompatible to the original quake3 1.32c
which is the latest official release from id.
Luckily, ioquake3 has backwards compatibility, on the client as well as on the
server. This means ioquake3 players can play on old servers just as ioquake3
servers are able to service old clients.
The cvar "com_protocol" denotes the protocol version for the new hardened
protocol, whereas the "com_legacyprotocol" cvar denotes the protocol version
for the legacy protocol.
If the value for "com_protocol" and "com_legacyprotocol" is identical, then
the legacy protocol is always used. If "com_legacyprotocol" is set to 0, then
support for the legacy protocol is disabled.
Mods that use a standalone engine obviously do not require dual protocol
support, and it is turned off if the engine is compiled with STANDALONE per
default. If you desire backwards compatibility to older versions of your
game you can still enable it in q_shared.h by defining
LEGACY_PROTOCOL.
## cl_guid Support
cl_guid is a cvar which is part of the client's USERINFO string. Its value
is a 32 character string made up of [a-f] and [0-9] characters. This
value is pseudo-unique for every player. Id's Quake 3 Arena client also
sets cl_guid, but only if Punkbuster is enabled on the client.
If cl_guidServerUniq is non-zero (the default), then this value is also
pseudo-unique for each server a client connects to (based on IP:PORT of
the server).
The purpose of cl_guid is to add an identifier for each player on
a server. This value can be reset by the client at any time so it's not
useful for blocking access. However, it can have at least two uses in
your mod's game code:
1. improve logging to allow statistical tools to index players by more
than just name
2. granting some weak admin rights to players without requiring passwords
## PNG support
@ -713,18 +473,13 @@ directory, this restriction is lifted.
# Contributing
Please send all patches to bugzilla (https://bugzilla.icculus.org), or join the
mailing list (http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org) and
submit your patch there. The best case scenario is that you submit your patch
to bugzilla, and then post the URL to the mailing list.
Please send all patches to bugzilla (https://bugzilla.icculus.org), or as a GitHub pull request and
submit your patch there.
The focus for ioq3 is to develop a stable base suitable for further development
and provide players with the same Quake 3 experience they've had for years. As
such ioq3 does not have any significant graphical enhancements and none are
planned at this time. However, improved graphics and sound patches will be
accepted as long as they are entirely optional, do not require new media and
are off by default.
and provide players with the same Quake 3 experience they've had for years.
We do have graphical improvements with the new renderer, but they are off by default.
# Building Official Installers
@ -783,4 +538,3 @@ Significant contributions from
* Aaron Gyes <floam@aaron.gy>
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/6d196bd663b47049a25dcb8caef95949 "githalytics.com")](http://githalytics.com/ioquake/ioq3)

View file

@ -21,10 +21,9 @@
; MASM ftol conversion functions using SSE or FPU
; assume __cdecl calling convention is being used for x86, __fastcall for x64
IFNDEF idx64
.686p
.xmm
IFNDEF idx64
.model flat, c
ENDIF

View file

@ -24,10 +24,9 @@
; function prototype:
; void qsnapvector(vec3_t vec)
IFNDEF idx64
.686p
.xmm
IFNDEF idx64
.model flat, c
ENDIF
@ -37,17 +36,12 @@ ENDIF
ssemask DWORD 0FFFFFFFFh, 0FFFFFFFFh, 0FFFFFFFFh, 00000000h
ssecw DWORD 00001F80h
IFNDEF idx64
fpucw WORD 037Fh
ENDIF
.code
IFDEF idx64
; qsnapvector using SSE
qsnapvectorsse PROC
sub rsp, 8
movaps xmm1, ssemask ; initialize the mask register
movups xmm0, [rcx] ; here is stored our vector. Read 4 values in one go
movaps xmm2, xmm0 ; keep a copy of the original data

View file

@ -2108,7 +2108,7 @@ int AAS_Reachability_Jump(int area1num, int area2num)
int stopevent, areas[10], numareas;
float phys_jumpvel, maxjumpdistance, maxjumpheight, height, bestdist, speed;
vec_t *v1, *v2, *v3, *v4;
vec3_t beststart, beststart2, bestend, bestend2;
vec3_t beststart = {0}, beststart2 = {0}, bestend = {0}, bestend2 = {0};
vec3_t teststart, testend, dir, velocity, cmdmove, up = {0, 0, 1}, sidewards;
aas_area_t *area1, *area2;
aas_face_t *face1, *face2;
@ -3152,7 +3152,7 @@ aas_lreachability_t *AAS_FindFaceReachabilities(vec3_t *facepoints, int numpoint
int facenum, edgenum, bestfacenum;
float *v1, *v2, *v3, *v4;
float bestdist, speed, hordist, dist;
vec3_t beststart, beststart2, bestend, bestend2, tmp, hordir, testpoint;
vec3_t beststart = {0}, beststart2 = {0}, bestend = {0}, bestend2 = {0}, tmp, hordir, testpoint;
aas_lreachability_t *lreach, *lreachabilities;
aas_area_t *area;
aas_face_t *face;

View file

@ -1770,7 +1770,7 @@ int AAS_AreaRouteToGoalArea(int areanum, vec3_t origin, int goalareanum, int tra
//===========================================================================
int AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags)
{
int traveltime, reachnum;
int traveltime, reachnum = 0;
if (AAS_AreaRouteToGoalArea(areanum, origin, goalareanum, travelflags, &traveltime, &reachnum))
{
@ -1786,7 +1786,7 @@ int AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, in
//===========================================================================
int AAS_AreaReachabilityToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags)
{
int traveltime, reachnum;
int traveltime, reachnum = 0;
if (AAS_AreaRouteToGoalArea(areanum, origin, goalareanum, travelflags, &traveltime, &reachnum))
{

View file

@ -995,14 +995,14 @@ int PC_Directive_include(source_t *source)
script = LoadScriptFile(token.string);
if (!script)
{
strcpy(path, source->includepath);
strcat(path, token.string);
Q_strncpyz(path, source->includepath, sizeof(path));
Q_strcat(path, sizeof(path), token.string);
script = LoadScriptFile(path);
} //end if
} //end if
else if (token.type == TT_PUNCTUATION && *token.string == '<')
{
strcpy(path, source->includepath);
Q_strncpyz(path, source->includepath, sizeof(path));
while(PC_ReadSourceToken(source, &token))
{
if (token.linescrossed > 0)
@ -1011,7 +1011,7 @@ int PC_Directive_include(source_t *source)
break;
} //end if
if (token.type == TT_PUNCTUATION && *token.string == '>') break;
strncat(path, token.string, MAX_PATH - 1);
Q_strcat(path, sizeof(path), token.string);
} //end while
if (*token.string != '>')
{
@ -2086,9 +2086,12 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
//remove the second value if not question mark operator
if (o->operator != P_QUESTIONMARK) v = v->next;
//
if (v)
{
if (v->prev) v->prev->next = v->next;
else firstvalue = v->next;
if (v->next) v->next->prev = v->prev;
}
//FreeMemory(v);
FreeValue(v);
} //end if
@ -2442,7 +2445,7 @@ int PC_Directive_eval(source_t *source)
token.whitespace_p = source->scriptstack->script_p;
token.endwhitespace_p = source->scriptstack->script_p;
token.linescrossed = 0;
sprintf(token.string, "%d", abs(value));
sprintf(token.string, "%ld", labs(value));
token.type = TT_NUMBER;
token.subtype = TT_INTEGER|TT_LONG|TT_DECIMAL;
PC_UnreadSourceToken(source, &token);
@ -2547,12 +2550,12 @@ int PC_DollarDirective_evalint(source_t *source)
token.whitespace_p = source->scriptstack->script_p;
token.endwhitespace_p = source->scriptstack->script_p;
token.linescrossed = 0;
sprintf(token.string, "%d", abs(value));
sprintf(token.string, "%ld", labs(value));
token.type = TT_NUMBER;
token.subtype = TT_INTEGER|TT_LONG|TT_DECIMAL;
#ifdef NUMBERVALUE
token.intvalue = abs(value);
token.intvalue = labs(value);
token.floatvalue = token.intvalue;
#endif //NUMBERVALUE
@ -2831,6 +2834,7 @@ int PC_ExpectTokenType(source_t *source, int type, int subtype, token_t *token)
{
if ((token->subtype & subtype) != subtype)
{
strcpy(str, "");
if (subtype & TT_DECIMAL) strcpy(str, "decimal");
if (subtype & TT_HEX) strcpy(str, "hex");
if (subtype & TT_OCTAL) strcpy(str, "octal");
@ -2954,10 +2958,14 @@ void PC_UnreadToken(source_t *source, token_t *token)
//============================================================================
void PC_SetIncludePath(source_t *source, char *path)
{
strncpy(source->includepath, path, MAX_PATH);
size_t len;
Q_strncpyz(source->includepath, path, MAX_PATH-1);
len = strlen(source->includepath);
//add trailing path seperator
if (source->includepath[strlen(source->includepath)-1] != '\\' &&
source->includepath[strlen(source->includepath)-1] != '/')
if (len > 0 && source->includepath[len-1] != '\\' &&
source->includepath[len-1] != '/')
{
strcat(source->includepath, PATHSEPERATOR_STR);
} //end if

View file

@ -828,7 +828,7 @@ int PS_ReadPrimitive(script_t *script, token_t *token)
len = 0;
while(*script->script_p > ' ' && *script->script_p != ';')
{
if (len >= MAX_TOKEN)
if (len >= MAX_TOKEN - 1)
{
ScriptError(script, "primitive token longer than MAX_TOKEN = %d", MAX_TOKEN);
return 0;
@ -956,6 +956,7 @@ int PS_ExpectTokenType(script_t *script, int type, int subtype, token_t *token)
if (token->type != type)
{
strcpy(str, "");
if (type == TT_STRING) strcpy(str, "string");
if (type == TT_LITERAL) strcpy(str, "literal");
if (type == TT_NUMBER) strcpy(str, "number");
@ -968,6 +969,7 @@ int PS_ExpectTokenType(script_t *script, int type, int subtype, token_t *token)
{
if ((token->subtype & subtype) != subtype)
{
strcpy(str, "");
if (subtype & TT_DECIMAL) strcpy(str, "decimal");
if (subtype & TT_HEX) strcpy(str, "hex");
if (subtype & TT_OCTAL) strcpy(str, "octal");
@ -1350,7 +1352,7 @@ script_t *LoadScriptFile(const char *filename)
buffer = GetClearedMemory(sizeof(script_t) + length + 1);
script = (script_t *) buffer;
Com_Memset(script, 0, sizeof(script_t));
strcpy(script->filename, filename);
Q_strncpyz(script->filename, filename, sizeof(script->filename));
script->buffer = (char *) buffer + sizeof(script_t);
script->buffer[length] = 0;
script->length = length;
@ -1396,7 +1398,7 @@ script_t *LoadScriptMemory(char *ptr, int length, char *name)
buffer = GetClearedMemory(sizeof(script_t) + length + 1);
script = (script_t *) buffer;
Com_Memset(script, 0, sizeof(script_t));
strcpy(script->filename, name);
Q_strncpyz(script->filename, name, sizeof(script->filename));
script->buffer = (char *) buffer + sizeof(script_t);
script->buffer[length] = 0;
script->length = length;

View file

@ -734,6 +734,11 @@ static float CG_DrawAttacker(float y)
return y;
}
if ( !cgs.clientinfo[clientNum].infoValid ) {
cg.attackerTime = 0;
return y;
}
t = cg.time - cg.attackerTime;
if (t > ATTACKER_HEAD_TIME) {
cg.attackerTime = 0;

View file

@ -840,6 +840,10 @@ void CG_EntityEvent(centity_t * cent, vec3_t position)
}
}
break;
case EV_USE_ITEM15:
DEBUGNAME("EV_USE_ITEM15");
CG_UseItem( cent );
break;
//
// weapon events

View file

@ -105,7 +105,7 @@ CG_FreeMarkPoly
*/
void CG_FreeMarkPoly(markPoly_t * le)
{
if (!le->prevMark) {
if (!le->prevMark || !le->nextMark) {
CG_Error("CG_FreeLocalEntity: not active");
}
// remove from the doubly linked active list

View file

@ -327,8 +327,6 @@ static void CG_DrawPlayerHead(rectDef_t * rect, qboolean draw2D)
cg.headEndYaw = 180 + 20 * cos(crandom() * M_PI);
cg.headEndPitch = 5 * cos(crandom() * M_PI);
}
size = rect->w * 1.25;
}
// if the server was frozen for a while we may have a bad head start time
@ -564,8 +562,6 @@ static void CG_DrawSelectedPlayerPowerup(rectDef_t * rect, qboolean draw2D)
item = BG_FindItemForPowerup(j);
if (item) {
CG_DrawPic(x, y, rect->w, rect->h, trap_R_RegisterShader(item->icon));
x += 3;
y += 3;
return;
}
}
@ -1332,7 +1328,7 @@ static void CG_Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4
}
count = 0;
while (s && *s && count < len) {
glyph = &font->glyphs[(int) *s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
glyph = &font->glyphs[*s & 255];
if (Q_IsColorString(s)) {
memcpy(newColor, g_color_table[ColorIndex(*(s + 1))], sizeof(newColor));
newColor[3] = color[3];
@ -1342,7 +1338,7 @@ static void CG_Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4
} else {
float yadj = useScale * glyph->top;
if (CG_Text_Width(s, useScale, 1) + x > max) {
if (CG_Text_Width(s, scale, 1) + x > max) {
*maxX = 0;
break;
}

View file

@ -734,7 +734,7 @@ static void CG_ConfigStringModified(void)
cgs.teamVoteNo[num - CS_TEAMVOTE_NO] = atoi(str);
cgs.teamVoteModified[num - CS_TEAMVOTE_NO] = qtrue;
} else if (num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) {
Q_strncpyz(cgs.teamVoteString[num - CS_TEAMVOTE_STRING], str, sizeof(cgs.teamVoteString));
Q_strncpyz(cgs.teamVoteString[num - CS_TEAMVOTE_STRING], str, sizeof(cgs.teamVoteString[0]));
} else if (num == CS_INTERMISSION) {
cg.intermissionStarted = atoi(str);
} else if (num >= CS_MODELS && num < CS_MODELS + MAX_MODELS) {

View file

@ -191,7 +191,9 @@ static void CG_TransitionSnapshot(void)
// if we had a map_restart, set everthing with initial
if (!cg.snap) {
return;
}
// clear the currentValid flag for all entities in the existing snapshot
for (i = 0; i < cg.snap->numEntities; i++) {
cent = &cg_entities[cg.snap->entities[i].number];

View file

@ -740,25 +740,21 @@ void CG_RegisterWeapon(int weaponNum)
weaponInfo->ammoIcon = trap_R_RegisterShader(ammo->icon);
}
strcpy(path, item->world_model[0]);
COM_StripExtensionInPlace(path);
strcat(path, "_flash.md3");
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_flash.md3" );
weaponInfo->flashModel = trap_R_RegisterModel(path);
strcpy(path, item->world_model[0]);
COM_StripExtensionInPlace(path);
strcat(path, "_barrel.md3");
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_barrel.md3" );
weaponInfo->barrelModel = trap_R_RegisterModel(path);
strcpy(path, item->world_model[0]);
COM_StripExtensionInPlace(path);
strcat(path, "_hand.md3");
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_hand.md3" );
weaponInfo->handsModel = trap_R_RegisterModel(path);
//Elder: added to cache 1st-person models
strcpy(path, item->world_model[0]);
COM_StripExtensionInPlace(path);
strcat(path, "_1st.md3");
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_1st.md3" );
weaponInfo->firstModel = trap_R_RegisterModel(path);
if (!weaponInfo->handsModel) {
@ -2447,11 +2443,11 @@ void CG_MissileHitWall(int weapon, int clientNum, vec3_t origin,
int r, duration, angle, contentType, sparkCount, i;
qboolean alphaFade, isSprite;
mark = 0;
radius = 32;
sfx = 0;
mod = 0;
mark = 0;
shader = 0;
sfx = 0;
radius = 0;
light = 0;
lightColor[0] = 1;
lightColor[1] = 1;

View file

@ -122,17 +122,6 @@ static ID_INLINE void WRITE_2BYTES( int x )
bufIndex += 2;
}
/*
===============
WRITE_1BYTES
===============
*/
static ID_INLINE void WRITE_1BYTES( int x )
{
buffer[ bufIndex ] = x;
bufIndex += 1;
}
/*
===============
START_CHUNK

View file

@ -94,8 +94,8 @@ typedef struct {
qboolean looping, holdAtEnd, dirty, alterGameState, silent, shader;
fileHandle_t iFile;
e_status status;
unsigned int startTime;
unsigned int lastTime;
int startTime;
int lastTime;
long tfps;
long RoQPlayed;
long ROQSize;
@ -1158,7 +1158,7 @@ redump:
if (cinTable[currentHandle].numQuads == -1) {
readQuadInfo( framedata );
setupQuad( 0, 0 );
cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds()*com_timescale->value;
cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds();
}
if (cinTable[currentHandle].numQuads != 1) cinTable[currentHandle].numQuads = 0;
break;
@ -1225,7 +1225,7 @@ redump:
static void RoQ_init( void )
{
cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds()*com_timescale->value;
cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds();
cinTable[currentHandle].RoQPlayed = 24;
@ -1356,11 +1356,11 @@ e_status CIN_RunCinematic (int handle)
return cinTable[currentHandle].status;
}
thisTime = CL_ScaledMilliseconds()*com_timescale->value;
thisTime = CL_ScaledMilliseconds();
if (cinTable[currentHandle].shader && (abs(thisTime - cinTable[currentHandle].lastTime))>100) {
cinTable[currentHandle].startTime += thisTime - cinTable[currentHandle].lastTime;
}
cinTable[currentHandle].tfps = ((((CL_ScaledMilliseconds()*com_timescale->value) - cinTable[currentHandle].startTime)*3)/100);
cinTable[currentHandle].tfps = (((CL_ScaledMilliseconds() - cinTable[currentHandle].startTime)*3)/100);
start = cinTable[currentHandle].startTime;
while( (cinTable[currentHandle].tfps != cinTable[currentHandle].numQuads)
@ -1368,8 +1368,7 @@ e_status CIN_RunCinematic (int handle)
{
RoQInterrupt();
if (start != cinTable[currentHandle].startTime) {
cinTable[currentHandle].tfps = ((((CL_ScaledMilliseconds()*com_timescale->value)
- cinTable[currentHandle].startTime)*3)/100);
cinTable[currentHandle].tfps = (((CL_ScaledMilliseconds() - cinTable[currentHandle].startTime)*3)/100);
start = cinTable[currentHandle].startTime;
}
}

View file

@ -583,8 +583,8 @@ void Con_DrawNotify (void)
if ( ( text[x] & 0xff ) == ' ' ) {
continue;
}
if ( ( (text[x]>>8)&7 ) != currentColor ) {
currentColor = (text[x]>>8)&7;
if ( ColorIndexForNumber( text[x]>>8 ) != currentColor ) {
currentColor = ColorIndexForNumber( text[x]>>8 );
re.SetColor( g_color_table[currentColor] );
}
SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + (x+1)*SMALLCHAR_WIDTH, v, text[x] & 0xff );
@ -677,7 +677,7 @@ void Con_DrawSolidConsole( float frac ) {
// draw the text
con.vislines = lines;
rows = (lines-SMALLCHAR_WIDTH)/SMALLCHAR_WIDTH; // rows of text to draw
rows = (lines-SMALLCHAR_HEIGHT)/SMALLCHAR_HEIGHT; // rows of text to draw
y = lines - (SMALLCHAR_HEIGHT*3);
@ -717,8 +717,8 @@ void Con_DrawSolidConsole( float frac ) {
continue;
}
if ( ( (text[x]>>8)&7 ) != currentColor ) {
currentColor = (text[x]>>8)&7;
if ( ColorIndexForNumber( text[x]>>8 ) != currentColor ) {
currentColor = ColorIndexForNumber( text[x]>>8 );
re.SetColor( g_color_table[currentColor] );
}
SCR_DrawSmallChar( con.xadjust + (x+1)*SMALLCHAR_WIDTH, y, text[x] & 0xff );

View file

@ -177,12 +177,20 @@ void CL_cURL_Shutdown( void )
void CL_cURL_Cleanup(void)
{
if(clc.downloadCURLM) {
CURLMcode result;
if(clc.downloadCURL) {
qcurl_multi_remove_handle(clc.downloadCURLM,
result = qcurl_multi_remove_handle(clc.downloadCURLM,
clc.downloadCURL);
if(result != CURLM_OK) {
Com_DPrintf("qcurl_multi_remove_handle failed: %s\n", qcurl_multi_strerror(result));
}
qcurl_easy_cleanup(clc.downloadCURL);
}
qcurl_multi_cleanup(clc.downloadCURLM);
result = qcurl_multi_cleanup(clc.downloadCURLM);
if(result != CURLM_OK) {
Com_DPrintf("CL_cURL_Cleanup: qcurl_multi_cleanup failed: %s\n", qcurl_multi_strerror(result));
}
clc.downloadCURLM = NULL;
clc.downloadCURL = NULL;
}
@ -209,8 +217,36 @@ static size_t CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb,
return size*nmemb;
}
CURLcode qcurl_easy_setopt_warn(CURL *curl, CURLoption option, ...)
{
CURLcode result;
va_list argp;
va_start(argp, option);
if(option < CURLOPTTYPE_OBJECTPOINT) {
long longValue = va_arg(argp, long);
result = qcurl_easy_setopt(curl, option, longValue);
} else if(option < CURLOPTTYPE_OFF_T) {
void *pointerValue = va_arg(argp, void *);
result = qcurl_easy_setopt(curl, option, pointerValue);
} else {
curl_off_t offsetValue = va_arg(argp, curl_off_t);
result = qcurl_easy_setopt(curl, option, offsetValue);
}
if(result != CURLE_OK) {
Com_DPrintf("qcurl_easy_setopt failed: %s\n", qcurl_easy_strerror(result));
}
va_end(argp);
return result;
}
void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
{
CURLMcode result;
clc.cURLUsed = qtrue;
Com_Printf("URL: %s\n", remoteURL);
Com_DPrintf("***** CL_cURL_BeginDownload *****\n"
@ -246,23 +282,23 @@ void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
}
if(com_developer->integer)
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_TRANSFERTEXT, 0);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_REFERER, va("ioQ3://%s",
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_VERBOSE, 1);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_TRANSFERTEXT, 0);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_REFERER, va("ioQ3://%s",
NET_AdrToString(clc.serverAddress)));
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_USERAGENT, va("%s %s",
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_USERAGENT, va("%s %s",
Q3_VERSION, qcurl_version()));
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEFUNCTION,
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_WRITEFUNCTION,
CL_cURL_CallbackWrite);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, &clc.download);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_NOPROGRESS, 0);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSFUNCTION,
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_WRITEDATA, &clc.download);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_NOPROGRESS, 0);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_PROGRESSFUNCTION,
CL_cURL_CallbackProgress);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
clc.downloadCURLM = qcurl_multi_init();
if(!clc.downloadCURLM) {
qcurl_easy_cleanup(clc.downloadCURL);
@ -271,7 +307,13 @@ void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
"failed");
return;
}
qcurl_multi_add_handle(clc.downloadCURLM, clc.downloadCURL);
result = qcurl_multi_add_handle(clc.downloadCURLM, clc.downloadCURL);
if(result != CURLM_OK) {
qcurl_easy_cleanup(clc.downloadCURL);
clc.downloadCURL = NULL;
Com_Error(ERR_DROP,"CL_cURL_BeginDownload: qcurl_multi_add_handle() failed: %s", qcurl_multi_strerror(result));
return;
}
if(!(clc.sv_allowDownload & DLF_NO_DISCONNECT) &&
!clc.cURLDisconnected) {

View file

@ -604,10 +604,10 @@ usercmd_t CL_CreateCmd( void ) {
// draw debug graphs of turning for mouse testing
if ( cl_debugMove->integer ) {
if ( cl_debugMove->integer == 1 ) {
SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]) );
SCR_DebugGraph( fabs(cl.viewangles[YAW] - oldAngles[YAW]) );
}
if ( cl_debugMove->integer == 2 ) {
SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]) );
SCR_DebugGraph( fabs(cl.viewangles[PITCH] - oldAngles[PITCH]) );
}
}

View file

@ -1207,7 +1207,7 @@ void CL_KeyDownEvent( int key, unsigned time )
{
keys[key].down = qtrue;
keys[key].repeats++;
if( keys[key].repeats == 1 && key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK )
if( keys[key].repeats == 1 )
anykeydown++;
if( keys[K_ALT].down && key == K_ENTER )
@ -1299,7 +1299,6 @@ void CL_KeyUpEvent( int key, unsigned time )
{
keys[key].repeats = 0;
keys[key].down = qfalse;
if (key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK)
anykeydown--;
if (anykeydown < 0) {
@ -1385,9 +1384,6 @@ void Key_ClearStates (void)
anykeydown = 0;
for ( i=0 ; i < MAX_KEYS ; i++ ) {
if (i == K_SCROLLOCK || i == K_KP_NUMLOCK || i == K_CAPSLOCK)
continue;
if ( keys[i].down ) {
CL_KeyEvent( i, qfalse, 0 );

View file

@ -149,7 +149,6 @@ typedef struct serverStatus_s
} serverStatus_t;
serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS];
int serverStatusCount;
#if defined __USEA3D && defined __A3D_GEOM
void hA3Dg_ExportRenderGeom (refexport_t *incoming_re);
@ -2301,9 +2300,9 @@ Resend a connect message if the last one has timed out
=================
*/
void CL_CheckForResend( void ) {
int port, i;
int port;
char info[MAX_INFO_STRING];
char data[MAX_INFO_STRING];
char data[MAX_INFO_STRING + 10];
// don't send anything if playing back a demo
if ( clc.demoplaying ) {
@ -2357,19 +2356,8 @@ void CL_CheckForResend( void ) {
Info_SetValueForKey( info, "qport", va("%i", port ) );
Info_SetValueForKey( info, "challenge", va("%i", clc.challenge ) );
strcpy(data, "connect ");
// TTimo adding " " around the userinfo string to avoid truncated userinfo on the server
// (Com_TokenizeString tokenizes around spaces)
data[8] = '"';
for(i=0;i<strlen(info);i++) {
data[9+i] = info[i]; // + (clc.challenge)&0x3;
}
data[9+i] = '"';
data[10+i] = 0;
// NOTE TTimo don't forget to set the right data length!
NET_OutOfBandData( NS_CLIENT, clc.serverAddress, (byte *) &data[0], i+10 );
Com_sprintf( data, sizeof(data), "connect \"%s\"", info );
NET_OutOfBandData( NS_CLIENT, clc.serverAddress, (byte *) data, strlen ( data ) );
// the most current userinfo has been sent, so watch for any
// newer changes to userinfo variables
cvar_modifiedFlags &= ~CVAR_USERINFO;
@ -3237,6 +3225,7 @@ void CL_InitRef( void ) {
ri.Cvar_Set = Cvar_Set;
ri.Cvar_SetValue = Cvar_SetValue;
ri.Cvar_CheckRange = Cvar_CheckRange;
ri.Cvar_SetDescription = Cvar_SetDescription;
ri.Cvar_VariableIntegerValue = Cvar_VariableIntegerValue;
// cinematic stuff
@ -3844,7 +3833,7 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
Q_strncpyz( info, MSG_ReadString( msg ), MAX_INFO_STRING );
if (strlen(info)) {
if (info[strlen(info)-1] != '\n') {
strncat(info, "\n", sizeof(info) - 1);
Q_strcat(info, sizeof(info), "\n");
}
Com_Printf( "%s: %s", NET_AdrToStringwPort( from ), info );
}
@ -3876,11 +3865,7 @@ serverStatus_t *CL_GetServerStatus( netadr_t from ) {
oldestTime = cl_serverStatusList[i].startTime;
}
}
if (oldest != -1) {
return &cl_serverStatusList[oldest];
}
serverStatusCount++;
return &cl_serverStatusList[serverStatusCount & (MAX_SERVERSTATUSREQUESTS-1)];
}
/*

View file

@ -35,7 +35,7 @@
#endif
#include <fcntl.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@ -146,7 +146,7 @@ void mumble_set_identity(const char* identity)
size_t len;
if (!lm)
return;
len = MIN(sizeof(lm->identity), strlen(identity)+1);
len = MIN(sizeof(lm->identity)/sizeof(wchar_t), strlen(identity)+1);
mbstowcs(lm->identity, identity, len);
}
@ -164,7 +164,7 @@ void mumble_set_description(const char* description)
size_t len;
if (!lm)
return;
len = MIN(sizeof(lm->description), strlen(description)+1);
len = MIN(sizeof(lm->description)/sizeof(wchar_t), strlen(description)+1);
mbstowcs(lm->description, description, len);
}

View file

@ -236,6 +236,10 @@ static void S_PaintChannelFrom16_altivec( channel_t *ch, const sfx_t *sc, int co
short *samples;
float ooff, fdata[2], fdiv, fleftvol, frightvol;
if (sc->soundChannels <= 0) {
return;
}
samp = &paintbuffer[ bufferOffset ];
if (ch->doppler) {
@ -422,6 +426,10 @@ static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int cou
short *samples;
float ooff, fdata[2], fdiv, fleftvol, frightvol;
if (sc->soundChannels <= 0) {
return;
}
samp = &paintbuffer[ bufferOffset ];
if (ch->doppler) {

View file

@ -2259,7 +2259,7 @@ void S_AL_StartBackgroundTrack( const char *intro, const char *loop )
issame = qfalse;
// Copy the loop over
strncpy( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) );
Q_strncpyz( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) );
if(!issame)
{
@ -3260,7 +3260,7 @@ qboolean S_AL_Init( soundInterface_t *si )
s_alGain = Cvar_Get( "s_alGain", "1.0", CVAR_ARCHIVE );
s_alSources = Cvar_Get( "s_alSources", "96", CVAR_ARCHIVE );
s_alDopplerFactor = Cvar_Get( "s_alDopplerFactor", "1.0", CVAR_ARCHIVE );
s_alDopplerSpeed = Cvar_Get( "s_alDopplerSpeed", "13512", CVAR_ARCHIVE );
s_alDopplerSpeed = Cvar_Get( "s_alDopplerSpeed", "9000", CVAR_ARCHIVE );
s_alMinDistance = Cvar_Get( "s_alMinDistance", "120", CVAR_CHEAT );
s_alMaxDistance = Cvar_Get("s_alMaxDistance", "1024", CVAR_CHEAT);
s_alRolloff = Cvar_Get( "s_alRolloff", "2", CVAR_CHEAT);

View file

@ -119,7 +119,7 @@ void NXPutc(NXStream *stream, char out) {
void encodeWavelet( sfx_t *sfx, short *packets) {
float wksp[4097], temp;
float wksp[4097] = {0}, temp;
int i, samples, size;
sndBuffer *newchunk, *chunk;
byte *out;
@ -169,7 +169,7 @@ void encodeWavelet( sfx_t *sfx, short *packets) {
}
void decodeWavelet(sndBuffer *chunk, short *to) {
float wksp[4097];
float wksp[4097] = {0};
int i;
byte *out;

View file

@ -1460,7 +1460,7 @@ char *EasyClientName(int client, char *buf, int size)
{
int i;
char *str1, *str2, *ptr, c;
char name[128];
char name[128] = {0};
ClientName(client, name, sizeof(name));
for (i = 0; name[i]; i++)
@ -2822,6 +2822,7 @@ float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int
BotAI_Trace(&trace, start, NULL, NULL, end, passent, contents_mask);
//if water was hit
waterfactor = 1.0;
//note: trace.contents is always 0, see BotAI_Trace
if (trace.contents & (CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER)) {
//if the water surface is translucent
if (1) {
@ -5133,6 +5134,7 @@ void BotCheckEvents(bot_state_t * bs, entityState_t * state)
case EV_USE_ITEM12:
case EV_USE_ITEM13:
case EV_USE_ITEM14:
case EV_USE_ITEM15:
break;
}
}

View file

@ -172,7 +172,8 @@ void BotAI_Trace(bsp_trace_t * bsptrace, vec3_t start, vec3_t mins, vec3_t maxs,
VectorCopy(trace.plane.normal, bsptrace->plane.normal);
bsptrace->plane.signbits = trace.plane.signbits;
bsptrace->plane.type = trace.plane.type;
bsptrace->surface.value = trace.surfaceFlags;
bsptrace->surface.value = 0;
bsptrace->surface.flags = trace.surfaceFlags;
bsptrace->ent = trace.entityNum;
bsptrace->exp_dist = 0;
bsptrace->sidenum = 0;
@ -1150,7 +1151,8 @@ void BotWriteSessionData(bot_state_t * bs)
s = va("%i %i %i %i %i %i %i %i"
" %f %f %f"
" %f %f %f"
" %f %f %f",
" %f %f %f"
" %f",
bs->lastgoal_decisionmaker,
bs->lastgoal_ltgtype,
bs->lastgoal_teammate,
@ -1165,7 +1167,10 @@ void BotWriteSessionData(bot_state_t * bs)
bs->lastgoal_teamgoal.mins[0],
bs->lastgoal_teamgoal.mins[1],
bs->lastgoal_teamgoal.mins[2],
bs->lastgoal_teamgoal.maxs[0], bs->lastgoal_teamgoal.maxs[1], bs->lastgoal_teamgoal.maxs[2]
bs->lastgoal_teamgoal.maxs[0],
bs->lastgoal_teamgoal.maxs[1],
bs->lastgoal_teamgoal.maxs[2],
bs->formation_dist
);
var = va("botsession%i", bs->client);
@ -1190,7 +1195,8 @@ void BotReadSessionData(bot_state_t * bs)
"%i %i %i %i %i %i %i %i"
" %f %f %f"
" %f %f %f"
" %f %f %f",
" %f %f %f"
" %f",
&bs->lastgoal_decisionmaker,
&bs->lastgoal_ltgtype,
&bs->lastgoal_teammate,
@ -1205,7 +1211,10 @@ void BotReadSessionData(bot_state_t * bs)
&bs->lastgoal_teamgoal.mins[0],
&bs->lastgoal_teamgoal.mins[1],
&bs->lastgoal_teamgoal.mins[2],
&bs->lastgoal_teamgoal.maxs[0], &bs->lastgoal_teamgoal.maxs[1], &bs->lastgoal_teamgoal.maxs[2]
&bs->lastgoal_teamgoal.maxs[0],
&bs->lastgoal_teamgoal.maxs[1],
&bs->lastgoal_teamgoal.maxs[2],
&bs->formation_dist
);
}
@ -1224,6 +1233,10 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
botstates[client] = G_Alloc(sizeof(bot_state_t));
bs = botstates[client];
if (!bs) {
return qfalse;
}
if (bs && bs->inuse) {
BotAI_Print(PRT_FATAL, "BotAISetupClient: client %d already setup\n", client);
return qfalse;

View file

@ -282,7 +282,7 @@ typedef struct bot_state_s {
float leadmessage_time; //last time a messaged was sent to the team mate
float leadbackup_time; //time backing up towards team mate
//
char teamleader[32]; //netname of the team leader
char teamleader[MAX_NETNAME]; //netname of the team leader
float askteamleader_time; //time asked for team leader
float becometeamleader_time; //time the bot will become the team leader
float teamgiveorders_time; //time to give team orders

View file

@ -177,7 +177,7 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t * bs, int *teammates, int maxte
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR)
continue;
//
if (BotSameTeam(bs, i)) {
if (BotSameTeam(bs, i) && goal) {
//
traveltime = BotClientTravelTimeToGoal(i, goal);
//
@ -336,7 +336,7 @@ BotCTFOrders
void BotCTFOrders_BothFlagsNotAtBase(bot_state_t * bs)
{
int numteammates, defenders, attackers, i, other;
int teammates[MAX_CLIENTS];
int teammates[MAX_CLIENTS] = {0};
char name[MAX_NETNAME], carriername[MAX_NETNAME];
numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates));
@ -723,7 +723,7 @@ BotCTFOrders
void BotCTFOrders_BothFlagsAtBase(bot_state_t * bs)
{
int numteammates, defenders, attackers, i;
int teammates[MAX_CLIENTS];
int teammates[MAX_CLIENTS] = {0};
char name[MAX_NETNAME];
//sort team mates by travel time to base

View file

@ -507,7 +507,7 @@ int BotVoiceChatCommand(bot_state_t * bs, int mode, char *voiceChat)
Q_strncpyz(buf, voiceChat, sizeof(buf));
cmd = buf;
for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
for (; *cmd && *cmd > ' '; cmd++);
while (*cmd && *cmd <= ' ')
*cmd++ = '\0';
//voiceOnly = atoi(ptr);
@ -515,7 +515,7 @@ int BotVoiceChatCommand(bot_state_t * bs, int mode, char *voiceChat)
while (*cmd && *cmd <= ' ')
*cmd++ = '\0';
clientNum = atoi(ptr);
for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
for (; *cmd && *cmd > ' '; cmd++);
while (*cmd && *cmd <= ' ')
*cmd++ = '\0';
//color = atoi(ptr);

View file

@ -869,7 +869,7 @@ static void G_SpawnBots(char *botList, int baseDelay)
while (*p && *p == ' ') {
p++;
}
if (!p) {
if (!*p) {
break;
}
// mark start of bot name

View file

@ -1293,8 +1293,6 @@ to free floating spectator mode
*/
void StopFollowing(gentity_t * ent)
{
vec3_t angle;
ent->client->ps.persistant[PERS_TEAM] = TEAM_SPECTATOR;
ent->client->sess.sessionTeam = TEAM_SPECTATOR;
ent->client->sess.spectatorState = SPECTATOR_FREE;
@ -1306,8 +1304,13 @@ void StopFollowing(gentity_t * ent)
ent->client->ps.pm_flags &= ~PMF_FOLLOW;
ent->r.svFlags &= ~SVF_BOT;
ent->client->ps.clientNum = ent - g_entities;
angle[0] = angle[1] = angle[2] = 0.0;
SetClientViewAngle(ent, angle);
SetClientViewAngle( ent, ent->client->ps.viewangles );
// don't use dead view angles
if ( ent->client->ps.stats[STAT_HEALTH] <= 0 ) {
ent->client->ps.stats[STAT_HEALTH] = 1;
}
}
/*

View file

@ -476,6 +476,10 @@ RespawnItem
*/
void RespawnItem(gentity_t * ent)
{
if (!ent) {
return;
}
// randomly select from teamed entities
if (ent->team) {
gentity_t *master;
@ -491,7 +495,11 @@ void RespawnItem(gentity_t * ent)
choice = rand() % count;
for (count = 0, ent = master; count < choice; ent = ent->teamchain, count++);
for (count = 0, ent = master; ent && count < choice; ent = ent->teamchain, count++);
}
if (!ent) {
return;
}
ent->r.contents = CONTENTS_TRIGGER;

View file

@ -1629,6 +1629,7 @@ void AdjustTournamentScores(void)
ClientUserinfoChanged(clientNum);
}
trap_SetConfigstring( CS_INTERMISSION, "" );
}
/*
@ -2730,7 +2731,7 @@ Runs thinking code for this frame if necessary
*/
void G_RunThink(gentity_t * ent)
{
float thinktime;
int thinktime;
thinktime = ent->nextthink;
if (thinktime <= 0) {

View file

@ -1448,6 +1448,10 @@ void Think_SpawnNewDoorTrigger(gentity_t * ent)
vec3_t mins, maxs;
int i, best;
if (!ent) {
return;
}
// set all of the slaves as shootable
// Makro - why ?
for (other = ent; other; other = other->teamchain) {

View file

@ -148,10 +148,11 @@ UpdateIPBans
*/
static void UpdateIPBans(void)
{
byte b[4], m[4];
byte b[4] = {0};
byte m[4] = {0};
int i, j;
char iplist_final[MAX_CVAR_VALUE_STRING];
char ip[64];
char iplist_final[MAX_CVAR_VALUE_STRING] = {0};
char ip[64] = {0};
*iplist_final = 0;
for (i = 0; i < numIPFilters; i++) {
@ -188,7 +189,7 @@ qboolean G_FilterPacket(char *from)
{
int i;
unsigned in;
byte m[4];
byte m[4] = {0};
char *p;
i = 0;

View file

@ -528,7 +528,8 @@
#elif defined(__GNUC__)
# if defined(__ILP32__) || \
defined(__i386__) || defined(__ppc__) || defined(__arm__)
defined(__i386__) || defined(__ppc__) || defined(__powerpc__) || \
defined(__arm__) || defined(__sparc__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
@ -538,7 +539,8 @@
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__)
defined(__x86_64__) || defined(__ppc64__) || defined(__powerpc64__) || \
defined(__sparc64__)
# define CURL_SIZEOF_LONG 8
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -872,7 +872,7 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
/* generate the partition's first stage cascade value */
if(csubbits){
int maxval[8];
int maxval[8] = {0};
for(k=0;k<csub;k++){
int booknum=info->class_subbook[class][k];
if(booknum<0){

View file

@ -309,7 +309,6 @@ static int comp(const void *a,const void *b){
#define EPSILON 10e-7
static int Laguerre_With_Deflation(float *a,int ord,float *r){
int i,m;
double lastdelta=0.f;
double *defl=alloca(sizeof(*defl)*(ord+1));
for(i=0;i<=ord;i++)defl[i]=a[i];
@ -346,7 +345,6 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){
if(delta<0.f)delta*=-1;
if(fabs(delta/new)<10e-12)break;
lastdelta=delta;
}
r[m-1]=new;

View file

@ -1827,7 +1827,7 @@ vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
}
}
static int host_is_big_endian() {
static int host_is_big_endian(void) {
ogg_int32_t pattern = 0xfeedface; /* deadbeef */
unsigned char *bytewise = (unsigned char *)&pattern;
if (bytewise[0] == 0xfe) return 1;

View file

@ -32,6 +32,3 @@ void IN_Shutdown( void ) {
void IN_Restart( void ) {
}
void Sys_SendKeyEvents (void) {
}

View file

@ -19,7 +19,7 @@ along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// sys_null.h -- null system driver to aid porting efforts
// null_main.c -- null system driver to aid porting efforts
#include <errno.h>
#include <stdio.h>
@ -30,26 +30,6 @@ int sys_curtime;
//===================================================================
void Sys_BeginStreamedFile( FILE *f, int readAhead ) {
}
void Sys_EndStreamedFile( FILE *f ) {
}
int Sys_StreamedRead( void *buffer, int size, int count, FILE *f ) {
return fread( buffer, size, count, f );
}
void Sys_StreamSeek( FILE *f, int offset, int origin ) {
fseek( f, offset, origin );
}
//===================================================================
void Sys_mkdir ( const char *path ) {
}
void Sys_Error (char *error, ...) {
va_list argptr;
@ -67,13 +47,6 @@ void Sys_Quit (void) {
exit (0);
}
void Sys_UnloadGame (void) {
}
void *Sys_GetGameAPI (void *parms) {
return NULL;
}
char *Sys_GetClipboardData( void ) {
return NULL;
}
@ -89,26 +62,10 @@ FILE *Sys_FOpen(const char *ospath, const char *mode) {
void Sys_Mkdir (char *path) {
}
char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave) {
return NULL;
}
char *Sys_FindNext (unsigned musthave, unsigned canthave) {
return NULL;
}
void Sys_FindClose (void) {
}
void Sys_Init (void) {
}
void Sys_EarlyOutput( char *string ) {
printf( "%s", string );
}
void main (int argc, char **argv) {
Com_Init (argc, argv);

View file

@ -163,7 +163,7 @@ static OPUS_INLINE void silk_LDL_FLP(
opus_int i, j, k, loop_count, err = 1;
silk_float *ptr1, *ptr2;
double temp, diag_min_value;
silk_float v[ MAX_MATRIX_SIZE ], D[ MAX_MATRIX_SIZE ]; /* temp arrays*/
silk_float v[ MAX_MATRIX_SIZE ] = { 0 }, D[ MAX_MATRIX_SIZE ]; /* temp arrays*/
silk_assert( M <= MAX_MATRIX_SIZE );

View file

@ -33,7 +33,7 @@
# error "OPUS_BUILD _MUST_ be defined to build Opus. This probably means you need other defines as well, as in a config.h. See the included build files for details."
#endif
#if defined(__GNUC__) && (__GNUC__ >= 2) && !defined(__OPTIMIZE__)
#if defined(__GNUC__) && (__GNUC__ >= 2) && !defined(__OPTIMIZE__) && !defined(__APPLE__)
# pragma message "You appear to be compiling without optimization, if so opus will be very slow."
#endif
@ -215,7 +215,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
VARDECL(opus_val16, pcm_transition_silk);
int pcm_transition_celt_size;
VARDECL(opus_val16, pcm_transition_celt);
opus_val16 *pcm_transition;
opus_val16 *pcm_transition=NULL;
int redundant_audio_size;
VARDECL(opus_val16, redundant_audio);

View file

@ -317,7 +317,7 @@ struct OpusSeekRecord{
static int op_get_prev_page_serial(OggOpusFile *_of,OpusSeekRecord *_sr,
opus_int64 _offset,ogg_uint32_t _serialno,
const ogg_uint32_t *_serialnos,int _nserialnos){
OpusSeekRecord preferred_sr;
OpusSeekRecord preferred_sr={0};
ogg_page og;
opus_int64 begin;
opus_int64 end;
@ -930,7 +930,7 @@ static int op_find_initial_pcm_offset(OggOpusFile *_of,
prev_packet_gp=pcm_start;
for(pi=0;pi<op_count;pi++){
if(cur_page_eos){
ogg_int64_t diff;
ogg_int64_t diff=0;
OP_ALWAYS_TRUE(!op_granpos_diff(&diff,cur_page_gp,prev_packet_gp));
diff=durations[pi]-diff;
/*If we have samples to trim...*/
@ -1128,7 +1128,7 @@ static int op_bisect_forward_serialno(OggOpusFile *_of,
opus_int64 bisect;
opus_int64 next;
opus_int64 last;
ogg_int64_t end_offset;
ogg_int64_t end_offset=0;
ogg_int64_t end_gp;
int sri;
serialnos=*_serialnos;
@ -1715,7 +1715,7 @@ opus_int64 op_raw_total(const OggOpusFile *_of,int _li){
ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li){
OggOpusLink *links;
ogg_int64_t diff;
ogg_int64_t diff=0;
int nlinks;
nlinks=_of->nlinks;
if(OP_UNLIKELY(_of->ready_state<OP_OPENED)
@ -2114,7 +2114,7 @@ int op_raw_seek(OggOpusFile *_of,opus_int64 _pos){
static ogg_int64_t op_get_granulepos(const OggOpusFile *_of,
ogg_int64_t _pcm_offset,int *_li){
const OggOpusLink *links;
ogg_int64_t duration;
ogg_int64_t duration=0;
int nlinks;
int li;
OP_ASSERT(_pcm_offset>=0);
@ -2166,11 +2166,11 @@ static int op_pcm_seek_page(OggOpusFile *_of,
ogg_int64_t _target_gp,int _li){
const OggOpusLink *link;
ogg_page og;
ogg_int64_t pcm_pre_skip;
ogg_int64_t pcm_pre_skip=0;
ogg_int64_t pcm_start;
ogg_int64_t pcm_end;
ogg_int64_t best_gp;
ogg_int64_t diff;
ogg_int64_t diff=0;
ogg_uint32_t serialno;
opus_int32 pre_skip;
opus_int64 begin;
@ -2239,7 +2239,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
}
}
else{
ogg_int64_t prev_page_gp;
ogg_int64_t prev_page_gp=0;
/*We might get lucky and already have the packet with the target
buffered.
Worth checking.
@ -2289,7 +2289,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
d2=end-begin>>1;
if(force_bisect)bisect=begin+(end-begin>>1);
else{
ogg_int64_t diff2;
ogg_int64_t diff2=0;
OP_ALWAYS_TRUE(!op_granpos_diff(&diff,_target_gp,pcm_start));
OP_ALWAYS_TRUE(!op_granpos_diff(&diff2,pcm_end,pcm_start));
/*Take a (pretty decent) guess.*/
@ -2503,7 +2503,7 @@ static ogg_int64_t op_get_pcm_offset(const OggOpusFile *_of,
ogg_int64_t _gp,int _li){
const OggOpusLink *links;
ogg_int64_t pcm_offset;
ogg_int64_t delta;
ogg_int64_t delta=0;
int li;
links=_of->links;
pcm_offset=0;

View file

@ -59,10 +59,16 @@ ADD BOTS MENU
typedef struct {
menuframework_s menu;
menutext_s banner;
menubitmap_s background;
menubitmap_s arrows;
menubitmap_s up;
menubitmap_s down;
menutext_s bots[7];
menulist_s skill;
menulist_s team;
menubitmap_s go;
@ -215,21 +221,6 @@ static void UI_AddBotsMenu_GetSortedBotNums( void ) {
qsort( addBotsMenuInfo.sortedBotNums, addBotsMenuInfo.numBots, sizeof(addBotsMenuInfo.sortedBotNums[0]), UI_AddBotsMenu_SortCompare );
}
/*
=================
UI_AddBotsMenu_Draw
=================
*/
static void UI_AddBotsMenu_Draw( void ) {
UI_DrawBannerString( 320, 16, "ADD BOTS", UI_CENTER, color_white );
UI_DrawNamedPic( 320-233, 240-166, 466, 332, ART_BACKGROUND );
// standard menu drawing
Menu_Draw( &addBotsMenuInfo.menu );
}
/*
=================
UI_AddBotsMenu_Init
@ -266,7 +257,6 @@ static void UI_AddBotsMenu_Init( void ) {
gametype = atoi( Info_ValueForKey( info,"g_gametype" ) );
memset( &addBotsMenuInfo, 0 ,sizeof(addBotsMenuInfo) );
addBotsMenuInfo.menu.draw = UI_AddBotsMenu_Draw;
addBotsMenuInfo.menu.fullscreen = qfalse;
addBotsMenuInfo.menu.wrapAround = qtrue;
addBotsMenuInfo.delay = 1000;
@ -276,6 +266,21 @@ static void UI_AddBotsMenu_Init( void ) {
addBotsMenuInfo.numBots = UI_GetNumBots();
count = addBotsMenuInfo.numBots < 7 ? addBotsMenuInfo.numBots : 7;
addBotsMenuInfo.banner.generic.type = MTYPE_BTEXT;
addBotsMenuInfo.banner.generic.x = 320;
addBotsMenuInfo.banner.generic.y = 16;
addBotsMenuInfo.banner.string = "ADD BOTS";
addBotsMenuInfo.banner.color = color_white;
addBotsMenuInfo.banner.style = UI_CENTER;
addBotsMenuInfo.background.generic.type = MTYPE_BITMAP;
addBotsMenuInfo.background.generic.name = ART_BACKGROUND;
addBotsMenuInfo.background.generic.flags = QMF_INACTIVE;
addBotsMenuInfo.background.generic.x = 320-233;
addBotsMenuInfo.background.generic.y = 240-166;
addBotsMenuInfo.background.width = 466;
addBotsMenuInfo.background.height = 332;
addBotsMenuInfo.arrows.generic.type = MTYPE_BITMAP;
addBotsMenuInfo.arrows.generic.name = ART_ARROWS;
addBotsMenuInfo.arrows.generic.flags = QMF_INACTIVE;
@ -370,8 +375,9 @@ static void UI_AddBotsMenu_Init( void ) {
UI_AddBotsMenu_GetSortedBotNums();
UI_AddBotsMenu_SetBotNames();
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.background );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.banner );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.arrows );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.up );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.down );
for( n = 0; n < count; n++ ) {

View file

@ -216,7 +216,7 @@ typedef struct
vec3_t playerMoveangles;
int playerLegs;
int playerTorso;
int playerWeapon;
weapon_t playerWeapon;
qboolean playerChat;
menubitmap_s back;
@ -434,7 +434,7 @@ static void Controls_UpdateModel( int anim ) {
s_controls.playerMoveangles[YAW] = s_controls.playerViewangles[YAW];
s_controls.playerLegs = LEGS_IDLE;
s_controls.playerTorso = TORSO_STAND;
s_controls.playerWeapon = -1;
s_controls.playerWeapon = WP_NUM_WEAPONS;
s_controls.playerChat = qfalse;
switch( anim ) {

View file

@ -659,7 +659,7 @@ Returns the next level the player has not won
*/
int UI_GetCurrentGame( void ) {
int level;
int rank;
int rank = 0;
int skill;
const char *info;

View file

@ -253,7 +253,7 @@ void MField_CharEvent( mfield_t *edit, int ch ) {
return;
}
if ( !trap_Key_GetOverstrikeMode() ) {
if ( trap_Key_GetOverstrikeMode() ) {
if ((edit->cursor == MAX_EDIT_LINE - 1) || (edit->maxchars && edit->cursor >= edit->maxchars))
return;
} else {

View file

@ -88,15 +88,13 @@ tryagain:
}
if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path, sizeof(path) );
strcat( path, "_barrel.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_barrel.md3" );
pi->barrelModel = trap_R_RegisterModel( path );
}
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path, sizeof(path) );
strcat( path, "_flash.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_flash.md3" );
pi->flashModel = trap_R_RegisterModel( path );
switch( weaponNum ) {
@ -332,8 +330,8 @@ static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_
}
// cast away const because of compiler problems
MatrixMultiply( entity->axis, ((refEntity_t *)parent)->axis, tempAxis );
MatrixMultiply( lerped.axis, tempAxis, entity->axis );
MatrixMultiply( entity->axis, lerped.axis, tempAxis );
MatrixMultiply( tempAxis, ((refEntity_t *)parent)->axis, entity->axis );
}
@ -689,12 +687,12 @@ UI_DrawPlayer
*/
void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int time ) {
refdef_t refdef;
refEntity_t legs;
refEntity_t torso;
refEntity_t head;
refEntity_t gun;
refEntity_t barrel;
refEntity_t flash;
refEntity_t legs = {0};
refEntity_t torso = {0};
refEntity_t head = {0};
refEntity_t gun = {0};
refEntity_t barrel = {0};
refEntity_t flash = {0};
vec3_t origin;
int renderfx;
vec3_t mins = {-16, -16, -24};
@ -845,10 +843,6 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
angles[YAW] = 0;
angles[PITCH] = 0;
angles[ROLL] = UI_MachinegunSpinAngle( pi );
if( pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {
angles[PITCH] = angles[ROLL];
angles[ROLL] = 0;
}
AnglesToAxis( angles, barrel.axis );
UI_PositionRotatedEntityOnTag( &barrel, &gun, pi->weaponModel, "tag_barrel");

View file

@ -353,7 +353,6 @@ static void Preferences_MenuInit( void ) {
s_preferences.allowdownload.generic.x = PREFERENCES_X_POS;
s_preferences.allowdownload.generic.y = y;
y += BIGCHAR_HEIGHT+2;
s_preferences.back.generic.type = MTYPE_BITMAP;
s_preferences.back.generic.name = ART_BACK0;
s_preferences.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;

View file

@ -183,7 +183,7 @@ static void UI_SPLevelMenu_SetBots( void ) {
while( *p && *p == ' ' ) {
p++;
}
if( !p ) {
if( !*p ) {
break;
}
@ -236,7 +236,7 @@ static void UI_SPLevelMenu_SetMenuArena( int n, int level, const char *arenaInfo
levelMenuInfo.levelScores[n] = 8;
}
strcpy( levelMenuInfo.levelPicNames[n], va( "levelshots/%s.tga", map ) );
Com_sprintf( levelMenuInfo.levelPicNames[n], sizeof(levelMenuInfo.levelPicNames[n]), "levelshots/%s.tga", map );
if( !trap_R_RegisterShaderNoMip( levelMenuInfo.levelPicNames[n] ) ) {
strcpy( levelMenuInfo.levelPicNames[n], ART_MAP_UNKNOWN );
}

View file

@ -1076,7 +1076,7 @@ static void ServerOptions_InitBotNames( void ) {
while( *p && *p == ' ' ) {
p++;
}
if( !p ) {
if( !*p ) {
break;
}

View file

@ -150,7 +150,6 @@ void TeamMain_MenuInit( void ) {
s_teammain.spectate.string = "SPECTATE";
s_teammain.spectate.style = UI_CENTER|UI_SMALLFONT;
s_teammain.spectate.color = colorRed;
y += 20;
trap_GetConfigString(CS_SERVERINFO, info, MAX_INFO_STRING);
gametype = atoi( Info_ValueForKey( info,"g_gametype" ) );

View file

@ -1199,7 +1199,6 @@ void GraphicsOptions_MenuInit( void )
s_graphicsoptions.driverinfo.string = "Driver Info";
s_graphicsoptions.driverinfo.style = UI_CENTER|UI_SMALLFONT;
s_graphicsoptions.driverinfo.color = color_red;
y += BIGCHAR_HEIGHT+2;
s_graphicsoptions.back.generic.type = MTYPE_BITMAP;
s_graphicsoptions.back.generic.name = GRAPHICSOPTIONS_BACK0;

View file

@ -418,7 +418,7 @@ static int numPlanes;
static patchPlane_t planes[MAX_PATCH_PLANES];
static int numFacets;
static facet_t facets[MAX_PATCH_PLANES]; //maybe MAX_FACETS ??
static facet_t facets[MAX_FACETS];
#define NORMAL_EPSILON 0.0001
#define DIST_EPSILON 0.02
@ -626,6 +626,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i][j];
p2 = grid->points[i+1][j];
p = CM_GridPlane( gridPlanes, i, j, 0 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p1, p2, up );
@ -633,6 +636,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i][j+1];
p2 = grid->points[i+1][j+1];
p = CM_GridPlane( gridPlanes, i, j, 1 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p2, p1, up );
@ -640,6 +646,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i][j];
p2 = grid->points[i][j+1];
p = CM_GridPlane( gridPlanes, i, j, 1 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p2, p1, up );
@ -647,6 +656,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i+1][j];
p2 = grid->points[i+1][j+1];
p = CM_GridPlane( gridPlanes, i, j, 0 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p1, p2, up );
@ -654,6 +666,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i+1][j+1];
p2 = grid->points[i][j];
p = CM_GridPlane( gridPlanes, i, j, 0 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p1, p2, up );
@ -661,6 +676,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i][j];
p2 = grid->points[i+1][j+1];
p = CM_GridPlane( gridPlanes, i, j, 1 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p1, p2, up );
@ -858,7 +876,10 @@ void CM_AddFacetBevels( facet_t *facet ) {
}
if ( i == facet->numBorders ) {
if (facet->numBorders > 4 + 6 + 16) Com_Printf("ERROR: too many bevels\n");
if ( facet->numBorders >= 4 + 6 + 16 ) {
Com_Printf( "ERROR: too many bevels\n" );
continue;
}
facet->borderPlanes[facet->numBorders] = CM_FindPlane2(plane, &flipped);
facet->borderNoAdjust[facet->numBorders] = 0;
facet->borderInward[facet->numBorders] = flipped;
@ -920,7 +941,10 @@ void CM_AddFacetBevels( facet_t *facet ) {
}
if ( i == facet->numBorders ) {
if (facet->numBorders > 4 + 6 + 16) Com_Printf("ERROR: too many bevels\n");
if ( facet->numBorders >= 4 + 6 + 16 ) {
Com_Printf( "ERROR: too many bevels\n" );
continue;
}
facet->borderPlanes[facet->numBorders] = CM_FindPlane2(plane, &flipped);
for ( k = 0 ; k < facet->numBorders ; k++ ) {
@ -958,6 +982,10 @@ void CM_AddFacetBevels( facet_t *facet ) {
#ifndef BSPC
//add opposite plane
if ( facet->numBorders >= 4 + 6 + 16 ) {
Com_Printf( "ERROR: too many bevels\n" );
return;
}
facet->borderPlanes[facet->numBorders] = facet->surfacePlane;
facet->borderNoAdjust[facet->numBorders] = 0;
facet->borderInward[facet->numBorders] = qtrue;

View file

@ -667,6 +667,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
if( !Q_stricmp( command, cmd->name ) ) {
cmd->complete = complete;
return;
}
}
}
@ -743,9 +744,12 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) {
cmd_function_t *cmd;
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
if( !Q_stricmp( command, cmd->name ) && cmd->complete ) {
if( !Q_stricmp( command, cmd->name ) ) {
if ( cmd->complete ) {
cmd->complete( args, argNum );
}
return;
}
}
}

View file

@ -1537,6 +1537,7 @@ void Com_InitHunkMemory( void ) {
// allocate the stack based hunk allocator
cv = Cvar_Get( "com_hunkMegs", DEF_COMHUNKMEGS_S, CVAR_LATCH | CVAR_ARCHIVE );
Cvar_SetDescription(cv, "The size of the hunk memory segment");
// if we are not dedicated min allocation is 56, otherwise min is 1
if (com_dedicated && com_dedicated->integer) {
@ -3551,7 +3552,7 @@ void Com_RandomBytes( byte *string, int len )
Com_Printf( "Com_RandomBytes: using weak randomization\n" );
for( i = 0; i < len; i++ )
string[i] = (unsigned char)( rand() % 255 );
string[i] = (unsigned char)( rand() % 256 );
}

View file

@ -438,6 +438,7 @@ cvar_t *Cvar_Get( const char *var_name, const char *var_value, int flags ) {
var->integer = atoi(var->string);
var->resetString = CopyString( var_value );
var->validate = qfalse;
var->description = NULL;
// link the variable in
var->next = cvar_vars;
@ -489,6 +490,10 @@ void Cvar_Print( cvar_t *v ) {
if ( v->latchedString ) {
Com_Printf( "latched: \"%s\"\n", v->latchedString );
}
if ( v->description ) {
Com_Printf( "%s\n", v->description );
}
}
/*
@ -1016,6 +1021,90 @@ void Cvar_List_f( void ) {
Com_Printf ("%i cvar indexes\n", cvar_numIndexes);
}
/*
============
Cvar_ListModified_f
============
*/
void Cvar_ListModified_f( void ) {
cvar_t *var;
int totalModified;
char *value;
char *match;
if ( Cmd_Argc() > 1 ) {
match = Cmd_Argv( 1 );
} else {
match = NULL;
}
totalModified = 0;
for (var = cvar_vars ; var ; var = var->next)
{
if ( !var->name || !var->modificationCount )
continue;
value = var->latchedString ? var->latchedString : var->string;
if ( !strcmp( value, var->resetString ) )
continue;
totalModified++;
if (match && !Com_Filter(match, var->name, qfalse))
continue;
if (var->flags & CVAR_SERVERINFO) {
Com_Printf("S");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_SYSTEMINFO) {
Com_Printf("s");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_USERINFO) {
Com_Printf("U");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_ROM) {
Com_Printf("R");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_INIT) {
Com_Printf("I");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_ARCHIVE) {
Com_Printf("A");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_LATCH) {
Com_Printf("L");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_CHEAT) {
Com_Printf("C");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_USER_CREATED) {
Com_Printf("?");
} else {
Com_Printf(" ");
}
Com_Printf (" %s \"%s\", default \"%s\"\n", var->name, value, var->resetString);
}
Com_Printf ("\n%i total modified cvars\n", totalModified);
}
/*
============
Cvar_Unset
@ -1028,6 +1117,9 @@ cvar_t *Cvar_Unset(cvar_t *cv)
{
cvar_t *next = cv->next;
// note what types of cvars have been modified (userinfo, archive, serverinfo, systeminfo)
cvar_modifiedFlags |= cv->flags;
if(cv->name)
Z_Free(cv->name);
if(cv->string)
@ -1036,6 +1128,8 @@ cvar_t *Cvar_Unset(cvar_t *cv)
Z_Free(cv->latchedString);
if(cv->resetString)
Z_Free(cv->resetString);
if(cv->description)
Z_Free(cv->description);
if(cv->prev)
cv->prev->next = cv->next;
@ -1205,6 +1299,23 @@ void Cvar_CheckRange( cvar_t *var, float min, float max, qboolean integral )
Cvar_Set( var->name, var->string );
}
/*
=====================
Cvar_SetDescription
=====================
*/
void Cvar_SetDescription( cvar_t *var, const char *var_description )
{
if( var_description && var_description[0] != '\0' )
{
if( var->description != NULL )
{
Z_Free( var->description );
}
var->description = CopyString( var_description );
}
}
/*
=====================
Cvar_Register
@ -1319,5 +1430,6 @@ void Cvar_Init (void)
Cmd_SetCommandCompletionFunc("unset", Cvar_CompleteCvarName);
Cmd_AddCommand ("cvarlist", Cvar_List_f);
Cmd_AddCommand ("cvar_modified", Cvar_ListModified_f);
Cmd_AddCommand ("cvar_restart", Cvar_Restart_f);
}

View file

@ -250,6 +250,7 @@ static cvar_t *fs_homepath;
// Also search the .app bundle for .pk3 files
static cvar_t *fs_apppath;
#endif
static cvar_t *fs_steampath;
static cvar_t *fs_basepath;
static cvar_t *fs_basegame;
@ -533,7 +534,9 @@ qboolean FS_CreatePath (char *OSPath) {
// Skip creation of the root directory as it will always be there
ofs = strchr( path, PATH_SEP );
if ( ofs != NULL ) {
ofs++;
}
for (; ofs != NULL && *ofs ; ofs++) {
if (*ofs == PATH_SEP) {
@ -746,6 +749,21 @@ long FS_SV_FOpenFileRead(const char *filename, fileHandle_t *fp)
fsh[f].handleSync = qfalse;
}
// Check fs_steampath too
if (!fsh[f].handleFiles.file.o && fs_steampath->string[0])
{
ospath = FS_BuildOSPath( fs_steampath->string, filename, "" );
ospath[strlen(ospath)-1] = '\0';
if ( fs_debug->integer )
{
Com_Printf( "FS_SV_FOpenFileRead (fs_steampath): %s\n", ospath );
}
fsh[f].handleFiles.file.o = Sys_FOpen( ospath, "rb" );
fsh[f].handleSync = qfalse;
}
if ( !fsh[f].handleFiles.file.o )
{
f = 0;
@ -2484,6 +2502,8 @@ int FS_GetModList( char *listbuf, int bufsize ) {
int dummy;
char **pFiles0 = NULL;
char **pFiles1 = NULL;
char **pFiles2 = NULL;
char **pFiles3 = NULL;
qboolean bDrop = qfalse;
*listbuf = 0;
@ -2491,9 +2511,12 @@ int FS_GetModList( char *listbuf, int bufsize ) {
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
pFiles2 = Sys_ListFiles( fs_steampath->string, NULL, NULL, &dummy, qtrue );
// we searched for mods in the three paths
// it is likely that we have duplicate names now, which we will cleanup below
pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
pFiles3 = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
pFiles = Sys_ConcatenateFileLists( pFiles2, pFiles3 );
nPotential = Sys_CountFileList(pFiles);
for ( i = 0 ; i < nPotential ; i++ ) {
@ -2535,6 +2558,15 @@ int FS_GetModList( char *listbuf, int bufsize ) {
Sys_FreeFileList( pPaks );
}
/* try on steam path */
if ( nPaks <= 0 )
{
path = FS_BuildOSPath( fs_steampath->string, name, "" );
nPaks = 0;
pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
Sys_FreeFileList( pPaks );
}
if (nPaks > 0) {
nLen = strlen(name) + 1;
// nLen is the length of the mod path
@ -2741,7 +2773,7 @@ void FS_Path_f( void ) {
searchpath_t *s;
int i;
Com_Printf ("Current search path:\n");
Com_Printf ("We are looking in the current search path:\n");
for (s = fs_searchpaths; s; s = s->next) {
if (s->pack) {
Com_Printf ("%s (%i files)\n", s->pack->pakFilename, s->pack->numfiles);
@ -3278,6 +3310,10 @@ static void FS_Startup( const char *gameName )
fs_gamedirvar = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
// add search path elements in reverse priority order
fs_steampath = Cvar_Get ("fs_steampath", Sys_SteamPath(), CVAR_INIT|CVAR_PROTECTED );
if (fs_steampath->string[0]) {
FS_AddGameDirectory( fs_steampath->string, gameName );
}
if (fs_basepath->string[0]) {
FS_AddGameDirectory( fs_basepath->string, gameName );
}
@ -3298,6 +3334,9 @@ static void FS_Startup( const char *gameName )
// check for additional base game so mods can be based upon other mods
if ( fs_basegame->string[0] && Q_stricmp( fs_basegame->string, gameName ) ) {
if (fs_steampath->string[0]) {
FS_AddGameDirectory(fs_steampath->string, fs_basegame->string);
}
if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_basegame->string);
}
@ -3308,6 +3347,9 @@ static void FS_Startup( const char *gameName )
// check for additional game folder for mods
if ( fs_gamedirvar->string[0] && Q_stricmp( fs_gamedirvar->string, gameName ) ) {
if (fs_steampath->string[0]) {
FS_AddGameDirectory(fs_steampath->string, fs_gamedirvar->string);
}
if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string);
}

View file

@ -177,12 +177,10 @@ static void mdfour_update(struct mdfour *md, byte *in, int n)
static void mdfour_result(struct mdfour *md, byte *out)
{
m = md;
copy4(out, m->A);
copy4(out+4, m->B);
copy4(out+8, m->C);
copy4(out+12, m->D);
copy4(out, md->A);
copy4(out+4, md->B);
copy4(out+8, md->C);
copy4(out+12, md->D);
}
static void mdfour(byte *out, byte *in, int n)

View file

@ -246,7 +246,7 @@ int MSG_ReadBits( msg_t *msg, int bits ) {
}
msg->readcount = (msg->bit>>3)+1;
}
if ( sgn ) {
if ( sgn && bits > 0 && bits < 32 ) {
if ( value & ( 1 << ( bits - 1 ) ) ) {
value |= -1 ^ ( ( 1 << bits ) - 1 );
}

View file

@ -1619,7 +1619,7 @@ Called from NET_Sleep which uses select() to determine which sockets have seen a
void NET_Event(fd_set *fdr)
{
byte bufData[MAX_MSGLEN + 1];
netadr_t from;
netadr_t from = {0};
msg_t netmsg;
while(1)

View file

@ -169,50 +169,29 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//================================================================= LINUX ===
#if defined(__linux__) || defined(__FreeBSD_kernel__)
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
#include <endian.h>
#if defined(__linux__)
#define OS_STRING "linux"
#else
#elif defined(__FreeBSD_kernel__)
#define OS_STRING "kFreeBSD"
#else
#define OS_STRING "GNU"
#endif
#define ID_INLINE inline
#define PATH_SEP '/'
#if defined __i386__
#define ARCH_STRING "x86"
#elif defined __x86_64__
#if !defined(ARCH_STRING)
# error ARCH_STRING should be defined by the Makefile
#endif
#if defined __x86_64__
#undef idx64
#define idx64 1
#define ARCH_STRING "x86_64"
#elif defined __powerpc64__
#define ARCH_STRING "ppc64"
#elif defined __powerpc__
#define ARCH_STRING "ppc"
#elif defined __s390__
#define ARCH_STRING "s390"
#elif defined __s390x__
#define ARCH_STRING "s390x"
#elif defined __ia64__
#define ARCH_STRING "ia64"
#elif defined __alpha__
#define ARCH_STRING "alpha"
#elif defined __sparc__
#define ARCH_STRING "sparc"
#elif defined __arm__
#define ARCH_STRING "arm"
#elif defined __cris__
#define ARCH_STRING "cris"
#elif defined __hppa__
#define ARCH_STRING "hppa"
#elif defined __mips__
#define ARCH_STRING "mips"
#elif defined __sh__
#define ARCH_STRING "sh"
#endif
#if __FLOAT_WORD_ORDER == __BIG_ENDIAN

View file

@ -600,6 +600,10 @@ void SkipRestOfLine ( char **data ) {
int c;
p = *data;
if ( !*p )
return;
while ( (c = *p++) != 0 ) {
if ( c == '\n' ) {
com_lines++;
@ -1252,7 +1256,7 @@ void Info_RemoveKey_Big( char *s, const char *key ) {
if (!strcmp (key, pkey) )
{
strcpy (start, s); // remove this part
memmove(start, s, strlen(s) + 1); // remove this part
return;
}

View file

@ -34,6 +34,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define HOMEPATH_NAME_UNIX ".Reaction"
#define HOMEPATH_NAME_WIN "Reaction"
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
// #define STEAMPATH_NAME "Foo Bar"
// #define STEAMPATH_APPID ""
#define GAMENAME_FOR_MASTER "Reaction"
// #define LEGACY_PROTOCOL // You probably don't need this for your standalone game
#else
@ -44,6 +46,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define HOMEPATH_NAME_UNIX ".Reaction"
#define HOMEPATH_NAME_WIN "Reaction"
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
// #define STEAMPATH_NAME "Foo Bar"
// #define STEAMPATH_APPID ""
#define GAMENAME_FOR_MASTER "Reaction"
// #define LEGACY_PROTOCOL
#endif
@ -410,8 +414,8 @@ extern vec4_t colorDkGrey;
#define COLOR_CYAN '5'
#define COLOR_MAGENTA '6'
#define COLOR_WHITE '7'
//#define ColorIndex(c) (((c) - '0') & 0x07)
#define ColorIndex(c) ( ( (c) - '0' ) & 7 )
#define ColorIndexForNumber(c) ((c) & 0x07)
#define ColorIndex(c) (ColorIndexForNumber((c) - '0'))
//Makro - reset color
#define S_COLOR_RESET "^*"
@ -952,6 +956,7 @@ struct cvar_s {
qboolean integral;
float min;
float max;
char *description;
cvar_t *next;
cvar_t *prev;

View file

@ -562,6 +562,7 @@ char *Cvar_InfoString_Big( int bit );
// in their flags ( CVAR_USERINFO, CVAR_SERVERINFO, CVAR_SYSTEMINFO, etc )
void Cvar_InfoStringBuffer( int bit, char *buff, int buffsize );
void Cvar_CheckRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
void Cvar_SetDescription( cvar_t *var, const char *var_description );
void Cvar_Restart(qboolean unsetVM);
void Cvar_Restart_f( void );
@ -1098,6 +1099,7 @@ FILE *Sys_Mkfifo( const char *ospath );
char *Sys_Cwd( void );
void Sys_SetDefaultInstallPath(const char *path);
char *Sys_DefaultInstallPath(void);
char *Sys_SteamPath(void);
#ifdef MACOS_X
char *Sys_DefaultAppPath(void);

View file

@ -1,4 +1,10 @@
/* unzip.c -- IO for uncompress .zip files using zlib
Modified for Quake III Arena to use the Z_Malloc() memory pool;
this means a system copy of minizip is not a suitable replacement.
Based on minizip:
Version 1.01e, February 12th, 2005
Copyright (C) 1998-2005 Gilles Vollant

View file

@ -203,19 +203,25 @@ static void EmitRexString(byte rex, const char *string)
#define MASK_REG(modrm, mask) \
do { \
EmitString("81"); \
EmitString((modrm)); \
Emit4((mask))
Emit4((mask)); \
} while(0)
// add bl, bytes
#define STACK_PUSH(bytes) \
do { \
EmitString("80 C3"); \
Emit1(bytes)
Emit1(bytes); \
} while(0)
// sub bl, bytes
#define STACK_POP(bytes) \
do { \
EmitString("80 EB"); \
Emit1(bytes)
Emit1(bytes); \
} while(0)
static void EmitCommand(ELastCommand command)
{
@ -412,23 +418,24 @@ static void DoSyscall(void)
if(vm_syscallNum < 0)
{
int *data;
int *data, *ret;
#if idx64
int index;
intptr_t args[MAX_VMSYSCALL_ARGS];
#endif
data = (int *) (savedVM->dataBase + vm_programStack + 4);
ret = &vm_opStackBase[vm_opStackOfs + 1];
#if idx64
args[0] = ~vm_syscallNum;
for(index = 1; index < ARRAY_LEN(args); index++)
args[index] = data[index];
vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall(args);
*ret = savedVM->systemCall(args);
#else
data[0] = ~vm_syscallNum;
vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall((intptr_t *) data);
*ret = savedVM->systemCall((intptr_t *) data);
#endif
}
else
@ -1087,8 +1094,9 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
// ensure that the optimisation pass knows about all the jump
// table targets
pc = -1; // a bogus value to be printed in out-of-bounds error messages
for( i = 0; i < vm->numJumpTableTargets; i++ ) {
jused[ *(int *)(vm->jumpTableTargets + ( i * sizeof( int ) ) ) ] = 1;
JUSED( *(int *)(vm->jumpTableTargets + ( i * sizeof( int ) ) ) );
}
// Start buffer with x86-VM specific procedures

View file

@ -381,8 +381,8 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
// GL_EXT_multi_draw_arrays
extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum, GLint *, GLsizei *, GLsizei);
extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei);
extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
// GL_ARB_shading_language_100
#ifndef GL_ARB_shading_language_100
@ -726,6 +726,17 @@ extern void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
#endif
// GL_ARB_vertex_array_object
extern void (APIENTRY * qglBindVertexArrayARB)(GLuint array);
extern void (APIENTRY * qglDeleteVertexArraysARB)(GLsizei n, const GLuint *arrays);
extern void (APIENTRY * qglGenVertexArraysARB)(GLsizei n, GLuint *arrays);
extern GLboolean (APIENTRY * qglIsVertexArrayARB)(GLuint array);
#ifndef GL_ARB_vertex_array_object
#define GL_ARB_vertex_array_object
#define GL_VERTEX_ARRAY_BINDING_ARB 0x85B5
#endif
#if defined(WIN32)
// WGL_ARB_create_context
#ifndef WGL_ARB_create_context

View file

@ -134,6 +134,20 @@ void R_InitFreeType( void );
void R_DoneFreeType( void );
void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font);
/*
=============================================================
IMAGE LOADERS
=============================================================
*/
void R_LoadBMP( const char *name, byte **pic, int *width, int *height );
void R_LoadJPG( const char *name, byte **pic, int *width, int *height );
void R_LoadPCX( const char *name, byte **pic, int *width, int *height );
void R_LoadPNG( const char *name, byte **pic, int *width, int *height );
void R_LoadTGA( const char *name, byte **pic, int *width, int *height );
/*
====================================================================

View file

@ -397,7 +397,7 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
// Com_Memcpy(font, faceData, sizeof(fontInfo_t));
Q_strncpyz(font->name, name, sizeof(font->name));
for (i = GLYPH_START; i < GLYPH_END; i++) {
for (i = GLYPH_START; i <= GLYPH_END; i++) {
font->glyphs[i].glyph = RE_RegisterShaderNoMip(font->glyphs[i].shaderName);
}
Com_Memcpy(&registeredFont[registeredFontCount++], font, sizeof(fontInfo_t));
@ -445,7 +445,7 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
maxHeight = 0;
for (i = GLYPH_START; i < GLYPH_END; i++) {
for (i = GLYPH_START; i <= GLYPH_END; i++) {
RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue);
}
@ -455,11 +455,16 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
lastStart = i;
imageNumber = 0;
while ( i <= GLYPH_END ) {
while ( i <= GLYPH_END + 1 ) {
if ( i == GLYPH_END + 1 ) {
// upload/save current image buffer
xOut = yOut = -1;
} else {
glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qfalse);
}
if (xOut == -1 || yOut == -1 || i == GLYPH_END) {
if (xOut == -1 || yOut == -1) {
// ran out of room
// we need to create an image from the bitmap, set all the handles in the glyphs to this point
//
@ -504,7 +509,7 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
xOut = 0;
yOut = 0;
ri.Free(imageBuff);
if(i == GLYPH_END)
if ( i == GLYPH_END + 1 )
i++;
} else {
Com_Memcpy(&font->glyphs[i], glyph, sizeof(glyphInfo_t));

View file

@ -133,6 +133,7 @@ typedef struct {
void (*Cvar_Set)( const char *name, const char *value );
void (*Cvar_SetValue) (const char *name, float value);
void (*Cvar_CheckRange)( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
void (*Cvar_SetDescription)( cvar_t *cv, const char *description );
int (*Cvar_VariableIntegerValue) (const char *var_name);

View file

@ -346,7 +346,7 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames +
backEnd.currentEntity->e.oldframe * frameSize );
RB_CheckOverflow( surface->numVerts, surface->numTriangles );
RB_CHECKOVERFLOW( surface->numVerts, surface->numTriangles * 3 );
triangles = (int *) ((byte *)surface + surface->ofsTriangles);
indexes = surface->numTriangles * 3;

View file

@ -474,7 +474,7 @@ void RB_BeginDrawingView (void) {
// clip to the plane of the portal
if ( backEnd.viewParms.isPortal ) {
float plane[4];
double plane2[4];
GLdouble plane2[4];
plane[0] = backEnd.viewParms.portalPlane.normal[0];
plane[1] = backEnd.viewParms.portalPlane.normal[1];
@ -710,7 +710,7 @@ void RB_SetGL2D (void) {
GLS_SRCBLEND_SRC_ALPHA |
GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
qglDisable( GL_CULL_FACE );
GL_Cull( CT_TWO_SIDED );
qglDisable( GL_CLIP_PLANE0 );
// set time for 2D shaders

View file

@ -927,7 +927,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
for (m = 0; m < 2; m++) {
if ( grid2->width >= MAX_GRID_SIZE )
if ( !grid2 || grid2->width >= MAX_GRID_SIZE )
break;
if (m) offset2 = (grid2->height-1) * grid2->width;
else offset2 = 0;
@ -971,7 +971,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
}
for (m = 0; m < 2; m++) {
if (grid2->height >= MAX_GRID_SIZE)
if (!grid2 || grid2->height >= MAX_GRID_SIZE)
break;
if (m) offset2 = grid2->width-1;
else offset2 = 0;
@ -1026,7 +1026,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
for (k = grid1->height-1; k > 1; k -= 2) {
for (m = 0; m < 2; m++) {
if ( grid2->width >= MAX_GRID_SIZE )
if ( !grid2 || grid2->width >= MAX_GRID_SIZE )
break;
if (m) offset2 = (grid2->height-1) * grid2->width;
else offset2 = 0;
@ -1070,7 +1070,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
}
for (m = 0; m < 2; m++) {
if (grid2->height >= MAX_GRID_SIZE)
if (!grid2 || grid2->height >= MAX_GRID_SIZE)
break;
if (m) offset2 = grid2->width-1;
else offset2 = 0;

View file

@ -899,7 +899,6 @@ image_t *R_CreateImage( const char *name, byte *pic, int width, int height,
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glWrapClampMode );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, glWrapClampMode );
// FIXME: this stops fog from setting border color?
glState.currenttextures[glState.currenttmu] = 0;
qglBindTexture( GL_TEXTURE_2D, 0 );
@ -1168,7 +1167,6 @@ static void R_CreateFogImage( void ) {
int x,y;
byte *data;
float d;
float borderColor[4];
data = ri.Hunk_AllocateTempMemory( FOG_S * FOG_T * 4 );
@ -1183,18 +1181,8 @@ static void R_CreateFogImage( void ) {
data[(y*FOG_S+x)*4+3] = 255*d;
}
}
// standard openGL clamping doesn't really do what we want -- it includes
// the border color at the edges. OpenGL 1.2 has clamp-to-edge, which does
// what we want.
tr.fogImage = R_CreateImage("*fog", (byte *)data, FOG_S, FOG_T, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
ri.Hunk_FreeTempMemory( data );
borderColor[0] = 1.0;
borderColor[1] = 1.0;
borderColor[2] = 1.0;
borderColor[3] = 1;
qglTexParameterfv( GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor );
}
/*
@ -1443,12 +1431,15 @@ static char *CommaParse( char **data_p ) {
// skip double slash comments
if ( c == '/' && data[1] == '/' )
{
while (*data && *data != '\n')
data += 2;
while (*data && *data != '\n') {
data++;
}
}
// skip /* */ comments
else if ( c=='/' && data[1] == '*' )
{
data += 2;
while ( *data && ( *data != '*' || data[1] != '/' ) )
{
data++;
@ -1481,7 +1472,7 @@ static char *CommaParse( char **data_p ) {
*data_p = ( char * ) data;
return com_token;
}
if (len < MAX_TOKEN_CHARS)
if (len < MAX_TOKEN_CHARS - 1)
{
com_token[len] = c;
len++;
@ -1492,7 +1483,7 @@ static char *CommaParse( char **data_p ) {
// parse a regular word
do
{
if (len < MAX_TOKEN_CHARS)
if (len < MAX_TOKEN_CHARS - 1)
{
com_token[len] = c;
len++;
@ -1501,11 +1492,6 @@ static char *CommaParse( char **data_p ) {
c = *data;
} while (c>32 && c != ',' );
if (len == MAX_TOKEN_CHARS)
{
// ri.Printf (PRINT_DEVELOPER, "Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
len = 0;
}
com_token[len] = 0;
*data_p = ( char * ) data;
@ -1569,7 +1555,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
// If not a .skin file, load as a single shader
if ( strcmp( name + strlen( name ) - 5, ".skin" ) ) {
skin->numSurfaces = 1;
skin->surfaces[0] = ri.Hunk_Alloc( sizeof(skin->surfaces[0]), h_low );
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
skin->surfaces[0]->shader = R_FindShader( name, LIGHTMAP_NONE, qtrue );
return hSkin;
}
@ -1640,7 +1626,7 @@ void R_InitSkins( void ) {
skin = tr.skins[0] = ri.Hunk_Alloc( sizeof( skin_t ), h_low );
Q_strncpyz( skin->name, "<default skin>", sizeof( skin->name ) );
skin->numSurfaces = 1;
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces ), h_low );
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
skin->surfaces[0]->shader = tr.defaultShader;
}

View file

@ -151,7 +151,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
frac[i] = v - pos[i];
if ( pos[i] < 0 ) {
pos[i] = 0;
} else if ( pos[i] >= tr.world->lightGridBounds[i] - 1 ) {
} else if ( pos[i] > tr.world->lightGridBounds[i] - 1 ) {
pos[i] = tr.world->lightGridBounds[i] - 1;
}
}
@ -182,6 +182,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
data = gridData;
for ( j = 0 ; j < 3 ; j++ ) {
if ( i & (1<<j) ) {
if ( pos[j] + 1 > tr.world->lightGridBounds[j] - 1 ) {
break; // ignore values outside lightgrid
}
factor *= frac[j];
data += gridStep[j];
} else {
@ -189,6 +192,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
}
}
if ( j != 3 ) {
continue;
}
if ( !(data[0]+data[1]+data[2]) ) {
continue; // ignore samples in walls
}

View file

@ -477,7 +477,6 @@ typedef enum {
SF_IQM,
SF_FLARE,
SF_ENTITY, // beams, rails, lightning, etc that can be determined by entity
SF_DISPLAY_LIST,
SF_NUM_SURFACE_TYPES,
SF_MAX = 0x7fffffff // ensures that sizeof( surfaceType_t ) == sizeof( int )
@ -503,11 +502,6 @@ typedef struct srfPoly_s {
polyVert_t *verts;
} srfPoly_t;
typedef struct srfDisplayList_s {
surfaceType_t surfaceType;
int listNum;
} srfDisplayList_t;
typedef struct srfFlare_s {
surfaceType_t surfaceType;
@ -1397,20 +1391,6 @@ int R_IQMLerpTag( orientation_t *tag, iqmData_t *data,
int startFrame, int endFrame,
float frac, const char *tagName );
/*
=============================================================
IMAGE LOADERS
=============================================================
*/
void R_LoadBMP( const char *name, byte **pic, int *width, int *height );
void R_LoadJPG( const char *name, byte **pic, int *width, int *height );
void R_LoadPCX( const char *name, byte **pic, int *width, int *height );
void R_LoadPNG( const char *name, byte **pic, int *width, int *height );
void R_LoadTGA( const char *name, byte **pic, int *width, int *height );
/*
=============================================================
=============================================================

View file

@ -1011,6 +1011,10 @@ int R_SpriteFogNum( trRefEntity_t *ent ) {
return 0;
}
if ( ent->e.renderfx & RF_CROSSHAIR ) {
return 0;
}
for ( i = 1 ; i < tr.world->numfogs ; i++ ) {
fog = &tr.world->fogs[i];
for ( j = 0 ; j < 3 ; j++ ) {

View file

@ -144,7 +144,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
unsigned short *framedata;
char *str;
int i, j;
float jointInvMats[IQM_MAX_JOINTS * 12];
float jointInvMats[IQM_MAX_JOINTS * 12] = {0.0f};
float *mat, *matInv;
size_t size, joint_names;
iqmData_t *iqmData;

View file

@ -421,7 +421,7 @@ static void ProjectDlightTexture_altivec( void ) {
byte clipBits[SHADER_MAX_VERTEXES];
float texCoordsArray[SHADER_MAX_VERTEXES][2];
byte colorArray[SHADER_MAX_VERTEXES][4];
unsigned hitIndexes[SHADER_MAX_INDEXES];
glIndex_t hitIndexes[SHADER_MAX_INDEXES];
int numIndexes;
float scale;
float radius;
@ -593,7 +593,7 @@ static void ProjectDlightTexture_scalar( void ) {
byte clipBits[SHADER_MAX_VERTEXES];
float texCoordsArray[SHADER_MAX_VERTEXES][2];
byte colorArray[SHADER_MAX_VERTEXES][4];
unsigned hitIndexes[SHADER_MAX_INDEXES];
glIndex_t hitIndexes[SHADER_MAX_INDEXES];
int numIndexes;
float scale;
float radius;

View file

@ -771,7 +771,7 @@ void RB_CalcModulateAlphasByFog( unsigned char *colors ) {
*/
void RB_CalcModulateRGBAsByFog( unsigned char *colors ) {
int i;
float texCoords[SHADER_MAX_VERTEXES][2];
float texCoords[SHADER_MAX_VERTEXES][2] = {{0.0f}};
// calculate texcoords so we can derive density
// this is not wasted, because it would only have

View file

@ -847,6 +847,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
{
vec3_t color;
VectorClear( color );
ParseVector( text, 3, color );
stage->constantColor[0] = 255 * color[0];
stage->constantColor[1] = 255 * color[1];
@ -1010,8 +1012,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
token = COM_ParseExt( text, qfalse );
if ( token[0] == 0 )
break;
strcat( buffer, token );
strcat( buffer, " " );
Q_strcat( buffer, sizeof (buffer), token );
Q_strcat( buffer, sizeof (buffer), " " );
}
ParseTexMod( buffer, stage );
@ -1457,7 +1459,7 @@ static qboolean ParseShader( char **text )
else if ( token[0] == '{' )
{
if ( s >= MAX_SHADER_STAGES ) {
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s\n", shader.name );
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s (max is %i)\n", shader.name, MAX_SHADER_STAGES );
return qfalse;
}
@ -1566,6 +1568,23 @@ static qboolean ParseShader( char **text )
return qfalse;
}
if ( r_greyscale->integer )
{
float luminance;
luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
VectorSet( shader.fogParms.color, luminance, luminance, luminance );
}
else if ( r_greyscale->value )
{
float luminance;
luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value );
shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value );
shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value );
}
token = COM_ParseExt( text, qfalse );
if ( !token[0] )
{
@ -2143,6 +2162,26 @@ static void VertexLightingCollapse( void ) {
}
}
/*
===============
InitShader
===============
*/
static void InitShader( const char *name, int lightmapIndex ) {
int i;
// clear the global shader
Com_Memset( &shader, 0, sizeof( shader ) );
Com_Memset( &stages, 0, sizeof( stages ) );
Q_strncpyz( shader.name, name, sizeof( shader.name ) );
shader.lightmapIndex = lightmapIndex;
for ( i = 0 ; i < MAX_SHADER_STAGES ; i++ ) {
stages[i].bundle[0].texMods = texMods[i];
}
}
/*
=========================
FinishShader
@ -2462,7 +2501,7 @@ most world construction surfaces.
*/
shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage ) {
char strippedName[MAX_QPATH];
int i, hash;
int hash;
char *shaderText;
image_t *image;
shader_t *sh;
@ -2500,14 +2539,7 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
}
}
// clear the global shader
Com_Memset( &shader, 0, sizeof( shader ) );
Com_Memset( &stages, 0, sizeof( stages ) );
Q_strncpyz(shader.name, strippedName, sizeof(shader.name));
shader.lightmapIndex = lightmapIndex;
for ( i = 0 ; i < MAX_SHADER_STAGES ; i++ ) {
stages[i].bundle[0].texMods = texMods[i];
}
InitShader( strippedName, lightmapIndex );
// FIXME: set these "need" values apropriately
shader.needsNormal = qtrue;
@ -2617,7 +2649,7 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_t *image, qboolean mipRawImage) {
int i, hash;
int hash;
shader_t *sh;
hash = generateHashValue(name, FILE_HASH_SIZE);
@ -2645,14 +2677,7 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_
}
}
// clear the global shader
Com_Memset( &shader, 0, sizeof( shader ) );
Com_Memset( &stages, 0, sizeof( stages ) );
Q_strncpyz(shader.name, name, sizeof(shader.name));
shader.lightmapIndex = lightmapIndex;
for ( i = 0 ; i < MAX_SHADER_STAGES ; i++ ) {
stages[i].bundle[0].texMods = texMods[i];
}
InitShader( name, lightmapIndex );
// FIXME: set these "need" values apropriately
shader.needsNormal = qtrue;
@ -2913,7 +2938,7 @@ a single large text block that can be scanned for shader names
static void ScanAndLoadShaderFiles( void )
{
char **shaderFiles;
char *buffers[MAX_SHADER_FILES];
char *buffers[MAX_SHADER_FILES] = {0};
char *p;
int numShaderFiles;
int i;
@ -3070,12 +3095,7 @@ static void CreateInternalShaders( void ) {
tr.numShaders = 0;
// init the default shader
Com_Memset( &shader, 0, sizeof( shader ) );
Com_Memset( &stages, 0, sizeof( stages ) );
Q_strncpyz( shader.name, "<default>", sizeof( shader.name ) );
shader.lightmapIndex = LIGHTMAP_NONE;
InitShader( "<default>", LIGHTMAP_NONE );
stages[0].bundle[0].image[0] = tr.defaultImage;
stages[0].active = qtrue;
stages[0].stateBits = GLS_DEFAULT;

View file

@ -44,6 +44,7 @@ typedef struct {
static edgeDef_t edgeDefs[SHADER_MAX_VERTEXES][MAX_EDGE_DEFS];
static int numEdgeDefs[SHADER_MAX_VERTEXES];
static int facing[SHADER_MAX_INDEXES/3];
static vec3_t shadowXyz[SHADER_MAX_VERTEXES];
void R_AddEdgeDef( int i1, int i2, int facing ) {
int c;
@ -80,13 +81,13 @@ void R_RenderShadowEdges( void ) {
qglBegin( GL_TRIANGLE_STRIP );
qglVertex3fv( tess.xyz[ i1 ] );
qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
qglVertex3fv( shadowXyz[ i1 ] );
qglVertex3fv( tess.xyz[ i2 ] );
qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
qglVertex3fv( shadowXyz[ i2 ] );
qglVertex3fv( tess.xyz[ i3 ] );
qglVertex3fv( tess.xyz[ i3 + tess.numVertexes ] );
qglVertex3fv( shadowXyz[ i3 ] );
qglVertex3fv( tess.xyz[ i1 ] );
qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
qglVertex3fv( shadowXyz[ i1 ] );
qglEnd();
}
#else
@ -126,9 +127,9 @@ void R_RenderShadowEdges( void ) {
if ( hit[ 1 ] == 0 ) {
qglBegin( GL_TRIANGLE_STRIP );
qglVertex3fv( tess.xyz[ i ] );
qglVertex3fv( tess.xyz[ i + tess.numVertexes ] );
qglVertex3fv( shadowXyz[ i ] );
qglVertex3fv( tess.xyz[ i2 ] );
qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
qglVertex3fv( shadowXyz[ i2 ] );
qglEnd();
c_edges++;
} else {
@ -157,11 +158,6 @@ void RB_ShadowTessEnd( void ) {
vec3_t lightDir;
GLboolean rgba[4];
// we can only do this if we have enough space in the vertex buffers
if ( tess.numVertexes >= SHADER_MAX_VERTEXES / 2 ) {
return;
}
if ( glConfig.stencilBits < 4 ) {
return;
}
@ -170,7 +166,7 @@ void RB_ShadowTessEnd( void ) {
// project vertexes away from light direction
for ( i = 0 ; i < tess.numVertexes ; i++ ) {
VectorMA( tess.xyz[i], -512, lightDir, tess.xyz[i+tess.numVertexes] );
VectorMA( tess.xyz[i], -512, lightDir, shadowXyz[i] );
}
// decide which triangles face the light
@ -211,7 +207,6 @@ void RB_ShadowTessEnd( void ) {
// draw the silhouette edges
GL_Bind( tr.whiteImage );
qglEnable( GL_CULL_FACE );
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
qglColor3f( 0.2f, 0.2f, 0.2f );
@ -222,28 +217,15 @@ void RB_ShadowTessEnd( void ) {
qglEnable( GL_STENCIL_TEST );
qglStencilFunc( GL_ALWAYS, 1, 255 );
// mirrors have the culling order reversed
if ( backEnd.viewParms.isMirror ) {
qglCullFace( GL_FRONT );
GL_Cull( CT_BACK_SIDED );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
R_RenderShadowEdges();
qglCullFace( GL_BACK );
GL_Cull( CT_FRONT_SIDED );
qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
R_RenderShadowEdges();
} else {
qglCullFace( GL_BACK );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
R_RenderShadowEdges();
qglCullFace( GL_FRONT );
qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
R_RenderShadowEdges();
}
// reenable writing to the color buffer
@ -272,7 +254,7 @@ void RB_ShadowFinish( void ) {
qglStencilFunc( GL_NOTEQUAL, 0, 255 );
qglDisable (GL_CLIP_PLANE0);
qglDisable (GL_CULL_FACE);
GL_Cull( CT_TWO_SIDED );
GL_Bind( tr.whiteImage );

View file

@ -907,7 +907,8 @@ RB_SurfaceFace
*/
static void RB_SurfaceFace( srfSurfaceFace_t *surf ) {
int i;
unsigned *indices, *tessIndexes;
unsigned *indices;
glIndex_t *tessIndexes;
float *v;
float *normal;
int ndx;
@ -1217,12 +1218,6 @@ static void RB_SurfaceFlare(srfFlare_t *surf)
RB_AddFlare(surf, tess.fogNum, surf->origin, surf->color, surf->normal);
}
static void RB_SurfaceDisplayList( srfDisplayList_t *surf ) {
// all apropriate state must be set in RB_BeginSurface
// this isn't implemented yet...
qglCallList( surf->listNum );
}
static void RB_SurfaceSkip( void *surf ) {
}
@ -1238,6 +1233,5 @@ void (*rb_surfaceTable[SF_NUM_SURFACE_TYPES])( void *) = {
(void(*)(void*))RB_MDRSurfaceAnim, // SF_MDR,
(void(*)(void*))RB_IQMSurfaceAnim, // SF_IQM,
(void(*)(void*))RB_SurfaceFlare, // SF_FLARE,
(void(*)(void*))RB_SurfaceEntity, // SF_ENTITY
(void(*)(void*))RB_SurfaceDisplayList // SF_DISPLAY_LIST
(void(*)(void*))RB_SurfaceEntity // SF_ENTITY
};

View file

@ -74,7 +74,7 @@ vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st)
void main()
{
vec3 position = attr_Position;
vec3 normal = attr_Normal * 2.0 - vec3(1.0);
vec3 normal = attr_Normal;
#if defined(USE_DEFORM_VERTEXES)
position = DeformPosition(position, normal, attr_TexCoord0.st);

View file

@ -102,10 +102,9 @@ void main()
#if defined(USE_VERTEX_ANIMATION)
vec3 position = mix(attr_Position, attr_Position2, u_VertexLerp);
vec3 normal = mix(attr_Normal, attr_Normal2, u_VertexLerp);
normal = normalize(normal - vec3(0.5));
#else
vec3 position = attr_Position;
vec3 normal = attr_Normal * 2.0 - vec3(1.0);
vec3 normal = attr_Normal;
#endif
#if defined(USE_DEFORM_VERTEXES)

View file

@ -1,45 +1,12 @@
uniform sampler2D u_DiffuseMap;
#if defined(USE_LIGHTMAP)
uniform sampler2D u_LightMap;
uniform int u_Texture1Env;
#endif
varying vec2 var_DiffuseTex;
#if defined(USE_LIGHTMAP)
varying vec2 var_LightTex;
#endif
varying vec4 var_Color;
void main()
{
vec4 color = texture2D(u_DiffuseMap, var_DiffuseTex);
#if defined(USE_LIGHTMAP)
vec4 color2 = texture2D(u_LightMap, var_LightTex);
#if defined(RGBM_LIGHTMAP)
color2.rgb *= color2.a;
color2.a = 1.0;
#endif
if (u_Texture1Env == TEXENV_MODULATE)
{
color *= color2;
}
else if (u_Texture1Env == TEXENV_ADD)
{
color += color2;
}
else if (u_Texture1Env == TEXENV_REPLACE)
{
color = color2;
}
//color = color * (u_Texture1Env.xxxx + color2 * u_Texture1Env.z) + color2 * u_Texture1Env.y;
#endif
gl_FragColor = color * var_Color;
}

View file

@ -9,7 +9,7 @@ attribute vec3 attr_Normal2;
attribute vec4 attr_Color;
attribute vec4 attr_TexCoord0;
#if defined(USE_LIGHTMAP) || defined(USE_TCGEN)
#if defined(USE_TCGEN)
attribute vec4 attr_TexCoord1;
#endif
@ -57,9 +57,6 @@ uniform float u_VertexLerp;
#endif
varying vec2 var_DiffuseTex;
#if defined(USE_LIGHTMAP)
varying vec2 var_LightTex;
#endif
varying vec4 var_Color;
#if defined(USE_DEFORM_VERTEXES)
@ -193,7 +190,7 @@ float CalcFog(vec3 position)
float t = dot(vec4(position, 1.0), u_FogDepth);
float eyeOutside = float(u_FogEyeT < 0.0);
float fogged = float(t < eyeOutside);
float fogged = float(t >= eyeOutside);
t += 1e-6;
t *= fogged / (t - u_FogEyeT * eyeOutside);
@ -207,10 +204,9 @@ void main()
#if defined(USE_VERTEX_ANIMATION)
vec3 position = mix(attr_Position, attr_Position2, u_VertexLerp);
vec3 normal = mix(attr_Normal, attr_Normal2, u_VertexLerp);
normal = normalize(normal - vec3(0.5));
#else
vec3 position = attr_Position;
vec3 normal = attr_Normal * 2.0 - vec3(1.0);
vec3 normal = attr_Normal;
#endif
#if defined(USE_DEFORM_VERTEXES)
@ -231,10 +227,6 @@ void main()
var_DiffuseTex = tex;
#endif
#if defined(USE_LIGHTMAP)
var_LightTex = attr_TexCoord1.st;
#endif
#if defined(USE_RGBAGEN)
var_Color = CalcColor(position, normal);
#else

View file

@ -100,6 +100,12 @@ float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
// best match found (starts with last position 1.0)
float bestDepth = 1.0;
// texture depth at best depth
float texDepth = 0.0;
float prevT = SampleDepth(normalMap, dp);
float prevTexDepth = prevT;
// search front to back for first point inside object
for(int i = 0; i < linearSearchSteps - 1; ++i)
{
@ -109,11 +115,20 @@ float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
if(bestDepth > 0.996) // if no depth found yet
if(depth >= t)
{
bestDepth = depth; // store best depth
texDepth = t;
prevTexDepth = prevT;
}
prevT = t;
}
depth = bestDepth;
#if !defined (USE_RELIEFMAP)
float div = 1.0 / (1.0 + (prevTexDepth - texDepth) * float(linearSearchSteps));
bestDepth -= (depth - size - prevTexDepth) * div;
#else
// recurse around first point (depth) for closest match
for(int i = 0; i < binarySearchSteps; ++i)
{
@ -129,6 +144,7 @@ float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
depth += size;
}
#endif
return bestDepth;
}
@ -164,7 +180,7 @@ vec3 EnvironmentBRDF(float gloss, float NE, vec3 specular)
{
#if 1
// from http://blog.selfshadow.com/publications/s2013-shading-course/lazarov/s2013_pbs_black_ops_2_notes.pdf
vec4 t = vec4( 1/0.96, 0.475, (0.0275 - 0.25 * 0.04)/0.96,0.25 ) * gloss;
vec4 t = vec4( 1.0/0.96, 0.475, (0.0275 - 0.25 * 0.04)/0.96,0.25 ) * gloss;
t += vec4( 0.0, 0.0, (0.015 - 0.75 * 0.04)/0.96,0.75 );
float a0 = t.x * min( t.y, exp2( -9.28 * NE ) ) + t.z;
float a1 = t.w;
@ -357,7 +373,7 @@ void main()
vec2 texCoords = var_TexCoords.xy;
#if defined(USE_PARALLAXMAP)
vec3 offsetDir = normalize(E * tangentToWorld);
vec3 offsetDir = viewDir * tangentToWorld;
offsetDir.xy *= -u_NormalScale.a / offsetDir.z;

View file

@ -167,11 +167,6 @@ void main()
#endif
#endif
normal = normal * 2.0 - vec3(1.0);
#if defined(USE_VERT_TANGENT_SPACE) && defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
tangent = tangent * 2.0 - vec3(1.0);
#endif
#if defined(USE_TCGEN)
vec2 texCoords = GenTexCoords(u_TCGen0, position, normal, u_TCGen0Vector0, u_TCGen0Vector1);
#else
@ -195,13 +190,13 @@ void main()
#endif
#if defined(USE_VERT_TANGENT_SPACE) && defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
vec3 bitangent = cross(normal, tangent) * (attr_Tangent.w * 2.0 - 1.0);
vec3 bitangent = cross(normal, tangent) * attr_Tangent.w;
#endif
#if defined(USE_LIGHT_VECTOR)
vec3 L = u_LightOrigin.xyz - (position * u_LightOrigin.w);
#elif defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
vec3 L = attr_LightDirection * 2.0 - vec3(1.0);
vec3 L = attr_LightDirection;
#if defined(USE_MODELMATRIX)
L = (u_ModelMatrix * vec4(L, 0.0)).xyz;
#endif

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