Merge pull request #21 from z33ky/mapbase/gcc-linux

gcc/Linux fixes
This commit is contained in:
Blixibon 2020-06-21 10:08:41 -05:00 committed by GitHub
commit 1f69727efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 1535 additions and 865 deletions

4
.gitignore vendored
View File

@ -26,6 +26,7 @@ ipch
*.xcodeproj/
obj*/
!devtools/*.mak
sp/src/devtools/makefile_base_posix.mak.link
!utils/smdlexp/smdlexp.mak
# Specific Source build products
@ -87,3 +88,6 @@ sp/src/materialsystem/*.dll
sp/src/materialsystem/*.pdb
sp/src/vgui2/*.dll
sp/src/vgui2/*.pdb
# Build support files
sp/src/devtools/gcc9+support.o

View File

@ -0,0 +1,59 @@
// compatibility with old ABI
#if __GNUC__ >= 9
#include <cmath>
extern "C" double __pow_finite(double a, double b)
{
return pow(a, b);
}
extern "C" double __log_finite(double a)
{
return log(a);
}
extern "C" double __exp_finite(double a)
{
return exp(a);
}
extern "C" double __atan2_finite(double a, double b)
{
return atan2(a, b);
}
extern "C" double __atan2f_finite(double a, double b)
{
return atan2f(a, b);
}
extern "C" float __powf_finite(float a, float b)
{
return powf(a, b);
}
extern "C" float __logf_finite(float a)
{
return logf(a);
}
extern "C" float __expf_finite(float a)
{
return expf(a);
}
extern "C" float __acosf_finite(float a)
{
return acosf(a);
}
extern "C" double __asin_finite(double a)
{
return asin(a);
}
extern "C" double __acos_finite(double a)
{
return acos(a);
}
#endif

View File

@ -1,509 +1,15 @@
#
# Base makefile for Linux and OSX
#
# !!!!! Note to future editors !!!!!
#
# before you make changes, make sure you grok:
# 1. the difference between =, :=, +=, and ?=
# 2. how and when this base makefile gets included in the generated makefile(s)
# ( see http://www.gnu.org/software/make/manual/make.html#Flavors )
#
# Command line prefixes:
# - errors are ignored
# @ command is not printed to stdout before being executed
# + command is executed even if Make is invoked in "do not exec" mode
OS := $(shell uname)
HOSTNAME := $(shell hostname)
-include $(SRCROOT)/devtools/steam_def.mak
-include $(SRCROOT)/devtools/sourcesdk_def.mak
# To build with clang, set the following in your environment:
# CC = clang
# CXX = clang++
ifeq ($(CFG), release)
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3.
# There also was no speed difference running at 1280x1024. May 2012, mikesart.
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
# -fno-omit-frame-pointer: need this for stack traces with perf.
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
else
OptimizerLevel_CompilerSpecific = -O0
#-O1 -finline-functions
endif
# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
ARCH_FLAGS =
BUILDING_MULTI_ARCH = 0
CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive
# turns these into warnings in gcc, and -Wno-c++11-narrowing suppresses them entirely in clang 3.1+.
ifeq ($(CXX),clang++)
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
else
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive
endif
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
MAP_FLAGS =
Srv_GAMEOUTPUTFILE =
COPY_DLL_TO_SRV = 0
ifeq ($(STEAM_BRANCH),1)
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
else
WARN_FLAGS = -Wno-write-strings -Wno-multichar
endif
WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -fdiagnostics-show-option -Wformat -Wformat-security
ifeq ($(OS),Linux)
# We should always specify -Wl,--build-id, as documented at:
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
LDFLAGS += -Wl,--build-id
# Set USE_VALVE_BINDIR to build with /Steam/tools/linux in the /valve/bin path.
# Dedicated server uses this.
ifeq ($(USE_VALVE_BINDIR),1)
# dedicated server flags
ifeq ($(TARGET_PLATFORM),linux64)
VALVE_BINDIR = /valve/bin64/
MARCH_TARGET = nocona
else
VALVE_BINDIR = /valve/bin/
MARCH_TARGET = pentium4
endif
STRIP_FLAGS =
else
# linux desktop client flags
VALVE_BINDIR =
# If the steam-runtime is available, use it. We should just default to using it when
# buildbot and everyone has a bit of time to get it installed.
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
# The steam-runtime is incompatible with clang at this point, so disable it
# if clang is enabled.
ifneq ($(CXX),clang++)
VALVE_BINDIR = /valve/steam-runtime/bin/
endif
endif
GCC_VER =
MARCH_TARGET = pentium4
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
# So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2.
STRIP_FLAGS = -x
endif
ifeq ($(CXX),clang++)
# Clang does not support -mfpmath=sse because it uses whatever
# instruction set extensions are available by default.
SSE_GEN_FLAGS = -msse2
else
SSE_GEN_FLAGS = -msse2 -mfpmath=sse
endif
CCACHE := $(SRCROOT)/devtools/bin/linux/ccache
ifeq ($(origin GCC_VER), undefined)
GCC_VER=-4.6
endif
ifeq ($(origin AR), default)
AR = $(VALVE_BINDIR)ar crs
endif
ifeq ($(origin CC),default)
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
endif
ifeq ($(origin CXX), default)
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
endif
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
# a ccache quirk. Could also upgrade ccache.
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
ifeq ($(CC),clang)
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
endif
ifeq ($(CXX),clang++)
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
endif
LINK ?= $(CC)
ifeq ($(TARGET_PLATFORM),linux64)
# nocona = pentium4 + 64bit + MMX, SSE, SSE2, SSE3 - no SSSE3 (that's three s's - added in core2)
ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=core2
LD_SO = ld-linux-x86_64.so.2
LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a)
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
else
# pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS)
LD_SO = ld-linux.so.2
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LDFLAGS += -m32
endif
GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh
ifeq ($(CFG),release)
STRIP ?= strip $(STRIP_FLAGS) -S
# CFLAGS += -ffunction-sections -fdata-sections
# LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections
else
STRIP ?= true
endif
VSIGN ?= true
ifeq ($(SOURCE_SDK), 1)
Srv_GAMEOUTPUTFILE := $(GAMEOUTPUTFILE:.so=_srv.so)
COPY_DLL_TO_SRV := 1
endif
LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map
SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined
_WRAP := -Xlinker --wrap=
PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRAP)access $(_WRAP)__xstat \
$(_WRAP)stat $(_WRAP)lstat $(_WRAP)fopen64 $(_WRAP)open64 $(_WRAP)opendir $(_WRAP)__lxstat \
$(_WRAP)chmod $(_WRAP)chown $(_WRAP)lchown $(_WRAP)symlink $(_WRAP)link $(_WRAP)__lxstat64 \
$(_WRAP)mknod $(_WRAP)utimes $(_WRAP)unlink $(_WRAP)rename $(_WRAP)utime $(_WRAP)__xstat64 \
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath
LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
endif
ifeq ($(OS),Darwin)
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
MAC_SDK_VER ?= 10.6
MAC_SDK := macosx$(MAC_SDK_VER)
SYSROOT := $(shell xcodebuild -sdk $(MAC_SDK) -version Path)
ifneq ($(origin MAC_SDK_VER), file)
$(warning Attempting build with SDK version $(MAC_SDK_VER), only 10.6 is supported and recommended!)
endif
ifeq ($(SYSROOT),)
FIRSTSDK := $(firstword $(sort $(shell xcodebuild -showsdks | grep macosx | sed 's/.*macosx//')))
$(error Could not find SDK version $(MAC_SDK_VER). Install and configure Xcode 4.3, or build with: make MAC_SDK_VER=$(FIRSTSDK))
endif
ifeq ($(origin CC), default)
# Test to see if you have a compiler in the right place, if you
# don't abort with an error
CLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang)
ifeq ($(wildcard $(CLANG)),)
$(error Unable to find C compiler, install and configure Xcode 4.3)
endif
CC := $(CCACHE) $(CLANG) -Qunused-arguments
endif
ifeq ($(origin CXX), default)
CXXLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang++)
ifeq ($(wildcard $(CXXLANG)),)
$(error Unable to find C++ compiler, install and configure Xcode 4.3)
endif
CXX := $(CCACHE) $(CXXLANG) -Qunused-arguments
endif
LINK ?= $(CXX)
ifeq ($(origin AR), default)
AR := $(shell xcrun -sdk $(MAC_SDK) -find libtool) -static -o
endif
ifeq ($(TARGET_PLATFORM),osx64)
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
else
# dirty hack to build a universal binary - don't specify the architecture
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
endif
GEN_SYM ?= $(shell xcrun -sdk $(MAC_SDK) -find dsymutil)
ifeq ($(CFG),release)
STRIP ?= strip -S
else
STRIP ?= true
endif
ifeq ($(SOURCE_SDK), 1)
VSIGN ?= true
else
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
endif
CPPFLAGS += -I$(SYSROOT)/usr/include/malloc
CFLAGS += -isysroot $(SYSROOT) -mmacosx-version-min=10.5 -fasm-blocks
LIB_START_EXE = -lm -ldl -lpthread
LIB_END_EXE =
LIB_START_SHLIB =
LIB_END_SHLIB =
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
endif
endif
#
# Profile-directed optimizations.
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
#
# First, uncomment these, build, and test. It will generate .gcda and .gcno files where the .o files are.
# PROFILE_LINKER_FLAG=-fprofile-arcs
# PROFILE_COMPILER_FLAG=-fprofile-arcs
#
# Then, comment the above flags out again and rebuild with this flag uncommented:
# PROFILE_COMPILER_FLAG=-fprofile-use
#
#############################################################################
# The compiler command lne for each src code file to compile
#############################################################################
OBJ_DIR = ./obj_$(NAME)_$(TARGET_PLATFORM)$(TARGET_PLATFORM_EXT)/$(CFG)
CPP_TO_OBJ = $(CPPFILES:.cpp=.o)
CXX_TO_OBJ = $(CPP_TO_OBJ:.cxx=.o)
CC_TO_OBJ = $(CXX_TO_OBJ:.cc=.o)
MM_TO_OBJ = $(CC_TO_OBJ:.mm=.o)
C_TO_OBJ = $(MM_TO_OBJ:.c=.o)
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ)))
ifeq ($(MAKE_VERBOSE),1)
QUIET_PREFIX =
QUIET_ECHO_POSTFIX =
else
QUIET_PREFIX = @
QUIET_ECHO_POSTFIX = > /dev/null
endif
ifeq ($(MAKE_CC_VERBOSE),1)
CC += -v
endif
ifeq ($(CONFTYPE),lib)
LIB_File = $(OUTPUTFILE)
endif
ifeq ($(CONFTYPE),dll)
SO_File = $(OUTPUTFILE)
endif
ifeq ($(CONFTYPE),exe)
EXE_File = $(OUTPUTFILE)
endif
# we generate dependencies as a side-effect of compilation now
GEN_DEP_FILE=
PRE_COMPILE_FILE =
POST_COMPILE_FILE =
ifeq ($(BUILDING_MULTI_ARCH),1)
SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS))
COMPILE_FILE = \
$(QUIET_PREFIX) \
echo "---- $(lastword $(subst /, ,$<)) as MULTIARCH----";\
mkdir -p $(OBJ_DIR) && \
$(CXX) $(SINGLE_ARCH_CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $< && \
$(CXX) $(CXXFLAGS) -o $@ -c $<
else
COMPILE_FILE = \
$(QUIET_PREFIX) \
echo "---- $(lastword $(subst /, ,$<)) ----";\
mkdir -p $(OBJ_DIR) && \
$(CXX) $(CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $<
endif
ifneq "$(origin VALVE_NO_AUTO_P4)" "undefined"
P4_EDIT_START = chmod -R +w
P4_EDIT_END = || true
P4_REVERT_START = true
P4_REVERT_END =
else
ifndef P4_EDIT_CHANGELIST
# You can use an environment variable to specify what changelist to check the Linux Binaries out into. Normally the default
# setting is best, but here is an alternate example:
# export P4_EDIT_CHANGELIST_CMD="echo 1424335"
# ?= means that if P4_EDIT_CHANGELIST_CMD is already set it won't be changed.
P4_EDIT_CHANGELIST_CMD ?= p4 changes -c `p4 client -o | grep ^Client | cut -f 2` -s pending | fgrep 'POSIX Auto Checkout' | cut -d' ' -f 2 | tail -n 1
P4_EDIT_CHANGELIST := $(shell $(P4_EDIT_CHANGELIST_CMD))
endif
ifeq ($(P4_EDIT_CHANGELIST),)
# If we haven't found a changelist to check out to then create one. The name must match the one from a few
# lines above or else a new changelist will be created each time.
# Warning: the behavior of 'echo' is not consistent. In bash you need the "-e" option in order for \n to be
# interpreted as a line-feed, but in dash you do not, and if "-e" is passed along then it is printed, which
# confuses p4. So, if you run this command from the bash shell don't forget to add "-e" to the echo command.
P4_EDIT_CHANGELIST = $(shell echo "Change: new\nDescription: POSIX Auto Checkout" | p4 change -i | cut -f 2 -d ' ')
endif
P4_EDIT_START := for f in
P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - edit -c $(P4_EDIT_CHANGELIST); else p4 edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
P4_REVERT_START := for f in
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - revert; else p4 revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
endif
ifeq ($(CONFTYPE),dll)
all: $(OTHER_DEPENDENCIES) $(OBJS) $(GAMEOUTPUTFILE)
@echo $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX)
else
all: $(OTHER_DEPENDENCIES) $(OBJS) $(OUTPUTFILE)
@echo $(OUTPUTFILE) $(QUIET_ECHO_POSTFIX)
endif
.PHONY: clean cleantargets cleanandremove rebuild relink RemoveOutputFile SingleFile
rebuild :
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) cleanandremove
$(MAKE) -f $(firstword $(MAKEFILE_LIST))
# Use the relink target to force to relink the project.
relink: RemoveOutputFile all
RemoveOutputFile:
rm -f $(OUTPUTFILE)
# This rule is so you can say "make SingleFile SingleFilename=/home/myname/valve_main/src/engine/language.cpp" and have it only build that file.
# It basically just translates the full filename to create a dependency on the appropriate .o file so it'll build that.
SingleFile : RemoveSingleFile $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
@echo ""
RemoveSingleFile:
$(QUIET_PREFIX) rm -f $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
clean:
ifneq "$(OBJ_DIR)" ""
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
$(QUIET_PREFIX) rm -rf $(OBJ_DIR)
endif
ifneq "$(OUTPUTFILE)" ""
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
echo "p4 revert $(OUTPUTFILE)"; \
$(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \
fi;
endif
ifneq "$(OTHER_DEPENDENCIES)" ""
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
$(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES)
endif
ifneq "$(GAMEOUTPUTFILE)" ""
$(QUIET_PREFIX) echo "p4 revert $(GAMEOUTPUTFILE)"
$(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END)
endif
# Do the above cleaning, except with p4 edit and rm. Reason being ar crs adds and replaces obj files to the
# archive. However if you've renamed or deleted a source file, $(AR) won't remove it. This can leave
# us with archive files that have extra unused symbols, and also potentially cause compilation errors
# when you rename a file and have many duplicate symbols.
cleanandremove:
ifneq "$(OBJ_DIR)" ""
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
$(QUIET_PREFIX) -rm -rf $(OBJ_DIR)
endif
ifneq "$(OUTPUTFILE)" ""
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
echo "p4 edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \
$(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \
fi;
$(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT);
endif
ifneq "$(OTHER_DEPENDENCIES)" ""
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
$(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES)
endif
ifneq "$(GAMEOUTPUTFILE)" ""
$(QUIET_PREFIX) echo "p4 edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)"
$(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END)
$(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE)
endif
# This just deletes the final targets so it'll do a relink next time we build.
cleantargets:
$(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE)
$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
$(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES);
SO_GameOutputFile = $(GAMEOUTPUTFILE)
# Remove the target before installing a file over it; this prevents existing
# instances of the game from crashing due to the overwrite.
$(SO_GameOutputFile): $(SO_File)
$(QUIET_PREFIX) \
$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END) && \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END);
$(QUIET_PREFIX) -mkdir -p `dirname $(GAMEOUTPUTFILE)` > /dev/null;
$(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) if [ "$(COPY_DLL_TO_SRV)" = "1" ]; then\
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO $(Srv_GAMEOUTPUTFILE) ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
cp -v $(GAMEOUTPUTFILE) $(Srv_GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);\
cp -v $(GAMEOUTPUTFILE)$(SYM_EXT) $(Srv_GAMEOUTPUTFILE)$(SYM_EXT) $(QUIET_ECHO_POSTFIX);\
fi;
$(QUIET_PREFIX) if [ "$(IMPORTLIBRARY)" != "" ]; then\
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO IMPORT LIBRARY $(IMPORTLIBRARY) ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
$(P4_EDIT_START) $(IMPORTLIBRARY) $(P4_EDIT_END) && \
mkdir -p `dirname $(IMPORTLIBRARY)` > /dev/null && \
cp -v $(OUTPUTFILE) $(IMPORTLIBRARY); \
fi;
$(SO_File): $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
$(QUIET_PREFIX) \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- LINKING $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
\
$(LINK) $(LINK_MAP_FLAGS) $(SHLIBLDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_SHLIB) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_SHLIB);
$(VSIGN) -signvalve $(OUTPUTFILE);
$(EXE_File) : $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
$(QUIET_PREFIX) \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- LINKING EXE $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
\
$(P4_EDIT_START) $(OUTPUTFILE) $(P4_EDIT_END);\
$(LINK) $(LINK_MAP_FLAGS) $(LDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_EXE) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_EXE);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
$(QUIET_PREFIX) $(GEN_SYM) $(OUTPUTFILE);
$(QUIET_PREFIX) -$(STRIP) $(OUTPUTFILE);
$(QUIET_PREFIX) $(VSIGN) -signvalve $(OUTPUTFILE);
tags:
etags -a -C -o $(SRCROOT)/TAGS *.cpp *.cxx *.h *.hxx
SRCROOT?=..
THISFILE:=$(SRCROOT)/devtools/makefile_base_posix.mak
MAKEFILE_BASE:=$(notdir $(THISFILE))
MAKEFILE_LINK:=$(THISFILE).link
-include $(MAKEFILE_LINK)
$(MAKEFILE_LINK): $(shell which $(CC)) $(THISFILE)
if [ "$(shell printf "$(shell $(CC) -dumpversion)\n8" | sort -Vr | head -1)" = 8 ]; then \
$(COMPILE.cpp) -o gcc9+support.o gcc9+support.c ;\
ln -sf $(MAKEFILE_BASE).default $@ ;\
else \
ln -sf $(MAKEFILE_BASE).gcc8 $@ ;\
fi

View File

@ -0,0 +1,509 @@
#
# Base makefile for Linux and OSX
#
# !!!!! Note to future editors !!!!!
#
# before you make changes, make sure you grok:
# 1. the difference between =, :=, +=, and ?=
# 2. how and when this base makefile gets included in the generated makefile(s)
# ( see http://www.gnu.org/software/make/manual/make.html#Flavors )
#
# Command line prefixes:
# - errors are ignored
# @ command is not printed to stdout before being executed
# + command is executed even if Make is invoked in "do not exec" mode
OS := $(shell uname)
HOSTNAME := $(shell hostname)
-include $(SRCROOT)/devtools/steam_def.mak
-include $(SRCROOT)/devtools/sourcesdk_def.mak
# To build with clang, set the following in your environment:
# CC = clang
# CXX = clang++
ifeq ($(CFG), release)
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3.
# There also was no speed difference running at 1280x1024. May 2012, mikesart.
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
# -fno-omit-frame-pointer: need this for stack traces with perf.
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
else
OptimizerLevel_CompilerSpecific = -O0
#-O1 -finline-functions
endif
# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
ARCH_FLAGS =
BUILDING_MULTI_ARCH = 0
CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive
# turns these into warnings in gcc, and -Wno-c++11-narrowing suppresses them entirely in clang 3.1+.
ifeq ($(CXX),clang++)
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
else
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive
endif
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
MAP_FLAGS =
Srv_GAMEOUTPUTFILE =
COPY_DLL_TO_SRV = 0
ifeq ($(STEAM_BRANCH),1)
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
else
WARN_FLAGS = -Wno-write-strings -Wno-multichar
endif
WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -fdiagnostics-show-option -Wformat -Wformat-security
ifeq ($(OS),Linux)
# We should always specify -Wl,--build-id, as documented at:
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
LDFLAGS += -Wl,--build-id
# Set USE_VALVE_BINDIR to build with /Steam/tools/linux in the /valve/bin path.
# Dedicated server uses this.
ifeq ($(USE_VALVE_BINDIR),1)
# dedicated server flags
ifeq ($(TARGET_PLATFORM),linux64)
VALVE_BINDIR = /valve/bin64/
MARCH_TARGET = nocona
else
VALVE_BINDIR = /valve/bin/
MARCH_TARGET = pentium4
endif
STRIP_FLAGS =
else
# linux desktop client flags
VALVE_BINDIR =
# If the steam-runtime is available, use it. We should just default to using it when
# buildbot and everyone has a bit of time to get it installed.
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
# The steam-runtime is incompatible with clang at this point, so disable it
# if clang is enabled.
ifneq ($(CXX),clang++)
VALVE_BINDIR = /valve/steam-runtime/bin/
endif
endif
GCC_VER =
MARCH_TARGET = pentium4
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
# So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2.
STRIP_FLAGS = -x
endif
ifeq ($(CXX),clang++)
# Clang does not support -mfpmath=sse because it uses whatever
# instruction set extensions are available by default.
SSE_GEN_FLAGS = -msse2
else
SSE_GEN_FLAGS = -msse2 -mfpmath=sse
endif
CCACHE := $(SRCROOT)/devtools/bin/linux/ccache
ifeq ($(origin GCC_VER), undefined)
GCC_VER=-4.6
endif
ifeq ($(origin AR), default)
AR = $(VALVE_BINDIR)ar crs
endif
ifeq ($(origin CC),default)
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
endif
ifeq ($(origin CXX), default)
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
endif
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
# a ccache quirk. Could also upgrade ccache.
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
ifeq ($(CC),clang)
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
endif
ifeq ($(CXX),clang++)
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
endif
LINK ?= $(CC)
ifeq ($(TARGET_PLATFORM),linux64)
# nocona = pentium4 + 64bit + MMX, SSE, SSE2, SSE3 - no SSSE3 (that's three s's - added in core2)
ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=core2
LD_SO = ld-linux-x86_64.so.2
LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a)
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
else
# pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS)
LD_SO = ld-linux.so.2
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LDFLAGS += -m32
endif
GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh
ifeq ($(CFG),release)
STRIP ?= strip $(STRIP_FLAGS) -S
# CFLAGS += -ffunction-sections -fdata-sections
# LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections
else
STRIP ?= true
endif
VSIGN ?= true
ifeq ($(SOURCE_SDK), 1)
Srv_GAMEOUTPUTFILE := $(GAMEOUTPUTFILE:.so=_srv.so)
COPY_DLL_TO_SRV := 1
endif
LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map
SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined
_WRAP := -Xlinker --wrap=
PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRAP)access $(_WRAP)__xstat \
$(_WRAP)stat $(_WRAP)lstat $(_WRAP)fopen64 $(_WRAP)open64 $(_WRAP)opendir $(_WRAP)__lxstat \
$(_WRAP)chmod $(_WRAP)chown $(_WRAP)lchown $(_WRAP)symlink $(_WRAP)link $(_WRAP)__lxstat64 \
$(_WRAP)mknod $(_WRAP)utimes $(_WRAP)unlink $(_WRAP)rename $(_WRAP)utime $(_WRAP)__xstat64 \
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath
LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
endif
ifeq ($(OS),Darwin)
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
MAC_SDK_VER ?= 10.6
MAC_SDK := macosx$(MAC_SDK_VER)
SYSROOT := $(shell xcodebuild -sdk $(MAC_SDK) -version Path)
ifneq ($(origin MAC_SDK_VER), file)
$(warning Attempting build with SDK version $(MAC_SDK_VER), only 10.6 is supported and recommended!)
endif
ifeq ($(SYSROOT),)
FIRSTSDK := $(firstword $(sort $(shell xcodebuild -showsdks | grep macosx | sed 's/.*macosx//')))
$(error Could not find SDK version $(MAC_SDK_VER). Install and configure Xcode 4.3, or build with: make MAC_SDK_VER=$(FIRSTSDK))
endif
ifeq ($(origin CC), default)
# Test to see if you have a compiler in the right place, if you
# don't abort with an error
CLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang)
ifeq ($(wildcard $(CLANG)),)
$(error Unable to find C compiler, install and configure Xcode 4.3)
endif
CC := $(CCACHE) $(CLANG) -Qunused-arguments
endif
ifeq ($(origin CXX), default)
CXXLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang++)
ifeq ($(wildcard $(CXXLANG)),)
$(error Unable to find C++ compiler, install and configure Xcode 4.3)
endif
CXX := $(CCACHE) $(CXXLANG) -Qunused-arguments
endif
LINK ?= $(CXX)
ifeq ($(origin AR), default)
AR := $(shell xcrun -sdk $(MAC_SDK) -find libtool) -static -o
endif
ifeq ($(TARGET_PLATFORM),osx64)
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
else
# dirty hack to build a universal binary - don't specify the architecture
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
endif
GEN_SYM ?= $(shell xcrun -sdk $(MAC_SDK) -find dsymutil)
ifeq ($(CFG),release)
STRIP ?= strip -S
else
STRIP ?= true
endif
ifeq ($(SOURCE_SDK), 1)
VSIGN ?= true
else
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
endif
CPPFLAGS += -I$(SYSROOT)/usr/include/malloc
CFLAGS += -isysroot $(SYSROOT) -mmacosx-version-min=10.5 -fasm-blocks
LIB_START_EXE = -lm -ldl -lpthread
LIB_END_EXE =
LIB_START_SHLIB =
LIB_END_SHLIB =
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
endif
endif
#
# Profile-directed optimizations.
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
#
# First, uncomment these, build, and test. It will generate .gcda and .gcno files where the .o files are.
# PROFILE_LINKER_FLAG=-fprofile-arcs
# PROFILE_COMPILER_FLAG=-fprofile-arcs
#
# Then, comment the above flags out again and rebuild with this flag uncommented:
# PROFILE_COMPILER_FLAG=-fprofile-use
#
#############################################################################
# The compiler command lne for each src code file to compile
#############################################################################
OBJ_DIR = ./obj_$(NAME)_$(TARGET_PLATFORM)$(TARGET_PLATFORM_EXT)/$(CFG)
CPP_TO_OBJ = $(CPPFILES:.cpp=.o)
CXX_TO_OBJ = $(CPP_TO_OBJ:.cxx=.o)
CC_TO_OBJ = $(CXX_TO_OBJ:.cc=.o)
MM_TO_OBJ = $(CC_TO_OBJ:.mm=.o)
C_TO_OBJ = $(MM_TO_OBJ:.c=.o)
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ)))
ifeq ($(MAKE_VERBOSE),1)
QUIET_PREFIX =
QUIET_ECHO_POSTFIX =
else
QUIET_PREFIX = @
QUIET_ECHO_POSTFIX = > /dev/null
endif
ifeq ($(MAKE_CC_VERBOSE),1)
CC += -v
endif
ifeq ($(CONFTYPE),lib)
LIB_File = $(OUTPUTFILE)
endif
ifeq ($(CONFTYPE),dll)
SO_File = $(OUTPUTFILE)
endif
ifeq ($(CONFTYPE),exe)
EXE_File = $(OUTPUTFILE)
endif
# we generate dependencies as a side-effect of compilation now
GEN_DEP_FILE=
PRE_COMPILE_FILE =
POST_COMPILE_FILE =
ifeq ($(BUILDING_MULTI_ARCH),1)
SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS))
COMPILE_FILE = \
$(QUIET_PREFIX) \
echo "---- $(lastword $(subst /, ,$<)) as MULTIARCH----";\
mkdir -p $(OBJ_DIR) && \
$(CXX) $(SINGLE_ARCH_CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $< && \
$(CXX) $(CXXFLAGS) -o $@ -c $<
else
COMPILE_FILE = \
$(QUIET_PREFIX) \
echo "---- $(lastword $(subst /, ,$<)) ----";\
mkdir -p $(OBJ_DIR) && \
$(CXX) $(CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $<
endif
ifneq "$(origin VALVE_NO_AUTO_P4)" "undefined"
P4_EDIT_START = chmod -R +w
P4_EDIT_END = || true
P4_REVERT_START = true
P4_REVERT_END =
else
ifndef P4_EDIT_CHANGELIST
# You can use an environment variable to specify what changelist to check the Linux Binaries out into. Normally the default
# setting is best, but here is an alternate example:
# export P4_EDIT_CHANGELIST_CMD="echo 1424335"
# ?= means that if P4_EDIT_CHANGELIST_CMD is already set it won't be changed.
P4_EDIT_CHANGELIST_CMD ?= p4 changes -c `p4 client -o | grep ^Client | cut -f 2` -s pending | fgrep 'POSIX Auto Checkout' | cut -d' ' -f 2 | tail -n 1
P4_EDIT_CHANGELIST := $(shell $(P4_EDIT_CHANGELIST_CMD))
endif
ifeq ($(P4_EDIT_CHANGELIST),)
# If we haven't found a changelist to check out to then create one. The name must match the one from a few
# lines above or else a new changelist will be created each time.
# Warning: the behavior of 'echo' is not consistent. In bash you need the "-e" option in order for \n to be
# interpreted as a line-feed, but in dash you do not, and if "-e" is passed along then it is printed, which
# confuses p4. So, if you run this command from the bash shell don't forget to add "-e" to the echo command.
P4_EDIT_CHANGELIST = $(shell echo "Change: new\nDescription: POSIX Auto Checkout" | p4 change -i | cut -f 2 -d ' ')
endif
P4_EDIT_START := for f in
P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - edit -c $(P4_EDIT_CHANGELIST); else p4 edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
P4_REVERT_START := for f in
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - revert; else p4 revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
endif
ifeq ($(CONFTYPE),dll)
all: $(OTHER_DEPENDENCIES) $(OBJS) $(GAMEOUTPUTFILE)
@echo $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX)
else
all: $(OTHER_DEPENDENCIES) $(OBJS) $(OUTPUTFILE)
@echo $(OUTPUTFILE) $(QUIET_ECHO_POSTFIX)
endif
.PHONY: clean cleantargets cleanandremove rebuild relink RemoveOutputFile SingleFile
rebuild :
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) cleanandremove
$(MAKE) -f $(firstword $(MAKEFILE_LIST))
# Use the relink target to force to relink the project.
relink: RemoveOutputFile all
RemoveOutputFile:
rm -f $(OUTPUTFILE)
# This rule is so you can say "make SingleFile SingleFilename=/home/myname/valve_main/src/engine/language.cpp" and have it only build that file.
# It basically just translates the full filename to create a dependency on the appropriate .o file so it'll build that.
SingleFile : RemoveSingleFile $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
@echo ""
RemoveSingleFile:
$(QUIET_PREFIX) rm -f $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
clean:
ifneq "$(OBJ_DIR)" ""
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
$(QUIET_PREFIX) rm -rf $(OBJ_DIR)
endif
ifneq "$(OUTPUTFILE)" ""
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
echo "p4 revert $(OUTPUTFILE)"; \
$(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \
fi;
endif
ifneq "$(OTHER_DEPENDENCIES)" ""
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
$(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES)
endif
ifneq "$(GAMEOUTPUTFILE)" ""
$(QUIET_PREFIX) echo "p4 revert $(GAMEOUTPUTFILE)"
$(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END)
endif
# Do the above cleaning, except with p4 edit and rm. Reason being ar crs adds and replaces obj files to the
# archive. However if you've renamed or deleted a source file, $(AR) won't remove it. This can leave
# us with archive files that have extra unused symbols, and also potentially cause compilation errors
# when you rename a file and have many duplicate symbols.
cleanandremove:
ifneq "$(OBJ_DIR)" ""
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
$(QUIET_PREFIX) -rm -rf $(OBJ_DIR)
endif
ifneq "$(OUTPUTFILE)" ""
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
echo "p4 edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \
$(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \
fi;
$(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT);
endif
ifneq "$(OTHER_DEPENDENCIES)" ""
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
$(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES)
endif
ifneq "$(GAMEOUTPUTFILE)" ""
$(QUIET_PREFIX) echo "p4 edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)"
$(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END)
$(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE)
endif
# This just deletes the final targets so it'll do a relink next time we build.
cleantargets:
$(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE)
$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
$(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES);
SO_GameOutputFile = $(GAMEOUTPUTFILE)
# Remove the target before installing a file over it; this prevents existing
# instances of the game from crashing due to the overwrite.
$(SO_GameOutputFile): $(SO_File)
$(QUIET_PREFIX) \
$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END) && \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END);
$(QUIET_PREFIX) -mkdir -p `dirname $(GAMEOUTPUTFILE)` > /dev/null;
$(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) if [ "$(COPY_DLL_TO_SRV)" = "1" ]; then\
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO $(Srv_GAMEOUTPUTFILE) ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
cp -v $(GAMEOUTPUTFILE) $(Srv_GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);\
cp -v $(GAMEOUTPUTFILE)$(SYM_EXT) $(Srv_GAMEOUTPUTFILE)$(SYM_EXT) $(QUIET_ECHO_POSTFIX);\
fi;
$(QUIET_PREFIX) if [ "$(IMPORTLIBRARY)" != "" ]; then\
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO IMPORT LIBRARY $(IMPORTLIBRARY) ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
$(P4_EDIT_START) $(IMPORTLIBRARY) $(P4_EDIT_END) && \
mkdir -p `dirname $(IMPORTLIBRARY)` > /dev/null && \
cp -v $(OUTPUTFILE) $(IMPORTLIBRARY); \
fi;
$(SO_File): $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
$(QUIET_PREFIX) \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- LINKING $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
\
$(LINK) $(LINK_MAP_FLAGS) $(SHLIBLDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_SHLIB) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_SHLIB);
$(VSIGN) -signvalve $(OUTPUTFILE);
$(EXE_File) : $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
$(QUIET_PREFIX) \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- LINKING EXE $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
\
$(P4_EDIT_START) $(OUTPUTFILE) $(P4_EDIT_END);\
$(LINK) $(LINK_MAP_FLAGS) $(LDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_EXE) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_EXE);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
$(QUIET_PREFIX) $(GEN_SYM) $(OUTPUTFILE);
$(QUIET_PREFIX) -$(STRIP) $(OUTPUTFILE);
$(QUIET_PREFIX) $(VSIGN) -signvalve $(OUTPUTFILE);
tags:
etags -a -C -o $(SRCROOT)/TAGS *.cpp *.cxx *.h *.hxx

View File

@ -0,0 +1,507 @@
#
# Base makefile for Linux and OSX
#
# !!!!! Note to future editors !!!!!
#
# before you make changes, make sure you grok:
# 1. the difference between =, :=, +=, and ?=
# 2. how and when this base makefile gets included in the generated makefile(s)
# ( see http://www.gnu.org/software/make/manual/make.html#Flavors )
#
# Command line prefixes:
# - errors are ignored
# @ command is not printed to stdout before being executed
# + command is executed even if Make is invoked in "do not exec" mode
OS := $(shell uname)
HOSTNAME := $(shell hostname)
-include $(SRCROOT)/devtools/steam_def.mak
-include $(SRCROOT)/devtools/sourcesdk_def.mak
# To build with clang, set the following in your environment:
# CC = clang
# CXX = clang++
ifeq ($(CFG), release)
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3.
# There also was no speed difference running at 1280x1024. May 2012, mikesart.
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
# -fno-omit-frame-pointer: need this for stack traces with perf.
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
else
OptimizerLevel_CompilerSpecific = -Og
#-O1 -finline-functions
endif
# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
ARCH_FLAGS = -fabi-compat-version=2 -fabi-version=2 -fpic -fno-plt -fcf-protection=none -fno-stack-protector -fno-stack-clash-protection
BUILDING_MULTI_ARCH = 0
CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive
# turns these into warnings in gcc, and -Wno-c++11-narrowing suppresses them entirely in clang 3.1+.
ifeq ($(CXX),clang++)
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
else
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-narrowing -fpermissive
endif
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE -D_GLIBCXX_USE_CXX11_ABI=0
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel) -fuse-ld=gold
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
MAP_FLAGS =
Srv_GAMEOUTPUTFILE =
COPY_DLL_TO_SRV = 0
ifeq ($(STEAM_BRANCH),1)
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
else
WARN_FLAGS = -Wno-write-strings -Wno-multichar
endif
WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -fdiagnostics-show-option -Wformat -Wformat-security
ifeq ($(OS),Linux)
# We should always specify -Wl,--build-id, as documented at:
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
LDFLAGS += -Wl,--build-id
# Set USE_VALVE_BINDIR to build with /Steam/tools/linux in the /valve/bin path.
# Dedicated server uses this.
ifeq ($(USE_VALVE_BINDIR),1)
# dedicated server flags
ifeq ($(TARGET_PLATFORM),linux64)
VALVE_BINDIR = /valve/bin64/
else
VALVE_BINDIR = /valve/bin/
endif
STRIP_FLAGS =
else
# linux desktop client flags
VALVE_BINDIR =
# If the steam-runtime is available, use it. We should just default to using it when
# buildbot and everyone has a bit of time to get it installed.
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
# The steam-runtime is incompatible with clang at this point, so disable it
# if clang is enabled.
ifneq ($(CXX),clang++)
VALVE_BINDIR = /valve/steam-runtime/bin/
endif
endif
GCC_VER =
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
# So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2.
STRIP_FLAGS = -x
endif
# nocona = MMX, SSE, SSE2, SSE3
MARCH_TARGET = nocona
MTUNE_TARGET = generic
ifeq ($(CXX),clang++)
# Clang does not support -mfpmath=sse because it uses whatever
# instruction set extensions are available by default.
SSE_GEN_FLAGS = -msse2
else
SSE_GEN_FLAGS = -msse2 -mfpmath=sse
endif
CCACHE := $(SRCROOT)/devtools/bin/linux/ccache
ifeq ($(origin GCC_VER), undefined)
GCC_VER=-4.6
endif
ifeq ($(origin AR), default)
AR = $(VALVE_BINDIR)ar crs
endif
ifeq ($(origin CC),default)
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
endif
ifeq ($(origin CXX), default)
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
endif
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
# a ccache quirk. Could also upgrade ccache.
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
ifeq ($(CC),clang)
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
endif
ifeq ($(CXX),clang++)
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
endif
LINK ?= $(CC)
ifeq ($(TARGET_PLATFORM),linux64)
ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=$(MTUNE_TARGET)
LD_SO = ld-linux-x86_64.so.2
LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a)
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
else
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=$(MTUNE_TARGET)
LD_SO = ld-linux.so.2
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LDFLAGS += -m32
endif
GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh
ifeq ($(CFG),release)
STRIP ?= strip $(STRIP_FLAGS) -S
# CFLAGS += -ffunction-sections -fdata-sections
# LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections
else
STRIP ?= true
endif
VSIGN ?= true
ifeq ($(SOURCE_SDK), 1)
Srv_GAMEOUTPUTFILE := $(GAMEOUTPUTFILE:.so=_srv.so)
COPY_DLL_TO_SRV := 1
endif
LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map
SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined
_WRAP := -Xlinker --wrap=
PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRAP)access $(_WRAP)__xstat \
$(_WRAP)stat $(_WRAP)lstat $(_WRAP)fopen64 $(_WRAP)open64 $(_WRAP)opendir $(_WRAP)__lxstat \
$(_WRAP)chmod $(_WRAP)chown $(_WRAP)lchown $(_WRAP)symlink $(_WRAP)link $(_WRAP)__lxstat64 \
$(_WRAP)mknod $(_WRAP)utimes $(_WRAP)unlink $(_WRAP)rename $(_WRAP)utime $(_WRAP)__xstat64 \
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath
LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_SHLIB = -Wl,--end-group $(SRCROOT)/devtools/gcc9+support.o -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
endif
ifeq ($(OS),Darwin)
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
MAC_SDK_VER ?= 10.6
MAC_SDK := macosx$(MAC_SDK_VER)
SYSROOT := $(shell xcodebuild -sdk $(MAC_SDK) -version Path)
ifneq ($(origin MAC_SDK_VER), file)
$(warning Attempting build with SDK version $(MAC_SDK_VER), only 10.6 is supported and recommended!)
endif
ifeq ($(SYSROOT),)
FIRSTSDK := $(firstword $(sort $(shell xcodebuild -showsdks | grep macosx | sed 's/.*macosx//')))
$(error Could not find SDK version $(MAC_SDK_VER). Install and configure Xcode 4.3, or build with: make MAC_SDK_VER=$(FIRSTSDK))
endif
ifeq ($(origin CC), default)
# Test to see if you have a compiler in the right place, if you
# don't abort with an error
CLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang)
ifeq ($(wildcard $(CLANG)),)
$(error Unable to find C compiler, install and configure Xcode 4.3)
endif
CC := $(CCACHE) $(CLANG) -Qunused-arguments
endif
ifeq ($(origin CXX), default)
CXXLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang++)
ifeq ($(wildcard $(CXXLANG)),)
$(error Unable to find C++ compiler, install and configure Xcode 4.3)
endif
CXX := $(CCACHE) $(CXXLANG) -Qunused-arguments
endif
LINK ?= $(CXX)
ifeq ($(origin AR), default)
AR := $(shell xcrun -sdk $(MAC_SDK) -find libtool) -static -o
endif
ifeq ($(TARGET_PLATFORM),osx64)
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
else
# dirty hack to build a universal binary - don't specify the architecture
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
endif
GEN_SYM ?= $(shell xcrun -sdk $(MAC_SDK) -find dsymutil)
ifeq ($(CFG),release)
STRIP ?= strip -S
else
STRIP ?= true
endif
ifeq ($(SOURCE_SDK), 1)
VSIGN ?= true
else
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
endif
CPPFLAGS += -I$(SYSROOT)/usr/include/malloc
CFLAGS += -isysroot $(SYSROOT) -mmacosx-version-min=10.5 -fasm-blocks
LIB_START_EXE = -lm -ldl -lpthread
LIB_END_EXE =
LIB_START_SHLIB =
LIB_END_SHLIB =
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
endif
endif
#
# Profile-directed optimizations.
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
#
# First, uncomment these, build, and test. It will generate .gcda and .gcno files where the .o files are.
# PROFILE_LINKER_FLAG=-fprofile-arcs
# PROFILE_COMPILER_FLAG=-fprofile-arcs
#
# Then, comment the above flags out again and rebuild with this flag uncommented:
# PROFILE_COMPILER_FLAG=-fprofile-use
#
#############################################################################
# The compiler command lne for each src code file to compile
#############################################################################
OBJ_DIR = ./obj_$(NAME)_$(TARGET_PLATFORM)$(TARGET_PLATFORM_EXT)/$(CFG)
CPP_TO_OBJ = $(CPPFILES:.cpp=.o)
CXX_TO_OBJ = $(CPP_TO_OBJ:.cxx=.o)
CC_TO_OBJ = $(CXX_TO_OBJ:.cc=.o)
MM_TO_OBJ = $(CC_TO_OBJ:.mm=.o)
C_TO_OBJ = $(MM_TO_OBJ:.c=.o)
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ)))
ifeq ($(MAKE_VERBOSE),1)
QUIET_PREFIX =
QUIET_ECHO_POSTFIX =
else
QUIET_PREFIX = @
QUIET_ECHO_POSTFIX = > /dev/null
endif
ifeq ($(MAKE_CC_VERBOSE),1)
CC += -v
endif
ifeq ($(CONFTYPE),lib)
LIB_File = $(OUTPUTFILE)
endif
ifeq ($(CONFTYPE),dll)
SO_File = $(OUTPUTFILE)
endif
ifeq ($(CONFTYPE),exe)
EXE_File = $(OUTPUTFILE)
endif
# we generate dependencies as a side-effect of compilation now
GEN_DEP_FILE=
PRE_COMPILE_FILE =
POST_COMPILE_FILE =
ifeq ($(BUILDING_MULTI_ARCH),1)
SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS))
COMPILE_FILE = \
$(QUIET_PREFIX) \
echo "---- $(lastword $(subst /, ,$<)) as MULTIARCH----";\
mkdir -p $(OBJ_DIR) && \
$(CXX) $(SINGLE_ARCH_CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $< && \
$(CXX) $(CXXFLAGS) -o $@ -c $<
else
COMPILE_FILE = \
$(QUIET_PREFIX) \
echo "---- $(lastword $(subst /, ,$<)) ----";\
mkdir -p $(OBJ_DIR) && \
$(CXX) $(CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $<
endif
ifneq "$(origin VALVE_NO_AUTO_P4)" "undefined"
P4_EDIT_START = chmod -R +w
P4_EDIT_END = || true
P4_REVERT_START = true
P4_REVERT_END =
else
ifndef P4_EDIT_CHANGELIST
# You can use an environment variable to specify what changelist to check the Linux Binaries out into. Normally the default
# setting is best, but here is an alternate example:
# export P4_EDIT_CHANGELIST_CMD="echo 1424335"
# ?= means that if P4_EDIT_CHANGELIST_CMD is already set it won't be changed.
P4_EDIT_CHANGELIST_CMD ?= p4 changes -c `p4 client -o | grep ^Client | cut -f 2` -s pending | fgrep 'POSIX Auto Checkout' | cut -d' ' -f 2 | tail -n 1
P4_EDIT_CHANGELIST := $(shell $(P4_EDIT_CHANGELIST_CMD))
endif
ifeq ($(P4_EDIT_CHANGELIST),)
# If we haven't found a changelist to check out to then create one. The name must match the one from a few
# lines above or else a new changelist will be created each time.
# Warning: the behavior of 'echo' is not consistent. In bash you need the "-e" option in order for \n to be
# interpreted as a line-feed, but in dash you do not, and if "-e" is passed along then it is printed, which
# confuses p4. So, if you run this command from the bash shell don't forget to add "-e" to the echo command.
P4_EDIT_CHANGELIST = $(shell echo "Change: new\nDescription: POSIX Auto Checkout" | p4 change -i | cut -f 2 -d ' ')
endif
P4_EDIT_START := for f in
P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - edit -c $(P4_EDIT_CHANGELIST); else p4 edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
P4_REVERT_START := for f in
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - revert; else p4 revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
endif
ifeq ($(CONFTYPE),dll)
all: $(OTHER_DEPENDENCIES) $(OBJS) $(GAMEOUTPUTFILE)
@echo $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX)
else
all: $(OTHER_DEPENDENCIES) $(OBJS) $(OUTPUTFILE)
@echo $(OUTPUTFILE) $(QUIET_ECHO_POSTFIX)
endif
.PHONY: clean cleantargets cleanandremove rebuild relink RemoveOutputFile SingleFile
rebuild :
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) cleanandremove
$(MAKE) -f $(firstword $(MAKEFILE_LIST))
# Use the relink target to force to relink the project.
relink: RemoveOutputFile all
RemoveOutputFile:
rm -f $(OUTPUTFILE)
# This rule is so you can say "make SingleFile SingleFilename=/home/myname/valve_main/src/engine/language.cpp" and have it only build that file.
# It basically just translates the full filename to create a dependency on the appropriate .o file so it'll build that.
SingleFile : RemoveSingleFile $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
@echo ""
RemoveSingleFile:
$(QUIET_PREFIX) rm -f $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
clean:
ifneq "$(OBJ_DIR)" ""
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
$(QUIET_PREFIX) rm -rf $(OBJ_DIR)
endif
ifneq "$(OUTPUTFILE)" ""
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
echo "p4 revert $(OUTPUTFILE)"; \
$(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \
fi;
endif
ifneq "$(OTHER_DEPENDENCIES)" ""
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
$(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES)
endif
ifneq "$(GAMEOUTPUTFILE)" ""
$(QUIET_PREFIX) echo "p4 revert $(GAMEOUTPUTFILE)"
$(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END)
endif
# Do the above cleaning, except with p4 edit and rm. Reason being ar crs adds and replaces obj files to the
# archive. However if you've renamed or deleted a source file, $(AR) won't remove it. This can leave
# us with archive files that have extra unused symbols, and also potentially cause compilation errors
# when you rename a file and have many duplicate symbols.
cleanandremove:
ifneq "$(OBJ_DIR)" ""
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
$(QUIET_PREFIX) -rm -rf $(OBJ_DIR)
endif
ifneq "$(OUTPUTFILE)" ""
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
echo "p4 edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \
$(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \
fi;
$(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT);
endif
ifneq "$(OTHER_DEPENDENCIES)" ""
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
$(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES)
endif
ifneq "$(GAMEOUTPUTFILE)" ""
$(QUIET_PREFIX) echo "p4 edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)"
$(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END)
$(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE)
endif
# This just deletes the final targets so it'll do a relink next time we build.
cleantargets:
$(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE)
$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
$(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES);
SO_GameOutputFile = $(GAMEOUTPUTFILE)
# Remove the target before installing a file over it; this prevents existing
# instances of the game from crashing due to the overwrite.
$(SO_GameOutputFile): $(SO_File)
$(QUIET_PREFIX) \
$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END) && \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END);
$(QUIET_PREFIX) -mkdir -p `dirname $(GAMEOUTPUTFILE)` > /dev/null;
$(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) if [ "$(COPY_DLL_TO_SRV)" = "1" ]; then\
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO $(Srv_GAMEOUTPUTFILE) ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
cp -v $(GAMEOUTPUTFILE) $(Srv_GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);\
cp -v $(GAMEOUTPUTFILE)$(SYM_EXT) $(Srv_GAMEOUTPUTFILE)$(SYM_EXT) $(QUIET_ECHO_POSTFIX);\
fi;
$(QUIET_PREFIX) if [ "$(IMPORTLIBRARY)" != "" ]; then\
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- COPYING TO IMPORT LIBRARY $(IMPORTLIBRARY) ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
$(P4_EDIT_START) $(IMPORTLIBRARY) $(P4_EDIT_END) && \
mkdir -p `dirname $(IMPORTLIBRARY)` > /dev/null && \
cp -v $(OUTPUTFILE) $(IMPORTLIBRARY); \
fi;
$(SO_File): $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
$(QUIET_PREFIX) \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- LINKING $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
\
$(LINK) $(LINK_MAP_FLAGS) $(SHLIBLDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_SHLIB) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_SHLIB);
$(VSIGN) -signvalve $(OUTPUTFILE);
$(EXE_File) : $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
$(QUIET_PREFIX) \
echo "----" $(QUIET_ECHO_POSTFIX);\
echo "---- LINKING EXE $@ [$(CFG)] ----";\
echo "----" $(QUIET_ECHO_POSTFIX);\
\
$(P4_EDIT_START) $(OUTPUTFILE) $(P4_EDIT_END);\
$(LINK) $(LINK_MAP_FLAGS) $(LDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_EXE) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_EXE);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
$(QUIET_PREFIX) $(GEN_SYM) $(OUTPUTFILE);
$(QUIET_PREFIX) -$(STRIP) $(OUTPUTFILE);
$(QUIET_PREFIX) $(VSIGN) -signvalve $(OUTPUTFILE);
tags:
etags -a -C -o $(SRCROOT)/TAGS *.cpp *.cxx *.h *.hxx

View File

@ -823,10 +823,10 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
if ( bufsize > 0 )
{
// Definitely in scenes.image
pBuffer = new char[ bufsize ];
pBuffer = malloc( bufsize );
if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, bufsize ) )
{
delete[] pBuffer;
free( pBuffer );
return NULL;
}
@ -866,10 +866,10 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
if ( bufsize <= 0 )
return NULL;
pBuffer = new char[ bufsize ];
pBuffer = malloc( bufsize );
if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, bufsize ) )
{
delete[] pBuffer;
free( pBuffer );
return NULL;
}
@ -897,7 +897,7 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
}
#endif
delete[] pBuffer;
free( pBuffer );
return pScene;
}
@ -1261,4 +1261,4 @@ void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene )
return;
Msg( "%d of %d animations resident\n", nResident, nChecked );
}
}

View File

@ -1468,7 +1468,8 @@ void CClientShadowMgr::InitDepthTextureShadows()
m_DummyColorTexture.InitRenderTargetSurface( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), IMAGE_FORMAT_BGR565, true );
#else
#if defined(MAPBASE) //&& !defined(ASW_PROJECTED_TEXTURES)
m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
// SAUL: we want to create a render target of specific size, so use RT_SIZE_NO_CHANGE
m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_NO_CHANGE, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
#else
m_DummyColorTexture.InitRenderTarget( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
#endif
@ -2135,7 +2136,7 @@ ClientShadowHandle_t CClientShadowMgr::CreateProjectedTexture( ClientEntityHandl
{
pShadowMaterial = NULL; // these materials aren't used for shadow depth texture shadows.
pShadowModelMaterial = NULL;
pShadowProxyData = (void*)h;
pShadowProxyData = (void*)(uintp)h;
}
#else
if( flags & SHADOW_FLAGS_USE_DEPTH_TEXTURE )

View File

@ -440,7 +440,8 @@ const QAngle &C_PlayerViewProxy::EyeAngles( void )
float fldummy;
pPlayer->CalcView( vecOrigin, angAngles, fldummy, fldummy, fldummy );
return GetAbsAngles() + (angAngles - pPlayer->GetAbsAngles());
angAngles = GetAbsAngles() + (angAngles - pPlayer->GetAbsAngles());
return angAngles;
//return m_hPlayer.Get()->EyeAngles();
}
@ -474,8 +475,11 @@ void C_PlayerViewProxy::GetEyePosition( Vector &vecOrigin, QAngle &angAngles )
const QAngle &C_PlayerViewProxy::LocalEyeAngles( void )
{
C_BasePlayer *pPlayer = GetPlayer();
if (pPlayer)
return GetAbsAngles() + (pPlayer->LocalEyeAngles() - pPlayer->GetAbsAngles());
if (pPlayer) {
static QAngle angAngles;
angAngles = GetAbsAngles() + (pPlayer->LocalEyeAngles() - pPlayer->GetAbsAngles());
return angAngles;
}
else
return BaseClass::LocalEyeAngles();
}

View File

@ -134,10 +134,13 @@ void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, const char *szFilena
pTemp = pTemp->GetNextKey();
}
}
}
// Failed for some reason. Delete the Key data and abort.
pKeyValuesData->deleteThis();
pKeyValuesData->deleteThis();
}
else
{
Warning( "Unable to read script %s.\n", szFilenameWithoutExtension );
}
}
//-----------------------------------------------------------------------------

View File

@ -15092,7 +15092,7 @@ void CAI_BaseNPC::CalculateValidEnemyInteractions( void )
pPlayer->ModifyOrAppendPlayerCriteria( set );
ReAppendContextCriteria( set );
DevMsg("Testing %s misc criteria\n", pInteraction->MiscCriteria);
DevMsg("Testing %s misc criteria\n", STRING(pInteraction->MiscCriteria));
int index;
const char *criteriavalue;

View File

@ -441,7 +441,7 @@ void CAI_Expresser::MergeModifiers( AI_CriteriaSet& set, const char *modifiers )
// NULL -
// Output : AI_Response
//-----------------------------------------------------------------------------
AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet &modifiers )
AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet &modifiers )
{
IResponseSystem *rs = GetOuter()->GetResponseSystem();
if ( !rs )
@ -536,7 +536,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, AI_CriteriaS
// Input : *response -
//-----------------------------------------------------------------------------
#ifdef MAPBASE
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, IRecipientFilter *filter, AI_CriteriaSet *modifiers )
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, IRecipientFilter *filter, const AI_CriteriaSet *modifiers )
#else
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, IRecipientFilter *filter /* = NULL */ )
#endif
@ -833,7 +833,7 @@ bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/
// Input : concept -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CAI_Expresser::Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
bool CAI_Expresser::Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
{
AI_Response *result = SpeakFindResponse( concept, modifiers );
if ( !result )
@ -1420,4 +1420,4 @@ void CMultiplayer_Expresser::AllowMultipleScenes()
void CMultiplayer_Expresser::DisallowMultipleScenes()
{
m_bAllowMultipleScenes = false;
}
}

View File

@ -158,15 +158,15 @@ public:
bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
#ifdef MAPBASE
bool Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
AI_Response *SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet& modifiers );
bool Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
AI_Response *SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers );
void MergeModifiers( AI_CriteriaSet& set, const char *modifiers );
#endif
// These two methods allow looking up a response and dispatching it to be two different steps
AI_Response *SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
#ifdef MAPBASE
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL, AI_CriteriaSet *modifiers = NULL );
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL, const AI_CriteriaSet *modifiers = NULL );
#else
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL );
#endif
@ -306,13 +306,13 @@ public:
virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
#ifdef MAPBASE
virtual bool Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
virtual bool Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
#endif
// These two methods allow looking up a response and dispatching it to be two different steps
AI_Response * SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
#ifdef MAPBASE
AI_Response * SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet& modifiers );
AI_Response * SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers );
#endif
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response );
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; }
@ -359,7 +359,7 @@ inline bool CAI_ExpresserHost<BASE_NPC>::Speak( AIConcept_t concept, const char
// Version of Speak() that takes a direct AI_CriteriaSet for modifiers.
//-----------------------------------------------------------------------------
template <class BASE_NPC>
inline bool CAI_ExpresserHost<BASE_NPC>::Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
inline bool CAI_ExpresserHost<BASE_NPC>::Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
{
AssertOnce( this->GetExpresser()->GetOuter() == this );
return this->GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter );
@ -411,7 +411,7 @@ inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
template <class BASE_NPC>
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet& modifiers )
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers )
{
return this->GetExpresser()->SpeakFindResponse( concept, modifiers );
}

View File

@ -3958,16 +3958,6 @@ bool CBaseCombatCharacter::IsGlowEffectActive( void )
}
#endif // GLOWS_ENABLE
#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Mapbase adds proficiency override
//-----------------------------------------------------------------------------
inline WeaponProficiency_t CBaseCombatCharacter::GetCurrentWeaponProficiency()
{
return (m_ProficiencyOverride > WEAPON_PROFICIENCY_INVALID) ? m_ProficiencyOverride : m_CurrentWeaponProficiency;
}
#endif
//-----------------------------------------------------------------------------
// Assume everyone is average with every weapon. Override this to make exceptions.
//-----------------------------------------------------------------------------

View File

@ -399,11 +399,15 @@ public:
CBaseCombatWeapon* GetWeapon( int i ) const;
bool RemoveWeapon( CBaseCombatWeapon *pWeapon );
virtual void RemoveAllWeapons();
WeaponProficiency_t GetCurrentWeaponProficiency()
{
#ifdef MAPBASE
WeaponProficiency_t GetCurrentWeaponProficiency();
// Mapbase adds proficiency override
return (m_ProficiencyOverride > WEAPON_PROFICIENCY_INVALID) ? m_ProficiencyOverride : m_CurrentWeaponProficiency;
#else
WeaponProficiency_t GetCurrentWeaponProficiency() { return m_CurrentWeaponProficiency; }
return m_CurrentWeaponProficiency;
#endif
}
void SetCurrentWeaponProficiency( WeaponProficiency_t iProficiency ) { m_CurrentWeaponProficiency = iProficiency; }
virtual WeaponProficiency_t CalcWeaponProficiency( CBaseCombatWeapon *pWeapon );
virtual Vector GetAttackSpread( CBaseCombatWeapon *pWeapon, CBaseEntity *pTarget = NULL );

View File

@ -4258,17 +4258,8 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator,
{
// found a match
char szBuffer[256];
// mapper debug message
if (pCaller != NULL)
{
Q_snprintf( szBuffer, sizeof(szBuffer), "(%0.2f) input %s: %s.%s(%s)\n", gpGlobals->curtime, STRING(pCaller->m_iName.Get()), GetDebugName(), szInputName, Value.String() );
}
else
{
Q_snprintf( szBuffer, sizeof(szBuffer), "(%0.2f) input <NULL>: %s.%s(%s)\n", gpGlobals->curtime, GetDebugName(), szInputName, Value.String() );
}
DevMsg( 2, "%s", szBuffer );
DevMsg( 2, "(%0.2f) input %s: %s.%s(%s)\n", gpGlobals->curtime, pCaller ? STRING(pCaller->m_iName.Get()) : "<NULL>", GetDebugName(), szInputName, Value.String() );
ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer );
if (m_debugOverlays & OVERLAY_MESSAGE_BIT)

View File

@ -1461,7 +1461,7 @@ public:
return TestEntityTriggerIntersection_Accurate(pVolume, pTarget);
else
{
Msg("%s cannot find target entity %s, returning false\n", STRING(m_iszVolumeTester));
Msg("%s cannot find target entity %s, returning false\n", GetDebugName(), STRING(m_iszVolumeTester));
return false;
}
}

View File

@ -1103,9 +1103,7 @@ bool g_bCheckForChainedActivate;
{ \
if ( bCheck ) \
{ \
char msg[ 1024 ]; \
Q_snprintf( msg, sizeof( msg ), "Entity (%i/%s/%s) failed to call base class Activate()\n", pClass->entindex(), pClass->GetClassname(), STRING( pClass->GetEntityName() ) ); \
AssertMsg( g_bReceivedChainedActivate == true, msg ); \
AssertMsg( g_bReceivedChainedActivate == true, "Entity (%i/%s/%s) failed to call base class Activate()\n", pClass->entindex(), pClass->GetClassname(), STRING( pClass->GetEntityName() ) ); \
} \
g_bCheckForChainedActivate = false; \
}

View File

@ -2193,7 +2193,7 @@ void CHL2_Player::InputSquadForceGoTo( inputdata_t &inputdata )
}
else
{
goal.m_pGoalEntity = var.FieldType() == FIELD_EHANDLE ? var.Entity() : gEntList.FindEntityByNameNearest(var.String(), pPlayerSquadLeader->GetAbsOrigin(), 0, this, inputdata.pActivator, inputdata.pCaller);
goal.m_pGoalEntity = var.FieldType() == FIELD_EHANDLE ? var.Entity().Get() : gEntList.FindEntityByNameNearest(var.String(), pPlayerSquadLeader->GetAbsOrigin(), 0, this, inputdata.pActivator, inputdata.pCaller);
goal.m_vecGoalLocation = vec3_invalid;
}

View File

@ -7,11 +7,11 @@
#include "cbase.h"
#include "game.h"
#include "AI_Default.h"
#include "AI_Schedule.h"
#include "AI_Hull.h"
#include "AI_Navigator.h"
#include "AI_Motor.h"
#include "ai_default.h"
#include "ai_schedule.h"
#include "ai_hull.h"
#include "ai_navigator.h"
#include "ai_motor.h"
#include "ai_squad.h"
#include "npc_bullsquid.h"
#include "npcevent.h"
@ -30,8 +30,8 @@
#include "engine/IEngineSound.h"
#include "movevars_shared.h"
#include "AI_Hint.h"
#include "AI_Senses.h"
#include "ai_hint.h"
#include "ai_senses.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

View File

@ -703,14 +703,6 @@ Class_T CNPC_Combine::Classify ( void )
}
#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
inline bool CNPC_Combine::IsElite( void )
{
return m_fIsElite;
}
//-----------------------------------------------------------------------------
// Purpose: Function for gauging whether we're capable of alt-firing.
//-----------------------------------------------------------------------------
@ -2931,14 +2923,6 @@ void CNPC_Combine::SpeakSentence( int sentenceType )
#ifdef COMBINE_SOLDIER_USES_RESPONSE_SYSTEM
//=========================================================
//=========================================================
inline bool CNPC_Combine::SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria )
{
return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria );
}
//=========================================================
//=========================================================
bool CNPC_Combine::SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria )
{
AI_CriteriaSet set;

View File

@ -104,13 +104,12 @@ public:
void Activate();
Class_T Classify( void );
bool IsElite() { return m_fIsElite; }
#ifdef MAPBASE
bool IsElite();
bool IsAltFireCapable();
bool IsGrenadeCapable();
const char* GetGrenadeAttachment() { return "lefthand"; }
#else
bool IsElite() { return m_fIsElite; }
#endif
#ifndef MAPBASE
void DelayAltFireAttack( float flDelay );
@ -190,7 +189,10 @@ public:
// Speaking
void SpeakSentence( int sentType );
#ifdef COMBINE_SOLDIER_USES_RESPONSE_SYSTEM
bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD );
bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD )
{
return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria );
}
bool SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD );
bool SpeakIfAllowed( const char *concept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD );
void ModifyOrAppendCriteria( AI_CriteriaSet& set );

View File

@ -1137,13 +1137,6 @@ void CNPC_MetroPolice::SpeakSentence( int nSentenceType )
}
#ifdef METROPOLICE_USES_RESPONSE_SYSTEM
//=========================================================
//=========================================================
inline bool CNPC_MetroPolice::SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria )
{
return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria );
}
//=========================================================
//=========================================================
bool CNPC_MetroPolice::SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria )

View File

@ -112,7 +112,10 @@ public:
// Speaking
virtual void SpeakSentence( int nSentenceType );
#ifdef METROPOLICE_USES_RESPONSE_SYSTEM
bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD );
bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD )
{
return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria );
}
bool SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD );
bool SpeakIfAllowed( const char *concept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD );
void ModifyOrAppendCriteria( AI_CriteriaSet& set );

View File

@ -4447,7 +4447,7 @@ CBaseFilter *CNPC_Strider::GetStompFilter()
}
else
{
Warning("%s stomp filter not found!", GetDebugName(), STRING(m_strStompFilter));
Warning("%s stomp filter %s not found!", GetDebugName(), STRING(m_strStompFilter));
}
}

View File

@ -581,7 +581,8 @@ const QAngle &CPlayerViewProxy::EyeAngles( void )
float fldummy;
m_hPlayer->CalcView( vecOrigin, angAngles, fldummy, fldummy, fldummy );
return GetAbsAngles() + (angAngles - m_hPlayer->GetAbsAngles());
angAngles = GetAbsAngles() + (angAngles - m_hPlayer->GetAbsAngles());
return angAngles;
//return m_hPlayer.Get()->EyeAngles();
}
@ -594,9 +595,10 @@ const QAngle &CPlayerViewProxy::EyeAngles( void )
//-----------------------------------------------------------------------------
const QAngle &CPlayerViewProxy::LocalEyeAngles( void )
{
if (m_hPlayer.Get())
return GetAbsAngles() + (m_hPlayer->LocalEyeAngles() - m_hPlayer->GetAbsAngles());
else
if (m_hPlayer.Get()) {
static QAngle angAngles = GetAbsAngles() + (m_hPlayer->LocalEyeAngles() - m_hPlayer->GetAbsAngles());
return angAngles;
} else
return BaseClass::LocalEyeAngles();
}

View File

@ -3752,14 +3752,14 @@ public:
// TODO: Replace "append" with variable arguments?
inline void LCMsg(const char *msg, const char *append = NULL) { ConColorMsg(m_MsgColor, msg, append); }
inline void LCDevMsg(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ConColorMsg(m_MsgColor, msg, append) : 0; }
inline void LCDevMsg(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ConColorMsg(m_MsgColor, msg, append) : (void)0; }
inline void LCWarning(const char *msg, const char *append = NULL) { ConColorMsg(m_WarningColor, msg, append); }
inline void LCDevWarning(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ConColorMsg(m_WarningColor, msg, append) : 0; }
inline void LCDevWarning(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ConColorMsg(m_WarningColor, msg, append) : (void)0; }
//inline void LCMsg(const char *msg, const char *append = NULL) { ColorSpewMessage(SPEW_MESSAGE, &m_MsgColor, msg, append); }
//inline void LCDevMsg(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ColorSpewMessage(SPEW_MESSAGE, &m_MsgColor, msg, append) : 0; }
//inline void LCDevMsg(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ColorSpewMessage(SPEW_MESSAGE, &m_MsgColor, msg, append) : (void)0; }
//inline void LCWarning(const char *msg, const char *append = NULL) { ColorSpewMessage(SPEW_MESSAGE, &m_WarningColor, msg, append); }
//inline void LCDevWarning(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ColorSpewMessage(SPEW_MESSAGE, &m_WarningColor, msg, append) : 0; }
//inline void LCDevWarning(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ColorSpewMessage(SPEW_MESSAGE, &m_WarningColor, msg, append) : (void)0; }
// Inputs
void InputSendMsg( inputdata_t &inputdata ) { !m_bNewLineNotAuto ? LCMsg("%s\n", inputdata.value.String()) : LCMsg("%s", inputdata.value.String()); }
@ -3772,7 +3772,7 @@ public:
// MAPBASE MP TODO: "ClearConsoleOnTarget"
// (and make this input broadcast to all players)
void InputClearConsole( inputdata_t &inputdata ) { UTIL_GetLocalPlayer() ? engine->ClientCommand(UTIL_GetLocalPlayer()->edict(), "clear") : NULL; }
void InputClearConsole( inputdata_t &inputdata ) { UTIL_GetLocalPlayer() ? engine->ClientCommand(UTIL_GetLocalPlayer()->edict(), "clear") : (void)0; }
DECLARE_DATADESC();
};
@ -4320,7 +4320,7 @@ inline float CMathClamp::ClampValue(float input, float min, float max, int *boun
{
if ( max < min )
{
Warning("WARNING: Max value (%i) less than min value (%i) in %s!\n", max, min, GetDebugName());
Warning("WARNING: Max value (%f) less than min value (%f) in %s!\n", max, min, GetDebugName());
return max;
}
else if( input < min )
@ -4750,7 +4750,7 @@ private:
bool KeyValue(const char *szKeyName, const char *szValue);
bool KeyValue( const char *szKeyName, const Vector &vecValue );
void UpdateOutValue(CBaseEntity *pActivator, Vector &vecNewValue);
void UpdateOutValue(CBaseEntity *pActivator, Vector vecNewValue);
int DrawDebugTextOverlays(void);
@ -5307,7 +5307,7 @@ void CMathVector::SubtractCoordinate(float value, char coord, CBaseEntity *pActi
// Purpose: Sets the value to the new value, firing the output value.
// Input : vecNewValue - Value to set.
//-----------------------------------------------------------------------------
void CMathVector::UpdateOutValue(CBaseEntity *pActivator, Vector &vecNewValue)
void CMathVector::UpdateOutValue(CBaseEntity *pActivator, Vector vecNewValue)
{
if (HasSpawnFlags( SF_MATH_VECTOR_DISABLE_X ))
vecNewValue.x = 0;
@ -5808,7 +5808,7 @@ void CLogicModelInfo::InputLookupActivity( inputdata_t &inputdata )
iActivity = atoi(inputdata.value.String());
if (!ActivityList_NameForIndex(iActivity))
{
Msg("%s received invalid LookupActivity %s\n", inputdata.value.String());
Msg("%s received invalid LookupActivity %s\n", GetDebugName(), inputdata.value.String());
return;
}
}
@ -5896,8 +5896,8 @@ private:
CBaseEntity *GetTarget(CBaseEntity *pActivator, CBaseEntity *pCaller);
const Vector &GetPosition(CBaseEntity *pEntity);
const QAngle &GetAngles(CBaseEntity *pEntity);
Vector GetPosition(CBaseEntity *pEntity);
QAngle GetAngles(CBaseEntity *pEntity);
// Inputs
void InputGetPosition( inputdata_t &inputdata );
@ -5945,7 +5945,7 @@ inline CBaseEntity *CLogicEntityPosition::GetTarget(CBaseEntity *pActivator, CBa
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const Vector &CLogicEntityPosition::GetPosition(CBaseEntity *pEntity)
Vector CLogicEntityPosition::GetPosition(CBaseEntity *pEntity)
{
switch (m_iPositionType)
{
@ -5963,8 +5963,7 @@ const Vector &CLogicEntityPosition::GetPosition(CBaseEntity *pEntity)
break;
}
// Attachment position doesn't originate anywhere, so use a static variable
static Vector vecPosition;
Vector vecPosition;
pAnimating->GetAttachment(STRING(m_iszPositionParameter), vecPosition);
return vecPosition;
}
@ -5975,16 +5974,15 @@ const Vector &CLogicEntityPosition::GetPosition(CBaseEntity *pEntity)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const QAngle &CLogicEntityPosition::GetAngles(CBaseEntity *pEntity)
QAngle CLogicEntityPosition::GetAngles(CBaseEntity *pEntity)
{
const QAngle *angAngles = &vec3_angle;
switch (m_iPositionType)
{
case POSITION_BBOX:
case POSITION_EARS:
case POSITION_ORIGIN: angAngles = &pEntity->GetAbsAngles(); break;
case POSITION_LOCAL: angAngles = &pEntity->GetLocalAngles(); break;
case POSITION_EYES: angAngles = &pEntity->EyeAngles(); break;
case POSITION_ORIGIN: return pEntity->GetAbsAngles(); break;
case POSITION_LOCAL: return pEntity->GetLocalAngles(); break;
case POSITION_EYES: return pEntity->EyeAngles(); break;
case POSITION_ATTACHMENT:
{
CBaseAnimating *pAnimating = pEntity->GetBaseAnimating();
@ -5994,16 +5992,15 @@ const QAngle &CLogicEntityPosition::GetAngles(CBaseEntity *pEntity)
break;
}
// Attachment angles don't originate anywhere, so use a static variable
static QAngle AttachmentAngles;
QAngle AttachmentAngles;
matrix3x4_t attachmentToWorld;
pAnimating->GetAttachment( pAnimating->LookupAttachment( STRING( m_iszPositionParameter ) ), attachmentToWorld );
MatrixAngles( attachmentToWorld, AttachmentAngles );
angAngles = &AttachmentAngles;
return AttachmentAngles;
} break;
}
return *angAngles;
return vec3_angle;
}
//-----------------------------------------------------------------------------

View File

@ -56,19 +56,6 @@ string_t gm_isz_name_activator;
// -------------------------------------------------------------
// Does the classname of this entity match the string_t?
//
// This function is for comparing global strings and allows us to change how we compare them quickly.
inline bool EntIsClass( CBaseEntity *ent, string_t str2 )
{
//return ent->ClassMatches(str2);
// Since classnames are pooled, the global string and the entity's classname should point to the same string in memory.
// As long as this rule is preserved, we only need a pointer comparison. A string comparison isn't necessary.
// Feel free to correct me if I'm disastrously wrong.
return ent->m_iClassname == str2;
}
// We know it hasn't been allocated yet
#define INITIALIZE_GLOBAL_STRING(string, text) string = AllocPooledString(text) //SetGlobalString(string, text)

View File

@ -5,6 +5,12 @@
// $NoKeywords: $
//=============================================================================
#ifndef MAPBASE_GLOBAL_STRINGS_H
#define MAPBASE_GLOBAL_STRINGS_H
#ifdef _WIN32
#pragma once
#endif
#include "cbase.h"
// -------------------------------------------------------------
@ -67,10 +73,20 @@ extern string_t gm_isz_name_activator;
// Does the classname of this entity match the string_t?
//
// This function is for comparing global strings and allows us to change how we compare them quickly.
extern bool EntIsClass( CBaseEntity *ent, string_t str2 );
inline bool EntIsClass( CBaseEntity *ent, string_t str2 )
{
//return ent->ClassMatches(str2);
// Since classnames are pooled, the global string and the entity's classname should point to the same string in memory.
// As long as this rule is preserved, we only need a pointer comparison. A string comparison isn't necessary.
// Feel free to correct me if I'm disastrously wrong.
return ent->m_iClassname == str2;
}
// -------------------------------------------------------------
extern void InitGlobalStrings();
void InitGlobalStrings();
// -------------------------------------------------------------
#endif

View File

@ -72,7 +72,7 @@ void CV_GlobalChange_Mapbase( IConVar *var, const char *pOldString, float flOldV
//-----------------------------------------------------------------------------
void CC_MapbaseNotChangingCVars( void )
{
SetChangingCVars( false );
SetChangingCVars( NULL );
}
static ConCommand mapbase_cvarsnotchanging("mapbase_cvarsnotchanging", CC_MapbaseNotChangingCVars, "An internal command used for ConVar modification.", FCVAR_HIDDEN);

View File

@ -91,6 +91,7 @@ template <class BASE_NPC>
class CAI_GrenadeUser : public BASE_NPC, public CAI_GrenadeUserSink
{
DECLARE_CLASS_NOFRIEND( CAI_GrenadeUser, BASE_NPC );
public:
CAI_GrenadeUser() : CAI_GrenadeUserSink() { }
@ -162,8 +163,8 @@ void CAI_GrenadeUser<BASE_NPC>::HandleAnimEvent( animevent_t *pEvent )
{
if ( pEvent->event == COMBINE_AE_BEGIN_ALTFIRE )
{
if (GetActiveWeapon())
GetActiveWeapon()->WeaponSound( SPECIAL1 );
if (this->GetActiveWeapon())
this->GetActiveWeapon()->WeaponSound( SPECIAL1 );
//SpeakIfAllowed( TLK_CMB_THROWGRENADE, "altfire:1" );
return;
@ -176,8 +177,8 @@ void CAI_GrenadeUser<BASE_NPC>::HandleAnimEvent( animevent_t *pEvent )
fakeEvent.event = EVENT_WEAPON_AR2_ALTFIRE;
// Weapon could've been dropped while playing animation
if (GetActiveWeapon())
GetActiveWeapon()->Operator_HandleAnimEvent( &fakeEvent, this );
if (this->GetActiveWeapon())
this->GetActiveWeapon()->Operator_HandleAnimEvent( &fakeEvent, this );
// Stop other squad members from combine balling for a while.
DelaySquadAltFireAttack( 10.0f );
@ -195,25 +196,25 @@ void CAI_GrenadeUser<BASE_NPC>::HandleAnimEvent( animevent_t *pEvent )
vecSpin.z = random->RandomFloat( -1000.0, 1000.0 );
Vector vecStart;
GetAttachment( GetGrenadeAttachment(), vecStart );
this->GetAttachment( GetGrenadeAttachment(), vecStart );
if( m_NPCState == NPC_STATE_SCRIPT )
if( this->GetState() == NPC_STATE_SCRIPT )
{
// Use a fixed velocity for grenades thrown in scripted state.
// Grenades thrown from a script do not count against grenades remaining for the AI to use.
Vector forward, up, vecThrow;
GetVectors( &forward, NULL, &up );
this->GetVectors( &forward, NULL, &up );
vecThrow = forward * 750 + up * 175;
// This code is used by player allies now, so it's only "combine spawned" if the thrower isn't allied with the player.
CBaseEntity *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, vecThrow, vecSpin, this, COMBINE_GRENADE_TIMER, !IsPlayerAlly() );
CBaseEntity *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, vecThrow, vecSpin, this, COMBINE_GRENADE_TIMER, !this->IsPlayerAlly() );
m_OnThrowGrenade.Set(pGrenade, pGrenade, this);
}
else
{
// Use the Velocity that AI gave us.
CBaseEntity *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, m_vecTossVelocity, vecSpin, this, COMBINE_GRENADE_TIMER, !IsPlayerAlly() );
CBaseEntity *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, m_vecTossVelocity, vecSpin, this, COMBINE_GRENADE_TIMER, !this->IsPlayerAlly() );
m_OnThrowGrenade.Set(pGrenade, pGrenade, this);
AddGrenades(-1, pGrenade);
}
@ -235,20 +236,20 @@ template <class BASE_NPC>
void CAI_GrenadeUser<BASE_NPC>::InputThrowGrenadeAtTarget( inputdata_t &inputdata )
{
// Ignore if we're inside a scripted sequence
if ( m_NPCState == NPC_STATE_SCRIPT && m_hCine )
if ( this->GetState() == NPC_STATE_SCRIPT && this->m_hCine )
return;
CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, inputdata.value.String(), this, inputdata.pActivator, inputdata.pCaller );
if ( !pEntity )
{
DevMsg("%s (%s) received ThrowGrenadeAtTarget input, but couldn't find target entity '%s'\n", GetClassname(), GetDebugName(), inputdata.value.String() );
DevMsg("%s (%s) received ThrowGrenadeAtTarget input, but couldn't find target entity '%s'\n", this->GetClassname(), this->GetDebugName(), inputdata.value.String() );
return;
}
m_hForcedGrenadeTarget = pEntity;
m_flNextGrenadeCheck = 0;
ClearSchedule( "Told to throw grenade via input" );
this->ClearSchedule( "Told to throw grenade via input" );
}
//-----------------------------------------------------------------------------
@ -262,33 +263,33 @@ bool CAI_GrenadeUser<BASE_NPC>::CanAltFireEnemy( bool bUseFreeKnowledge )
if (!IsAltFireCapable())
return false;
if (!GetActiveWeapon())
if (!this->GetActiveWeapon())
return false;
if (IsCrouching())
if (this->IsCrouching())
return false;
if ( gpGlobals->curtime < m_flNextAltFireTime || gpGlobals->curtime < m_flNextGrenadeCheck )
return false;
if( !GetEnemy() )
if( !this->GetEnemy() )
return false;
if (!EntIsClass(GetActiveWeapon(), gm_isz_class_AR2) && !EntIsClass(GetActiveWeapon(), gm_isz_class_SMG1))
if (!EntIsClass(this->GetActiveWeapon(), gm_isz_class_AR2) && !EntIsClass(this->GetActiveWeapon(), gm_isz_class_SMG1))
return false;
CBaseEntity *pEnemy = GetEnemy();
CBaseEntity *pEnemy = this->GetEnemy();
Vector vecTarget;
// Determine what point we're shooting at
if( bUseFreeKnowledge )
{
vecTarget = GetEnemies()->LastKnownPosition( pEnemy ) + (pEnemy->GetViewOffset()*0.75);// approximates the chest
vecTarget = this->GetEnemies()->LastKnownPosition( pEnemy ) + (pEnemy->GetViewOffset()*0.75);// approximates the chest
}
else
{
vecTarget = GetEnemies()->LastSeenPosition( pEnemy ) + (pEnemy->GetViewOffset()*0.75);// approximates the chest
vecTarget = this->GetEnemies()->LastSeenPosition( pEnemy ) + (pEnemy->GetViewOffset()*0.75);// approximates the chest
}
// Trace a hull about the size of the combine ball (don't shoot through grates!)
@ -297,11 +298,11 @@ bool CAI_GrenadeUser<BASE_NPC>::CanAltFireEnemy( bool bUseFreeKnowledge )
Vector mins( -12, -12, -12 );
Vector maxs( 12, 12, 12 );
Vector vShootPosition = EyePosition();
Vector vShootPosition = this->EyePosition();
if ( GetActiveWeapon() )
if ( this->GetActiveWeapon() )
{
GetActiveWeapon()->GetAttachment( "muzzle", vShootPosition );
this->GetActiveWeapon()->GetAttachment( "muzzle", vShootPosition );
}
// Trace a hull about the size of the combine ball.
@ -350,7 +351,8 @@ void CAI_GrenadeUser<BASE_NPC>::DelaySquadAltFireAttack( float flDelay )
DelayAltFireAttack( flDelay );
AISquadIter_t iter;
CAI_BaseNPC *pSquadmate = m_pSquad ? m_pSquad->GetFirstMember( &iter ) : NULL;
CAI_Squad *pSquad = this->GetSquad();
CAI_BaseNPC *pSquadmate = pSquad ? pSquad->GetFirstMember( &iter ) : NULL;
while ( pSquadmate )
{
CAI_GrenadeUser *pUser = dynamic_cast<CAI_GrenadeUser*>(pSquadmate);
@ -359,7 +361,7 @@ void CAI_GrenadeUser<BASE_NPC>::DelaySquadAltFireAttack( float flDelay )
pUser->DelayAltFireAttack( flDelay );
}
pSquadmate = m_pSquad->GetNextMember( &iter );
pSquadmate = pSquad->GetNextMember( &iter );
}
}
@ -368,25 +370,25 @@ void CAI_GrenadeUser<BASE_NPC>::DelaySquadAltFireAttack( float flDelay )
template <class BASE_NPC>
bool CAI_GrenadeUser<BASE_NPC>::CanGrenadeEnemy( bool bUseFreeKnowledge )
{
CBaseEntity *pEnemy = GetEnemy();
CBaseEntity *pEnemy = this->GetEnemy();
Assert( pEnemy != NULL );
if( pEnemy )
{
// I'm not allowed to throw grenades during dustoff
if ( IsCurSchedule(SCHED_DROPSHIP_DUSTOFF) )
if ( this->IsCurSchedule(SCHED_DROPSHIP_DUSTOFF) )
return false;
if( bUseFreeKnowledge )
{
// throw to where we think they are.
return CanThrowGrenade( GetEnemies()->LastKnownPosition( pEnemy ) );
return CanThrowGrenade( this->GetEnemies()->LastKnownPosition( pEnemy ) );
}
else
{
// hafta throw to where we last saw them.
return CanThrowGrenade( GetEnemies()->LastSeenPosition( pEnemy ) );
return CanThrowGrenade( this->GetEnemies()->LastSeenPosition( pEnemy ) );
}
}
@ -421,7 +423,7 @@ bool CAI_GrenadeUser<BASE_NPC>::CanThrowGrenade( const Vector &vecTarget )
}
float flDist;
flDist = ( vecTarget - GetAbsOrigin() ).Length();
flDist = ( vecTarget - this->GetAbsOrigin() ).Length();
if( flDist > 1024 || flDist < 128 )
{
@ -433,15 +435,16 @@ bool CAI_GrenadeUser<BASE_NPC>::CanThrowGrenade( const Vector &vecTarget )
// -----------------------
// If moving, don't check.
// -----------------------
if ( m_flGroundSpeed != 0 )
if ( this->m_flGroundSpeed != 0 )
return false;
// ---------------------------------------------------------------------
// Are any of my squad members near the intended grenade impact area?
// ---------------------------------------------------------------------
if ( m_pSquad )
CAI_Squad *pSquad = this->GetSquad();
if ( pSquad )
{
if (m_pSquad->SquadMemberInRange( vecTarget, COMBINE_MIN_GRENADE_CLEAR_DIST ))
if (pSquad->SquadMemberInRange( vecTarget, COMBINE_MIN_GRENADE_CLEAR_DIST ))
{
// crap, I might blow my own guy up. Don't throw a grenade and don't check again for a while.
m_flNextGrenadeCheck = gpGlobals->curtime + 1; // one full second.
@ -464,7 +467,7 @@ bool CAI_GrenadeUser<BASE_NPC>::CanThrowGrenade( const Vector &vecTarget )
template <class BASE_NPC>
bool CAI_GrenadeUser<BASE_NPC>::CheckCanThrowGrenade( const Vector &vecTarget )
{
//NDebugOverlay::Line( EyePosition(), vecTarget, 0, 255, 0, false, 5 );
//NDebugOverlay::Line( this->EyePosition(), vecTarget, 0, 255, 0, false, 5 );
// ---------------------------------------------------------------------
// Check that throw is legal and clear
@ -473,21 +476,21 @@ bool CAI_GrenadeUser<BASE_NPC>::CheckCanThrowGrenade( const Vector &vecTarget )
Vector vecToss;
Vector vecMins = -Vector(4,4,4);
Vector vecMaxs = Vector(4,4,4);
if( FInViewCone( vecTarget ) && CBaseEntity::FVisible( vecTarget ) )
if( this->FInViewCone( vecTarget ) && CBaseEntity::FVisible( vecTarget ) )
{
vecToss = VecCheckThrow( this, EyePosition(), vecTarget, COMBINE_GRENADE_THROW_SPEED, 1.0, &vecMins, &vecMaxs );
vecToss = VecCheckThrow( this, this->EyePosition(), vecTarget, COMBINE_GRENADE_THROW_SPEED, 1.0, &vecMins, &vecMaxs );
}
else
{
// Have to try a high toss. Do I have enough room?
trace_t tr;
AI_TraceLine( EyePosition(), EyePosition() + Vector( 0, 0, 64 ), MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );
AI_TraceLine( this->EyePosition(), this->EyePosition() + Vector( 0, 0, 64 ), MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );
if( tr.fraction != 1.0 )
{
return false;
}
vecToss = VecCheckToss( this, EyePosition(), vecTarget, -1, 1.0, true, &vecMins, &vecMaxs );
vecToss = VecCheckToss( this, this->EyePosition(), vecTarget, -1, 1.0, true, &vecMins, &vecMaxs );
}
if ( vecToss != vec3_origin )
@ -518,7 +521,7 @@ bool CAI_GrenadeUser<BASE_NPC>::CheckCanThrowGrenade( const Vector &vecTarget )
template <class BASE_NPC>
void CAI_GrenadeUser<BASE_NPC>::ClearAttackConditions()
{
bool fCanRangeAttack2 = IsGrenadeCapable() && HasCondition( COND_CAN_RANGE_ATTACK2 );
bool fCanRangeAttack2 = IsGrenadeCapable() && this->HasCondition( COND_CAN_RANGE_ATTACK2 );
// Call the base class.
BaseClass::ClearAttackConditions();
@ -527,7 +530,7 @@ void CAI_GrenadeUser<BASE_NPC>::ClearAttackConditions()
{
// We don't allow the base class to clear this condition because we
// don't sense for it every frame.
SetCondition( COND_CAN_RANGE_ATTACK2 );
this->SetCondition( COND_CAN_RANGE_ATTACK2 );
}
}
@ -537,8 +540,8 @@ void CAI_GrenadeUser<BASE_NPC>::ClearAttackConditions()
template <class BASE_NPC>
void CAI_GrenadeUser<BASE_NPC>::StartTask_FaceAltFireTarget( const Task_t *pTask )
{
SetIdealActivity( (Activity)(int)pTask->flTaskData );
GetMotor()->SetIdealYawToTargetAndUpdate( m_vecAltFireTarget, AI_KEEP_YAW_SPEED );
this->SetIdealActivity( (Activity)(int)pTask->flTaskData );
this->GetMotor()->SetIdealYawToTargetAndUpdate( m_vecAltFireTarget, AI_KEEP_YAW_SPEED );
}
template <class BASE_NPC>
@ -546,7 +549,7 @@ void CAI_GrenadeUser<BASE_NPC>::StartTask_GetPathToForced( const Task_t *pTask )
{
if ( !m_hForcedGrenadeTarget )
{
TaskFail(FAIL_NO_ENEMY);
this->TaskFail(FAIL_NO_ENEMY);
return;
}
@ -559,47 +562,48 @@ void CAI_GrenadeUser<BASE_NPC>::StartTask_GetPathToForced( const Task_t *pTask )
Vector posLos;
bool found = false;
if ( GetTacticalServices()->FindLateralLos( vecEnemyEye, &posLos ) )
if ( this->GetTacticalServices()->FindLateralLos( vecEnemyEye, &posLos ) )
{
float dist = ( posLos - vecEnemyEye ).Length();
if ( dist < flMaxRange && dist > flMinRange )
found = true;
}
if ( !found && GetTacticalServices()->FindLos( vecEnemy, vecEnemyEye, flMinRange, flMaxRange, 1.0, &posLos ) )
if ( !found && this->GetTacticalServices()->FindLos( vecEnemy, vecEnemyEye, flMinRange, flMaxRange, 1.0, &posLos ) )
{
found = true;
}
if ( !found )
{
TaskFail( FAIL_NO_SHOOT );
this->TaskFail( FAIL_NO_SHOOT );
}
else
{
// else drop into run task to offer an interrupt
m_vInterruptSavePosition = posLos;
this->m_vInterruptSavePosition = posLos;
}
}
template <class BASE_NPC>
void CAI_GrenadeUser<BASE_NPC>::StartTask_DeferSquad( const Task_t *pTask )
{
if ( m_pSquad )
CAI_Squad *pSquad = this->GetSquad();
if ( pSquad )
{
// iterate my squad and stop everyone from throwing grenades for a little while.
AISquadIter_t iter;
CAI_BaseNPC *pSquadmate = m_pSquad ? m_pSquad->GetFirstMember( &iter ) : NULL;
CAI_BaseNPC *pSquadmate = pSquad ? pSquad->GetFirstMember( &iter ) : NULL;
while ( pSquadmate )
{
pSquadmate->DelayGrenadeCheck(5);
pSquadmate = m_pSquad->GetNextMember( &iter );
pSquadmate = pSquad->GetNextMember( &iter );
}
}
TaskComplete();
this->TaskComplete();
}
//-----------------------------------------------------------------------------
@ -607,14 +611,14 @@ void CAI_GrenadeUser<BASE_NPC>::StartTask_DeferSquad( const Task_t *pTask )
template <class BASE_NPC>
void CAI_GrenadeUser<BASE_NPC>::RunTask_FaceAltFireTarget( const Task_t *pTask )
{
GetMotor()->SetIdealYawToTargetAndUpdate( m_vecAltFireTarget, AI_KEEP_YAW_SPEED );
this->GetMotor()->SetIdealYawToTargetAndUpdate( m_vecAltFireTarget, AI_KEEP_YAW_SPEED );
// New Mapbase thing that fixes forced alt-fires not changing weapon yaw/pitch
SetAim( m_vecAltFireTarget - Weapon_ShootPosition() );
this->SetAim( m_vecAltFireTarget - this->Weapon_ShootPosition() );
if (IsActivityFinished())
if (this->IsActivityFinished())
{
TaskComplete();
this->TaskComplete();
}
}
@ -623,23 +627,23 @@ void CAI_GrenadeUser<BASE_NPC>::RunTask_GetPathToForced( const Task_t *pTask )
{
if ( !m_hForcedGrenadeTarget )
{
TaskFail(FAIL_NO_ENEMY);
this->TaskFail(FAIL_NO_ENEMY);
return;
}
if ( GetTaskInterrupt() > 0 )
if ( this->GetTaskInterrupt() > 0 )
{
ClearTaskInterrupt();
this->ClearTaskInterrupt();
Vector vecEnemy = m_hForcedGrenadeTarget->GetAbsOrigin();
AI_NavGoal_t goal( m_vInterruptSavePosition, ACT_RUN, AIN_HULL_TOLERANCE );
AI_NavGoal_t goal( this->m_vInterruptSavePosition, ACT_RUN, AIN_HULL_TOLERANCE );
GetNavigator()->SetGoal( goal, AIN_CLEAR_TARGET );
GetNavigator()->SetArrivalDirection( vecEnemy - goal.dest );
this->GetNavigator()->SetGoal( goal, AIN_CLEAR_TARGET );
this->GetNavigator()->SetArrivalDirection( vecEnemy - goal.dest );
}
else
{
TaskInterrupt();
this->TaskInterrupt();
}
}
@ -647,11 +651,11 @@ template <class BASE_NPC>
void CAI_GrenadeUser<BASE_NPC>::RunTask_FaceTossDir( const Task_t *pTask )
{
// project a point along the toss vector and turn to face that point.
GetMotor()->SetIdealYawToTargetAndUpdate( GetLocalOrigin() + m_vecTossVelocity * 64, AI_KEEP_YAW_SPEED );
this->GetMotor()->SetIdealYawToTargetAndUpdate( this->GetLocalOrigin() + m_vecTossVelocity * 64, AI_KEEP_YAW_SPEED );
if ( FacingIdeal() )
if ( this->FacingIdeal() )
{
TaskComplete( true );
this->TaskComplete( true );
}
}

View File

@ -119,11 +119,11 @@ public:
#if AI_MONITOR_USE_UTLVECTOR
inline void SetCondition( int iCondition ) { m_Conditions.HasElement(iCondition) ? NULL : m_Conditions.AddToTail(iCondition); }
inline void ClearCondition( int iCondition ) { m_Conditions.FindAndRemove(iCondition); }
inline bool HasCondition( int iCondition ) { m_Conditions.HasElement(iCondition); }
inline bool HasCondition( int iCondition ) { return m_Conditions.HasElement(iCondition); }
#else
inline void SetCondition( int iCondition ) { m_Conditions.Set(iCondition); }
inline void ClearCondition( int iCondition ) { m_Conditions.Clear(iCondition); }
inline bool HasCondition( int iCondition ) { m_Conditions.IsBitSet(iCondition); }
inline bool HasCondition( int iCondition ) { return m_Conditions.IsBitSet(iCondition); }
#endif
static int GetConditionID(const char* condName) { return CAI_BaseNPC::GetSchedulingSymbols()->ConditionSymbolToId(condName); }
@ -150,11 +150,11 @@ public:
#if AI_MONITOR_USE_UTLVECTOR
inline void SetSchedule( int iSchedule ) { m_Schedules.HasElement(iSchedule) ? NULL : m_Schedules.AddToTail(iSchedule); }
inline void ClearSchedule( int iSchedule ) { m_Schedules.FindAndRemove(iSchedule); }
inline bool HasSchedule( int iSchedule ) { m_Schedules.HasElement(iSchedule); }
inline bool HasSchedule( int iSchedule ) { return m_Schedules.HasElement(iSchedule); }
#else
inline void SetSchedule( int iSchedule ) { m_Schedules.Set(iSchedule); }
inline void ClearSchedule( int iSchedule ) { m_Schedules.Clear(iSchedule); }
inline bool HasSchedule( int iSchedule ) { m_Schedules.IsBitSet(iSchedule); }
inline bool HasSchedule( int iSchedule ) { return m_Schedules.IsBitSet(iSchedule); }
#endif
static int GetScheduleID(const char* schedName) { return CAI_BaseNPC::GetSchedulingSymbols()->ScheduleSymbolToId(schedName); }
@ -179,7 +179,7 @@ public:
inline void SetHint( int iHint ) { m_Hints.HasElement(iHint) ? NULL : m_Hints.AddToTail(iHint); }
inline void ClearHint( int iHint ) { m_Hints.FindAndRemove(iHint); }
inline bool HasHint( int iHint ) { m_Hints.HasElement(iHint); }
inline bool HasHint( int iHint ) { return m_Hints.HasElement(iHint); }
// Only register a hint as "being used" when the NPC is this distance away or less
float m_flDistanceFromHint;

View File

@ -20,7 +20,7 @@ private:
// Used by gamerules to fire OnSkillChanged.
// Passes the level it changed to as well.
void InputSkillLevelChanged(inputdata_t &inputdata) { m_bListeningForSkillChanges ? m_OnSkillChanged.Set(inputdata.value.Int(), inputdata.pActivator, this) : 0; }
void InputSkillLevelChanged(inputdata_t &inputdata) { m_bListeningForSkillChanges ? m_OnSkillChanged.Set(inputdata.value.Int(), inputdata.pActivator, this) : (void)0; }
COutputInt m_OnSkillChanged;
COutputEvent m_OnEasy;

View File

@ -6263,7 +6263,7 @@ public:
if (m_debugOverlays & OVERLAY_TEXT_BIT)
{
char tempstr[512];
Q_snprintf(tempstr, sizeof(tempstr), "Flare Duration: %d", GetEnvFlareLifetime(m_hFlareEnt));
Q_snprintf(tempstr, sizeof(tempstr), "Flare Duration: %f", GetEnvFlareLifetime(m_hFlareEnt));
EntityText(text_offset, tempstr, 0);
text_offset++;
}

View File

@ -52,7 +52,7 @@ void CSkyboxSwapper::Precache( void )
{
if ( Q_strlen( m_iszSkyboxName.ToCStr() ) == 0 )
{
Warning( "skybox_swapper (%s) has no skybox specified!\n", GetEntityName() );
Warning( "skybox_swapper (%s) has no skybox specified!\n", STRING(GetEntityName()) );
return;
}
@ -73,8 +73,8 @@ void CSkyboxSwapper::InputTrigger( inputdata_t &inputdata )
static ConVarRef skyname( "sv_skyname", false );
if ( !skyname.IsValid() )
{
Warning( "skybox_swapper (%s) trigger input failed - cannot find 'sv_skyname' convar!\n", GetEntityName() );
Warning( "skybox_swapper (%s) trigger input failed - cannot find 'sv_skyname' convar!\n", STRING(GetEntityName()) );
return;
}
skyname.SetValue( m_iszSkyboxName.ToCStr() );
}
}

View File

@ -57,12 +57,7 @@ void DBG_AssertFunction( bool fExpr, const char *szExpr, const char *szFile, int
{
if (fExpr)
return;
char szOut[512];
if (szMessage != NULL)
Q_snprintf(szOut,sizeof(szOut), "ASSERT FAILED:\n %s \n(%s@%d)\n%s", szExpr, szFile, szLine, szMessage);
else
Q_snprintf(szOut,sizeof(szOut), "ASSERT FAILED:\n %s \n(%s@%d)\n", szExpr, szFile, szLine);
Warning( szOut);
Warning("ASSERT FAILED:\n %s \n(%s@%d)\n%s", szExpr, szFile, szLine, szMessage ? szMessage : "");
}
#endif // DEBUG

View File

@ -39,7 +39,7 @@ inline void DebugMsg(const tchar *pMsg, ...)
{
if (mapedit_debug.GetBool() == true)
{
Msg(pMsg);
Msg("%s", pMsg);
}
}
@ -544,7 +544,7 @@ public:
else
{
DebugMsg("MapEdit Debug: File not NULL, loading %s\n", pFile);
Q_snprintf(szFullName,sizeof(szFullName), pFile);
Q_strncpy(szFullName, pFile, sizeof(szFullName));
}
KeyValues *pkvFile = new KeyValues( "MapEdit" );
if ( pkvFile->LoadFromFile( filesystem, szFullName, "MOD" ) )

View File

@ -162,9 +162,9 @@ void MapbaseGameLog_Record( const char *szContext )
continue;
if ( pPlayer->GetActiveWeapon() == pWeapon )
pKVWeapons->SetString(pWeapon->GetClassname(), CFmtStrN<32>("%i; %i (active)", pWeapon->m_iClip1, pWeapon->m_iClip2));
pKVWeapons->SetString(pWeapon->GetClassname(), CFmtStrN<32>("%i; %i (active)", pWeapon->m_iClip1.Get(), pWeapon->m_iClip2.Get()));
else
pKVWeapons->SetString(pWeapon->GetClassname(), CFmtStrN<32>("%i; %i", pWeapon->m_iClip1, pWeapon->m_iClip2));
pKVWeapons->SetString(pWeapon->GetClassname(), CFmtStrN<32>("%i; %i", pWeapon->m_iClip1.Get(), pWeapon->m_iClip2.Get()));
}
}
@ -209,7 +209,7 @@ void MapbaseGameLog_Record( const char *szContext )
}
}
CFmtStrN<MAX_PATH> pathfmt("map_logs/%s_log_%i.txt", gpGlobals->mapname, pGameLoggerEnt->m_iSaveID);
CFmtStrN<MAX_PATH> pathfmt("map_logs/%s_log_%i.txt", STRING(gpGlobals->mapname), pGameLoggerEnt->m_iSaveID);
pGameLoggerEnt->m_flLastLogTime = gpGlobals->curtime;
pGameLoggerEnt->m_iSaveID++;
@ -219,7 +219,7 @@ void MapbaseGameLog_Record( const char *szContext )
if (pKV->SaveToFile( g_pFullFileSystem, pathfmt, "MOD" ))
{
Msg("Saved game log file to \"%s\"\n", pathfmt);
Msg("Saved game log file to \"%s\"\n", pathfmt.Get());
}
pKV->deleteThis();

View File

@ -83,8 +83,6 @@ static const char *g_pszRPCNames[] = {
// There can be only one...for each RPC.
static EHANDLE g_Metadata[NUM_RPCS];
#define CMapbaseMetadata C_MapbaseMetadata
// Don't update constantly
#define RPC_UPDATE_COOLDOWN 5.0f
@ -92,6 +90,10 @@ static EHANDLE g_Metadata[NUM_RPCS];
#define RPC_UPDATE_WAIT 0.25f
#endif
#ifdef CLIENT_DLL
#define CMapbaseMetadata C_MapbaseMetadata
#endif
class CMapbaseMetadata : public CBaseEntity
{
public:
@ -101,6 +103,7 @@ public:
DECLARE_NETWORKCLASS();
DECLARE_CLASS( CMapbaseMetadata, CBaseEntity );
#ifdef MAPBASE_RPC
#ifdef CLIENT_DLL
~C_MapbaseMetadata()
{
@ -174,15 +177,18 @@ public:
return SetTransmitState( FL_EDICT_ALWAYS );
}
#endif
#endif
#ifdef CLIENT_DLL
// Built-in update spam limiter
float m_flRPCUpdateTimer = RPC_UPDATE_COOLDOWN;
char m_iszRPCState[128];
char m_iszRPCDetails[128];
#ifdef MAPBASE_RPC
// Built-in update spam limiter
float m_flRPCUpdateTimer = RPC_UPDATE_COOLDOWN;
int m_spawnflags;
#endif
#else
CNetworkVar( string_t, m_iszRPCState );
CNetworkVar( string_t, m_iszRPCDetails );
@ -198,6 +204,7 @@ IMPLEMENT_NETWORKCLASS_ALIASED(MapbaseMetadata, DT_MapbaseMetadata)
BEGIN_NETWORK_TABLE_NOBASE(CMapbaseMetadata, DT_MapbaseMetadata)
#ifdef MAPBASE_RPC
#ifdef CLIENT_DLL
RecvPropString(RECVINFO(m_iszRPCState)),
RecvPropString(RECVINFO(m_iszRPCDetails)),
@ -207,6 +214,7 @@ BEGIN_NETWORK_TABLE_NOBASE(CMapbaseMetadata, DT_MapbaseMetadata)
SendPropStringT(SENDINFO(m_iszRPCDetails) ),
SendPropInt( SENDINFO(m_spawnflags), 8, SPROP_UNSIGNED ),
#endif
#endif
END_NETWORK_TABLE()

View File

@ -9,14 +9,20 @@
#include "matchers.h"
#include "fmtstr.h"
// glibc (Linux) uses these tokens when including <regex>, so we must not #define them
#undef max
#undef min
#include <regex>
#undef MINMAX_H
#include "minmax.h"
ConVar mapbase_wildcards_enabled("mapbase_wildcards_enabled", "1", FCVAR_NONE, "Toggles Mapbase's '?' wildcard and true '*' features. Useful for maps that have '?' in their targetnames.");
ConVar mapbase_regex_enabled("mapbase_regex_enabled", "1", FCVAR_NONE, "Toggles Mapbase's regex matching handover.");
#ifdef CLIENT_DLL
// FIXME: There is no clientside equivalent to the RS code
bool ResponseSystemCompare(const char *criterion, const char *value) { return Matcher_NamesMatch(criterion, value); }
static bool ResponseSystemCompare(const char *criterion, const char *value) { return Matcher_NamesMatch(criterion, value); }
#else
extern bool ResponseSystemCompare(const char *criterion, const char *value);
#endif
@ -32,21 +38,20 @@ extern bool ResponseSystemCompare(const char *criterion, const char *value);
// AppearsToBeANumber - Response System-based function which checks if the string might be a number.
//=============================================================================
inline bool Matcher_Match(const char *pszQuery, const char *szValue)
bool Matcher_Match(const char *pszQuery, const char *szValue)
{
// I wasn't kidding when I said all this did was hijack response system matching.
return ResponseSystemCompare(pszQuery, szValue);
}
inline bool Matcher_Match(const char *pszQuery, int iValue) { return Matcher_Match(pszQuery, CNumStr(iValue)); }
inline bool Matcher_Match(const char *pszQuery, float flValue) { return Matcher_Match(pszQuery, CNumStr(flValue)); }
bool Matcher_Match(const char *pszQuery, int iValue) { return Matcher_Match(pszQuery, CNumStr(iValue)); }
bool Matcher_Match(const char *pszQuery, float flValue) { return Matcher_Match(pszQuery, CNumStr(flValue)); }
// -------------------------------------------------------------------------------
// -------------------------------------------------------------------------------
// The recursive part of Mapbase's modified version of Valve's NamesMatch().
// This part is no longer inlined since it's recursive.
/*FORCEINLINE*/ bool Matcher_RunCharCompare(const char *pszQuery, const char *szValue)
bool Matcher_RunCharCompare(const char *pszQuery, const char *szValue)
{
// This matching model is based off of the ASW SDK
while ( *szValue && *pszQuery )
@ -119,7 +124,7 @@ bool Matcher_Regex(const char *pszQuery, const char *szValue)
}
// The entry point for Mapbase's modified version of Valve's NamesMatch().
FORCEINLINE bool Matcher_NamesMatch(const char *pszQuery, const char *szValue)
bool Matcher_NamesMatch(const char *pszQuery, const char *szValue)
{
if ( szValue == NULL )
return (*pszQuery == 0 || *pszQuery == '*');
@ -142,7 +147,7 @@ FORCEINLINE bool Matcher_NamesMatch(const char *pszQuery, const char *szValue)
return Matcher_RunCharCompare( pszQuery, szValue );
}
FORCEINLINE bool Matcher_NamesMatch_Classic(const char *pszQuery, const char *szValue)
bool Matcher_NamesMatch_Classic(const char *pszQuery, const char *szValue)
{
if ( szValue == NULL )
return (!pszQuery || *pszQuery == 0 || *pszQuery == '*');
@ -178,7 +183,7 @@ FORCEINLINE bool Matcher_NamesMatch_Classic(const char *pszQuery, const char *sz
return false;
}
FORCEINLINE bool Matcher_NamesMatch_MutualWildcard(const char *pszQuery, const char *szValue)
bool Matcher_NamesMatch_MutualWildcard(const char *pszQuery, const char *szValue)
{
if ( szValue == NULL )
return (!pszQuery || *pszQuery == 0 || *pszQuery == '*');
@ -219,7 +224,7 @@ FORCEINLINE bool Matcher_NamesMatch_MutualWildcard(const char *pszQuery, const c
// Matcher_Compare is a deprecated alias originally used when Matcher_Match didn't support wildcards.
/*
inline bool Matcher_Compare(const char *pszQuery, const char *szValue)
bool Matcher_Compare(const char *pszQuery, const char *szValue)
{
return Matcher_Match(pszQuery, szValue);
#if 0

View File

@ -5,39 +5,46 @@
// $NoKeywords: $
//=============================================================================
#ifndef MAPBASE_MATCHERS_H
#define MAPBASE_MATCHERS_H
#ifdef _WIN32
#pragma once
#endif
#define MAPBASE_MATCHERS 1
// Compares with != and the like. Basically hijacks the response system matching.
// This also loops back around to Matcher_NamesMatch.
// pszQuery = The value that should have the operator(s) at the beginning.
// szValue = The value tested against the criterion.
extern bool Matcher_Match( const char *pszQuery, const char *szValue );
extern bool Matcher_Match( const char *pszQuery, int iValue );
extern bool Matcher_Match( const char *pszQuery, float flValue );
bool Matcher_Match( const char *pszQuery, const char *szValue );
bool Matcher_Match( const char *pszQuery, int iValue );
bool Matcher_Match( const char *pszQuery, float flValue );
// Regular expressions based off of the std library.
// pszQuery = The regex text.
// szValue = The value that should be matched.
extern bool Matcher_Regex( const char *pszQuery, const char *szValue );
bool Matcher_Regex( const char *pszQuery, const char *szValue );
// Compares two strings with support for wildcards or regex. This code is an expanded version of baseentity.cpp's NamesMatch().
// pszQuery = The value that should have the wildcard.
// szValue = The value tested against the query.
// Use Matcher_Match if you want <, !=, etc. as well.
extern bool Matcher_NamesMatch( const char *pszQuery, const char *szValue );
bool Matcher_NamesMatch( const char *pszQuery, const char *szValue );
// Identical to baseentity.cpp's original NamesMatch().
// pszQuery = The value that should have the wildcard.
// szValue = The value tested against the query.
extern bool Matcher_NamesMatch_Classic( const char *pszQuery, const char *szValue );
bool Matcher_NamesMatch_Classic( const char *pszQuery, const char *szValue );
// Identical to Matcher_NamesMatch_Classic(), but either value could use a wildcard.
// pszQuery = The value that serves as the query. This value can use wildcards.
// szValue = The value tested against the query. This value can use wildcards as well.
extern bool Matcher_NamesMatch_MutualWildcard( const char *pszQuery, const char *szValue );
bool Matcher_NamesMatch_MutualWildcard( const char *pszQuery, const char *szValue );
// Deprecated; do not use
inline bool Matcher_Compare( const char *pszQuery, const char *szValue ) { return Matcher_Match( pszQuery, szValue ); }
static inline bool Matcher_Compare( const char *pszQuery, const char *szValue ) { return Matcher_Match( pszQuery, szValue ); }
// Taken from the Response System.
// Checks if the specified string appears to be a number of some sort.
@ -57,3 +64,5 @@ static bool AppearsToBeANumber( char const *token )
return true;
}
#endif

View File

@ -20,30 +20,30 @@
#endif
#if SUPPORT_DX8
#include "sdk_lightmappedgeneric_flashlight_vs11.inc"
#include "sdk_flashlight_ps11.inc"
#include "SDK_lightmappedgeneric_flashlight_vs11.inc"
#include "SDK_flashlight_ps11.inc"
#endif
#ifdef STDSHADER_DX9_DLL_EXPORT
#include "sdk_lightmappedgeneric_flashlight_vs20.inc"
#include "sdk_lightmappedgeneric_flashlight_vs30.inc"
#include "SDK_lightmappedgeneric_flashlight_vs20.inc"
#include "SDK_lightmappedgeneric_flashlight_vs30.inc"
#endif
#ifdef STDSHADER_DX9_DLL_EXPORT
#include "sdk_flashlight_ps20.inc"
#include "sdk_flashlight_ps20b.inc"
#include "sdk_flashlight_ps30.inc"
#include "SDK_flashlight_ps20.inc"
#include "SDK_flashlight_ps20b.inc"
#include "SDK_flashlight_ps30.inc"
#endif
#include "sdk_unlitgeneric_vs11.inc"
#include "sdk_VertexLitGeneric_EnvmappedBumpmap_NoLighting_ps14.inc"
#include "sdk_VertexLitGeneric_EnvmappedBumpmap_NoLighting.inc"
#include "sdk_vertexlitgeneric_flashlight_vs11.inc"
#include "sdk_LightmappedGeneric_BaseTexture.inc"
#include "sdk_LightmappedGeneric_BumpmappedLightmap_Base_ps14.inc"
#include "sdk_LightmappedGeneric_BumpmappedLightmap_Blend_ps14.inc"
#include "sdk_lightmappedgeneric_bumpmappedenvmap_ps14.inc"
#include "sdk_lightmappedgeneric_bumpmappedenvmap.inc"
#include "sdk_lightmappedgeneric_basetextureblend.inc"
#include "sdk_lightmappedgeneric_bumpmappedlightmap.inc"
#include "SDK_unlitgeneric_vs11.inc"
#include "SDK_VertexLitGeneric_EnvmappedBumpmap_NoLighting_ps14.inc"
#include "SDK_VertexLitGeneric_EnvmappedBumpmap_NoLighting.inc"
#include "SDK_vertexlitgeneric_flashlight_vs11.inc"
#include "SDK_LightmappedGeneric_BaseTexture.inc"
#include "SDK_LightmappedGeneric_BumpmappedLightmap_Base_ps14.inc"
#include "SDK_LightmappedGeneric_BumpmappedLightmap_Blend_ps14.inc"
#include "SDK_lightmappedgeneric_bumpmappedenvmap_ps14.inc"
#include "SDK_lightmappedgeneric_bumpmappedenvmap.inc"
#include "SDK_lightmappedgeneric_basetextureblend.inc"
#include "SDK_lightmappedgeneric_bumpmappedlightmap.inc"
#endif // GAME_SHADER_DLL
// memdbgon must be the last include file in a .cpp file!!!

View File

@ -5,9 +5,9 @@
//=============================================================================//
#include "BaseVSShader.h"
#include "sdk_unlittwotexture_vs20.inc"
#include "sdk_monitorscreen_ps20.inc"
#include "sdk_monitorscreen_ps20b.inc"
#include "SDK_unlittwotexture_vs20.inc"
#include "SDK_monitorscreen_ps20.inc"
#include "SDK_monitorscreen_ps20b.inc"
#include "cpp_shader_constant_register_map.h"
// memdbgon must be the last include file in a .cpp file!!!

View File

@ -8,9 +8,9 @@
#include "BaseVSShader.h"
#include "sdk_cable_vs20.inc"
#include "sdk_cable_ps20.inc"
#include "sdk_cable_ps20b.inc"
#include "SDK_cable_vs20.inc"
#include "SDK_cable_ps20.inc"
#include "SDK_cable_ps20b.inc"
#include "cpp_shader_constant_register_map.h"
// memdbgon must be the last include file in a .cpp file!!!

View File

@ -130,7 +130,7 @@
==================================================================================================== */
#include "BaseVSShader.h"
#include "mathlib/VMatrix.h"
#include "mathlib/vmatrix.h"
#include "cloak_blended_pass_helper.h"
#include "convar.h"
@ -355,4 +355,4 @@ bool CloakBlendedPassIsFullyOpaque ( IMaterialVar** params, CloakBlendedPassVars
return true;
return false;
}
}

View File

@ -9,13 +9,13 @@
#include "BaseVSShader.h"
#include "cpp_shader_constant_register_map.h"
#include "sdk_decalmodulate_vs20.inc"
#include "sdk_decalmodulate_ps20.inc"
#include "sdk_decalmodulate_ps20b.inc"
#include "SDK_decalmodulate_vs20.inc"
#include "SDK_decalmodulate_ps20.inc"
#include "SDK_decalmodulate_ps20b.inc"
#ifndef _X360
#include "sdk_decalmodulate_vs30.inc"
#include "sdk_decalmodulate_ps30.inc"
#include "SDK_decalmodulate_vs30.inc"
#include "SDK_decalmodulate_ps30.inc"
#endif
// memdbgon must be the last include file in a .cpp file!!!

View File

@ -8,13 +8,13 @@
#include "BaseVSShader.h"
#include "sdk_depthwrite_ps20.inc"
#include "sdk_depthwrite_ps20b.inc"
#include "sdk_depthwrite_vs20.inc"
#include "SDK_depthwrite_ps20.inc"
#include "SDK_depthwrite_ps20b.inc"
#include "SDK_depthwrite_vs20.inc"
#if !defined( _X360 )
#include "sdk_depthwrite_ps30.inc"
#include "sdk_depthwrite_vs30.inc"
#include "SDK_depthwrite_ps30.inc"
#include "SDK_depthwrite_vs30.inc"
#endif
BEGIN_VS_SHADER_FLAGS( SDK_DepthWrite, "Help for Depth Write", SHADER_NOT_EDITABLE )

View File

@ -85,7 +85,7 @@
==================================================================================================== */
#include "BaseVSShader.h"
#include "mathlib/VMatrix.h"
#include "mathlib/vmatrix.h"
#include "emissive_scroll_blended_pass_helper.h"
#include "convar.h"
@ -275,4 +275,4 @@ void DrawEmissiveScrollBlendedPass( CBaseVSShader *pShader, IMaterialVar** param
pShaderAPI->SetPixelShaderConstant( 2, IS_PARAM_DEFINED( info.m_nEmissiveTint ) ? params[info.m_nEmissiveTint]->GetVecValue() : kDefaultEmissiveTint, 1 );
}
pShader->Draw();
}
}

View File

@ -9,13 +9,13 @@
//#include "eyes_flashlight_vs11.inc"
//#include "eyes_flashlight_ps11.inc"
#include "sdk_eye_refract_vs20.inc"
#include "sdk_eye_refract_ps20.inc"
#include "sdk_eye_refract_ps20b.inc"
#include "SDK_eye_refract_vs20.inc"
#include "SDK_eye_refract_ps20.inc"
#include "SDK_eye_refract_ps20b.inc"
#ifndef _X360
#include "sdk_eye_refract_vs30.inc"
#include "sdk_eye_refract_ps30.inc"
#include "SDK_eye_refract_vs30.inc"
#include "SDK_eye_refract_ps30.inc"
#endif
#include "convar.h"

View File

@ -9,9 +9,9 @@
#include "BaseVSShader.h"
#include "shaderlib/cshader.h"
#include "sdk_eyeglint_vs20.inc"
#include "sdk_eyeglint_ps20.inc"
#include "sdk_eyeglint_ps20b.inc"
#include "SDK_eyeglint_vs20.inc"
#include "SDK_eyeglint_ps20.inc"
#include "SDK_eyeglint_ps20b.inc"
DEFINE_FALLBACK_SHADER( SDK_EyeGlint, SDK_EyeGlint_dx9 )
BEGIN_VS_SHADER( SDK_EyeGlint_dx9, "Help for SDK_EyeGlint" )

View File

@ -10,23 +10,23 @@
#include "eyes_dx8_dx9_helper.h"
#include "cpp_shader_constant_register_map.h"
#include "SDK_Eyes.inc"
#include "sdk_eyes_flashlight_vs11.inc"
#include "sdk_eyes_flashlight_ps11.inc"
#include "SDK_eyes_flashlight_vs11.inc"
#include "SDK_eyes_flashlight_ps11.inc"
#ifdef STDSHADER_DX9_DLL_EXPORT
#include "sdk_eyes_vs20.inc"
#include "sdk_eyes_ps20.inc"
#include "sdk_eyes_ps20b.inc"
#include "sdk_eyes_flashlight_vs20.inc"
#include "sdk_eyes_flashlight_ps20.inc"
#include "sdk_eyes_flashlight_ps20b.inc"
#include "SDK_eyes_vs20.inc"
#include "SDK_eyes_ps20.inc"
#include "SDK_eyes_ps20b.inc"
#include "SDK_eyes_flashlight_vs20.inc"
#include "SDK_eyes_flashlight_ps20.inc"
#include "SDK_eyes_flashlight_ps20b.inc"
#ifndef _X360
#include "sdk_eyes_vs30.inc"
#include "sdk_eyes_ps30.inc"
#include "sdk_eyes_flashlight_vs30.inc"
#include "sdk_eyes_flashlight_ps30.inc"
#include "SDK_eyes_vs30.inc"
#include "SDK_eyes_ps30.inc"
#include "SDK_eyes_flashlight_vs30.inc"
#include "SDK_eyes_flashlight_ps30.inc"
#endif
#endif

View File

@ -124,9 +124,9 @@
#include "flesh_interior_blended_pass_helper.h"
// Auto generated inc files
#include "sdk_flesh_interior_blended_pass_vs20.inc"
#include "sdk_flesh_interior_blended_pass_ps20.inc"
#include "sdk_flesh_interior_blended_pass_ps20b.inc"
#include "SDK_flesh_interior_blended_pass_vs20.inc"
#include "SDK_flesh_interior_blended_pass_ps20.inc"
#include "SDK_flesh_interior_blended_pass_ps20b.inc"
void InitParamsFleshInteriorBlendedPass( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, FleshInteriorBlendedPassVars_t &info )
{

View File

@ -16,11 +16,11 @@
#include "SDK_lightmappedgeneric_ps30.inc"
#include "SDK_lightmappedgeneric_vs30.inc"
#include "sdk_lightmappedgeneric_flashlight_vs20.inc"
#include "sdk_lightmappedgeneric_flashlight_vs30.inc"
#include "sdk_lightmappedgeneric_flashlight_ps20.inc"
#include "sdk_lightmappedgeneric_flashlight_ps20b.inc"
#include "sdk_lightmappedgeneric_flashlight_ps30.inc"
#include "SDK_lightmappedgeneric_flashlight_vs20.inc"
#include "SDK_lightmappedgeneric_flashlight_vs30.inc"
#include "SDK_lightmappedgeneric_flashlight_ps20.inc"
#include "SDK_lightmappedgeneric_flashlight_ps20b.inc"
#include "SDK_lightmappedgeneric_flashlight_ps30.inc"
#include "tier0/memdbgon.h"
@ -1759,4 +1759,4 @@ void DrawLightmappedGeneric_DX9(CBaseVSShader *pShader, IMaterialVar** params,
//}
//
//DrawLightmappedGeneric_DX9_Internal( pShader, params, hasFlashlight, pShaderAPI, pShaderShadow, info, pContextDataPtr );
}
}

View File

@ -6,7 +6,7 @@
//===========================================================================//
#include "BaseVSShader.h"
#include "mathlib/VMatrix.h"
#include "mathlib/vmatrix.h"
#include "common_hlsl_cpp_consts.h" // hack hack hack!
#include "SDK_lightmappedreflective_vs20.inc"

View File

@ -8,9 +8,9 @@
#include "BaseVSShader.h"
#include "refract_dx9_helper.h"
#include "convar.h"
#include "sdk_refract_vs20.inc"
#include "SDK_Refract_ps20.inc"
#include "sdk_refract_ps20b.inc"
#include "SDK_Refract_vs20.inc"
#include "SDK_refract_ps20.inc"
#include "SDK_refract_ps20b.inc"
#include "cpp_shader_constant_register_map.h"
#define MAXBLUR 1

View File

@ -3,9 +3,9 @@
#include "BaseVSShader.h"
#include "convar.h"
#include "sdk_splinerope_ps20.inc"
#include "sdk_splinerope_ps20b.inc"
#include "sdk_splinerope_vs20.inc"
#include "SDK_splinerope_ps20.inc"
#include "SDK_splinerope_ps20b.inc"
#include "SDK_splinerope_vs20.inc"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

View File

@ -15,9 +15,9 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#include "sdk_sprite_vs20.inc"
#include "sdk_sprite_ps20.inc"
#include "sdk_sprite_ps20b.inc"
#include "SDK_sprite_vs20.inc"
#include "SDK_sprite_ps20.inc"
#include "SDK_sprite_ps20b.inc"
// WARNING! Change these in engine/SpriteGn.h if you change them here!
#define SPR_VP_PARALLEL_UPRIGHT 0

View File

@ -92,4 +92,4 @@ SDK_unlittwotexture_ps2x.fxc
SDK_unlittwotexture_vs20.fxc
SDK_monitorscreen_ps2x.fxc
SDK_ShatteredGlass_ps2x.fxc
SDK_ShatteredGlass_vs20.fxc
SDK_ShatteredGlass_vs20.fxc

View File

@ -29,7 +29,7 @@ SDK_depthwrite_ps2x.fxc
SDK_depthwrite_vs20.fxc
SDK_eyes_ps2x.fxc
SDK_Eyes_vs20.fxc
SDK_eyes_vs20.fxc
SDK_eye_refract_ps2x.fxc
SDK_eye_refract_vs20.fxc
SDK_eyes_flashlight_ps2x.fxc
@ -43,4 +43,4 @@ SDK_teeth_flashlight_ps2x.fxc
SDK_teeth_flashlight_vs20.fxc
SDK_decalmodulate_ps2x.fxc
SDK_decalmodulate_vs20.fxc
SDK_decalmodulate_vs20.fxc

View File

@ -7,23 +7,23 @@
#include "BaseVSShader.h"
#include "cpp_shader_constant_register_map.h"
#include "sdk_teeth_vs20.inc"
#include "sdk_teeth_flashlight_vs20.inc"
#include "sdk_teeth_bump_vs20.inc"
#include "sdk_teeth_ps20.inc"
#include "sdk_teeth_ps20b.inc"
#include "sdk_teeth_flashlight_ps20.inc"
#include "sdk_teeth_flashlight_ps20b.inc"
#include "sdk_teeth_bump_ps20.inc"
#include "sdk_teeth_bump_ps20b.inc"
#include "SDK_teeth_vs20.inc"
#include "SDK_teeth_flashlight_vs20.inc"
#include "SDK_teeth_bump_vs20.inc"
#include "SDK_teeth_ps20.inc"
#include "SDK_teeth_ps20b.inc"
#include "SDK_teeth_flashlight_ps20.inc"
#include "SDK_teeth_flashlight_ps20b.inc"
#include "SDK_teeth_bump_ps20.inc"
#include "SDK_teeth_bump_ps20b.inc"
#ifndef _X360
#include "sdk_teeth_vs30.inc"
#include "sdk_teeth_ps30.inc"
#include "sdk_teeth_bump_vs30.inc"
#include "sdk_teeth_bump_ps30.inc"
#include "sdk_teeth_flashlight_vs30.inc"
#include "sdk_teeth_flashlight_ps30.inc"
#include "SDK_teeth_vs30.inc"
#include "SDK_teeth_ps30.inc"
#include "SDK_teeth_bump_vs30.inc"
#include "SDK_teeth_bump_ps30.inc"
#include "SDK_teeth_flashlight_vs30.inc"
#include "SDK_teeth_flashlight_ps30.inc"
#endif
// memdbgon must be the last include file in a .cpp file!!!

View File

@ -10,9 +10,9 @@
#include "cloak_blended_pass_helper.h"
#include "cpp_shader_constant_register_map.h"
#include "sdk_unlittwotexture_vs20.inc"
#include "sdk_unlittwotexture_ps20.inc"
#include "sdk_unlittwotexture_ps20b.inc"
#include "SDK_unlittwotexture_vs20.inc"
#include "SDK_unlittwotexture_ps20.inc"
#include "SDK_unlittwotexture_ps20b.inc"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

View File

@ -9,8 +9,8 @@
#include "vertexlitgeneric_dx9_helper.h"
#include "skin_dx9_helper.h"
#include "SDK_VertexLit_and_unlit_Generic_vs20.inc"
#include "SDK_VertexLit_and_unlit_Generic_bump_vs20.inc"
#include "SDK_vertexlit_and_unlit_generic_vs20.inc"
#include "SDK_vertexlit_and_unlit_generic_bump_vs20.inc"
//#include "SDK_vertexlit_and_unlit_generic_ps20.inc"
#include "SDK_vertexlit_and_unlit_generic_ps20b.inc"

View File

@ -13,9 +13,9 @@
#include "SDK_WaterCheap_vs20.inc"
#include "SDK_WaterCheap_ps20.inc"
#include "SDK_WaterCheap_ps20b.inc"
#include "sdk_water_vs20.inc"
#include "SDK_Water_vs20.inc"
#include "SDK_Water_ps20.inc"
#include "sdk_water_ps20b.inc"
#include "SDK_Water_ps20b.inc"
#ifndef _X360
static ConVar r_waterforceexpensive( "r_waterforceexpensive", "0", FCVAR_ARCHIVE );

View File

@ -11,8 +11,8 @@
#include "convar.h"
#include "SDK_lightmappedgeneric_vs20.inc"
#include "SDK_WorldTwoTextureBlend_ps20.inc"
#include "SDK_WorldTwoTextureBlend_ps20b.inc"
#include "SDK_worldtwotextureblend_ps20.inc"
#include "SDK_worldtwotextureblend_ps20b.inc"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

View File

@ -1375,7 +1375,7 @@ private:
class CM128InitialAttributeIterator : public CStridedConstPtr<fltx4>
class CM128InitialAttributeIterator : public CFltx4StridedConstPtr
{
public:
FORCEINLINE CM128InitialAttributeIterator( int nAttribute, CParticleCollection *pParticles )
@ -1385,7 +1385,7 @@ public:
};
class CM128AttributeIterator : public CStridedConstPtr<fltx4>
class CM128AttributeIterator : public CFltx4StridedConstPtr
{
public:
FORCEINLINE CM128AttributeIterator( int nAttribute, CParticleCollection *pParticles )
@ -1403,7 +1403,7 @@ public:
}
};
class CM128AttributeWriteIterator : public CStridedPtr<fltx4>
class CM128AttributeWriteIterator : public CFltx4StridedPtr
{
public:
FORCEINLINE CM128AttributeWriteIterator( void )

View File

@ -135,10 +135,10 @@ CUtlBlockMemory<T,I>::~CUtlBlockMemory()
template< class T, class I >
void CUtlBlockMemory<T,I>::Swap( CUtlBlockMemory< T, I > &mem )
{
swap( m_pMemory, mem.m_pMemory );
swap( m_nBlocks, mem.m_nBlocks );
swap( m_nIndexMask, mem.m_nIndexMask );
swap( m_nIndexShift, mem.m_nIndexShift );
V_swap( m_pMemory, mem.m_pMemory );
V_swap( m_nBlocks, mem.m_nBlocks );
V_swap( m_nIndexMask, mem.m_nIndexMask );
V_swap( m_nIndexShift, mem.m_nIndexShift );
}

View File

@ -109,6 +109,95 @@ public:
}
};
class CFltx4StridedPtr
{
private:
typedef __m128 T;
protected:
T *m_pData;
size_t m_nStride;
public:
FORCEINLINE CFltx4StridedPtr( void *pData, size_t nByteStride )
{
m_pData = reinterpret_cast<T *>( pData );
m_nStride = nByteStride / sizeof( T );
}
FORCEINLINE CFltx4StridedPtr( void ) {}
T *operator->(void) const
{
return m_pData;
}
T & operator*(void) const
{
return *m_pData;
}
FORCEINLINE operator T *(void)
{
return m_pData;
}
FORCEINLINE CFltx4StridedPtr& operator++(void)
{
m_pData += m_nStride;
return *this;
}
FORCEINLINE void operator+=( size_t nNumElements )
{
m_pData += nNumElements * m_nStride;
}
};
class CFltx4StridedConstPtr
{
private:
typedef __m128 T;
protected:
const T *m_pData;
size_t m_nStride;
public:
FORCEINLINE CFltx4StridedConstPtr( void const *pData, size_t nByteStride )
{
m_pData = reinterpret_cast<T const *>( pData );
m_nStride = nByteStride / sizeof( T );
}
FORCEINLINE CFltx4StridedConstPtr( void ) {}
const T *operator->(void) const
{
return m_pData;
}
const T & operator*(void) const
{
return *m_pData;
}
FORCEINLINE operator const T *(void) const
{
return m_pData;
}
FORCEINLINE CFltx4StridedConstPtr &operator++(void)
{
m_pData += m_nStride;
return *this;
}
FORCEINLINE void operator+=( size_t nNumElements )
{
m_pData += nNumElements*m_nStride;
}
};
// allowed field data types. if you change these values, you need to change the tables in the .cpp file
enum EAttributeDataType
{
@ -311,19 +400,19 @@ public:
};
class CFltX4AttributeIterator : public CStridedConstPtr<fltx4>
class CFltX4AttributeIterator : public CFltx4StridedConstPtr
{
FORCEINLINE CFltX4AttributeIterator( CSOAContainer const *pContainer, int nAttribute, int nRowNumber = 0 )
: CStridedConstPtr<fltx4>( pContainer->ConstRowPtr( nAttribute, nRowNumber),
: CFltx4StridedConstPtr( pContainer->ConstRowPtr( nAttribute, nRowNumber),
pContainer->ItemByteStride( nAttribute ) )
{
}
};
class CFltX4AttributeWriteIterator : public CStridedPtr<fltx4>
class CFltX4AttributeWriteIterator : public CFltx4StridedPtr
{
FORCEINLINE CFltX4AttributeWriteIterator( CSOAContainer const *pContainer, int nAttribute, int nRowNumber = 0 )
: CStridedPtr<fltx4>( pContainer->RowPtr( nAttribute, nRowNumber),
: CFltx4StridedPtr( pContainer->RowPtr( nAttribute, nRowNumber),
pContainer->ItemByteStride( nAttribute ) )
{
}

View File

@ -200,7 +200,7 @@ DECLARE_DEDUCE_FIELDTYPE( FIELD_VECTOR, const QAngle& );
template <typename T>
inline const char * ScriptFieldTypeName()
{
T::using_unknown_script_type();
return T::using_unknown_script_type();
}
#define DECLARE_NAMED_FIELDTYPE( fieldType, strName ) template <> inline const char * ScriptFieldTypeName<fieldType>() { return strName; }