FTE_TARGET=msvc now invokes some old version of msvc via wine, old FTE_TARGET=vc removed. Related code tweaks to make it a bit happier.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6001 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
1c5b264402
commit
221d4032af
36 changed files with 413 additions and 274 deletions
217
engine/Makefile
217
engine/Makefile
|
@ -6,6 +6,8 @@
|
|||
#only the following 3 are supported
|
||||
#linux->win32 (FTE_TARGET=win32) RPM Package: "mingw32-gcc", DEB Package: "mingw32"
|
||||
#linux->win64 (FTE_TARGET=win64) RPM Package: "mingw32-gcc", DEB Package: "mingw32"
|
||||
#linux->win32 (FTE_TARGET=msvc32 MSVCPATH=? WINDOWSSDKDIR=?) invokes via wine.
|
||||
#linux->win64 (FTE_TARGET=msvc64 MSVCPATH=? WINDOWSSDKDIR=?) invokes via wine.
|
||||
#linux->linux 32 (FTE_TARGET=linux32)
|
||||
#linux->linux 64 (FTE_TARGET=linux64)
|
||||
#linux->linux x32 (FTE_TARGET=linux_x32)
|
||||
|
@ -36,6 +38,8 @@ COMPILE_SYS:=$(shell uname -o 2>&1)
|
|||
#canonicalize the source path. except emscripten warns about that like crazy. *sigh*
|
||||
ifeq ($(FTE_TARGET),web)
|
||||
BASE_DIR:=.
|
||||
else ifeq ($(findstring msvc,$(FTE_TARGET)),msvc)
|
||||
BASE_DIR:=.
|
||||
else ifeq ($(FTE_TARGET),droid)
|
||||
#android tools suck, but plugins need to find the engine directory.
|
||||
BASE_DIR:=../engine
|
||||
|
@ -110,7 +114,7 @@ ifneq (,$(BRANDING))
|
|||
-include game_$(BRANDING).mak
|
||||
endif
|
||||
FTE_CONFIG?=fteqw
|
||||
ifneq ($(FTE_TARGET),vc)
|
||||
ifneq ($(findstring msvc,$(FTE_TARGET)),msvc)
|
||||
ifeq (,$(FTE_CONFIG_EXTRA))
|
||||
export FTE_CONFIG_EXTRA := $(shell $(CC) -xc -E -P -DFTE_TARGET_$(FTE_TARGET) -DCOMPILE_OPTS common/config_$(FTE_CONFIG).h)
|
||||
endif
|
||||
|
@ -574,7 +578,7 @@ DO_ECHO=@
|
|||
DO_CC=$(DO_ECHO) $(CC) $(LTO_CC) $(ALL_CFLAGS) -o $@ -c $<
|
||||
DO_CXX=$(DO_ECHO) $(CXX) $(LTO_CC) $(ALL_CXXFLAGS) -o $@ -c $<
|
||||
|
||||
ifeq ($(FTE_TARGET),vc)
|
||||
ifeq ($(findstring msvc,$(FTE_TARGET)),msvc)
|
||||
BASELDFLAGS=
|
||||
endif
|
||||
ifeq ($(FTE_TARGET),cyg)
|
||||
|
@ -620,11 +624,11 @@ VISIBILITY_FLAGS?=
|
|||
XLDFLAGS=-L$(ARCHLIBS) $(IMAGELDFLAGS)
|
||||
|
||||
#hack some other arguments based upon the toolchain
|
||||
ifeq ($(FTE_TARGET),vc)
|
||||
WARNINGFLAGS=-W3 -D_CRT_SECURE_NO_WARNINGS
|
||||
ifeq ($(findstring msvc,$(FTE_TARGET)),msvc)
|
||||
WARNINGFLAGS?=-W3 -D_CRT_SECURE_NO_WARNINGS
|
||||
GNUC_FUNCS=
|
||||
else
|
||||
WARNINGFLAGS=-Wall -Wno-pointer-sign -Wno-unknown-pragmas -Wno-format-zero-length -Wno-strict-aliasing #-Wcast-align
|
||||
WARNINGFLAGS?=-Wall -Wno-pointer-sign -Wno-unknown-pragmas -Wno-format-zero-length -Wno-strict-aliasing #-Wcast-align
|
||||
# GNUC_FUNCS= -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp
|
||||
endif
|
||||
|
||||
|
@ -643,9 +647,15 @@ RELEASE_CFLAGS?=$(CPUOPTIMIZATIONS)
|
|||
#however, its use resulted in the player getting stuck etc, so be warned if you try re-enabling it.
|
||||
#
|
||||
|
||||
ifeq ($(FTE_TARGET),vc)
|
||||
ifeq ($(findstring msvc,$(FTE_TARGET)),msvc)
|
||||
#msvc doesn't do -dumpmachine.
|
||||
#we might as well get it to reuse the mingw libraries, if only because that makes those libraries easier to compile...
|
||||
ifeq ($(FTE_TARGET),msvc32)
|
||||
BITS?=32
|
||||
else ifeq ($(FTE_TARGET),msvc64)
|
||||
BITS?=64
|
||||
endif
|
||||
BITS?=32
|
||||
ifeq ($(BITS),64)
|
||||
ARCH?=x86_64-w64-mingw32
|
||||
else
|
||||
|
@ -1245,78 +1255,99 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
|
|||
endif
|
||||
|
||||
#FTE_TARGET=vc (Visual C)
|
||||
ifeq ($(FTE_TARGET),vc)
|
||||
DEBUG_CFLAGS=
|
||||
MSVCDIR=Microsoft Visual Studio 10.0
|
||||
|
||||
ifeq ($(WINRT),1)
|
||||
WINDOWSSDKDIR=C:/Program Files (x86)/Windows Kits/8.1
|
||||
|
||||
ifeq ($(BITS),64)
|
||||
WINDRES=x86_64-w64-mingw32-windres
|
||||
MSVCPATH=C:/Program Files (x86)/$(MSVCDIR)/VC/BIN/amd64/
|
||||
|
||||
|
||||
else
|
||||
WINDRES=i686-w64-mingw32-windres
|
||||
MSVCPATH=C:/Program Files (x86)/$(MSVCDIR)/VC/BIN/
|
||||
|
||||
SDKINC=-I"$(WINDOWSSDKDIR)\Include\shared" -I"$(WINDOWSSDKDIR)\Include\um"
|
||||
MSVCINC=-I"C:\Program Files (x86)\$(MSVCDIR)\VC\INCLUDE"
|
||||
#-I"C:\Program Files (x86)\$(MSVCDIR)\VC\ATLMFC\INCLUDE"
|
||||
# -I"C:\Program Files (x86)\$(MSVCDIR)\VC\PlatformSDK\include" -I"C:\Program Files (x86)\$(MSVCDIR)\SDK\v2.0\include"
|
||||
|
||||
MSVCLIB=/LIBPATH:"C:\Program Files (x86)\$(MSVCDIR)\VC\ATLMFC\LIB" /LIBPATH:"C:\Program Files (x86)\$(MSVCDIR)\VC\LIB" /LIBPATH:"$(WINDOWSSDKDIR)/lib/winv6.3/um/x86" /LIBPATH:"C:\Program Files (x86)\$(MSVCDIR)\SDK\v2.0\LIB"
|
||||
JPEGLIB=libs/jpeg.lib
|
||||
endif
|
||||
ifeq ($(findstring msvc,$(FTE_TARGET)),msvc)
|
||||
#assumptions...
|
||||
ifneq ($(shell uname -o 2>&1 | grep Cygwin),)
|
||||
#we're on cygwin
|
||||
MSVCPATH?=C:/Program Files (x86)/Microsoft Visual Studio 8/VC/
|
||||
WINDOWSSDKDIR?=C:/Program Files/Microsoft SDKs/Windows/v7.1/
|
||||
FIXPATH=`cygpath -m "$(1)"`
|
||||
INVOKE="$(1)"
|
||||
else
|
||||
WINDOWSSDKDIR=C:/Program Files/Microsoft SDKs/Windows/v7.1
|
||||
|
||||
ifeq ($(BITS),64)
|
||||
WINDRES=x86_64-w64-mingw32-windres
|
||||
|
||||
MSVCPATH=C:/Program Files (x86)/$(MSVCDIR)/VC/BIN/amd64/
|
||||
|
||||
MSVCINC=-I"C:\Program Files (x86)\$(MSVCDIR)\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\$(MSVCDIR)\VC\INCLUDE" -I"$(WINDOWSSDKDIR)/Include" -I"C:\Program Files (x86)\$(MSVCDIR)\VC\PlatformSDK\include" -I"C:\Program Files (x86)\$(MSVCDIR)\SDK\v2.0\include"
|
||||
MSVCLIB=/LIBPATH:"C:\Program Files (x86)\$(MSVCPATH)\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\$(MSVCDIR)\VC\LIB\amd64" /LIBPATH:"$(WINDOWSSDKDIR)\lib\amd64" /LIBPATH:"C:\Program Files (x86)\$(MSVCDIR)\SDK\v2.0\LIB\AMD64" /LIBPATH:"$(WINDOWSSDKDIR)\lib\x64"
|
||||
JPEGLIB=libs/libjpeg$(BITS).lib
|
||||
else
|
||||
WINDRES=i686-w64-mingw32-windres
|
||||
MSVCPATH=C:/Program Files (x86)/$(MSVCDIR)/VC/BIN/
|
||||
|
||||
MSVCINC=-I"C:\Program Files (x86)\$(MSVCDIR)\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\$(MSVCDIR)\VC\INCLUDE" -I"$(WINDOWSSDKDIR)/Include" -I"C:\Program Files (x86)\$(MSVCDIR)\VC\PlatformSDK\include" -I"C:\Program Files (x86)\$(MSVCDIR)\SDK\v2.0\include"
|
||||
MSVCLIB=/LIBPATH:"C:\Program Files (x86)\$(MSVCDIR)\VC\ATLMFC\LIB" /LIBPATH:"C:\Program Files (x86)\$(MSVCDIR)\VC\LIB" /LIBPATH:"$(WINDOWSSDKDIR)\lib" /LIBPATH:"C:\Program Files (x86)\$(MSVCDIR)\SDK\v2.0\LIB"
|
||||
JPEGLIB=libs/jpeg.lib
|
||||
endif
|
||||
#we're PROBABLY on linux (invoke it via wine)
|
||||
#MSVCPATH=/mnt/win/Program Files (x86)/Microsoft Visual Studio 10.0/VC/
|
||||
MSVCPATH?=/mnt/win/Program Files (x86)/Microsoft Visual Studio 8/VC/
|
||||
WINDOWSSDKDIR?=/mnt/win/Program Files/Microsoft SDKs/Windows/v7.1/
|
||||
#functions to handle wine (or cygwin)
|
||||
FIXPATH=`winepath -w "$(1)"`
|
||||
INVOKE=WINEDEBUG=-all WINEPATH="$(WINEPATH)" wine "$(1)"
|
||||
endif
|
||||
|
||||
#our msvc library naming still assumes 32bit and thus no postfix for that target (microsoft usually reuse '32' for 64bit libraries too...).
|
||||
ifeq ($(BITS),32)
|
||||
LIBBITS=
|
||||
else
|
||||
LIBBITS=$(BITS)
|
||||
endif
|
||||
|
||||
#evil lameness.
|
||||
LIBS_DIR=./libs/
|
||||
|
||||
ifeq ($(BITS),64)
|
||||
MSVC_ARCH=amd64/
|
||||
WINSDK_ARCH=x64/
|
||||
WINEPATH=
|
||||
else
|
||||
MSVC_ARCH=
|
||||
WINSDK_ARCH=
|
||||
WINEPATH=$(MSVCPATH)../Common7/IDE/
|
||||
endif
|
||||
|
||||
LIBOPUS_STATIC=
|
||||
|
||||
#-I"$(MSVCPATH)/ATLMFC/INCLUDE"
|
||||
MSVCINC+=-I"$(shell winepath -w "$(MSVCPATH)INCLUDE")"
|
||||
MSVCINC+=-I"$(shell winepath -w "$(WINDOWSSDKDIR)/Include")"
|
||||
#-I"$(MSVCPATH)PlatformSDK/include"
|
||||
#-I"$(MSVCPATH)../SDK/v2.0/include"
|
||||
|
||||
MSVCLIB+=/libpath:"$(call FIXPATH,$(MSVCPATH)lib/$(MSVC_ARCH))"
|
||||
MSVCLIB+=/libpath:"$(call FIXPATH,$(WINDOWSSDKDIR)Lib/$(WINSDK_ARCH))"
|
||||
MSVCLIB+=/libpath:"$(call FIXPATH,$(LIBS_DIR))"
|
||||
|
||||
ARCHLIBS:=$(call FIXPATH,$(ARCHLIBS))
|
||||
|
||||
MSVCINC:=$(MSVCINC)
|
||||
DO_WINDRES=$(DO_ECHO) $(WINDRES) /nologo $(BRANDFLAGS) $(MSVCINC) -I$(call FIXPATH,$(CLIENT_DIR)) -fo $(call FIXPATH,$@) $(call FIXPATH,$<)
|
||||
WINDRES=$(call INVOKE,$(WINDOWSSDKDIR)Bin/$(WINSDK_ARCH)RC.exe)
|
||||
LINK:=$(call INVOKE,$(MSVCPATH)/bin/$(MSVC_ARCH)link.exe)
|
||||
CC:=$(call INVOKE,$(MSVCPATH)/bin/$(MSVC_ARCH)cl.exe) $(MSVCINC) -DMSVCLIBSPATH=libs/
|
||||
CXX=$(CC)
|
||||
|
||||
#library stuff... we'll be breaking attempts to statically link because deps are too painful otherwise.
|
||||
BASELDFLAGS=
|
||||
CLIENTLIBFLAGS=
|
||||
SERVERLIBFLAGS=
|
||||
CLIENTLDDEPS=
|
||||
SERVERLDDEPS=
|
||||
|
||||
#override various flags that expected gcc.
|
||||
DEBUG_CFLAGS = -Od $(CPUOPTIMIZATIONS) /fp:fast
|
||||
RELEASE_CFLAGS = -O2 -Gy -GS- $(CPUOPTIMIZATIONS) /fp:fast
|
||||
RELEASE_LDFLAGS = /LTCG
|
||||
|
||||
#we need some command tweaks.
|
||||
DO_CC=$(DO_ECHO) $(CC) /nologo $(ALL_CFLAGS) -Fo"$(call FIXPATH,$@)" -c "$(call FIXPATH,$<)"
|
||||
DO_CXX=$(DO_ECHO) $(CXX) /nologo $(ALL_CFLAGS) -Fo"$(call FIXPATH,$@)" -c "$(call FIXPATH,$<)"
|
||||
DO_LD=$(DO_ECHO) PATH="$(MSVCPATH)/Common7/IDE:$(PATH)" $(LINK) /nologo /out:"$(call FIXPATH,$@)" /nodefaultlib:libc.lib /LARGEADDRESSAWARE /nodefaultlib:MSVCRT $(MSVCLIB) $(SDKLIB) /manifest:no /OPT:REF wsock32.lib user32.lib kernel32.lib advapi32.lib winmm.lib libs/zlib$(LIBBITS).lib shell32.lib
|
||||
STRIP=@echo SKIP: strip
|
||||
EXEPOSTFIX=.exe
|
||||
|
||||
CC=PATH="C:\Program Files (x86)\$(MSVCDIR)\Common7\IDE" "$(MSVCPATH)cl" $(SDKINC) $(MSVCINC) -D_CRT_SECURE_NO_WARNINGS
|
||||
CXX=PATH="C:\Program Files (x86)\$(MSVCDIR)\Common7\IDE" "$(MSVCPATH)cl" $(SDKINC) $(MSVCINC) -D_CRT_SECURE_NO_WARNINGS
|
||||
DEBUG_CFLAGS ?= -Od $(CPUOPTIMIZATIONS) /fp:fast
|
||||
PROFILE_CFLAGS = -O2 -Ot -Ox -GL $(CPUOPTIMISATIONS) /fp:fast
|
||||
PROFILE_LDFLAGS = /LTCG:PGINSTRUMENT
|
||||
RELEASE_CFLAGS = -O2 -Ot -Ox -GL -GS- -Gr $(CPUOPTIMIZATIONS) /fp:fast
|
||||
RELEASE_LDFLAGS = /LTCG
|
||||
# /LTCG:PGOPTIMIZE
|
||||
#gotta work around a whole load of paths.
|
||||
BASE_CFLAGS:=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(call FIXPATH,$(CLIENT_DIR)) -I$(call FIXPATH,$(SERVER_DIR)) -I$(call FIXPATH,$(COMMON_DIR)) -I$(call FIXPATH,$(GL_DIR)) -I$(call FIXPATH,$(D3D_DIR)) -I$(call FIXPATH,$(PROGS_DIR)) -I. -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/dxsdk7/include $(SDL_INCLUDES) $(BOTLIB_CFLAGS) $(SVNREVISION)
|
||||
|
||||
DO_CC=$(DO_ECHO) $(CC) /nologo $(ALL_CFLAGS) -Fo$(shell cygpath -m $@) -c $(shell cygpath -m $<)
|
||||
DO_CXX=$(DO_ECHO) $(CXX) /nologo $(ALL_CFLAGS) -Fo$(shell cygpath -m $@) -c $(shell cygpath -m $<)
|
||||
DO_LD=$(DO_ECHO) PATH="C:\Program Files (x86)\$(MSVCDIR)\Common7\IDE" "$(MSVCPATH)link" /nologo /out:"$(shell cygpath -m $@)" /nodefaultlib:libc.lib /LARGEADDRESSAWARE /nodefaultlib:MSVCRT $(MSVCLIB) $(SDKLIB) /manifest:no /OPT:REF wsock32.lib user32.lib kernel32.lib advapi32.lib winmm.lib libs/zlib$(BITS).lib shell32.lib
|
||||
PRECOMPHEADERS =
|
||||
|
||||
#this stuff isn't supported.
|
||||
PRECOMPHEADERS=
|
||||
DEPCC=
|
||||
DEPCXX=
|
||||
|
||||
LIBS_DIR=./libs/
|
||||
|
||||
BASE_CFLAGS:=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(shell cygpath -m $(CLIENT_DIR)) -I$(shell cygpath -m $(SERVER_DIR)) -I$(shell cygpath -m $(COMMON_DIR)) -I$(shell cygpath -m $(GL_DIR)) -I$(shell cygpath -m $(D3D_DIR)) -I$(shell cygpath -m $(PROGS_DIR)) -I. -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/dxsdk7/include $(SDL_INCLUDES) $(BOTLIB_CFLAGS) $(SVNREVISION)
|
||||
|
||||
#dedicated server stuff
|
||||
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) $(W32_CFLAGS) -DMULTITHREAD -DMSVCLIBPATH=libs/
|
||||
SV_EXE_NAME=../$(EXE_NAME)-sv$(BITS)$(EXEPOSTFIX)
|
||||
SV_DIR=sv_vc$(BITS)
|
||||
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(BOTLIB_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) fs_win32.o resources.o
|
||||
SV_LDFLAGS=/subsystem:console
|
||||
SV_LDFLAGS=ole32.lib /subsystem:console
|
||||
|
||||
GL_EXE_NAME=../$(EXE_NAME)-gl$(BITS)$(EXEPOSTFIX)
|
||||
GLCL_EXE_NAME=../$(EXE_NAME)-mingl$(BITS)
|
||||
|
@ -1330,6 +1361,14 @@ ifeq ($(FTE_TARGET),vc)
|
|||
MINGL_DIR=mingl_vc$(BITS)
|
||||
MINGL_EXE_NAME=../$(EXE_NAME)-mingl$(BITS)$(EXEPOSTFIX)
|
||||
|
||||
VKCL_OBJS=$(VKQUAKE_OBJS) $(D3DGL_OBJS) $(BOTLIB_OBJS) gl_bloom.o gl_vidnt.o $(WINDOWS_OBJS)
|
||||
VK_EXE_NAME=../$(EXE_NAME)-vk$(BITS)$(EXEPOSTFIX)
|
||||
VKCL_EXE_NAME=../$(EXE_NAME)-vkcl$(BITS)$(EXEPOSTFIX)
|
||||
VK_CFLAGS=$(VKCFLAGS) $(CLIENTLIBFLAGS) $(DX7SDK) -DMULTITHREAD -DMSVCLIBPATH=libs/
|
||||
VK_LDFLAGS=$(JPEGLIB) libs/libpng$(BITS).lib uuid.lib gdi32.lib ole32.lib /subsystem:windows
|
||||
VKB_DIR=vk_vc$(BITS)
|
||||
VKCL_DIR=vkcl_vc$(BITS)
|
||||
|
||||
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(D3DGL_OBJS) $(BOTLIB_OBJS) $(WINDOWS_OBJS)
|
||||
D3D_EXE_NAME=../$(EXE_NAME)-d3d$(BITS)$(EXEPOSTFIX)
|
||||
D3DCL_EXE_NAME=../$(EXE_NAME)-d3dcl$(BITS)$(EXEPOSTFIX)
|
||||
|
@ -1337,12 +1376,15 @@ ifeq ($(FTE_TARGET),vc)
|
|||
D3D_CFLAGS=$(D3DCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD -DMSVCLIBPATH=libs/
|
||||
D3DB_DIR=d3d_vc$(BITS)
|
||||
D3DCL_DIR=d3dcl_vc$(BITS)
|
||||
|
||||
|
||||
#merged client stuff
|
||||
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidnt.o gl_videgl.o $(WINDOWS_OBJS)
|
||||
M_EXE_NAME=../$(EXE_NAME)$(BITS)$(EXEPOSTFIX)
|
||||
MCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(D3DQUAKE_OBJS) $(GLQUAKE_OBJS) gl_vidnt.o $(BOTLIB_OBJS) $(WINDOWS_OBJS)
|
||||
M_CFLAGS=$(D3DCFLAGS) $(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) -DMULTITHREAD -DMSVCLIBPATH=libs/
|
||||
MCL_EXE_NAME=../$(EXE_NAME)cl$(BITS)$(EXEPOSTFIX)
|
||||
M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) $(DX7SDK) $(VKCFLAGS) -DMULTITHREAD $(CLIENTLIBFLAGS)
|
||||
MB_DIR=m_vc$(BITS)
|
||||
M_LDFLAGS=$(GLLDFLAGS) $(JPEGLIB) libs/libpng$(BITS).lib uuid.lib gdi32.lib ole32.lib /subsystem:windows
|
||||
MCL_DIR=mcl_vc$(BITS)
|
||||
M_LDFLAGS=$(GLLDFLAGS) $(JPEGLIB) libs/libpng$(LIBBITS).lib uuid.lib gdi32.lib ole32.lib /subsystem:windows
|
||||
endif
|
||||
|
||||
#FTE_TARGET=win32 | FTE_TARGET=win64 (MinGW32 | MinGW64)
|
||||
|
@ -1787,7 +1829,11 @@ SV_DIR?=sv_sdl
|
|||
DEPCC?=$(CC)
|
||||
DEPCXX?=$(CXX)
|
||||
ARCH:=$(ARCH)
|
||||
BASELDFLAGS:=-L$(ARCHLIBS) $(BASELDFLAGS)
|
||||
ifeq ($(findstring msvc,$(FTE_TARGET)),msvc)
|
||||
BASELDFLAGS:=/libpath:"$(ARCHLIBS)" $(BASELDFLAGS)
|
||||
else
|
||||
BASELDFLAGS:=-L$(ARCHLIBS) $(BASELDFLAGS)
|
||||
endif
|
||||
|
||||
default: help
|
||||
-include Makefile_private
|
||||
|
@ -1829,14 +1875,16 @@ endif
|
|||
|
||||
VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(SW_DIR) : $(COMMON_DIR) : $(SERVER_DIR) : $(HTTP_DIR) : $(BASE_DIR)/irc : $(BASE_DIR)/email : $(QUX_DIR) : $(PROGS_DIR) : $(NACL_DIR) : $(D3D_DIR) : $(VK_DIR) : $(BOTLIB_DIR) : $(BASE_DIR)/web
|
||||
|
||||
DO_WINDRES?=$(DO_ECHO) $(WINDRES) $(BRANDFLAGS) -I$(CLIENT_DIR) -O coff $< $@
|
||||
|
||||
# This is for linking the FTE icon to the MinGW target
|
||||
$(OUT_DIR)/resources.o : winquake.rc
|
||||
@$(WINDRES) $(BRANDFLAGS) -I$(CLIENT_DIR) -O coff $< $@
|
||||
$(DO_WINDRES)
|
||||
$(OUT_DIR)/fteqcc.o : fteqcc.rc
|
||||
@$(WINDRES) $(BRANDFLAGS) -I$(PROGS_DIR) -O coff $< $@
|
||||
$(DO_WINDRES)
|
||||
#npAPI stuff requires some extra resources
|
||||
$(OUT_DIR)/npplug.o : ftequake/npplug.rc
|
||||
@$(WINDRES) $(BRANDFLAGS) -I$(CLIENT_DIR) -O coff $< $@
|
||||
$(DO_WINDRES)
|
||||
|
||||
|
||||
#$(OUT_DIR)/%.d: %.c
|
||||
|
@ -2203,8 +2251,12 @@ nacl-dbg:
|
|||
#################################################
|
||||
#webgl helpers
|
||||
|
||||
ifneq ($(shell which emcc 2> /dev/null),)
|
||||
EMCC?=emcc
|
||||
else
|
||||
#EMCC?=/opt/emsdk_portable/emscripten/master/emcc
|
||||
EMCC?=emcc.bat --em-config $(shell cygpath -m $(USERPROFILE))/.emscripten
|
||||
endif
|
||||
ifeq ($(EMSDK),)
|
||||
#just adds some extra paths (WINDOWS HOST ONLY)
|
||||
#assumes you installed the emscripten 1.22.0 sdk to EMSCRIPTENROOT
|
||||
|
@ -2263,32 +2315,25 @@ else
|
|||
endif
|
||||
|
||||
droid-rel:
|
||||
$(MAKE) FTE_TARGET=droid droid/build.xml droid/ftekeystore
|
||||
$(foreach a, $(DROID_ARCH), $(MAKE) FTE_TARGET=droid m-rel plugins-rel DROID_ARCH=$a NATIVE_PLUGINS="$(NATIVE_PLUGINS)"; )
|
||||
-rm -rf droid/libs
|
||||
@$(MAKE) FTE_TARGET=droid droid/build.xml droid/ftekeystore
|
||||
@$(foreach a, $(DROID_ARCH), $(MAKE) FTE_TARGET=droid m-rel plugins-rel DROID_ARCH=$a NATIVE_PLUGINS="$(NATIVE_PLUGINS)"; )
|
||||
@-rm -rf droid/libs
|
||||
@$(foreach a, $(DROID_ARCH), mkdir -p droid/libs/$a; )
|
||||
-@$(foreach a, $(DROID_ARCH), cp $(RELEASE_DIR)/m_droid-$a/*.so droid/libs/$a/; )
|
||||
|
||||
@cd droid && $(ANT) release
|
||||
@cd droid && $(ANT) -q release
|
||||
ifneq ($(DROID_PACKSU),)
|
||||
@echo
|
||||
@echo Adding custom data files - non-compressed
|
||||
@echo
|
||||
zip droid/bin/FTEDroid-release-unsigned.apk -0 -j $(DROID_PACKSU)
|
||||
endif
|
||||
ifneq ($(DROID_PACKSC),)
|
||||
@echo
|
||||
@echo Adding custom data files - compressed
|
||||
@echo
|
||||
zip droid/bin/FTEDroid-release-unsigned.apk -9 -j $(DROID_PACKSC)
|
||||
endif
|
||||
@echo
|
||||
@echo
|
||||
@echo Signing package... I hope you remember your password.
|
||||
@echo
|
||||
@$(JAVATOOL)jarsigner $(JARSIGNARGS) -digestalg SHA1 -sigalg MD5withRSA -keystore droid/ftekeystore droid/bin/FTEDroid-release-unsigned.apk autogen
|
||||
-rm -f $(RELEASE_DIR)/FTEDroid.apk
|
||||
$(ANDROID_ZIPALIGN) 4 droid/bin/FTEDroid-release-unsigned.apk $(NATIVE_RELEASE_DIR)/FTEDroid.apk
|
||||
@-rm -f $(RELEASE_DIR)/FTEDroid.apk
|
||||
@$(ANDROID_ZIPALIGN) 4 droid/bin/FTEDroid-release-unsigned.apk $(NATIVE_RELEASE_DIR)/FTEDroid.apk
|
||||
|
||||
droid-opt:
|
||||
$(MAKE) FTE_TARGET=droid droid/build.xml droid/ftekeystore
|
||||
|
|
|
@ -1053,6 +1053,9 @@ int AAS_Reachability_EqualFloorHeight(int area1num, int area2num)
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize("", off) //work around msvc ICE
|
||||
#endif
|
||||
int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2num)
|
||||
{
|
||||
int i, j, k, l, edge1num, edge2num, areas[10], numareas;
|
||||
|
@ -1595,6 +1598,9 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
|
|||
} //end if
|
||||
return qfalse;
|
||||
} //end of the function AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize("", on) //work around msvc ICE
|
||||
#endif
|
||||
//===========================================================================
|
||||
// returns the distance between the two vectors
|
||||
//
|
||||
|
|
|
@ -913,7 +913,6 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
{
|
||||
static int overstrikemode;
|
||||
int ret=0;
|
||||
char adrbuf[MAX_ADR_SIZE];
|
||||
|
||||
//Remember to range check pointers.
|
||||
//The QVM must not be allowed to write to anything outside it's memory.
|
||||
|
@ -1454,6 +1453,7 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
{
|
||||
char *buf = VM_POINTER(arg[2]);
|
||||
char *adr;
|
||||
char adrbuf[MAX_ADR_SIZE];
|
||||
serverinfo_t *info = Master_InfoForNum(VM_LONG(arg[1]));
|
||||
if (info)
|
||||
{
|
||||
|
|
|
@ -3143,7 +3143,7 @@ void Con_DrawConsole (int lines, qboolean noback)
|
|||
for (i = 0; i < countof(buttons); i++)
|
||||
{
|
||||
if (i == countof(buttons)-1)
|
||||
tw = ~0u;
|
||||
tw = FLT_MAX;
|
||||
else if (i == countof(buttons)-2)
|
||||
{
|
||||
tw = 8+8;
|
||||
|
|
|
@ -1331,6 +1331,7 @@ qboolean WriteTGA(const char *filename, enum fs_relative fsroot, const qbyte *ft
|
|||
#define png_const_bytep png_bytep
|
||||
#define png_const_unknown_chunkp png_unknown_chunkp
|
||||
#define png_const_textp png_textp
|
||||
#define png_const_colorp png_colorp
|
||||
#endif
|
||||
#if PNG_LIBPNG_VER < 10600
|
||||
#define png_inforp png_infop
|
||||
|
@ -8838,9 +8839,11 @@ static void Image_Tr_PalettedtoRGBX8(struct pendingtextureinfo *mips, int alphap
|
|||
}
|
||||
|
||||
//may operate in place
|
||||
static void Image_Tr_RGBX8toPaletted(struct pendingtextureinfo *mips, int dummy)
|
||||
static void Image_Tr_RGBX8toPaletted(struct pendingtextureinfo *mips, int args)
|
||||
{
|
||||
unsigned int mip;
|
||||
int first=args&0xffff;
|
||||
int stop=(args>>16)&0xffff;
|
||||
for (mip = 0; mip < mips->mipcount; mip++)
|
||||
{
|
||||
qbyte *in = mips->mip[mip].data;
|
||||
|
@ -8855,7 +8858,7 @@ static void Image_Tr_RGBX8toPaletted(struct pendingtextureinfo *mips, int dummy)
|
|||
mips->mip[mip].datasize = p*sizeof(*out);
|
||||
|
||||
for(; p-->0; in += 4)
|
||||
*out++ = GetPaletteIndexNoFB(in[0], in[1], in[2]);
|
||||
*out++ = GetPaletteIndexRange(first, stop, in[0], in[1], in[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12221,7 +12224,9 @@ static struct
|
|||
{PTI_RGBA32F, PTI_RGB32F, Image_Tr_DropBytes, (16<<16)|12, true},
|
||||
|
||||
{PTI_RG8, PTI_RGBX8, Image_Tr_RG8ToRGXX8},
|
||||
{PTI_RGBX8, PTI_P8, Image_Tr_RGBX8toPaletted},
|
||||
{PTI_RGBX8, PTI_P8, Image_Tr_RGBX8toPaletted, 0},
|
||||
{PTI_RGBX8, TF_H2_TRANS8_0, Image_Tr_RGBX8toPaletted, 1|(255<<16)},
|
||||
{PTI_RGBX8, TF_TRANS8, Image_Tr_RGBX8toPaletted, 0|(254<<16)},
|
||||
{PTI_P8, PTI_RGBX8, Image_Tr_PalettedtoRGBX8, -1},
|
||||
{TF_SOLID8, PTI_RGBX8, Image_Tr_PalettedtoRGBX8, -1},
|
||||
{TF_H2_TRANS8_0,PTI_RGBA8, Image_Tr_PalettedtoRGBX8, 0},
|
||||
|
@ -12899,7 +12904,7 @@ static qboolean Image_GenMip0(struct pendingtextureinfo *mips, unsigned int flag
|
|||
|
||||
if (flags & IF_NOALPHA)
|
||||
{
|
||||
switch(mips->encoding)
|
||||
safeswitch(mips->encoding)
|
||||
{
|
||||
case PTI_RGBA8:
|
||||
mips->encoding = PTI_RGBX8;
|
||||
|
@ -13063,7 +13068,9 @@ static qboolean Image_GenMip0(struct pendingtextureinfo *mips, unsigned int flag
|
|||
case PTI_DEPTH24_8:
|
||||
break;
|
||||
case PTI_EMULATED:
|
||||
case PTI_MAX: break; //stfu
|
||||
case PTI_MAX:
|
||||
safedefault:
|
||||
break; //stfu
|
||||
}
|
||||
//FIXME: fill alpha channel with 255?
|
||||
}
|
||||
|
|
|
@ -261,23 +261,23 @@ extern "C" {
|
|||
#if (_MSC_VER >= 1900)
|
||||
// MSVC 14 has standardized snprintf functions, hurrah!
|
||||
#elif (_MSC_VER >= 1400)
|
||||
//with MSVC 8, use MS extensions. return values are still wrong.
|
||||
#define snprintf linuxlike_snprintf_vc8
|
||||
//with MSVC 8, use microsoft's vsnprintf_s. return values are still wrong though.
|
||||
#define snprintf (void)linuxlike_snprintf_vc8
|
||||
int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
||||
#define vsnprintf(a, b, c, d) vsnprintf_s(a, b, _TRUNCATE, c, d)
|
||||
#define vsnprintf(a, b, c, d) (void)(vsnprintf_s(a, b, _TRUNCATE, c, d))
|
||||
#else
|
||||
//msvc crap. return values are wrong but at least we can null terminate it safely.
|
||||
#define snprintf linuxlike_snprintf
|
||||
#define snprintf (void)linuxlike_snprintf
|
||||
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
||||
#define vsnprintf linuxlike_vsnprintf
|
||||
#define vsnprintf (void)linuxlike_vsnprintf
|
||||
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//these are provided so we don't use them
|
||||
//but mingw has some defines elsewhere and makes gcc moan
|
||||
#define _vsnprintf unsafe_vsnprintf
|
||||
#define _snprintf unsafe_snprintf
|
||||
// #define _vsnprintf unsafe_vsnprintf
|
||||
// #define _snprintf unsafe_snprintf
|
||||
|
||||
#ifndef strcasecmp
|
||||
#define strcasecmp _stricmp
|
||||
|
|
|
@ -2900,7 +2900,7 @@ void Surf_GenBrushBatches(batch_t **batches, entity_t *ent)
|
|||
if (!(cl_dlights[k].flags & LFLAG_LIGHTMAP))
|
||||
continue;
|
||||
|
||||
model->funcs.MarkLights (&cl_dlights[k], 1<<k, model->rootnode);
|
||||
model->funcs.MarkLights (&cl_dlights[k], (dlightbitmask_t)1<<k, model->rootnode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1173,7 +1173,7 @@ static void BIH_RecursiveTest (struct bihtrace_s *fte_restrict tr, const struct
|
|||
min = node->bihnode.cmin[1] - tr->expand[axis];
|
||||
max = node->bihnode.cmax[1] + tr->expand[axis];
|
||||
if (min <= tr->startpos[axis] && tr->startpos[axis] <= max)
|
||||
return BIH_RecursiveTest(tr, node+node->bihnode.firstchild+1);
|
||||
BIH_RecursiveTest(tr, node+node->bihnode.firstchild+1);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
@ -1199,7 +1199,7 @@ static void BIH_RecursiveTest (struct bihtrace_s *fte_restrict tr, const struct
|
|||
min = node->bvhnode.cmin - tr->expand[axis];
|
||||
max = node->bvhnode.max[axis] + tr->expand[axis];
|
||||
if (min <= tr->startpos[axis] && tr->startpos[axis] <= max)
|
||||
return CM_RecursiveBIHTest(tr, node+node->bvhnode.firstchild+1);
|
||||
CM_RecursiveBIHTest(tr, node+node->bvhnode.firstchild+1);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
@ -1467,6 +1467,7 @@ restart:
|
|||
#endif
|
||||
}
|
||||
FTE_UNREACHABLE;
|
||||
return 0;
|
||||
}
|
||||
static unsigned int BIH_PointContents(struct model_s *mod, const vec3_t axis[3], const vec3_t p)
|
||||
{
|
||||
|
|
|
@ -181,30 +181,54 @@ void QDECL Q_strncpyz(char *d, const char *s, int n)
|
|||
*d='\0';
|
||||
}
|
||||
|
||||
//windows/linux have inconsistant snprintf
|
||||
//this is an attempt to get them consistant and safe
|
||||
//size is the total size of the buffer
|
||||
void VARGS Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list argptr)
|
||||
//returns true on truncation
|
||||
qboolean VARGS Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list argptr)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if ((size_t)vsnprintf (dest, size, fmt, argptr) > size-1)
|
||||
Sys_Error("Q_vsnprintfz: truncation");
|
||||
size_t ret;
|
||||
#ifdef _WIN32
|
||||
//doesn't null terminate.
|
||||
//returns -1 on truncation
|
||||
ret = _vsnprintf (dest, size, fmt, argptr);
|
||||
dest[size-1] = 0; //shitty paranoia
|
||||
#else
|
||||
vsnprintf (dest, size, fmt, argptr);
|
||||
//always null terminates.
|
||||
//returns length regardless of truncation.
|
||||
ret = vsnprintf (dest, size, fmt, argptr);
|
||||
#endif
|
||||
dest[size-1] = 0;
|
||||
#ifdef _DEBUG
|
||||
if (ret>=size)
|
||||
Sys_Error("Q_vsnprintfz: Truncation\n");
|
||||
#endif
|
||||
//if ret is -1 (windows oversize, or general error) then it'll be treated as unsigned so really long. this makes the following check quite simple.
|
||||
return ret>=size;
|
||||
}
|
||||
|
||||
//windows/linux have inconsistant snprintf
|
||||
//this is an attempt to get them consistant and safe
|
||||
//size is the total size of the buffer
|
||||
void VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
|
||||
qboolean VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
size_t ret;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
Q_vsnprintfz(dest, size, fmt, argptr);
|
||||
#ifdef _WIN32
|
||||
//doesn't null terminate.
|
||||
//returns -1 on truncation
|
||||
ret = _vsnprintf (dest, size, fmt, argptr);
|
||||
dest[size-1] = 0; //shitty paranoia
|
||||
#else
|
||||
//always null terminates.
|
||||
//returns length regardless of truncation.
|
||||
ret = vsnprintf (dest, size, fmt, argptr);
|
||||
#endif
|
||||
va_end (argptr);
|
||||
#ifdef _DEBUG
|
||||
if (ret>=size)
|
||||
Sys_Error("Q_vsnprintfz: Truncation\n");
|
||||
#endif
|
||||
//if ret is -1 (windows oversize, or general error) then it'll be treated as unsigned so really long. this makes the following check quite simple.
|
||||
return ret>=size;
|
||||
}
|
||||
|
||||
|
||||
|
@ -420,16 +444,13 @@ char *Q_strcasestr(const char *haystack, const char *needle)
|
|||
return NULL; //didn't find it
|
||||
}
|
||||
|
||||
int VARGS Com_sprintf(char *buffer, int size, const char *format, ...)
|
||||
void VARGS Com_sprintf(char *buffer, int size, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, format);
|
||||
ret = vsnprintf (buffer, size, format, argptr);
|
||||
Q_vsnprintfz (buffer, size, format, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
void QDECL Com_Error( int level, const char *error, ... )
|
||||
{
|
||||
|
@ -8054,7 +8075,7 @@ int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...)
|
|||
va_list argptr;
|
||||
|
||||
if (size <= 0)
|
||||
return 0;
|
||||
return !buffer?-1:0;
|
||||
size--;
|
||||
|
||||
va_start (argptr, format);
|
||||
|
@ -8067,12 +8088,12 @@ int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...)
|
|||
}
|
||||
|
||||
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr)
|
||||
{
|
||||
{ //_vsnprintf truncates WITHOUT NULL, and returns -1
|
||||
#undef _vsnprintf
|
||||
int ret;
|
||||
|
||||
if (size <= 0)
|
||||
return 0;
|
||||
return !buffer?-1:0;
|
||||
size--;
|
||||
|
||||
ret = _vsnprintf (buffer,size, format,argptr);
|
||||
|
@ -8083,7 +8104,7 @@ int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_lis
|
|||
}
|
||||
#else
|
||||
int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...)
|
||||
{
|
||||
{ //vsnprintf_s safely truncates with null, but returns -1 on truncation rather than untruncated full length
|
||||
int ret;
|
||||
va_list argptr;
|
||||
|
||||
|
|
|
@ -82,6 +82,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define quintptr_t unsigned qintptr_t
|
||||
#define quint64_t unsigned qint64_t
|
||||
#endif
|
||||
|
||||
#ifndef uint32_t
|
||||
#define int16_t qint16_t
|
||||
#define uint16_t quint16_t
|
||||
#define int32_t qint32_t
|
||||
#define uint32_t quint32_t
|
||||
#define int64_t qint64_t
|
||||
#define uint64_t quint64_t
|
||||
#define intptr_t qintptr_t
|
||||
#define uintptr_t quintptr_t
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FTE_WORDSIZE
|
||||
|
@ -384,9 +395,9 @@ int wildcmp(const char *wild, const char *string); //1 if match
|
|||
#define Q_strcmp(s1, s2) strcmp((s1), (s2))
|
||||
#define Q_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
|
||||
|
||||
void VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...) LIKEPRINTF(3);
|
||||
void VARGS Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list args);
|
||||
int VARGS Com_sprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
||||
qboolean VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...) LIKEPRINTF(3); //true means truncated (will also warn in debug builds).
|
||||
qboolean VARGS Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list args); //true means truncated (will also warn in debug builds).
|
||||
void VARGS Com_sprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
||||
|
||||
#define Q_strncpyS(d, s, n) do{const char *____in=(s);char *____out=(d);int ____i; for (____i=0;*(____in); ____i++){if (____i == (n))break;*____out++ = *____in++;}if (____i < (n))*____out='\0';}while(0) //only use this when it should be used. If undiciided, use N
|
||||
#define Q_strncpyN(d, s, n) do{if (n < 0)Sys_Error("Bad length in strncpyz");Q_strncpyS((d), (s), (n));((char *)(d))[n] = '\0';}while(0) //this'll stop me doing buffer overflows. (guarenteed to overflow if you tried the wrong size.)
|
||||
|
|
|
@ -592,7 +592,7 @@ static void QDECL VFSW32_BuildHash(searchpathfuncs_t *handle, int hashdepth, voi
|
|||
wp->hashdepth = hashdepth;
|
||||
Sys_EnumerateFiles(wp->rootpath, "*", VFSW32_RebuildFSHash, AddFileHash, handle);
|
||||
}
|
||||
static unsigned int QDECL VFSW32_CreateLoc(searchpathfuncs_t *handle, flocation_t *loc, const char *filename)
|
||||
static qboolean QDECL VFSW32_CreateLoc(searchpathfuncs_t *handle, flocation_t *loc, const char *filename)
|
||||
{
|
||||
vfsw32path_t *wp = (void*)handle;
|
||||
char *ofs;
|
||||
|
@ -601,7 +601,7 @@ static unsigned int QDECL VFSW32_CreateLoc(searchpathfuncs_t *handle, flocation_
|
|||
loc->offset = 0;
|
||||
loc->fhandle = handle;
|
||||
loc->rawname[sizeof(loc->rawname)-1] = 0;
|
||||
if ((unsigned int)snprintf (loc->rawname, sizeof(loc->rawname), "%s/%s", wp->rootpath, filename) > sizeof(loc->rawname)-1)
|
||||
if (Q_snprintfz (loc->rawname, sizeof(loc->rawname), "%s/%s", wp->rootpath, filename))
|
||||
return FF_NOTFOUND;
|
||||
for (ofs = loc->rawname+1 ; *ofs ; ofs++)
|
||||
{
|
||||
|
@ -639,7 +639,7 @@ static unsigned int QDECL VFSW32_FLocate(searchpathfuncs_t *handle, flocation_t
|
|||
*/
|
||||
|
||||
// check a file in the directory tree
|
||||
if ((unsigned int)snprintf (netpath, sizeof(netpath), "%s/%s", wp->rootpath, filename) > sizeof(loc->rawname)-1)
|
||||
if (Q_snprintfz (netpath, sizeof(netpath), "%s/%s", wp->rootpath, filename))
|
||||
return FF_NOTFOUND;
|
||||
|
||||
if (!WinNT)
|
||||
|
|
|
@ -969,7 +969,7 @@ void Log_MapNowCompleted(void)
|
|||
m = Z_Malloc(sizeof(*m)+strlen(packagename)+strlen(sv.world.worldmodel->name)+2);
|
||||
sprintf(m->name, "%s/%s", packagename, sv.world.worldmodel->name);
|
||||
|
||||
m->fulltime = m->besttime = INFINITY;
|
||||
m->fulltime = m->besttime = FLT_MAX;
|
||||
m->bestkills = m->bestsecrets = 0;
|
||||
m->next = maplog_enties;
|
||||
maplog_enties = m;
|
||||
|
|
|
@ -922,7 +922,7 @@ msurface_t *Mod_GetSurfaceNearPoint(model_t *model, pvec3_t point)
|
|||
int i;
|
||||
|
||||
pvec3_t cpoint = {0,0,0};
|
||||
float bestdist = 0x7fffffff, dist;
|
||||
float bestdist = FLT_MAX, dist;
|
||||
msurface_t *bestsurf = NULL;
|
||||
|
||||
if (model->fromgame == fg_quake || model->fromgame == fg_quake2)
|
||||
|
@ -1003,13 +1003,13 @@ void QCBUILTIN PF_getsurfaceclippedpoint(pubprogfuncs_t *prinst, struct globalva
|
|||
{
|
||||
//all polies, we can skip parts. special case.
|
||||
surf = model->surfaces + model->firstmodelsurface + surfnum;
|
||||
getsurface_clippointpoly(model, surf, point, result, 0x7fffffff);
|
||||
getsurface_clippointpoly(model, surf, point, result, FLT_MAX);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if performance is needed, I suppose we could try walking bsp nodes a bit
|
||||
surf = model->surfaces + model->firstmodelsurface + surfnum;
|
||||
getsurface_clippointtri(model, surf, point, result, 0x7fffffff);
|
||||
getsurface_clippointtri(model, surf, point, result, FLT_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2112,7 +2112,7 @@ static void Q1BSP_ClustersInSphere_Union(mleaf_t *firstleaf, const vec3_t center
|
|||
continue;
|
||||
}
|
||||
}
|
||||
static qbyte *Q1BSP_ClustersInSphere(model_t *mod, const vec3_t center, float radius, pvsbuffer_t *fte_restrict pvsbuffer, const qbyte *unionwith)
|
||||
static qbyte *Q1BSP_ClustersInSphere(model_t *mod, const vec3_t center, float radius, pvsbuffer_t *fte_restrict pvsbuffer, const qbyte *fte_restrict unionwith)
|
||||
{
|
||||
if (!mod)
|
||||
Sys_Error ("Mod_PointInLeaf: bad model");
|
||||
|
|
|
@ -132,19 +132,19 @@ static void sha2trunc_init (void *context)
|
|||
hd->count = 0;
|
||||
}
|
||||
|
||||
static inline u64
|
||||
fte_inlinestatic u64
|
||||
ROTR (u64 x, u64 n)
|
||||
{
|
||||
return ((x >> n) | (x << (64 - n)));
|
||||
}
|
||||
|
||||
static inline u64
|
||||
fte_inlinestatic u64
|
||||
Ch (u64 x, u64 y, u64 z)
|
||||
{
|
||||
return ((x & y) ^ ( ~x & z));
|
||||
}
|
||||
|
||||
static inline u64
|
||||
fte_inlinestatic u64
|
||||
Maj (u64 x, u64 y, u64 z)
|
||||
{
|
||||
return ((x & y) ^ (x & z) ^ (y & z));
|
||||
|
@ -156,13 +156,13 @@ Maj (u64 x, u64 y, u64 z)
|
|||
#define S0(x) (ROTR((x),7) ^ ROTR((x),18) ^ ((x)>>3))
|
||||
#define S1(x) (ROTR((x),17) ^ ROTR((x),19) ^ ((x)>>10))
|
||||
|
||||
static inline u64
|
||||
fte_inlinestatic u64
|
||||
Sum0 (u64 x)
|
||||
{
|
||||
return (ROTR (x, 2) ^ ROTR (x, 13) ^ ROTR (x, 22));
|
||||
}
|
||||
|
||||
static inline u64
|
||||
fte_inlinestatic u64
|
||||
Sum1 (u64 x)
|
||||
{
|
||||
return (ROTR (x, 6) ^ ROTR (x, 11) ^ ROTR (x, 25));
|
||||
|
@ -171,13 +171,13 @@ Sum1 (u64 x)
|
|||
#define S0(x) (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))
|
||||
#define S1(x) (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))
|
||||
|
||||
static inline u64
|
||||
fte_inlinestatic u64
|
||||
Sum0 (u64 x)
|
||||
{
|
||||
return (ROTR (x, 28) ^ ROTR (x, 34) ^ ROTR (x, 39));
|
||||
}
|
||||
|
||||
static inline u64
|
||||
fte_inlinestatic u64
|
||||
Sum1 (u64 x)
|
||||
{
|
||||
return (ROTR (x, 14) ^ ROTR (x, 18) ^ ROTR (x, 41));
|
||||
|
|
|
@ -106,9 +106,9 @@ qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refres
|
|||
#define FTE_Atomic32_Inc(ptr) __sync_add_and_fetch(ptr, 1) //returns the AFTER the operation.
|
||||
#define FTE_Atomic32_Dec(ptr) __sync_add_and_fetch(ptr, 1) //returns the AFTER the operation.
|
||||
#elif defined(_WIN32)
|
||||
#define qatomic32_t LONG
|
||||
#define FTE_Atomic32_Inc(ptr) InterlockedIncrement(ptr)
|
||||
#define FTE_Atomic32_Dec(ptr) InterlockedDecrement(ptr)
|
||||
#define qatomic32_t long
|
||||
#define FTE_Atomic32_Inc(ptr) _InterlockedIncrement(ptr)
|
||||
#define FTE_Atomic32_Dec(ptr) _InterlockedDecrement(ptr)
|
||||
#else
|
||||
#define qatomic32_t qint32_t
|
||||
#define FTE_Atomic32_Inc(ptr) FTE_Atomic32Mutex_Add(ptr, 1)
|
||||
|
|
|
@ -222,6 +222,23 @@ char *Z_StrDupf(const char *format, ...)
|
|||
char *string;
|
||||
int n;
|
||||
|
||||
#if defined(_MSC_VER) || defined(_WIN32)
|
||||
int try;
|
||||
//msvc is shitty shit shit and doesn't even do c99. sadly mingw uses the same libraries.
|
||||
try = 256;
|
||||
for(;;)
|
||||
{
|
||||
string = Z_Malloc(try+1);
|
||||
va_start (argptr, format);
|
||||
n = _vsnprintf (string,try, format,argptr);
|
||||
va_end (argptr);
|
||||
if (n >= 0 && n < try)
|
||||
break;
|
||||
Z_Free(string);
|
||||
try *= 2;
|
||||
}
|
||||
string[n] = 0;
|
||||
#else
|
||||
va_start (argptr, format);
|
||||
n = vsnprintf (NULL,0, format,argptr);
|
||||
va_end (argptr);
|
||||
|
@ -233,6 +250,7 @@ char *Z_StrDupf(const char *format, ...)
|
|||
vsnprintf (string,n+1, format,argptr);
|
||||
va_end (argptr);
|
||||
string[n] = 0;
|
||||
#endif
|
||||
|
||||
return string;
|
||||
}
|
||||
|
|
|
@ -2718,6 +2718,10 @@ qboolean Sh_GenerateShadowMap(dlight_t *l, int lighttype)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define round(a) floor((a)+0.5)
|
||||
#endif
|
||||
|
||||
void Sh_OrthoAlignToFrustum(dlight_t *dl, int smsize)
|
||||
{
|
||||
vec3_t neworg;
|
||||
|
|
|
@ -88,19 +88,34 @@ void Q_strncpyz(char *d, const char *s, int n)
|
|||
*d='\0';
|
||||
}
|
||||
|
||||
void VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
|
||||
qboolean VARGS Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list argptr)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
size_t ret;
|
||||
#ifdef _WIN32
|
||||
#undef _vsnprintf
|
||||
_vsnprintf (dest, size-1, fmt, args);
|
||||
//doesn't null terminate.
|
||||
//returns -1 on truncation
|
||||
ret = _vsnprintf (dest, size, fmt, argptr);
|
||||
dest[size-1] = 0; //shitty paranoia
|
||||
#else
|
||||
vsnprintf (dest, size-1, fmt, args);
|
||||
//always null terminates.
|
||||
//returns length regardless of truncation.
|
||||
ret = vsnprintf (dest, size, fmt, argptr);
|
||||
#endif
|
||||
va_end (args);
|
||||
//make sure its terminated.
|
||||
dest[size-1] = 0;
|
||||
#ifdef _DEBUG
|
||||
if (ret>=size)
|
||||
Sys_Error("Q_vsnprintfz: Truncation\n");
|
||||
#endif
|
||||
//if ret is -1 (windows oversize, or general error) then it'll be treated as unsigned so really long. this makes the following check quite simple.
|
||||
return ret>=size;
|
||||
}
|
||||
qboolean VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
qboolean ret;
|
||||
va_start (argptr, fmt);
|
||||
ret = Q_vsnprintfz(dest, size, fmt, argptr);
|
||||
va_end (argptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*char *va(char *format, ...)
|
||||
|
|
|
@ -83,6 +83,7 @@ static void VARGS QC_snprintfz (char *dest, size_t size, const char *fmt, ...) L
|
|||
//make sure its terminated.
|
||||
dest[size-1] = 0;
|
||||
}
|
||||
#define snprintf QC_snprintfz
|
||||
#else
|
||||
#define QC_vsnprintf vsnprintf
|
||||
#define QC_snprintfz snprintf
|
||||
|
|
|
@ -419,9 +419,9 @@ reeval:
|
|||
break;
|
||||
case OP_STOREP_I64: // 64bit
|
||||
i = OPB->_int + OPC->_int*sizeof(ptr->_int);
|
||||
errorif (QCPOINTERWRITEFAIL(i, sizeof(ptr->_int64)))
|
||||
errorif (QCPOINTERWRITEFAIL(i, sizeof(ptr->i64)))
|
||||
{
|
||||
if (!(ptr=PR_GetWriteTempStringPtr(progfuncs, OPB->_int, OPC->_int*sizeof(ptr->_int), sizeof(ptr->_int64))))
|
||||
if (!(ptr=PR_GetWriteTempStringPtr(progfuncs, OPB->_int, OPC->_int*sizeof(ptr->_int), sizeof(ptr->i64))))
|
||||
{
|
||||
if (i == -1)
|
||||
break;
|
||||
|
@ -433,7 +433,7 @@ reeval:
|
|||
}
|
||||
else
|
||||
ptr = QCPOINTERM(i);
|
||||
ptr->_int64 = OPA->_int64;
|
||||
ptr->i64 = OPA->i64;
|
||||
break;
|
||||
case OP_STOREP_V:
|
||||
i = OPB->_int + (OPC->_int*sizeof(ptr->_int));
|
||||
|
@ -568,7 +568,7 @@ reeval:
|
|||
}
|
||||
|
||||
ptr = (eval_t *)(((int *)edvars(ed)) + i);
|
||||
ptr->_int64 = OPC->_int64;
|
||||
ptr->i64 = OPC->i64;
|
||||
break;
|
||||
case OP_STOREF_V:
|
||||
errorif ((unsigned)OPA->edict >= (unsigned)num_edicts)
|
||||
|
@ -746,7 +746,7 @@ reeval:
|
|||
break;
|
||||
}
|
||||
ptr = (eval_t *)(((int *)edvars(ed)) + i);
|
||||
OPC->_int64 = ptr->_int64;
|
||||
OPC->i64 = ptr->i64;
|
||||
}
|
||||
break;
|
||||
case OP_LOAD_V:
|
||||
|
@ -1064,7 +1064,7 @@ reeval:
|
|||
QCFAULT(&progfuncs->funcs, "bad array read in %s (index %i)", PR_StringToNative(&progfuncs->funcs, prinst.pr_xfunction->s_name), OPB->_int);
|
||||
}
|
||||
else
|
||||
OPC->_int64 = ((eval_t *)&glob[i])->_int64;
|
||||
OPC->i64 = ((eval_t *)&glob[i])->i64;
|
||||
break;
|
||||
case OP_LOADA_V:
|
||||
i = st->a + OPB->_int;
|
||||
|
@ -1156,7 +1156,7 @@ reeval:
|
|||
{
|
||||
if (i == -1)
|
||||
{
|
||||
OPC->_int64 = 0;
|
||||
OPC->i64 = 0;
|
||||
break;
|
||||
}
|
||||
QCFAULT(&progfuncs->funcs, "bad pointer read in %s (from %#x)", PR_StringToNative(&progfuncs->funcs, prinst.pr_xfunction->s_name), i);
|
||||
|
@ -1164,7 +1164,7 @@ reeval:
|
|||
}
|
||||
else
|
||||
ptr = QCPOINTERM(i);
|
||||
OPC->_int64 = ptr->_int64;
|
||||
OPC->i64 = ptr->i64;
|
||||
break;
|
||||
|
||||
case OP_LOADP_V:
|
||||
|
@ -1625,33 +1625,33 @@ reeval:
|
|||
|
||||
|
||||
//[u]int64+double opcodes
|
||||
case OP_ADD_I64: OPC->_int64 = OPA->_int64 + OPB->_int64; break;
|
||||
case OP_SUB_I64: OPC->_int64 = OPA->_int64 - OPB->_int64; break;
|
||||
case OP_MUL_I64: OPC->_int64 = OPA->_int64 * OPB->_int64; break;
|
||||
case OP_DIV_I64: OPC->_int64 = OPA->_int64 / OPB->_int64; break;
|
||||
case OP_BITAND_I64: OPC->_int64 = OPA->_int64 & OPB->_int64; break;
|
||||
case OP_BITOR_I64: OPC->_int64 = OPA->_int64 | OPB->_int64; break;
|
||||
case OP_BITXOR_I64: OPC->_int64 = OPA->_int64 ^ OPB->_int64; break;
|
||||
case OP_LSHIFT_I64I: OPC->_int64 = OPA->_int64 << OPB->_int; break;
|
||||
case OP_RSHIFT_I64I: OPC->_int64 = OPA->_int64 >> OPB->_int; break;
|
||||
case OP_LT_I64: OPC->_int = OPA->_int64 < OPB->_int64; break;
|
||||
case OP_LE_I64: OPC->_int = OPA->_int64 <= OPB->_int64; break;
|
||||
case OP_EQ_I64: OPC->_int = OPA->_int64 == OPB->_int64; break;
|
||||
case OP_NE_I64: OPC->_int = OPA->_int64 != OPB->_int64; break;
|
||||
case OP_LT_U64: OPC->_int = OPA->_uint64 < OPB->_uint64; break;
|
||||
case OP_LE_U64: OPC->_int = OPA->_uint64 <= OPB->_uint64; break;
|
||||
case OP_DIV_U64: OPC->_uint64 = OPA->_uint64 / OPB->_uint64; break;
|
||||
case OP_RSHIFT_U64I: OPC->_uint64 = OPA->_uint64 >> OPB->_int; break;
|
||||
case OP_STORE_I64: OPB->_int64 = OPA->_int64; break;
|
||||
case OP_CONV_UI64: OPC->_int64 = OPA->_uint; break;
|
||||
case OP_CONV_II64: OPC->_int64 = OPA->_int; break;
|
||||
case OP_CONV_I64I: OPC->_int = OPA->_int64; break;
|
||||
case OP_ADD_I64: OPC->i64 = OPA->i64 + OPB->i64; break;
|
||||
case OP_SUB_I64: OPC->i64 = OPA->i64 - OPB->i64; break;
|
||||
case OP_MUL_I64: OPC->i64 = OPA->i64 * OPB->i64; break;
|
||||
case OP_DIV_I64: OPC->i64 = OPA->i64 / OPB->i64; break;
|
||||
case OP_BITAND_I64: OPC->i64 = OPA->i64 & OPB->i64; break;
|
||||
case OP_BITOR_I64: OPC->i64 = OPA->i64 | OPB->i64; break;
|
||||
case OP_BITXOR_I64: OPC->i64 = OPA->i64 ^ OPB->i64; break;
|
||||
case OP_LSHIFT_I64I: OPC->i64 = OPA->i64 << OPB->_int; break;
|
||||
case OP_RSHIFT_I64I: OPC->i64 = OPA->i64 >> OPB->_int; break;
|
||||
case OP_LT_I64: OPC->_int = OPA->i64 < OPB->i64; break;
|
||||
case OP_LE_I64: OPC->_int = OPA->i64 <= OPB->i64; break;
|
||||
case OP_EQ_I64: OPC->_int = OPA->i64 == OPB->i64; break;
|
||||
case OP_NE_I64: OPC->_int = OPA->i64 != OPB->i64; break;
|
||||
case OP_LT_U64: OPC->_int = OPA->u64 < OPB->u64; break;
|
||||
case OP_LE_U64: OPC->_int = OPA->u64 <= OPB->u64; break;
|
||||
case OP_DIV_U64: OPC->u64 = OPA->u64 / OPB->u64; break;
|
||||
case OP_RSHIFT_U64I: OPC->u64 = OPA->u64 >> OPB->_int; break;
|
||||
case OP_STORE_I64: OPB->i64 = OPA->i64; break;
|
||||
case OP_CONV_UI64: OPC->i64 = OPA->_uint; break;
|
||||
case OP_CONV_II64: OPC->i64 = OPA->_int; break;
|
||||
case OP_CONV_I64I: OPC->_int = OPA->i64; break;
|
||||
case OP_CONV_FD: OPC->_double = OPA->_float; break;
|
||||
case OP_CONV_DF: OPC->_float = OPA->_double; break;
|
||||
case OP_CONV_I64F: OPC->_float = OPA->_int64; break;
|
||||
case OP_CONV_FI64: OPC->_int64 = OPA->_float; break;
|
||||
case OP_CONV_I64D: OPC->_double = OPA->_int64; break;
|
||||
case OP_CONV_DI64: OPC->_int64 = OPA->_double; break;
|
||||
case OP_CONV_I64F: OPC->_float = OPA->i64; break;
|
||||
case OP_CONV_FI64: OPC->i64 = OPA->_float; break;
|
||||
case OP_CONV_I64D: OPC->_double = OPA->i64; break;
|
||||
case OP_CONV_DI64: OPC->i64 = OPA->_double; break;
|
||||
case OP_ADD_D: OPC->_double = OPA->_double + OPB->_double; break;
|
||||
case OP_SUB_D: OPC->_double = OPA->_double - OPB->_double; break;
|
||||
case OP_MUL_D: OPC->_double = OPA->_double * OPB->_double; break;
|
||||
|
@ -1667,7 +1667,9 @@ reeval:
|
|||
case OP_UNUSED:
|
||||
case OP_POP:
|
||||
|
||||
#ifdef __GNUC__
|
||||
case OP_NUMREALOPS ... OP_NUMOPS:
|
||||
#endif
|
||||
|
||||
safedefault:
|
||||
if (op & OP_BIT_BREAKPOINT) //break point!
|
||||
|
|
|
@ -611,10 +611,10 @@ char *PR_ValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val, pbool v
|
|||
QC_snprintfz (line, sizeof(line), "%"pPRIu, val->_uint);
|
||||
break;
|
||||
case ev_int64:
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIi64, val->_int64);
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIi64, val->i64);
|
||||
break;
|
||||
case ev_uint64:
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIu64, val->_uint64);
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIu64, val->u64);
|
||||
break;
|
||||
case ev_vector:
|
||||
QC_snprintfz (line, sizeof(line), "'%g %g %g'", val->_vector[0], val->_vector[1], val->_vector[2]);
|
||||
|
@ -765,10 +765,10 @@ char *PDECL PR_UglyValueString (pubprogfuncs_t *ppf, etype_t type, eval_t *val)
|
|||
sprintf (line, "%"pPRIu, val->_uint);
|
||||
break;
|
||||
case ev_int64:
|
||||
sprintf (line, "%"pPRIi64, val->_int64);
|
||||
sprintf (line, "%"pPRIi64, val->i64);
|
||||
break;
|
||||
case ev_uint64:
|
||||
sprintf (line, "%"pPRIu64, val->_int64);
|
||||
sprintf (line, "%"pPRIu64, val->u64);
|
||||
break;
|
||||
case ev_vector:
|
||||
if (val->_vector[0] == (int)val->_vector[0] && val->_vector[1] == (int)val->_vector[1] && val->_vector[2] == (int)val->_vector[2])
|
||||
|
@ -846,10 +846,10 @@ char *PR_UglyOldValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
|||
QC_snprintfz (line, sizeof(line), "%"pPRIu, val->_uint);
|
||||
break;
|
||||
case ev_int64:
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIi64, val->_int64);
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIi64, val->i64);
|
||||
break;
|
||||
case ev_uint64:
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIu64, val->_uint64);
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIu64, val->u64);
|
||||
break;
|
||||
case ev_vector:
|
||||
if (val->_vector[0] == (int)val->_vector[0] && val->_vector[1] == (int)val->_vector[1] && val->_vector[2] == (int)val->_vector[2])
|
||||
|
@ -1244,10 +1244,10 @@ pbool PDECL ED_ParseEval (pubprogfuncs_t *ppf, eval_t *eval, int type, const cha
|
|||
eval->_uint = strtoul (s, NULL, 0);
|
||||
break;
|
||||
case ev_int64:
|
||||
eval->_int64 = strtoll (s, NULL, 0);
|
||||
eval->i64 = strtoll (s, NULL, 0);
|
||||
break;
|
||||
case ev_uint64:
|
||||
eval->_uint64 = strtoull (s, NULL, 0);
|
||||
eval->u64 = strtoull (s, NULL, 0);
|
||||
break;
|
||||
|
||||
case ev_vector:
|
||||
|
@ -1382,7 +1382,7 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, size_t qcptr, unsigned int fldofs,
|
|||
i = strtoll(s, &s, 0);
|
||||
while(*s == ' ' || *s == '\t')
|
||||
s++;
|
||||
eval->_int64 = i;
|
||||
eval->i64 = i;
|
||||
if (*s)
|
||||
return false; //some kind of junk in there.
|
||||
break;
|
||||
|
@ -1392,7 +1392,7 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, size_t qcptr, unsigned int fldofs,
|
|||
u = strtoull(s, &s, 0);
|
||||
while(*s == ' ' || *s == '\t')
|
||||
s++;
|
||||
eval->_uint64 = u;
|
||||
eval->u64 = u;
|
||||
if (*s)
|
||||
return false; //some kind of junk in there.
|
||||
break;
|
||||
|
|
|
@ -26,14 +26,14 @@
|
|||
#if (_MSC_VER >= 1400)
|
||||
//with MSVC 8, use MS extensions
|
||||
#define snprintf linuxlike_snprintf_vc8
|
||||
int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
||||
#define vsnprintf(a, b, c, d) vsnprintf_s(a, b, _TRUNCATE, c, d)
|
||||
void VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
||||
#define vsnprintf(a, b, c, d) (void)(vsnprintf_s(a, b, _TRUNCATE, c, d))
|
||||
#else
|
||||
//msvc crap
|
||||
#define snprintf linuxlike_snprintf
|
||||
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
||||
void VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
||||
#define vsnprintf linuxlike_vsnprintf
|
||||
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
|
||||
void VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -296,8 +296,8 @@ typedef union eval_s
|
|||
func_t function; //module=0xff000000, func=0x00ffffff
|
||||
pint_t _int;
|
||||
puint_t _uint;
|
||||
pint64_t _int64;
|
||||
puint64_t _uint64;
|
||||
pint64_t i64;
|
||||
puint64_t u64;
|
||||
pdouble_t _double;
|
||||
pint_t edict;
|
||||
pvec_t prog; //so it can easily be changed
|
||||
|
|
|
@ -32,8 +32,8 @@ typedef float pvec_t;
|
|||
typedef int pint_t;
|
||||
typedef unsigned int puint_t;
|
||||
#ifdef _MSC_VER
|
||||
typedef __int64 pint64_t QC_ALIGN(4);
|
||||
typedef unsigned __int64 puint64_t QC_ALIGN(4);
|
||||
typedef QC_ALIGN(4) __int64 pint64_t;
|
||||
typedef QC_ALIGN(4) unsigned __int64 puint64_t;
|
||||
|
||||
#define pPRId "d"
|
||||
#define pPRIi "i"
|
||||
|
@ -58,7 +58,7 @@ typedef unsigned int puint_t;
|
|||
#define QCVM_32
|
||||
#endif
|
||||
|
||||
typedef double pdouble_t QC_ALIGN(4); //the qcvm uses vectors and stuff, so any 64bit types are only 4-byte aligned. we don't do atomics so this is fine so long as the compiler handles it for us.
|
||||
typedef QC_ALIGN(4) double pdouble_t; //the qcvm uses vectors and stuff, so any 64bit types are only 4-byte aligned. we don't do atomics so this is fine so long as the compiler handles it for us.
|
||||
typedef unsigned int pbool;
|
||||
typedef pvec_t pvec3_t[3];
|
||||
typedef pint_t progsnum_t;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
extern progfuncs_t *qccprogfuncs;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define strtoll _strtoi64
|
||||
#define strtoull _strtoui64
|
||||
#ifndef PRIxPTR
|
||||
#define PRIxPTR "Ix"
|
||||
|
@ -343,8 +344,8 @@ typedef union QCC_eval_s
|
|||
func_t function;
|
||||
pint_t _int;
|
||||
puint_t _uint;
|
||||
pint64_t _int64;
|
||||
puint64_t _uint64;
|
||||
pint64_t i64;
|
||||
puint64_t u64;
|
||||
// union QCC_eval_s *ptr;
|
||||
} QCC_eval_t;
|
||||
|
||||
|
|
|
@ -1841,7 +1841,7 @@ static pbool QCC_Eval_Truth(const QCC_eval_t *eval, QCC_type_t *type, pbool assu
|
|||
break;
|
||||
case ev_int64:
|
||||
case ev_uint64:
|
||||
istrue = (eval->_int64 != 0);
|
||||
istrue = (eval->i64 != 0);
|
||||
break;
|
||||
case ev_string:
|
||||
if (flag_ifstring)
|
||||
|
@ -2551,12 +2551,12 @@ const char *QCC_VarAtOffset(QCC_sref_t ref)
|
|||
QC_snprintfz(message, sizeof(message), "%#"pPRIx"u", val->_uint);
|
||||
return message;
|
||||
case ev_int64:
|
||||
//QC_snprintfz(message, sizeof(message), "%"pPRIu64"ill", val->_int64);
|
||||
QC_snprintfz(message, sizeof(message), "%#"pPRIx64"ill", val->_int64);
|
||||
//QC_snprintfz(message, sizeof(message), "%"pPRIu64"ill", val->i64);
|
||||
QC_snprintfz(message, sizeof(message), "%#"pPRIx64"ill", val->i64);
|
||||
return message;
|
||||
case ev_uint64:
|
||||
//QC_snprintfz(message, sizeof(message), "%"pPRIu64"ull", val->_uint64);
|
||||
QC_snprintfz(message, sizeof(message), "%#"pPRIx64"ull", val->_uint64);
|
||||
//QC_snprintfz(message, sizeof(message), "%"pPRIu64"ull", val->u64);
|
||||
QC_snprintfz(message, sizeof(message), "%#"pPRIx64"ull", val->u64);
|
||||
return message;
|
||||
case ev_entity:
|
||||
QC_snprintfz(message, sizeof(message), "%"pPRIi"e", val->_int);
|
||||
|
@ -3118,55 +3118,55 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
|
|||
|
||||
case OP_ADD_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 + eval_b->_int64);
|
||||
return QCC_MakeInt64Const(eval_a->i64 + eval_b->i64);
|
||||
case OP_SUB_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 - eval_b->_int64);
|
||||
return QCC_MakeInt64Const(eval_a->i64 - eval_b->i64);
|
||||
case OP_MUL_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 * eval_b->_int64);
|
||||
return QCC_MakeInt64Const(eval_a->i64 * eval_b->i64);
|
||||
case OP_DIV_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 / eval_b->_int64);
|
||||
return QCC_MakeInt64Const(eval_a->i64 / eval_b->i64);
|
||||
case OP_LSHIFT_I64I:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 << eval_b->_int);
|
||||
return QCC_MakeInt64Const(eval_a->i64 << eval_b->_int);
|
||||
case OP_RSHIFT_I64I:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 >> eval_b->_int);
|
||||
return QCC_MakeInt64Const(eval_a->i64 >> eval_b->_int);
|
||||
case OP_BITAND_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 & eval_b->_int64);
|
||||
return QCC_MakeInt64Const(eval_a->i64 & eval_b->i64);
|
||||
case OP_BITOR_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 | eval_b->_int64);
|
||||
return QCC_MakeInt64Const(eval_a->i64 | eval_b->i64);
|
||||
case OP_BITXOR_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeInt64Const(eval_a->_int64 ^ eval_b->_int64);
|
||||
return QCC_MakeInt64Const(eval_a->i64 ^ eval_b->i64);
|
||||
case OP_LE_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeIntConst(eval_a->_int64 <= eval_b->_int64);
|
||||
return QCC_MakeIntConst(eval_a->i64 <= eval_b->i64);
|
||||
case OP_LT_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeIntConst(eval_a->_int64 < eval_b->_int64);
|
||||
return QCC_MakeIntConst(eval_a->i64 < eval_b->i64);
|
||||
case OP_EQ_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeIntConst(eval_a->_int64 == eval_b->_int64);
|
||||
return QCC_MakeIntConst(eval_a->i64 == eval_b->i64);
|
||||
case OP_NE_I64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeIntConst(eval_a->_int64 != eval_b->_int64);
|
||||
return QCC_MakeIntConst(eval_a->i64 != eval_b->i64);
|
||||
case OP_LT_U64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeIntConst(eval_a->_uint64 < eval_b->_uint64);
|
||||
return QCC_MakeIntConst(eval_a->u64 < eval_b->u64);
|
||||
case OP_LE_U64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeIntConst(eval_a->_uint64 <= eval_b->_uint64);
|
||||
return QCC_MakeIntConst(eval_a->u64 <= eval_b->u64);
|
||||
case OP_DIV_U64:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeUInt64Const(eval_a->_uint64 / eval_b->_uint64);
|
||||
return QCC_MakeUInt64Const(eval_a->u64 / eval_b->u64);
|
||||
case OP_RSHIFT_U64I:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
return QCC_MakeUInt64Const(eval_a->_uint64 >> eval_b->_int);
|
||||
return QCC_MakeUInt64Const(eval_a->u64 >> eval_b->_int);
|
||||
|
||||
case OP_ADD_D:
|
||||
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
|
||||
|
@ -3289,9 +3289,9 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
|
|||
QCC_FreeTemp(var_a);
|
||||
optres_constantarithmatic++;
|
||||
{
|
||||
double d = eval_a->_int64;
|
||||
if ((pint64_t)d != eval_a->_int64)
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Numerical truncation of %#"pPRIx64" to %#"pPRIx64".", eval_a->_int64, (pint64_t)d);
|
||||
double d = eval_a->i64;
|
||||
if ((pint64_t)d != eval_a->i64)
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Numerical truncation of %#"pPRIx64" to %#"pPRIx64".", eval_a->i64, (pint64_t)d);
|
||||
return QCC_MakeDoubleConst(d);
|
||||
}
|
||||
case OP_CONV_FI64:
|
||||
|
@ -3304,9 +3304,9 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
|
|||
QCC_FreeTemp(var_a);
|
||||
optres_constantarithmatic++;
|
||||
{
|
||||
float d = eval_a->_int64;
|
||||
if ((pint64_t)d != eval_a->_int64)
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Numerical truncation of %#"pPRIx64" to %#"pPRIx64".", eval_a->_int64, (pint64_t)d);
|
||||
float d = eval_a->i64;
|
||||
if ((pint64_t)d != eval_a->i64)
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Numerical truncation of %#"pPRIx64" to %#"pPRIx64".", eval_a->i64, (pint64_t)d);
|
||||
return QCC_MakeFloatConst(d);
|
||||
}
|
||||
case OP_CONV_II64:
|
||||
|
@ -3331,9 +3331,9 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
|
|||
QCC_FreeTemp(var_a);
|
||||
optres_constantarithmatic++;
|
||||
{
|
||||
pint_t d = eval_a->_int64;
|
||||
if ((pint64_t)d != eval_a->_int64)
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Numerical truncation of %#"pPRIx64" to %#"pPRIx".", eval_a->_int64, (pint_t)d);
|
||||
pint_t d = eval_a->i64;
|
||||
if ((pint64_t)d != eval_a->i64)
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Numerical truncation of %#"pPRIx64" to %#"pPRIx".", eval_a->i64, (pint_t)d);
|
||||
return QCC_MakeIntConst(d);
|
||||
}
|
||||
|
||||
|
@ -5517,11 +5517,11 @@ static QCC_sref_t QCC_PR_ParseImmediate (void)
|
|||
QCC_PR_Lex ();
|
||||
return cn;
|
||||
case ev_int64:
|
||||
cn = QCC_MakeInt64Const(pr_immediate._int64);
|
||||
cn = QCC_MakeInt64Const(pr_immediate.i64);
|
||||
QCC_PR_Lex ();
|
||||
return cn;
|
||||
case ev_uint64:
|
||||
cn = QCC_MakeUInt64Const(pr_immediate._uint64);
|
||||
cn = QCC_MakeUInt64Const(pr_immediate.u64);
|
||||
QCC_PR_Lex ();
|
||||
return cn;
|
||||
|
||||
|
@ -8130,7 +8130,7 @@ static QCC_sref_t QCC_Make64bitConst(QCC_type_t *type, puint64_t value) //all va
|
|||
while (cn)
|
||||
{
|
||||
if (cn->type->size == type->size)
|
||||
if (((QCC_eval_t*)cn->symboldata)->_uint64 == value)
|
||||
if (((QCC_eval_t*)cn->symboldata)->u64 == value)
|
||||
return QCC_MakeSRefForce(cn, 0, type);
|
||||
cn = Hash_GetNextKey(&floatconstdefstable, key, cn);
|
||||
}
|
||||
|
@ -8153,7 +8153,7 @@ static QCC_sref_t QCC_Make64bitConst(QCC_type_t *type, puint64_t value) //all va
|
|||
cn->symbolsize = cn->type->size;
|
||||
cn->symboldata = (QCC_eval_basic_t*)(cn+1);
|
||||
|
||||
((QCC_eval_t*)cn->symboldata)->_uint64 = value;
|
||||
((QCC_eval_t*)cn->symboldata)->u64 = value;
|
||||
|
||||
Hash_AddKey(&floatconstdefstable, key, cn, qccHunkAlloc(sizeof(bucket_t)));
|
||||
|
||||
|
@ -8229,14 +8229,14 @@ QCC_sref_t QCC_MakeInt64Const(longlong llvalue)
|
|||
{
|
||||
pint64_t value = llvalue;
|
||||
if (value != llvalue)
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Constant int operand %llu will be truncated to %"PRIi64, llvalue, value);
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Constant int operand %llu will be truncated to %"pPRIi64, llvalue, value);
|
||||
return QCC_Make64bitConst(type_int64, value);
|
||||
}
|
||||
QCC_sref_t QCC_MakeUInt64Const(unsigned longlong llvalue)
|
||||
{
|
||||
puint64_t value = llvalue;
|
||||
if (value != llvalue)
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Constant int operand %llu will be truncated to %"PRIu64, llvalue, value);
|
||||
QCC_PR_ParseWarning(WARN_OVERFLOW, "Constant int operand %llu will be truncated to %"pPRIu64, llvalue, value);
|
||||
return QCC_Make64bitConst(type_uint64, value);
|
||||
}
|
||||
QCC_sref_t QCC_MakeDoubleConst(double value)
|
||||
|
@ -12654,9 +12654,9 @@ int QCC_PR_IntConstExpr(void)
|
|||
case ev_uint:
|
||||
return ev->_uint;
|
||||
case ev_int64:
|
||||
return ev->_int64;
|
||||
return ev->i64;
|
||||
case ev_uint64:
|
||||
return ev->_uint64;
|
||||
return ev->u64;
|
||||
default:
|
||||
QCC_PR_ParseError(ERR_NOTACONSTANT, "Value is not an integer constant");
|
||||
}
|
||||
|
@ -17569,9 +17569,9 @@ QCC_type_t *QCC_PR_ParseEnum(pbool flags)
|
|||
else if (sref.cast->type == ev_uint)
|
||||
next_f = next_i = eval->_uint;
|
||||
else if (sref.cast->type == ev_int64)
|
||||
next_f = (longlong)(next_i = eval->_int64);
|
||||
next_f = (longlong)(next_i = eval->i64);
|
||||
else if (sref.cast->type == ev_uint64)
|
||||
next_f = next_i = eval->_uint64;
|
||||
next_f = next_i = eval->u64;
|
||||
}
|
||||
else if (sref.sym)
|
||||
QCC_PR_ParseError(ERR_NOTANUMBER, "enum - %s is not a compile-time constant", sref.sym->name);
|
||||
|
|
|
@ -2157,7 +2157,7 @@ static void QCC_PR_LexNumber (void)
|
|||
if (islong)
|
||||
{
|
||||
pr_immediate_type = (isunsigned)?type_uint64:type_int64;
|
||||
pr_immediate._int64 = num;
|
||||
pr_immediate.i64 = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3985,8 +3985,8 @@ void QCC_PR_ParsePrintDef (int type, QCC_def_t *def)
|
|||
case ev_double: QC_snprintfz(vlbuffer, sizeof(vlbuffer), " = %g", ev->_double); break;
|
||||
case ev_integer:QC_snprintfz(vlbuffer, sizeof(vlbuffer), " = %i", ev->_int); break;
|
||||
case ev_uint: QC_snprintfz(vlbuffer, sizeof(vlbuffer), " = %u", ev->_uint); break;
|
||||
case ev_int64: QC_snprintfz(vlbuffer, sizeof(vlbuffer), " = %i", (int)ev->_int64); break;
|
||||
case ev_uint64: QC_snprintfz(vlbuffer, sizeof(vlbuffer), " = %u", (unsigned)ev->_uint64); break;
|
||||
case ev_int64: QC_snprintfz(vlbuffer, sizeof(vlbuffer), " = %"pPRIi64, ev->i64); break;
|
||||
case ev_uint64: QC_snprintfz(vlbuffer, sizeof(vlbuffer), " = %"pPRIu64, ev->u64); break;
|
||||
default: *vlbuffer = 0; break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -756,10 +756,10 @@ static void QCC_DumpAutoCvars (const char *outputname)
|
|||
snprintf(line, sizeof(line), "set %s\t%"pPRIu"%s%s\n", n, val->_uint, desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
case ev_int64:
|
||||
snprintf(line, sizeof(line), "set %s\t%"pPRIi64"%s%s\n", n, val->_int64, desc?"\t//":"", desc?desc:"");
|
||||
snprintf(line, sizeof(line), "set %s\t%"pPRIi64"%s%s\n", n, val->i64, desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
case ev_uint64:
|
||||
snprintf(line, sizeof(line), "set %s\t%"pPRIu64"%s%s\n", n, val->_uint64, desc?"\t//":"", desc?desc:"");
|
||||
snprintf(line, sizeof(line), "set %s\t%"pPRIu64"%s%s\n", n, val->u64, desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
case ev_string:
|
||||
snprintf(line, sizeof(line), "set %s\t\"%s\"%s%s\n", n, strings + val->_int, desc?"\t//":"", desc?desc:"");
|
||||
|
|
|
@ -1658,7 +1658,7 @@ static void PR_FallbackSpawn_Misc_Model(pubprogfuncs_t *progfuncs, edict_t *self
|
|||
progfuncs->SetStringField(progfuncs, self, &self->v->model, "*null", true);
|
||||
|
||||
if (self->v->angles[1] < 0) //mimic AD. shame there's no avelocity clientside.
|
||||
self->v->angles[1] = (rand()*(360.0f/RAND_MAX));
|
||||
self->v->angles[1] = (rand()*(360.0/RAND_MAX));
|
||||
|
||||
//make sure the model is precached, to avoid errors.
|
||||
pr_globals = PR_globals(progfuncs, PR_CURRENT);
|
||||
|
@ -8755,7 +8755,7 @@ static void QCBUILTIN PF_h2starteffect(pubprogfuncs_t *prinst, struct globalvars
|
|||
|
||||
/*convert it to the requested chunk type*/
|
||||
efnum = ce_chunk_1 + type - 1;
|
||||
if (efnum < ce_chunk_1 && efnum > ce_chunk_24)
|
||||
if (efnum < ce_chunk_1 || efnum > ce_chunk_24)
|
||||
efnum = ce_chunk;
|
||||
|
||||
if (h2customtents[efnum] != -1)
|
||||
|
|
|
@ -462,7 +462,7 @@ static void QDECL Q1QVMPF_ClearEdict(pubprogfuncs_t *pf, edict_t *e)
|
|||
Q1QVMED_ClearEdict(e, true);
|
||||
}
|
||||
|
||||
static void QDECL Q1QVMPF_EntRemove(pubprogfuncs_t *pf, edict_t *e, qboolean instant)
|
||||
static void QDECL Q1QVMPF_EntRemove(pubprogfuncs_t *pf, edict_t *e, pbool instant)
|
||||
{
|
||||
if (!ED_CanFree(e))
|
||||
return;
|
||||
|
|
|
@ -1871,7 +1871,7 @@ void SV_MVD_SendInitialGamestate(mvddest_t *dest)
|
|||
for (j = 0; j < MAX_CL_STATS; j++)
|
||||
{
|
||||
demo.statsi[i][j] = 0x7fffffff;
|
||||
demo.statsf[i][j] = -0x7fffffff;
|
||||
demo.statsf[i][j] = -FLT_MAX;
|
||||
}
|
||||
demo.playerreset[i] = true;
|
||||
}
|
||||
|
|
|
@ -2226,8 +2226,8 @@ void SV_UpdateQCStats(edict_t *ent, int *statsi, char const** statss, float *sta
|
|||
break;
|
||||
case ev_int64:
|
||||
case ev_uint64: //split over 2 stats.
|
||||
statsi[qcstats[i].statnum] = eval->_uint64&0xffffffff;
|
||||
statsi[qcstats[i].statnum+1] = eval->_uint64>>32;
|
||||
statsi[qcstats[i].statnum] = eval->u64&0xffffffff;
|
||||
statsi[qcstats[i].statnum+1] = eval->u64>>32;
|
||||
break;
|
||||
case ev_entity:
|
||||
statsi[qcstats[i].statnum] = NUM_FOR_EDICT(svprogfuncs, PROG_TO_EDICT(svprogfuncs, eval->edict));
|
||||
|
|
|
@ -57,7 +57,7 @@ static void R_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist
|
|||
extern texid_t r_whiteimage, missing_texture_gloss, missing_texture_normal;
|
||||
extern texid_t r_blackimage, r_blackcubeimage, r_whitecubeimage;
|
||||
|
||||
static void BE_RotateForEntity (const entity_t *e, const model_t *mod);
|
||||
static void BE_RotateForEntity (const entity_t *fte_restrict e, const model_t *fte_restrict mod);
|
||||
void VKBE_SetupLightCBuffer(dlight_t *l, vec3_t colour);
|
||||
|
||||
#ifdef VK_EXT_debug_utils
|
||||
|
|
34
imgtool.c
34
imgtool.c
|
@ -341,29 +341,37 @@ void QDECL Q_strncpyz(char *d, const char *s, int n)
|
|||
}
|
||||
*d='\0';
|
||||
}
|
||||
void VARGS Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list argptr)
|
||||
|
||||
qboolean VARGS Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list argptr)
|
||||
{
|
||||
size_t ret;
|
||||
#ifdef _WIN32
|
||||
#undef _vsnprintf
|
||||
_vsnprintf (dest, size, fmt, argptr);
|
||||
#define _vsnprintf unsafe_vsnprintf
|
||||
//doesn't null terminate.
|
||||
//returns -1 on truncation
|
||||
ret = _vsnprintf (dest, size, fmt, argptr);
|
||||
dest[size-1] = 0; //shitty paranoia
|
||||
#else
|
||||
#ifdef _DEBUG
|
||||
if ((size_t)vsnprintf (dest, size, fmt, argptr) > size-1)
|
||||
Sys_Error("Q_vsnprintfz: truncation");
|
||||
#else
|
||||
vsnprintf (dest, size, fmt, argptr);
|
||||
#endif
|
||||
//always null terminates.
|
||||
//returns length regardless of truncation.
|
||||
ret = vsnprintf (dest, size, fmt, argptr);
|
||||
#endif
|
||||
dest[size-1] = 0;
|
||||
#ifdef _DEBUG
|
||||
if (ret>=size)
|
||||
Sys_Error("Q_vsnprintfz: Truncation\n");
|
||||
#endif
|
||||
//if ret is -1 (windows oversize, or general error) then it'll be treated as unsigned so really long. this makes the following check quite simple.
|
||||
return ret>=size;
|
||||
}
|
||||
void VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
|
||||
|
||||
qboolean VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
qboolean ret;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
Q_vsnprintfz(dest, size, fmt, argptr);
|
||||
ret = Q_vsnprintfz(dest, size, fmt, argptr);
|
||||
va_end (argptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//palette data is used in lmps, as well as written into pcxes or wads, probably some other things.
|
||||
|
|
|
@ -459,7 +459,6 @@ static qboolean JSON_Equals(json_t *t, const char *child, const char *expected)
|
|||
return !strncmp(t->bodystart, expected, t->bodyend-t->bodystart);
|
||||
return false;
|
||||
}
|
||||
#include <inttypes.h>
|
||||
static quintptr_t JSON_GetUInteger(json_t *t, const char *child, unsigned int fallback)
|
||||
{
|
||||
if (child)
|
||||
|
|
Loading…
Reference in a new issue