Updated the SDK with the latest code from the TF and HL2 branches.

This commit is contained in:
John Schoenick 2015-09-09 18:35:41 -07:00
parent 55ed12f8d1
commit 0d8dceea43
675 changed files with 46223 additions and 9824 deletions

View File

@ -56,6 +56,7 @@ static const Language_t s_LanguageNames[] =
{ "Brazilian", "brazilian", "#GameUI_Language_Brazilian", "pt_BR", k_Lang_Brazilian, 1046 } , { "Brazilian", "brazilian", "#GameUI_Language_Brazilian", "pt_BR", k_Lang_Brazilian, 1046 } ,
{ "Bulgarian", "bulgarian", "#GameUI_Language_Bulgarian", "bg_BG", k_Lang_Bulgarian, 1026 } , { "Bulgarian", "bulgarian", "#GameUI_Language_Bulgarian", "bg_BG", k_Lang_Bulgarian, 1026 } ,
{ "Greek", "greek", "#GameUI_Language_Greek", "el_GR", k_Lang_Greek, 1032 }, { "Greek", "greek", "#GameUI_Language_Greek", "el_GR", k_Lang_Greek, 1032 },
{ "Ukrainian", "ukrainian", "#GameUI_Language_Ukrainian", "uk_UA", k_Lang_Ukrainian, 1058 },
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -40,6 +40,7 @@ enum ELanguage
k_Lang_Brazilian, k_Lang_Brazilian,
k_Lang_Bulgarian, k_Lang_Bulgarian,
k_Lang_Greek, k_Lang_Greek,
k_Lang_Ukrainian,
k_Lang_MAX k_Lang_MAX
}; };

53
mp/src/common/lzma/lzma.h Normal file
View File

@ -0,0 +1,53 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: LZMA Glue. Designed for Tool time Encoding/Decoding.
//
// LZMA Codec interface for engine. Based largely on LzmaUtil.c in SDK
//
// LZMA SDK 9.38 beta
// 2015-01-03 : Igor Pavlov : Public domain
// http://www.7-zip.org/
//
//====================================================================================//
#ifndef LZMA_H
#define LZMA_H
#ifdef _WIN32
#pragma once
#endif
//-----------------------------------------------------------------------------
// These routines are designed for TOOL TIME encoding/decoding on the PC!
// They have not been made to encode/decode on the PPC and lack big endian awarnesss.
// Lightweight GAME TIME Decoding is part of tier1.lib, via CLZMA.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Encoding glue. Returns non-null Compressed buffer if successful.
// Caller must free.
//-----------------------------------------------------------------------------
unsigned char *LZMA_Compress(
unsigned char *pInput,
unsigned int inputSize,
unsigned int *pOutputSize );
//-----------------------------------------------------------------------------
// Decoding glue. Returns TRUE if succesful.
//-----------------------------------------------------------------------------
bool LZMA_Uncompress(
unsigned char *pInput,
unsigned char **ppOutput,
unsigned int *pOutputSize );
//-----------------------------------------------------------------------------
// Decoding helper, returns TRUE if buffer is LZMA compressed.
//-----------------------------------------------------------------------------
bool LZMA_IsCompressed( unsigned char *pInput );
//-----------------------------------------------------------------------------
// Decoding helper, returns non-zero size of data when uncompressed, otherwise 0.
//-----------------------------------------------------------------------------
unsigned int LZMA_GetActualSize( unsigned char *pInput );
#endif

View File

@ -1679,6 +1679,11 @@ int ByteswapMDLFile( void *pDestBase, void *pSrcBase, const int fileSize )
SET_INDEX_POINTERS( pData, pSequence, keyvalueindex ) SET_INDEX_POINTERS( pData, pSequence, keyvalueindex )
WriteBuffer<char>( pDataDest, pDataSrc, SrcNative( &pSequence->keyvaluesize ) ); WriteBuffer<char>( pDataDest, pDataSrc, SrcNative( &pSequence->keyvaluesize ) );
/** ACTIVITY MODIFIERS **/
SET_INDEX_POINTERS( pData, pSequence, activitymodifierindex )
WriteObjects<mstudioactivitymodifier_t>( pDataDest, pDataSrc, SrcNative( &pSequence->numactivitymodifiers ) );
} }
/** TRANSITION GRAPH **/ /** TRANSITION GRAPH **/
@ -2801,6 +2806,10 @@ BEGIN_BYTESWAP_DATADESC( mstudiomovement_t )
DEFINE_FIELD( position, FIELD_VECTOR ), DEFINE_FIELD( position, FIELD_VECTOR ),
END_BYTESWAP_DATADESC() END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudioactivitymodifier_t )
DEFINE_INDEX( sznameindex, FIELD_INTEGER ),
END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudioseqdesc_t ) BEGIN_BYTESWAP_DATADESC( mstudioseqdesc_t )
DEFINE_INDEX( baseptr, FIELD_INTEGER ), DEFINE_INDEX( baseptr, FIELD_INTEGER ),
DEFINE_INDEX( szlabelindex, FIELD_INTEGER ), DEFINE_INDEX( szlabelindex, FIELD_INTEGER ),
@ -2840,7 +2849,9 @@ BEGIN_BYTESWAP_DATADESC( mstudioseqdesc_t )
DEFINE_INDEX( keyvalueindex, FIELD_INTEGER ), DEFINE_INDEX( keyvalueindex, FIELD_INTEGER ),
DEFINE_FIELD( keyvaluesize, FIELD_INTEGER ), DEFINE_FIELD( keyvaluesize, FIELD_INTEGER ),
DEFINE_INDEX( cycleposeindex, FIELD_INTEGER ), DEFINE_INDEX( cycleposeindex, FIELD_INTEGER ),
DEFINE_ARRAY( unused, FIELD_INTEGER, 7 ), // remove/add as appropriate (grow back to 8 ints on version change!) DEFINE_INDEX( activitymodifierindex, FIELD_INTEGER ),
DEFINE_FIELD( numactivitymodifiers, FIELD_INTEGER ),
DEFINE_ARRAY( unused, FIELD_INTEGER, 5 ), // remove/add as appropriate (grow back to 8 ints on version change!)
END_BYTESWAP_DATADESC() END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudioevent_t ) BEGIN_BYTESWAP_DATADESC( mstudioevent_t )

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
OBJCOPY=objcopy OBJCOPY=$STEAM_RUNTIME_PATH/bin/objcopy
function usage { function usage {
echo "$0 /path/to/input/file [-o /path/to/output/file ]" echo "$0 /path/to/input/file [-o /path/to/output/file ]"

View File

@ -1,5 +1,5 @@
# #
# Base makefile for Linux and OSX # Base makefile for Linux.
# #
# !!!!! Note to future editors !!!!! # !!!!! Note to future editors !!!!!
# #
@ -26,6 +26,10 @@ ifneq (,$(findstring clang,$(CXX)))
CLANG_BUILD = 1 CLANG_BUILD = 1
endif endif
ifeq ($(OS),Darwin)
$(error This file should never be used for Mac - use base.xconfig)
endif
ifeq ($(CFG), release) ifeq ($(CFG), release)
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3. # 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. # There also was no speed difference running at 1280x1024. May 2012, mikesart.
@ -46,22 +50,106 @@ endif
# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags" # CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
ARCH_FLAGS = ARCH_FLAGS =
BUILDING_MULTI_ARCH = 0 BUILDING_MULTI_ARCH = 0
# Preserve cflags set in environment
ENV_CFLAGS := $(CFLAGS)
ENV_CXXFLAGS := $(CXXFLAGS)
CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) )) CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE BASE_CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
CFLAGS = $(BASE_CFLAGS) $(ENV_CFLAGS)
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive # 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+. # turns these into warnings in gcc, and -Wno-c++11-narrowing suppresses them entirely in clang 3.1+.
ifeq ($(CLANG_BUILD),1) ifeq ($(CLANG_BUILD),1)
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else CXXFLAGS = $(BASE_CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else $(ENV_CXXFLAGS)
else else
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive CXXFLAGS = $(BASE_CFLAGS) -std=gnu++0x -fpermissive $(ENV_CXXFLAGS)
endif endif
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
## TODO: This cases build errors in cstrike/bin right now. Need to debug.
# This causes all filesystem interfaces to default to their 64bit versions on
# 32bit systems, which means we don't break on filesystems with inodes > 32bit.
# DEFINES += -D_FILE_OFFSET_BITS=64
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel) LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
GENDEP_CXXFLAGS = -MMD -MP -MF $(@:.o=.P) GENDEP_CXXFLAGS = -MMD -MP -MF $(@:.o=.P)
MAP_FLAGS = MAP_FLAGS =
Srv_GAMEOUTPUTFILE = Srv_GAMEOUTPUTFILE =
COPY_DLL_TO_SRV = 0 COPY_DLL_TO_SRV = 0
# 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
#
# If we should be running in a chroot, check to see if we are. If not, then prefix everything with the
# required chroot
#
ifdef MAKE_CHROOT
export STEAM_RUNTIME_PATH := /usr
ifneq ("$(SCHROOT_CHROOT_NAME)", "$(CHROOT_NAME)")
$(info '$(SCHROOT_CHROOT_NAME)' is not '$(CHROOT_NAME)')
$(error This makefile should be run from within a chroot. 'schroot --chroot $(CHROOT_NAME) -- $(MAKE) $(MAKEFLAGS)')
endif
GCC_VER = -4.8
P4BIN = $(SRCROOT)/devtools/bin/linux/p4
CRYPTOPPDIR=ubuntu12_32_gcc48
else ifeq ($(USE_VALVE_BINDIR),1)
# Using /valve/bin directory.
export STEAM_RUNTIME_PATH ?= /valve
GCC_VER = -4.6
P4BIN = p4
CRYPTOPPDIR=linux32
else
# Not using chroot, use old steam-runtime. (gcc 4.6.3)
export STEAM_RUNTIME_PATH ?= /valve/steam-runtime
GCC_VER =
P4BIN = p4
CRYPTOPPDIR=ubuntu12_32
endif
ifeq ($(TARGET_PLATFORM),linux64)
MARCH_TARGET = core2
else
MARCH_TARGET = pentium4
endif
ifeq ($(USE_VALVE_BINDIR),1)
# 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 =
else
# Linux desktop client (or client/dedicated server in chroot).
STRIP_FLAGS = -x
endif
ifeq ($(CLANG_BUILD),1)
# 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 AR), default)
AR = $(STEAM_RUNTIME_PATH)/bin/ar crs
endif
ifeq ($(origin CC), default)
CC = $(CCACHE) $(STEAM_RUNTIME_PATH)/bin/gcc$(GCC_VER)
endif
ifeq ($(origin CXX), default)
CXX = $(CCACHE) $(STEAM_RUNTIME_PATH)/bin/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 ($(CLANG_BUILD),1)
CC := $(CCACHE) $(CC) -Qunused-arguments -fcolor-diagnostics
CXX := $(CCACHE) $(CXX) -Qunused-arguments -fcolor-diagnostics
endif
LINK ?= $(CC)
ifeq ($(STEAM_BRANCH),1) ifeq ($(STEAM_BRANCH),1)
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
@ -71,141 +159,67 @@ else
WARN_FLAGS += -Wno-unused-variable WARN_FLAGS += -Wno-unused-variable
WARN_FLAGS += -Wno-unused-but-set-variable WARN_FLAGS += -Wno-unused-but-set-variable
WARN_FLAGS += -Wno-unused-function WARN_FLAGS += -Wno-unused-function
endif
ifeq ($(CLANG_BUILD),1) ifeq ($(CLANG_BUILD),1)
# Clang specific flags # Clang specific flags
else else ifeq ($(GCC_VER),-4.8)
# Gcc specific flags. Need this for gcc 4.8. WARN_FLAGS += -Wno-unused-local-typedefs
# WARN_FLAGS += -Wno-unused-local-typedefs WARN_FLAGS += -Wno-unused-result
WARN_FLAGS += -Wno-narrowing
# WARN_FLAGS += -Wno-unused-function # WARN_FLAGS += -Wno-unused-function
# WARN_FLAGS += -Wno-unused-result
# WARN_FLAGS += -Wno-narrowing
endif
endif endif
WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers
WARN_FLAGS += -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type WARN_FLAGS += -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type
WARN_FLAGS += -fdiagnostics-show-option -Wformat -Wformat-security WARN_FLAGS += -fdiagnostics-show-option -Wformat -Wformat-security
ifeq ($(OS),Darwin) ifeq ($(TARGET_PLATFORM),linux64)
$(error This file should never be used for Mac - use base.xconfig)
endif
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/)" ""
VALVE_BINDIR = /valve/steam-runtime/bin/
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 ($(CLANG_BUILD),1)
# The steam-runtime is incompatible with clang at this point, so disable it
VALVE_BINDIR =
# 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 ($(CLANG_BUILD),1)
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
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) # nocona = pentium4 + 64bit + MMX, SSE, SSE2, SSE3 - no SSSE3 (that's three s's - added in core2)
ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=core2 ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=core2
LD_SO = ld-linux-x86_64.so.2 LD_SO = ld-linux-x86_64.so.2
LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a) LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a)
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a) LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
else else
# pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse # pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS) ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS)
LD_SO = ld-linux.so.2 LD_SO = ld-linux.so.2
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so) LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so) LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LDFLAGS += -m32 LDFLAGS += -m32
endif endif
GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh
ifeq ($(CFG),release) ifeq ($(CFG),release)
STRIP ?= strip $(STRIP_FLAGS) -S STRIP ?= strip $(STRIP_FLAGS) -S
# CFLAGS += -ffunction-sections -fdata-sections # CFLAGS += -ffunction-sections -fdata-sections
# LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections # LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections
else else
STRIP ?= true STRIP ?= true
endif endif
VSIGN ?= true VSIGN ?= true
ifeq ($(SOURCE_SDK), 1) ifeq ($(SOURCE_SDK), 1)
Srv_GAMEOUTPUTFILE := $(GAMEOUTPUTFILE:.so=_srv.so) Srv_GAMEOUTPUTFILE := $(GAMEOUTPUTFILE:.so=_srv.so)
COPY_DLL_TO_SRV := 1 COPY_DLL_TO_SRV := 1
endif endif
LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map
SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined
_WRAP := -Xlinker --wrap= _WRAP := -Xlinker --wrap=
PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRAP)access $(_WRAP)__xstat \ 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)stat $(_WRAP)lstat $(_WRAP)fopen64 $(_WRAP)open64 $(_WRAP)opendir $(_WRAP)__lxstat \
$(_WRAP)chmod $(_WRAP)chown $(_WRAP)lchown $(_WRAP)symlink $(_WRAP)link $(_WRAP)__lxstat64 \ $(_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)mknod $(_WRAP)utimes $(_WRAP)unlink $(_WRAP)rename $(_WRAP)utime $(_WRAP)__xstat64 \
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath $(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath
LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group 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 LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
endif
# #
# Profile-directed optimizations. # Profile-directed optimizations.
@ -289,7 +303,7 @@ else
# setting is best, but here is an alternate example: # setting is best, but here is an alternate example:
# export P4_EDIT_CHANGELIST_CMD="echo 1424335" # export P4_EDIT_CHANGELIST_CMD="echo 1424335"
# ?= means that if P4_EDIT_CHANGELIST_CMD is already set it won't be changed. # ?= 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_CMD ?= $(P4BIN) changes -c `$(P4BIN) 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)) P4_EDIT_CHANGELIST := $(shell $(P4_EDIT_CHANGELIST_CMD))
endif endif
ifeq ($(P4_EDIT_CHANGELIST),) ifeq ($(P4_EDIT_CHANGELIST),)
@ -298,13 +312,13 @@ else
# Warning: the behavior of 'echo' is not consistent. In bash you need the "-e" option in order for \n to be # 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 # 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. # 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 ' ') P4_EDIT_CHANGELIST = $(shell echo -e "Change: new\nDescription: POSIX Auto Checkout" | $(P4BIN) change -i | cut -f 2 -d ' ')
endif endif
P4_EDIT_START := for f in 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_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | $(P4BIN) -x - edit -c $(P4_EDIT_CHANGELIST); else $(P4BIN) edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
P4_REVERT_START := for f in 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) P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | $(P4BIN) -x - revert; else $(P4BIN) revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
endif endif
ifeq ($(CONFTYPE),dll) ifeq ($(CONFTYPE),dll)
@ -345,7 +359,7 @@ ifneq "$(OBJ_DIR)" ""
endif endif
ifneq "$(OUTPUTFILE)" "" ifneq "$(OUTPUTFILE)" ""
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \ $(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
echo "p4 revert $(OUTPUTFILE)"; \ echo "$(P4BIN) revert $(OUTPUTFILE)"; \
$(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \ $(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \
fi; fi;
endif endif
@ -354,7 +368,7 @@ ifneq "$(OTHER_DEPENDENCIES)" ""
$(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES) $(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES)
endif endif
ifneq "$(GAMEOUTPUTFILE)" "" ifneq "$(GAMEOUTPUTFILE)" ""
$(QUIET_PREFIX) echo "p4 revert $(GAMEOUTPUTFILE)" $(QUIET_PREFIX) echo "$(P4BIN) revert $(GAMEOUTPUTFILE)"
$(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END) $(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END)
endif endif
@ -370,7 +384,7 @@ ifneq "$(OBJ_DIR)" ""
endif endif
ifneq "$(OUTPUTFILE)" "" ifneq "$(OUTPUTFILE)" ""
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \ $(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
echo "p4 edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \ echo "$(P4BIN) edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \
$(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \ $(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \
fi; fi;
$(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT); $(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT);
@ -380,7 +394,7 @@ ifneq "$(OTHER_DEPENDENCIES)" ""
$(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES) $(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES)
endif endif
ifneq "$(GAMEOUTPUTFILE)" "" ifneq "$(GAMEOUTPUTFILE)" ""
$(QUIET_PREFIX) echo "p4 edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)" $(QUIET_PREFIX) echo "$(P4BIN) edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)"
$(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END) $(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END)
$(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE) $(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE)
endif endif

Binary file not shown.

View File

@ -11,6 +11,8 @@
#include "materialsystem/itexture.h" #include "materialsystem/itexture.h"
#include "tier1/KeyValues.h" #include "tier1/KeyValues.h"
#include "toolframework_client.h" #include "toolframework_client.h"
#include "tier0/minidump.h"
#include "tier0/stacktools.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
@ -39,25 +41,33 @@ CBaseAnimatedTextureProxy::~CBaseAnimatedTextureProxy()
bool CBaseAnimatedTextureProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues ) bool CBaseAnimatedTextureProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{ {
char const* pAnimatedTextureVarName = pKeyValues->GetString( "animatedTextureVar" ); char const* pAnimatedTextureVarName = pKeyValues->GetString( "animatedTextureVar" );
if( !pAnimatedTextureVarName )
return false;
if( pAnimatedTextureVarName )
{
bool foundVar; bool foundVar;
m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false ); m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false );
if( !foundVar ) if( foundVar )
return false; {
char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" ); char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" );
if( !pAnimatedTextureFrameNumVarName )
return false;
if( pAnimatedTextureFrameNumVarName )
{
m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false ); m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false );
if( !foundVar )
return false;
if( foundVar )
{
m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 ); m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 );
m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 ); m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 );
return true; return true;
}
}
}
}
// Error - null out pointers.
Cleanup();
return false;
} }
void CBaseAnimatedTextureProxy::Cleanup() void CBaseAnimatedTextureProxy::Cleanup()

View File

@ -0,0 +1,170 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Exposes bsp tools to game for e.g. workshop use
//
// $NoKeywords: $
//===========================================================================//
#include "cbase.h"
#include <tier2/tier2.h>
#include "filesystem.h"
#include "bsp_utils.h"
#include "utlbuffer.h"
#include "igamesystem.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
bool BSP_SyncRepack( const char *pszInputMapFile,
const char *pszOutputMapFile,
IBSPPack::eRepackBSPFlags eRepackFlags )
{
// load the bsppack dll
IBSPPack *libBSPPack = NULL;
CSysModule *pModule = g_pFullFileSystem->LoadModule( "bsppack" );
if ( pModule )
{
CreateInterfaceFn BSPPackFactory = Sys_GetFactory( pModule );
if ( BSPPackFactory )
{
libBSPPack = ( IBSPPack * )BSPPackFactory( IBSPPACK_VERSION_STRING, NULL );
}
}
if( !libBSPPack )
{
Warning( "Can't load bsppack library - unable to compress bsp\n" );
return false;
}
Msg( "Repacking %s -> %s\n", pszInputMapFile, pszOutputMapFile );
if ( !g_pFullFileSystem->FileExists( pszInputMapFile ) )
{
Warning( "Couldn't open input file %s - BSP recompress failed\n", pszInputMapFile );
return false;
}
CUtlBuffer inputBuffer;
if ( !g_pFullFileSystem->ReadFile( pszInputMapFile, NULL, inputBuffer ) )
{
Warning( "Couldn't read file %s - BSP compression failed\n", pszInputMapFile );
return false;
}
CUtlBuffer outputBuffer;
if ( !libBSPPack->RepackBSP( inputBuffer, outputBuffer, eRepackFlags ) )
{
Warning( "Internal error compressing BSP\n" );
return false;
}
g_pFullFileSystem->WriteFile( pszOutputMapFile, NULL, outputBuffer );
Msg( "Successfully repacked %s as %s -- %u -> %u bytes\n",
pszInputMapFile, pszOutputMapFile, inputBuffer.TellPut(), outputBuffer.TellPut() );
return true;
}
// Helper to create a thread that calls SyncCompressMap, and clean it up when it exists
void BSP_BackgroundRepack( const char *pszInputMapFile,
const char *pszOutputMapFile,
IBSPPack::eRepackBSPFlags eRepackFlags )
{
// Make this a gamesystem and thread, so it can check for completion each frame and clean itself up. Run() is the
// background thread, Update() is the main thread tick.
class BackgroundBSPRepackThread : public CThread, public CAutoGameSystemPerFrame
{
public:
BackgroundBSPRepackThread( const char *pszInputFile, const char *pszOutputFile, IBSPPack::eRepackBSPFlags eRepackFlags )
: m_strInput( pszInputFile )
, m_strOutput( pszOutputFile )
, m_eRepackFlags( eRepackFlags )
{
Start();
}
// CThread job - returns 0 for success
virtual int Run() OVERRIDE
{
return BSP_SyncRepack( m_strInput.Get(), m_strOutput.Get(), m_eRepackFlags ) ? 0 : 1;
}
// GameSystem
virtual const char* Name( void ) OVERRIDE { return "BackgroundBSPRepackThread"; }
// Runs on main thread
void CheckFinished()
{
if ( !IsAlive() )
{
// Thread finished
if ( GetResult() != 0 )
{
Warning( "Map compression thread failed :(\n" );
}
// AutoGameSystem deregisters itself on destruction, we're done
delete this;
}
}
#ifdef CLIENT_DLL
virtual void Update( float frametime ) OVERRIDE { CheckFinished(); }
#else // GAME DLL
virtual void FrameUpdatePostEntityThink() OVERRIDE { CheckFinished(); }
#endif
private:
CUtlString m_strInput;
CUtlString m_strOutput;
IBSPPack::eRepackBSPFlags m_eRepackFlags;
};
Msg( "Starting BSP repack job %s -> %s\n", pszInputMapFile, pszOutputMapFile );
// Deletes itself up when done
new BackgroundBSPRepackThread( pszInputMapFile, pszOutputMapFile, eRepackFlags );
}
CON_COMMAND( bsp_repack, "Repack and output a (re)compressed version of a bsp file" )
{
#ifdef GAME_DLL
if ( !UTIL_IsCommandIssuedByServerAdmin() )
return;
#endif
// Handle -nocompress
bool bCompress = true;
const char *szInFilename = NULL;
const char *szOutFilename = NULL;
if ( args.ArgC() == 4 && V_strcasecmp( args.Arg( 1 ), "-nocompress" ) == 0 )
{
bCompress = false;
szInFilename = args.Arg( 2 );
szOutFilename = args.Arg( 3 );
}
else if ( args.ArgC() == 3 )
{
szInFilename = args.Arg( 1 );
szOutFilename = args.Arg( 2 );
}
if ( !szInFilename || !szOutFilename || !strlen( szInFilename ) || !strlen( szOutFilename ) )
{
Msg( "Usage: bsp_repack [-nocompress] map.bsp output_map.bsp\n" );
return;
}
if ( bCompress )
{
// Use default compress flags
BSP_BackgroundRepack( szInFilename, szOutFilename );
}
else
{
// No compression
BSP_BackgroundRepack( szInFilename, szOutFilename, (IBSPPack::eRepackBSPFlags)0 );
}
}

View File

@ -0,0 +1,21 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Exposes bsp tools to game for e.g. workshop use
//
// $NoKeywords: $
//===========================================================================//
#include "../utils/common/bsplib.h"
#include "ibsppack.h"
// Loads bsppack module (IBSPPack) and calls RepackBSP()
bool BSP_SyncRepack( const char *pszInputMapFile,
const char *pszOutputMapFile,
IBSPPack::eRepackBSPFlags eRepackFlags = (IBSPPack::eRepackBSPFlags) ( IBSPPack::eRepackBSP_CompressLumps |
IBSPPack::eRepackBSP_CompressPackfile ) );
// Helper to spawn a background thread that runs SyncRepack
void BSP_BackgroundRepack( const char *pszInputMapFile,
const char *pszOutputMapFile,
IBSPPack::eRepackBSPFlags eRepackFlags = (IBSPPack::eRepackBSPFlags) ( IBSPPack::eRepackBSP_CompressLumps |
IBSPPack::eRepackBSP_CompressPackfile ) );

View File

@ -153,9 +153,13 @@ void C_AI_BaseNPC::OnDataChanged( DataUpdateType_t type )
} }
} }
void C_AI_BaseNPC::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) bool C_AI_BaseNPC::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
{ {
ForceSetupBonesAtTime( pDeltaBones0, gpGlobals->curtime - boneDt ); bool bRet = true;
if ( !ForceSetupBonesAtTime( pDeltaBones0, gpGlobals->curtime - boneDt ) )
bRet = false;
GetRagdollCurSequenceWithDeathPose( this, pDeltaBones1, gpGlobals->curtime, m_iDeathPose, m_iDeathFrame ); GetRagdollCurSequenceWithDeathPose( this, pDeltaBones1, gpGlobals->curtime, m_iDeathPose, m_iDeathFrame );
float ragdollCreateTime = PhysGetSyncCreateTime(); float ragdollCreateTime = PhysGetSyncCreateTime();
if ( ragdollCreateTime != gpGlobals->curtime ) if ( ragdollCreateTime != gpGlobals->curtime )
@ -164,11 +168,15 @@ void C_AI_BaseNPC::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x
// so initialize the ragdoll at that time so that it will reach the current // so initialize the ragdoll at that time so that it will reach the current
// position at curtime. Otherwise the ragdoll will simulate forward from curtime // position at curtime. Otherwise the ragdoll will simulate forward from curtime
// and pop into the future a bit at this point of transition // and pop into the future a bit at this point of transition
ForceSetupBonesAtTime( pCurrentBones, ragdollCreateTime ); if ( !ForceSetupBonesAtTime( pCurrentBones, ragdollCreateTime ) )
bRet = false;
} }
else else
{ {
SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime ); if ( !SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime ) )
bRet = false;
} }
return bRet;
} }

View File

@ -14,7 +14,7 @@
#include "c_basecombatcharacter.h" #include "c_basecombatcharacter.h"
// NOTE: MOved all controller code into c_basestudiomodel // NOTE: Moved all controller code into c_basestudiomodel
class C_AI_BaseNPC : public C_BaseCombatCharacter class C_AI_BaseNPC : public C_BaseCombatCharacter
{ {
DECLARE_CLASS( C_AI_BaseNPC, C_BaseCombatCharacter ); DECLARE_CLASS( C_AI_BaseNPC, C_BaseCombatCharacter );
@ -29,7 +29,7 @@ public:
bool ShouldAvoidObstacle( void ){ return m_bPerformAvoidance; } bool ShouldAvoidObstacle( void ){ return m_bPerformAvoidance; }
virtual bool AddRagdollToFadeQueue( void ) { return m_bFadeCorpse; } virtual bool AddRagdollToFadeQueue( void ) { return m_bFadeCorpse; }
virtual void GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ); virtual bool GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) OVERRIDE;
int GetDeathPose( void ) { return m_iDeathPose; } int GetDeathPose( void ) { return m_iDeathPose; }

View File

@ -79,6 +79,11 @@ const float RUN_SPEED_ESTIMATE_SQR = 150.0f * 150.0f;
static ConVar dbganimmodel( "dbganimmodel", "" ); static ConVar dbganimmodel( "dbganimmodel", "" );
#endif #endif
#if defined( STAGING_ONLY )
static ConVar dbg_bonestack_perturb( "dbg_bonestack_perturb", "0", 0);
static CInterlockedInt dbg_bonestack_reentrant_count = 0;
#endif // STAGING_ONLY
mstudioevent_t *GetEventIndexForSequence( mstudioseqdesc_t &seqdesc ); mstudioevent_t *GetEventIndexForSequence( mstudioseqdesc_t &seqdesc );
C_EntityDissolve *DissolveEffect( C_BaseEntity *pTarget, float flTime ); C_EntityDissolve *DissolveEffect( C_BaseEntity *pTarget, float flTime );
@ -632,7 +637,10 @@ void C_ClientRagdoll::Release( void )
} }
ClientEntityList().RemoveEntity( GetClientHandle() ); ClientEntityList().RemoveEntity( GetClientHandle() );
if ( CollisionProp()->GetPartitionHandle() != PARTITION_INVALID_HANDLE )
{
partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() ); partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
}
RemoveFromLeafSystem(); RemoveFromLeafSystem();
BaseClass::Release(); BaseClass::Release();
@ -744,15 +752,25 @@ C_BaseAnimating::~C_BaseAnimating()
int i = g_PreviousBoneSetups.Find( this ); int i = g_PreviousBoneSetups.Find( this );
if ( i != -1 ) if ( i != -1 )
g_PreviousBoneSetups.FastRemove( i ); g_PreviousBoneSetups.FastRemove( i );
RemoveFromClientSideAnimationList();
TermRopes(); TermRopes();
Assert( !m_pRagdoll );
delete m_pRagdollInfo; delete m_pRagdollInfo;
Assert(!m_pRagdoll); m_pRagdollInfo = NULL;
delete m_pIk; delete m_pIk;
m_pIk = NULL;
delete m_pBoneMergeCache; delete m_pBoneMergeCache;
m_pBoneMergeCache = NULL;
Studio_DestroyBoneCache( m_hitboxBoneCacheHandle ); Studio_DestroyBoneCache( m_hitboxBoneCacheHandle );
delete m_pJiggleBones; delete m_pJiggleBones;
m_pJiggleBones = NULL;
InvalidateMdlCache(); InvalidateMdlCache();
// Kill off anything bone attached to us. // Kill off anything bone attached to us.
@ -852,7 +870,7 @@ void C_BaseAnimating::UpdateRelevantInterpolatedVars()
{ {
MDLCACHE_CRITICAL_SECTION(); MDLCACHE_CRITICAL_SECTION();
// Remove any interpolated vars that need to be removed. // Remove any interpolated vars that need to be removed.
if ( !GetPredictable() && !IsClientCreated() && GetModelPtr() && GetModelPtr()->SequencesAvailable() ) if ( !IsMarkedForDeletion() && !GetPredictable() && !IsClientCreated() && GetModelPtr() && GetModelPtr()->SequencesAvailable() )
{ {
AddBaseAnimatingInterpolatedVars(); AddBaseAnimatingInterpolatedVars();
} }
@ -892,6 +910,17 @@ void C_BaseAnimating::RemoveBaseAnimatingInterpolatedVars()
} }
} }
/*
From Ken: Lock() and Unlock() are render frame only, its just so the mdlcache
doesnt toss the memory when it reshuffles the data, or at least used to. I
don't have any idea if mdlcache even does that anymore, but at one point it would
happily throw away the animation data if you ran out of memory on the
consoles. Jay adds: Ken is correct and the pointer should be valid until the end
of the frame lock (provided you are within a MDLCACHE_LOCK() block or whatever
Jay also recommends running with a forced small cache size (1MB) to put maximum
pressure on the cache when testing changes. Look for datacache ConVar in datacache.cpp.
*/
void C_BaseAnimating::LockStudioHdr() void C_BaseAnimating::LockStudioHdr()
{ {
Assert( m_hStudioHdr == MDLHANDLE_INVALID && m_pStudioHdr == NULL ); Assert( m_hStudioHdr == MDLHANDLE_INVALID && m_pStudioHdr == NULL );
@ -963,6 +992,9 @@ void C_BaseAnimating::UnlockStudioHdr()
mdlcache->UnlockStudioHdr( m_hStudioHdr ); mdlcache->UnlockStudioHdr( m_hStudioHdr );
} }
m_hStudioHdr = MDLHANDLE_INVALID; m_hStudioHdr = MDLHANDLE_INVALID;
delete m_pStudioHdr;
m_pStudioHdr = NULL;
} }
} }
@ -1514,7 +1546,18 @@ void C_BaseAnimating::BuildTransformations( CStudioHdr *hdr, Vector *pos, Quater
} }
else else
{ {
ConcatTransforms( GetBone( pbones[i].parent ), bonematrix, goalMX ); // If the parent bone has been scaled (like with BuildBigHeadTransformations)
// scale it back down so the jiggly bones show up non-scaled in the correct location.
matrix3x4_t parentMX = GetBone( pbones[i].parent );
float fScale = Square( parentMX[0][0] ) + Square( parentMX[1][0] ) + Square( parentMX[2][0] );
if ( fScale > Square( 1.0001f ) )
{
fScale = 1.0f / FastSqrt( fScale );
MatrixScaleBy( fScale, parentMX );
}
ConcatTransforms( parentMX, bonematrix, goalMX );
} }
// get jiggle properties from QC data // get jiggle properties from QC data
@ -1995,10 +2038,10 @@ bool C_BaseAnimating::PutAttachment( int number, const matrix3x4_t &attachmentTo
} }
void C_BaseAnimating::SetupBones_AttachmentHelper( CStudioHdr *hdr ) bool C_BaseAnimating::SetupBones_AttachmentHelper( CStudioHdr *hdr )
{ {
if ( !hdr || !hdr->GetNumAttachments() ) if ( !hdr )
return; return false;
// calculate attachment points // calculate attachment points
matrix3x4_t world; matrix3x4_t world;
@ -2024,6 +2067,8 @@ void C_BaseAnimating::SetupBones_AttachmentHelper( CStudioHdr *hdr )
FormatViewModelAttachment( i, world ); FormatViewModelAttachment( i, world );
PutAttachment( i + 1, world ); PutAttachment( i + 1, world );
} }
return true;
} }
bool C_BaseAnimating::CalcAttachments() bool C_BaseAnimating::CalcAttachments()
@ -2214,18 +2259,36 @@ bool C_BaseAnimating::GetSoundSpatialization( SpatializationInfo_t& info )
return true; return true;
} }
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool C_BaseAnimating::IsViewModel() const bool C_BaseAnimating::IsViewModel() const
{ {
return false; return false;
} }
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_BaseAnimating::UpdateOnRemove( void )
{
RemoveFromClientSideAnimationList( true );
BaseClass::UpdateOnRemove();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool C_BaseAnimating::IsMenuModel() const bool C_BaseAnimating::IsMenuModel() const
{ {
return false; return false;
} }
// UNDONE: Seems kind of silly to have this when we also have the cached bones in C_BaseAnimating // UNDONE: Seems kind of silly to have this when we also have the cached bones in C_BaseAnimating
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CBoneCache *C_BaseAnimating::GetBoneCache( CStudioHdr *pStudioHdr ) CBoneCache *C_BaseAnimating::GetBoneCache( CStudioHdr *pStudioHdr )
{ {
int boneMask = BONE_USED_BY_HITBOX; int boneMask = BONE_USED_BY_HITBOX;
@ -2908,7 +2971,11 @@ bool C_BaseAnimating::SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, i
if( !( oldReadableBones & BONE_USED_BY_ATTACHMENT ) && ( boneMask & BONE_USED_BY_ATTACHMENT ) ) if( !( oldReadableBones & BONE_USED_BY_ATTACHMENT ) && ( boneMask & BONE_USED_BY_ATTACHMENT ) )
{ {
SetupBones_AttachmentHelper( hdr ); if ( !SetupBones_AttachmentHelper( hdr ) )
{
DevWarning( 2, "SetupBones: SetupBones_AttachmentHelper failed.\n" );
return false;
}
} }
} }
@ -2922,7 +2989,7 @@ bool C_BaseAnimating::SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, i
} }
else else
{ {
Warning( "SetupBones: invalid bone array size (%d - needs %d)\n", nMaxBones, m_CachedBoneData.Count() ); ExecuteNTimes( 25, Warning( "SetupBones: invalid bone array size (%d - needs %d)\n", nMaxBones, m_CachedBoneData.Count() ) );
return false; return false;
} }
} }
@ -2989,6 +3056,9 @@ struct BoneAccess
char const *tag; char const *tag;
}; };
// the modelcache critical section is insufficient for preventing us from getting into the bone cache at the same time.
// The bonecache itself is protected by a mutex, but the actual bone access stack needs to be protected separately.
static CThreadFastMutex g_BoneAccessMutex;
static CUtlVector< BoneAccess > g_BoneAccessStack; static CUtlVector< BoneAccess > g_BoneAccessStack;
static BoneAccess g_BoneAcessBase; static BoneAccess g_BoneAcessBase;
@ -3003,6 +3073,9 @@ bool C_BaseAnimating::IsBoneAccessAllowed() const
// (static function) // (static function)
void C_BaseAnimating::PushAllowBoneAccess( bool bAllowForNormalModels, bool bAllowForViewModels, char const *tagPush ) void C_BaseAnimating::PushAllowBoneAccess( bool bAllowForNormalModels, bool bAllowForViewModels, char const *tagPush )
{ {
AUTO_LOCK( g_BoneAccessMutex );
STAGING_ONLY_EXEC( ReentrancyVerifier rv( &dbg_bonestack_reentrant_count, dbg_bonestack_perturb.GetInt() ) );
BoneAccess save = g_BoneAcessBase; BoneAccess save = g_BoneAcessBase;
g_BoneAccessStack.AddToTail( save ); g_BoneAccessStack.AddToTail( save );
@ -3014,6 +3087,9 @@ void C_BaseAnimating::PushAllowBoneAccess( bool bAllowForNormalModels, bool bAll
void C_BaseAnimating::PopBoneAccess( char const *tagPop ) void C_BaseAnimating::PopBoneAccess( char const *tagPop )
{ {
AUTO_LOCK( g_BoneAccessMutex );
STAGING_ONLY_EXEC( ReentrancyVerifier rv( &dbg_bonestack_reentrant_count, dbg_bonestack_perturb.GetInt() ) );
// Validate that pop matches the push // Validate that pop matches the push
Assert( ( g_BoneAcessBase.tag == tagPop ) || ( g_BoneAcessBase.tag && g_BoneAcessBase.tag != ( char const * ) 1 && tagPop && tagPop != ( char const * ) 1 && !strcmp( g_BoneAcessBase.tag, tagPop ) ) ); Assert( ( g_BoneAcessBase.tag == tagPop ) || ( g_BoneAcessBase.tag && g_BoneAcessBase.tag != ( char const * ) 1 && tagPop && tagPop != ( char const * ) 1 && !strcmp( g_BoneAcessBase.tag, tagPop ) ) );
int lastIndex = g_BoneAccessStack.Count() - 1; int lastIndex = g_BoneAccessStack.Count() - 1;
@ -3481,7 +3557,7 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
} }
// Necessary to get the next loop working // Necessary to get the next loop working
m_flPrevEventCycle = -0.01; m_flPrevEventCycle = flEventCycle - 0.001f;
} }
for (int i = 0; i < (int)seqdesc.numevents; i++) for (int i = 0; i < (int)seqdesc.numevents; i++)
@ -4496,7 +4572,7 @@ void C_BaseAnimating::OnPreDataChanged( DataUpdateType_t updateType )
m_bLastClientSideFrameReset = m_bClientSideFrameReset; m_bLastClientSideFrameReset = m_bClientSideFrameReset;
} }
void C_BaseAnimating::ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTime ) bool C_BaseAnimating::ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTime )
{ {
// blow the cached prev bones // blow the cached prev bones
InvalidateBoneCache(); InvalidateBoneCache();
@ -4505,13 +4581,18 @@ void C_BaseAnimating::ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTim
Interpolate( flTime ); Interpolate( flTime );
// Setup bone state at the given time // Setup bone state at the given time
SetupBones( pBonesOut, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, flTime ); return SetupBones( pBonesOut, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, flTime );
} }
void C_BaseAnimating::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) bool C_BaseAnimating::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
{ {
ForceSetupBonesAtTime( pDeltaBones0, gpGlobals->curtime - boneDt ); bool bSuccess = true;
ForceSetupBonesAtTime( pDeltaBones1, gpGlobals->curtime );
if ( !ForceSetupBonesAtTime( pDeltaBones0, gpGlobals->curtime - boneDt ) )
bSuccess = false;
if ( !ForceSetupBonesAtTime( pDeltaBones1, gpGlobals->curtime ) )
bSuccess = false;
float ragdollCreateTime = PhysGetSyncCreateTime(); float ragdollCreateTime = PhysGetSyncCreateTime();
if ( ragdollCreateTime != gpGlobals->curtime ) if ( ragdollCreateTime != gpGlobals->curtime )
{ {
@ -4519,12 +4600,15 @@ void C_BaseAnimating::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matri
// so initialize the ragdoll at that time so that it will reach the current // so initialize the ragdoll at that time so that it will reach the current
// position at curtime. Otherwise the ragdoll will simulate forward from curtime // position at curtime. Otherwise the ragdoll will simulate forward from curtime
// and pop into the future a bit at this point of transition // and pop into the future a bit at this point of transition
ForceSetupBonesAtTime( pCurrentBones, ragdollCreateTime ); if ( !ForceSetupBonesAtTime( pCurrentBones, ragdollCreateTime ) )
bSuccess = false;
} }
else else
{ {
memcpy( pCurrentBones, m_CachedBoneData.Base(), sizeof( matrix3x4_t ) * m_CachedBoneData.Count() ); memcpy( pCurrentBones, m_CachedBoneData.Base(), sizeof( matrix3x4_t ) * m_CachedBoneData.Count() );
} }
return bSuccess;
} }
C_BaseAnimating *C_BaseAnimating::CreateRagdollCopy() C_BaseAnimating *C_BaseAnimating::CreateRagdollCopy()
@ -4592,14 +4676,32 @@ C_BaseAnimating *C_BaseAnimating::BecomeRagdollOnClient()
{ {
MoveToLastReceivedPosition( true ); MoveToLastReceivedPosition( true );
GetAbsOrigin(); GetAbsOrigin();
C_BaseAnimating *pRagdoll = CreateRagdollCopy();
C_BaseAnimating *pRagdoll = CreateRagdollCopy();
if ( pRagdoll )
{
matrix3x4_t boneDelta0[MAXSTUDIOBONES]; matrix3x4_t boneDelta0[MAXSTUDIOBONES];
matrix3x4_t boneDelta1[MAXSTUDIOBONES]; matrix3x4_t boneDelta1[MAXSTUDIOBONES];
matrix3x4_t currentBones[MAXSTUDIOBONES]; matrix3x4_t currentBones[MAXSTUDIOBONES];
const float boneDt = 0.1f; const float boneDt = 0.1f;
GetRagdollInitBoneArrays( boneDelta0, boneDelta1, currentBones, boneDt );
pRagdoll->InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt ); bool bInitAsClient = false;
bool bInitBoneArrays = GetRagdollInitBoneArrays( boneDelta0, boneDelta1, currentBones, boneDt );
if ( bInitBoneArrays )
{
bInitAsClient = pRagdoll->InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt );
}
if ( !bInitAsClient || !bInitBoneArrays )
{
Warning( "C_BaseAnimating::BecomeRagdollOnClient failed. pRagdoll:%p bInitBoneArrays:%d bInitAsClient:%d\n",
pRagdoll, bInitBoneArrays, bInitAsClient );
pRagdoll->Release();
return NULL;
}
}
return pRagdoll; return pRagdoll;
} }
@ -5512,6 +5614,13 @@ int C_BaseAnimating::SelectWeightedSequence ( int activity )
} }
int C_BaseAnimating::SelectWeightedSequenceFromModifiers( Activity activity, CUtlSymbol *pActivityModifiers, int iModifierCount )
{
Assert( activity != ACT_INVALID );
Assert( GetModelPtr() );
return GetModelPtr()->SelectWeightedSequenceFromModifiers( activity, pActivityModifiers, iModifierCount );
}
//========================================================= //=========================================================
//========================================================= //=========================================================
int C_BaseAnimating::LookupPoseParameter( CStudioHdr *pstudiohdr, const char *szName ) int C_BaseAnimating::LookupPoseParameter( CStudioHdr *pstudiohdr, const char *szName )
@ -6018,7 +6127,7 @@ void C_BaseAnimating::AddToClientSideAnimationList()
UpdateRelevantInterpolatedVars(); UpdateRelevantInterpolatedVars();
} }
void C_BaseAnimating::RemoveFromClientSideAnimationList() void C_BaseAnimating::RemoveFromClientSideAnimationList( bool bBeingDestroyed /*= false*/ )
{ {
// Not in list yet // Not in list yet
if ( INVALID_CLIENTSIDEANIMATION_LIST_HANDLE == m_ClientSideAnimationListHandle ) if ( INVALID_CLIENTSIDEANIMATION_LIST_HANDLE == m_ClientSideAnimationListHandle )
@ -6049,7 +6158,10 @@ void C_BaseAnimating::RemoveFromClientSideAnimationList()
// Invalidate our handle no matter what. // Invalidate our handle no matter what.
m_ClientSideAnimationListHandle = INVALID_CLIENTSIDEANIMATION_LIST_HANDLE; m_ClientSideAnimationListHandle = INVALID_CLIENTSIDEANIMATION_LIST_HANDLE;
if ( !bBeingDestroyed )
{
UpdateRelevantInterpolatedVars(); UpdateRelevantInterpolatedVars();
}
} }

View File

@ -247,7 +247,7 @@ public:
void ForceClientSideAnimationOn(); void ForceClientSideAnimationOn();
void AddToClientSideAnimationList(); void AddToClientSideAnimationList();
void RemoveFromClientSideAnimationList(); void RemoveFromClientSideAnimationList( bool bBeingDestroyed = false );
virtual bool IsSelfAnimating(); virtual bool IsSelfAnimating();
virtual void ResetLatched(); virtual void ResetLatched();
@ -298,8 +298,8 @@ public:
virtual void Clear( void ); virtual void Clear( void );
void ClearRagdoll(); void ClearRagdoll();
void CreateUnragdollInfo( C_BaseAnimating *pRagdoll ); void CreateUnragdollInfo( C_BaseAnimating *pRagdoll );
void ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTime ); bool ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTime );
virtual void GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ); virtual bool GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt );
// For shadows rendering the correct body + sequence... // For shadows rendering the correct body + sequence...
virtual int GetBody() { return m_nBody; } virtual int GetBody() { return m_nBody; }
@ -429,6 +429,7 @@ public:
// For prediction // For prediction
int SelectWeightedSequence ( int activity ); int SelectWeightedSequence ( int activity );
int SelectWeightedSequenceFromModifiers( Activity activity, CUtlSymbol *pActivityModifiers, int iModifierCount );
void ResetSequenceInfo( void ); void ResetSequenceInfo( void );
float SequenceDuration( void ); float SequenceDuration( void );
float SequenceDuration( CStudioHdr *pStudioHdr, int iSequence ); float SequenceDuration( CStudioHdr *pStudioHdr, int iSequence );
@ -444,6 +445,7 @@ public:
virtual bool ShouldResetSequenceOnNewModel( void ); virtual bool ShouldResetSequenceOnNewModel( void );
virtual bool IsViewModel() const; virtual bool IsViewModel() const;
virtual void UpdateOnRemove( void );
protected: protected:
// View models scale their attachment positions to account for FOV. To get the unmodified // View models scale their attachment positions to account for FOV. To get the unmodified
@ -605,7 +607,7 @@ private:
// Calculated attachment points // Calculated attachment points
CUtlVector<CAttachmentData> m_Attachments; CUtlVector<CAttachmentData> m_Attachments;
void SetupBones_AttachmentHelper( CStudioHdr *pStudioHdr ); bool SetupBones_AttachmentHelper( CStudioHdr *pStudioHdr );
EHANDLE m_hLightingOrigin; EHANDLE m_hLightingOrigin;
EHANDLE m_hLightingOriginRelative; EHANDLE m_hLightingOriginRelative;
@ -758,19 +760,12 @@ inline CStudioHdr *C_BaseAnimating::GetModelPtr() const
inline void C_BaseAnimating::InvalidateMdlCache() inline void C_BaseAnimating::InvalidateMdlCache()
{ {
if ( m_pStudioHdr )
{
UnlockStudioHdr(); UnlockStudioHdr();
delete m_pStudioHdr;
m_pStudioHdr = NULL;
}
} }
inline bool C_BaseAnimating::IsModelScaleFractional() const
inline bool C_BaseAnimating::IsModelScaleFractional() const /// very fast way to ask if the model scale is < 1.0f
{ {
COMPILE_TIME_ASSERT( sizeof( m_flModelScale ) == sizeof( int ) ); return ( m_flModelScale < 1.0f );
return *((const int *) &m_flModelScale) < 0x3f800000;
} }
inline bool C_BaseAnimating::IsModelScaled() const inline bool C_BaseAnimating::IsModelScaled() const

View File

@ -34,6 +34,7 @@ C_BaseCombatCharacter::C_BaseCombatCharacter()
m_pGlowEffect = NULL; m_pGlowEffect = NULL;
m_bGlowEnabled = false; m_bGlowEnabled = false;
m_bOldGlowEnabled = false; m_bOldGlowEnabled = false;
m_bClientSideGlowEnabled = false;
#endif // GLOWS_ENABLE #endif // GLOWS_ENABLE
} }
@ -113,6 +114,22 @@ void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b )
*b = 0.76f; *b = 0.76f;
} }
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
/*
void C_BaseCombatCharacter::EnableGlowEffect( float r, float g, float b )
{
// destroy the existing effect
if ( m_pGlowEffect )
{
DestroyGlowEffect();
}
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
}
*/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -125,7 +142,7 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void )
} }
// create a new effect // create a new effect
if ( m_bGlowEnabled ) if ( m_bGlowEnabled || m_bClientSideGlowEnabled )
{ {
float r, g, b; float r, g, b;
GetGlowEffectColor( &r, &g, &b ); GetGlowEffectColor( &r, &g, &b );

View File

@ -97,6 +97,10 @@ public:
#ifdef GLOWS_ENABLE #ifdef GLOWS_ENABLE
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; } CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
virtual void GetGlowEffectColor( float *r, float *g, float *b ); virtual void GetGlowEffectColor( float *r, float *g, float *b );
// void EnableGlowEffect( float r, float g, float b );
void SetClientSideGlowEnabled( bool bEnabled ){ m_bClientSideGlowEnabled = bEnabled; UpdateGlowEffect(); }
bool IsClientSideGlowEnabled( void ){ return m_bClientSideGlowEnabled; }
#endif // GLOWS_ENABLE #endif // GLOWS_ENABLE
public: public:
@ -121,7 +125,8 @@ private:
CHandle< C_BaseCombatWeapon > m_hActiveWeapon; CHandle< C_BaseCombatWeapon > m_hActiveWeapon;
#ifdef GLOWS_ENABLE #ifdef GLOWS_ENABLE
bool m_bGlowEnabled; bool m_bClientSideGlowEnabled; // client-side only value used for spectator
bool m_bGlowEnabled; // networked value
bool m_bOldGlowEnabled; bool m_bOldGlowEnabled;
CGlowObject *m_pGlowEffect; CGlowObject *m_pGlowEffect;
#endif // GLOWS_ENABLE #endif // GLOWS_ENABLE

View File

@ -163,7 +163,10 @@ void C_BaseCombatWeapon::OnDataChanged( DataUpdateType_t updateType )
} }
} }
if ( updateType == DATA_UPDATE_CREATED )
{
UpdateVisibility(); UpdateVisibility();
}
m_iOldState = m_iState; m_iOldState = m_iState;

View File

@ -1150,6 +1150,13 @@ bool C_BaseEntity::InitializeAsClientEntityByIndex( int iIndex, RenderGroup_t re
return true; return true;
} }
void C_BaseEntity::TrackAngRotation( bool bTrack )
{
if ( bTrack )
AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR );
else
RemoveVar( &m_angRotation, false );
}
void C_BaseEntity::Term() void C_BaseEntity::Term()
{ {
@ -2459,8 +2466,6 @@ void C_BaseEntity::UnlinkFromHierarchy()
void C_BaseEntity::ValidateModelIndex( void ) void C_BaseEntity::ValidateModelIndex( void )
{ {
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
if ( m_nModelIndexOverrides[VISION_MODE_NONE] > 0 )
{
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_HALLOWEEN ) ) if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_HALLOWEEN ) )
{ {
if ( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] > 0 ) if ( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] > 0 )
@ -2488,8 +2493,9 @@ void C_BaseEntity::ValidateModelIndex( void )
} }
} }
if ( m_nModelIndexOverrides[VISION_MODE_NONE] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_NONE] ); SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_NONE] );
return; return;
} }
#endif #endif
@ -2621,14 +2627,6 @@ void C_BaseEntity::PostDataUpdate( DataUpdateType_t updateType )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void C_BaseEntity::OnDataUnchangedInPVS() void C_BaseEntity::OnDataUnchangedInPVS()
{ {
Interp_RestoreToLastNetworked( GetVarMapping() );
// For non-predicted and non-client only ents, we need to latch network values into the interpolation histories
if ( !GetPredictable() && !IsClientCreated() )
{
OnLatchInterpolatedVariables( LATCH_SIMULATION_VAR );
}
Assert( m_hNetworkMoveParent.Get() || !m_hNetworkMoveParent.IsValid() ); Assert( m_hNetworkMoveParent.Get() || !m_hNetworkMoveParent.IsValid() );
HierarchySetParent(m_hNetworkMoveParent); HierarchySetParent(m_hNetworkMoveParent);
@ -6308,6 +6306,9 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
if ( FStrEq( pszModel, "models/flag/briefcase.mdl" ) ) if ( FStrEq( pszModel, "models/flag/briefcase.mdl" ) )
return true; return true;
if ( FStrEq( pszModel, "models/passtime/ball/passtime_ball.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/props_doomsday/australium_container.mdl" ) ) if ( FStrEq( pszModel, "models/props_doomsday/australium_container.mdl" ) )
return true; return true;
@ -6323,6 +6324,13 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
if ( FStrEq( pszModel, "models/props_moonbase/powersupply_flag.mdl" ) ) if ( FStrEq( pszModel, "models/props_moonbase/powersupply_flag.mdl" ) )
return true; return true;
// The Halloween 2014 doomsday flag replacement
if ( FStrEq( pszModel, "models/flag/ticket_case.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/weapons/c_models/c_grapple_proj/c_grapple_proj.mdl" ) )
return true;
} }
// Any entity that's not an item parented to a player is invalid. // Any entity that's not an item parented to a player is invalid.

View File

@ -1226,7 +1226,7 @@ protected:
public: public:
// Accessors for above // Accessors for above
static int GetPredictionRandomSeed( void ); static int GetPredictionRandomSeed( bool bUseUnSyncedServerPlatTime = false );
static void SetPredictionRandomSeed( const CUserCmd *cmd ); static void SetPredictionRandomSeed( const CUserCmd *cmd );
static C_BasePlayer *GetPredictionPlayer( void ); static C_BasePlayer *GetPredictionPlayer( void );
static void SetPredictionPlayer( C_BasePlayer *player ); static void SetPredictionPlayer( C_BasePlayer *player );
@ -1394,6 +1394,7 @@ public:
virtual bool IsDeflectable() { return false; } virtual bool IsDeflectable() { return false; }
bool IsCombatCharacter() { return MyCombatCharacterPointer() == NULL ? false : true; }
protected: protected:
int m_nFXComputeFrame; int m_nFXComputeFrame;
@ -1442,6 +1443,8 @@ public:
// a render handle, and is put into the spatial partition. // a render handle, and is put into the spatial partition.
bool InitializeAsClientEntityByIndex( int iIndex, RenderGroup_t renderGroup ); bool InitializeAsClientEntityByIndex( int iIndex, RenderGroup_t renderGroup );
void TrackAngRotation( bool bTrack );
private: private:
friend void OnRenderStart(); friend void OnRenderStart();

View File

@ -122,6 +122,9 @@ ConVar demo_fov_override( "demo_fov_override", "0", FCVAR_CLIENTDLL | FCVAR_DONT
ConVar cl_meathook_neck_pivot_ingame_up( "cl_meathook_neck_pivot_ingame_up", "7.0" ); ConVar cl_meathook_neck_pivot_ingame_up( "cl_meathook_neck_pivot_ingame_up", "7.0" );
ConVar cl_meathook_neck_pivot_ingame_fwd( "cl_meathook_neck_pivot_ingame_fwd", "3.0" ); ConVar cl_meathook_neck_pivot_ingame_fwd( "cl_meathook_neck_pivot_ingame_fwd", "3.0" );
static ConVar cl_clean_textures_on_death( "cl_clean_textures_on_death", "0", FCVAR_DEVELOPMENTONLY, "If enabled, attempts to purge unused textures every time a freeze cam is shown" );
void RecvProxy_LocalVelocityX( const CRecvProxyData *pData, void *pStruct, void *pOut ); void RecvProxy_LocalVelocityX( const CRecvProxyData *pData, void *pStruct, void *pOut );
void RecvProxy_LocalVelocityY( const CRecvProxyData *pData, void *pStruct, void *pOut ); void RecvProxy_LocalVelocityY( const CRecvProxyData *pData, void *pStruct, void *pOut );
void RecvProxy_LocalVelocityZ( const CRecvProxyData *pData, void *pStruct, void *pOut ); void RecvProxy_LocalVelocityZ( const CRecvProxyData *pData, void *pStruct, void *pOut );
@ -436,6 +439,7 @@ C_BasePlayer::C_BasePlayer() : m_iv_vecViewOffset( "C_BasePlayer::m_iv_vecViewOf
m_bFiredWeapon = false; m_bFiredWeapon = false;
m_nForceVisionFilterFlags = 0; m_nForceVisionFilterFlags = 0;
m_nLocalPlayerVisionFlags = 0;
ListenForGameEvent( "base_player_teleported" ); ListenForGameEvent( "base_player_teleported" );
} }
@ -541,6 +545,7 @@ CBaseEntity *C_BasePlayer::GetObserverTarget() const // returns players target o
case OBS_MODE_FIXED: // view from a fixed camera position case OBS_MODE_FIXED: // view from a fixed camera position
case OBS_MODE_IN_EYE: // follow a player in first person view case OBS_MODE_IN_EYE: // follow a player in first person view
case OBS_MODE_CHASE: // follow a player in third person view case OBS_MODE_CHASE: // follow a player in third person view
case OBS_MODE_POI: // PASSTIME point of interest - game objective, big fight, anything interesting
case OBS_MODE_ROAMING: // free roaming case OBS_MODE_ROAMING: // free roaming
return m_hObserverTarget; return m_hObserverTarget;
break; break;
@ -635,6 +640,7 @@ int C_BasePlayer::GetObserverMode() const
case OBS_MODE_FIXED: // view from a fixed camera position case OBS_MODE_FIXED: // view from a fixed camera position
case OBS_MODE_IN_EYE: // follow a player in first person view case OBS_MODE_IN_EYE: // follow a player in first person view
case OBS_MODE_CHASE: // follow a player in third person view case OBS_MODE_CHASE: // follow a player in third person view
case OBS_MODE_POI: // PASSTIME point of interest - game objective, big fight, anything interesting
case OBS_MODE_ROAMING: // free roaming case OBS_MODE_ROAMING: // free roaming
return m_iObserverMode; return m_iObserverMode;
break; break;
@ -880,6 +886,10 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
// Force the sound mixer to the freezecam mixer // Force the sound mixer to the freezecam mixer
ConVar *pVar = (ConVar *)cvar->FindVar( "snd_soundmixer" ); ConVar *pVar = (ConVar *)cvar->FindVar( "snd_soundmixer" );
pVar->SetValue( "FreezeCam_Only" ); pVar->SetValue( "FreezeCam_Only" );
// When we start, give unused textures an opportunity to unload
if ( cl_clean_textures_on_death.GetBool() )
g_pMaterialSystem->UncacheUnusedMaterials( false );
} }
else if ( m_bWasFreezeFraming && GetObserverMode() != OBS_MODE_FREEZECAM ) else if ( m_bWasFreezeFraming && GetObserverMode() != OBS_MODE_FREEZECAM )
{ {
@ -897,6 +907,14 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
m_nForceVisionFilterFlags = 0; m_nForceVisionFilterFlags = 0;
CalculateVisionUsingCurrentFlags(); CalculateVisionUsingCurrentFlags();
} }
// force calculate vision when the local vision flags changed
int nCurrentLocalPlayerVisionFlags = GetLocalPlayerVisionFilterFlags();
if ( m_nLocalPlayerVisionFlags != nCurrentLocalPlayerVisionFlags )
{
CalculateVisionUsingCurrentFlags();
m_nLocalPlayerVisionFlags = nCurrentLocalPlayerVisionFlags;
}
} }
// If we are updated while paused, allow the player origin to be snapped by the // If we are updated while paused, allow the player origin to be snapped by the
@ -2078,7 +2096,7 @@ void C_BasePlayer::GetToolRecordingState( KeyValues *msg )
// then this code can (should!) be removed // then this code can (should!) be removed
if ( state.m_bThirdPerson ) if ( state.m_bThirdPerson )
{ {
Vector cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles(); const Vector& cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles();
QAngle camAngles; QAngle camAngles;
camAngles[ PITCH ] = cam_ofs[ PITCH ]; camAngles[ PITCH ] = cam_ofs[ PITCH ];
@ -2594,7 +2612,7 @@ void C_BasePlayer::NotePredictionError( const Vector &vDelta )
// offset curtime and setup bones at that time using fake interpolation // offset curtime and setup bones at that time using fake interpolation
// fake interpolation means we don't have reliable interpolation history (the local player doesn't animate locally) // fake interpolation means we don't have reliable interpolation history (the local player doesn't animate locally)
// so we just modify cycle and origin directly and use that as a fake guess // so we just modify cycle and origin directly and use that as a fake guess
void C_BasePlayer::ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOut, float curtimeOffset ) bool C_BasePlayer::ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOut, float curtimeOffset )
{ {
// we don't have any interpolation data, so fake it // we don't have any interpolation data, so fake it
float cycle = m_flCycle; float cycle = m_flCycle;
@ -2609,30 +2627,37 @@ void C_BasePlayer::ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOu
m_flCycle = fmod( 10 + cycle + m_flPlaybackRate * curtimeOffset, 1.0f ); m_flCycle = fmod( 10 + cycle + m_flPlaybackRate * curtimeOffset, 1.0f );
SetLocalOrigin( origin + curtimeOffset * GetLocalVelocity() ); SetLocalOrigin( origin + curtimeOffset * GetLocalVelocity() );
// Setup bone state to extrapolate physics velocity // Setup bone state to extrapolate physics velocity
SetupBones( pBonesOut, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime + curtimeOffset ); bool bSuccess = SetupBones( pBonesOut, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime + curtimeOffset );
m_flCycle = cycle; m_flCycle = cycle;
SetLocalOrigin( origin ); SetLocalOrigin( origin );
return bSuccess;
} }
void C_BasePlayer::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) bool C_BasePlayer::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
{ {
if ( !IsLocalPlayer() ) if ( !IsLocalPlayer() )
{ return BaseClass::GetRagdollInitBoneArrays(pDeltaBones0, pDeltaBones1, pCurrentBones, boneDt);
BaseClass::GetRagdollInitBoneArrays(pDeltaBones0, pDeltaBones1, pCurrentBones, boneDt);
return; bool bSuccess = true;
}
ForceSetupBonesAtTimeFakeInterpolation( pDeltaBones0, -boneDt ); if ( !ForceSetupBonesAtTimeFakeInterpolation( pDeltaBones0, -boneDt ) )
ForceSetupBonesAtTimeFakeInterpolation( pDeltaBones1, 0 ); bSuccess = false;
if ( !ForceSetupBonesAtTimeFakeInterpolation( pDeltaBones1, 0 ) )
bSuccess = false;
float ragdollCreateTime = PhysGetSyncCreateTime(); float ragdollCreateTime = PhysGetSyncCreateTime();
if ( ragdollCreateTime != gpGlobals->curtime ) if ( ragdollCreateTime != gpGlobals->curtime )
{ {
ForceSetupBonesAtTimeFakeInterpolation( pCurrentBones, ragdollCreateTime - gpGlobals->curtime ); if ( !ForceSetupBonesAtTimeFakeInterpolation( pCurrentBones, ragdollCreateTime - gpGlobals->curtime ) )
bSuccess = false;
} }
else else
{ {
SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime ); if ( !SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime ) )
bSuccess = false;
} }
return bSuccess;
} }
@ -2838,6 +2863,7 @@ void C_BasePlayer::UpdateWearables( void )
{ {
pItem->ValidateModelIndex(); pItem->ValidateModelIndex();
pItem->UpdateVisibility(); pItem->UpdateVisibility();
pItem->CreateShadow();
} }
} }
} }

View File

@ -169,7 +169,7 @@ public:
virtual IRagdoll* GetRepresentativeRagdoll() const; virtual IRagdoll* GetRepresentativeRagdoll() const;
// override the initial bone position for ragdolls // override the initial bone position for ragdolls
virtual void GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ); virtual bool GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) OVERRIDE;
// Returns eye vectors // Returns eye vectors
void EyeVectors( Vector *pForward, Vector *pRight = NULL, Vector *pUp = NULL ); void EyeVectors( Vector *pForward, Vector *pRight = NULL, Vector *pUp = NULL );
@ -388,7 +388,7 @@ public:
#if defined USES_ECON_ITEMS #if defined USES_ECON_ITEMS
// Wearables // Wearables
void UpdateWearables(); virtual void UpdateWearables();
C_EconWearable *GetWearable( int i ) { return m_hMyWearables[i]; } C_EconWearable *GetWearable( int i ) { return m_hMyWearables[i]; }
int GetNumWearables( void ) { return m_hMyWearables.Count(); } int GetNumWearables( void ) { return m_hMyWearables.Count(); }
#endif #endif
@ -585,7 +585,7 @@ protected:
virtual bool IsDucked( void ) const { return m_Local.m_bDucked; } virtual bool IsDucked( void ) const { return m_Local.m_bDucked; }
virtual bool IsDucking( void ) const { return m_Local.m_bDucking; } virtual bool IsDucking( void ) const { return m_Local.m_bDucking; }
virtual float GetFallVelocity( void ) { return m_Local.m_flFallVelocity; } virtual float GetFallVelocity( void ) { return m_Local.m_flFallVelocity; }
void ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOut, float curtimeOffset ); bool ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOut, float curtimeOffset );
float m_flLaggedMovementValue; float m_flLaggedMovementValue;
@ -611,6 +611,7 @@ protected:
float m_flNextAchievementAnnounceTime; float m_flNextAchievementAnnounceTime;
int m_nForceVisionFilterFlags; // Force our vision filter to a specific setting int m_nForceVisionFilterFlags; // Force our vision filter to a specific setting
int m_nLocalPlayerVisionFlags;
#if defined USES_ECON_ITEMS #if defined USES_ECON_ITEMS
// Wearables // Wearables

View File

@ -18,6 +18,9 @@
#include "tools/bonelist.h" #include "tools/bonelist.h"
#include <KeyValues.h> #include <KeyValues.h>
#include "hltvcamera.h" #include "hltvcamera.h"
#ifdef TF_CLIENT_DLL
#include "tf_weaponbase.h"
#endif
#if defined( REPLAY_ENABLED ) #if defined( REPLAY_ENABLED )
#include "replay/replaycamera.h" #include "replay/replaycamera.h"
@ -53,8 +56,8 @@ void FormatViewModelAttachment( Vector &vOrigin, bool bInverse )
// aspect ratio cancels out, so only need one factor // aspect ratio cancels out, so only need one factor
// the difference between the screen coordinates of the 2 systems is the ratio // the difference between the screen coordinates of the 2 systems is the ratio
// of the coefficients of the projection matrices (tan (fov/2) is that coefficient) // of the coefficients of the projection matrices (tan (fov/2) is that coefficient)
float factorX = worldx / viewx; // NOTE: viewx was coming in as 0 when folks set their viewmodel_fov to 0 and show their weapon.
float factorX = viewx ? ( worldx / viewx ) : 0.0f;
float factorY = factorX; float factorY = factorX;
// Get the coordinates in the viewer's space. // Get the coordinates in the viewer's space.
@ -331,6 +334,16 @@ int C_BaseViewModel::DrawModel( int flags )
} }
} }
#ifdef TF_CLIENT_DLL
CTFWeaponBase* pTFWeapon = dynamic_cast<CTFWeaponBase*>( pWeapon );
if ( ( flags & STUDIO_RENDER ) && pTFWeapon && pTFWeapon->m_viewmodelStatTrakAddon )
{
pTFWeapon->m_viewmodelStatTrakAddon->RemoveEffects( EF_NODRAW );
pTFWeapon->m_viewmodelStatTrakAddon->DrawModel( flags );
pTFWeapon->m_viewmodelStatTrakAddon->AddEffects( EF_NODRAW );
}
#endif
return ret; return ret;
} }

View File

@ -12,6 +12,7 @@
#include "input.h" #include "input.h"
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
#include "cdll_util.h" #include "cdll_util.h"
#include "tf_gamerules.h"
#endif #endif
#include "rope_helpers.h" #include "rope_helpers.h"
#include "engine/ivmodelinfo.h" #include "engine/ivmodelinfo.h"
@ -640,6 +641,15 @@ bool CRopeManager::IsHolidayLightMode( void )
return false; return false;
} }
#ifdef TF_CLIENT_DLL
if ( TFGameRules() && TFGameRules()->IsPowerupMode() )
{
// We don't want to draw the lights for the grapple.
// They get left behind for a while and look bad.
return false;
}
#endif
bool bDrawHolidayLights = false; bool bDrawHolidayLights = false;
#ifdef USES_ECON_ITEMS #ifdef USES_ECON_ITEMS
@ -1638,12 +1648,12 @@ struct catmull_t
}; };
// bake out the terms of the catmull rom spline // bake out the terms of the catmull rom spline
void Catmull_Rom_Spline_Matrix( const Vector &p1, const Vector &p2, const Vector &p3, const Vector &p4, catmull_t &output ) void Catmull_Rom_Spline_Matrix( const Vector &vecP1, const Vector &vecP2, const Vector &vecP3, const Vector &vecP4, catmull_t &output )
{ {
output.t3 = 0.5f * ((-1*p1) + (3*p2) + (-3*p3) + p4); // 0.5 t^3 * [ (-1*p1) + ( 3*p2) + (-3*p3) + p4 ] output.t3 = 0.5f * ( ( -1 * vecP1 ) + ( 3 * vecP2 ) + ( -3 * vecP3 ) + vecP4 ); // 0.5 t^3 * [ (-1*p1) + ( 3*p2) + (-3*p3) + p4 ]
output.t2 = 0.5f * ((2*p1) + (-5*p2) + (4*p3) - p4); // 0.5 t^2 * [ ( 2*p1) + (-5*p2) + ( 4*p3) - p4 ] output.t2 = 0.5f * ( ( 2 * vecP1 ) + ( -5 * vecP2 ) + ( 4 * vecP3 ) - vecP4 ); // 0.5 t^2 * [ ( 2*p1) + (-5*p2) + ( 4*p3) - p4 ]
output.t = 0.5f * ((-1*p1) + p3); // 0.5 t * [ (-1*p1) + p3 ] output.t = 0.5f * ( ( -1 * vecP1 ) + vecP3 ); // 0.5 t * [ (-1*p1) + p3 ]
output.c = p2; // p2 output.c = vecP2; // p2
} }
// evaluate one point on the spline, t is a vector of (t, t^2, t^3) // evaluate one point on the spline, t is a vector of (t, t^2, t^3)

View File

@ -219,7 +219,7 @@ void C_SceneEntity::SetupClientOnlyScene( const char *pszFilename, C_BaseFlex *p
{ {
LoadSceneFromFile( szFilename ); LoadSceneFromFile( szFilename );
if (!CommandLine()->FindParm("-hushasserts")) if ( !HushAsserts() )
{ {
Assert( m_pScene ); Assert( m_pScene );
} }
@ -257,7 +257,7 @@ void C_SceneEntity::SetupClientOnlyScene( const char *pszFilename, C_BaseFlex *p
if ( m_hOwner.Get() ) if ( m_hOwner.Get() )
{ {
if (!CommandLine()->FindParm("-hushasserts")) if ( !HushAsserts() )
{ {
Assert( m_pScene ); Assert( m_pScene );
} }
@ -1108,7 +1108,7 @@ void C_SceneEntity::SetCurrentTime( float t, bool forceClientSync )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene ) void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene )
{ {
if (!CommandLine()->FindParm("-hushasserts")) if ( !HushAsserts() )
{ {
Assert( pScene && m_bMultiplayer ); Assert( pScene && m_bMultiplayer );
} }

View File

@ -272,8 +272,8 @@ void C_SlideshowDisplay::BuildSlideShowImagesList( void )
if ( bLoaded ) if ( bLoaded )
{ {
char szKeywords[ 256 ]; char szKeywords[ 256 ] = {0};
Q_strcpy( szKeywords, pMaterialKeys->GetString( "%keywords", "" ) ); V_strcpy_safe( szKeywords, pMaterialKeys->GetString( "%keywords", "" ) );
char *pchKeyword = szKeywords; char *pchKeyword = szKeywords;
@ -306,7 +306,7 @@ void C_SlideshowDisplay::BuildSlideShowImagesList( void )
{ {
// Couldn't find the list, so create it // Couldn't find the list, so create it
iList = m_SlideMaterialLists.AddToTail( new SlideMaterialList_t ); iList = m_SlideMaterialLists.AddToTail( new SlideMaterialList_t );
Q_strcpy( m_SlideMaterialLists[ iList ]->szSlideKeyword, pchKeyword ); V_strcpy_safe( m_SlideMaterialLists[iList]->szSlideKeyword, pchKeyword );
} }
// Add material index to this list // Add material index to this list
@ -329,7 +329,7 @@ void C_SlideshowDisplay::BuildSlideShowImagesList( void )
{ {
// Couldn't find the generic list, so create it // Couldn't find the generic list, so create it
iList = m_SlideMaterialLists.AddToHead( new SlideMaterialList_t ); iList = m_SlideMaterialLists.AddToHead( new SlideMaterialList_t );
Q_strcpy( m_SlideMaterialLists[ iList ]->szSlideKeyword, "" ); V_strcpy_safe( m_SlideMaterialLists[iList]->szSlideKeyword, "" );
} }
// Add material index to this list // Add material index to this list

View File

@ -150,7 +150,7 @@ public:
{ {
Msg( "- %d: %s\n", i, m_soundscapes[i]->GetName() ); Msg( "- %d: %s\n", i, m_soundscapes[i]->GetName() );
} }
if ( m_forcedSoundscapeIndex ) if ( m_forcedSoundscapeIndex >= 0 )
{ {
Msg( "- PLAYING DEBUG SOUNDSCAPE: %d [%s]\n", m_forcedSoundscapeIndex, SoundscapeNameByIndex(m_forcedSoundscapeIndex) ); Msg( "- PLAYING DEBUG SOUNDSCAPE: %d [%s]\n", m_forcedSoundscapeIndex, SoundscapeNameByIndex(m_forcedSoundscapeIndex) );
} }

View File

@ -104,7 +104,7 @@ public:
Assert( iCapper != TEAM_UNASSIGNED ); Assert( iCapper != TEAM_UNASSIGNED );
return GetIconForTeam( index, iCapper );; return GetIconForTeam( index, iCapper );
} }
// Icon for the specified team // Icon for the specified team

View File

@ -81,7 +81,7 @@ C_VoteController::~C_VoteController()
void C_VoteController::ResetData() void C_VoteController::ResetData()
{ {
m_iActiveIssueIndex = INVALID_ISSUE; m_iActiveIssueIndex = INVALID_ISSUE;
m_iOnlyTeamToVote = TEAM_INVALID; m_iOnlyTeamToVote = TEAM_UNASSIGNED;
for( int index = 0; index < MAX_VOTE_OPTIONS; index++ ) for( int index = 0; index < MAX_VOTE_OPTIONS; index++ )
{ {
m_nVoteOptionCount[index] = 0; m_nVoteOptionCount[index] = 0;
@ -118,9 +118,11 @@ void C_VoteController::ClientThink()
{ {
if ( m_nPotentialVotes > 0 ) if ( m_nPotentialVotes > 0 )
{ {
#ifdef STAGING_ONLY
// Currently hard-coded to MAX_VOTE_COUNT options per issue // Currently hard-coded to MAX_VOTE_COUNT options per issue
DevMsg( "Votes: Option1 - %d, Option2 - %d, Option3 - %d, Option4 - %d, Option5 - %d\n", DevMsg( "Votes: Option1 - %d, Option2 - %d, Option3 - %d, Option4 - %d, Option5 - %d\n",
m_nVoteOptionCount[0], m_nVoteOptionCount[1], m_nVoteOptionCount[2], m_nVoteOptionCount[3], m_nVoteOptionCount[4] ); m_nVoteOptionCount[0], m_nVoteOptionCount[1], m_nVoteOptionCount[2], m_nVoteOptionCount[3], m_nVoteOptionCount[4] );
#endif // STAGING_ONLY
IGameEvent *event = gameeventmanager->CreateEvent( "vote_changed" ); IGameEvent *event = gameeventmanager->CreateEvent( "vote_changed" );
if ( event ) if ( event )

View File

@ -133,7 +133,7 @@ float GetClientInterpAmount()
} }
else else
{ {
if (!CommandLine()->FindParm("-hushasserts")) if ( !HushAsserts() )
{ {
AssertMsgOnce( false, "GetInterpolationAmount: can't get cl_updaterate cvar." ); AssertMsgOnce( false, "GetInterpolationAmount: can't get cl_updaterate cvar." );
} }

View File

@ -141,6 +141,7 @@
#if defined( TF_CLIENT_DLL ) #if defined( TF_CLIENT_DLL )
#include "econ/tool_items/custom_texture_cache.h" #include "econ/tool_items/custom_texture_cache.h"
#endif #endif
#ifdef WORKSHOP_IMPORT_ENABLED #ifdef WORKSHOP_IMPORT_ENABLED
@ -568,7 +569,8 @@ void DisplayBoneSetupEnts()
if ( pEnt->m_Count >= 3 ) if ( pEnt->m_Count >= 3 )
{ {
printInfo.color[0] = 1; printInfo.color[0] = 1;
printInfo.color[1] = printInfo.color[2] = 0; printInfo.color[1] = 0;
printInfo.color[2] = 0;
} }
else if ( pEnt->m_Count == 2 ) else if ( pEnt->m_Count == 2 )
{ {
@ -578,7 +580,9 @@ void DisplayBoneSetupEnts()
} }
else else
{ {
printInfo.color[0] = printInfo.color[0] = printInfo.color[0] = 1; printInfo.color[0] = 1;
printInfo.color[1] = 1;
printInfo.color[2] = 1;
} }
engine->Con_NXPrintf( &printInfo, "%25s / %3d / %3d", pEnt->m_ModelName, pEnt->m_Count, pEnt->m_Index ); engine->Con_NXPrintf( &printInfo, "%25s / %3d / %3d", pEnt->m_ModelName, pEnt->m_Count, pEnt->m_Index );
printInfo.index++; printInfo.index++;
@ -2561,8 +2565,8 @@ void CHLClient::ClientAdjustStartSoundParams( StartSoundParams_t& params )
// Halloween voice futzery? // Halloween voice futzery?
else else
{ {
float flHeadScale = 1.f; float flVoicePitchScale = 1.f;
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pEntity, flHeadScale, head_scale ); CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pEntity, flVoicePitchScale, voice_pitch_scale );
int iHalloweenVoiceSpell = 0; int iHalloweenVoiceSpell = 0;
CALL_ATTRIB_HOOK_INT_ON_OTHER( pEntity, iHalloweenVoiceSpell, halloween_voice_modulation ); CALL_ATTRIB_HOOK_INT_ON_OTHER( pEntity, iHalloweenVoiceSpell, halloween_voice_modulation );
@ -2570,17 +2574,9 @@ void CHLClient::ClientAdjustStartSoundParams( StartSoundParams_t& params )
{ {
params.pitch *= 0.8f; params.pitch *= 0.8f;
} }
else if( flHeadScale != 1.f ) else if( flVoicePitchScale != 1.f )
{ {
// Big head, deep voice params.pitch *= flVoicePitchScale;
if( flHeadScale > 1.f )
{
params.pitch *= 0.8f;
}
else // Small head, high voice
{
params.pitch *= 1.3f;
}
} }
} }
} }

View File

@ -1252,7 +1252,8 @@ $Project
$Lib vtf $Lib vtf
$ImpLib steam_api $ImpLib steam_api
$Lib $LIBCOMMON/libcrypto [$POSIX] $Libexternal $LIBCOMMON/libcrypto [$OSXALL]
$Libexternal "$SRCDIR\lib\common\$(CRYPTOPPDIR)\libcrypto" [$LINUXALL]
$ImpLib "$LIBCOMMON\curl" [$OSXALL] $ImpLib "$LIBCOMMON\curl" [$OSXALL]
@ -1262,7 +1263,7 @@ $Project
$Libexternal libz [$LINUXALL] $Libexternal libz [$LINUXALL]
$Libexternal "$LIBCOMMON/libcurl" [$LINUXALL] $Libexternal "$LIBCOMMON/libcurl" [$LINUXALL]
$Libexternal "$LIBCOMMON/libcurlssl" [$LINUXALL] $Libexternal "$LIBCOMMON/libcurlssl" [$LINUXALL]
$Libexternal "$LIBCOMMON/libssl" [$LINUXALL] $Libexternal "$SRCDIR\lib\common\$(CRYPTOPPDIR)\libssl" [$LINUXALL]
} }
} }

View File

@ -189,12 +189,12 @@ private:
void RemoveShadowFromLeaves( ClientLeafShadowHandle_t handle ); void RemoveShadowFromLeaves( ClientLeafShadowHandle_t handle );
// Methods associated with the various bi-directional sets // Methods associated with the various bi-directional sets
static unsigned short& FirstRenderableInLeaf( int leaf ) static unsigned int& FirstRenderableInLeaf( int leaf )
{ {
return s_ClientLeafSystem.m_Leaf[leaf].m_FirstElement; return s_ClientLeafSystem.m_Leaf[leaf].m_FirstElement;
} }
static unsigned short& FirstLeafInRenderable( unsigned short renderable ) static unsigned int& FirstLeafInRenderable( unsigned short renderable )
{ {
return s_ClientLeafSystem.m_Renderables[renderable].m_LeafList; return s_ClientLeafSystem.m_Renderables[renderable].m_LeafList;
} }
@ -248,8 +248,8 @@ private:
int m_RenderFrame2; int m_RenderFrame2;
int m_EnumCount; // Have I been added to a particular shadow yet? int m_EnumCount; // Have I been added to a particular shadow yet?
int m_TranslucencyCalculated; int m_TranslucencyCalculated;
unsigned short m_LeafList; // What leafs is it in? unsigned int m_LeafList; // What leafs is it in?
unsigned short m_RenderLeaf; // What leaf do I render in? unsigned int m_RenderLeaf; // What leaf do I render in?
unsigned char m_Flags; // rendering flags unsigned char m_Flags; // rendering flags
unsigned char m_RenderGroup; // RenderGroup_t type unsigned char m_RenderGroup; // RenderGroup_t type
unsigned short m_FirstShadow; // The first shadow caster that cast on it unsigned short m_FirstShadow; // The first shadow caster that cast on it
@ -260,7 +260,7 @@ private:
// The leaf contains an index into a list of renderables // The leaf contains an index into a list of renderables
struct ClientLeaf_t struct ClientLeaf_t
{ {
unsigned short m_FirstElement; unsigned int m_FirstElement;
unsigned short m_FirstShadow; unsigned short m_FirstShadow;
unsigned short m_FirstDetailProp; unsigned short m_FirstDetailProp;
@ -302,7 +302,7 @@ private:
CUtlLinkedList< ShadowInfo_t, ClientLeafShadowHandle_t, false, unsigned int > m_Shadows; CUtlLinkedList< ShadowInfo_t, ClientLeafShadowHandle_t, false, unsigned int > m_Shadows;
// Maintains the list of all renderables in a particular leaf // Maintains the list of all renderables in a particular leaf
CBidirectionalSet< int, ClientRenderHandle_t, unsigned short, unsigned int > m_RenderablesInLeaf; CBidirectionalSet< int, ClientRenderHandle_t, unsigned int, unsigned int > m_RenderablesInLeaf;
// Maintains a list of all shadows in a particular leaf // Maintains a list of all shadows in a particular leaf
CBidirectionalSet< int, ClientLeafShadowHandle_t, unsigned short, unsigned int > m_ShadowsInLeaf; CBidirectionalSet< int, ClientLeafShadowHandle_t, unsigned short, unsigned int > m_ShadowsInLeaf;
@ -343,7 +343,8 @@ void DefaultRenderBoundsWorldspace( IClientRenderable *pRenderable, Vector &absM
{ {
// Tracker 37433: This fixes a bug where if the stunstick is being wielded by a combine soldier, the fact that the stick was // Tracker 37433: This fixes a bug where if the stunstick is being wielded by a combine soldier, the fact that the stick was
// attached to the soldier's hand would move it such that it would get frustum culled near the edge of the screen. // attached to the soldier's hand would move it such that it would get frustum culled near the edge of the screen.
C_BaseEntity *pEnt = pRenderable->GetIClientUnknown()->GetBaseEntity(); IClientUnknown *pUnk = pRenderable->GetIClientUnknown();
C_BaseEntity *pEnt = pUnk->GetBaseEntity();
if ( pEnt && pEnt->IsFollowingEntity() ) if ( pEnt && pEnt->IsFollowingEntity() )
{ {
C_BaseEntity *pParent = pEnt->GetFollowedEntity(); C_BaseEntity *pParent = pEnt->GetFollowedEntity();
@ -629,7 +630,7 @@ void CClientLeafSystem::NewRenderable( IClientRenderable* pRenderable, RenderGro
info.m_Flags = flags; info.m_Flags = flags;
info.m_RenderGroup = (unsigned char)type; info.m_RenderGroup = (unsigned char)type;
info.m_EnumCount = 0; info.m_EnumCount = 0;
info.m_RenderLeaf = 0xFFFF; info.m_RenderLeaf = m_RenderablesInLeaf.InvalidIndex();
if ( IsViewModelRenderGroup( (RenderGroup_t)info.m_RenderGroup ) ) if ( IsViewModelRenderGroup( (RenderGroup_t)info.m_RenderGroup ) )
{ {
AddToViewModelList( handle ); AddToViewModelList( handle );
@ -986,7 +987,7 @@ void CClientLeafSystem::AddShadowToLeaf( int leaf, ClientLeafShadowHandle_t shad
m_ShadowsInLeaf.AddElementToBucket( leaf, shadow ); m_ShadowsInLeaf.AddElementToBucket( leaf, shadow );
// Add the shadow exactly once to all renderables in the leaf // Add the shadow exactly once to all renderables in the leaf
unsigned short i = m_RenderablesInLeaf.FirstElement( leaf ); unsigned int i = m_RenderablesInLeaf.FirstElement( leaf );
while ( i != m_RenderablesInLeaf.InvalidIndex() ) while ( i != m_RenderablesInLeaf.InvalidIndex() )
{ {
ClientRenderHandle_t renderable = m_RenderablesInLeaf.Element(i); ClientRenderHandle_t renderable = m_RenderablesInLeaf.Element(i);
@ -1092,7 +1093,54 @@ void CClientLeafSystem::AddRenderableToLeaf( int leaf, ClientRenderHandle_t rend
#ifdef VALIDATE_CLIENT_LEAF_SYSTEM #ifdef VALIDATE_CLIENT_LEAF_SYSTEM
m_RenderablesInLeaf.ValidateAddElementToBucket( leaf, renderable ); m_RenderablesInLeaf.ValidateAddElementToBucket( leaf, renderable );
#endif #endif
m_RenderablesInLeaf.AddElementToBucket( leaf, renderable );
#ifdef DUMP_RENDERABLE_LEAFS
static uint32 count = 0;
if (count < m_RenderablesInLeaf.NumAllocated())
{
count = m_RenderablesInLeaf.NumAllocated();
Msg("********** frame: %d count:%u ***************\n", gpGlobals->framecount, count );
if (count >= 20000)
{
for (int j = 0; j < m_RenderablesInLeaf.NumAllocated(); j++)
{
const ClientRenderHandle_t& renderable = m_RenderablesInLeaf.Element(j);
RenderableInfo_t& info = m_Renderables[renderable];
char pTemp[256];
const char *pClassName = "<unknown renderable>";
C_BaseEntity *pEnt = info.m_pRenderable->GetIClientUnknown()->GetBaseEntity();
if ( pEnt )
{
pClassName = pEnt->GetClassname();
}
else
{
CNewParticleEffect *pEffect = dynamic_cast< CNewParticleEffect*>( info.m_pRenderable );
if ( pEffect )
{
Vector mins, maxs;
pEffect->GetRenderBounds(mins, maxs);
Q_snprintf( pTemp, sizeof(pTemp), "ps: %s %.2f,%.2f", pEffect->GetEffectName(), maxs.x - mins.x, maxs.y - mins.y );
pClassName = pTemp;
}
else if ( dynamic_cast< CParticleEffectBinding* >( info.m_pRenderable ) )
{
pClassName = "<old particle system>";
}
}
Msg(" %d: %p group:%d %s %d %d TransCalc:%d renderframe:%d\n", j, info.m_pRenderable, info.m_RenderGroup, pClassName,
info.m_LeafList, info.m_RenderLeaf, info.m_TranslucencyCalculated, info.m_RenderFrame);
}
DebuggerBreak();
}
}
#endif // DUMP_RENDERABLE_LEAFS
m_RenderablesInLeaf.AddElementToBucket(leaf, renderable);
if ( !ShouldRenderableReceiveShadow( renderable, SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK ) ) if ( !ShouldRenderableReceiveShadow( renderable, SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK ) )
return; return;
@ -1344,7 +1392,7 @@ void CClientLeafSystem::ComputeTranslucentRenderLeaf( int count, const LeafIndex
orderedList.AddToTail( LeafToMarker( leaf ) ); orderedList.AddToTail( LeafToMarker( leaf ) );
// iterate over all elements in this leaf // iterate over all elements in this leaf
unsigned short idx = m_RenderablesInLeaf.FirstElement(leaf); unsigned int idx = m_RenderablesInLeaf.FirstElement(leaf);
while (idx != m_RenderablesInLeaf.InvalidIndex()) while (idx != m_RenderablesInLeaf.InvalidIndex())
{ {
RenderableInfo_t& info = m_Renderables[m_RenderablesInLeaf.Element(idx)]; RenderableInfo_t& info = m_Renderables[m_RenderablesInLeaf.Element(idx)];
@ -1512,7 +1560,7 @@ void CClientLeafSystem::CollateRenderablesInLeaf( int leaf, int worldListLeafInd
AddRenderableToRenderList( *info.m_pRenderList, NULL, worldListLeafIndex, RENDER_GROUP_OPAQUE_ENTITY, NULL ); AddRenderableToRenderList( *info.m_pRenderList, NULL, worldListLeafIndex, RENDER_GROUP_OPAQUE_ENTITY, NULL );
// Collate everything. // Collate everything.
unsigned short idx = m_RenderablesInLeaf.FirstElement(leaf); unsigned int idx = m_RenderablesInLeaf.FirstElement(leaf);
for ( ;idx != m_RenderablesInLeaf.InvalidIndex(); idx = m_RenderablesInLeaf.NextElement(idx) ) for ( ;idx != m_RenderablesInLeaf.InvalidIndex(); idx = m_RenderablesInLeaf.NextElement(idx) )
{ {
ClientRenderHandle_t handle = m_RenderablesInLeaf.Element(idx); ClientRenderHandle_t handle = m_RenderablesInLeaf.Element(idx);

View File

@ -85,6 +85,12 @@ extern ConVar v_viewmodel_fov;
extern ConVar voice_modenable; extern ConVar voice_modenable;
extern bool IsInCommentaryMode( void ); extern bool IsInCommentaryMode( void );
extern const char* GetWearLocalizationString( float flWear );
CON_COMMAND( cl_reload_localization_files, "Reloads all localization files" )
{
g_pVGuiLocalize->ReloadLocalizationFiles();
}
#ifdef VOICE_VOX_ENABLE #ifdef VOICE_VOX_ENABLE
void VoxCallback( IConVar *var, const char *oldString, float oldFloat ) void VoxCallback( IConVar *var, const char *oldString, float oldFloat )
@ -141,7 +147,7 @@ CON_COMMAND( hud_reloadscheme, "Reloads hud layout and animation scripts." )
if ( !mode ) if ( !mode )
return; return;
mode->ReloadScheme(); mode->ReloadScheme(true);
} }
#ifdef _DEBUG #ifdef _DEBUG
@ -292,8 +298,14 @@ ClientModeShared::~ClientModeShared()
delete m_pViewport; delete m_pViewport;
} }
void ClientModeShared::ReloadScheme( void ) void ClientModeShared::ReloadScheme( bool flushLowLevel )
{ {
// Invalidate the global cache first.
if (flushLowLevel)
{
KeyValuesSystem()->InvalidateCache();
}
m_pViewport->ReloadScheme( "resource/ClientScheme.res" ); m_pViewport->ReloadScheme( "resource/ClientScheme.res" );
ClearKeyValuesCache(); ClearKeyValuesCache();
} }
@ -335,7 +347,7 @@ void ClientModeShared::Init()
Assert( m_pReplayReminderPanel ); Assert( m_pReplayReminderPanel );
#endif #endif
ListenForGameEvent( "player_connect" ); ListenForGameEvent( "player_connect_client" );
ListenForGameEvent( "player_disconnect" ); ListenForGameEvent( "player_disconnect" );
ListenForGameEvent( "player_team" ); ListenForGameEvent( "player_team" );
ListenForGameEvent( "server_cvar" ); ListenForGameEvent( "server_cvar" );
@ -421,7 +433,7 @@ void ClientModeShared::OverrideView( CViewSetup *pSetup )
if( ::input->CAM_IsThirdPerson() ) if( ::input->CAM_IsThirdPerson() )
{ {
Vector cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles(); const Vector& cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles();
Vector cam_ofs_distance = g_ThirdPersonManager.GetFinalCameraOffset(); Vector cam_ofs_distance = g_ThirdPersonManager.GetFinalCameraOffset();
cam_ofs_distance *= g_ThirdPersonManager.GetDistanceFraction(); cam_ofs_distance *= g_ThirdPersonManager.GetDistanceFraction();
@ -867,7 +879,7 @@ void ClientModeShared::LevelShutdown( void )
void ClientModeShared::Enable() void ClientModeShared::Enable()
{ {
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();; vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();
// Add our viewport to the root panel. // Add our viewport to the root panel.
if( pRoot != 0 ) if( pRoot != 0 )
@ -894,7 +906,7 @@ void ClientModeShared::Enable()
void ClientModeShared::Disable() void ClientModeShared::Disable()
{ {
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();; vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();
// Remove our viewport from the root panel. // Remove our viewport from the root panel.
if( pRoot != 0 ) if( pRoot != 0 )
@ -923,7 +935,7 @@ void ClientModeShared::Layout()
m_pViewport->SetBounds(0, 0, wide, tall); m_pViewport->SetBounds(0, 0, wide, tall);
if ( changed ) if ( changed )
{ {
ReloadScheme(); ReloadScheme(false);
} }
} }
} }
@ -955,7 +967,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
const char *eventname = event->GetName(); const char *eventname = event->GetName();
if ( Q_strcmp( "player_connect", eventname ) == 0 ) if ( Q_strcmp( "player_connect_client", eventname ) == 0 )
{ {
if ( !hudChat ) if ( !hudChat )
return; return;
@ -1115,7 +1127,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
{ {
CBasePlayer *pSpectatorTarget = UTIL_PlayerByIndex( GetSpectatorTarget() ); CBasePlayer *pSpectatorTarget = UTIL_PlayerByIndex( GetSpectatorTarget() );
if ( pSpectatorTarget && (GetSpectatorMode() == OBS_MODE_IN_EYE || GetSpectatorMode() == OBS_MODE_CHASE) ) if ( pSpectatorTarget && (GetSpectatorMode() == OBS_MODE_IN_EYE || GetSpectatorMode() == OBS_MODE_CHASE || GetSpectatorMode() == OBS_MODE_POI) )
{ {
if ( pSpectatorTarget->GetTeamNumber() == team ) if ( pSpectatorTarget->GetTeamNumber() == team )
{ {
@ -1222,10 +1234,14 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
entityquality_t iItemQuality = event->GetInt( "quality" ); entityquality_t iItemQuality = event->GetInt( "quality" );
int iMethod = event->GetInt( "method" ); int iMethod = event->GetInt( "method" );
int iItemDef = event->GetInt( "itemdef" ); int iItemDef = event->GetInt( "itemdef" );
bool bIsStrange = event->GetInt( "isstrange" );
bool bIsUnusual = event->GetInt( "isunusual" );
float flWear = event->GetFloat( "wear" );
C_BasePlayer *pPlayer = UTIL_PlayerByIndex( iPlayerIndex ); C_BasePlayer *pPlayer = UTIL_PlayerByIndex( iPlayerIndex );
const GameItemDefinition_t *pItemDefinition = dynamic_cast<GameItemDefinition_t *>( GetItemSchema()->GetItemDefinition( iItemDef ) ); const GameItemDefinition_t *pItemDefinition = dynamic_cast<GameItemDefinition_t *>( GetItemSchema()->GetItemDefinition( iItemDef ) );
if ( !pPlayer || !pItemDefinition ) if ( !pPlayer || !pItemDefinition || pItemDefinition->IsHidden() )
return; return;
if ( g_PR ) if ( g_PR )
@ -1245,19 +1261,101 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
_snwprintf( wszItemFound, ARRAYSIZE( wszItemFound ), L"%ls", g_pVGuiLocalize->Find( pszLocString ) ); _snwprintf( wszItemFound, ARRAYSIZE( wszItemFound ), L"%ls", g_pVGuiLocalize->Find( pszLocString ) );
wchar_t *colorMarker = wcsstr( wszItemFound, L"::" ); wchar_t *colorMarker = wcsstr( wszItemFound, L"::" );
const CEconItemRarityDefinition* pItemRarity = GetItemSchema()->GetRarityDefinition( pItemDefinition->GetRarity() );
if ( colorMarker ) if ( colorMarker )
{
if ( pItemRarity )
{
attrib_colors_t colorRarity = pItemRarity->GetAttribColor();
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( scheme );
Color color = pScheme->GetColor( GetColorNameForAttribColor( colorRarity ), Color( 255, 255, 255, 255 ) );
hudChat->SetCustomColor( color );
}
else
{ {
const char *pszQualityColorString = EconQuality_GetColorString( (EEconItemQuality)iItemQuality ); const char *pszQualityColorString = EconQuality_GetColorString( (EEconItemQuality)iItemQuality );
if ( pszQualityColorString ) if ( pszQualityColorString )
{ {
hudChat->SetCustomColor( pszQualityColorString ); hudChat->SetCustomColor( pszQualityColorString );
*(colorMarker+1) = COLOR_CUSTOM;
} }
} }
*(colorMarker+1) = COLOR_CUSTOM;
}
// TODO: Update the localization strings to only have two format parameters since that's all we need. // TODO: Update the localization strings to only have two format parameters since that's all we need.
wchar_t wszLocalizedString[256]; wchar_t wszLocalizedString[256];
g_pVGuiLocalize->ConstructString( wszLocalizedString, sizeof( wszLocalizedString ), wszItemFound, 3, wszPlayerName, CEconItemLocalizedFullNameGenerator( GLocalizationProvider(), pItemDefinition, iItemQuality ).GetFullName(), L"" ); g_pVGuiLocalize->ConstructString(
wszLocalizedString,
sizeof( wszLocalizedString ),
LOCCHAR( "%s1" ),
1,
CEconItemLocalizedFullNameGenerator( GLocalizationProvider(), pItemDefinition, iItemQuality ).GetFullName()
);
locchar_t tempName[MAX_ITEM_NAME_LENGTH];
if ( pItemRarity )
{
// grade and Wear
loc_scpy_safe( tempName, wszLocalizedString );
const locchar_t *loc_WearText = LOCCHAR("");
const char *pszTooltipText = "TFUI_InvTooltip_Rarity";
if ( !IsWearableSlot( pItemDefinition->GetDefaultLoadoutSlot() ) )
{
loc_WearText = g_pVGuiLocalize->Find( GetWearLocalizationString( flWear ) );
}
else
{
pszTooltipText = "TFUI_InvTooltip_RarityNoWear";
}
g_pVGuiLocalize->ConstructString( wszLocalizedString,
ARRAYSIZE( wszLocalizedString ) * sizeof( locchar_t ),
g_pVGuiLocalize->Find( pszTooltipText ),
3,
g_pVGuiLocalize->Find( pItemRarity->GetLocKey() ),
tempName,
loc_WearText
);
if ( bIsUnusual )
{
loc_scpy_safe( tempName, wszLocalizedString );
g_pVGuiLocalize->ConstructString( wszLocalizedString,
ARRAYSIZE( wszLocalizedString ) * sizeof( locchar_t ),
LOCCHAR( "%s1 %s2" ),
2,
g_pVGuiLocalize->Find( "rarity4" ),
tempName
);
}
if ( bIsStrange )
{
loc_scpy_safe( tempName, wszLocalizedString );
g_pVGuiLocalize->ConstructString( wszLocalizedString,
ARRAYSIZE( wszLocalizedString ) * sizeof( locchar_t ),
LOCCHAR( "%s1 %s2" ),
2,
g_pVGuiLocalize->Find( "strange" ),
tempName
);
}
}
loc_scpy_safe( tempName, wszLocalizedString );
g_pVGuiLocalize->ConstructString(
wszLocalizedString,
sizeof( wszLocalizedString ),
wszItemFound,
3,
wszPlayerName, tempName, L"" );
char szLocalized[256]; char szLocalized[256];
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalizedString, szLocalized, sizeof( szLocalized ) ); g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalizedString, szLocalized, sizeof( szLocalized ) );

View File

@ -66,7 +66,7 @@ public:
virtual void Disable(); virtual void Disable();
virtual void Layout(); virtual void Layout();
virtual void ReloadScheme( void ); virtual void ReloadScheme( bool flushLowLevel );
virtual void OverrideView( CViewSetup *pSetup ); virtual void OverrideView( CViewSetup *pSetup );
virtual bool ShouldDrawDetailObjects( ); virtual bool ShouldDrawDetailObjects( );
virtual bool ShouldDrawEntity(C_BaseEntity *pEnt); virtual bool ShouldDrawEntity(C_BaseEntity *pEnt);

View File

@ -1802,6 +1802,9 @@ ClientShadowHandle_t CClientShadowMgr::CreateProjectedTexture( ClientEntityHandl
if( !( flags & SHADOW_FLAGS_FLASHLIGHT ) ) if( !( flags & SHADOW_FLAGS_FLASHLIGHT ) )
{ {
IClientRenderable *pRenderable = ClientEntityList().GetClientRenderableFromHandle( entity ); IClientRenderable *pRenderable = ClientEntityList().GetClientRenderableFromHandle( entity );
if ( !pRenderable )
return m_Shadows.InvalidIndex();
int modelType = modelinfo->GetModelType( pRenderable->GetModel() ); int modelType = modelinfo->GetModelType( pRenderable->GetModel() );
if (modelType == mod_brush) if (modelType == mod_brush)
{ {

View File

@ -68,6 +68,15 @@ const char *CClientSideEffect::GetName( void )
return m_pszName; return m_pszName;
} }
//-----------------------------------------------------------------------------
// Purpose: Set the name of effect
// Input : const char
//-----------------------------------------------------------------------------
void CClientSideEffect::SetEffectName( const char *pszName )
{
m_pszName = pszName;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Is effect still active? // Purpose: Is effect still active?
// Output : Returns true on success, false on failure. // Output : Returns true on success, false on failure.
@ -99,6 +108,7 @@ public:
// Add an effect to the effects list // Add an effect to the effects list
void AddEffect( CClientSideEffect *effect ); void AddEffect( CClientSideEffect *effect );
// Remove the specified effect // Remove the specified effect
void RemoveEffect( CClientSideEffect *effect );
// Draw/update all effects in the current list // Draw/update all effects in the current list
void DrawEffects( double frametime ); void DrawEffects( double frametime );
// Flush out all effects from the list // Flush out all effects from the list
@ -160,6 +170,23 @@ void CEffectsList::AddEffect( CClientSideEffect *effect )
m_rgEffects[ m_nEffects++ ] = effect; m_rgEffects[ m_nEffects++ ] = effect;
} }
//-----------------------------------------------------------------------------
void CEffectsList::RemoveEffect( CClientSideEffect *effect )
{
Assert( effect );
CClientSideEffect **end = &m_rgEffects[m_nEffects];
for( CClientSideEffect **p = &m_rgEffects[0]; p < end; ++p)
{
if ( *p == effect )
{
RemoveEffect( p - &m_rgEffects[0] ); // todo remove this crutch
return;
}
}
Assert( false ); // don't know this effect
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Remove specified effect by index // Purpose: Remove specified effect by index
// Input : effectIndex - // Input : effectIndex -

View File

@ -33,6 +33,9 @@ public:
// Sets the effect to inactive so it can be destroed // Sets the effect to inactive so it can be destroed
virtual void Destroy( void ); virtual void Destroy( void );
// Sets the effect name (useful for debugging).
virtual void SetEffectName( const char *pszName );
private: private:
// Name of effect ( static data ) // Name of effect ( static data )
const char *m_pszName; const char *m_pszName;
@ -50,6 +53,8 @@ public:
// Add an effect to the list of effects // Add an effect to the list of effects
virtual void AddEffect( CClientSideEffect *effect ) = 0; virtual void AddEffect( CClientSideEffect *effect ) = 0;
// Remove the specified effect
virtual void RemoveEffect( CClientSideEffect *effect ) = 0;
// Simulate/Update/Draw effects on list // Simulate/Update/Draw effects on list
virtual void DrawEffects( double frametime ) = 0; virtual void DrawEffects( double frametime ) = 0;
// Flush out all effects fbrom the list // Flush out all effects fbrom the list

View File

@ -13,11 +13,21 @@
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
CFXQuad::CFXQuad( const FXQuadData_t &data ) static const char g_EffectName[] = "Quad";
: CClientSideEffect( "Quad" ) CFXQuad::CFXQuad( const FXQuadData_t &data )
: CClientSideEffect( g_EffectName )
{ {
m_FXData = data; m_FXData = data;
if ( data.m_pMaterial != NULL )
{
// If we've got a material, use that as our effectname instead of just "Quad".
// This should hopefully help narrow down messages like "No room for effect Quad".
const char *szMaterialName = data.m_pMaterial->GetName();
if ( szMaterialName )
SetEffectName( szMaterialName );
}
} }
CFXQuad::~CFXQuad( void ) CFXQuad::~CFXQuad( void )
@ -63,6 +73,12 @@ void CFXQuad::Draw( double frametime )
float alpha = m_FXData.m_flStartAlpha + ( ( m_FXData.m_flEndAlpha - m_FXData.m_flStartAlpha ) * alphaTimePerc ); float alpha = m_FXData.m_flStartAlpha + ( ( m_FXData.m_flEndAlpha - m_FXData.m_flStartAlpha ) * alphaTimePerc );
alpha = clamp( alpha, 0.0f, 1.0f ); alpha = clamp( alpha, 0.0f, 1.0f );
// PASSTIME don't bother if alpha is 0
if ( alpha == 0 )
{
return;
}
CMatRenderContextPtr pRenderContext( materials ); CMatRenderContextPtr pRenderContext( materials );
//Bind the material //Bind the material
@ -152,6 +168,8 @@ bool CFXQuad::IsActive( void )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CFXQuad::Destroy( void ) void CFXQuad::Destroy( void )
{ {
SetEffectName( g_EffectName );
//Release the material //Release the material
if ( m_FXData.m_pMaterial != NULL ) if ( m_FXData.m_pMaterial != NULL )
{ {

View File

@ -82,8 +82,6 @@ public:
virtual void Destroy( void ); virtual void Destroy( void );
virtual void Update( double frametime ); virtual void Update( double frametime );
protected:
FXQuadData_t m_FXData; FXQuadData_t m_FXData;
}; };

View File

@ -13,6 +13,9 @@
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
ConVar r_drawtracers( "r_drawtracers", "1", FCVAR_CHEAT );
ConVar r_drawtracers_firstperson( "r_drawtracers_firstperson", "1", FCVAR_ARCHIVE, "Toggle visibility of first person weapon tracers" );
#define TRACER_SPEED 5000 #define TRACER_SPEED 5000
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -23,7 +26,7 @@ Vector GetTracerOrigin( const CEffectData &data )
Vector vecStart = data.m_vStart; Vector vecStart = data.m_vStart;
QAngle vecAngles; QAngle vecAngles;
int iAttachment = data.m_nAttachmentIndex;; int iAttachment = data.m_nAttachmentIndex;
// Attachment? // Attachment?
if ( data.m_fFlags & TRACER_FLAG_USEATTACHMENT ) if ( data.m_fFlags & TRACER_FLAG_USEATTACHMENT )
@ -77,6 +80,17 @@ void TracerCallback( const CEffectData &data )
if ( !player ) if ( !player )
return; return;
if ( !r_drawtracers.GetBool() )
return;
if ( !r_drawtracers_firstperson.GetBool() )
{
C_BasePlayer *pPlayer = dynamic_cast<C_BasePlayer*>( data.GetEntity() );
if ( pPlayer && !pPlayer->ShouldDrawThisPlayer() )
return;
}
// Grab the data // Grab the data
Vector vecStart = GetTracerOrigin( data ); Vector vecStart = GetTracerOrigin( data );
float flVelocity = data.m_flScale; float flVelocity = data.m_flScale;
@ -120,6 +134,17 @@ void ParticleTracerCallback( const CEffectData &data )
if ( !player ) if ( !player )
return; return;
if ( !r_drawtracers.GetBool() )
return;
if ( !r_drawtracers_firstperson.GetBool() )
{
C_BasePlayer *pPlayer = dynamic_cast<C_BasePlayer*>( data.GetEntity() );
if ( pPlayer && !pPlayer->ShouldDrawThisPlayer() )
return;
}
// Grab the data // Grab the data
Vector vecStart = GetTracerOrigin( data ); Vector vecStart = GetTracerOrigin( data );
Vector vecEnd = data.m_vOrigin; Vector vecEnd = data.m_vOrigin;

View File

@ -181,7 +181,7 @@ void CMapOverview::Init( void )
// register for events as client listener // register for events as client listener
ListenForGameEvent( "game_newmap" ); ListenForGameEvent( "game_newmap" );
ListenForGameEvent( "round_start" ); ListenForGameEvent( "round_start" );
ListenForGameEvent( "player_connect" ); ListenForGameEvent( "player_connect_client" );
ListenForGameEvent( "player_info" ); ListenForGameEvent( "player_info" );
ListenForGameEvent( "player_team" ); ListenForGameEvent( "player_team" );
ListenForGameEvent( "player_spawn" ); ListenForGameEvent( "player_spawn" );
@ -933,7 +933,7 @@ void CMapOverview::FireGameEvent( IGameEvent *event )
ResetRound(); ResetRound();
} }
else if ( Q_strcmp(type,"player_connect") == 0 ) else if ( Q_strcmp(type,"player_connect_client") == 0 )
{ {
int index = event->GetInt("index"); // = entity index - 1 int index = event->GetInt("index"); // = entity index - 1

View File

@ -67,6 +67,7 @@ static const char *s_SpectatorModes[] =
"#Spec_Mode2", // OBS_MODE_FIXED, "#Spec_Mode2", // OBS_MODE_FIXED,
"#Spec_Mode3", // OBS_MODE_IN_EYE, "#Spec_Mode3", // OBS_MODE_IN_EYE,
"#Spec_Mode4", // OBS_MODE_CHASE, "#Spec_Mode4", // OBS_MODE_CHASE,
"#Spec_Mode_POI", // OBS_MODE_POI, PASSTIME
"#Spec_Mode5", // OBS_MODE_ROAMING, "#Spec_Mode5", // OBS_MODE_ROAMING,
}; };
@ -806,6 +807,8 @@ CON_COMMAND_F( spec_mode, "Set spectator mode", FCVAR_CLIENTCMD_CAN_EXECUTE )
if ( mode > LAST_PLAYER_OBSERVERMODE ) if ( mode > LAST_PLAYER_OBSERVERMODE )
mode = OBS_MODE_IN_EYE; mode = OBS_MODE_IN_EYE;
else if ( mode == OBS_MODE_POI ) // PASSTIME skip POI mode since hltv doesn't have the entity data required to make it work
mode = OBS_MODE_ROAMING;
} }
// handle the command clientside // handle the command clientside

View File

@ -22,6 +22,7 @@ CBaseModelPanel::CBaseModelPanel( vgui::Panel *pParent, const char *pName ): Bas
m_bForcePos = false; m_bForcePos = false;
m_bMousePressed = false; m_bMousePressed = false;
m_bAllowRotation = false; m_bAllowRotation = false;
m_bAllowPitch = false;
m_bAllowFullManipulation = false; m_bAllowFullManipulation = false;
m_bApplyManipulators = false; m_bApplyManipulators = false;
m_bForcedCameraPosition = false; m_bForcedCameraPosition = false;
@ -43,6 +44,7 @@ void CBaseModelPanel::ApplySettings( KeyValues *inResourceData )
// Set whether we render to texture // Set whether we render to texture
m_bRenderToTexture = inResourceData->GetBool( "render_texture", true ); m_bRenderToTexture = inResourceData->GetBool( "render_texture", true );
m_bUseParticle = inResourceData->GetBool( "use_particle", false );
// Grab and set the camera FOV. // Grab and set the camera FOV.
float flFOV = GetCameraFOV(); float flFOV = GetCameraFOV();
@ -51,6 +53,7 @@ void CBaseModelPanel::ApplySettings( KeyValues *inResourceData )
// Do we allow rotation on these panels. // Do we allow rotation on these panels.
m_bAllowRotation = inResourceData->GetBool( "allow_rot", false ); m_bAllowRotation = inResourceData->GetBool( "allow_rot", false );
m_bAllowPitch = inResourceData->GetBool( "allow_pitch", false );
// Do we allow full manipulation on these panels. // Do we allow full manipulation on these panels.
m_bAllowFullManipulation = inResourceData->GetBool( "allow_manip", false ); m_bAllowFullManipulation = inResourceData->GetBool( "allow_manip", false );
@ -64,7 +67,7 @@ void CBaseModelPanel::ApplySettings( KeyValues *inResourceData )
} }
} }
SetMouseInputEnabled( m_bAllowFullManipulation || m_bAllowRotation ); SetMouseInputEnabled( m_bAllowFullManipulation || m_bAllowRotation || m_bAllowPitch );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -412,13 +415,16 @@ void CBaseModelPanel::OnMousePressed ( vgui::MouseCode code )
return; return;
} }
if ( !m_bAllowRotation ) if ( !m_bAllowRotation && !m_bAllowPitch )
return; return;
RequestFocus(); RequestFocus();
EnableMouseCapture( true, code ); EnableMouseCapture( true, code );
// Save where they clicked
input()->GetCursorPosition( m_nClickStartX, m_nClickStartY );
// Warp the mouse to the center of the screen // Warp the mouse to the center of the screen
int width, height; int width, height;
GetSize( width, height ); GetSize( width, height );
@ -446,11 +452,14 @@ void CBaseModelPanel::OnMouseReleased( vgui::MouseCode code )
return; return;
} }
if ( !m_bAllowRotation ) if ( !m_bAllowRotation && !m_bAllowPitch )
return; return;
EnableMouseCapture( false ); EnableMouseCapture( false );
m_bMousePressed = false; m_bMousePressed = false;
// Restore the cursor to where the clicked
input()->SetCursorPos( m_nClickStartX, m_nClickStartY );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -467,7 +476,7 @@ void CBaseModelPanel::OnCursorMoved( int x, int y )
return; return;
} }
if ( !m_bAllowRotation ) if ( !m_bAllowRotation && !m_bAllowPitch )
return; return;
if ( m_bMousePressed ) if ( m_bMousePressed )
@ -476,12 +485,26 @@ void CBaseModelPanel::OnCursorMoved( int x, int y )
int xpos, ypos; int xpos, ypos;
input()->GetCursorPos( xpos, ypos ); input()->GetCursorPos( xpos, ypos );
if ( m_bAllowRotation )
{
// Only want the x delta. // Only want the x delta.
float flDelta = xpos - m_nManipStartX; float flDelta = xpos - m_nManipStartX;
// Apply the delta and rotate the player. // Apply the delta and rotate the player.
RotateYaw( flDelta ); RotateYaw( flDelta );
} }
if ( m_bAllowPitch )
{
// Only want the y delta.
float flDelta = ypos - m_nManipStartY;
// Apply the delta and rotate the player.
RotatePitch( flDelta );
}
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -501,6 +524,23 @@ void CBaseModelPanel::RotateYaw( float flDelta )
SetModelAnglesAndPosition( m_angPlayer, m_vecPlayerPos ); SetModelAnglesAndPosition( m_angPlayer, m_vecPlayerPos );
} }
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CBaseModelPanel::RotatePitch( float flDelta )
{
m_angPlayer.x += flDelta;
if ( m_angPlayer.x > m_flMaxPitch )
{
m_angPlayer.x = m_flMaxPitch;
}
else if ( m_angPlayer.x < -m_flMaxPitch )
{
m_angPlayer.x = -m_flMaxPitch;
}
SetModelAnglesAndPosition( m_angPlayer, m_vecPlayerPos );
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
Vector CBaseModelPanel::GetPlayerPos() const Vector CBaseModelPanel::GetPlayerPos() const
@ -643,7 +683,7 @@ void CBaseModelPanel::LookAtBounds( const Vector &vecBoundsMin, const Vector &ve
// Clear the camera pivot and set position matrix. // Clear the camera pivot and set position matrix.
ResetCameraPivot(); ResetCameraPivot();
if (m_bAllowRotation ) if (m_bAllowRotation || m_bAllowPitch )
{ {
vecCameraOffset.x = 0.0f; vecCameraOffset.x = 0.0f;
} }
@ -651,3 +691,150 @@ void CBaseModelPanel::LookAtBounds( const Vector &vecBoundsMin, const Vector &ve
UpdateCameraTransform(); UpdateCameraTransform();
} }
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CBaseModelPanel::particle_data_t::~particle_data_t()
{
if ( m_pParticleSystem )
{
delete m_pParticleSystem;
m_pParticleSystem = NULL;
}
}
//-----------------------------------------------------------------------------
// Purpose: Allocate particle data
//-----------------------------------------------------------------------------
void CBaseModelPanel::particle_data_t::UpdateControlPoints( CStudioHdr *pStudioHdr, matrix3x4_t *pWorldMatrix, const CUtlVector< int >& vecAttachments, int iDefaultBone /*= 0*/, const Vector& vecParticleOffset /*= vec3_origin*/ )
{
if ( m_pParticleSystem )
{
// Update control points which is updating the position of the particles
matrix3x4_t matAttachToWorld;
Vector vecPosition, vecForward, vecRight, vecUp;
if ( vecAttachments.Count() )
{
for ( int i = 0; i < vecAttachments.Count(); ++i )
{
const mstudioattachment_t& attach = pStudioHdr->pAttachment( vecAttachments[i] );
MatrixMultiply( pWorldMatrix[ attach.localbone ], attach.local, matAttachToWorld );
MatrixVectors( matAttachToWorld, &vecForward, &vecRight, &vecUp );
MatrixPosition( matAttachToWorld, vecPosition );
m_pParticleSystem->SetControlPointOrientation( i, vecForward, vecRight, vecUp );
m_pParticleSystem->SetControlPoint( i, vecPosition + vecParticleOffset );
}
}
else
{
matAttachToWorld = pWorldMatrix[iDefaultBone];
MatrixVectors( matAttachToWorld, &vecForward, &vecRight, &vecUp );
MatrixPosition( matAttachToWorld, vecPosition );
m_pParticleSystem->SetControlPointOrientation( 0, vecForward, vecRight, vecUp );
m_pParticleSystem->SetControlPoint( 0, vecPosition + vecParticleOffset );
}
}
m_bIsUpdateToDate = true;
}
//-----------------------------------------------------------------------------
// Purpose: Allocate particle data
//-----------------------------------------------------------------------------
CBaseModelPanel::particle_data_t *CBaseModelPanel::CreateParticleData( const char *pszParticleName )
{
Assert( m_bUseParticle );
if ( !m_bUseParticle )
return NULL;
CParticleCollection *pParticle = g_pParticleSystemMgr->CreateParticleCollection( pszParticleName );
if ( !pParticle )
return NULL;
particle_data_t *pData = new particle_data_t;
pData->m_bIsUpdateToDate = false;
pData->m_pParticleSystem = pParticle;
m_particleList.AddToTail( pData );
return pData;
}
//-----------------------------------------------------------------------------
// Purpose: remove and delete particle data
//-----------------------------------------------------------------------------
bool CBaseModelPanel::SafeDeleteParticleData( particle_data_t **pData )
{
if ( !m_bUseParticle )
return false;
if ( *pData )
{
FOR_EACH_VEC( m_particleList, i )
{
if ( *pData == m_particleList[i] )
{
delete *pData;
*pData = NULL;
m_particleList.FastRemove( i );
return true;
}
}
}
return false;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseModelPanel::PrePaint3D( IMatRenderContext *pRenderContext )
{
if ( !m_bUseParticle )
return;
// mark all effects need to be updated
FOR_EACH_VEC( m_particleList, i )
{
m_particleList[i]->m_bIsUpdateToDate = false;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseModelPanel::PostPaint3D( IMatRenderContext *pRenderContext )
{
if ( !m_bUseParticle )
return;
// This needs calling to reset various counters.
g_pParticleSystemMgr->SetLastSimulationTime( gpGlobals->curtime );
// Render Particles
pRenderContext->MatrixMode( MATERIAL_MODEL );
pRenderContext->PushMatrix();
pRenderContext->LoadIdentity( );
FOR_EACH_VEC( m_particleList, i )
{
if ( m_particleList[i]->m_bIsUpdateToDate )
{
m_particleList[i]->m_pParticleSystem->Simulate( gpGlobals->frametime, false );
m_particleList[i]->m_pParticleSystem->Render( pRenderContext );
m_particleList[i]->m_bIsUpdateToDate = false;
}
}
pRenderContext->MatrixMode( MATERIAL_MODEL );
pRenderContext->PopMatrix();
}

View File

@ -183,6 +183,7 @@ public:
void SetBody( unsigned int nBody ) { m_RootMDL.m_MDL.m_nBody = nBody; } void SetBody( unsigned int nBody ) { m_RootMDL.m_MDL.m_nBody = nBody; }
void RotateYaw( float flDelta ); void RotateYaw( float flDelta );
void RotatePitch( float flDelta );
Vector GetPlayerPos() const; Vector GetPlayerPos() const;
QAngle GetPlayerAngles() const; QAngle GetPlayerAngles() const;
@ -213,6 +214,7 @@ protected:
bool m_bForcePos; bool m_bForcePos;
bool m_bMousePressed; bool m_bMousePressed;
bool m_bAllowRotation; bool m_bAllowRotation;
bool m_bAllowPitch;
bool m_bAllowFullManipulation; bool m_bAllowFullManipulation;
bool m_bApplyManipulators; bool m_bApplyManipulators;
bool m_bForcedCameraPosition; bool m_bForcedCameraPosition;
@ -220,6 +222,25 @@ protected:
// VGUI script accessible variables. // VGUI script accessible variables.
CPanelAnimationVar( bool, m_bStartFramed, "start_framed", "0" ); CPanelAnimationVar( bool, m_bStartFramed, "start_framed", "0" );
CPanelAnimationVar( bool, m_bDisableManipulation, "disable_manipulation", "0" ); CPanelAnimationVar( bool, m_bDisableManipulation, "disable_manipulation", "0" );
CPanelAnimationVar( bool, m_bUseParticle, "use_particle", "0" );
CPanelAnimationVar( float, m_flMaxPitch, "max_pitch", "90" );
struct particle_data_t
{
~particle_data_t();
void UpdateControlPoints( CStudioHdr *pStudioHdr, matrix3x4_t *pWorldMatrix, const CUtlVector< int >& vecAttachments, int iDefaultBone = 0, const Vector& vecParticleOffset = vec3_origin );
bool m_bIsUpdateToDate;
CParticleCollection *m_pParticleSystem;
};
CUtlVector< particle_data_t* > m_particleList;
particle_data_t *CreateParticleData( const char *pszParticleName );
bool SafeDeleteParticleData( particle_data_t **pData );
virtual void PrePaint3D( IMatRenderContext *pRenderContext ) OVERRIDE;
virtual void PostPaint3D( IMatRenderContext *pRenderContext ) OVERRIDE;
}; };
#endif // BASEMODEL_PANEL_H #endif // BASEMODEL_PANEL_H

View File

@ -65,7 +65,17 @@ vgui::Panel *g_lastPanel = NULL; // used for mouseover buttons, keeps track of t
vgui::Button *g_lastButton = NULL; // used for mouseover buttons, keeps track of the last active button vgui::Button *g_lastButton = NULL; // used for mouseover buttons, keeps track of the last active button
using namespace vgui; using namespace vgui;
ConVar hud_autoreloadscript("hud_autoreloadscript", "0", FCVAR_NONE, "Automatically reloads the animation script each time one is ran"); void hud_autoreloadscript_callback( IConVar *var, const char *pOldValue, float flOldValue );
ConVar hud_autoreloadscript("hud_autoreloadscript", "0", FCVAR_NONE, "Automatically reloads the animation script each time one is ran", hud_autoreloadscript_callback);
void hud_autoreloadscript_callback( IConVar *var, const char *pOldValue, float flOldValue )
{
if ( g_pClientMode && g_pClientMode->GetViewportAnimationController() )
{
g_pClientMode->GetViewportAnimationController()->SetAutoReloadScript( hud_autoreloadscript.GetBool() );
}
}
static ConVar cl_leveloverviewmarker( "cl_leveloverviewmarker", "0", FCVAR_CHEAT ); static ConVar cl_leveloverviewmarker( "cl_leveloverviewmarker", "0", FCVAR_CHEAT );
@ -574,10 +584,11 @@ void CBaseViewport::OnThink()
m_pActivePanel = NULL; m_pActivePanel = NULL;
} }
// TF does this in OnTick in TFViewport. This remains to preserve old
// behavior in other games
#if !defined( TF_CLIENT_DLL )
m_pAnimController->UpdateAnimations( gpGlobals->curtime ); m_pAnimController->UpdateAnimations( gpGlobals->curtime );
#endif
// check the auto-reload cvar
m_pAnimController->SetAutoReloadScript(hud_autoreloadscript.GetBool());
int count = m_Panels.Count(); int count = m_Panels.Count();

View File

@ -138,9 +138,9 @@ void CTextWindow::Reset( void )
// HPE_BEGIN: // HPE_BEGIN:
// [Forrest] Replace strange hard-coded default message with hard-coded error message. // [Forrest] Replace strange hard-coded default message with hard-coded error message.
//============================================================================= //=============================================================================
Q_strcpy( m_szTitle, "Error loading info message." ); V_strcpy_safe( m_szTitle, "Error loading info message." );
Q_strcpy( m_szMessage, "" ); V_strcpy_safe( m_szMessage, "" );
Q_strcpy( m_szMessageFallback, "" ); V_strcpy_safe( m_szMessageFallback, "" );
//============================================================================= //=============================================================================
// HPE_END // HPE_END
//============================================================================= //=============================================================================

View File

@ -85,7 +85,7 @@ public:
sParticle->m_flDieTime = 0.2f; sParticle->m_flDieTime = 0.2f;
sParticle->m_flRoll = random->RandomInt( 0, 360 ); sParticle->m_flRoll = random->RandomInt( 0, 360 );
sParticle->m_flRollDelta = random->RandomInt( -4, 4 );; sParticle->m_flRollDelta = random->RandomInt( -4, 4 );
unsigned char color = random->RandomInt( 200, 255 ); unsigned char color = random->RandomInt( 200, 255 );

View File

@ -215,8 +215,8 @@ void CHudCredits::ReadNames( KeyValues *pKeyValue )
while ( pKVNames ) while ( pKVNames )
{ {
creditname_t Credits; creditname_t Credits;
Q_strcpy( Credits.szCreditName, pKVNames->GetName()); V_strcpy_safe( Credits.szCreditName, pKVNames->GetName() );
Q_strcpy( Credits.szFontName, pKeyValue->GetString( Credits.szCreditName, "Default" ) ); V_strcpy_safe( Credits.szFontName, pKeyValue->GetString( Credits.szCreditName, "Default" ) );
m_CreditsList.AddToTail( Credits ); m_CreditsList.AddToTail( Credits );
pKVNames = pKVNames->GetNextKey(); pKVNames = pKVNames->GetNextKey();

View File

@ -736,7 +736,7 @@ void C_HLTVCamera::FireGameEvent( IGameEvent * event)
} }
// after this only auto-director commands follow // after this only auto-director commands follow
// don't execute them is autodirector is off and PVS is unlocked // don't execute them if autodirector is off and PVS is unlocked
if ( !spec_autodirector.GetBool() && !IsPVSLocked() ) if ( !spec_autodirector.GetBool() && !IsPVSLocked() )
return; return;

View File

@ -24,6 +24,7 @@
#include "vgui/IInput.h" #include "vgui/IInput.h"
#include "vgui/ILocalize.h" #include "vgui/ILocalize.h"
#include "multiplay_gamerules.h" #include "multiplay_gamerules.h"
#include "voice_status.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
@ -36,6 +37,7 @@ ConVar hud_saytext_time( "hud_saytext_time", "12", 0 );
ConVar cl_showtextmsg( "cl_showtextmsg", "1", 0, "Enable/disable text messages printing on the screen." ); ConVar cl_showtextmsg( "cl_showtextmsg", "1", 0, "Enable/disable text messages printing on the screen." );
ConVar cl_chatfilters( "cl_chatfilters", "63", FCVAR_CLIENTDLL | FCVAR_ARCHIVE, "Stores the chat filter settings " ); ConVar cl_chatfilters( "cl_chatfilters", "63", FCVAR_CLIENTDLL | FCVAR_ARCHIVE, "Stores the chat filter settings " );
ConVar cl_chatfilter_version( "cl_chatfilter_version", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE | FCVAR_HIDDEN, "Stores the chat filter version" ); ConVar cl_chatfilter_version( "cl_chatfilter_version", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE | FCVAR_HIDDEN, "Stores the chat filter version" );
ConVar cl_mute_all_comms("cl_mute_all_comms", "1", FCVAR_ARCHIVE, "If 1, then all communications from a player will be blocked when that player is muted, including chat messages.");
const int kChatFilterVersion = 1; const int kChatFilterVersion = 1;
@ -1750,6 +1752,13 @@ void CBaseHudChat::ChatPrintf( int iPlayerIndex, int iFilter, const char *fmt, .
return; return;
} }
// If a player is muted for voice, also mute them for text because jerks gonna jerk.
if ( cl_mute_all_comms.GetBool() && iPlayerIndex != 0 )
{
if ( GetClientVoiceMgr() && GetClientVoiceMgr()->IsPlayerBlocked( iPlayerIndex ) )
return;
}
if ( *pmsg < 32 ) if ( *pmsg < 32 )
{ {
hudlcd->AddChatLine( pmsg + 1 ); hudlcd->AddChatLine( pmsg + 1 );

View File

@ -115,7 +115,9 @@ void CHudBaseDeathNotice::Paint()
DeathNoticeItem &msg = m_DeathNotices[i]; DeathNoticeItem &msg = m_DeathNotices[i];
CHudTexture *icon = msg.iconDeath; CHudTexture *icon = msg.iconDeath;
CHudTexture *iconPrekiller = msg.iconPreKiller; CHudTexture *iconPostKillerName = msg.iconPostKillerName;
CHudTexture *iconPreKillerName = msg.iconPreKillerName;
CHudTexture *iconPostVictimName = msg.iconPostVictimName;
wchar_t victim[256]=L""; wchar_t victim[256]=L"";
wchar_t killer[256]=L""; wchar_t killer[256]=L"";
@ -135,7 +137,11 @@ void CHudBaseDeathNotice::Paint()
int iconWide = 0, iconTall = 0, iDeathInfoOffset = 0, iVictimTextOffset = 0, iconActualWide = 0; int iconWide = 0, iconTall = 0, iDeathInfoOffset = 0, iVictimTextOffset = 0, iconActualWide = 0;
int iPreKillerTextWide = msg.wzPreKillerText[0] ? UTIL_ComputeStringWidth( m_hTextFont, msg.wzPreKillerText ) - xSpacing : 0; int iPreKillerTextWide = msg.wzPreKillerText[0] ? UTIL_ComputeStringWidth( m_hTextFont, msg.wzPreKillerText ) - xSpacing : 0;
int iconPrekillerWide = 0, iconPrekillerActualWide = 0, iconPreKillerTall = 0;
int iconPrekillerWide = 0, iconPrekillerActualWide = 0, iconPrekillerTall = 0;
int iconPostkillerWide = 0, iconPostkillerActualWide = 0, iconPostkillerTall = 0;
int iconPostVictimWide = 0, iconPostVictimActualWide = 0, iconPostVictimTall = 0;
// Get the local position for this notice // Get the local position for this notice
if ( icon ) if ( icon )
@ -153,23 +159,53 @@ void CHudBaseDeathNotice::Paint()
iconWide *= flScale; iconWide *= flScale;
} }
if ( iconPrekiller ) if ( iconPreKillerName )
{ {
iconPrekillerActualWide = iconPrekiller->EffectiveWidth( 1.0f ); iconPrekillerActualWide = iconPreKillerName->EffectiveWidth( 1.0f );
iconPrekillerWide = iconPrekillerActualWide; iconPrekillerWide = iconPrekillerActualWide;
iconPreKillerTall = iconPrekiller->EffectiveHeight( 1.0f ); iconPrekillerTall = iconPreKillerName->EffectiveHeight( 1.0f );
int iconTallDesired = iLineTall-YRES(2); int iconTallDesired = iLineTall - YRES( 2 );
Assert( 0 != iconTallDesired ); Assert( 0 != iconTallDesired );
float flScale = (float) iconTallDesired / (float) iconPreKillerTall; float flScale = (float)iconTallDesired / (float)iconPrekillerTall;
iconPrekillerActualWide *= flScale; iconPrekillerActualWide *= flScale;
iconPreKillerTall *= flScale; iconPrekillerTall *= flScale;
iconPrekillerWide *= flScale; iconPrekillerWide *= flScale;
} }
if ( iconPostKillerName )
{
iconPostkillerActualWide = iconPostKillerName->EffectiveWidth( 1.0f );
iconPostkillerWide = iconPostkillerActualWide;
iconPostkillerTall = iconPostKillerName->EffectiveHeight( 1.0f );
int iconTallDesired = iLineTall-YRES(2);
Assert( 0 != iconTallDesired );
float flScale = (float) iconTallDesired / (float) iconPostkillerTall;
iconPostkillerActualWide *= flScale;
iconPostkillerTall *= flScale;
iconPostkillerWide *= flScale;
}
if ( iconPostVictimName )
{
iconPostVictimActualWide = iconPostVictimName->EffectiveWidth( 1.0f );
iconPostVictimWide = iconPostVictimActualWide;
iconPostVictimTall = iconPostVictimName->EffectiveHeight( 1.0f );
int iconTallDesired = iLineTall - YRES( 2 );
Assert( 0 != iconTallDesired );
float flScale = (float)iconTallDesired / (float)iconPostVictimTall;
iconPostVictimActualWide *= flScale;
iconPostVictimTall *= flScale;
iconPostVictimWide *= flScale;
}
int iTotalWide = iKillerTextWide + iconWide + iVictimTextWide + iDeathInfoTextWide + iDeathInfoEndTextWide + ( xMargin * 2 ); int iTotalWide = iKillerTextWide + iconWide + iVictimTextWide + iDeathInfoTextWide + iDeathInfoEndTextWide + ( xMargin * 2 );
iTotalWide += iconPrekillerWide + iPreKillerTextWide; iTotalWide += iconPrekillerWide + iconPostkillerWide + iPreKillerTextWide + iconPostVictimWide;
int y = yStart + ( ( iLineTall + m_flLineSpacing ) * i ); int y = yStart + ( ( iLineTall + m_flLineSpacing ) * i );
int yText = y + ( ( iLineTall - iTextTall ) / 2 ); int yText = y + ( ( iLineTall - iTextTall ) / 2 );
@ -190,6 +226,14 @@ void CHudBaseDeathNotice::Paint()
x += xMargin; x += xMargin;
// prekiller icon
if ( iconPreKillerName )
{
int yPreIconTall = y + ( ( iLineTall - iconPrekillerTall ) / 2 );
iconPreKillerName->DrawSelf( x, yPreIconTall, iconPrekillerActualWide, iconPrekillerTall, m_clrIcon);
x += iconPrekillerWide + xSpacing;
}
if ( killer[0] ) if ( killer[0] )
{ {
// Draw killer's name // Draw killer's name
@ -205,12 +249,12 @@ void CHudBaseDeathNotice::Paint()
x += iPreKillerTextWide; x += iPreKillerTextWide;
} }
// Prekiller icon // postkiller icon
if ( iconPrekiller ) if ( iconPostKillerName )
{ {
int yPreIconTall = y + ( ( iLineTall - iconPreKillerTall ) / 2 ); int yPreIconTall = y + ( ( iLineTall - iconPostkillerTall ) / 2 );
iconPrekiller->DrawSelf( x, yPreIconTall, iconPrekillerActualWide, iconPreKillerTall, m_clrIcon ); iconPostKillerName->DrawSelf( x, yPreIconTall, iconPostkillerActualWide, iconPostkillerTall, m_clrIcon );
x += iconPrekillerWide + xSpacing; x += iconPostkillerWide + xSpacing;
} }
// Draw glow behind weapon icon to show it was a crit death // Draw glow behind weapon icon to show it was a crit death
@ -243,6 +287,14 @@ void CHudBaseDeathNotice::Paint()
DrawText( x + iVictimTextOffset, yText, m_hTextFont, GetTeamColor( msg.Victim.iTeam, msg.bLocalPlayerInvolved ), victim ); DrawText( x + iVictimTextOffset, yText, m_hTextFont, GetTeamColor( msg.Victim.iTeam, msg.bLocalPlayerInvolved ), victim );
x += iVictimTextWide; x += iVictimTextWide;
// postkiller icon
if ( iconPostVictimName )
{
int yPreIconTall = y + ( ( iLineTall - iconPostVictimTall ) / 2 );
iconPostVictimName->DrawSelf( x, yPreIconTall, iconPostVictimActualWide, iconPostVictimTall, m_clrIcon );
x += iconPostkillerWide + xSpacing;
}
// Draw Additional Text on the end of the victims name // Draw Additional Text on the end of the victims name
if ( msg.wzInfoTextEnd[0] ) if ( msg.wzInfoTextEnd[0] )
{ {
@ -569,16 +621,27 @@ void CHudBaseDeathNotice::FireGameEvent( IGameEvent *event )
} }
} }
bool bIsHalloween2014 = TFGameRules() && TFGameRules()->IsHalloweenScenario( CTFGameRules::HALLOWEEN_SCENARIO_DOOMSDAY );
switch ( iEventType ) switch ( iEventType )
{ {
case TF_FLAGEVENT_PICKUP: case TF_FLAGEVENT_PICKUP:
pszMsgKey = "#Msg_PickedUpFlag"; pszMsgKey = bIsHalloween2014 ? "#Msg_PickedUpFlagHalloween2014" : "#Msg_PickedUpFlag";
break; break;
case TF_FLAGEVENT_CAPTURE: case TF_FLAGEVENT_CAPTURE:
pszMsgKey = "#Msg_CapturedFlag"; pszMsgKey = bIsHalloween2014 ? "#Msg_CapturedFlagHalloween2014" : "#Msg_CapturedFlag";
break; break;
case TF_FLAGEVENT_DEFEND: case TF_FLAGEVENT_DEFEND:
pszMsgKey = bIsMvM ? "#Msg_DefendedBomb" : "#Msg_DefendedFlag"; if ( bIsMvM )
{
pszMsgKey = "#Msg_DefendedBomb";
}
else
{
pszMsgKey = bIsHalloween2014 ? "#Msg_DefendedFlagHalloween2014" : "#Msg_DefendedFlag";
}
break; break;
// Add this when we can get localization for it // Add this when we can get localization for it

View File

@ -42,8 +42,10 @@ struct DeathNoticeItem
iKillerID = -1; iKillerID = -1;
iVictimID = -1; iVictimID = -1;
iconPreKiller = NULL; iconPreKillerName = NULL;
iconPostKillerName = NULL;
wzPreKillerText[0] = 0; wzPreKillerText[0] = 0;
iconPostVictimName = NULL;
} }
float GetExpiryTime(); float GetExpiryTime();
@ -56,9 +58,13 @@ struct DeathNoticeItem
CHudTexture *iconDeath; CHudTexture *iconDeath;
CHudTexture *iconCritDeath; // crit background icon CHudTexture *iconCritDeath; // crit background icon
CHudTexture *iconPreKiller; CHudTexture *iconPreKillerName;
CHudTexture *iconPostKillerName;
wchar_t wzPreKillerText[32]; wchar_t wzPreKillerText[32];
CHudTexture *iconPostVictimName;
bool bSelfInflicted; bool bSelfInflicted;
bool bLocalPlayerInvolved; bool bLocalPlayerInvolved;
bool bCrit; bool bCrit;

View File

@ -1402,7 +1402,7 @@ void CControlPointProgressBar::PerformLayout( void )
{ {
BaseClass::PerformLayout(); BaseClass::PerformLayout();
if ( m_pAttachedToIcon && m_pTeardrop && m_pTeardropSide ) if ( m_pAttachedToIcon && m_pTeardrop && m_pTeardropSide && m_pAttachedToIcon->GetVPanel() )
{ {
int iIconX, iIconY; int iIconX, iIconY;
ipanel()->GetAbsPos(m_pAttachedToIcon->GetVPanel(), iIconX, iIconY ); ipanel()->GetAbsPos(m_pAttachedToIcon->GetVPanel(), iIconX, iIconY );

View File

@ -59,7 +59,7 @@ public:
{ {
g_pVGuiLocalize->ConvertANSIToUnicode( pPlayerName, m_wszPlayerName, sizeof(m_wszPlayerName) ); g_pVGuiLocalize->ConvertANSIToUnicode( pPlayerName, m_wszPlayerName, sizeof(m_wszPlayerName) );
SetLifetime( 7 ); SetLifetime( 7 );
SetText( "#Vote_notification_text" ); SetText( "#GameUI_Vote_Notification_Text" );
AddStringToken( "initiator", m_wszPlayerName ); AddStringToken( "initiator", m_wszPlayerName );
} }
virtual bool CanBeTriggered() virtual bool CanBeTriggered()
@ -68,7 +68,10 @@ public:
} }
virtual void Trigger() virtual void Trigger()
{ {
CTFGenericConfirmDialog *pDialog = ShowConfirmDialog( "#Vote_notification_title", "#Vote_notification_text", "#Vote_notification_view", "#cancel", &ConfirmShowVoteSetup ); CTFGenericConfirmDialog *pDialog = ShowConfirmDialog( "#GameUI_Vote_Notification_Title",
"#GameUI_Vote_Notification_Text",
"#GameUI_Vote_Notification_View",
"#cancel", &ConfirmShowVoteSetup );
pDialog->SetContext( this ); pDialog->SetContext( this );
pDialog->AddStringToken( "initiator", m_wszPlayerName ); pDialog->AddStringToken( "initiator", m_wszPlayerName );
// so we aren't deleted // so we aren't deleted
@ -95,7 +98,7 @@ public:
CHudVote *pHudVote = GET_HUDELEMENT( CHudVote ); CHudVote *pHudVote = GET_HUDELEMENT( CHudVote );
if ( pHudVote ) if ( pHudVote )
{ {
pHudVote->ShowVoteUI(); pHudVote->ShowVoteUI( true );
} }
} }
pNotification->SetIsInUse( false ); pNotification->SetIsInUse( false );
@ -290,6 +293,76 @@ void CVoteSetupDialog::ApplySettings(KeyValues *inResourceData)
m_HeaderFGColor = pScheme->GetColor( pszColor, Color( 255, 255, 255, 255 ) ); m_HeaderFGColor = pScheme->GetColor( pszColor, Color( 255, 255, 255, 255 ) );
} }
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVoteSetupDialog::InitializeIssueList( void )
{
m_pComboBox->RemoveAll();
m_pComboBox->SetVisible( false );
SetDialogVariable( "combo_label", "" );
for ( int index = 0; index < m_VoteIssues.Count(); index++ )
{
if ( !m_VoteIssues[index].szName || !m_VoteIssues[index].szName[0] )
continue;
bool bActive = m_VoteIssues[index].bIsActive;
char szIssueLocalized[k_MAX_VOTE_NAME_LENGTH] = { 0 };
g_pVGuiLocalize->ConvertUnicodeToANSI( g_pVGuiLocalize->Find( m_VoteIssues[index].szNameString ), szIssueLocalized, sizeof( szIssueLocalized ) );
if ( !bActive )
{
char szDisabled[k_MAX_VOTE_NAME_LENGTH] = { 0 };
g_pVGuiLocalize->ConvertUnicodeToANSI( g_pVGuiLocalize->Find( "#GameUI_Vote_Disabled" ), szDisabled, sizeof( szDisabled ) );
V_strcat_safe( szIssueLocalized, szDisabled );
}
KeyValues *pKeyValues = new KeyValues( "Issue" );
pKeyValues->SetString( "Issue", szIssueLocalized );
pKeyValues->SetString( "IssueRaw", m_VoteIssues[index].szName );
pKeyValues->SetBool( "Active", m_VoteIssues[index].bIsActive );
int iId = m_pVoteSetupList->AddItem( 0, pKeyValues );
pKeyValues->deleteThis();
// Setup the list entry style
if ( m_hIssueFont != INVALID_FONT )
{
m_pVoteSetupList->SetItemFont( iId, m_hIssueFont );
Color colFG = bActive ? m_IssueFGColor : m_IssueFGColorDisabled;
m_pVoteSetupList->SetItemFgColor( iId, colFG );
}
}
// Select the first item by default
if ( m_pVoteSetupList->GetItemCount() > 0 )
{
m_pVoteSetupList->SetSelectedItem( 0 );
}
else
{
// No active issues
char szIssueLocalized[k_MAX_VOTE_NAME_LENGTH] = { 0 };
g_pVGuiLocalize->ConvertUnicodeToANSI( g_pVGuiLocalize->Find( "#GameUI_Vote_System_Disabled" ), szIssueLocalized, sizeof( szIssueLocalized ) );
KeyValues *pKeyValues = new KeyValues( "Issue" );
pKeyValues->SetString( "Issue", szIssueLocalized );
pKeyValues->SetString( "IssueRaw", "Disabled" );
pKeyValues->SetBool( "Active", false );
int iId = m_pVoteSetupList->AddItem( 0, pKeyValues );
pKeyValues->deleteThis();
if ( m_hIssueFont != INVALID_FONT )
{
m_pVoteSetupList->SetItemFont( iId, m_hIssueFont );
m_pVoteSetupList->SetItemFgColor( iId, m_IssueFGColor );
}
}
UpdateCurrentMap();
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Keep track of the current map // Purpose: Keep track of the current map
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -302,7 +375,7 @@ void CVoteSetupDialog::UpdateCurrentMap( void )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Feeds Issues from the server to this Dialog // Purpose: Feeds Issues from the server to this Dialog
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CVoteSetupDialog::AddVoteIssues( CUtlStringList &m_VoteSetupIssues ) void CVoteSetupDialog::AddVoteIssues( CUtlVector< VoteIssue_t > &m_VoteSetupIssues )
{ {
m_VoteIssues.RemoveAll(); m_VoteIssues.RemoveAll();
for ( int index = 0; index < m_VoteSetupIssues.Count(); index++ ) for ( int index = 0; index < m_VoteSetupIssues.Count(); index++ )
@ -385,36 +458,7 @@ void CVoteSetupDialog::Activate()
m_pVoteParameterList->SetSectionFgColor( 1, m_HeaderFGColor ); m_pVoteParameterList->SetSectionFgColor( 1, m_HeaderFGColor );
} }
// Populate the Issue list InitializeIssueList();
for ( int index = 0; index < m_VoteIssues.Count(); index++ )
{
const char *pszIssue = m_VoteIssues[index];
if ( !pszIssue || !pszIssue[0] )
continue;
KeyValues *pKeyValues = new KeyValues( "Issue" );
pKeyValues->SetString( "Issue", pszIssue );
int iId = m_pVoteSetupList->AddItem( 0, pKeyValues );
pKeyValues->deleteThis();
// Setup the list entry style
if ( m_hIssueFont != INVALID_FONT )
{
m_pVoteSetupList->SetItemFont( iId, m_hIssueFont );
bool bDisabled = V_stristr( pszIssue, "(Disabled on Server)" ); // driller: need to localize
Color colFG = bDisabled ? m_IssueFGColorDisabled : m_IssueFGColor;
m_pVoteSetupList->SetItemFgColor( iId, colFG );
}
}
// Select the first item by default
if ( m_pVoteSetupList->GetItemCount() > 0 )
{
m_pVoteSetupList->SetSelectedItem( 0 );
}
UpdateCurrentMap();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -432,15 +476,15 @@ void CVoteSetupDialog::OnClose()
void CVoteSetupDialog::OnCommand(const char *command) void CVoteSetupDialog::OnCommand(const char *command)
{ {
// We should have enough data to issue a CallVote command // We should have enough data to issue a CallVote command
if ( V_stricmp( command, "CallVote" ) == 0 ) if ( !V_stricmp( command, "CallVote" ) )
{ {
int iSelectedItem = m_pVoteSetupList->GetSelectedItem(); int iSelectedItem = m_pVoteSetupList->GetSelectedItem();
if ( iSelectedItem >= 0 ) if ( iSelectedItem >= 0 )
{ {
char szVoteCommand[128]; char szVoteCommand[k_MAX_VOTE_NAME_LENGTH];
KeyValues *pIssueKeyValues = m_pVoteSetupList->GetItemData( iSelectedItem ); KeyValues *pIssueKeyValues = m_pVoteSetupList->GetItemData( iSelectedItem );
const char *szIssue = pIssueKeyValues->GetString( "Issue" ); const char *szIssueRaw = pIssueKeyValues->GetString( "IssueRaw" );
if ( V_stricmp( "changelevel", szIssue ) == 0 || V_stricmp( "nextlevel", szIssue ) == 0 ) if ( !V_stricmp( "ChangeLevel", szIssueRaw ) || !V_stricmp( "NextLevel", szIssueRaw ) )
{ {
int nSelectedParam = m_pVoteParameterList->GetSelectedItem(); int nSelectedParam = m_pVoteParameterList->GetSelectedItem();
if ( nSelectedParam >= 0 ) if ( nSelectedParam >= 0 )
@ -454,13 +498,13 @@ void CVoteSetupDialog::OnCommand(const char *command)
{ {
// Which Map? // Which Map?
const char *szMapName = pParameterKeyValues->GetString( "Name" ); const char *szMapName = pParameterKeyValues->GetString( "Name" );
Q_snprintf( szVoteCommand, sizeof( szVoteCommand ), "callvote %s %s\n;", szIssue, szMapName ); Q_snprintf( szVoteCommand, sizeof( szVoteCommand ), "callvote %s %s\n;", szIssueRaw, szMapName );
engine->ClientCmd( szVoteCommand ); engine->ClientCmd( szVoteCommand );
} }
} }
} }
} }
else if ( V_stricmp( "kick", szIssue ) == 0 ) else if ( !V_stricmp( "Kick", szIssueRaw ) )
{ {
// Get selected Player // Get selected Player
int iSelectedParam = m_pVoteParameterList->GetSelectedItem(); int iSelectedParam = m_pVoteParameterList->GetSelectedItem();
@ -476,7 +520,7 @@ void CVoteSetupDialog::OnCommand(const char *command)
if ( engine->GetPlayerInfo( playerIndex, &playerInfo ) ) if ( engine->GetPlayerInfo( playerIndex, &playerInfo ) )
{ {
CBasePlayer *pPlayer = UTIL_PlayerByIndex( playerIndex ); CBasePlayer *pPlayer = UTIL_PlayerByIndex( playerIndex );
Q_snprintf( szVoteCommand, sizeof( szVoteCommand ), "callvote %s \"%d %s\"\n;", szIssue, pPlayer->GetUserID(), pReasonString ); Q_snprintf( szVoteCommand, sizeof( szVoteCommand ), "callvote %s \"%d %s\"\n;", szIssueRaw, pPlayer->GetUserID(), pReasonString );
engine->ClientCmd( szVoteCommand ); engine->ClientCmd( szVoteCommand );
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
CSteamID steamID; CSteamID steamID;
@ -495,7 +539,7 @@ void CVoteSetupDialog::OnCommand(const char *command)
} }
} }
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
else if ( V_stricmp( "ChangeMission", szIssue ) == 0 ) else if ( !V_stricmp( "ChangeMission", szIssueRaw ) )
{ {
int nSelectedParam = m_pVoteParameterList->GetSelectedItem(); int nSelectedParam = m_pVoteParameterList->GetSelectedItem();
if ( nSelectedParam >= 0 ) if ( nSelectedParam >= 0 )
@ -509,7 +553,7 @@ void CVoteSetupDialog::OnCommand(const char *command)
{ {
// Which Pop File? // Which Pop File?
const char *szPopFile = pParameterKeyValues->GetString( "Name" ); const char *szPopFile = pParameterKeyValues->GetString( "Name" );
Q_snprintf( szVoteCommand, sizeof( szVoteCommand ), "callvote %s %s\n;", szIssue, szPopFile ); Q_snprintf( szVoteCommand, sizeof( szVoteCommand ), "callvote %s %s\n;", szIssueRaw, szPopFile );
engine->ClientCmd( szVoteCommand ); engine->ClientCmd( szVoteCommand );
} }
} }
@ -519,7 +563,7 @@ void CVoteSetupDialog::OnCommand(const char *command)
else else
{ {
// Non-parameter vote. i.e. callvote scrambleteams // Non-parameter vote. i.e. callvote scrambleteams
Q_snprintf( szVoteCommand, sizeof(szVoteCommand), "callvote %s\n;", szIssue ); Q_snprintf( szVoteCommand, sizeof(szVoteCommand), "callvote %s\n;", szIssueRaw );
engine->ClientCmd( szVoteCommand ); engine->ClientCmd( szVoteCommand );
} }
@ -551,22 +595,23 @@ void CVoteSetupDialog::OnItemSelected( vgui::Panel *panel )
if ( !pIssueKeyValues ) if ( !pIssueKeyValues )
return; return;
CHudVote *pHudVote = GET_HUDELEMENT( CHudVote );
if ( !pHudVote )
return;
// We're rebuilding, so clear state // We're rebuilding, so clear state
m_bVoteButtonEnabled = false; m_bVoteButtonEnabled = false;
m_pVoteParameterList->ClearSelection(); m_pVoteParameterList->ClearSelection();
m_pVoteParameterList->RemoveAll(); m_pVoteParameterList->RemoveAll();
const char *szName = pIssueKeyValues->GetString( "Issue" ); const char *pszIssueRaw = pIssueKeyValues->GetString( "IssueRaw" );
if ( V_stricmp( "Voting disabled on this Server", szName ) == 0 ) bool bActive = pIssueKeyValues->GetBool( "Active" );
{ if ( !pHudVote->IsVoteSystemActive() || !bActive )
m_bVoteButtonEnabled = false;
}
else if ( V_stristr( szName, "(Disabled on Server)" ) ) // driller: need to localize
{ {
m_bVoteButtonEnabled = false; m_bVoteButtonEnabled = false;
} }
// CHANGELEVEL / NEXTLEVEL // CHANGELEVEL / NEXTLEVEL
else if ( V_stricmp( "changelevel", szName ) == 0 || V_stricmp( "nextlevel", szName ) == 0 ) else if ( !V_stricmp( "ChangeLevel", pszIssueRaw ) || !V_stricmp( "NextLevel", pszIssueRaw ) )
{ {
// Feed the mapcycle to the parameters list // Feed the mapcycle to the parameters list
for ( int index = 0; index < m_VoteIssuesMapCycle.Count(); index++ ) for ( int index = 0; index < m_VoteIssuesMapCycle.Count(); index++ )
@ -598,7 +643,7 @@ void CVoteSetupDialog::OnItemSelected( vgui::Panel *panel )
} }
} }
// KICK // KICK
else if ( V_stricmp( "kick", szName ) == 0 ) else if ( !V_stricmp( "Kick", pszIssueRaw ) )
{ {
// Feed the player list to the parameters list // Feed the player list to the parameters list
int nMaxClients = engine->GetMaxClients(); int nMaxClients = engine->GetMaxClients();
@ -656,7 +701,7 @@ void CVoteSetupDialog::OnItemSelected( vgui::Panel *panel )
} }
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
// CHANGE POP FILE // CHANGE POP FILE
else if ( V_stricmp( "ChangeMission", szName ) == 0 ) else if ( !V_stricmp( "ChangeMission", pszIssueRaw ) )
{ {
// Feed the popfiles to the parameters list // Feed the popfiles to the parameters list
for ( int index = 0; index < m_VoteIssuesPopFiles.Count(); index++ ) for ( int index = 0; index < m_VoteIssuesPopFiles.Count(); index++ )
@ -742,8 +787,8 @@ void CVoteSetupDialog::RefreshIssueParameters()
if ( iSelectedItem >= 0 ) if ( iSelectedItem >= 0 )
{ {
KeyValues *pIssueKeyValues = m_pVoteSetupList->GetItemData( iSelectedItem ); KeyValues *pIssueKeyValues = m_pVoteSetupList->GetItemData( iSelectedItem );
const char *szName = pIssueKeyValues->GetString( "Issue" ); const char *pszIssueRaw = pIssueKeyValues->GetString( "IssueRaw" );
if ( V_stricmp( "kick", szName ) == 0 ) if ( !V_stricmp( "Kick", pszIssueRaw ) )
{ {
if ( m_pVoteParameterList->GetItemCount() > 0 ) if ( m_pVoteParameterList->GetItemCount() > 0 )
{ {
@ -786,11 +831,11 @@ void CVoteSetupDialog::RefreshIssueParameters()
m_pVoteParameterList->InvalidateItem( index ); m_pVoteParameterList->InvalidateItem( index );
} }
}
}
m_pVoteParameterList->SetImageList( m_pImageList, false ); m_pVoteParameterList->SetImageList( m_pImageList, false );
} }
}
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -799,9 +844,9 @@ void CVoteSetupDialog::RefreshIssueParameters()
void CVoteSetupDialog::ResetData() void CVoteSetupDialog::ResetData()
{ {
m_bVoteButtonEnabled = false; m_bVoteButtonEnabled = false;
m_pVoteSetupList->DeleteAllItems(); m_pVoteSetupList->RemoveAll();
m_pVoteParameterList->DeleteAllItems(); m_pVoteParameterList->RemoveAll();
m_pComboBox->DeleteAllItems(); m_pComboBox->RemoveAll();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -863,7 +908,7 @@ void CHudVote::Init( void )
ListenForGameEvent( "vote_options" ); ListenForGameEvent( "vote_options" );
ListenForGameEvent( "vote_cast" ); ListenForGameEvent( "vote_cast" );
SetVoteActive( false ); m_bVotingActive = false;
m_flVoteResultCycleTime = -1; m_flVoteResultCycleTime = -1;
m_flHideTime = -1; m_flHideTime = -1;
m_bIsYesNoVote = true; m_bIsYesNoVote = true;
@ -871,6 +916,8 @@ void CHudVote::Init( void )
m_nVoteChoicesCount = 2; // Yes/No is the default m_nVoteChoicesCount = 2; // Yes/No is the default
m_bShowVoteActivePanel = false; m_bShowVoteActivePanel = false;
m_iVoteCallerIdx = -1; m_iVoteCallerIdx = -1;
m_bVoteSystemActive = false;
m_nVoteTeamIndex = 0;
HOOK_HUD_MESSAGE( CHudVote, CallVoteFailed ); HOOK_HUD_MESSAGE( CHudVote, CallVoteFailed );
HOOK_HUD_MESSAGE( CHudVote, VoteStart ); HOOK_HUD_MESSAGE( CHudVote, VoteStart );
@ -884,7 +931,7 @@ void CHudVote::Init( void )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CHudVote::LevelInit( void ) void CHudVote::LevelInit( void )
{ {
SetVoteActive( false ); m_bVotingActive = false;
m_flVoteResultCycleTime = -1; m_flVoteResultCycleTime = -1;
m_flHideTime = -1; m_flHideTime = -1;
m_flPostVotedHideTime = -1; m_flPostVotedHideTime = -1;
@ -901,7 +948,7 @@ int CHudVote::KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBin
if ( !down ) if ( !down )
return 1; return 1;
if ( !m_bVoteActive ) if ( !m_bVotingActive )
return 1; return 1;
if ( m_bPlayerVoted ) if ( m_bPlayerVoted )
@ -979,21 +1026,19 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
m_pCallVoteFailed->SetVisible( true ); m_pCallVoteFailed->SetVisible( true );
m_pVoteSetupDialog->SetVisible( false ); m_pVoteSetupDialog->SetVisible( false );
m_flHideTime = gpGlobals->curtime + 4.0; m_flHideTime = gpGlobals->curtime + 4.f;
char szTime[256]; char szTime[k_MAX_VOTE_NAME_LENGTH];
wchar_t wszTime[256]; wchar_t wszTime[k_MAX_VOTE_NAME_LENGTH];
bool bMinutes = ( nTime > 65 ); bool bMinutes = ( nTime > 65 );
if ( bMinutes ) if ( bMinutes )
{ {
nTime /= 60; nTime /= 60;
} }
const char *pszTimeString = ( bMinutes ) ? ( ( nTime < 2 ) ? "#GameUI_vote_failed_recently_min" : "#GameUI_vote_failed_recently_mins" ) : "#GameUI_vote_failed_recently";
Q_snprintf( szTime, sizeof ( szTime), "%i", nTime ); Q_snprintf( szTime, sizeof ( szTime), "%i", nTime );
g_pVGuiLocalize->ConvertANSIToUnicode( szTime, wszTime, sizeof( wszTime ) ); g_pVGuiLocalize->ConvertANSIToUnicode( szTime, wszTime, sizeof( wszTime ) );
wchar_t wszHeaderString[512]; wchar_t wszHeaderString[k_MAX_VOTE_NAME_LENGTH];
wchar_t *pwszHeaderString;
switch( nReason ) switch( nReason )
{ {
@ -1006,10 +1051,12 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
break; break;
case VOTE_FAILED_RATE_EXCEEDED: case VOTE_FAILED_RATE_EXCEEDED:
g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof(wszHeaderString), g_pVGuiLocalize->Find( "#GameUI_vote_failed_vote_spam" ), 1, wszTime ); {
pwszHeaderString = wszHeaderString; const char *pszTimeString = ( bMinutes ) ? ( ( nTime < 2 ) ? "#GameUI_vote_failed_vote_spam_min" : "#GameUI_vote_failed_vote_spam_mins" ) : "#GameUI_vote_failed_vote_spam";
m_pCallVoteFailed->SetDialogVariable( "FailedReason", pwszHeaderString ); g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof( wszHeaderString ), g_pVGuiLocalize->Find( pszTimeString ), 1, wszTime );
m_pCallVoteFailed->SetDialogVariable( "FailedReason", wszHeaderString );
break; break;
}
case VOTE_FAILED_ISSUE_DISABLED: case VOTE_FAILED_ISSUE_DISABLED:
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_disabled_issue" ); m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_disabled_issue" );
@ -1028,10 +1075,12 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
break; break;
case VOTE_FAILED_ON_COOLDOWN: case VOTE_FAILED_ON_COOLDOWN:
{
const char *pszTimeString = ( bMinutes ) ? ( ( nTime < 2 ) ? "#GameUI_vote_failed_recently_min" : "#GameUI_vote_failed_recently_mins" ) : "#GameUI_vote_failed_recently";
g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof( wszHeaderString ), g_pVGuiLocalize->Find( pszTimeString ), 1, wszTime ); g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof( wszHeaderString ), g_pVGuiLocalize->Find( pszTimeString ), 1, wszTime );
pwszHeaderString = wszHeaderString; m_pCallVoteFailed->SetDialogVariable( "FailedReason", wszHeaderString );
m_pCallVoteFailed->SetDialogVariable( "FailedReason", pwszHeaderString );
break; break;
}
case VOTE_FAILED_TEAM_CANT_CALL: case VOTE_FAILED_TEAM_CANT_CALL:
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_team_cant_call" ); m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_team_cant_call" );
@ -1058,10 +1107,12 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
break; break;
case VOTE_FAILED_CANNOT_KICK_FOR_TIME: case VOTE_FAILED_CANNOT_KICK_FOR_TIME:
g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof(wszHeaderString), g_pVGuiLocalize->Find( "#GameUI_vote_failed_cannot_kick_for_time" ), 1, wszTime ); {
pwszHeaderString = wszHeaderString; const char *pszTimeString = ( bMinutes ) ? ( ( nTime < 2 ) ? "#GameUI_vote_failed_cannot_kick_min" : "#GameUI_vote_failed_cannot_kick_mins" ) : "#GameUI_vote_failed_cannot_kick";
m_pCallVoteFailed->SetDialogVariable( "FailedReason", pwszHeaderString ); g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof( wszHeaderString ), g_pVGuiLocalize->Find( pszTimeString ), 1, wszTime );
m_pCallVoteFailed->SetDialogVariable( "FailedReason", wszHeaderString );
break; break;
}
case VOTE_FAILED_CANNOT_KICK_DURING_ROUND: case VOTE_FAILED_CANNOT_KICK_DURING_ROUND:
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_round_active" ); m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_round_active" );
@ -1070,6 +1121,14 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
case VOTE_FAILED_MODIFICATION_ALREADY_ACTIVE: case VOTE_FAILED_MODIFICATION_ALREADY_ACTIVE:
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_event_already_active" ); m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_event_already_active" );
break; break;
case VOTE_FAILED_VOTE_IN_PROGRESS:
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_vote_in_progress" );
break;
case VOTE_FAILED_KICK_LIMIT_REACHED:
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_kick_limit" );
break;
} }
} }
@ -1081,14 +1140,14 @@ void CHudVote::MsgFunc_VoteFailed( bf_read &msg )
if ( IsPlayingDemo() ) if ( IsPlayingDemo() )
return; return;
int iTeam = msg.ReadByte(); m_nVoteTeamIndex = msg.ReadByte();
vote_create_failed_t nReason = (vote_create_failed_t)msg.ReadByte(); vote_create_failed_t nReason = (vote_create_failed_t)msg.ReadByte();
// Visibility of this error is handled by OnThink() // Visibility of this error is handled by OnThink()
SetVoteActive( false ); m_bVotingActive = false;
m_bVotePassed = false; m_bVotePassed = false;
m_flVoteResultCycleTime = gpGlobals->curtime + 2; m_flVoteResultCycleTime = gpGlobals->curtime + 2.f;
m_flHideTime = gpGlobals->curtime + 5; m_flHideTime = gpGlobals->curtime + 5.f;
switch ( nReason ) switch ( nReason )
{ {
@ -1105,11 +1164,10 @@ void CHudVote::MsgFunc_VoteFailed( bf_read &msg )
break; break;
} }
// driller: this event has no listeners - will eventually hook into stats
IGameEvent *event = gameeventmanager->CreateEvent( "vote_failed" ); IGameEvent *event = gameeventmanager->CreateEvent( "vote_failed" );
if ( event ) if ( event )
{ {
event->SetInt( "team", iTeam ); event->SetInt( "team", m_nVoteTeamIndex );
gameeventmanager->FireEventClientSide( event ); gameeventmanager->FireEventClientSide( event );
} }
@ -1117,7 +1175,11 @@ void CHudVote::MsgFunc_VoteFailed( bf_read &msg )
if ( !pLocalPlayer ) if ( !pLocalPlayer )
return; return;
bool bShowToPlayer = ( !m_nVoteTeamIndex || pLocalPlayer->GetTeamNumber() == m_nVoteTeamIndex );
if ( bShowToPlayer )
{
pLocalPlayer->EmitSound("Vote.Failed"); pLocalPlayer->EmitSound("Vote.Failed");
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -1133,9 +1195,8 @@ void CHudVote::MsgFunc_VoteStart( bf_read &msg )
return; return;
// Is this a team-only vote? // Is this a team-only vote?
int iTeam = msg.ReadByte(); m_nVoteTeamIndex = msg.ReadByte();
uint8 invalidTeam = (uint8)TEAM_INVALID; if ( m_nVoteTeamIndex >= FIRST_GAME_TEAM && m_nVoteTeamIndex != pLocalPlayer->GetTeamNumber() )
if ( iTeam != invalidTeam && iTeam != pLocalPlayer->GetTeamNumber() )
return; return;
// Entity calling the vote // Entity calling the vote
@ -1163,18 +1224,18 @@ void CHudVote::MsgFunc_VoteStart( bf_read &msg )
} }
// DisplayString // DisplayString
char szIssue[256]; char szIssue[k_MAX_VOTE_NAME_LENGTH];
szIssue[0] = 0; szIssue[0] = 0;
msg.ReadString( szIssue, sizeof(szIssue) ); msg.ReadString( szIssue, sizeof(szIssue) );
// DetailString // DetailString
char szParam1[256]; char szParam1[k_MAX_VOTE_NAME_LENGTH];
szParam1[0] = 0; szParam1[0] = 0;
msg.ReadString( szParam1, sizeof(szParam1) ); msg.ReadString( szParam1, sizeof(szParam1) );
m_bIsYesNoVote = msg.ReadByte(); m_bIsYesNoVote = msg.ReadByte();
SetVoteActive( true ); m_bVotingActive = true;
m_pVoteFailed->SetVisible( false ); m_pVoteFailed->SetVisible( false );
m_pVotePassed->SetVisible( false ); m_pVotePassed->SetVisible( false );
m_pCallVoteFailed->SetVisible( false ); m_pCallVoteFailed->SetVisible( false );
@ -1204,25 +1265,23 @@ void CHudVote::MsgFunc_VoteStart( bf_read &msg )
// Display vote caller's name // Display vote caller's name
wchar_t wszCallerName[MAX_PLAYER_NAME_LENGTH]; wchar_t wszCallerName[MAX_PLAYER_NAME_LENGTH];
wchar_t wszHeaderString[512]; wchar_t wszHeaderString[k_MAX_VOTE_NAME_LENGTH];
wchar_t *pwszHeaderString;
// Player // Player
g_pVGuiLocalize->ConvertANSIToUnicode( pszCallerName, wszCallerName, sizeof( wszCallerName ) ); g_pVGuiLocalize->ConvertANSIToUnicode( pszCallerName, wszCallerName, sizeof( wszCallerName ) );
// String // String
g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof(wszHeaderString), g_pVGuiLocalize->Find( "#GameUI_vote_header" ), 1, wszCallerName ); g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof( wszHeaderString ), g_pVGuiLocalize->Find( "#GameUI_vote_header" ), 1, wszCallerName );
pwszHeaderString = wszHeaderString;
// Final // Final
m_pVoteActive->SetDialogVariable( "header", pwszHeaderString ); m_pVoteActive->SetDialogVariable( "header", wszHeaderString );
// Display the Issue // Display the Issue
wchar_t *pwcParam; wchar_t *pwcParam;
wchar_t wcParam[128]; wchar_t wcParam[k_MAX_VOTE_NAME_LENGTH];
wchar_t *pwcIssue; wchar_t *pwcIssue;
wchar_t wcIssue[512]; wchar_t wcIssue[k_MAX_VOTE_NAME_LENGTH];
if ( Q_strlen( szParam1 ) > 0 ) if ( Q_strlen( szParam1 ) > 0 )
{ {
@ -1252,7 +1311,7 @@ void CHudVote::MsgFunc_VoteStart( bf_read &msg )
if ( m_bIsYesNoVote ) if ( m_bIsYesNoVote )
{ {
// YES / NO UI // YES / NO UI
wchar_t wzFinal[512] = L""; wchar_t wzFinal[k_MAX_VOTE_NAME_LENGTH] = L"";
wchar_t *pszText = g_pVGuiLocalize->Find( "#GameUI_vote_yes_pc_instruction" ); wchar_t *pszText = g_pVGuiLocalize->Find( "#GameUI_vote_yes_pc_instruction" );
if ( pszText ) if ( pszText )
{ {
@ -1294,7 +1353,7 @@ void CHudVote::MsgFunc_VoteStart( bf_read &msg )
// Construct Option name // Construct Option name
const char *pszChoiceName = m_VoteSetupChoices[iIndex]; const char *pszChoiceName = m_VoteSetupChoices[iIndex];
char szOptionName[256]; char szOptionName[k_MAX_VOTE_NAME_LENGTH];
Q_snprintf( szOptionName, sizeof( szOptionName ), "F%i. ", iIndex + 1 ); Q_snprintf( szOptionName, sizeof( szOptionName ), "F%i. ", iIndex + 1 );
Q_strncat( szOptionName, pszChoiceName, sizeof( szOptionName ), COPY_ALL_CHARACTERS ); Q_strncat( szOptionName, pszChoiceName, sizeof( szOptionName ), COPY_ALL_CHARACTERS );
@ -1320,7 +1379,7 @@ void CHudVote::MsgFunc_VoteStart( bf_read &msg )
{ {
event->SetString( "issue", szIssue ); event->SetString( "issue", szIssue );
event->SetString( "param1", szParam1 ); event->SetString( "param1", szParam1 );
event->SetInt( "team", iTeam ); event->SetInt( "team", m_nVoteTeamIndex );
event->SetInt( "initiator", m_iVoteCallerIdx ); event->SetInt( "initiator", m_iVoteCallerIdx );
gameeventmanager->FireEventClientSide( event ); gameeventmanager->FireEventClientSide( event );
} }
@ -1332,10 +1391,10 @@ void CHudVote::MsgFunc_VoteStart( bf_read &msg )
} }
else else
{ {
ShowVoteUI(); m_bShowVoteActivePanel = true;
} }
#else #else
ShowVoteUI(); m_bShowVoteActivePanel = true;
#endif // TF_CLIENT_DLL #endif // TF_CLIENT_DLL
} }
@ -1347,24 +1406,24 @@ void CHudVote::MsgFunc_VotePass( bf_read &msg )
if ( IsPlayingDemo() ) if ( IsPlayingDemo() )
return; return;
int iTeam = msg.ReadByte(); m_nVoteTeamIndex = msg.ReadByte();
// Passed string // Passed string
char szResult[256]; char szResult[k_MAX_VOTE_NAME_LENGTH];
szResult[0] = 0; szResult[0] = 0;
msg.ReadString( szResult, sizeof(szResult) ); msg.ReadString( szResult, sizeof(szResult) );
// Detail string // Detail string
char szParam1[256]; char szParam1[k_MAX_VOTE_NAME_LENGTH];
szParam1[0] = 0; szParam1[0] = 0;
msg.ReadString( szParam1, sizeof(szParam1) ); msg.ReadString( szParam1, sizeof(szParam1) );
// Localize // Localize
wchar_t *pwcParam; wchar_t *pwcParam;
wchar_t wcParam[128]; wchar_t wcParam[k_MAX_VOTE_NAME_LENGTH];
wchar_t *pwcIssue; wchar_t *pwcIssue;
wchar_t wcIssue[512]; wchar_t wcIssue[k_MAX_VOTE_NAME_LENGTH];
if ( Q_strlen( szParam1 ) > 0 ) if ( Q_strlen( szParam1 ) > 0 )
{ {
@ -1390,10 +1449,10 @@ void CHudVote::MsgFunc_VotePass( bf_read &msg )
m_pVotePassed->SetDialogVariable( "passedresult", pwcIssue ); m_pVotePassed->SetDialogVariable( "passedresult", pwcIssue );
SetVoteActive( false ); m_bVotingActive = false;
m_bVotePassed = true; m_bVotePassed = true;
m_flVoteResultCycleTime = gpGlobals->curtime + 2; m_flVoteResultCycleTime = gpGlobals->curtime + 2.f;
m_flHideTime = gpGlobals->curtime + 5; m_flHideTime = gpGlobals->curtime + 5.f;
// driller: this event has no listeners - will eventually hook into stats // driller: this event has no listeners - will eventually hook into stats
IGameEvent *event = gameeventmanager->CreateEvent( "vote_passed" ); IGameEvent *event = gameeventmanager->CreateEvent( "vote_passed" );
@ -1401,7 +1460,7 @@ void CHudVote::MsgFunc_VotePass( bf_read &msg )
{ {
event->SetString( "details", szResult ); event->SetString( "details", szResult );
event->SetString( "param1", szParam1 ); event->SetString( "param1", szParam1 );
event->SetInt( "team", iTeam ); event->SetInt( "team", m_nVoteTeamIndex );
gameeventmanager->FireEventClientSide( event ); gameeventmanager->FireEventClientSide( event );
} }
@ -1434,21 +1493,45 @@ void CHudVote::MsgFunc_VoteSetup( bf_read &msg )
int nIssueCount = msg.ReadByte(); int nIssueCount = msg.ReadByte();
if ( nIssueCount ) if ( nIssueCount )
{ {
for ( int index = 0; index < nIssueCount; index++ ) for ( int i = 0; i < nIssueCount; i++ )
{ {
char szIssue[256]; char szIssue[k_MAX_VOTE_NAME_LENGTH];
msg.ReadString( szIssue, sizeof(szIssue) ); char szIssueString[k_MAX_VOTE_NAME_LENGTH];
if ( !m_VoteSetupIssues.HasElement( szIssue ) ) msg.ReadString( szIssue, sizeof( szIssue ) );
msg.ReadString( szIssueString, sizeof( szIssueString ) );
bool bIsActive = (bool)msg.ReadByte();
m_bVoteSystemActive |= bIsActive;
bool bAdd = true;
FOR_EACH_VEC( m_VoteSetupIssues, j )
{ {
if ( !V_strcmp( szIssue, m_VoteSetupIssues[j].szName ) )
{
bAdd = false;
break;
}
}
if ( bAdd )
{
// When empty, assume that we just pre-pend #Vote_ to szIssue (reduces msg size)
if ( !szIssueString[0] )
{
V_sprintf_safe( szIssueString, "#Vote_%s", szIssue );
}
VoteIssue_t issue;
V_strcpy_safe( issue.szName, szIssue );
V_strcpy_safe( issue.szNameString, szIssueString );
issue.bIsActive = bIsActive;
// Send it over to the listpanel // Send it over to the listpanel
m_VoteSetupIssues.CopyAndAddToTail( szIssue ); m_VoteSetupIssues.AddToTail( issue );
} }
} }
} }
else
{
m_VoteSetupIssues.CopyAndAddToTail( "Voting disabled on this Server" );
}
m_pVoteSetupDialog->AddVoteIssues( m_VoteSetupIssues ); m_pVoteSetupDialog->AddVoteIssues( m_VoteSetupIssues );
// Load up the list of Vote Issue Parameters // Load up the list of Vote Issue Parameters
@ -1638,50 +1721,51 @@ void CHudVote::FireGameEvent( IGameEvent *event )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CHudVote::OnThink() void CHudVote::OnThink()
{ {
C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
if ( pLocalPlayer )
{
bool bShowToPlayer = ( !m_nVoteTeamIndex || pLocalPlayer->GetTeamNumber() == m_nVoteTeamIndex );
// We delay hiding the menu after we cast a vote // We delay hiding the menu after we cast a vote
if ( m_bPlayerVoted && m_flPostVotedHideTime > 0 && m_flPostVotedHideTime < gpGlobals->curtime ) if ( m_bPlayerVoted && m_flPostVotedHideTime > 0 && gpGlobals->curtime > m_flPostVotedHideTime )
{ {
m_pVoteActive->SetVisible( false ); m_pVoteActive->SetVisible( false );
m_bShowVoteActivePanel = false; m_bShowVoteActivePanel = false;
m_flPostVotedHideTime = -1; m_flPostVotedHideTime = -1;
} }
if ( m_flVoteResultCycleTime > 0 && m_flVoteResultCycleTime < gpGlobals->curtime ) if ( m_flVoteResultCycleTime > 0 && gpGlobals->curtime > m_flVoteResultCycleTime )
{ {
m_pVoteActive->SetVisible( false ); m_pVoteActive->SetVisible( false );
m_pVoteFailed->SetVisible( !m_bVotePassed ); m_pVoteFailed->SetVisible( !m_bVotePassed && bShowToPlayer );
m_pVotePassed->SetVisible( m_bVotePassed ); m_pVotePassed->SetVisible( m_bVotePassed && bShowToPlayer );
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( m_pVoteActive, "HideVoteBackgrounds" ); g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( m_pVoteActive, "HideVoteBackgrounds" );
m_flVoteResultCycleTime = -1; m_flVoteResultCycleTime = -1;
m_bPlayerVoted = false; m_bPlayerVoted = false;
m_bVoteActive = false; m_bVotingActive = false;
m_bShowVoteActivePanel = false; m_bShowVoteActivePanel = false;
m_iVoteCallerIdx = -1; m_iVoteCallerIdx = -1;
} }
if ( m_bVoteActive ) if ( m_bVotingActive && m_bShowVoteActivePanel )
{ {
// driller: Need to rewrite this to handle all vote types (Yes/No and General) // driller: Need to rewrite this to handle all vote types (Yes/No and General)
if ( m_bIsYesNoVote && m_pVoteActive ) if ( m_bIsYesNoVote && m_pVoteActive )
{ {
char szYesCount[512] = ""; char szYesCount[k_MAX_VOTE_NAME_LENGTH] = "";
Q_snprintf( szYesCount, 512, "%d", m_nVoteOptionCount[0] ); Q_snprintf( szYesCount, sizeof( szYesCount ), "%d", m_nVoteOptionCount[0] );
char szNoCount[512] = ""; char szNoCount[k_MAX_VOTE_NAME_LENGTH] = "";
Q_snprintf( szNoCount, 512, "%d", m_nVoteOptionCount[1] ); Q_snprintf( szNoCount, sizeof( szNoCount ), "%d", m_nVoteOptionCount[1] );
m_pVoteActive->SetControlString( "Option1CountLabel", szYesCount ); m_pVoteActive->SetControlString( "Option1CountLabel", szYesCount );
m_pVoteActive->SetControlString( "Option2CountLabel", szNoCount ); m_pVoteActive->SetControlString( "Option2CountLabel", szNoCount );
} }
if ( !m_pVoteActive->IsVisible() && m_bShowVoteActivePanel ) if ( !m_pVoteActive->IsVisible() && bShowToPlayer )
{ {
m_pVoteActive->SetVisible( true ); m_pVoteActive->SetVisible( true );
C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
if ( pLocalPlayer )
{
pLocalPlayer->EmitSound("Vote.Created"); pLocalPlayer->EmitSound("Vote.Created");
} }
} }
@ -1695,7 +1779,7 @@ void CHudVote::OnThink()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool CHudVote::ShouldDraw( void ) bool CHudVote::ShouldDraw( void )
{ {
return ( m_bVoteActive || m_flHideTime > gpGlobals->curtime ); return ( m_bVotingActive || gpGlobals->curtime < m_flHideTime );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -1706,22 +1790,6 @@ bool CHudVote::IsPlayingDemo() const
return engine->IsPlayingDemo(); return engine->IsPlayingDemo();
} }
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudVote::SetVoteActive( bool bActive )
{
m_bVoteActive = bActive;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudVote::ShowVoteUI( void )
{
m_bShowVoteActivePanel = true;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -25,6 +25,8 @@ extern INetworkStringTable *g_pStringTableServerPopFiles;
extern INetworkStringTable *g_pStringTableServerMapCycleMvM; extern INetworkStringTable *g_pStringTableServerMapCycleMvM;
#endif #endif
static const int k_MAX_VOTE_NAME_LENGTH = 256;
namespace vgui namespace vgui
{ {
class SectionedListPanel; class SectionedListPanel;
@ -32,6 +34,13 @@ namespace vgui
class ImageList; class ImageList;
}; };
struct VoteIssue_t
{
char szName[k_MAX_VOTE_NAME_LENGTH];
char szNameString[k_MAX_VOTE_NAME_LENGTH];
bool bIsActive;
};
class VoteBarPanel : public vgui::Panel, public CGameEventListener class VoteBarPanel : public vgui::Panel, public CGameEventListener
{ {
DECLARE_CLASS_SIMPLE( VoteBarPanel, vgui::Panel ); DECLARE_CLASS_SIMPLE( VoteBarPanel, vgui::Panel );
@ -69,8 +78,9 @@ public:
virtual void PostApplySchemeSettings( vgui::IScheme *pScheme ); virtual void PostApplySchemeSettings( vgui::IScheme *pScheme );
virtual void ApplySettings(KeyValues *inResourceData); virtual void ApplySettings(KeyValues *inResourceData);
void InitializeIssueList( void );
void UpdateCurrentMap( void ); void UpdateCurrentMap( void );
void AddVoteIssues( CUtlStringList &m_VoteSetupIssues ); void AddVoteIssues( CUtlVector< VoteIssue_t > &m_VoteSetupIssues );
void AddVoteIssueParams_MapCycle( CUtlStringList &m_VoteSetupMapCycle ); void AddVoteIssueParams_MapCycle( CUtlStringList &m_VoteSetupMapCycle );
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
@ -94,7 +104,7 @@ private:
vgui::Button *m_pCallVoteButton; vgui::Button *m_pCallVoteButton;
vgui::ImageList *m_pImageList; vgui::ImageList *m_pImageList;
CUtlVector<const char*> m_VoteIssues; CUtlVector< VoteIssue_t > m_VoteIssues;
CUtlVector<const char*> m_VoteIssuesMapCycle; CUtlVector<const char*> m_VoteIssuesMapCycle;
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
@ -137,12 +147,12 @@ class CHudVote : public vgui::EditablePanel, public CHudElement
void MsgFunc_VoteSetup( bf_read &msg ); void MsgFunc_VoteSetup( bf_read &msg );
void PropagateOptionParameters( void ); void PropagateOptionParameters( void );
void ShowVoteUI( void ); void ShowVoteUI( bool bShow ) { m_bShowVoteActivePanel = bShow; }
bool IsVoteUIActive( void ); bool IsVoteUIActive( void );
bool IsVoteSystemActive( void ) { return m_bVoteSystemActive; }
private: private:
bool IsPlayingDemo() const; bool IsPlayingDemo() const;
void SetVoteActive( bool bActive );
EditablePanel *m_pVoteActive; EditablePanel *m_pVoteActive;
VoteBarPanel *m_voteBar; VoteBarPanel *m_voteBar;
@ -151,7 +161,7 @@ private:
EditablePanel *m_pCallVoteFailed; EditablePanel *m_pCallVoteFailed;
CVoteSetupDialog *m_pVoteSetupDialog; CVoteSetupDialog *m_pVoteSetupDialog;
CUtlStringList m_VoteSetupIssues; CUtlVector< VoteIssue_t > m_VoteSetupIssues;
CUtlStringList m_VoteSetupMapCycle; CUtlStringList m_VoteSetupMapCycle;
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
@ -160,7 +170,8 @@ private:
CUtlStringList m_VoteSetupChoices; CUtlStringList m_VoteSetupChoices;
bool m_bVoteActive; bool m_bVotingActive;
bool m_bVoteSystemActive;
float m_flVoteResultCycleTime; // what time will we cycle to the result float m_flVoteResultCycleTime; // what time will we cycle to the result
float m_flHideTime; // what time will we hide float m_flHideTime; // what time will we hide
bool m_bVotePassed; // what mode are we going to cycle to bool m_bVotePassed; // what mode are we going to cycle to
@ -172,6 +183,7 @@ private:
float m_flPostVotedHideTime; float m_flPostVotedHideTime;
bool m_bShowVoteActivePanel; bool m_bShowVoteActivePanel;
int m_iVoteCallerIdx; int m_iVoteCallerIdx;
int m_nVoteTeamIndex; // If defined, only players on this team will see/vote on the issue
}; };
#endif // HUD_VOTE_H #endif // HUD_VOTE_H

View File

@ -60,6 +60,7 @@ void CAM_ToThirdPerson(void)
{ {
if ( cl_thirdperson.GetBool() == false ) if ( cl_thirdperson.GetBool() == false )
{ {
g_ThirdPersonManager.SetDesiredCameraOffset( Vector( cam_idealdist.GetFloat(), cam_idealdistright.GetFloat(), cam_idealdistup.GetFloat() ) );
g_ThirdPersonManager.SetOverridingThirdPerson( true ); g_ThirdPersonManager.SetOverridingThirdPerson( true );
} }

View File

@ -800,7 +800,7 @@ void CInput::JoyStickMove( float frametime, CUserCmd *cmd )
if ( m_flPreviousJoystickForward || m_flPreviousJoystickSide || m_flPreviousJoystickPitch || m_flPreviousJoystickYaw ) if ( m_flPreviousJoystickForward || m_flPreviousJoystickSide || m_flPreviousJoystickPitch || m_flPreviousJoystickYaw )
{ {
Vector vTempOffset = g_ThirdPersonManager.GetCameraOffsetAngles(); const Vector& vTempOffset = g_ThirdPersonManager.GetCameraOffsetAngles();
// update the ideal pitch and yaw // update the ideal pitch and yaw
cam_idealpitch.SetValue( vTempOffset[ PITCH ] - viewangles[ PITCH ] ); cam_idealpitch.SetValue( vTempOffset[ PITCH ] - viewangles[ PITCH ] );

View File

@ -522,7 +522,7 @@ void CInput::ApplyMouse( QAngle& viewangles, CUserCmd *cmd, float mouse_x, float
} }
else else
{ {
viewangles[PITCH] += m_pitch->GetFloat() * mouse_y; viewangles[PITCH] += CAM_CapPitch( m_pitch->GetFloat() * mouse_y );
} }
// Check pitch bounds // Check pitch bounds

View File

@ -99,7 +99,8 @@ public:
virtual bool CAM_IsOrthographic() const; virtual bool CAM_IsOrthographic() const;
virtual void CAM_OrthographicSize( float& w, float& h ) const; virtual void CAM_OrthographicSize( float& w, float& h ) const;
virtual float CAM_CapYaw( float fVal ) { return fVal; } virtual float CAM_CapYaw( float fVal ) const { return fVal; }
virtual float CAM_CapPitch( float fVal ) const { return fVal; }
#if defined( HL2_CLIENT_DLL ) #if defined( HL2_CLIENT_DLL )
// IK back channel info // IK back channel info
@ -113,7 +114,7 @@ public:
virtual bool EnableJoystickMode(); virtual bool EnableJoystickMode();
// Private Implementation // Private Implementation
private: protected:
// Implementation specific initialization // Implementation specific initialization
void Init_Camera( void ); void Init_Camera( void );
void Init_Keyboard( void ); void Init_Keyboard( void );
@ -134,8 +135,8 @@ private:
void GetAccumulatedMouseDeltasAndResetAccumulators( float *mx, float *my ); void GetAccumulatedMouseDeltasAndResetAccumulators( float *mx, float *my );
void GetMouseDelta( float inmousex, float inmousey, float *pOutMouseX, float *pOutMouseY ); void GetMouseDelta( float inmousex, float inmousey, float *pOutMouseX, float *pOutMouseY );
void ScaleMouse( float *x, float *y ); void ScaleMouse( float *x, float *y );
void ApplyMouse( QAngle& viewangles, CUserCmd *cmd, float mouse_x, float mouse_y ); virtual void ApplyMouse( QAngle& viewangles, CUserCmd *cmd, float mouse_x, float mouse_y );
void MouseMove ( CUserCmd *cmd ); virtual void MouseMove ( CUserCmd *cmd );
// Joystick movement input helpers // Joystick movement input helpers
void ControllerMove ( float frametime, CUserCmd *cmd ); void ControllerMove ( float frametime, CUserCmd *cmd );

View File

@ -1540,12 +1540,15 @@ static ConVar r_threaded_particles( "r_threaded_particles", "1" );
static float s_flThreadedPSystemTimeStep; static float s_flThreadedPSystemTimeStep;
static void ProcessPSystem( CNewParticleEffect *&pNewEffect ) static void ProcessPSystem( ParticleSimListEntry_t& pSimListEntry )
{ {
// Enable FP exceptions here when FP_EXCEPTIONS_ENABLED is defined, // Enable FP exceptions here when FP_EXCEPTIONS_ENABLED is defined,
// to help track down bad math. // to help track down bad math.
FPExceptionEnabler enableExceptions; FPExceptionEnabler enableExceptions;
CNewParticleEffect* pNewEffect = pSimListEntry.m_pNewParticleEffect;
bool updateBboxOnly = pSimListEntry.m_bBoundingBoxOnly;
// If this is a new effect, then update its bbox so it goes in the // If this is a new effect, then update its bbox so it goes in the
// right leaves (if it has particles). // right leaves (if it has particles).
int bFirstUpdate = pNewEffect->GetNeedsBBoxUpdate(); int bFirstUpdate = pNewEffect->GetNeedsBBoxUpdate();
@ -1564,12 +1567,12 @@ static void ProcessPSystem( CNewParticleEffect *&pNewEffect )
if ( pNewEffect->GetFirstFrameFlag() ) if ( pNewEffect->GetFirstFrameFlag() )
{ {
pNewEffect->Simulate( 0.0f ); pNewEffect->Simulate( 0.0f, updateBboxOnly );
pNewEffect->SetFirstFrameFlag( false ); pNewEffect->SetFirstFrameFlag( false );
} }
else if ( pNewEffect->ShouldSimulate() ) else if ( pNewEffect->ShouldSimulate() )
{ {
pNewEffect->Simulate( s_flThreadedPSystemTimeStep ); pNewEffect->Simulate( s_flThreadedPSystemTimeStep, updateBboxOnly );
} }
if ( pNewEffect->IsFinished() ) if ( pNewEffect->IsFinished() )
@ -1684,7 +1687,7 @@ bool CParticleMgr::RetireParticleCollections( CParticleSystemDefinition* pDef,
// Next, see if there are new particle systems that need early retirement // Next, see if there are new particle systems that need early retirement
static ConVar cl_particle_retire_cost( "cl_particle_retire_cost", "0", FCVAR_CHEAT ); static ConVar cl_particle_retire_cost( "cl_particle_retire_cost", "0", FCVAR_CHEAT );
bool CParticleMgr::EarlyRetireParticleSystems( int nCount, CNewParticleEffect **ppEffects ) bool CParticleMgr::EarlyRetireParticleSystems( int nCount, ParticleSimListEntry_t *ppEffects )
{ {
// NOTE: Doing a cheap and hacky estimate of worst-case fillrate // NOTE: Doing a cheap and hacky estimate of worst-case fillrate
const CViewSetup *pViewSetup = view->GetPlayerViewSetup(); const CViewSetup *pViewSetup = view->GetPlayerViewSetup();
@ -1699,14 +1702,14 @@ bool CParticleMgr::EarlyRetireParticleSystems( int nCount, CNewParticleEffect **
CParticleSystemDefinition **ppDefs = (CParticleSystemDefinition**)stackalloc( nCount * sizeof(CParticleSystemDefinition*) ); CParticleSystemDefinition **ppDefs = (CParticleSystemDefinition**)stackalloc( nCount * sizeof(CParticleSystemDefinition*) );
for ( int i = 0; i < nCount; ++i ) for ( int i = 0; i < nCount; ++i )
{ {
CParticleSystemDefinition *pDef = ppEffects[i]->m_pDef; CParticleSystemDefinition *pDef = ppEffects[i].m_pNewParticleEffect->m_pDef;
// Skip stuff that doesn't have a cull radius set // Skip stuff that doesn't have a cull radius set
if ( pDef->GetCullRadius() == 0.0f ) if ( pDef->GetCullRadius() == 0.0f )
continue; continue;
// Only perform the cull check on creation // Only perform the cull check on creation
if ( !ppEffects[i]->GetFirstFrameFlag() ) if ( !ppEffects[i].m_pNewParticleEffect->GetFirstFrameFlag() )
continue; continue;
if ( pDef->HasRetirementBeenChecked( gpGlobals->framecount ) ) if ( pDef->HasRetirementBeenChecked( gpGlobals->framecount ) )
@ -1714,7 +1717,7 @@ bool CParticleMgr::EarlyRetireParticleSystems( int nCount, CNewParticleEffect **
pDef->MarkRetirementCheck( gpGlobals->framecount ); pDef->MarkRetirementCheck( gpGlobals->framecount );
ppDefs[nDefCount++] = ppEffects[i]->m_pDef; ppDefs[nDefCount++] = ppEffects[i].m_pNewParticleEffect->m_pDef;
} }
if ( nDefCount == 0 ) if ( nDefCount == 0 )
@ -1722,7 +1725,7 @@ bool CParticleMgr::EarlyRetireParticleSystems( int nCount, CNewParticleEffect **
for ( int i = 0; i < nCount; ++i ) for ( int i = 0; i < nCount; ++i )
{ {
ppEffects[i]->MarkShouldPerformCullCheck( true ); ppEffects[i].m_pNewParticleEffect->MarkShouldPerformCullCheck( true );
} }
Vector vecCameraForward; Vector vecCameraForward;
@ -1749,28 +1752,45 @@ bool CParticleMgr::EarlyRetireParticleSystems( int nCount, CNewParticleEffect **
for ( int i = 0; i < nCount; ++i ) for ( int i = 0; i < nCount; ++i )
{ {
ppEffects[i]->MarkShouldPerformCullCheck( false ); ppEffects[i].m_pNewParticleEffect->MarkShouldPerformCullCheck( false );
} }
return bRetiredCollections; return bRetiredCollections;
} }
static ConVar particle_sim_alt_cores( "particle_sim_alt_cores", "2" ); static ConVar particle_sim_alt_cores( "particle_sim_alt_cores", "2" );
void CParticleMgr::BuildParticleSimList( CUtlVector< CNewParticleEffect* > &list ) void CParticleMgr::BuildParticleSimList( CUtlVector< ParticleSimListEntry_t > &list )
{ {
float flNow = g_pParticleSystemMgr->GetLastSimulationTime(); float flNow = g_pParticleSystemMgr->GetLastSimulationTime();
for( CNewParticleEffect *pNewEffect=m_NewEffects.m_pHead; pNewEffect; for( CNewParticleEffect *pNewEffect=m_NewEffects.m_pHead; pNewEffect;
pNewEffect=pNewEffect->m_pNext ) pNewEffect=pNewEffect->m_pNext )
{ {
bool bSkip = false;
bool bNeedsBboxUpdate = false;
if ( flNow >= pNewEffect->m_flNextSleepTime && pNewEffect->m_nActiveParticles > 0 ) if ( flNow >= pNewEffect->m_flNextSleepTime && pNewEffect->m_nActiveParticles > 0 )
continue; bSkip = true;
if ( pNewEffect->GetRemoveFlag() ) if ( pNewEffect->GetRemoveFlag() )
continue; bSkip = true;
if ( g_bMeasureParticlePerformance )
if ( !bSkip && g_bMeasureParticlePerformance )
{ {
g_nNumParticlesSimulated += pNewEffect->m_nActiveParticles; g_nNumParticlesSimulated += pNewEffect->m_nActiveParticles;
} }
list.AddToTail( pNewEffect );
// Particles that are attached to moving things will need to update their bboxes even if they
// otherwise would like to skip the updates. Check that here.
if (bSkip)
{
bNeedsBboxUpdate = pNewEffect->HasMoved();
bSkip = !bNeedsBboxUpdate;
}
if (!bSkip)
{
ParticleSimListEntry_t entry = { pNewEffect, bNeedsBboxUpdate };
list.AddToTail( entry );
}
} }
} }
@ -1812,23 +1832,27 @@ void CParticleMgr::UpdateNewEffects( float flTimeDelta )
int nParticleStatsTriggerCount = cl_particle_stats_trigger_count.GetInt(); int nParticleStatsTriggerCount = cl_particle_stats_trigger_count.GetInt();
BeginSimulateParticles(); BeginSimulateParticles();
CUtlVector<CNewParticleEffect *> particlesToSimulate;
BuildParticleSimList( particlesToSimulate );
s_flThreadedPSystemTimeStep = flTimeDelta; s_flThreadedPSystemTimeStep = flTimeDelta;
int nCount = particlesToSimulate.Count();
// first, run non-reentrant part to get CP updates from entities // first, run non-reentrant part to get CP updates from entities
for( int i=0; i<nCount; i++ ) // This is done on all particles, because it updates control point locations which we need to determine whether or not we should
// do full simulation later.
for (CNewParticleEffect *pNewEffect = m_NewEffects.m_pHead; pNewEffect;
pNewEffect = pNewEffect->m_pNext)
{ {
// this one can call into random entity code which may not be thread-safe // this one can call into random entity code which may not be thread-safe
particlesToSimulate[i]->Update( s_flThreadedPSystemTimeStep ); pNewEffect->Update( s_flThreadedPSystemTimeStep );
if ( nParticleStatsTriggerCount > 0 ) if ( nParticleStatsTriggerCount > 0 )
{ {
nParticleActiveParticlesCount += CountParticleSystemActiveParticles( particlesToSimulate[i] ); nParticleActiveParticlesCount += CountParticleSystemActiveParticles( pNewEffect );
} }
} }
CUtlVector<ParticleSimListEntry_t> particlesToSimulate;
BuildParticleSimList(particlesToSimulate);
int nCount = particlesToSimulate.Count();
// See if there are new particle systems that need early retirement // See if there are new particle systems that need early retirement
// This has to happen after the first update // This has to happen after the first update
if ( EarlyRetireParticleSystems( nCount, particlesToSimulate.Base() ) ) if ( EarlyRetireParticleSystems( nCount, particlesToSimulate.Base() ) )
@ -1861,7 +1885,7 @@ void CParticleMgr::UpdateNewEffects( float flTimeDelta )
{ {
nAltCore = 2; nAltCore = 2;
} }
CParallelProcessor<CNewParticleEffect*, CFuncJobItemProcessor<CNewParticleEffect*> > processor( "CParticleMgr::UpdateNewEffects" ); CParallelProcessor<ParticleSimListEntry_t, CFuncJobItemProcessor<ParticleSimListEntry_t> > processor( "CParticleMgr::UpdateNewEffects" );
processor.m_ItemProcessor.Init( ProcessPSystem, NULL, NULL ); processor.m_ItemProcessor.Init( ProcessPSystem, NULL, NULL );
processor.Run( particlesToSimulate.Base(), nCount, INT_MAX, m_pThreadPool[nAltCore-1] ); processor.Run( particlesToSimulate.Base(), nCount, INT_MAX, m_pThreadPool[nAltCore-1] );
} }
@ -1872,7 +1896,7 @@ void CParticleMgr::UpdateNewEffects( float flTimeDelta )
for( int i=0; i<nCount; i++) for( int i=0; i<nCount; i++)
{ {
// this one can call into random entity code which may not be thread-safe // this one can call into random entity code which may not be thread-safe
particlesToSimulate[i]->DetectChanges(); particlesToSimulate[i].m_pNewParticleEffect->DetectChanges();
} }
EndSimulateParticles(); EndSimulateParticles();

View File

@ -236,6 +236,13 @@ public:
IMaterial *m_pMaterial; IMaterial *m_pMaterial;
}; };
// Particle simulation list, used to determine what particles to simulate and how.
struct ParticleSimListEntry_t
{
CNewParticleEffect* m_pNewParticleEffect;
bool m_bBoundingBoxOnly;
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// interface IParticleEffect: // interface IParticleEffect:
@ -715,8 +722,9 @@ private:
const CViewSetup& view, const VMatrix &worldToPixels, float flFocalDist ); const CViewSetup& view, const VMatrix &worldToPixels, float flFocalDist );
bool RetireParticleCollections( CParticleSystemDefinition* pDef, int nCount, RetireInfo_t *pInfo, float flScreenArea, float flMaxTotalArea ); bool RetireParticleCollections( CParticleSystemDefinition* pDef, int nCount, RetireInfo_t *pInfo, float flScreenArea, float flMaxTotalArea );
void BuildParticleSimList( CUtlVector< CNewParticleEffect* > &list );
bool EarlyRetireParticleSystems( int nCount, CNewParticleEffect **ppEffects ); void BuildParticleSimList( CUtlVector< ParticleSimListEntry_t > &list );
bool EarlyRetireParticleSystems( int nCount, ParticleSimListEntry_t *ppEffects );
static int RetireSort( const void *p1, const void *p2 ); static int RetireSort( const void *p1, const void *p2 );
private: private:

View File

@ -65,6 +65,8 @@ void CNewParticleEffect::Construct()
m_MaxBounds = Vector( -1.0e6, -1.0e6, -1.0e6 ); m_MaxBounds = Vector( -1.0e6, -1.0e6, -1.0e6 );
m_pDebugName = NULL; m_pDebugName = NULL;
m_bViewModelEffect = m_pDef ? m_pDef->IsViewModelEffect() : false;
if ( IsValid() && clienttools->IsInRecordingMode() ) if ( IsValid() && clienttools->IsInRecordingMode() )
{ {
int nId = AllocateToolParticleEffectId(); int nId = AllocateToolParticleEffectId();

View File

@ -91,6 +91,9 @@ public:
void SetControlPointUpVector( int nWhichPoint, const Vector &v ); void SetControlPointUpVector( int nWhichPoint, const Vector &v );
void SetControlPointRightVector( int nWhichPoint, const Vector &v ); void SetControlPointRightVector( int nWhichPoint, const Vector &v );
void SetIsViewModelEffect ( bool bIsViewModelEffect ) { m_bViewModelEffect = bIsViewModelEffect; }
bool GetIsViewModelEffect () { return m_bViewModelEffect; }
FORCEINLINE EHANDLE const &GetControlPointEntity( int nWhichPoint ) FORCEINLINE EHANDLE const &GetControlPointEntity( int nWhichPoint )
{ {
return m_hControlPointOwners[ nWhichPoint ]; return m_hControlPointOwners[ nWhichPoint ];
@ -153,6 +156,8 @@ protected:
Vector m_LastMin; Vector m_LastMin;
Vector m_LastMax; Vector m_LastMax;
bool m_bViewModelEffect;
private: private:
// Update the reference count. // Update the reference count.
void AddRef(); void AddRef();
@ -309,7 +314,7 @@ inline void CNewParticleEffect::MarkShouldPerformCullCheck( bool bEnable )
inline CSmartPtr<CNewParticleEffect> CNewParticleEffect::Create( CBaseEntity *pOwner, const char *pParticleSystemName, const char *pDebugName ) inline CSmartPtr<CNewParticleEffect> CNewParticleEffect::Create( CBaseEntity *pOwner, const char *pParticleSystemName, const char *pDebugName )
{ {
CNewParticleEffect *pRet = new CNewParticleEffect( pOwner, pParticleSystemName ); CNewParticleEffect *pRet = new CNewParticleEffect( pOwner, pParticleSystemName );
pRet->m_pDebugName = pDebugName; pRet->m_pDebugName = pDebugName ? pDebugName : pParticleSystemName;
pRet->SetDynamicallyAllocated( true ); pRet->SetDynamicallyAllocated( true );
return pRet; return pRet;
} }
@ -317,7 +322,7 @@ inline CSmartPtr<CNewParticleEffect> CNewParticleEffect::Create( CBaseEntity *pO
inline CSmartPtr<CNewParticleEffect> CNewParticleEffect::Create( CBaseEntity *pOwner, CParticleSystemDefinition *pDef, const char *pDebugName ) inline CSmartPtr<CNewParticleEffect> CNewParticleEffect::Create( CBaseEntity *pOwner, CParticleSystemDefinition *pDef, const char *pDebugName )
{ {
CNewParticleEffect *pRet = new CNewParticleEffect( pOwner, pDef ); CNewParticleEffect *pRet = new CNewParticleEffect( pOwner, pDef );
pRet->m_pDebugName = pDebugName; pRet->m_pDebugName = pDebugName ? pDebugName : pDef->GetName();
pRet->SetDynamicallyAllocated( true ); pRet->SetDynamicallyAllocated( true );
return pRet; return pRet;
} }

View File

@ -45,6 +45,12 @@ static ConVar cl_predictionentitydump( "cl_pdump", "-1", FCVAR_CHEAT, "Dump info
static ConVar cl_predictionentitydumpbyclass( "cl_pclass", "", FCVAR_CHEAT, "Dump entity by prediction classname." ); static ConVar cl_predictionentitydumpbyclass( "cl_pclass", "", FCVAR_CHEAT, "Dump entity by prediction classname." );
static ConVar cl_pred_optimize( "cl_pred_optimize", "2", 0, "Optimize for not copying data if didn't receive a network update (1), and also for not repredicting if there were no errors (2)." ); static ConVar cl_pred_optimize( "cl_pred_optimize", "2", 0, "Optimize for not copying data if didn't receive a network update (1), and also for not repredicting if there were no errors (2)." );
#ifdef STAGING_ONLY
// Do not ship this - testing a fix
static ConVar cl_pred_optimize_prefer_server_data( "cl_pred_optimize_prefer_server_data", "0", 0, "In the case where we have both server data and predicted data up to the same tick, choose server data over predicted data." );
//
#endif // STAGING_ONLY
#endif #endif
extern IGameMovement *g_pGameMovement; extern IGameMovement *g_pGameMovement;
@ -1401,6 +1407,11 @@ int CPrediction::ComputeFirstCommandToExecute( bool received_new_world_update, i
} }
else else
{ {
#ifdef STAGING_ONLY
int nPredictedLimit = cl_pred_optimize_prefer_server_data.GetBool() ? m_nCommandsPredicted - 1 : m_nCommandsPredicted;
#else
int nPredictedLimit = m_nCommandsPredicted;
#endif // STAGING_ONLY
// Otherwise, there is a second optimization, wherein if we did receive an update, but no // Otherwise, there is a second optimization, wherein if we did receive an update, but no
// values differed (or were outside their epsilon) and the server actually acknowledged running // values differed (or were outside their epsilon) and the server actually acknowledged running
// one or more commands, then we can revert the entity to the predicted state from last frame, // one or more commands, then we can revert the entity to the predicted state from last frame,
@ -1409,7 +1420,7 @@ int CPrediction::ComputeFirstCommandToExecute( bool received_new_world_update, i
if ( cl_pred_optimize.GetInt() >= 2 && if ( cl_pred_optimize.GetInt() >= 2 &&
!m_bPreviousAckHadErrors && !m_bPreviousAckHadErrors &&
m_nCommandsPredicted > 0 && m_nCommandsPredicted > 0 &&
m_nServerCommandsAcknowledged <= m_nCommandsPredicted ) m_nServerCommandsAcknowledged <= nPredictedLimit )
{ {
// Copy all of the previously predicted data back into entity so we can skip repredicting it // Copy all of the previously predicted data back into entity so we can skip repredicting it
// This is the final slot that we previously predicted // This is the final slot that we previously predicted

View File

@ -107,11 +107,11 @@ ITexture *GetFullFrameFrameBufferTexture( int textureIndex )
char name[256]; char name[256];
if( textureIndex != 0 ) if( textureIndex != 0 )
{ {
sprintf( name, "_rt_FullFrameFB%d", textureIndex ); V_sprintf_safe( name, "_rt_FullFrameFB%d", textureIndex );
} }
else else
{ {
Q_strcpy( name, "_rt_FullFrameFB" ); V_strcpy_safe( name, "_rt_FullFrameFB" );
} }
s_pFullFrameFrameBufferTexture[textureIndex].Init( materials->FindTexture( name, TEXTURE_GROUP_RENDER_TARGET ) ); s_pFullFrameFrameBufferTexture[textureIndex].Init( materials->FindTexture( name, TEXTURE_GROUP_RENDER_TARGET ) );
Assert( !IsErrorTexture( s_pFullFrameFrameBufferTexture[textureIndex] ) ); Assert( !IsErrorTexture( s_pFullFrameFrameBufferTexture[textureIndex] ) );

View File

@ -141,7 +141,7 @@ bool CGenericClassBasedReplay::Read( KeyValues *pIn )
// Read killer info // Read killer info
m_nKillerClass = pIn->GetInt( "killer_class" ); m_nKillerClass = pIn->GetInt( "killer_class" );
V_strcpy( m_szKillerName, pIn->GetString( "killer_name" ) ); V_strcpy_safe( m_szKillerName, pIn->GetString( "killer_name" ) );
// Make sure vector is clear // Make sure vector is clear
Assert( GetKillCount() == 0 ); Assert( GetKillCount() == 0 );

View File

@ -2151,7 +2151,7 @@ void SixenseInput::SetPlayerHandPositions( CUserCmd *pCmd, float flFrametime )
// This 'slides' the hold origin if you pull the object back into the player // This 'slides' the hold origin if you pull the object back into the player
float min_z_dist = sixense_hold_slide_z_min_dist.GetFloat(); float min_z_dist = sixense_hold_slide_z_min_dist.GetFloat();
float xy_radius = sixense_hold_slide_xy_radius.GetFloat();; float xy_radius = sixense_hold_slide_xy_radius.GetFloat();
if ( !m_bScalingLockedOneToOne && (Vector3( ss_right_pos[0], ss_right_pos[1], 0.0f ).length() < xy_radius) && (ss_right_pos[2] > min_z_dist) ) if ( !m_bScalingLockedOneToOne && (Vector3( ss_right_pos[0], ss_right_pos[1], 0.0f ).length() < xy_radius) && (ss_right_pos[2] > min_z_dist) )
{ {

View File

@ -201,7 +201,7 @@ static void AdjustSubRect(CEngineSprite *pSprite, int frame, float *pfLeft, floa
*pw = rc.right - rc.left; *pw = rc.right - rc.left;
*ph = rc.bottom - rc.top; *ph = rc.bottom - rc.top;
f = 1.0 / (float)pSprite->GetWidth();; f = 1.0 / (float)pSprite->GetWidth();
*pfLeft = ((float)rc.left + 0.5) * f; *pfLeft = ((float)rc.left + 0.5) * f;
*pfRight = ((float)rc.right - 0.5) * f; *pfRight = ((float)rc.right - 0.5) * f;
@ -415,13 +415,15 @@ IMaterial *CEngineSprite::GetMaterial( RenderMode_t nRenderMode, int nFrame )
m_VideoMaterial->SetFrame( nFrame ); m_VideoMaterial->SetFrame( nFrame );
} }
IMaterial *pMaterial = m_material[nRenderMode]; IMaterial *pMaterial = m_material[nRenderMode];
if ( pMaterial )
{
IMaterialVar* pFrameVar = pMaterial->FindVarFast( "$frame", &frameCache ); IMaterialVar* pFrameVar = pMaterial->FindVarFast( "$frame", &frameCache );
if ( pFrameVar ) if ( pFrameVar )
{ {
pFrameVar->SetIntValue( nFrame ); pFrameVar->SetIntValue( nFrame );
} }
}
return pMaterial; return pMaterial;
} }

View File

@ -166,7 +166,8 @@ public:
if ( debugOverlayPanel ) if ( debugOverlayPanel )
{ {
debugOverlayPanel->SetParent( (vgui::Panel *)NULL ); debugOverlayPanel->SetParent( (vgui::Panel *)NULL );
delete debugOverlayPanel; debugOverlayPanel->MarkForDeletion();
debugOverlayPanel = NULL;
} }
} }
}; };

View File

@ -395,7 +395,7 @@ public:
if ( fpsPanel ) if ( fpsPanel )
{ {
fpsPanel->SetParent( (vgui::Panel *)NULL ); fpsPanel->SetParent( (vgui::Panel *)NULL );
delete fpsPanel; fpsPanel->MarkForDeletion();
fpsPanel = NULL; fpsPanel = NULL;
} }
} }
@ -814,7 +814,7 @@ public:
if ( ioPanel ) if ( ioPanel )
{ {
ioPanel->SetParent( (vgui::Panel *)NULL ); ioPanel->SetParent( (vgui::Panel *)NULL );
delete ioPanel; ioPanel->MarkForDeletion();
ioPanel = NULL; ioPanel = NULL;
} }
} }

View File

@ -128,14 +128,14 @@ public:
if ( loadingDiscPanel ) if ( loadingDiscPanel )
{ {
loadingDiscPanel->SetParent( (vgui::Panel *)NULL ); loadingDiscPanel->SetParent( (vgui::Panel *)NULL );
delete loadingDiscPanel; loadingDiscPanel->MarkForDeletion();
loadingDiscPanel = NULL; loadingDiscPanel = NULL;
} }
if ( m_pPauseDiscPanel ) if ( m_pPauseDiscPanel )
{ {
m_pPauseDiscPanel->SetParent( (vgui::Panel *)NULL ); m_pPauseDiscPanel->SetParent( (vgui::Panel *)NULL );
delete m_pPauseDiscPanel; m_pPauseDiscPanel->MarkForDeletion();
m_pPauseDiscPanel = NULL; m_pPauseDiscPanel = NULL;
} }

View File

@ -378,7 +378,7 @@ public:
if ( messageCharsPanel ) if ( messageCharsPanel )
{ {
messageCharsPanel->SetParent( (vgui::Panel *)NULL ); messageCharsPanel->SetParent( (vgui::Panel *)NULL );
delete messageCharsPanel; messageCharsPanel->MarkForDeletion();
messageCharsPanel = NULL; messageCharsPanel = NULL;
} }
} }

View File

@ -492,6 +492,10 @@ void CNetGraphPanel::DrawTimes( vrect_t vrect, cmdinfo_t *cmdinfo, int x, int w,
{ {
i = ( m_OutgoingSequence - a ) & ( TIMINGS - 1 ); i = ( m_OutgoingSequence - a ) & ( TIMINGS - 1 );
h = MIN( ( cmdinfo[i].cmd_lerp / 3.0 ) * LERP_HEIGHT, LERP_HEIGHT ); h = MIN( ( cmdinfo[i].cmd_lerp / 3.0 ) * LERP_HEIGHT, LERP_HEIGHT );
if ( h < 0 )
{
h = LERP_HEIGHT;
}
rcFill.x = x + w -a - 1; rcFill.x = x + w -a - 1;
rcFill.width = 1; rcFill.width = 1;
@ -514,7 +518,9 @@ void CNetGraphPanel::DrawTimes( vrect_t vrect, cmdinfo_t *cmdinfo, int x, int w,
for ( j = start; j < h; j++ ) for ( j = start; j < h; j++ )
{ {
DrawLine(&rcFill, colors[j + extrap_point], 255 ); int index = j + extrap_point;
Assert( (size_t)index < Q_ARRAYSIZE( colors ) );
DrawLine(&rcFill, colors[ index ], 255 );
rcFill.y--; rcFill.y--;
} }
} }
@ -532,7 +538,9 @@ void CNetGraphPanel::DrawTimes( vrect_t vrect, cmdinfo_t *cmdinfo, int x, int w,
for ( j = 0; j < h; j++ ) for ( j = 0; j < h; j++ )
{ {
DrawLine(&rcFill, colors[j + oldh], 255 ); int index = j + oldh;
Assert( (size_t)index < Q_ARRAYSIZE( colors ) );
DrawLine(&rcFill, colors[ index ], 255 );
rcFill.y--; rcFill.y--;
} }
} }
@ -1533,7 +1541,7 @@ public:
if ( netGraphPanel ) if ( netGraphPanel )
{ {
netGraphPanel->SetParent( (Panel *)NULL ); netGraphPanel->SetParent( (Panel *)NULL );
delete netGraphPanel; netGraphPanel->MarkForDeletion();
netGraphPanel = NULL; netGraphPanel = NULL;
} }
} }

View File

@ -178,11 +178,13 @@ void CSchemeVisualizer::AddFontsToList()
{ {
#ifdef POSIX #ifdef POSIX
const char strOAccent[] = { (char)0xc3, (char)0x93, 0x00 }; // UTF-8 for U+00D3 (LATIN CAPITAL LETTER O WITH ACUTE) const char strOAccent[] = { (char)0xc3, (char)0x93, 0x00 }; // UTF-8 for U+00D3 (LATIN CAPITAL LETTER O WITH ACUTE)
const char strSkull[] = { (char)0xe2, (char)0x98, (char)0xa0, 0x00 };
#else #else
const uint8 strOAccent[] = { 0xd3, 0x00 }; const uint8 strOAccent[] = { 0xd3, 0x00 };
const char strSkull[] = "";
#endif #endif
// Stick an intl character in here to test accents (O') // Stick an intl character in here to test accents (O')
CFmtStr fmtText( "ABCDEFGHIJKLMN%sPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz0123456789!@#$%%^&*()-_=+", strOAccent ); CFmtStr fmtText( "ABCDEFGHIJKLMN%sPQRSTUVWXYZ%sabcdefhijklmnopqrstuvwxyz0123456789!@#$%%^&*()-_=+", strOAccent, strSkull );
const int nFontCount = m_pViewScheme->GetFontCount(); const int nFontCount = m_pViewScheme->GetFontCount();

View File

@ -348,7 +348,8 @@ bool VideoPanel_Create( unsigned int nXPos, unsigned int nYPos,
// Start it going // Start it going
if ( pVideoPanel->BeginPlayback( pVideoFilename ) == false ) if ( pVideoPanel->BeginPlayback( pVideoFilename ) == false )
{ {
delete pVideoPanel; pVideoPanel->MarkForDeletion();
pVideoPanel = NULL;
return false; return false;
} }

View File

@ -110,9 +110,9 @@ static ConVar v_centerspeed( "v_centerspeed","500" );
#ifdef TF_CLIENT_DLL #ifdef TF_CLIENT_DLL
// 54 degrees approximates a 35mm camera - we determined that this makes the viewmodels // 54 degrees approximates a 35mm camera - we determined that this makes the viewmodels
// and motions look the most natural. // and motions look the most natural.
ConVar v_viewmodel_fov( "viewmodel_fov", "54", FCVAR_ARCHIVE ); ConVar v_viewmodel_fov( "viewmodel_fov", "54", FCVAR_ARCHIVE, "Sets the field-of-view for the viewmodel.", true, 0.1, true, 179.9 );
#else #else
ConVar v_viewmodel_fov( "viewmodel_fov", "54", FCVAR_CHEAT ); ConVar v_viewmodel_fov( "viewmodel_fov", "54", FCVAR_CHEAT, "Sets the field-of-view for the viewmodel.", true, 0.1, true, 179.9 );
#endif #endif
ConVar mat_viewportscale( "mat_viewportscale", "1.0", FCVAR_ARCHIVE, "Scale down the main viewport (to reduce GPU impact on CPU profiling)", true, (1.0f / 640.0f), true, 1.0f ); ConVar mat_viewportscale( "mat_viewportscale", "1.0", FCVAR_ARCHIVE, "Scale down the main viewport (to reduce GPU impact on CPU profiling)", true, (1.0f / 640.0f), true, 1.0f );
ConVar mat_viewportupscale( "mat_viewportupscale", "1", FCVAR_ARCHIVE, "Scale the viewport back up" ); ConVar mat_viewportupscale( "mat_viewportupscale", "1", FCVAR_ARCHIVE, "Scale the viewport back up" );

View File

@ -101,6 +101,7 @@ void CBaseHudWeaponSelection::Reset(void)
// Start hidden // Start hidden
m_bSelectionVisible = false; m_bSelectionVisible = false;
m_flSelectionTime = gpGlobals->curtime; m_flSelectionTime = gpGlobals->curtime;
gHUD.UnlockRenderGroup( gHUD.LookupRenderGroupIndexByName( "weapon_selection" ) );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -207,6 +208,7 @@ bool CBaseHudWeaponSelection::IsInSelectionMode()
void CBaseHudWeaponSelection::OpenSelection( void ) void CBaseHudWeaponSelection::OpenSelection( void )
{ {
m_bSelectionVisible = true; m_bSelectionVisible = true;
gHUD.LockRenderGroup( gHUD.LookupRenderGroupIndexByName( "weapon_selection" ) );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -215,6 +217,7 @@ void CBaseHudWeaponSelection::OpenSelection( void )
void CBaseHudWeaponSelection::HideSelection( void ) void CBaseHudWeaponSelection::HideSelection( void )
{ {
m_bSelectionVisible = false; m_bSelectionVisible = false;
gHUD.UnlockRenderGroup( gHUD.LookupRenderGroupIndexByName( "weapon_selection" ) );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -18,6 +18,7 @@
abstract_class IResponseFilter abstract_class IResponseFilter
{ {
public: public:
virtual ~IResponseFilter(){}
virtual bool IsValidResponse( ResponseType_t type, const char *pszValue ) = 0; virtual bool IsValidResponse( ResponseType_t type, const char *pszValue ) = 0;
}; };

View File

@ -925,6 +925,25 @@ void CBaseAnimatingOverlay::SetLayerCycle( int iLayer, float flCycle, float flPr
m_AnimOverlay[iLayer].MarkActive( ); m_AnimOverlay[iLayer].MarkActive( );
} }
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseAnimatingOverlay::SetLayerCycle( int iLayer, float flCycle, float flPrevCycle, float flLastEventCheck )
{
if (!IsValidLayer( iLayer ))
return;
if (!m_AnimOverlay[iLayer].m_bLooping)
{
flCycle = clamp( flCycle, 0.0f, 1.0f );
flPrevCycle = clamp( flPrevCycle, 0.0f, 1.0f );
}
m_AnimOverlay[iLayer].m_flCycle = flCycle;
m_AnimOverlay[iLayer].m_flPrevCycle = flPrevCycle;
m_AnimOverlay[iLayer].m_flLastEventCheck = flLastEventCheck;
m_AnimOverlay[iLayer].MarkActive( );
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -165,6 +165,7 @@ public:
void SetLayerCycle( int iLayer, float flCycle ); void SetLayerCycle( int iLayer, float flCycle );
void SetLayerCycle( int iLayer, float flCycle, float flPrevCycle ); void SetLayerCycle( int iLayer, float flCycle, float flPrevCycle );
void SetLayerCycle( int iLayer, float flCycle, float flPrevCycle, float flLastEventCheck );
float GetLayerCycle( int iLayer ); float GetLayerCycle( int iLayer );
void SetLayerPlaybackRate( int iLayer, float flPlaybackRate ); void SetLayerPlaybackRate( int iLayer, float flPlaybackRate );

View File

@ -839,7 +839,7 @@ void CC_CommentaryChanged( IConVar *pConVar, const char *pOldString, float flOld
g_CommentarySystem.SetCommentaryMode( var.GetBool() ); g_CommentarySystem.SetCommentaryMode( var.GetBool() );
} }
} }
ConVar commentary("commentary", "0", FCVAR_ARCHIVE | FCVAR_ARCHIVE_XBOX, "Desired commentary mode state.", CC_CommentaryChanged ); ConVar commentary( "commentary", "0", FCVAR_NONE, "Desired commentary mode state.", CC_CommentaryChanged );
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: We need to revert back any convar changes that are made by the // Purpose: We need to revert back any convar changes that are made by the

View File

@ -155,7 +155,7 @@ bool BasicGameStats_t::ParseFromBuffer( CUtlBuffer& buf, int iBufferStatsVersion
for ( int i = 0; i < c; ++i ) for ( int i = 0; i < c; ++i )
{ {
char mapname[ 256 ]; char mapname[ 256 ];
buf.GetString( mapname, sizeof( mapname ) ); buf.GetString( mapname );
BasicGameStatsRecord_t *rec = FindOrAddRecordForMap( mapname ); BasicGameStatsRecord_t *rec = FindOrAddRecordForMap( mapname );
bool valid= rec->ParseFromBuffer( buf, iBufferStatsVersion ); bool valid= rec->ParseFromBuffer( buf, iBufferStatsVersion );

View File

@ -1686,6 +1686,11 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
ADD_ACTIVITY_TO_SR( ACT_MP_ATTACK_SWIM_GRENADE_ITEM2 ); ADD_ACTIVITY_TO_SR( ACT_MP_ATTACK_SWIM_GRENADE_ITEM2 );
ADD_ACTIVITY_TO_SR( ACT_MP_ATTACK_AIRWALK_GRENADE_ITEM2 ); ADD_ACTIVITY_TO_SR( ACT_MP_ATTACK_AIRWALK_GRENADE_ITEM2 );
// Passtime
ADD_ACTIVITY_TO_SR( ACT_MP_STAND_PASSTIME );
ADD_ACTIVITY_TO_SR( ACT_MP_RUN_PASSTIME );
ADD_ACTIVITY_TO_SR( ACT_MP_CROUCHWALK_PASSTIME );
// Flinches // Flinches
ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_FLINCH ); ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_FLINCH );
ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_FLINCH_PRIMARY ); ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_FLINCH_PRIMARY );
@ -1826,6 +1831,7 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_ITEM1 ); ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_ITEM1 );
ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_ITEM2 ); ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_ITEM2 );
ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_LOSERSTATE ); ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_LOSERSTATE );
ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_PASSTIME );
ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_VC_HANDMOUTH ); ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_VC_HANDMOUTH );
ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_VC_FINGERPOINT ); ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_VC_FINGERPOINT );
@ -1887,6 +1893,11 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
ADD_ACTIVITY_TO_SR( ACT_MP_STUN_MIDDLE ); ADD_ACTIVITY_TO_SR( ACT_MP_STUN_MIDDLE );
ADD_ACTIVITY_TO_SR( ACT_MP_STUN_END ); ADD_ACTIVITY_TO_SR( ACT_MP_STUN_END );
ADD_ACTIVITY_TO_SR( ACT_MP_PASSTIME_THROW_BEGIN );
ADD_ACTIVITY_TO_SR( ACT_MP_PASSTIME_THROW_MIDDLE );
ADD_ACTIVITY_TO_SR( ACT_MP_PASSTIME_THROW_END );
ADD_ACTIVITY_TO_SR( ACT_MP_PASSTIME_THROW_CANCEL );
ADD_ACTIVITY_TO_SR( ACT_VM_UNUSABLE ); ADD_ACTIVITY_TO_SR( ACT_VM_UNUSABLE );
ADD_ACTIVITY_TO_SR( ACT_VM_UNUSABLE_TO_USABLE ); ADD_ACTIVITY_TO_SR( ACT_VM_UNUSABLE_TO_USABLE );
ADD_ACTIVITY_TO_SR( ACT_VM_USABLE_TO_UNUSABLE ); ADD_ACTIVITY_TO_SR( ACT_VM_USABLE_TO_UNUSABLE );
@ -2186,4 +2197,40 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
ADD_ACTIVITY_TO_SR( ACT_BOT_GESTURE_FLINCH ); ADD_ACTIVITY_TO_SR( ACT_BOT_GESTURE_FLINCH );
ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC_START ); ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC_START );
ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC_END ); ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC_END );
ADD_ACTIVITY_TO_SR( ACT_ENGINEER_REVOLVER_DRAW );
ADD_ACTIVITY_TO_SR( ACT_ENGINEER_REVOLVER_IDLE );
ADD_ACTIVITY_TO_SR( ACT_ENGINEER_REVOLVER_PRIMARYATTACK );
ADD_ACTIVITY_TO_SR( ACT_ENGINEER_REVOLVER_RELOAD );
ADD_ACTIVITY_TO_SR( ACT_KART_IDLE );
ADD_ACTIVITY_TO_SR( ACT_KART_ACTION_SHOOT );
ADD_ACTIVITY_TO_SR( ACT_KART_ACTION_DASH );
ADD_ACTIVITY_TO_SR( ACT_KART_JUMP_START );
ADD_ACTIVITY_TO_SR( ACT_KART_JUMP_FLOAT );
ADD_ACTIVITY_TO_SR( ACT_KART_JUMP_LAND );
ADD_ACTIVITY_TO_SR( ACT_KART_IMPACT );
ADD_ACTIVITY_TO_SR( ACT_KART_IMPACT_BIG );
ADD_ACTIVITY_TO_SR( ACT_KART_GESTURE_POSITIVE );
ADD_ACTIVITY_TO_SR( ACT_KART_GESTURE_NEGATIVE );
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_DRAW );
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_IDLE );
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_FIRE_START );
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_FIRE_IDLE );
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_PULL_START );
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_PULL_IDLE );
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_PULL_END );
ADD_ACTIVITY_TO_SR( ACT_PRIMARY_VM_INSPECT_START );
ADD_ACTIVITY_TO_SR( ACT_PRIMARY_VM_INSPECT_IDLE );
ADD_ACTIVITY_TO_SR( ACT_PRIMARY_VM_INSPECT_END );
ADD_ACTIVITY_TO_SR( ACT_SECONDARY_VM_INSPECT_START );
ADD_ACTIVITY_TO_SR( ACT_SECONDARY_VM_INSPECT_IDLE );
ADD_ACTIVITY_TO_SR( ACT_SECONDARY_VM_INSPECT_END );
ADD_ACTIVITY_TO_SR( ACT_MELEE_VM_INSPECT_START );
ADD_ACTIVITY_TO_SR( ACT_MELEE_VM_INSPECT_IDLE );
ADD_ACTIVITY_TO_SR( ACT_MELEE_VM_INSPECT_END );
} }

View File

@ -470,7 +470,6 @@ void CBaseAnimating::StudioFrameAdvanceManual( float flInterval )
if ( !pStudioHdr ) if ( !pStudioHdr )
return; return;
UpdateModelScale();
m_flAnimTime = gpGlobals->curtime; m_flAnimTime = gpGlobals->curtime;
m_flPrevAnimTime = m_flAnimTime - flInterval; m_flPrevAnimTime = m_flAnimTime - flInterval;
float flCycleRate = GetSequenceCycleRate( pStudioHdr, GetSequence() ) * m_flPlaybackRate; float flCycleRate = GetSequenceCycleRate( pStudioHdr, GetSequence() ) * m_flPlaybackRate;
@ -490,8 +489,6 @@ void CBaseAnimating::StudioFrameAdvance()
return; return;
} }
UpdateModelScale();
if ( !m_flPrevAnimTime ) if ( !m_flPrevAnimTime )
{ {
m_flPrevAnimTime = m_flAnimTime; m_flPrevAnimTime = m_flAnimTime;
@ -631,7 +628,7 @@ void CBaseAnimating::InputSetModelScale( inputdata_t &inputdata )
int CBaseAnimating::SelectWeightedSequence ( Activity activity ) int CBaseAnimating::SelectWeightedSequence ( Activity activity )
{ {
Assert( activity != ACT_INVALID ); Assert( activity != ACT_INVALID );
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
return ::SelectWeightedSequence( GetModelPtr(), activity, GetSequence() ); return ::SelectWeightedSequence( GetModelPtr(), activity, GetSequence() );
} }
@ -639,16 +636,23 @@ int CBaseAnimating::SelectWeightedSequence ( Activity activity )
int CBaseAnimating::SelectWeightedSequence ( Activity activity, int curSequence ) int CBaseAnimating::SelectWeightedSequence ( Activity activity, int curSequence )
{ {
Assert( activity != ACT_INVALID ); Assert( activity != ACT_INVALID );
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
return ::SelectWeightedSequence( GetModelPtr(), activity, curSequence ); return ::SelectWeightedSequence( GetModelPtr(), activity, curSequence );
} }
int CBaseAnimating::SelectWeightedSequenceFromModifiers( Activity activity, CUtlSymbol *pActivityModifiers, int iModifierCount )
{
Assert( activity != ACT_INVALID );
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
return GetModelPtr()->SelectWeightedSequenceFromModifiers( activity, pActivityModifiers, iModifierCount );
}
//========================================================= //=========================================================
// ResetActivityIndexes // ResetActivityIndexes
//========================================================= //=========================================================
void CBaseAnimating::ResetActivityIndexes ( void ) void CBaseAnimating::ResetActivityIndexes ( void )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
::ResetActivityIndexes( GetModelPtr() ); ::ResetActivityIndexes( GetModelPtr() );
} }
@ -657,7 +661,7 @@ void CBaseAnimating::ResetActivityIndexes ( void )
//========================================================= //=========================================================
void CBaseAnimating::ResetEventIndexes ( void ) void CBaseAnimating::ResetEventIndexes ( void )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
::ResetEventIndexes( GetModelPtr() ); ::ResetEventIndexes( GetModelPtr() );
} }
@ -669,7 +673,7 @@ void CBaseAnimating::ResetEventIndexes ( void )
//========================================================= //=========================================================
int CBaseAnimating::SelectHeaviestSequence ( Activity activity ) int CBaseAnimating::SelectHeaviestSequence ( Activity activity )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
return ::SelectHeaviestSequence( GetModelPtr(), activity ); return ::SelectHeaviestSequence( GetModelPtr(), activity );
} }
@ -681,7 +685,7 @@ int CBaseAnimating::SelectHeaviestSequence ( Activity activity )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CBaseAnimating::LookupActivity( const char *label ) int CBaseAnimating::LookupActivity( const char *label )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
return ::LookupActivity( GetModelPtr(), label ); return ::LookupActivity( GetModelPtr(), label );
} }
@ -689,7 +693,7 @@ int CBaseAnimating::LookupActivity( const char *label )
//========================================================= //=========================================================
int CBaseAnimating::LookupSequence( const char *label ) int CBaseAnimating::LookupSequence( const char *label )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
return ::LookupSequence( GetModelPtr(), label ); return ::LookupSequence( GetModelPtr(), label );
} }
@ -729,7 +733,7 @@ float CBaseAnimating::GetSequenceMoveYaw( int iSequence )
{ {
Vector vecReturn; Vector vecReturn;
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
::GetSequenceLinearMotion( GetModelPtr(), iSequence, GetPoseParameterArray(), &vecReturn ); ::GetSequenceLinearMotion( GetModelPtr(), iSequence, GetPoseParameterArray(), &vecReturn );
if (vecReturn.Length() > 0) if (vecReturn.Length() > 0)
@ -765,7 +769,7 @@ float CBaseAnimating::GetSequenceMoveDist( CStudioHdr *pStudioHdr, int iSequence
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CBaseAnimating::GetSequenceLinearMotion( int iSequence, Vector *pVec ) void CBaseAnimating::GetSequenceLinearMotion( int iSequence, Vector *pVec )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
::GetSequenceLinearMotion( GetModelPtr(), iSequence, GetPoseParameterArray(), pVec ); ::GetSequenceLinearMotion( GetModelPtr(), iSequence, GetPoseParameterArray(), pVec );
} }
@ -912,7 +916,7 @@ void CBaseAnimating::ResetSequenceInfo ( )
//========================================================= //=========================================================
bool CBaseAnimating::IsValidSequence( int iSequence ) bool CBaseAnimating::IsValidSequence( int iSequence )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
CStudioHdr* pstudiohdr = GetModelPtr( ); CStudioHdr* pstudiohdr = GetModelPtr( );
if (iSequence < 0 || iSequence >= pstudiohdr->GetNumSeq()) if (iSequence < 0 || iSequence >= pstudiohdr->GetNumSeq())
{ {
@ -1779,7 +1783,7 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
MDLCACHE_CRITICAL_SECTION(); MDLCACHE_CRITICAL_SECTION();
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
CStudioHdr *pStudioHdr = GetModelPtr( ); CStudioHdr *pStudioHdr = GetModelPtr( );
@ -2087,7 +2091,7 @@ void CBaseAnimating::GetEyeballs( Vector &origin, QAngle &angles )
//========================================================= //=========================================================
int CBaseAnimating::FindTransitionSequence( int iCurrentSequence, int iGoalSequence, int *piDir ) int CBaseAnimating::FindTransitionSequence( int iCurrentSequence, int iGoalSequence, int *piDir )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
if (piDir == NULL) if (piDir == NULL)
{ {
@ -2136,7 +2140,7 @@ void CBaseAnimating::SetBodygroup( int iGroup, int iValue )
{ {
// SetBodygroup is not supported on pending dynamic models. Wait for it to load! // SetBodygroup is not supported on pending dynamic models. Wait for it to load!
// XXX TODO we could buffer up the group and value if we really needed to. -henryg // XXX TODO we could buffer up the group and value if we really needed to. -henryg
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
int newBody = m_nBody; int newBody = m_nBody;
::SetBodygroup( GetModelPtr( ), newBody, iGroup, iValue ); ::SetBodygroup( GetModelPtr( ), newBody, iGroup, iValue );
m_nBody = newBody; m_nBody = newBody;
@ -2735,7 +2739,7 @@ void CBaseAnimating::InitBoneControllers ( void ) // FIXME: rename
//========================================================= //=========================================================
float CBaseAnimating::SetBoneController ( int iController, float flValue ) float CBaseAnimating::SetBoneController ( int iController, float flValue )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
CStudioHdr *pmodel = (CStudioHdr*)GetModelPtr(); CStudioHdr *pmodel = (CStudioHdr*)GetModelPtr();
@ -2752,7 +2756,7 @@ float CBaseAnimating::SetBoneController ( int iController, float flValue )
//========================================================= //=========================================================
float CBaseAnimating::GetBoneController ( int iController ) float CBaseAnimating::GetBoneController ( int iController )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
CStudioHdr *pmodel = (CStudioHdr*)GetModelPtr(); CStudioHdr *pmodel = (CStudioHdr*)GetModelPtr();
@ -2943,7 +2947,7 @@ void CBaseAnimating::SetHitboxSet( int setnum )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CBaseAnimating::SetHitboxSetByName( const char *setname ) void CBaseAnimating::SetHitboxSetByName( const char *setname )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
m_nHitboxSet = FindHitboxSetByName( GetModelPtr(), setname ); m_nHitboxSet = FindHitboxSetByName( GetModelPtr(), setname );
} }
@ -2962,7 +2966,7 @@ int CBaseAnimating::GetHitboxSet( void )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const char *CBaseAnimating::GetHitboxSetName( void ) const char *CBaseAnimating::GetHitboxSetName( void )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
return ::GetHitboxSetName( GetModelPtr(), m_nHitboxSet ); return ::GetHitboxSetName( GetModelPtr(), m_nHitboxSet );
} }
@ -2972,7 +2976,7 @@ const char *CBaseAnimating::GetHitboxSetName( void )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CBaseAnimating::GetHitboxSetCount( void ) int CBaseAnimating::GetHitboxSetCount( void )
{ {
Assert( GetModelPtr() ); AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
return ::GetHitboxSetCount( GetModelPtr() ); return ::GetHitboxSetCount( GetModelPtr() );
} }
@ -3303,6 +3307,7 @@ void CBaseAnimating::SetModelScale( float scale, float change_duration /*= 0.0f*
mvs->m_flModelScaleGoal = scale; mvs->m_flModelScaleGoal = scale;
mvs->m_flModelScaleStartTime = gpGlobals->curtime; mvs->m_flModelScaleStartTime = gpGlobals->curtime;
mvs->m_flModelScaleFinishTime = mvs->m_flModelScaleStartTime + change_duration; mvs->m_flModelScaleFinishTime = mvs->m_flModelScaleStartTime + change_duration;
SetContextThink( &CBaseAnimating::UpdateModelScale, gpGlobals->curtime, "UpdateModelScaleThink" );
} }
else else
{ {
@ -3341,6 +3346,11 @@ void CBaseAnimating::UpdateModelScale()
} }
RefreshCollisionBounds(); RefreshCollisionBounds();
if ( frac < 1.f )
{
SetContextThink( &CBaseAnimating::UpdateModelScale, gpGlobals->curtime, "UpdateModelScaleThink" );
}
} }
void CBaseAnimating::RefreshCollisionBounds( void ) void CBaseAnimating::RefreshCollisionBounds( void )

View File

@ -108,6 +108,7 @@ public:
void ResetEventIndexes ( void ); void ResetEventIndexes ( void );
int SelectWeightedSequence ( Activity activity ); int SelectWeightedSequence ( Activity activity );
int SelectWeightedSequence ( Activity activity, int curSequence ); int SelectWeightedSequence ( Activity activity, int curSequence );
int SelectWeightedSequenceFromModifiers( Activity activity, CUtlSymbol *pActivityModifiers, int iModifierCount );
int SelectHeaviestSequence ( Activity activity ); int SelectHeaviestSequence ( Activity activity );
int LookupActivity( const char *label ); int LookupActivity( const char *label );
int LookupSequence ( const char *label ); int LookupSequence ( const char *label );
@ -436,10 +437,14 @@ inline CStudioHdr *CBaseAnimating::GetModelPtr( void )
return NULL; return NULL;
#ifdef _DEBUG #ifdef _DEBUG
if ( !HushAsserts() )
{
// GetModelPtr() is often called before OnNewModel() so go ahead and set it up first chance. // GetModelPtr() is often called before OnNewModel() so go ahead and set it up first chance.
static IDataCacheSection *pModelCache = datacache->FindSection( "ModelData" ); static IDataCacheSection *pModelCache = datacache->FindSection( "ModelData" );
AssertOnce( pModelCache->IsFrameLocking() ); AssertOnce( pModelCache->IsFrameLocking() );
}
#endif #endif
if ( !m_pStudioHdr && GetModel() ) if ( !m_pStudioHdr && GetModel() )
{ {
LockStudioHdr(); LockStudioHdr();

View File

@ -2280,8 +2280,8 @@ CBaseCombatWeapon *CBaseCombatCharacter::Weapon_GetWpnForAmmo( int iAmmoIndex )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool CBaseCombatCharacter::Weapon_CanUse( CBaseCombatWeapon *pWeapon ) bool CBaseCombatCharacter::Weapon_CanUse( CBaseCombatWeapon *pWeapon )
{ {
acttable_t *pTable = pWeapon->ActivityList(); int actCount = 0;
int actCount = pWeapon->ActivityListCount(); acttable_t *pTable = pWeapon->ActivityList( actCount );
if( actCount < 1 ) if( actCount < 1 )
{ {

View File

@ -86,6 +86,7 @@ bool CBaseEntity::sm_bDisableTouchFuncs = false; // Disables PhysicsTouch and Ph
bool CBaseEntity::sm_bAccurateTriggerBboxChecks = true; // set to false for legacy behavior in ep1 bool CBaseEntity::sm_bAccurateTriggerBboxChecks = true; // set to false for legacy behavior in ep1
int CBaseEntity::m_nPredictionRandomSeed = -1; int CBaseEntity::m_nPredictionRandomSeed = -1;
int CBaseEntity::m_nPredictionRandomSeedServer = -1;
CBasePlayer *CBaseEntity::m_pPredictionPlayer = NULL; CBasePlayer *CBaseEntity::m_pPredictionPlayer = NULL;
// Used to make sure nobody calls UpdateTransmitState directly. // Used to make sure nobody calls UpdateTransmitState directly.
@ -1440,10 +1441,10 @@ int CBaseEntity::OnTakeDamage( const CTakeDamageInfo &info )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Scale damage done and call OnTakeDamage // Purpose: Scale damage done and call OnTakeDamage
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo ) int CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
{ {
if ( !g_pGameRules ) if ( !g_pGameRules )
return; return 0;
bool bHasPhysicsForceDamage = !g_pGameRules->Damage_NoPhysicsForce( inputInfo.GetDamageType() ); bool bHasPhysicsForceDamage = !g_pGameRules->Damage_NoPhysicsForce( inputInfo.GetDamageType() );
if ( bHasPhysicsForceDamage && inputInfo.GetDamageType() != DMG_GENERIC ) if ( bHasPhysicsForceDamage && inputInfo.GetDamageType() != DMG_GENERIC )
@ -1475,12 +1476,12 @@ void CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
// Make sure our damage filter allows the damage. // Make sure our damage filter allows the damage.
if ( !PassesDamageFilter( inputInfo )) if ( !PassesDamageFilter( inputInfo ))
{ {
return; return 0;
} }
if( !g_pGameRules->AllowDamage(this, inputInfo) ) if( !g_pGameRules->AllowDamage(this, inputInfo) )
{ {
return; return 0;
} }
if ( PhysIsInCallback() ) if ( PhysIsInCallback() )
@ -1502,8 +1503,9 @@ void CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
//Msg("%s took %.2f Damage, at %.2f\n", GetClassname(), info.GetDamage(), gpGlobals->curtime ); //Msg("%s took %.2f Damage, at %.2f\n", GetClassname(), info.GetDamage(), gpGlobals->curtime );
OnTakeDamage( info ); return OnTakeDamage( info );
} }
return 0;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -6089,7 +6091,7 @@ void CBaseEntity::SetLocalAngles( const QAngle& angles )
{ {
Warning( "Bad SetLocalAngles(%f,%f,%f) on %s\n", angles.x, angles.y, angles.z, GetDebugName() ); Warning( "Bad SetLocalAngles(%f,%f,%f) on %s\n", angles.x, angles.y, angles.z, GetDebugName() );
} }
Assert( false ); AssertMsg( false, "Bad SetLocalAngles(%f,%f,%f) on %s\n", angles.x, angles.y, angles.z, GetDebugName() );
return; return;
} }

View File

@ -904,7 +904,7 @@ public:
virtual int OnTakeDamage( const CTakeDamageInfo &info ); virtual int OnTakeDamage( const CTakeDamageInfo &info );
// This is what you should call to apply damage to an entity. // This is what you should call to apply damage to an entity.
void TakeDamage( const CTakeDamageInfo &info ); int TakeDamage( const CTakeDamageInfo &info );
virtual void AdjustDamageDirection( const CTakeDamageInfo &info, Vector &dir, CBaseEntity *pEnt ) {} virtual void AdjustDamageDirection( const CTakeDamageInfo &info, Vector &dir, CBaseEntity *pEnt ) {}
virtual int TakeHealth( float flHealth, int bitsDamageType ); virtual int TakeHealth( float flHealth, int bitsDamageType );
@ -1748,6 +1748,7 @@ private:
// randon number generators to spit out the same random numbers on both sides for a particular // randon number generators to spit out the same random numbers on both sides for a particular
// usercmd input. // usercmd input.
static int m_nPredictionRandomSeed; static int m_nPredictionRandomSeed;
static int m_nPredictionRandomSeedServer;
static CBasePlayer *m_pPredictionPlayer; static CBasePlayer *m_pPredictionPlayer;
// FIXME: Make hierarchy a member of CBaseEntity // FIXME: Make hierarchy a member of CBaseEntity
@ -1761,7 +1762,7 @@ private:
public: public:
// Accessors for above // Accessors for above
static int GetPredictionRandomSeed( void ); static int GetPredictionRandomSeed( bool bUseUnSyncedServerPlatTime = false );
static void SetPredictionRandomSeed( const CUserCmd *cmd ); static void SetPredictionRandomSeed( const CUserCmd *cmd );
static CBasePlayer *GetPredictionPlayer( void ); static CBasePlayer *GetPredictionPlayer( void );
static void SetPredictionPlayer( CBasePlayer *player ); static void SetPredictionPlayer( CBasePlayer *player );
@ -1799,6 +1800,8 @@ public:
{ {
return s_bAbsQueriesValid; return s_bAbsQueriesValid;
} }
virtual bool ShouldBlockNav() const { return true; }
}; };
// Send tables exposed in this module. // Send tables exposed in this module.

View File

@ -113,7 +113,7 @@ CBaseFlex::CBaseFlex( void ) :
CBaseFlex::~CBaseFlex( void ) CBaseFlex::~CBaseFlex( void )
{ {
m_LocalToGlobal.RemoveAll(); m_LocalToGlobal.RemoveAll();
Assert( m_SceneEvents.Count() == 0 ); AssertMsg( m_SceneEvents.Count() == 0, "m_ScenesEvent.Count != 0: %d", m_SceneEvents.Count() );
} }
void CBaseFlex::SetModel( const char *szModelName ) void CBaseFlex::SetModel( const char *szModelName )
@ -508,7 +508,7 @@ bool CBaseFlex::HandleStartSequenceSceneEvent( CSceneEventInfo *info, CChoreoSce
float seq_duration = SequenceDuration( info->m_nSequence ); float seq_duration = SequenceDuration( info->m_nSequence );
float flCycle = dt / seq_duration; float flCycle = dt / seq_duration;
flCycle = flCycle - (int)flCycle; // loop flCycle = flCycle - (int)flCycle; // loop
SetLayerCycle( info->m_iLayer, flCycle, flCycle ); SetLayerCycle( info->m_iLayer, flCycle, flCycle, 0.f );
SetLayerPlaybackRate( info->m_iLayer, 0.0 ); SetLayerPlaybackRate( info->m_iLayer, 0.0 );
} }

View File

@ -57,6 +57,60 @@ extern bool IsInCommentaryMode( void );
ConVar *sv_cheats = NULL; ConVar *sv_cheats = NULL;
enum eAllowPointServerCommand {
eAllowNever,
eAllowOfficial,
eAllowAlways
};
#ifdef TF_DLL
// The default value here should match the default of the convar
eAllowPointServerCommand sAllowPointServerCommand = eAllowOfficial;
#else
eAllowPointServerCommand sAllowPointServerCommand = eAllowAlways;
#endif // TF_DLL
void sv_allow_point_servercommand_changed( IConVar *pConVar, const char *pOldString, float flOldValue )
{
ConVarRef var( pConVar );
if ( !var.IsValid() )
{
return;
}
const char *pNewValue = var.GetString();
if ( V_strcasecmp ( pNewValue, "always" ) == 0 )
{
sAllowPointServerCommand = eAllowAlways;
}
#ifdef TF_DLL
else if ( V_strcasecmp ( pNewValue, "official" ) == 0 )
{
sAllowPointServerCommand = eAllowOfficial;
}
#endif // TF_DLL
else
{
sAllowPointServerCommand = eAllowNever;
}
}
ConVar sv_allow_point_servercommand ( "sv_allow_point_servercommand",
#ifdef TF_DLL
// The default value here should match the default of the convar
"official",
#else
// Other games may use this in their official maps, and only TF exposes IsValveMap() currently
"always",
#endif // TF_DLL
FCVAR_NONE,
"Allow use of point_servercommand entities in map. Potentially dangerous for untrusted maps.\n"
" disallow : Always disallow\n"
#ifdef TF_DLL
" official : Allowed for valve maps only\n"
#endif // TF_DLL
" always : Allow for all maps", sv_allow_point_servercommand_changed );
void ClientKill( edict_t *pEdict, const Vector &vecForce, bool bExplode = false ) void ClientKill( edict_t *pEdict, const Vector &vecForce, bool bExplode = false )
{ {
CBasePlayer *pPlayer = static_cast<CBasePlayer*>( GetContainingEntity( pEdict ) ); CBasePlayer *pPlayer = static_cast<CBasePlayer*>( GetContainingEntity( pEdict ) );
@ -569,7 +623,22 @@ void CPointServerCommand::InputCommand( inputdata_t& inputdata )
if ( !inputdata.value.String()[0] ) if ( !inputdata.value.String()[0] )
return; return;
bool bAllowed = ( sAllowPointServerCommand == eAllowAlways );
#ifdef TF_DLL
if ( sAllowPointServerCommand == eAllowOfficial )
{
bAllowed = TFGameRules() && TFGameRules()->IsValveMap();
}
#endif // TF_DLL
if ( bAllowed )
{
engine->ServerCommand( UTIL_VarArgs( "%s\n", inputdata.value.String() ) ); engine->ServerCommand( UTIL_VarArgs( "%s\n", inputdata.value.String() ) );
}
else
{
Warning( "point_servercommand usage blocked by sv_allow_point_servercommand setting\n" );
}
} }
BEGIN_DATADESC( CPointServerCommand ) BEGIN_DATADESC( CPointServerCommand )

View File

@ -150,6 +150,8 @@ public:
bool ShouldLoopMoveSound( void ) { return m_bLoopMoveSound; } bool ShouldLoopMoveSound( void ) { return m_bLoopMoveSound; }
bool m_bLoopMoveSound; // Move sound loops until stopped bool m_bLoopMoveSound; // Move sound loops until stopped
virtual bool ShouldBlockNav() const OVERRIDE { return false; }
private: private:
void ChainUse( void ); ///< Chains +use on through to m_ChainTarget void ChainUse( void ); ///< Chains +use on through to m_ChainTarget
void ChainTouch( CBaseEntity *pOther ); ///< Chains touch on through to m_ChainTarget void ChainTouch( CBaseEntity *pOther ); ///< Chains touch on through to m_ChainTarget

View File

@ -215,7 +215,7 @@ public:
{ {
Ep2LevelStats_t::EntityDeathsLump_t data; Ep2LevelStats_t::EntityDeathsLump_t data;
char npcName[ 512 ]; char npcName[ 512 ];
LoadBuffer.GetString( npcName, sizeof( npcName ) ); LoadBuffer.GetString( npcName );
LoadBuffer.Get( &data, sizeof( data ) ); LoadBuffer.Get( &data, sizeof( data ) );
pItem->m_dictEntityDeaths.Insert( npcName, data ); pItem->m_dictEntityDeaths.Insert( npcName, data );
} }
@ -229,7 +229,7 @@ public:
{ {
Ep2LevelStats_t::WeaponLump_t data; Ep2LevelStats_t::WeaponLump_t data;
char weaponName[ 512 ]; char weaponName[ 512 ];
LoadBuffer.GetString( weaponName, sizeof( weaponName ) ); LoadBuffer.GetString( weaponName );
LoadBuffer.Get( &data, sizeof( data ) ); LoadBuffer.Get( &data, sizeof( data ) );
pItem->m_dictWeapons.Insert( weaponName, data ); pItem->m_dictWeapons.Insert( weaponName, data );
} }
@ -240,7 +240,7 @@ public:
Assert( pItem ); Assert( pItem );
Ep2LevelStats_t::SaveGameInfo_t *info = &pItem->m_SaveGameInfo; Ep2LevelStats_t::SaveGameInfo_t *info = &pItem->m_SaveGameInfo;
char sz[ 512 ]; char sz[ 512 ];
LoadBuffer.GetString( sz, sizeof( sz ) ); LoadBuffer.GetString( sz );
info->m_sCurrentSaveFile = sz; info->m_sCurrentSaveFile = sz;
info->m_nCurrentSaveFileTime = LoadBuffer.GetInt(); info->m_nCurrentSaveFileTime = LoadBuffer.GetInt();
int c = LoadBuffer.GetInt(); int c = LoadBuffer.GetInt();
@ -277,7 +277,7 @@ public:
{ {
Ep2LevelStats_t::GenericStatsLump_t data; Ep2LevelStats_t::GenericStatsLump_t data;
char pchStatName[ 512 ]; char pchStatName[ 512 ];
LoadBuffer.GetString( pchStatName, sizeof( pchStatName ) ); LoadBuffer.GetString( pchStatName );
LoadBuffer.Get( &data, sizeof( data ) ); LoadBuffer.Get( &data, sizeof( data ) );
pItem->m_dictGeneric.Insert( pchStatName, data ); pItem->m_dictGeneric.Insert( pchStatName, data );
} }

View File

@ -817,8 +817,6 @@ void CBreakable::VPhysicsCollision( int index, gamevcollisionevent_t *pEvent )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CBreakable::OnTakeDamage( const CTakeDamageInfo &info ) int CBreakable::OnTakeDamage( const CTakeDamageInfo &info )
{ {
Vector vecTemp;
CTakeDamageInfo subInfo = info; CTakeDamageInfo subInfo = info;
// If attacker can't do at least the min required damage to us, don't take any damage from them // If attacker can't do at least the min required damage to us, don't take any damage from them
@ -832,8 +830,6 @@ int CBreakable::OnTakeDamage( const CTakeDamageInfo &info )
return 1; return 1;
} }
vecTemp = subInfo.GetInflictor()->GetAbsOrigin() - WorldSpaceCenter();
if (!IsBreakable()) if (!IsBreakable())
return 0; return 0;

View File

@ -99,6 +99,7 @@
#include "tf_gamerules.h" #include "tf_gamerules.h"
#include "tf_lobby.h" #include "tf_lobby.h"
#include "player_vs_environment/tf_population_manager.h" #include "player_vs_environment/tf_population_manager.h"
#include "workshop/maps_workshop.h"
extern ConVar tf_mm_trusted; extern ConVar tf_mm_trusted;
extern ConVar tf_mm_servermode; extern ConVar tf_mm_servermode;
@ -559,11 +560,11 @@ void DrawAllDebugOverlays( void )
CServerGameDLL g_ServerGameDLL; CServerGameDLL g_ServerGameDLL;
// INTERFACEVERSION_SERVERGAMEDLL_VERSION_8 is compatible with the latest since we're only adding things to the end, so expose that as well. // INTERFACEVERSION_SERVERGAMEDLL_VERSION_8 is compatible with the latest since we're only adding things to the end, so expose that as well.
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameDLL, IServerGameDLL008, INTERFACEVERSION_SERVERGAMEDLL_VERSION_8, g_ServerGameDLL ); //EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameDLL, IServerGameDLL008, INTERFACEVERSION_SERVERGAMEDLL_VERSION_8, g_ServerGameDLL );
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameDLL, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL, g_ServerGameDLL); EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameDLL, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL, g_ServerGameDLL);
// When bumping the version to this interface, check that our assumption is still valid and expose the older version in the same way // When bumping the version to this interface, check that our assumption is still valid and expose the older version in the same way
COMPILE_TIME_ASSERT( INTERFACEVERSION_SERVERGAMEDLL_INT == 9 ); COMPILE_TIME_ASSERT( INTERFACEVERSION_SERVERGAMEDLL_INT == 10 );
bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory,
CreateInterfaceFn physicsFactory, CreateInterfaceFn fileSystemFactory, CreateInterfaceFn physicsFactory, CreateInterfaceFn fileSystemFactory,
@ -1081,9 +1082,7 @@ bool g_bCheckForChainedActivate;
{ \ { \
if ( bCheck ) \ if ( bCheck ) \
{ \ { \
char msg[ 1024 ]; \ AssertMsg( g_bReceivedChainedActivate, "Entity (%i/%s/%s) failed to call base class Activate()\n", pClass->entindex(), pClass->GetClassname(), STRING( pClass->GetEntityName() ) ); \
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 ); \
} \ } \
g_bCheckForChainedActivate = false; \ g_bCheckForChainedActivate = false; \
} }
@ -1100,7 +1099,7 @@ void CServerGameDLL::ServerActivate( edict_t *pEdictList, int edictCount, int cl
if ( gEntList.ResetDeleteList() != 0 ) if ( gEntList.ResetDeleteList() != 0 )
{ {
Msg( "ERROR: Entity delete queue not empty on level start!\n" ); Msg( "%s", "ERROR: Entity delete queue not empty on level start!\n" );
} }
for ( CBaseEntity *pClass = gEntList.FirstEnt(); pClass != NULL; pClass = gEntList.NextEnt(pClass) ) for ( CBaseEntity *pClass = gEntList.FirstEnt(); pClass != NULL; pClass = gEntList.NextEnt(pClass) )
@ -1150,6 +1149,7 @@ void CServerGameDLL::ServerActivate( edict_t *pEdictList, int edictCount, int cl
void CServerGameDLL::GameServerSteamAPIActivated( void ) void CServerGameDLL::GameServerSteamAPIActivated( void )
{ {
#ifndef NO_STEAM #ifndef NO_STEAM
steamgameserverapicontext->Clear();
steamgameserverapicontext->Init(); steamgameserverapicontext->Init();
if ( steamgameserverapicontext->SteamGameServer() && engine->IsDedicatedServer() ) if ( steamgameserverapicontext->SteamGameServer() && engine->IsDedicatedServer() )
{ {
@ -1160,6 +1160,7 @@ void CServerGameDLL::GameServerSteamAPIActivated( void )
#ifdef TF_DLL #ifdef TF_DLL
GCClientSystem()->GameServerActivate(); GCClientSystem()->GameServerActivate();
InventoryManager()->GameServerSteamAPIActivated(); InventoryManager()->GameServerSteamAPIActivated();
TFMapsWorkshop()->GameServerSteamAPIActivated();
#endif #endif
} }
@ -1936,6 +1937,52 @@ void CServerGameDLL::Status( void (*print) (const char *fmt, ...) )
} }
} }
//-----------------------------------------------------------------------------
void CServerGameDLL::PrepareLevelResources( /* in/out */ char *pszMapName, size_t nMapNameSize,
/* in/out */ char *pszMapFile, size_t nMapFileSize )
{
#ifdef TF_DLL
TFMapsWorkshop()->PrepareLevelResources( pszMapName, nMapNameSize, pszMapFile, nMapFileSize );
#endif // TF_DLL
}
//-----------------------------------------------------------------------------
IServerGameDLL::ePrepareLevelResourcesResult
CServerGameDLL::AsyncPrepareLevelResources( /* in/out */ char *pszMapName, size_t nMapNameSize,
/* in/out */ char *pszMapFile, size_t nMapFileSize,
float *flProgress /* = NULL */ )
{
#ifdef TF_DLL
return TFMapsWorkshop()->AsyncPrepareLevelResources( pszMapName, nMapNameSize, pszMapFile, nMapFileSize, flProgress );
#endif // TF_DLL
if ( flProgress )
{
*flProgress = 1.f;
}
return IServerGameDLL::ePrepareLevelResources_Prepared;
}
//-----------------------------------------------------------------------------
IServerGameDLL::eCanProvideLevelResult CServerGameDLL::CanProvideLevel( /* in/out */ char *pMapName, int nMapNameMax )
{
#ifdef TF_DLL
return TFMapsWorkshop()->OnCanProvideLevel( pMapName, nMapNameMax );
#endif // TF_DLL
return IServerGameDLL::eCanProvideLevel_CannotProvide;
}
//-----------------------------------------------------------------------------
bool CServerGameDLL::IsManualMapChangeOkay( const char **pszReason )
{
if ( GameRules() )
{
return GameRules()->IsManualMapChangeOkay( pszReason );
}
return true;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Called during a transition, to build a map adjacency list // Purpose: Called during a transition, to build a map adjacency list
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -2648,7 +2695,7 @@ void CServerGameClients::ClientActive( edict_t *pEdict, bool bLoadGame )
#if defined( TF_DLL ) #if defined( TF_DLL )
Assert( pPlayer ); Assert( pPlayer );
if ( pPlayer && !pPlayer->IsFakeClient() ) if ( pPlayer && !pPlayer->IsFakeClient() && !pPlayer->IsHLTV() && !pPlayer->IsReplay() )
{ {
CSteamID steamID; CSteamID steamID;
if ( pPlayer->GetSteamID( &steamID ) ) if ( pPlayer->GetSteamID( &steamID ) )
@ -2656,10 +2703,13 @@ void CServerGameClients::ClientActive( edict_t *pEdict, bool bLoadGame )
GTFGCClientSystem()->ClientActive( steamID ); GTFGCClientSystem()->ClientActive( steamID );
} }
else else
{
if ( !pPlayer->IsReplay() && !pPlayer->IsHLTV() )
{ {
Log("WARNING: ClientActive, but we don't know his SteamID?\n"); Log("WARNING: ClientActive, but we don't know his SteamID?\n");
} }
} }
}
#endif #endif
} }
@ -2730,10 +2780,13 @@ void CServerGameClients::ClientDisconnect( edict_t *pEdict )
GTFGCClientSystem()->ClientDisconnected( steamID ); GTFGCClientSystem()->ClientDisconnected( steamID );
} }
else else
{
if ( !player->IsReplay() && !player->IsHLTV() )
{ {
Log("WARNING: ClientDisconnected, but we don't know his SteamID?\n"); Log("WARNING: ClientDisconnected, but we don't know his SteamID?\n");
} }
} }
}
#endif #endif
} }
} }

View File

@ -139,7 +139,19 @@ public:
virtual const char *GetServerBrowserGameData() OVERRIDE; virtual const char *GetServerBrowserGameData() OVERRIDE;
// Called to add output to the status command // Called to add output to the status command
virtual void Status( void (*print) (const char *fmt, ...) ); virtual void Status( void (*print) (const char *fmt, ...) ) OVERRIDE;
virtual void PrepareLevelResources( /* in/out */ char *pszMapName, size_t nMapNameSize,
/* in/out */ char *pszMapFile, size_t nMapFileSize ) OVERRIDE;
virtual ePrepareLevelResourcesResult AsyncPrepareLevelResources( /* in/out */ char *pszMapName, size_t nMapNameSize,
/* in/out */ char *pszMapFile, size_t nMapFileSize,
float *flProgress = NULL ) OVERRIDE;
virtual eCanProvideLevelResult CanProvideLevel( /* in/out */ char *pMapName, int nMapNameMax ) OVERRIDE;
// Called to see if the game server is okay with a manual changelevel or map command
virtual bool IsManualMapChangeOkay( const char **pszReason ) OVERRIDE;
private: private:

View File

@ -82,9 +82,10 @@ public:
DECLARE_DATADESC(); DECLARE_DATADESC();
protected: protected:
virtual void ComeToRest( void ); virtual void ComeToRest( void );
bool m_bActivateWhenAtRest;
private: private:
bool m_bActivateWhenAtRest;
COutputEvent m_OnPlayerTouch; COutputEvent m_OnPlayerTouch;
COutputEvent m_OnCacheInteraction; COutputEvent m_OnCacheInteraction;

View File

@ -3707,7 +3707,7 @@ static Vector FindPositionInArea( CNavArea *area, NavCornerType corner )
pos = cornerPos + Vector( area->GetSizeX()*0.5f*multX, area->GetSizeY()*0.5f*multY, 0.0f ); pos = cornerPos + Vector( area->GetSizeX()*0.5f*multX, area->GetSizeY()*0.5f*multY, 0.0f );
if ( !area->IsOverlapping( pos ) ) if ( !area->IsOverlapping( pos ) )
{ {
AssertMsg( false, UTIL_VarArgs( "A Hiding Spot can't be placed on its area at (%.0f %.0f %.0f)", cornerPos.x, cornerPos.y, cornerPos.z) ); AssertMsg( false, "A Hiding Spot can't be placed on its area at (%.0f %.0f %.0f)", cornerPos.x, cornerPos.y, cornerPos.z );
// Just pull the position to a small offset // Just pull the position to a small offset
pos = cornerPos + Vector( 1.0f*multX, 1.0f*multY, 0.0f ); pos = cornerPos + Vector( 1.0f*multX, 1.0f*multY, 0.0f );
@ -4285,6 +4285,9 @@ bool CNavArea::ComputeLighting( void )
//-------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------
CON_COMMAND_F( nav_update_lighting, "Recomputes lighting values", FCVAR_CHEAT ) CON_COMMAND_F( nav_update_lighting, "Recomputes lighting values", FCVAR_CHEAT )
{ {
if ( !UTIL_IsCommandIssuedByServerAdmin() )
return;
int numComputed = 0; int numComputed = 0;
if ( args.ArgC() == 2 ) if ( args.ArgC() == 2 )
{ {

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