mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-27 06:07:56 +03:00
Updated the SDK with the latest code from the TF and HL2 branches.
This commit is contained in:
parent
56accfdb9c
commit
55ed12f8d1
11
.gitignore
vendored
11
.gitignore
vendored
@ -18,20 +18,15 @@ ipch
|
|||||||
*.opensdf
|
*.opensdf
|
||||||
*.idb
|
*.idb
|
||||||
*.vcxproj
|
*.vcxproj
|
||||||
*.vcxproj.filters
|
|
||||||
*.sln
|
*.sln
|
||||||
[Dd]ebug*/
|
|
||||||
[Rr]elease*/
|
|
||||||
|
|
||||||
# OSX/Linux build products
|
# OSX/Linux build products
|
||||||
*.DS_Store
|
|
||||||
*.mak
|
*.mak
|
||||||
*.mak.vpc_crc
|
*.mak.vpc_crc
|
||||||
*.xcodeproj/
|
*.xcodeproj/
|
||||||
obj*/
|
obj*/
|
||||||
!devtools/*.mak
|
!devtools/*.mak
|
||||||
!utils/smdlexp/smdlexp.mak
|
!utils/smdlexp/smdlexp.mak
|
||||||
*_osx32*
|
|
||||||
|
|
||||||
# Specific Source build products
|
# Specific Source build products
|
||||||
client.pdb
|
client.pdb
|
||||||
@ -53,12 +48,6 @@ client.dylib.dSYM/
|
|||||||
server.dylib
|
server.dylib
|
||||||
server.dylib.dSYM/
|
server.dylib.dSYM/
|
||||||
|
|
||||||
*.vpc.sentinel
|
|
||||||
*.vpc_crc
|
|
||||||
**/generated_proto/**
|
|
||||||
**/src/utils/sapi51/**
|
|
||||||
**/game/**/bin/**
|
|
||||||
|
|
||||||
# files generated by running a mod
|
# files generated by running a mod
|
||||||
config.cfg
|
config.cfg
|
||||||
|
|
||||||
|
@ -11,8 +11,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "strtools.h"
|
||||||
|
#include "steam/steamclientpublic.h"
|
||||||
#if !defined( INCLUDED_STEAM_STEAMUSERIDTYPES_H )
|
#if !defined( INCLUDED_STEAM_STEAMUSERIDTYPES_H )
|
||||||
#include "SteamCommon.h"
|
#define INCLUDED_STEAM2_USERID_STRUCTS
|
||||||
|
#include "SteamCommon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IDTYPE_WON 0
|
#define IDTYPE_WON 0
|
||||||
@ -23,13 +26,7 @@
|
|||||||
typedef struct USERID_s
|
typedef struct USERID_s
|
||||||
{
|
{
|
||||||
int idtype;
|
int idtype;
|
||||||
|
CSteamID steamid;
|
||||||
union
|
|
||||||
{
|
|
||||||
TSteamGlobalUserID steamid;
|
|
||||||
} uid;
|
|
||||||
|
|
||||||
// unsigned int clientip;
|
|
||||||
} USERID_t;
|
} USERID_t;
|
||||||
|
|
||||||
#endif // USERID_H
|
#endif // USERID_H
|
||||||
|
@ -1,3 +1 @@
|
|||||||
pushd %~dp0
|
|
||||||
devtools\bin\vpc.exe /hl2mp +everything /mksln everything.sln
|
devtools\bin\vpc.exe /hl2mp +everything /mksln everything.sln
|
||||||
popd
|
|
||||||
|
@ -1,3 +1 @@
|
|||||||
pushd %~dp0
|
|
||||||
devtools\bin\vpc.exe /hl2mp +game /mksln games.sln
|
devtools\bin\vpc.exe /hl2mp +game /mksln games.sln
|
||||||
popd
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -22,13 +22,22 @@ HOSTNAME := $(shell hostname)
|
|||||||
# To build with clang, set the following in your environment:
|
# To build with clang, set the following in your environment:
|
||||||
# CC = clang
|
# CC = clang
|
||||||
# CXX = clang++
|
# CXX = clang++
|
||||||
|
ifneq (,$(findstring clang,$(CXX)))
|
||||||
|
CLANG_BUILD = 1
|
||||||
|
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.
|
||||||
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
|
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
|
||||||
# -fno-omit-frame-pointer: need this for stack traces with perf.
|
# -fno-omit-frame-pointer: need this for stack traces with perf.
|
||||||
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
|
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize
|
||||||
|
ifeq ($(CLANG_BUILD),1)
|
||||||
|
# These aren't supported wit Clang 3.5. Need to remove when we update that.
|
||||||
|
OptimizerLevel_CompilerSpecific += -fpredictive-commoning -funswitch-loops
|
||||||
|
else
|
||||||
|
OptimizerLevel_CompilerSpecific += -fpredictive-commoning -funswitch-loops
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
OptimizerLevel_CompilerSpecific = -O0
|
OptimizerLevel_CompilerSpecific = -O0
|
||||||
#-O1 -finline-functions
|
#-O1 -finline-functions
|
||||||
@ -41,14 +50,14 @@ CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
|
|||||||
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
|
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
|
||||||
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive
|
# 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 ($(CXX),clang++)
|
ifeq ($(CLANG_BUILD),1)
|
||||||
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
|
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
|
||||||
else
|
else
|
||||||
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive
|
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive
|
||||||
endif
|
endif
|
||||||
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
|
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
|
||||||
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
|
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
|
||||||
GENDEP_CXXFLAGS = -MD -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
|
||||||
@ -57,11 +66,30 @@ COPY_DLL_TO_SRV = 0
|
|||||||
ifeq ($(STEAM_BRANCH),1)
|
ifeq ($(STEAM_BRANCH),1)
|
||||||
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
|
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
|
||||||
else
|
else
|
||||||
WARN_FLAGS = -Wno-write-strings -Wno-multichar
|
WARN_FLAGS = -Wall -Wno-invalid-offsetof -Wno-multichar -Wno-overloaded-virtual
|
||||||
|
WARN_FLAGS += -Wno-write-strings
|
||||||
|
WARN_FLAGS += -Wno-unused-variable
|
||||||
|
WARN_FLAGS += -Wno-unused-but-set-variable
|
||||||
|
WARN_FLAGS += -Wno-unused-function
|
||||||
|
|
||||||
|
ifeq ($(CLANG_BUILD),1)
|
||||||
|
# Clang specific flags
|
||||||
|
else
|
||||||
|
# Gcc specific flags. Need this for gcc 4.8.
|
||||||
|
# WARN_FLAGS += -Wno-unused-local-typedefs
|
||||||
|
# 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 -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -fdiagnostics-show-option -Wformat -Wformat-security
|
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 += -fdiagnostics-show-option -Wformat -Wformat-security
|
||||||
|
|
||||||
|
ifeq ($(OS),Darwin)
|
||||||
|
$(error This file should never be used for Mac - use base.xconfig)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Linux)
|
ifeq ($(OS),Linux)
|
||||||
# We should always specify -Wl,--build-id, as documented at:
|
# We should always specify -Wl,--build-id, as documented at:
|
||||||
@ -85,12 +113,9 @@ ifeq ($(OS),Linux)
|
|||||||
# If the steam-runtime is available, use it. We should just default to using it when
|
# 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.
|
# buildbot and everyone has a bit of time to get it installed.
|
||||||
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
|
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
|
||||||
# The steam-runtime is incompatible with clang at this point, so disable it
|
VALVE_BINDIR = /valve/steam-runtime/bin/
|
||||||
# if clang is enabled.
|
|
||||||
ifneq ($(CXX),clang++)
|
|
||||||
VALVE_BINDIR = /valve/steam-runtime/bin/
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GCC_VER =
|
GCC_VER =
|
||||||
MARCH_TARGET = pentium4
|
MARCH_TARGET = pentium4
|
||||||
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
|
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
|
||||||
@ -98,7 +123,10 @@ ifeq ($(OS),Linux)
|
|||||||
STRIP_FLAGS = -x
|
STRIP_FLAGS = -x
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CXX),clang++)
|
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
|
# Clang does not support -mfpmath=sse because it uses whatever
|
||||||
# instruction set extensions are available by default.
|
# instruction set extensions are available by default.
|
||||||
SSE_GEN_FLAGS = -msse2
|
SSE_GEN_FLAGS = -msse2
|
||||||
@ -114,19 +142,18 @@ ifeq ($(OS),Linux)
|
|||||||
ifeq ($(origin AR), default)
|
ifeq ($(origin AR), default)
|
||||||
AR = $(VALVE_BINDIR)ar crs
|
AR = $(VALVE_BINDIR)ar crs
|
||||||
endif
|
endif
|
||||||
ifeq ($(origin CC),default)
|
ifeq ($(origin CC), default)
|
||||||
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
|
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
|
||||||
endif
|
endif
|
||||||
ifeq ($(origin CXX), default)
|
ifeq ($(origin CXX), default)
|
||||||
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
|
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
|
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
|
||||||
# a ccache quirk. Could also upgrade ccache.
|
# a ccache quirk. Could also upgrade ccache.
|
||||||
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
|
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
|
||||||
ifeq ($(CC),clang)
|
ifeq ($(CLANG_BUILD),1)
|
||||||
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
|
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
|
||||||
endif
|
|
||||||
ifeq ($(CXX),clang++)
|
|
||||||
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
|
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
|
||||||
endif
|
endif
|
||||||
LINK ?= $(CC)
|
LINK ?= $(CC)
|
||||||
@ -180,84 +207,6 @@ ifeq ($(OS),Linux)
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Darwin)
|
|
||||||
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
|
|
||||||
MAC_SDK_VER ?= 10.6
|
|
||||||
MAC_SDK := macosx$(MAC_SDK_VER)
|
|
||||||
SYSROOT := $(shell xcodebuild -sdk $(MAC_SDK) -version Path)
|
|
||||||
|
|
||||||
ifneq ($(origin MAC_SDK_VER), file)
|
|
||||||
$(warning Attempting build with SDK version $(MAC_SDK_VER), only 10.6 is supported and recommended!)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(SYSROOT),)
|
|
||||||
FIRSTSDK := $(firstword $(sort $(shell xcodebuild -showsdks | grep macosx | sed 's/.*macosx//')))
|
|
||||||
$(error Could not find SDK version $(MAC_SDK_VER). Install and configure Xcode 4.3, or build with: make MAC_SDK_VER=$(FIRSTSDK))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(origin CC), default)
|
|
||||||
# Test to see if you have a compiler in the right place, if you
|
|
||||||
# don't abort with an error
|
|
||||||
CLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang)
|
|
||||||
ifeq ($(wildcard $(CLANG)),)
|
|
||||||
$(error Unable to find C compiler, install and configure Xcode 4.3)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CC := $(CCACHE) $(CLANG) -Qunused-arguments
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(origin CXX), default)
|
|
||||||
CXXLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang++)
|
|
||||||
ifeq ($(wildcard $(CXXLANG)),)
|
|
||||||
$(error Unable to find C++ compiler, install and configure Xcode 4.3)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CXX := $(CCACHE) $(CXXLANG) -Qunused-arguments
|
|
||||||
endif
|
|
||||||
LINK ?= $(CXX)
|
|
||||||
|
|
||||||
ifeq ($(origin AR), default)
|
|
||||||
AR := $(shell xcrun -sdk $(MAC_SDK) -find libtool) -static -o
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(TARGET_PLATFORM),osx64)
|
|
||||||
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
|
|
||||||
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
|
|
||||||
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
|
|
||||||
else
|
|
||||||
# dirty hack to build a universal binary - don't specify the architecture
|
|
||||||
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
|
|
||||||
endif
|
|
||||||
|
|
||||||
GEN_SYM ?= $(shell xcrun -sdk $(MAC_SDK) -find dsymutil)
|
|
||||||
ifeq ($(CFG),release)
|
|
||||||
STRIP ?= strip -S
|
|
||||||
else
|
|
||||||
STRIP ?= true
|
|
||||||
endif
|
|
||||||
ifeq ($(SOURCE_SDK), 1)
|
|
||||||
VSIGN ?= true
|
|
||||||
else
|
|
||||||
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
|
|
||||||
endif
|
|
||||||
|
|
||||||
CPPFLAGS += -I$(SYSROOT)/usr/include/malloc
|
|
||||||
CFLAGS += -isysroot $(SYSROOT) -mmacosx-version-min=10.5 -fasm-blocks
|
|
||||||
|
|
||||||
LIB_START_EXE = -lm -ldl -lpthread
|
|
||||||
LIB_END_EXE =
|
|
||||||
|
|
||||||
LIB_START_SHLIB =
|
|
||||||
LIB_END_SHLIB =
|
|
||||||
|
|
||||||
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
|
||||||
|
|
||||||
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
|
|
||||||
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Profile-directed optimizations.
|
# Profile-directed optimizations.
|
||||||
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
|
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -3531,7 +3531,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer
|
|||||||
p = nexttoken( token, p, ' ' );
|
p = nexttoken( token, p, ' ' );
|
||||||
|
|
||||||
// Find the weapon type
|
// Find the weapon type
|
||||||
if ( token )
|
if ( token[0] )
|
||||||
{
|
{
|
||||||
//TODO: Parse the type from a list instead
|
//TODO: Parse the type from a list instead
|
||||||
if ( Q_stricmp( token, "COMBINE" ) == 0 )
|
if ( Q_stricmp( token, "COMBINE" ) == 0 )
|
||||||
@ -3577,7 +3577,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer
|
|||||||
int attachmentIndex = -1;
|
int attachmentIndex = -1;
|
||||||
|
|
||||||
// Find the attachment name
|
// Find the attachment name
|
||||||
if ( token )
|
if ( token[0] )
|
||||||
{
|
{
|
||||||
attachmentIndex = LookupAttachment( token );
|
attachmentIndex = LookupAttachment( token );
|
||||||
|
|
||||||
@ -3684,29 +3684,25 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
// Get the particle effect name
|
// Get the particle effect name
|
||||||
const char *p = options;
|
const char *p = options;
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ');
|
||||||
if ( token )
|
|
||||||
{
|
const char* mtoken = ModifyEventParticles( token );
|
||||||
const char* mtoken = ModifyEventParticles( token );
|
if ( !mtoken || mtoken[0] == '\0' )
|
||||||
if ( !mtoken || mtoken[0] == '\0' )
|
return;
|
||||||
return;
|
Q_strncpy( szParticleEffect, mtoken, sizeof(szParticleEffect) );
|
||||||
Q_strncpy( szParticleEffect, mtoken, sizeof(szParticleEffect) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the attachment type
|
// Get the attachment type
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ');
|
||||||
if ( token )
|
|
||||||
|
iAttachType = GetAttachTypeFromString( token );
|
||||||
|
if ( iAttachType == -1 )
|
||||||
{
|
{
|
||||||
iAttachType = GetAttachTypeFromString( token );
|
Warning("Invalid attach type specified for particle effect anim event. Trying to spawn effect '%s' with attach type of '%s'\n", szParticleEffect, token );
|
||||||
if ( iAttachType == -1 )
|
return;
|
||||||
{
|
|
||||||
Warning("Invalid attach type specified for particle effect anim event. Trying to spawn effect '%s' with attach type of '%s'\n", szParticleEffect, token );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the attachment point index
|
// Get the attachment point index
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ');
|
||||||
if ( token )
|
if ( token[0] )
|
||||||
{
|
{
|
||||||
iAttachment = atoi(token);
|
iAttachment = atoi(token);
|
||||||
|
|
||||||
@ -3902,26 +3898,19 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
|
|
||||||
case AE_CL_BODYGROUP_SET_VALUE:
|
case AE_CL_BODYGROUP_SET_VALUE:
|
||||||
{
|
{
|
||||||
char szBodygroupName[256];
|
int value;
|
||||||
int value = 0;
|
|
||||||
|
|
||||||
char token[256];
|
char token[256];
|
||||||
|
char szBodygroupName[256];
|
||||||
|
|
||||||
const char *p = options;
|
const char *p = options;
|
||||||
|
|
||||||
// Bodygroup Name
|
// Bodygroup Name
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ');
|
||||||
if ( token )
|
Q_strncpy( szBodygroupName, token, sizeof(szBodygroupName) );
|
||||||
{
|
|
||||||
Q_strncpy( szBodygroupName, token, sizeof(szBodygroupName) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the desired value
|
// Get the desired value
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ');
|
||||||
if ( token )
|
value = token[0] ? atoi( token ) : 0;
|
||||||
{
|
|
||||||
value = atoi( token );
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = FindBodygroupByName( szBodygroupName );
|
int index = FindBodygroupByName( szBodygroupName );
|
||||||
if ( index >= 0 )
|
if ( index >= 0 )
|
||||||
@ -3950,33 +3939,21 @@ void C_BaseAnimating::FireObsoleteEvent( const Vector& origin, const QAngle& ang
|
|||||||
// Obsolete. Use the AE_CL_CREATE_PARTICLE_EFFECT event instead, which uses the artist driven particle system & editor.
|
// Obsolete. Use the AE_CL_CREATE_PARTICLE_EFFECT event instead, which uses the artist driven particle system & editor.
|
||||||
case AE_CLIENT_EFFECT_ATTACH:
|
case AE_CLIENT_EFFECT_ATTACH:
|
||||||
{
|
{
|
||||||
int iAttachment = -1;
|
int iAttachment;
|
||||||
int iParam = 0;
|
int iParam;
|
||||||
char token[128];
|
char token[128];
|
||||||
char effectFunc[128];
|
char effectFunc[128];
|
||||||
|
|
||||||
const char *p = options;
|
const char *p = options;
|
||||||
|
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ');
|
||||||
|
Q_strncpy( effectFunc, token, sizeof(effectFunc) );
|
||||||
if( token )
|
|
||||||
{
|
|
||||||
Q_strncpy( effectFunc, token, sizeof(effectFunc) );
|
|
||||||
}
|
|
||||||
|
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ');
|
||||||
|
iAttachment = token[0] ? atoi(token) : -1;
|
||||||
if( token )
|
|
||||||
{
|
|
||||||
iAttachment = atoi(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ');
|
||||||
|
iParam = token[0] ? atoi(token) : 0;
|
||||||
if( token )
|
|
||||||
{
|
|
||||||
iParam = atoi(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( iAttachment != -1 && m_Attachments.Count() >= iAttachment )
|
if ( iAttachment != -1 && m_Attachments.Count() >= iAttachment )
|
||||||
{
|
{
|
||||||
@ -5281,8 +5258,9 @@ float C_BaseAnimating::FrameAdvance( float flInterval )
|
|||||||
// Stubs for weapon prediction
|
// Stubs for weapon prediction
|
||||||
void C_BaseAnimating::ResetSequenceInfo( void )
|
void C_BaseAnimating::ResetSequenceInfo( void )
|
||||||
{
|
{
|
||||||
if (GetSequence() == -1)
|
if ( GetSequence() == -1 )
|
||||||
{
|
{
|
||||||
|
// This shouldn't happen. Setting m_nSequence blindly is a horrible coding practice.
|
||||||
SetSequence( 0 );
|
SetSequence( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5294,7 +5272,7 @@ void C_BaseAnimating::ResetSequenceInfo( void )
|
|||||||
|
|
||||||
CStudioHdr *pStudioHdr = GetModelPtr();
|
CStudioHdr *pStudioHdr = GetModelPtr();
|
||||||
m_flGroundSpeed = GetSequenceGroundSpeed( pStudioHdr, GetSequence() ) * GetModelScale();
|
m_flGroundSpeed = GetSequenceGroundSpeed( pStudioHdr, GetSequence() ) * GetModelScale();
|
||||||
m_bSequenceLoops = ((GetSequenceFlags( pStudioHdr, GetSequence() ) & STUDIO_LOOPING) != 0);
|
m_bSequenceLoops = ( ( GetSequenceFlags( pStudioHdr, GetSequence() ) & STUDIO_LOOPING ) != 0 );
|
||||||
// m_flAnimTime = gpGlobals->time;
|
// m_flAnimTime = gpGlobals->time;
|
||||||
m_flPlaybackRate = 1.0;
|
m_flPlaybackRate = 1.0;
|
||||||
m_bSequenceFinished = false;
|
m_bSequenceFinished = false;
|
||||||
@ -5302,9 +5280,12 @@ void C_BaseAnimating::ResetSequenceInfo( void )
|
|||||||
|
|
||||||
m_nNewSequenceParity = ( m_nNewSequenceParity + 1 ) & EF_PARITY_MASK;
|
m_nNewSequenceParity = ( m_nNewSequenceParity + 1 ) & EF_PARITY_MASK;
|
||||||
m_nResetEventsParity = ( m_nResetEventsParity + 1 ) & EF_PARITY_MASK;
|
m_nResetEventsParity = ( m_nResetEventsParity + 1 ) & EF_PARITY_MASK;
|
||||||
|
|
||||||
// FIXME: why is this called here? Nothing should have changed to make this nessesary
|
// FIXME: why is this called here? Nothing should have changed to make this nessesary
|
||||||
SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) );
|
if ( pStudioHdr )
|
||||||
|
{
|
||||||
|
SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
@ -571,7 +571,8 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar )
|
|||||||
{
|
{
|
||||||
Msg( "--------------------------------------------------\n" );
|
Msg( "--------------------------------------------------\n" );
|
||||||
int i = pVar->GetHead();
|
int i = pVar->GetHead();
|
||||||
CApparentVelocity<Vector> apparent;
|
Vector v0(0, 0, 0);
|
||||||
|
CApparentVelocity<Vector> apparent(v0);
|
||||||
float prevtime = 0.0f;
|
float prevtime = 0.0f;
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
@ -594,7 +595,8 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f
|
|||||||
|
|
||||||
Msg( "--------------------------------------------------\n" );
|
Msg( "--------------------------------------------------\n" );
|
||||||
int i = pVar->GetHead();
|
int i = pVar->GetHead();
|
||||||
CApparentVelocity<Vector> apparent;
|
Vector v0(0, 0, 0);
|
||||||
|
CApparentVelocity<Vector> apparent(v0);
|
||||||
float newtime = 999999.0f;
|
float newtime = 999999.0f;
|
||||||
Vector newVec( 0, 0, 0 );
|
Vector newVec( 0, 0, 0 );
|
||||||
bool bSpew = true;
|
bool bSpew = true;
|
||||||
@ -662,7 +664,7 @@ void SpewInterpolatedVar( CInterpolatedVar< float > *pVar )
|
|||||||
{
|
{
|
||||||
Msg( "--------------------------------------------------\n" );
|
Msg( "--------------------------------------------------\n" );
|
||||||
int i = pVar->GetHead();
|
int i = pVar->GetHead();
|
||||||
CApparentVelocity<float> apparent;
|
CApparentVelocity<float> apparent(0.0f);
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
float changetime;
|
float changetime;
|
||||||
@ -684,7 +686,8 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar<T> *pVar, float &flMin, float
|
|||||||
flMax = -1e23;
|
flMax = -1e23;
|
||||||
|
|
||||||
int i = pVar->GetHead();
|
int i = pVar->GetHead();
|
||||||
CApparentVelocity<Vector> apparent;
|
Vector v0(0, 0, 0);
|
||||||
|
CApparentVelocity<Vector> apparent(v0);
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
float changetime;
|
float changetime;
|
||||||
@ -892,6 +895,8 @@ C_BaseEntity::C_BaseEntity() :
|
|||||||
m_iv_angRotation( "C_BaseEntity::m_iv_angRotation" ),
|
m_iv_angRotation( "C_BaseEntity::m_iv_angRotation" ),
|
||||||
m_iv_vecVelocity( "C_BaseEntity::m_iv_vecVelocity" )
|
m_iv_vecVelocity( "C_BaseEntity::m_iv_vecVelocity" )
|
||||||
{
|
{
|
||||||
|
m_pAttributes = NULL;
|
||||||
|
|
||||||
AddVar( &m_vecOrigin, &m_iv_vecOrigin, LATCH_SIMULATION_VAR );
|
AddVar( &m_vecOrigin, &m_iv_vecOrigin, LATCH_SIMULATION_VAR );
|
||||||
AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR );
|
AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR );
|
||||||
// Removing this until we figure out why velocity introduces view hitching.
|
// Removing this until we figure out why velocity introduces view hitching.
|
||||||
@ -1299,19 +1304,6 @@ bool C_BaseEntity::VPhysicsIsFlesh( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Returns the health fraction
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
float C_BaseEntity::HealthFraction() const
|
|
||||||
{
|
|
||||||
if (GetMaxHealth() == 0)
|
|
||||||
return 1.0f;
|
|
||||||
|
|
||||||
float flFraction = (float)GetHealth() / (float)GetMaxHealth();
|
|
||||||
flFraction = clamp( flFraction, 0.0f, 1.0f );
|
|
||||||
return flFraction;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Retrieves the coordinate frame for this entity.
|
// Purpose: Retrieves the coordinate frame for this entity.
|
||||||
@ -2624,6 +2616,25 @@ void C_BaseEntity::PostDataUpdate( DataUpdateType_t updateType )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Latch simulation values when the entity has not changed
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
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() );
|
||||||
|
HierarchySetParent(m_hNetworkMoveParent);
|
||||||
|
|
||||||
|
MarkMessageReceived();
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Input : *context -
|
// Input : *context -
|
||||||
@ -3741,7 +3752,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd
|
|||||||
|
|
||||||
case mod_brush:
|
case mod_brush:
|
||||||
{
|
{
|
||||||
color32 cColor32 = { cColor.r(), cColor.g(), cColor.b(), cColor.a() };
|
color32 cColor32 = { (byte)cColor.r(), (byte)cColor.g(), (byte)cColor.b(), (byte)cColor.a() };
|
||||||
effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
|
effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -6309,6 +6320,9 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
|
|||||||
|
|
||||||
if ( FStrEq( pszModel, "models/props_lakeside_event/bomb_temp_hat.mdl" ) )
|
if ( FStrEq( pszModel, "models/props_lakeside_event/bomb_temp_hat.mdl" ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if ( FStrEq( pszModel, "models/props_moonbase/powersupply_flag.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.
|
||||||
|
@ -58,6 +58,7 @@ class C_BaseCombatCharacter;
|
|||||||
class CEntityMapData;
|
class CEntityMapData;
|
||||||
class ConVar;
|
class ConVar;
|
||||||
class CDmgAccumulator;
|
class CDmgAccumulator;
|
||||||
|
class IHasAttributes;
|
||||||
|
|
||||||
struct CSoundParameters;
|
struct CSoundParameters;
|
||||||
|
|
||||||
@ -335,6 +336,7 @@ public:
|
|||||||
// save out interpolated values
|
// save out interpolated values
|
||||||
virtual void PreDataUpdate( DataUpdateType_t updateType );
|
virtual void PreDataUpdate( DataUpdateType_t updateType );
|
||||||
virtual void PostDataUpdate( DataUpdateType_t updateType );
|
virtual void PostDataUpdate( DataUpdateType_t updateType );
|
||||||
|
virtual void OnDataUnchangedInPVS();
|
||||||
|
|
||||||
virtual void ValidateModelIndex( void );
|
virtual void ValidateModelIndex( void );
|
||||||
|
|
||||||
@ -516,6 +518,7 @@ public:
|
|||||||
|
|
||||||
// Used when the collision prop is told to ask game code for the world-space surrounding box
|
// Used when the collision prop is told to ask game code for the world-space surrounding box
|
||||||
virtual void ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs );
|
virtual void ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs );
|
||||||
|
virtual float GetHealthBarHeightOffset() const { return 0.f; }
|
||||||
|
|
||||||
// Returns the entity-to-world transform
|
// Returns the entity-to-world transform
|
||||||
matrix3x4_t &EntityToWorldTransform();
|
matrix3x4_t &EntityToWorldTransform();
|
||||||
@ -686,7 +689,7 @@ public:
|
|||||||
|
|
||||||
virtual bool ShouldDraw();
|
virtual bool ShouldDraw();
|
||||||
inline bool IsVisible() const { return m_hRender != INVALID_CLIENT_RENDER_HANDLE; }
|
inline bool IsVisible() const { return m_hRender != INVALID_CLIENT_RENDER_HANDLE; }
|
||||||
void UpdateVisibility();
|
virtual void UpdateVisibility();
|
||||||
|
|
||||||
// Returns true if the entity changes its position every frame on the server but it doesn't
|
// Returns true if the entity changes its position every frame on the server but it doesn't
|
||||||
// set animtime. In that case, the client returns true here so it copies the server time to
|
// set animtime. In that case, the client returns true here so it copies the server time to
|
||||||
@ -743,7 +746,8 @@ public:
|
|||||||
virtual void SetHealth(int iHealth) {}
|
virtual void SetHealth(int iHealth) {}
|
||||||
virtual int GetHealth() const { return 0; }
|
virtual int GetHealth() const { return 0; }
|
||||||
virtual int GetMaxHealth() const { return 1; }
|
virtual int GetMaxHealth() const { return 1; }
|
||||||
virtual bool IsVisibleToTargetID( void ) { return false; }
|
virtual bool IsVisibleToTargetID( void ) const { return false; }
|
||||||
|
virtual bool IsHealthBarVisible( void ) const { return false; }
|
||||||
|
|
||||||
// Returns the health fraction
|
// Returns the health fraction
|
||||||
float HealthFraction() const;
|
float HealthFraction() const;
|
||||||
@ -1172,7 +1176,17 @@ public:
|
|||||||
// Sets the origin + angles to match the last position received
|
// Sets the origin + angles to match the last position received
|
||||||
void MoveToLastReceivedPosition( bool force = false );
|
void MoveToLastReceivedPosition( bool force = false );
|
||||||
|
|
||||||
|
// Return the IHasAttributes interface for this base entity. Removes the need for:
|
||||||
|
// dynamic_cast< IHasAttributes * >( pEntity );
|
||||||
|
// Which is remarkably slow.
|
||||||
|
// GetAttribInterface( CBaseEntity *pEntity ) in attribute_manager.h uses
|
||||||
|
// this function, tests for NULL, and Asserts m_pAttributes == dynamic_cast.
|
||||||
|
inline IHasAttributes *GetHasAttributesInterfacePtr() const { return m_pAttributes; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// NOTE: m_pAttributes needs to be set in the leaf class constructor.
|
||||||
|
IHasAttributes *m_pAttributes;
|
||||||
|
|
||||||
// Only meant to be called from subclasses
|
// Only meant to be called from subclasses
|
||||||
void DestroyModelInstance();
|
void DestroyModelInstance();
|
||||||
|
|
||||||
|
@ -562,11 +562,11 @@ Vector C_BaseFlex::SetViewTarget( CStudioHdr *pStudioHdr )
|
|||||||
m_iEyeUpdown = FindFlexController( "eyes_updown" );
|
m_iEyeUpdown = FindFlexController( "eyes_updown" );
|
||||||
m_iEyeRightleft = FindFlexController( "eyes_rightleft" );
|
m_iEyeRightleft = FindFlexController( "eyes_rightleft" );
|
||||||
|
|
||||||
if ( m_iEyeUpdown != -1 )
|
if ( m_iEyeUpdown != LocalFlexController_t(-1) )
|
||||||
{
|
{
|
||||||
pStudioHdr->pFlexcontroller( m_iEyeUpdown )->localToGlobal = AddGlobalFlexController( "eyes_updown" );
|
pStudioHdr->pFlexcontroller( m_iEyeUpdown )->localToGlobal = AddGlobalFlexController( "eyes_updown" );
|
||||||
}
|
}
|
||||||
if ( m_iEyeRightleft != -1 )
|
if ( m_iEyeRightleft != LocalFlexController_t(-1) )
|
||||||
{
|
{
|
||||||
pStudioHdr->pFlexcontroller( m_iEyeRightleft )->localToGlobal = AddGlobalFlexController( "eyes_rightleft" );
|
pStudioHdr->pFlexcontroller( m_iEyeRightleft )->localToGlobal = AddGlobalFlexController( "eyes_rightleft" );
|
||||||
}
|
}
|
||||||
@ -594,13 +594,13 @@ Vector C_BaseFlex::SetViewTarget( CStudioHdr *pStudioHdr )
|
|||||||
// calculate animated eye deflection
|
// calculate animated eye deflection
|
||||||
Vector eyeDeflect;
|
Vector eyeDeflect;
|
||||||
QAngle eyeAng( 0, 0, 0 );
|
QAngle eyeAng( 0, 0, 0 );
|
||||||
if ( m_iEyeUpdown != -1 )
|
if ( m_iEyeUpdown != LocalFlexController_t(-1) )
|
||||||
{
|
{
|
||||||
mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeUpdown );
|
mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeUpdown );
|
||||||
eyeAng.x = g_flexweight[ pflex->localToGlobal ];
|
eyeAng.x = g_flexweight[ pflex->localToGlobal ];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_iEyeRightleft != -1 )
|
if ( m_iEyeRightleft != LocalFlexController_t(-1) )
|
||||||
{
|
{
|
||||||
mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeRightleft );
|
mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeRightleft );
|
||||||
eyeAng.y = g_flexweight[ pflex->localToGlobal ];
|
eyeAng.y = g_flexweight[ pflex->localToGlobal ];
|
||||||
@ -1057,7 +1057,7 @@ void C_BaseFlex::GetToolRecordingState( KeyValues *msg )
|
|||||||
Vector viewtarget = m_viewtarget; // Use the unfiltered value
|
Vector viewtarget = m_viewtarget; // Use the unfiltered value
|
||||||
|
|
||||||
// HACK HACK: Unmap eyes right/left amounts
|
// HACK HACK: Unmap eyes right/left amounts
|
||||||
if (m_iEyeUpdown != -1 && m_iEyeRightleft != -1)
|
if (m_iEyeUpdown != LocalFlexController_t(-1) && m_iEyeRightleft != LocalFlexController_t(-1))
|
||||||
{
|
{
|
||||||
mstudioflexcontroller_t *flexupdown = hdr->pFlexcontroller( m_iEyeUpdown );
|
mstudioflexcontroller_t *flexupdown = hdr->pFlexcontroller( m_iEyeUpdown );
|
||||||
mstudioflexcontroller_t *flexrightleft = hdr->pFlexcontroller( m_iEyeRightleft );
|
mstudioflexcontroller_t *flexrightleft = hdr->pFlexcontroller( m_iEyeRightleft );
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
virtual void NotifyShouldTransmit( ShouldTransmitState_t state );
|
virtual void NotifyShouldTransmit( ShouldTransmitState_t state );
|
||||||
virtual void PreDataUpdate( DataUpdateType_t updateType );
|
virtual void PreDataUpdate( DataUpdateType_t updateType );
|
||||||
virtual void PostDataUpdate( DataUpdateType_t updateType );
|
virtual void PostDataUpdate( DataUpdateType_t updateType );
|
||||||
|
virtual void OnDataUnchangedInPVS( void ) { }
|
||||||
virtual void OnPreDataChanged( DataUpdateType_t updateType );
|
virtual void OnPreDataChanged( DataUpdateType_t updateType );
|
||||||
virtual void OnDataChanged( DataUpdateType_t updateType );
|
virtual void OnDataChanged( DataUpdateType_t updateType );
|
||||||
virtual void SetDormant( bool bDormant );
|
virtual void SetDormant( bool bDormant );
|
||||||
|
@ -192,7 +192,7 @@ bool C_BaseViewModel::Interpolate( float currentTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool C_BaseViewModel::ShouldFlipViewModel()
|
bool C_BaseViewModel::ShouldFlipViewModel()
|
||||||
{
|
{
|
||||||
#ifdef CSTRIKE_DLL
|
#ifdef CSTRIKE_DLL
|
||||||
// If cl_righthand is set, then we want them all right-handed.
|
// If cl_righthand is set, then we want them all right-handed.
|
||||||
|
@ -575,7 +575,10 @@ void C_EntityDissolve::ClientThink( void )
|
|||||||
#ifdef TF_CLIENT_DLL
|
#ifdef TF_CLIENT_DLL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pEnt->Release();
|
// Hide the ragdoll -- don't actually delete it or else things get unhappy when
|
||||||
|
// we get a message from the server telling us to delete it
|
||||||
|
pEnt->AddEffects( EF_NODRAW );
|
||||||
|
pEnt->ParticleProp()->StopEmission();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -198,12 +198,19 @@ void ParticleEffectCallback( const CEffectData &data )
|
|||||||
pEnt->ParticleProp()->StopEmission();
|
pEnt->ParticleProp()->StopEmission();
|
||||||
}
|
}
|
||||||
|
|
||||||
pEffect = pEnt->ParticleProp()->Create( pszName, (ParticleAttachment_t)data.m_nDamageType, data.m_nAttachmentIndex );
|
Vector vOffset = vec3_origin;
|
||||||
|
ParticleAttachment_t iAttachType = (ParticleAttachment_t)data.m_nDamageType;
|
||||||
|
if ( iAttachType == PATTACH_ABSORIGIN_FOLLOW || iAttachType == PATTACH_POINT_FOLLOW || iAttachType == PATTACH_ROOTBONE_FOLLOW )
|
||||||
|
{
|
||||||
|
vOffset = data.m_vStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEffect = pEnt->ParticleProp()->Create( pszName, iAttachType, data.m_nAttachmentIndex, vOffset );
|
||||||
AssertMsg2( pEffect.IsValid() && pEffect->IsValid(), "%s could not create particle effect %s",
|
AssertMsg2( pEffect.IsValid() && pEffect->IsValid(), "%s could not create particle effect %s",
|
||||||
C_BaseEntity::Instance( data.m_hEntity )->GetDebugName(), pszName );
|
C_BaseEntity::Instance( data.m_hEntity )->GetDebugName(), pszName );
|
||||||
if ( pEffect.IsValid() && pEffect->IsValid() )
|
if ( pEffect.IsValid() && pEffect->IsValid() )
|
||||||
{
|
{
|
||||||
if ( (ParticleAttachment_t)data.m_nDamageType == PATTACH_CUSTOMORIGIN )
|
if ( iAttachType == PATTACH_CUSTOMORIGIN )
|
||||||
{
|
{
|
||||||
pEffect->SetSortOrigin( data.m_vOrigin );
|
pEffect->SetSortOrigin( data.m_vOrigin );
|
||||||
pEffect->SetControlPoint( 0, data.m_vOrigin );
|
pEffect->SetControlPoint( 0, data.m_vOrigin );
|
||||||
|
@ -193,7 +193,7 @@ public:
|
|||||||
if( pReturn == NULL )
|
if( pReturn == NULL )
|
||||||
{
|
{
|
||||||
int iMaxSize = m_QueuedRopeMemory[m_nCurrentStack].GetMaxSize();
|
int iMaxSize = m_QueuedRopeMemory[m_nCurrentStack].GetMaxSize();
|
||||||
Warning( "Overflowed rope queued rendering memory stack. Needed %d, have %d/%d\n", bytes, iMaxSize - m_QueuedRopeMemory[m_nCurrentStack].GetUsed(), iMaxSize );
|
Warning( "Overflowed rope queued rendering memory stack. Needed %llu, have %d/%d\n", (uint64)bytes, iMaxSize - m_QueuedRopeMemory[m_nCurrentStack].GetUsed(), iMaxSize );
|
||||||
pReturn = malloc( bytes );
|
pReturn = malloc( bytes );
|
||||||
m_DeleteOnSwitch[m_nCurrentStack].AddToTail( pReturn );
|
m_DeleteOnSwitch[m_nCurrentStack].AddToTail( pReturn );
|
||||||
}
|
}
|
||||||
|
@ -214,11 +214,11 @@ void C_SceneEntity::SetupClientOnlyScene( const char *pszFilename, C_BaseFlex *p
|
|||||||
V_strcpy( szFilename, szSceneHWM );
|
V_strcpy( szFilename, szSceneHWM );
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert( szFilename && szFilename[ 0 ] );
|
Assert( szFilename[ 0 ] );
|
||||||
if ( szFilename && szFilename[ 0 ] )
|
if ( szFilename[ 0 ] )
|
||||||
{
|
{
|
||||||
LoadSceneFromFile( szFilename );
|
LoadSceneFromFile( szFilename );
|
||||||
|
|
||||||
if (!CommandLine()->FindParm("-hushasserts"))
|
if (!CommandLine()->FindParm("-hushasserts"))
|
||||||
{
|
{
|
||||||
Assert( m_pScene );
|
Assert( m_pScene );
|
||||||
@ -335,8 +335,8 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType )
|
|||||||
|
|
||||||
if ( updateType == DATA_UPDATE_CREATED )
|
if ( updateType == DATA_UPDATE_CREATED )
|
||||||
{
|
{
|
||||||
Assert( szFilename && szFilename[ 0 ] );
|
Assert( szFilename[ 0 ] );
|
||||||
if ( szFilename && szFilename[ 0 ] )
|
if ( szFilename[ 0 ] )
|
||||||
{
|
{
|
||||||
LoadSceneFromFile( szFilename );
|
LoadSceneFromFile( szFilename );
|
||||||
|
|
||||||
@ -373,6 +373,8 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType )
|
|||||||
|
|
||||||
SetNextClientThink( CLIENT_THINK_ALWAYS );
|
SetNextClientThink( CLIENT_THINK_ALWAYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_bWasPlaying = !m_bIsPlayingBack; // force it to be "changed"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Playback state changed...
|
// Playback state changed...
|
||||||
|
@ -1539,7 +1539,7 @@ void CTempEnts::BloodSprite( const Vector &org, int r, int g, int b, int a, int
|
|||||||
{
|
{
|
||||||
C_LocalTempEntity *pTemp;
|
C_LocalTempEntity *pTemp;
|
||||||
int frameCount = modelinfo->GetModelFrameCount( model );
|
int frameCount = modelinfo->GetModelFrameCount( model );
|
||||||
color32 impactcolor = { r, g, b, a };
|
color32 impactcolor = { (byte)r, (byte)g, (byte)b, (byte)a };
|
||||||
|
|
||||||
//Large, single blood sprite is a high-priority tent
|
//Large, single blood sprite is a high-priority tent
|
||||||
if ( ( pTemp = TempEntAllocHigh( org, model ) ) != NULL )
|
if ( ( pTemp = TempEntAllocHigh( org, model ) ) != NULL )
|
||||||
|
@ -163,18 +163,13 @@ void C_TeamTrainWatcher::OnDataChanged( DataUpdateType_t updateType )
|
|||||||
int nNumHills = ObjectiveResource()->GetNumNodeHillData( GetTeamNumber() );
|
int nNumHills = ObjectiveResource()->GetNumNodeHillData( GetTeamNumber() );
|
||||||
if ( nNumHills > 0 )
|
if ( nNumHills > 0 )
|
||||||
{
|
{
|
||||||
float flStart, flEnd;
|
float flStart = 0, flEnd = 0;
|
||||||
for ( int i = 0 ; i < nNumHills ; i++ )
|
for ( int i = 0 ; i < nNumHills ; i++ )
|
||||||
{
|
{
|
||||||
ObjectiveResource()->GetHillData( GetTeamNumber(), i, flStart, flEnd );
|
ObjectiveResource()->GetHillData( GetTeamNumber(), i, flStart, flEnd );
|
||||||
if ( m_flTotalProgress >= flStart && m_flTotalProgress<= flEnd )
|
|
||||||
{
|
bool state = ( m_flTotalProgress >= flStart && m_flTotalProgress <= flEnd );
|
||||||
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, true );
|
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, state );
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, false );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,9 +53,8 @@ $Configuration
|
|||||||
{
|
{
|
||||||
$AdditionalIncludeDirectories ".\;$BASE;$SRCDIR\vgui2\include;$SRCDIR\vgui2\controls;$SRCDIR\game\shared;.\game_controls;$SRCDIR\thirdparty\sixensesdk\include"
|
$AdditionalIncludeDirectories ".\;$BASE;$SRCDIR\vgui2\include;$SRCDIR\vgui2\controls;$SRCDIR\game\shared;.\game_controls;$SRCDIR\thirdparty\sixensesdk\include"
|
||||||
$PreprocessorDefinitions "$BASE;NO_STRING_T;CLIENT_DLL;VECTOR;VERSION_SAFE_STEAM_API_INTERFACES;PROTECTED_THINGS_ENABLE;strncpy=use_Q_strncpy_instead;_snprintf=use_Q_snprintf_instead"
|
$PreprocessorDefinitions "$BASE;NO_STRING_T;CLIENT_DLL;VECTOR;VERSION_SAFE_STEAM_API_INTERFACES;PROTECTED_THINGS_ENABLE;strncpy=use_Q_strncpy_instead;_snprintf=use_Q_snprintf_instead"
|
||||||
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;fopen=dont_use_fopen" [$WIN32]
|
$PreprocessorDefinitions "$BASE;fopen=dont_use_fopen" [$WIN32]
|
||||||
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;" [$OSXALL]
|
$PreprocessorDefinitions "$BASE;USE_WEBM_FOR_REPLAY;" [$LINUXALL]
|
||||||
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;USE_WEBM_FOR_REPLAY;" [$LINUXALL]
|
|
||||||
$PreprocessorDefinitions "$BASE;CURL_STATICLIB" [$WIN32 && $BUILD_REPLAY]
|
$PreprocessorDefinitions "$BASE;CURL_STATICLIB" [$WIN32 && $BUILD_REPLAY]
|
||||||
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
|
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
|
||||||
$Create/UsePCHThroughFile "cbase.h"
|
$Create/UsePCHThroughFile "cbase.h"
|
||||||
|
@ -213,6 +213,7 @@ void CalcFovFromProjection ( float *pFov, const VMatrix &proj )
|
|||||||
Assert ( proj.m[3][2] == -1.0f );
|
Assert ( proj.m[3][2] == -1.0f );
|
||||||
Assert ( proj.m[3][3] == 0.0f );
|
Assert ( proj.m[3][3] == 0.0f );
|
||||||
|
|
||||||
|
/*
|
||||||
// The math here:
|
// The math here:
|
||||||
// A view-space vector (x,y,z,1) is transformed by the projection matrix
|
// A view-space vector (x,y,z,1) is transformed by the projection matrix
|
||||||
// / xscale 0 xoffset 0 \
|
// / xscale 0 xoffset 0 \
|
||||||
@ -227,6 +228,7 @@ void CalcFovFromProjection ( float *pFov, const VMatrix &proj )
|
|||||||
// = xscale*(x/z) + xoffset (I flipped the signs of both sides)
|
// = xscale*(x/z) + xoffset (I flipped the signs of both sides)
|
||||||
// => (+-1 - xoffset)/xscale = x/z
|
// => (+-1 - xoffset)/xscale = x/z
|
||||||
// ...and x/z is tan(theta), and theta is the half-FOV.
|
// ...and x/z is tan(theta), and theta is the half-FOV.
|
||||||
|
*/
|
||||||
|
|
||||||
float fov_px = 2.0f * RAD2DEG ( atanf ( fabsf ( ( 1.0f - xoffset ) / xscale ) ) );
|
float fov_px = 2.0f * RAD2DEG ( atanf ( fabsf ( ( 1.0f - xoffset ) / xscale ) ) );
|
||||||
float fov_nx = 2.0f * RAD2DEG ( atanf ( fabsf ( ( -1.0f - xoffset ) / xscale ) ) );
|
float fov_nx = 2.0f * RAD2DEG ( atanf ( fabsf ( ( -1.0f - xoffset ) / xscale ) ) );
|
||||||
@ -261,8 +263,6 @@ CClientVirtualReality::CClientVirtualReality()
|
|||||||
m_rtLastMotionSample = 0;
|
m_rtLastMotionSample = 0;
|
||||||
m_bMotionUpdated = false;
|
m_bMotionUpdated = false;
|
||||||
|
|
||||||
m_bForceVRMode = false;
|
|
||||||
|
|
||||||
#if defined( USE_SDL )
|
#if defined( USE_SDL )
|
||||||
m_nNonVRSDLDisplayIndex = 0;
|
m_nNonVRSDLDisplayIndex = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -1367,7 +1367,7 @@ void CClientVirtualReality::Activate()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// These checks don't apply if we're in VR mode because Steam said so.
|
// These checks don't apply if we're in VR mode because Steam said so.
|
||||||
if ( !m_bForceVRMode )
|
if ( !ShouldForceVRActive() )
|
||||||
{
|
{
|
||||||
// see if VR mode is even enabled
|
// see if VR mode is even enabled
|
||||||
if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 )
|
if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 )
|
||||||
@ -1441,7 +1441,7 @@ void CClientVirtualReality::Activate()
|
|||||||
vgui::ivgui()->SetVRMode( true );
|
vgui::ivgui()->SetVRMode( true );
|
||||||
|
|
||||||
// we can skip this extra mode change if we've always been in VR mode
|
// we can skip this extra mode change if we've always been in VR mode
|
||||||
if ( !m_bForceVRMode )
|
if ( !ShouldForceVRActive() )
|
||||||
{
|
{
|
||||||
VRRect_t rect;
|
VRRect_t rect;
|
||||||
if ( g_pSourceVR->GetDisplayBounds( &rect ) )
|
if ( g_pSourceVR->GetDisplayBounds( &rect ) )
|
||||||
@ -1510,10 +1510,7 @@ void CClientVirtualReality::Deactivate()
|
|||||||
// Called when startup is complete
|
// Called when startup is complete
|
||||||
void CClientVirtualReality::StartupComplete()
|
void CClientVirtualReality::StartupComplete()
|
||||||
{
|
{
|
||||||
if ( g_pSourceVR )
|
if ( vr_activate_default.GetBool() || ShouldForceVRActive() )
|
||||||
m_bForceVRMode = g_pSourceVR->ShouldForceVRMode();
|
|
||||||
|
|
||||||
if ( vr_activate_default.GetBool( ) || m_bForceVRMode )
|
|
||||||
Activate();
|
Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,6 @@ private:
|
|||||||
int m_iAlignTorsoAndViewToWeaponCountdown;
|
int m_iAlignTorsoAndViewToWeaponCountdown;
|
||||||
|
|
||||||
bool m_bMotionUpdated;
|
bool m_bMotionUpdated;
|
||||||
bool m_bForceVRMode;
|
|
||||||
|
|
||||||
RTime32 m_rtLastMotionSample;
|
RTime32 m_rtLastMotionSample;
|
||||||
|
|
||||||
|
@ -354,6 +354,67 @@ void CClientEntityList::OnAddEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined( STAGING_ONLY )
|
||||||
|
|
||||||
|
// Defined in tier1 / interface.cpp for Windows and native for POSIX platforms.
|
||||||
|
extern "C" int backtrace( void **buffer, int size );
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
int entnum;
|
||||||
|
float time;
|
||||||
|
C_BaseEntity *pBaseEntity;
|
||||||
|
void *backtrace_addrs[ 16 ];
|
||||||
|
} g_RemoveEntityBacktraces[ 1024 ];
|
||||||
|
static uint32 g_RemoveEntityBacktracesIndex = 0;
|
||||||
|
|
||||||
|
static void OnRemoveEntityBacktraceHook( int entnum, C_BaseEntity *pBaseEntity )
|
||||||
|
{
|
||||||
|
int index = g_RemoveEntityBacktracesIndex++;
|
||||||
|
if ( g_RemoveEntityBacktracesIndex >= ARRAYSIZE( g_RemoveEntityBacktraces ) )
|
||||||
|
g_RemoveEntityBacktracesIndex = 0;
|
||||||
|
|
||||||
|
g_RemoveEntityBacktraces[ index ].entnum = entnum;
|
||||||
|
g_RemoveEntityBacktraces[ index ].time = gpGlobals->curtime;
|
||||||
|
g_RemoveEntityBacktraces[ index ].pBaseEntity = pBaseEntity;
|
||||||
|
|
||||||
|
memset( g_RemoveEntityBacktraces[ index ].backtrace_addrs, 0, sizeof( g_RemoveEntityBacktraces[ index ].backtrace_addrs ) );
|
||||||
|
backtrace( g_RemoveEntityBacktraces[ index ].backtrace_addrs, ARRAYSIZE( g_RemoveEntityBacktraces[ index ].backtrace_addrs ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should help us track down CL_PreserveExistingEntity Host_Error() issues:
|
||||||
|
// 1. Set cl_removeentity_backtrace_capture to 1.
|
||||||
|
// 2. When error hits, run "cl_removeentity_backtrace_dump [entnum]".
|
||||||
|
// 3. In debugger, track down what functions the spewed addresses refer to.
|
||||||
|
static ConVar cl_removeentity_backtrace_capture( "cl_removeentity_backtrace_capture", "0", 0,
|
||||||
|
"For debugging. Capture backtraces for CClientEntityList::OnRemoveEntity calls." );
|
||||||
|
|
||||||
|
CON_COMMAND( cl_removeentity_backtrace_dump, "Dump backtraces for client OnRemoveEntity calls." )
|
||||||
|
{
|
||||||
|
if ( !cl_removeentity_backtrace_capture.GetBool() )
|
||||||
|
{
|
||||||
|
Msg( "cl_removeentity_backtrace_dump error: cl_removeentity_backtrace_capture not enabled. Backtraces not captured.\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int entnum = ( args.ArgC() >= 2 ) ? atoi( args[ 1 ] ) : -1;
|
||||||
|
|
||||||
|
for ( int i = 0; i < ARRAYSIZE( g_RemoveEntityBacktraces ); i++ )
|
||||||
|
{
|
||||||
|
if ( g_RemoveEntityBacktraces[ i ].time &&
|
||||||
|
( entnum == -1 || g_RemoveEntityBacktraces[ i ].entnum == entnum ) )
|
||||||
|
{
|
||||||
|
Msg( "%d: time:%.2f pBaseEntity:%p\n", g_RemoveEntityBacktraces[i].entnum,
|
||||||
|
g_RemoveEntityBacktraces[ i ].time, g_RemoveEntityBacktraces[ i ].pBaseEntity );
|
||||||
|
for ( int j = 0; j < ARRAYSIZE( g_RemoveEntityBacktraces[ i ].backtrace_addrs ); j++ )
|
||||||
|
{
|
||||||
|
Msg( " %p\n", g_RemoveEntityBacktraces[ i ].backtrace_addrs[ j ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // STAGING_ONLY
|
||||||
|
|
||||||
void CClientEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
void CClientEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
||||||
{
|
{
|
||||||
@ -380,6 +441,13 @@ void CClientEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle
|
|||||||
|
|
||||||
C_BaseEntity *pBaseEntity = pUnknown->GetBaseEntity();
|
C_BaseEntity *pBaseEntity = pUnknown->GetBaseEntity();
|
||||||
|
|
||||||
|
#if defined( STAGING_ONLY )
|
||||||
|
if ( cl_removeentity_backtrace_capture.GetBool() )
|
||||||
|
{
|
||||||
|
OnRemoveEntityBacktraceHook( entnum, pBaseEntity );
|
||||||
|
}
|
||||||
|
#endif // STAGING_ONLY
|
||||||
|
|
||||||
if ( pBaseEntity )
|
if ( pBaseEntity )
|
||||||
{
|
{
|
||||||
if ( pBaseEntity->ObjectCaps() & FCAP_SAVE_NON_NETWORKABLE )
|
if ( pBaseEntity->ObjectCaps() & FCAP_SAVE_NON_NETWORKABLE )
|
||||||
@ -502,4 +570,4 @@ C_BaseEntity* C_BaseEntityIterator::Next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -470,8 +470,17 @@ bool ClientModeShared::ShouldDrawEntity(C_BaseEntity *pEnt)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
bool ClientModeShared::ShouldDrawParticles( )
|
bool ClientModeShared::ShouldDrawParticles( )
|
||||||
{
|
{
|
||||||
|
#ifdef TF_CLIENT_DLL
|
||||||
|
C_TFPlayer *pTFPlayer = C_TFPlayer::GetLocalTFPlayer();
|
||||||
|
if ( pTFPlayer && !pTFPlayer->ShouldPlayerDrawParticles() )
|
||||||
|
return false;
|
||||||
|
#endif // TF_CLIENT_DLL
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,12 +229,11 @@ void CBaseViewport::CreateDefaultPanels( void )
|
|||||||
AddNewPanel( CreatePanelByName( PANEL_SCOREBOARD ), "PANEL_SCOREBOARD" );
|
AddNewPanel( CreatePanelByName( PANEL_SCOREBOARD ), "PANEL_SCOREBOARD" );
|
||||||
AddNewPanel( CreatePanelByName( PANEL_INFO ), "PANEL_INFO" );
|
AddNewPanel( CreatePanelByName( PANEL_INFO ), "PANEL_INFO" );
|
||||||
AddNewPanel( CreatePanelByName( PANEL_SPECGUI ), "PANEL_SPECGUI" );
|
AddNewPanel( CreatePanelByName( PANEL_SPECGUI ), "PANEL_SPECGUI" );
|
||||||
|
#if !defined( TF_CLIENT_DLL )
|
||||||
AddNewPanel( CreatePanelByName( PANEL_SPECMENU ), "PANEL_SPECMENU" );
|
AddNewPanel( CreatePanelByName( PANEL_SPECMENU ), "PANEL_SPECMENU" );
|
||||||
AddNewPanel( CreatePanelByName( PANEL_NAV_PROGRESS ), "PANEL_NAV_PROGRESS" );
|
AddNewPanel( CreatePanelByName( PANEL_NAV_PROGRESS ), "PANEL_NAV_PROGRESS" );
|
||||||
// AddNewPanel( CreatePanelByName( PANEL_TEAM ), "PANEL_TEAM" );
|
#endif // !TF_CLIENT_DLL
|
||||||
// AddNewPanel( CreatePanelByName( PANEL_CLASS ), "PANEL_CLASS" );
|
#endif // !_XBOX
|
||||||
// AddNewPanel( CreatePanelByName( PANEL_BUY ), "PANEL_BUY" );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBaseViewport::UpdateAllPanels( void )
|
void CBaseViewport::UpdateAllPanels( void )
|
||||||
|
@ -190,6 +190,7 @@ void CTeamMenu::LoadMapPage( const char *mapName )
|
|||||||
char mapRES[ MAX_PATH ];
|
char mapRES[ MAX_PATH ];
|
||||||
|
|
||||||
char uilanguage[ 64 ];
|
char uilanguage[ 64 ];
|
||||||
|
uilanguage[0] = 0;
|
||||||
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
|
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
|
||||||
|
|
||||||
Q_snprintf( mapRES, sizeof( mapRES ), "resource/maphtml/%s_%s.html", mapName, uilanguage );
|
Q_snprintf( mapRES, sizeof( mapRES ), "resource/maphtml/%s_%s.html", mapName, uilanguage );
|
||||||
|
@ -102,11 +102,7 @@ CTextWindow::CTextWindow(IViewPort *pViewPort) : Frame(NULL, PANEL_INFO )
|
|||||||
SetTitleBarVisible( false );
|
SetTitleBarVisible( false );
|
||||||
|
|
||||||
m_pTextMessage = new TextEntry( this, "TextMessage" );
|
m_pTextMessage = new TextEntry( this, "TextMessage" );
|
||||||
#if defined( ENABLE_CHROMEHTMLWINDOW )
|
|
||||||
m_pHTMLMessage = new CMOTDHTML( this,"HTMLMessage" );
|
m_pHTMLMessage = new CMOTDHTML( this,"HTMLMessage" );
|
||||||
#else
|
|
||||||
m_pHTMLMessage = NULL;
|
|
||||||
#endif
|
|
||||||
m_pTitleLabel = new Label( this, "MessageTitle", "Message Title" );
|
m_pTitleLabel = new Label( this, "MessageTitle", "Message Title" );
|
||||||
m_pOK = new Button(this, "ok", "#PropertyDialog_OK");
|
m_pOK = new Button(this, "ok", "#PropertyDialog_OK");
|
||||||
|
|
||||||
@ -165,7 +161,6 @@ void CTextWindow::ShowText( const char *text )
|
|||||||
|
|
||||||
void CTextWindow::ShowURL( const char *URL, bool bAllowUserToDisable )
|
void CTextWindow::ShowURL( const char *URL, bool bAllowUserToDisable )
|
||||||
{
|
{
|
||||||
#if defined( ENABLE_CHROMEHTMLWINDOW )
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Msg( "CTextWindow::ShowURL( %s )\n", URL );
|
Msg( "CTextWindow::ShowURL( %s )\n", URL );
|
||||||
#endif
|
#endif
|
||||||
@ -196,8 +191,6 @@ void CTextWindow::ShowURL( const char *URL, bool bAllowUserToDisable )
|
|||||||
m_pHTMLMessage->SetVisible( true );
|
m_pHTMLMessage->SetVisible( true );
|
||||||
m_pHTMLMessage->OpenURL( URL, NULL );
|
m_pHTMLMessage->OpenURL( URL, NULL );
|
||||||
m_bShownURL = true;
|
m_bShownURL = true;
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTextWindow::ShowIndex( const char *entry )
|
void CTextWindow::ShowIndex( const char *entry )
|
||||||
@ -286,9 +279,8 @@ void CTextWindow::Update( void )
|
|||||||
|
|
||||||
m_pTitleLabel->SetText( m_szTitle );
|
m_pTitleLabel->SetText( m_szTitle );
|
||||||
|
|
||||||
#if defined( ENABLE_CHROMEHTMLWINDOW )
|
if ( m_pHTMLMessage )
|
||||||
m_pHTMLMessage->SetVisible( false );
|
m_pHTMLMessage->SetVisible( false );
|
||||||
#endif
|
|
||||||
m_pTextMessage->SetVisible( false );
|
m_pTextMessage->SetVisible( false );
|
||||||
|
|
||||||
if ( m_nContentType == TYPE_INDEX )
|
if ( m_nContentType == TYPE_INDEX )
|
||||||
@ -427,13 +419,11 @@ void CTextWindow::ShowPanel( bool bShow )
|
|||||||
SetVisible( false );
|
SetVisible( false );
|
||||||
SetMouseInputEnabled( false );
|
SetMouseInputEnabled( false );
|
||||||
|
|
||||||
#if defined( ENABLE_CHROMEHTMLWINDOW )
|
if ( m_bUnloadOnDismissal && m_bShownURL && m_pHTMLMessage )
|
||||||
if ( m_bUnloadOnDismissal && m_bShownURL )
|
|
||||||
{
|
{
|
||||||
m_pHTMLMessage->OpenURL( "about:blank", NULL );
|
m_pHTMLMessage->OpenURL( "about:blank", NULL );
|
||||||
m_bShownURL = false;
|
m_bShownURL = false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void CHudDamageIndicator::DrawDamageIndicator(int side)
|
|||||||
|
|
||||||
int x1 = m_flDmgX;
|
int x1 = m_flDmgX;
|
||||||
int x2 = m_flDmgX + m_flDmgWide;
|
int x2 = m_flDmgX + m_flDmgWide;
|
||||||
int y[4] = { m_flDmgY, m_flDmgY + insetY, m_flDmgY + m_flDmgTall1 - insetY, m_flDmgY + m_flDmgTall1 };
|
int y[4] = { (int)m_flDmgY, (int)(m_flDmgY + insetY), (int)(m_flDmgY + m_flDmgTall1 - insetY), (int)(m_flDmgY + m_flDmgTall1) };
|
||||||
int alpha[4] = { 0.0f, 1.0f, 1.0f, 0.0f };
|
int alpha[4] = { 0.0f, 1.0f, 1.0f, 0.0f };
|
||||||
|
|
||||||
// see if we're high damage
|
// see if we're high damage
|
||||||
|
@ -241,7 +241,7 @@ public:
|
|||||||
void MsgFunc_TextMsg(const char *pszName, int iSize, void *pbuf);
|
void MsgFunc_TextMsg(const char *pszName, int iSize, void *pbuf);
|
||||||
|
|
||||||
virtual void Printf( int iFilter, PRINTF_FORMAT_STRING const char *fmt, ... );
|
virtual void Printf( int iFilter, PRINTF_FORMAT_STRING const char *fmt, ... );
|
||||||
virtual void ChatPrintf( int iPlayerIndex, int iFilter, PRINTF_FORMAT_STRING const char *fmt, ... );
|
virtual void ChatPrintf( int iPlayerIndex, int iFilter, PRINTF_FORMAT_STRING const char *fmt, ... ) FMTFUNCTION( 4, 5 );
|
||||||
|
|
||||||
virtual void StartMessageMode( int iMessageModeType );
|
virtual void StartMessageMode( int iMessageModeType );
|
||||||
virtual void StopMessageMode( void );
|
virtual void StopMessageMode( void );
|
||||||
|
@ -65,6 +65,7 @@ void CHudBaseDeathNotice::Init( void )
|
|||||||
ListenForGameEvent( "teamplay_point_captured" );
|
ListenForGameEvent( "teamplay_point_captured" );
|
||||||
ListenForGameEvent( "teamplay_capture_blocked" );
|
ListenForGameEvent( "teamplay_capture_blocked" );
|
||||||
ListenForGameEvent( "teamplay_flag_event" );
|
ListenForGameEvent( "teamplay_flag_event" );
|
||||||
|
ListenForGameEvent( "rd_robot_killed" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -844,6 +844,7 @@ CHudCloseCaption::CHudCloseCaption( const char *pElementName )
|
|||||||
HOOK_HUD_MESSAGE( CHudCloseCaption, CloseCaption );
|
HOOK_HUD_MESSAGE( CHudCloseCaption, CloseCaption );
|
||||||
|
|
||||||
char uilanguage[ 64 ];
|
char uilanguage[ 64 ];
|
||||||
|
uilanguage[0] = 0;
|
||||||
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
|
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
|
||||||
|
|
||||||
if ( !Q_stricmp( uilanguage, "english" ) )
|
if ( !Q_stricmp( uilanguage, "english" ) )
|
||||||
@ -2752,6 +2753,7 @@ void OnCaptionLanguageChanged( IConVar *pConVar, const char *pOldString, float f
|
|||||||
}
|
}
|
||||||
|
|
||||||
char uilanguage[ 64 ];
|
char uilanguage[ 64 ];
|
||||||
|
uilanguage[0] = 0;
|
||||||
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
|
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
|
||||||
|
|
||||||
CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption );
|
CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption );
|
||||||
|
@ -983,6 +983,12 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
|
|||||||
|
|
||||||
char szTime[256];
|
char szTime[256];
|
||||||
wchar_t wszTime[256];
|
wchar_t wszTime[256];
|
||||||
|
bool bMinutes = ( nTime > 65 );
|
||||||
|
if ( bMinutes )
|
||||||
|
{
|
||||||
|
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 ) );
|
||||||
|
|
||||||
@ -1021,8 +1027,8 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
|
|||||||
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_map_name_required" );
|
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_map_name_required" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VOTE_FAILED_FAILED_RECENTLY:
|
case VOTE_FAILED_ON_COOLDOWN:
|
||||||
g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof(wszHeaderString), g_pVGuiLocalize->Find( "#GameUI_vote_failed_recently" ), 1, wszTime );
|
g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof( wszHeaderString ), g_pVGuiLocalize->Find( pszTimeString ), 1, wszTime );
|
||||||
pwszHeaderString = wszHeaderString;
|
pwszHeaderString = wszHeaderString;
|
||||||
m_pCallVoteFailed->SetDialogVariable( "FailedReason", pwszHeaderString );
|
m_pCallVoteFailed->SetDialogVariable( "FailedReason", pwszHeaderString );
|
||||||
break;
|
break;
|
||||||
|
@ -97,8 +97,8 @@ CParticleSubTextureGroup::~CParticleSubTextureGroup()
|
|||||||
|
|
||||||
CParticleSubTexture::CParticleSubTexture()
|
CParticleSubTexture::CParticleSubTexture()
|
||||||
{
|
{
|
||||||
m_tCoordMins[0] = m_tCoordMins[0] = 0;
|
m_tCoordMins[0] = m_tCoordMins[1] = 0;
|
||||||
m_tCoordMaxs[0] = m_tCoordMaxs[0] = 1;
|
m_tCoordMaxs[0] = m_tCoordMaxs[1] = 1;
|
||||||
m_pGroup = &m_DefaultGroup;
|
m_pGroup = &m_DefaultGroup;
|
||||||
m_pMaterial = NULL;
|
m_pMaterial = NULL;
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ public:
|
|||||||
BaseClass::PerformLayout();
|
BaseClass::PerformLayout();
|
||||||
|
|
||||||
int nWidth = XRES( 140 );
|
int nWidth = XRES( 140 );
|
||||||
int nMargins[2] = { XRES( 5 ), YRES( 5 ) };
|
int nMargins[2] = { (int)XRES( 5 ), (int)YRES( 5 ) };
|
||||||
int nVBuf = YRES( 0 );
|
int nVBuf = YRES( 0 );
|
||||||
int nLastY = -1;
|
int nLastY = -1;
|
||||||
int nY = nMargins[1];
|
int nY = nMargins[1];
|
||||||
@ -1969,7 +1969,7 @@ void CReplayPerformanceEditorPanel::PerformLayout()
|
|||||||
dynamic_cast< CExLabel * >( m_pPlayerCellsPanel->FindChildByName( "RedLabel" ) ),
|
dynamic_cast< CExLabel * >( m_pPlayerCellsPanel->FindChildByName( "RedLabel" ) ),
|
||||||
dynamic_cast< CExLabel * >( m_pPlayerCellsPanel->FindChildByName( "BlueLabel" ) )
|
dynamic_cast< CExLabel * >( m_pPlayerCellsPanel->FindChildByName( "BlueLabel" ) )
|
||||||
};
|
};
|
||||||
int nMargins[2] = { XRES( 5 ), YRES( 2 ) };
|
int nMargins[2] = { (int)XRES( 5 ), (int)YRES( 2 ) };
|
||||||
for ( int i = 0; i < 2; ++i )
|
for ( int i = 0; i < 2; ++i )
|
||||||
{
|
{
|
||||||
pRedBlueLabels[i]->SizeToContents();
|
pRedBlueLabels[i]->SizeToContents();
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "../common/xbox/xboxstubs.h"
|
#include "../common/xbox/xboxstubs.h"
|
||||||
#include "steam/steam_api.h"
|
#include "steam/steam_api.h"
|
||||||
|
#include "tier0/cpumonitoring.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"
|
||||||
@ -208,6 +209,28 @@ void GetFPSColor( int nFps, unsigned char ucColor[3] )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Set the color appropriately based on the CPU's frequency percentage
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void GetCPUColor( float cpuPercentage, unsigned char ucColor[3] )
|
||||||
|
{
|
||||||
|
// These colors are for poor CPU performance
|
||||||
|
ucColor[0] = 255; ucColor[1] = 0; ucColor[2] = 0;
|
||||||
|
|
||||||
|
if ( cpuPercentage >= kCPUMonitoringWarning1 )
|
||||||
|
{
|
||||||
|
// Excellent CPU performance
|
||||||
|
ucColor[0] = 10;
|
||||||
|
ucColor[1] = 200;
|
||||||
|
}
|
||||||
|
else if ( cpuPercentage >= kCPUMonitoringWarning2 )
|
||||||
|
{
|
||||||
|
// Medium CPU performance
|
||||||
|
ucColor[0] = 220;
|
||||||
|
ucColor[1] = 220;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Input :
|
// Input :
|
||||||
@ -272,6 +295,17 @@ void CFPSPanel::Paint()
|
|||||||
GetFPSColor( nFps, ucColor );
|
GetFPSColor( nFps, ucColor );
|
||||||
g_pMatSystemSurface->DrawColoredText( m_hFont, x, 2, ucColor[0], ucColor[1], ucColor[2], 255, "%3i fps on %s", nFps, engine->GetLevelName() );
|
g_pMatSystemSurface->DrawColoredText( m_hFont, x, 2, ucColor[0], ucColor[1], ucColor[2], 255, "%3i fps on %s", nFps, engine->GetLevelName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CPUFrequencyResults frequency = GetCPUFrequencyResults();
|
||||||
|
double currentTime = Plat_FloatTime();
|
||||||
|
const double displayTime = 5.0f; // Display frequency results for this long.
|
||||||
|
if ( frequency.m_GHz > 0 && frequency.m_timeStamp + displayTime > currentTime )
|
||||||
|
{
|
||||||
|
int lineHeight = vgui::surface()->GetFontTall( m_hFont );
|
||||||
|
// Optionally print out the CPU frequency monitoring data.
|
||||||
|
GetCPUColor( frequency.m_percentage, ucColor );
|
||||||
|
g_pMatSystemSurface->DrawColoredText( m_hFont, x, lineHeight + 2, ucColor[0], ucColor[1], ucColor[2], 255, "CPU frequency percent: %3.1f%% Min percent: %3.1f%%", frequency.m_percentage, frequency.m_lowestPercentage );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_lastRealTime = gpGlobals->realtime;
|
m_lastRealTime = gpGlobals->realtime;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <vgui/IScheme.h>
|
#include <vgui/IScheme.h>
|
||||||
#include <vgui/ILocalize.h>
|
#include <vgui/ILocalize.h>
|
||||||
#include "tier0/vprof.h"
|
#include "tier0/vprof.h"
|
||||||
|
#include "tier0/cpumonitoring.h"
|
||||||
#include "cdll_bounded_cvars.h"
|
#include "cdll_bounded_cvars.h"
|
||||||
|
|
||||||
#include "materialsystem/imaterialsystem.h"
|
#include "materialsystem/imaterialsystem.h"
|
||||||
@ -761,7 +762,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
|||||||
|
|
||||||
Q_snprintf( sz, sizeof( sz ), "lerp: %5.1f ms", GetClientInterpAmount() * 1000.0f );
|
Q_snprintf( sz, sizeof( sz ), "lerp: %5.1f ms", GetClientInterpAmount() * 1000.0f );
|
||||||
|
|
||||||
int interpcolor[ 3 ] = { GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE };
|
int interpcolor[ 3 ] = { (int)GRAPH_RED, (int)GRAPH_GREEN, (int)GRAPH_BLUE };
|
||||||
float flInterp = GetClientInterpAmount();
|
float flInterp = GetClientInterpAmount();
|
||||||
if ( flInterp > 0.001f )
|
if ( flInterp > 0.001f )
|
||||||
{
|
{
|
||||||
@ -817,7 +818,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
|||||||
{
|
{
|
||||||
Q_snprintf( sz, sizeof( sz ), "sv : %5.1f var: %4.2f msec", m_flServerFramerate, m_flServerFramerateStdDeviation * 1000.0f );
|
Q_snprintf( sz, sizeof( sz ), "sv : %5.1f var: %4.2f msec", m_flServerFramerate, m_flServerFramerateStdDeviation * 1000.0f );
|
||||||
|
|
||||||
int servercolor[ 3 ] = { GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE };
|
int servercolor[ 3 ] = { (int)GRAPH_RED, (int)GRAPH_GREEN, (int)GRAPH_BLUE };
|
||||||
|
|
||||||
if ( m_flServerFramerate < 10.0f )
|
if ( m_flServerFramerate < 10.0f )
|
||||||
{
|
{
|
||||||
@ -876,6 +877,35 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
|||||||
g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 0, 128, 255, "voice" );
|
g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 0, 128, 255, "voice" );
|
||||||
y -= textTall;
|
y -= textTall;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const CPUFrequencyResults frequency = GetCPUFrequencyResults();
|
||||||
|
double currentTime = Plat_FloatTime();
|
||||||
|
const double displayTime = 5.0f; // Display frequency results for this long.
|
||||||
|
if ( frequency.m_GHz > 0 && frequency.m_timeStamp + displayTime > currentTime )
|
||||||
|
{
|
||||||
|
// Optionally print out the CPU frequency monitoring data.
|
||||||
|
uint8 cpuColor[4] = { (uint8)GRAPH_RED, (uint8)GRAPH_GREEN, (uint8)GRAPH_BLUE, 255 };
|
||||||
|
|
||||||
|
if ( frequency.m_percentage < kCPUMonitoringWarning2 )
|
||||||
|
{
|
||||||
|
cpuColor[0] = 255;
|
||||||
|
cpuColor[1] = 31;
|
||||||
|
cpuColor[2] = 31;
|
||||||
|
}
|
||||||
|
else if ( frequency.m_percentage < kCPUMonitoringWarning1 )
|
||||||
|
{
|
||||||
|
cpuColor[0] = 255;
|
||||||
|
cpuColor[1] = 125;
|
||||||
|
cpuColor[2] = 31;
|
||||||
|
}
|
||||||
|
// Experimental fading out as data becomes stale. Probably too distracting.
|
||||||
|
//float age = currentTime - frequency.m_timeStamp;
|
||||||
|
//cpuColor.a *= ( displayTime - age ) / displayTime;
|
||||||
|
g_pMatSystemSurface->DrawColoredText( font, x, y, cpuColor[0], cpuColor[1], cpuColor[2], cpuColor[3],
|
||||||
|
"CPU freq: %3.1f%% Min: %3.1f%%", frequency.m_percentage, frequency.m_lowestPercentage );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -177,7 +177,7 @@ void CSchemeVisualizer::AddBordersToList()
|
|||||||
void CSchemeVisualizer::AddFontsToList()
|
void CSchemeVisualizer::AddFontsToList()
|
||||||
{
|
{
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
const char strOAccent[] = { 0xc3, 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)
|
||||||
#else
|
#else
|
||||||
const uint8 strOAccent[] = { 0xd3, 0x00 };
|
const uint8 strOAccent[] = { 0xd3, 0x00 };
|
||||||
#endif
|
#endif
|
||||||
|
@ -1435,8 +1435,8 @@ static void GetFogColorTransition( fogparams_t *pFogParams, float *pColorPrimary
|
|||||||
{
|
{
|
||||||
float flPercent = 1.0f - (( pFogParams->lerptime - gpGlobals->curtime ) / pFogParams->duration );
|
float flPercent = 1.0f - (( pFogParams->lerptime - gpGlobals->curtime ) / pFogParams->duration );
|
||||||
|
|
||||||
float flPrimaryColorLerp[3] = { pFogParams->colorPrimaryLerpTo.GetR(), pFogParams->colorPrimaryLerpTo.GetG(), pFogParams->colorPrimaryLerpTo.GetB() };
|
float flPrimaryColorLerp[3] = { (float)pFogParams->colorPrimaryLerpTo.GetR(), (float)pFogParams->colorPrimaryLerpTo.GetG(), (float)pFogParams->colorPrimaryLerpTo.GetB() };
|
||||||
float flSecondaryColorLerp[3] = { pFogParams->colorSecondaryLerpTo.GetR(), pFogParams->colorSecondaryLerpTo.GetG(), pFogParams->colorSecondaryLerpTo.GetB() };
|
float flSecondaryColorLerp[3] = { (float)pFogParams->colorSecondaryLerpTo.GetR(), (float)pFogParams->colorSecondaryLerpTo.GetG(), (float)pFogParams->colorSecondaryLerpTo.GetB() };
|
||||||
|
|
||||||
CheckAndTransitionColor( flPercent, pColorPrimary, flPrimaryColorLerp );
|
CheckAndTransitionColor( flPercent, pColorPrimary, flPrimaryColorLerp );
|
||||||
CheckAndTransitionColor( flPercent, pColorSecondary, flSecondaryColorLerp );
|
CheckAndTransitionColor( flPercent, pColorSecondary, flSecondaryColorLerp );
|
||||||
@ -1459,8 +1459,8 @@ static void GetFogColor( fogparams_t *pFogParams, float *pColor )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float flPrimaryColor[3] = { pFogParams->colorPrimary.GetR(), pFogParams->colorPrimary.GetG(), pFogParams->colorPrimary.GetB() };
|
float flPrimaryColor[3] = { (float)pFogParams->colorPrimary.GetR(), (float)pFogParams->colorPrimary.GetG(), (float)pFogParams->colorPrimary.GetB() };
|
||||||
float flSecondaryColor[3] = { pFogParams->colorSecondary.GetR(), pFogParams->colorSecondary.GetG(), pFogParams->colorSecondary.GetB() };
|
float flSecondaryColor[3] = { (float)pFogParams->colorSecondary.GetR(), (float)pFogParams->colorSecondary.GetG(), (float)pFogParams->colorSecondary.GetB() };
|
||||||
|
|
||||||
GetFogColorTransition( pFogParams, flPrimaryColor, flSecondaryColor );
|
GetFogColorTransition( pFogParams, flPrimaryColor, flSecondaryColor );
|
||||||
|
|
||||||
|
@ -27,13 +27,8 @@ AI_CriteriaSet::AI_CriteriaSet() : m_Lookup( 0, 0, CritEntry_t::LessFunc )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
AI_CriteriaSet::AI_CriteriaSet( const AI_CriteriaSet& src ) : m_Lookup( 0, 0, CritEntry_t::LessFunc )
|
AI_CriteriaSet::AI_CriteriaSet( const AI_CriteriaSet& src ) : m_Lookup( 0, 0, CritEntry_t::LessFunc )
|
||||||
{
|
{
|
||||||
m_Lookup.Purge();
|
// Use fast Copy CUtlRBTree CopyFrom. WARNING: It only handles POD.
|
||||||
for ( short i = src.m_Lookup.FirstInorder();
|
m_Lookup.CopyFrom( src.m_Lookup );
|
||||||
i != src.m_Lookup.InvalidIndex();
|
|
||||||
i = src.m_Lookup.NextInorder( i ) )
|
|
||||||
{
|
|
||||||
m_Lookup.Insert( src.m_Lookup[ i ] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -162,7 +157,6 @@ void AI_CriteriaSet::Describe()
|
|||||||
{
|
{
|
||||||
for ( short i = m_Lookup.FirstInorder(); i != m_Lookup.InvalidIndex(); i = m_Lookup.NextInorder( i ) )
|
for ( short i = m_Lookup.FirstInorder(); i != m_Lookup.InvalidIndex(); i = m_Lookup.NextInorder( i ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
CritEntry_t *entry = &m_Lookup[ i ];
|
CritEntry_t *entry = &m_Lookup[ i ];
|
||||||
|
|
||||||
if ( entry->weight != 1.0f )
|
if ( entry->weight != 1.0f )
|
||||||
@ -199,9 +193,9 @@ AI_Response::AI_Response()
|
|||||||
{
|
{
|
||||||
m_Type = RESPONSE_NONE;
|
m_Type = RESPONSE_NONE;
|
||||||
m_szResponseName[0] = 0;
|
m_szResponseName[0] = 0;
|
||||||
|
m_szMatchingRule[0] = 0;
|
||||||
|
|
||||||
m_pCriteria = NULL;
|
m_pCriteria = NULL;
|
||||||
m_szMatchingRule[0]=0;
|
|
||||||
m_szContext = NULL;
|
|
||||||
m_bApplyContextToWorld = false;
|
m_bApplyContextToWorld = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,13 +203,8 @@ AI_Response::AI_Response()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
AI_Response::AI_Response( const AI_Response &from )
|
AI_Response::AI_Response( const AI_Response &from )
|
||||||
{
|
{
|
||||||
Assert( (void*)(&m_Type) == (void*)this );
|
|
||||||
m_pCriteria = NULL;
|
m_pCriteria = NULL;
|
||||||
memcpy( this, &from, sizeof(*this) );
|
*this = from;
|
||||||
m_pCriteria = NULL;
|
|
||||||
m_szContext = NULL;
|
|
||||||
SetContext( from.m_szContext );
|
|
||||||
m_bApplyContextToWorld = from.m_bApplyContextToWorld;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -224,20 +213,34 @@ AI_Response::AI_Response( const AI_Response &from )
|
|||||||
AI_Response::~AI_Response()
|
AI_Response::~AI_Response()
|
||||||
{
|
{
|
||||||
delete m_pCriteria;
|
delete m_pCriteria;
|
||||||
delete[] m_szContext;
|
m_pCriteria = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
AI_Response &AI_Response::operator=( const AI_Response &from )
|
AI_Response &AI_Response::operator=( const AI_Response &from )
|
||||||
{
|
{
|
||||||
Assert( (void*)(&m_Type) == (void*)this );
|
Assert( (void*)(&m_Type) == (void*)this );
|
||||||
|
|
||||||
|
if (this == &from)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
m_Type = from.m_Type;
|
||||||
|
|
||||||
|
V_strcpy_safe( m_szResponseName, from.m_szResponseName );
|
||||||
|
V_strcpy_safe( m_szMatchingRule, from.m_szMatchingRule );
|
||||||
|
|
||||||
delete m_pCriteria;
|
delete m_pCriteria;
|
||||||
m_pCriteria = NULL;
|
m_pCriteria = NULL;
|
||||||
memcpy( this, &from, sizeof(*this) );
|
|
||||||
m_pCriteria = NULL;
|
// Copy criteria.
|
||||||
m_szContext = NULL;
|
if (from.m_pCriteria)
|
||||||
SetContext( from.m_szContext );
|
m_pCriteria = new AI_CriteriaSet(*from.m_pCriteria);
|
||||||
|
|
||||||
|
m_Params = from.m_Params;
|
||||||
|
|
||||||
|
m_szContext = from.m_szContext;
|
||||||
m_bApplyContextToWorld = from.m_bApplyContextToWorld;
|
m_bApplyContextToWorld = from.m_bApplyContextToWorld;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,15 +249,22 @@ AI_Response &AI_Response::operator=( const AI_Response &from )
|
|||||||
// Input : *response -
|
// Input : *response -
|
||||||
// *criteria -
|
// *criteria -
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void AI_Response::Init( ResponseType_t type, const char *responseName, const AI_CriteriaSet& criteria, const AI_ResponseParams& responseparams, const char *ruleName, const char *applyContext, bool bApplyContextToWorld )
|
void AI_Response::Init( ResponseType_t type, const char *responseName, const AI_CriteriaSet& criteria,
|
||||||
|
const AI_ResponseParams& responseparams, const char *ruleName, const char *applyContext,
|
||||||
|
bool bApplyContextToWorld )
|
||||||
{
|
{
|
||||||
m_Type = type;
|
m_Type = type;
|
||||||
Q_strncpy( m_szResponseName, responseName, sizeof( m_szResponseName ) );
|
|
||||||
|
V_strcpy_safe( m_szResponseName, responseName );
|
||||||
|
V_strcpy_safe( m_szMatchingRule, ruleName ? ruleName : "NULL" );
|
||||||
|
|
||||||
// Copy underlying criteria
|
// Copy underlying criteria
|
||||||
|
Assert( !m_pCriteria );
|
||||||
m_pCriteria = new AI_CriteriaSet( criteria );
|
m_pCriteria = new AI_CriteriaSet( criteria );
|
||||||
Q_strncpy( m_szMatchingRule, ruleName ? ruleName : "NULL", sizeof( m_szMatchingRule ) );
|
|
||||||
m_Params = responseparams;
|
m_Params = responseparams;
|
||||||
SetContext( applyContext );
|
|
||||||
|
m_szContext = applyContext;
|
||||||
m_bApplyContextToWorld = bApplyContextToWorld;
|
m_bApplyContextToWorld = bApplyContextToWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,35 +279,29 @@ void AI_Response::Describe()
|
|||||||
m_pCriteria->Describe();
|
m_pCriteria->Describe();
|
||||||
}
|
}
|
||||||
if ( m_szMatchingRule[ 0 ] )
|
if ( m_szMatchingRule[ 0 ] )
|
||||||
{
|
|
||||||
DevMsg( "Matched rule '%s', ", m_szMatchingRule );
|
DevMsg( "Matched rule '%s', ", m_szMatchingRule );
|
||||||
}
|
if ( m_szContext.Length() )
|
||||||
if ( m_szContext )
|
DevMsg( "Contexts to set '%s' on %s, ", m_szContext.Get(), m_bApplyContextToWorld ? "world" : "speaker" );
|
||||||
{
|
|
||||||
DevMsg( "Contexts to set '%s' on %s, ", m_szContext, m_bApplyContextToWorld ? "world" : "speaker" );
|
|
||||||
}
|
|
||||||
|
|
||||||
DevMsg( "response %s = '%s'\n", DescribeResponse( (ResponseType_t)m_Type ), m_szResponseName );
|
DevMsg( "response %s = '%s'\n", DescribeResponse( (ResponseType_t)m_Type ), m_szResponseName );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Output : char const
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void AI_Response::GetName( char *buf, size_t buflen ) const
|
const char * AI_Response::GetNamePtr() const
|
||||||
{
|
{
|
||||||
Q_strncpy( buf, m_szResponseName, buflen );
|
return m_szResponseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Output : char const
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void AI_Response::GetResponse( char *buf, size_t buflen ) const
|
const char * AI_Response::GetResponsePtr() const
|
||||||
{
|
{
|
||||||
GetName( buf, buflen );
|
return m_szResponseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Input : type -
|
// Input : type -
|
||||||
@ -313,25 +317,15 @@ const char *AI_Response::DescribeResponse( ResponseType_t type )
|
|||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
default:
|
case RESPONSE_NONE: return "RESPONSE_NONE";
|
||||||
{
|
case RESPONSE_SPEAK: return "RESPONSE_SPEAK";
|
||||||
Assert( 0 );
|
case RESPONSE_SENTENCE: return "RESPONSE_SENTENCE";
|
||||||
}
|
case RESPONSE_SCENE: return "RESPONSE_SCENE";
|
||||||
// Fall through
|
case RESPONSE_RESPONSE: return "RESPONSE_RESPONSE";
|
||||||
case RESPONSE_NONE:
|
case RESPONSE_PRINT: return "RESPONSE_PRINT";
|
||||||
return "RESPONSE_NONE";
|
|
||||||
case RESPONSE_SPEAK:
|
|
||||||
return "RESPONSE_SPEAK";
|
|
||||||
case RESPONSE_SENTENCE:
|
|
||||||
return "RESPONSE_SENTENCE";
|
|
||||||
case RESPONSE_SCENE:
|
|
||||||
return "RESPONSE_SCENE";
|
|
||||||
case RESPONSE_RESPONSE:
|
|
||||||
return "RESPONSE_RESPONSE";
|
|
||||||
case RESPONSE_PRINT:
|
|
||||||
return "RESPONSE_PRINT";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assert( 0 );
|
||||||
return "RESPONSE_NONE";
|
return "RESPONSE_NONE";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,16 +441,7 @@ float AI_Response::GetPreDelay() const
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void AI_Response::SetContext( const char *context )
|
void AI_Response::SetContext( const char *context )
|
||||||
{
|
{
|
||||||
delete[] m_szContext;
|
m_szContext = context;
|
||||||
m_szContext = NULL;
|
|
||||||
|
|
||||||
if ( context )
|
|
||||||
{
|
|
||||||
int len = Q_strlen( context );
|
|
||||||
m_szContext = new char[ len + 1 ];
|
|
||||||
Q_memcpy( m_szContext, context, len );
|
|
||||||
m_szContext[ len ] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -84,8 +84,10 @@ private:
|
|||||||
Q_strncpy( value, str, sizeof( value ) );
|
Q_strncpy( value, str, sizeof( value ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CUtlSymbol criterianame;
|
// We use CUtlRBTree CopyFrom() in ctor, so CritEntry_t must be POD. If you add
|
||||||
|
// CUtlString or something then you must change AI_CriteriaSet copy ctor.
|
||||||
|
CUtlSymbol criterianame;
|
||||||
char value[ 64 ];
|
char value[ 64 ];
|
||||||
float weight;
|
float weight;
|
||||||
};
|
};
|
||||||
@ -178,10 +180,10 @@ public:
|
|||||||
~AI_Response();
|
~AI_Response();
|
||||||
AI_Response &operator=( const AI_Response &from );
|
AI_Response &operator=( const AI_Response &from );
|
||||||
|
|
||||||
void Release();
|
void Release();
|
||||||
|
|
||||||
void GetName( char *buf, size_t buflen ) const;
|
const char * GetNamePtr() const;
|
||||||
void GetResponse( char *buf, size_t buflen ) const;
|
const char * GetResponsePtr() const;
|
||||||
const AI_ResponseParams *GetParams() const { return &m_Params; }
|
const AI_ResponseParams *GetParams() const { return &m_Params; }
|
||||||
ResponseType_t GetType() const { return (ResponseType_t)m_Type; }
|
ResponseType_t GetType() const { return (ResponseType_t)m_Type; }
|
||||||
soundlevel_t GetSoundLevel() const;
|
soundlevel_t GetSoundLevel() const;
|
||||||
@ -195,7 +197,7 @@ public:
|
|||||||
float GetPreDelay() const;
|
float GetPreDelay() const;
|
||||||
|
|
||||||
void SetContext( const char *context );
|
void SetContext( const char *context );
|
||||||
const char * GetContext( void ) const { return m_szContext; }
|
const char * GetContext( void ) const { return m_szContext.Length() ? m_szContext.Get() : NULL; }
|
||||||
|
|
||||||
bool IsApplyContextToWorld( void ) { return m_bApplyContextToWorld; }
|
bool IsApplyContextToWorld( void ) { return m_bApplyContextToWorld; }
|
||||||
|
|
||||||
@ -230,7 +232,7 @@ private:
|
|||||||
|
|
||||||
AI_ResponseParams m_Params;
|
AI_ResponseParams m_Params;
|
||||||
|
|
||||||
char * m_szContext;
|
CUtlString m_szContext;
|
||||||
bool m_bApplyContextToWorld;
|
bool m_bApplyContextToWorld;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ void CMaterialModifyControl::InputStartFloatLerp( inputdata_t &inputdata )
|
|||||||
{
|
{
|
||||||
bool bWrap = atoi(pszParam) != 0;
|
bool bWrap = atoi(pszParam) != 0;
|
||||||
// We don't implement wrap currently.
|
// We don't implement wrap currently.
|
||||||
bWrap = bWrap;
|
NOTE_UNUSED( bWrap );
|
||||||
|
|
||||||
// Got all the parameters. Save 'em and return;
|
// Got all the parameters. Save 'em and return;
|
||||||
m_flFloatLerpStartValue = flStartValue;
|
m_flFloatLerpStartValue = flStartValue;
|
||||||
|
@ -108,6 +108,9 @@ IHandleEntity *CServerNetworkProperty::GetEntityHandle( )
|
|||||||
void CServerNetworkProperty::Release()
|
void CServerNetworkProperty::Release()
|
||||||
{
|
{
|
||||||
delete m_pOuter;
|
delete m_pOuter;
|
||||||
|
// Don't zero m_pOuter or reference any member variables after
|
||||||
|
// the delete call because the object may be deleted.
|
||||||
|
//m_pOuter = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2157,4 +2157,33 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
|
|||||||
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_IDLE );
|
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_IDLE );
|
||||||
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_ARM );
|
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_ARM );
|
||||||
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_FIRE );
|
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_FIRE );
|
||||||
|
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADSAPPER_VM_DRAW );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADSAPPER_VM_IDLE );
|
||||||
|
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_HITLEFT );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_HITRIGHT );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_SWINGHARD );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_IDLE );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_DRAW );
|
||||||
|
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_GLOVES_IDLE );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_GLOVES_HITRIGHT );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_GLOVES_HITUP );
|
||||||
|
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_VM_DRAW );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_VM_IDLE );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_VM_PRIMARYATTACK );
|
||||||
|
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_PARACHUTE_DEPLOY );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_PARACHUTE_DEPLOY_IDLE );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_PARACHUTE_RETRACT );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_PARACHUTE_RETRACT_IDLE );
|
||||||
|
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BOT_SPAWN );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BOT_PRIMARY_MOVEMENT );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BOT_GESTURE_FLINCH );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC_START );
|
||||||
|
ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC_END );
|
||||||
}
|
}
|
||||||
|
@ -7710,7 +7710,9 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
|||||||
if (!pEnemy || !pEnemy->IsAlive())
|
if (!pEnemy || !pEnemy->IsAlive())
|
||||||
{
|
{
|
||||||
if ( pEnemy )
|
if ( pEnemy )
|
||||||
|
{
|
||||||
DbgEnemyMsg( this, " %s rejected: dead\n", pEnemy->GetDebugName() );
|
DbgEnemyMsg( this, " %s rejected: dead\n", pEnemy->GetDebugName() );
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7785,7 +7787,9 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
|||||||
{
|
{
|
||||||
DbgEnemyMsg( this, " %s accepted (1)\n", pEnemy->GetDebugName() );
|
DbgEnemyMsg( this, " %s accepted (1)\n", pEnemy->GetDebugName() );
|
||||||
if ( pBestEnemy )
|
if ( pBestEnemy )
|
||||||
|
{
|
||||||
DbgEnemyMsg( this, " (%s displaced)\n", pBestEnemy->GetDebugName() );
|
DbgEnemyMsg( this, " (%s displaced)\n", pBestEnemy->GetDebugName() );
|
||||||
|
}
|
||||||
|
|
||||||
iBestPriority = IRelationPriority ( pEnemy );
|
iBestPriority = IRelationPriority ( pEnemy );
|
||||||
iBestDistSq = (pEnemy->GetAbsOrigin() - GetAbsOrigin() ).LengthSqr();
|
iBestDistSq = (pEnemy->GetAbsOrigin() - GetAbsOrigin() ).LengthSqr();
|
||||||
@ -7799,7 +7803,9 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
|||||||
{
|
{
|
||||||
DbgEnemyMsg( this, " %s accepted\n", pEnemy->GetDebugName() );
|
DbgEnemyMsg( this, " %s accepted\n", pEnemy->GetDebugName() );
|
||||||
if ( pBestEnemy )
|
if ( pBestEnemy )
|
||||||
|
{
|
||||||
DbgEnemyMsg( this, " (%s displaced due to priority, %d > %d )\n", pBestEnemy->GetDebugName(), IRelationPriority( pEnemy ), iBestPriority );
|
DbgEnemyMsg( this, " (%s displaced due to priority, %d > %d )\n", pBestEnemy->GetDebugName(), IRelationPriority( pEnemy ), iBestPriority );
|
||||||
|
}
|
||||||
// this entity is disliked MORE than the entity that we
|
// this entity is disliked MORE than the entity that we
|
||||||
// currently think is the best visible enemy. No need to do
|
// currently think is the best visible enemy. No need to do
|
||||||
// a distance check, just get mad at this one for now.
|
// a distance check, just get mad at this one for now.
|
||||||
@ -7933,7 +7939,9 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
|||||||
|
|
||||||
DbgEnemyMsg( this, " %s accepted\n", pEnemy->GetDebugName() );
|
DbgEnemyMsg( this, " %s accepted\n", pEnemy->GetDebugName() );
|
||||||
if ( pBestEnemy )
|
if ( pBestEnemy )
|
||||||
|
{
|
||||||
DbgEnemyMsg( this, " (%s displaced due to distance/visibility)\n", pBestEnemy->GetDebugName() );
|
DbgEnemyMsg( this, " (%s displaced due to distance/visibility)\n", pBestEnemy->GetDebugName() );
|
||||||
|
}
|
||||||
fBestSeen = fCurSeen;
|
fBestSeen = fCurSeen;
|
||||||
fBestVisible = fCurVisible;
|
fBestVisible = fCurVisible;
|
||||||
iBestDistSq = iDistSq;
|
iBestDistSq = iDistSq;
|
||||||
@ -7942,7 +7950,9 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
|||||||
bBestUnreachable = bUnreachable;
|
bBestUnreachable = bUnreachable;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DbgEnemyMsg( this, " %s rejected: lower priority\n", pEnemy->GetDebugName() );
|
DbgEnemyMsg( this, " %s rejected: lower priority\n", pEnemy->GetDebugName() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DbgEnemyMsg( this, "} == %s\n", pBestEnemy->GetDebugName() );
|
DbgEnemyMsg( this, "} == %s\n", pBestEnemy->GetDebugName() );
|
||||||
@ -8033,6 +8043,7 @@ float CAI_BaseNPC::CalcIdealYaw( const Vector &vecTarget )
|
|||||||
{
|
{
|
||||||
vecProjection.x = -vecTarget.y;
|
vecProjection.x = -vecTarget.y;
|
||||||
vecProjection.y = vecTarget.x;
|
vecProjection.y = vecTarget.x;
|
||||||
|
vecProjection.z = 0;
|
||||||
|
|
||||||
return UTIL_VecToYaw( vecProjection - GetLocalOrigin() );
|
return UTIL_VecToYaw( vecProjection - GetLocalOrigin() );
|
||||||
}
|
}
|
||||||
@ -8040,6 +8051,7 @@ float CAI_BaseNPC::CalcIdealYaw( const Vector &vecTarget )
|
|||||||
{
|
{
|
||||||
vecProjection.x = vecTarget.y;
|
vecProjection.x = vecTarget.y;
|
||||||
vecProjection.y = vecTarget.x;
|
vecProjection.y = vecTarget.x;
|
||||||
|
vecProjection.z = 0;
|
||||||
|
|
||||||
return UTIL_VecToYaw( vecProjection - GetLocalOrigin() );
|
return UTIL_VecToYaw( vecProjection - GetLocalOrigin() );
|
||||||
}
|
}
|
||||||
|
@ -1761,7 +1761,6 @@ public:
|
|||||||
|
|
||||||
virtual Activity GetFlinchActivity( bool bHeavyDamage, bool bGesture );
|
virtual Activity GetFlinchActivity( bool bHeavyDamage, bool bGesture );
|
||||||
|
|
||||||
virtual bool ShouldGib( const CTakeDamageInfo &info ) { return false; } // Always ragdoll, unless specified by the leaf class
|
|
||||||
virtual bool Event_Gibbed( const CTakeDamageInfo &info );
|
virtual bool Event_Gibbed( const CTakeDamageInfo &info );
|
||||||
virtual void Event_Killed( const CTakeDamageInfo &info );
|
virtual void Event_Killed( const CTakeDamageInfo &info );
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ bool CAI_LeadBehavior::GetClosestPointOnRoute( const Vector &targetPos, Vector *
|
|||||||
float flNearestDist = 999999999;
|
float flNearestDist = 999999999;
|
||||||
float flPathDist, flPathDist2D;
|
float flPathDist, flPathDist2D;
|
||||||
|
|
||||||
Vector vecNearestPoint;
|
Vector vecNearestPoint(0, 0, 0);
|
||||||
Vector vecPrevPos = GetOuter()->GetAbsOrigin();
|
Vector vecPrevPos = GetOuter()->GetAbsOrigin();
|
||||||
for ( ; (waypoint != NULL) ; waypoint = waypoint->GetNext() )
|
for ( ; (waypoint != NULL) ; waypoint = waypoint->GetNext() )
|
||||||
{
|
{
|
||||||
|
@ -1864,7 +1864,7 @@ float ChangeDistance( float flInterval, float flGoalDistance, float flGoalVeloci
|
|||||||
// I need to speed up
|
// I need to speed up
|
||||||
flNewVelocity = flCurVelocity + flGoalAccel * flInterval;
|
flNewVelocity = flCurVelocity + flGoalAccel * flInterval;
|
||||||
if (flNewVelocity > flGoalVelocity)
|
if (flNewVelocity > flGoalVelocity)
|
||||||
flGoalVelocity = flGoalVelocity;
|
flNewVelocity = flGoalVelocity;
|
||||||
}
|
}
|
||||||
else if (flNewVelocity < flIdealVelocity)
|
else if (flNewVelocity < flIdealVelocity)
|
||||||
{
|
{
|
||||||
|
@ -51,8 +51,8 @@ enum AIMsgFlags
|
|||||||
AIMF_IGNORE_SELECTED = 0x01
|
AIMF_IGNORE_SELECTED = 0x01
|
||||||
};
|
};
|
||||||
|
|
||||||
void DevMsg( CAI_BaseNPC *pAI, unsigned flags, PRINTF_FORMAT_STRING const char *pszFormat, ... );
|
void DevMsg( CAI_BaseNPC *pAI, unsigned flags, PRINTF_FORMAT_STRING const char *pszFormat, ... ) FMTFUNCTION( 3, 4 );
|
||||||
void DevMsg( CAI_BaseNPC *pAI, PRINTF_FORMAT_STRING const char *pszFormat, ... );
|
void DevMsg( CAI_BaseNPC *pAI, PRINTF_FORMAT_STRING const char *pszFormat, ... ) FMTFUNCTION( 2, 3 );
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -114,7 +114,7 @@ bool CAI_MoveSolver::Solve( const AI_MoveSuggestion_t *pSuggestions, int nSugges
|
|||||||
AI_MoveSuggestion_t *pHighSuggestion;
|
AI_MoveSuggestion_t *pHighSuggestion;
|
||||||
};
|
};
|
||||||
|
|
||||||
Solution_t solutions[NUM_SOLUTIONS] = { 0 };
|
Solution_t solutions[NUM_SOLUTIONS] = { { 0, 0, NULL } };
|
||||||
|
|
||||||
//---------------------------------
|
//---------------------------------
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ extern ConVar ai_debug_nav;
|
|||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (DbgNav()) \
|
if (DbgNav()) \
|
||||||
DevMsg( pAI, CFmtStr( "[Nav] %s", static_cast<const char *>(pszMsg) ) ); \
|
DevMsg( pAI, "[Nav] %s", static_cast<const char *>(pszMsg) ); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define DbgNavMsg1( pAI, pszMsg, a ) DbgNavMsg( pAI, CFmtStr(static_cast<const char *>(pszMsg), (a) ) )
|
#define DbgNavMsg1( pAI, pszMsg, a ) DbgNavMsg( pAI, CFmtStr(static_cast<const char *>(pszMsg), (a) ) )
|
||||||
#define DbgNavMsg2( pAI, pszMsg, a, b ) DbgNavMsg( pAI, CFmtStr(static_cast<const char *>(pszMsg), (a), (b) ) )
|
#define DbgNavMsg2( pAI, pszMsg, a, b ) DbgNavMsg( pAI, CFmtStr(static_cast<const char *>(pszMsg), (a), (b) ) )
|
||||||
|
@ -548,10 +548,11 @@ void CAI_PlayerAlly::PrescheduleThink( void )
|
|||||||
if ( m_flNextIdleSpeechTime && m_flNextIdleSpeechTime < gpGlobals->curtime )
|
if ( m_flNextIdleSpeechTime && m_flNextIdleSpeechTime < gpGlobals->curtime )
|
||||||
{
|
{
|
||||||
AISpeechSelection_t selection;
|
AISpeechSelection_t selection;
|
||||||
|
|
||||||
if ( SelectNonCombatSpeech( &selection ) )
|
if ( SelectNonCombatSpeech( &selection ) )
|
||||||
{
|
{
|
||||||
SetSpeechTarget( selection.hSpeechTarget );
|
SetSpeechTarget( selection.hSpeechTarget );
|
||||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||||
m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 );
|
m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -593,22 +594,23 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM
|
|||||||
{
|
{
|
||||||
if ( IsAllowedToSpeak( concept ) )
|
if ( IsAllowedToSpeak( concept ) )
|
||||||
{
|
{
|
||||||
AI_Response *pResponse = SpeakFindResponse( concept, pszModifiers );
|
bool result = SpeakFindResponse( pSelection->Response, concept, pszModifiers );
|
||||||
if ( pResponse )
|
if ( result )
|
||||||
{
|
{
|
||||||
pSelection->Set( concept, pResponse, pTarget );
|
pSelection->concept = concept;
|
||||||
|
pSelection->hSpeechTarget = pTarget;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse )
|
void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response &Response )
|
||||||
{
|
{
|
||||||
m_PendingResponse = *pResponse;
|
m_PendingResponse = Response;
|
||||||
pResponse->Release();
|
|
||||||
m_PendingConcept = concept;
|
m_PendingConcept = concept;
|
||||||
m_TimePendingSet = gpGlobals->curtime;
|
m_TimePendingSet = gpGlobals->curtime;
|
||||||
}
|
}
|
||||||
@ -690,7 +692,7 @@ bool CAI_PlayerAlly::SelectInterjection()
|
|||||||
if ( SelectIdleSpeech( &selection ) )
|
if ( SelectIdleSpeech( &selection ) )
|
||||||
{
|
{
|
||||||
SetSpeechTarget( selection.hSpeechTarget );
|
SetSpeechTarget( selection.hSpeechTarget );
|
||||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -889,9 +891,8 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert( selection.pResponse );
|
|
||||||
SetSpeechTarget( selection.hSpeechTarget );
|
SetSpeechTarget( selection.hSpeechTarget );
|
||||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||||
|
|
||||||
// Prevent idle speech for a while
|
// Prevent idle speech for a while
|
||||||
DeferAllIdleSpeech( random->RandomFloat( TALKER_DEFER_IDLE_SPEAK_MIN, TALKER_DEFER_IDLE_SPEAK_MAX ), GetSpeechTarget()->MyNPCPointer() );
|
DeferAllIdleSpeech( random->RandomFloat( TALKER_DEFER_IDLE_SPEAK_MIN, TALKER_DEFER_IDLE_SPEAK_MAX ), GetSpeechTarget()->MyNPCPointer() );
|
||||||
@ -939,11 +940,11 @@ int CAI_PlayerAlly::SelectNonCombatSpeechSchedule()
|
|||||||
if ( !HasPendingSpeech() )
|
if ( !HasPendingSpeech() )
|
||||||
{
|
{
|
||||||
AISpeechSelection_t selection;
|
AISpeechSelection_t selection;
|
||||||
|
|
||||||
if ( SelectNonCombatSpeech( &selection ) )
|
if ( SelectNonCombatSpeech( &selection ) )
|
||||||
{
|
{
|
||||||
Assert( selection.pResponse );
|
|
||||||
SetSpeechTarget( selection.hSpeechTarget );
|
SetSpeechTarget( selection.hSpeechTarget );
|
||||||
SetPendingSpeech( selection.concept.c_str(), selection.pResponse );
|
SetPendingSpeech( selection.concept.c_str(), selection.Response );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,14 +1019,14 @@ void CAI_PlayerAlly::StartTask( const Task_t *pTask )
|
|||||||
case TASK_TALKER_SPEAK_PENDING:
|
case TASK_TALKER_SPEAK_PENDING:
|
||||||
if ( !m_PendingConcept.empty() )
|
if ( !m_PendingConcept.empty() )
|
||||||
{
|
{
|
||||||
AI_Response *pResponse = new AI_Response;
|
SpeakDispatchResponse( m_PendingConcept.c_str(), m_PendingResponse );
|
||||||
*pResponse = m_PendingResponse;
|
|
||||||
SpeakDispatchResponse( m_PendingConcept.c_str(), pResponse );
|
|
||||||
m_PendingConcept.erase();
|
m_PendingConcept.erase();
|
||||||
TaskComplete();
|
TaskComplete();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
TaskFail( FAIL_NO_SOUND );
|
TaskFail( FAIL_NO_SOUND );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1692,15 +1693,15 @@ bool CAI_PlayerAlly::RespondedTo( const char *ResponseConcept, bool bForce, bool
|
|||||||
{
|
{
|
||||||
// We're being forced to respond to the event, probably because it's the
|
// We're being forced to respond to the event, probably because it's the
|
||||||
// player dying or something equally important.
|
// player dying or something equally important.
|
||||||
AI_Response *result = SpeakFindResponse( ResponseConcept, NULL );
|
AI_Response response;
|
||||||
|
bool result = SpeakFindResponse( response, ResponseConcept, NULL );
|
||||||
if ( result )
|
if ( result )
|
||||||
{
|
{
|
||||||
// We've got something to say. Stop any scenes we're in, and speak the response.
|
// We've got something to say. Stop any scenes we're in, and speak the response.
|
||||||
if ( bCancelScene )
|
if ( bCancelScene )
|
||||||
RemoveActorFromScriptedScenes( this, false );
|
RemoveActorFromScriptedScenes( this, false );
|
||||||
|
|
||||||
bool spoke = SpeakDispatchResponse( ResponseConcept, result );
|
return SpeakDispatchResponse( ResponseConcept, response );
|
||||||
return spoke;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -248,21 +248,9 @@ enum AISpeechTargetSearchFlags_t
|
|||||||
|
|
||||||
struct AISpeechSelection_t
|
struct AISpeechSelection_t
|
||||||
{
|
{
|
||||||
AISpeechSelection_t()
|
std::string concept;
|
||||||
: pResponse(NULL)
|
AI_Response Response;
|
||||||
{
|
EHANDLE hSpeechTarget;
|
||||||
}
|
|
||||||
|
|
||||||
void Set( AIConcept_t newConcept, AI_Response *pNewResponse, CBaseEntity *pTarget = NULL )
|
|
||||||
{
|
|
||||||
pResponse = pNewResponse;
|
|
||||||
concept = newConcept;
|
|
||||||
hSpeechTarget = pTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string concept;
|
|
||||||
AI_Response * pResponse;
|
|
||||||
EHANDLE hSpeechTarget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
@ -347,7 +335,7 @@ public:
|
|||||||
//---------------------------------
|
//---------------------------------
|
||||||
|
|
||||||
bool SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection );
|
bool SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection );
|
||||||
void SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse );
|
void SetPendingSpeech( AIConcept_t concept, AI_Response &Response );
|
||||||
void ClearPendingSpeech();
|
void ClearPendingSpeech();
|
||||||
bool HasPendingSpeech() { return !m_PendingConcept.empty(); }
|
bool HasPendingSpeech() { return !m_PendingConcept.empty(); }
|
||||||
|
|
||||||
|
@ -38,10 +38,7 @@ CAI_TimedSemaphore g_AIFoesTalkSemaphore;
|
|||||||
|
|
||||||
ConceptHistory_t::~ConceptHistory_t()
|
ConceptHistory_t::~ConceptHistory_t()
|
||||||
{
|
{
|
||||||
if ( response )
|
delete response;
|
||||||
{
|
|
||||||
delete response;
|
|
||||||
}
|
|
||||||
response = NULL;
|
response = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,14 +54,16 @@ ConceptHistory_t::ConceptHistory_t( const ConceptHistory_t& src )
|
|||||||
|
|
||||||
ConceptHistory_t& ConceptHistory_t::operator =( const ConceptHistory_t& src )
|
ConceptHistory_t& ConceptHistory_t::operator =( const ConceptHistory_t& src )
|
||||||
{
|
{
|
||||||
if ( this == &src )
|
if ( this != &src )
|
||||||
return *this;
|
|
||||||
|
|
||||||
timeSpoken = src.timeSpoken;
|
|
||||||
response = NULL;
|
|
||||||
if ( src.response )
|
|
||||||
{
|
{
|
||||||
response = new AI_Response( *src.response );
|
timeSpoken = src.timeSpoken;
|
||||||
|
|
||||||
|
delete response;
|
||||||
|
response = NULL;
|
||||||
|
if ( src.response )
|
||||||
|
{
|
||||||
|
response = new AI_Response( *src.response );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -89,14 +88,14 @@ public:
|
|||||||
|
|
||||||
pSave->StartBlock();
|
pSave->StartBlock();
|
||||||
{
|
{
|
||||||
|
|
||||||
// Write element name
|
// Write element name
|
||||||
pSave->WriteString( ch->GetElementName( i ) );
|
pSave->WriteString( ch->GetElementName( i ) );
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
pSave->WriteAll( pHistory );
|
pSave->WriteAll( pHistory );
|
||||||
|
|
||||||
// Write response blob
|
// Write response blob
|
||||||
bool hasresponse = pHistory->response != NULL ? true : false;
|
bool hasresponse = !!pHistory->response;
|
||||||
pSave->WriteBool( &hasresponse );
|
pSave->WriteBool( &hasresponse );
|
||||||
if ( hasresponse )
|
if ( hasresponse )
|
||||||
{
|
{
|
||||||
@ -118,6 +117,7 @@ public:
|
|||||||
{
|
{
|
||||||
char conceptname[ 512 ];
|
char conceptname[ 512 ];
|
||||||
conceptname[ 0 ] = 0;
|
conceptname[ 0 ] = 0;
|
||||||
|
|
||||||
ConceptHistory_t history;
|
ConceptHistory_t history;
|
||||||
|
|
||||||
pRestore->StartBlock();
|
pRestore->StartBlock();
|
||||||
@ -127,7 +127,6 @@ public:
|
|||||||
pRestore->ReadAll( &history );
|
pRestore->ReadAll( &history );
|
||||||
|
|
||||||
bool hasresponse = false;
|
bool hasresponse = false;
|
||||||
|
|
||||||
pRestore->ReadBool( &hasresponse );
|
pRestore->ReadBool( &hasresponse );
|
||||||
if ( hasresponse )
|
if ( hasresponse )
|
||||||
{
|
{
|
||||||
@ -151,7 +150,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void MakeEmpty( const SaveRestoreFieldInfo_t &fieldInfo )
|
virtual void MakeEmpty( const SaveRestoreFieldInfo_t &fieldInfo )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -251,14 +250,14 @@ void CAI_Expresser::TestAllResponses()
|
|||||||
if ( pResponseSystem )
|
if ( pResponseSystem )
|
||||||
{
|
{
|
||||||
CUtlVector<AI_Response *> responses;
|
CUtlVector<AI_Response *> responses;
|
||||||
|
|
||||||
pResponseSystem->GetAllResponses( &responses );
|
pResponseSystem->GetAllResponses( &responses );
|
||||||
for ( int i = 0; i < responses.Count(); i++ )
|
for ( int i = 0; i < responses.Count(); i++ )
|
||||||
{
|
{
|
||||||
char response[ 256 ];
|
const char *szResponse = responses[i]->GetResponsePtr();
|
||||||
responses[i]->GetResponse( response, sizeof( response ) );
|
|
||||||
|
|
||||||
Msg( "Response: %s\n", response );
|
Msg( "Response: %s\n", szResponse );
|
||||||
SpeakDispatchResponse( "", responses[i] );
|
SpeakDispatchResponse( "", *responses[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,13 +272,13 @@ static const int LEN_SPECIFIC_SCENE_MODIFIER = strlen( AI_SPECIFIC_SCENE_MODIFIE
|
|||||||
// NULL -
|
// NULL -
|
||||||
// Output : AI_Response
|
// Output : AI_Response
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
bool CAI_Expresser::SpeakFindResponse( AI_Response &outResponse, AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
||||||
{
|
{
|
||||||
IResponseSystem *rs = GetOuter()->GetResponseSystem();
|
IResponseSystem *rs = GetOuter()->GetResponseSystem();
|
||||||
if ( !rs )
|
if ( !rs )
|
||||||
{
|
{
|
||||||
Assert( !"No response system installed for CAI_Expresser::GetOuter()!!!" );
|
Assert( !"No response system installed for CAI_Expresser::GetOuter()!!!" );
|
||||||
return NULL;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AI_CriteriaSet set;
|
AI_CriteriaSet set;
|
||||||
@ -287,7 +286,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *
|
|||||||
set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT );
|
set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT );
|
||||||
|
|
||||||
// Always include any optional modifiers
|
// Always include any optional modifiers
|
||||||
if ( modifiers != NULL )
|
if ( modifiers )
|
||||||
{
|
{
|
||||||
char copy_modifiers[ 255 ];
|
char copy_modifiers[ 255 ];
|
||||||
const char *pCopy;
|
const char *pCopy;
|
||||||
@ -320,30 +319,19 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now that we have a criteria set, ask for a suitable response
|
// Now that we have a criteria set, ask for a suitable response
|
||||||
AI_Response *result = new AI_Response;
|
bool found = rs->FindBestResponse( set, outResponse, this );
|
||||||
Assert( result && "new AI_Response: Returned a NULL AI_Response!" );
|
|
||||||
bool found = rs->FindBestResponse( set, *result, this );
|
|
||||||
|
|
||||||
if ( rr_debugresponses.GetInt() == 3 )
|
if ( rr_debugresponses.GetInt() == 3 )
|
||||||
{
|
{
|
||||||
if ( ( GetOuter()->MyNPCPointer() && GetOuter()->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT ) || GetOuter()->IsPlayer() )
|
if ( ( GetOuter()->MyNPCPointer() && GetOuter()->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT ) || GetOuter()->IsPlayer() )
|
||||||
{
|
{
|
||||||
const char *pszName;
|
const char *pszName = GetOuter()->IsPlayer() ?
|
||||||
if ( GetOuter()->IsPlayer() )
|
((CBasePlayer*)GetOuter())->GetPlayerName() : GetOuter()->GetDebugName();
|
||||||
{
|
|
||||||
pszName = ((CBasePlayer*)GetOuter())->GetPlayerName();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pszName = GetOuter()->GetDebugName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( found )
|
if ( found )
|
||||||
{
|
{
|
||||||
char response[ 256 ];
|
const char *szReponse = outResponse.GetResponsePtr();
|
||||||
result->GetResponse( response, sizeof( response ) );
|
Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, szReponse );
|
||||||
|
|
||||||
Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, response );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -353,44 +341,28 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !found )
|
if ( !found )
|
||||||
{
|
return false;
|
||||||
//Assert( !"rs->FindBestResponse: Returned a NULL AI_Response!" );
|
|
||||||
delete result;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
char response[ 256 ];
|
const char *szReponse = outResponse.GetResponsePtr();
|
||||||
result->GetResponse( response, sizeof( response ) );
|
if ( !szReponse[0] )
|
||||||
|
return false;
|
||||||
|
|
||||||
if ( !response[0] )
|
if ( ( outResponse.GetOdds() < 100 ) && ( random->RandomInt( 1, 100 ) <= outResponse.GetOdds() ) )
|
||||||
{
|
return false;
|
||||||
delete result;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( result->GetOdds() < 100 && random->RandomInt( 1, 100 ) <= result->GetOdds() )
|
return true;
|
||||||
{
|
|
||||||
delete result;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Dispatches the result
|
// Purpose: Dispatches the result
|
||||||
// Input : *response -
|
// Input : *response -
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, IRecipientFilter *filter /* = NULL */ )
|
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response& response, IRecipientFilter *filter /* = NULL */ )
|
||||||
{
|
{
|
||||||
char response[ 256 ];
|
|
||||||
result->GetResponse( response, sizeof( response ) );
|
|
||||||
|
|
||||||
float delay = result->GetDelay();
|
|
||||||
|
|
||||||
bool spoke = false;
|
bool spoke = false;
|
||||||
|
float delay = response.GetDelay();
|
||||||
soundlevel_t soundlevel = result->GetSoundLevel();
|
const char *szResponse = response.GetResponsePtr();
|
||||||
|
soundlevel_t soundlevel = response.GetSoundLevel();
|
||||||
|
|
||||||
if ( IsSpeaking() && concept[0] != 0 )
|
if ( IsSpeaking() && concept[0] != 0 )
|
||||||
{
|
{
|
||||||
@ -404,63 +376,52 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
|
|||||||
if ( IsRunningScriptedScene( GetOuter() ) )
|
if ( IsRunningScriptedScene( GetOuter() ) )
|
||||||
{
|
{
|
||||||
DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), STRING( GetOuter()->GetEntityName() ), concept );
|
DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), STRING( GetOuter()->GetEntityName() ), concept );
|
||||||
delete result;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( result->GetType() )
|
switch ( response.GetType() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case RESPONSE_NONE:
|
case RESPONSE_NONE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPONSE_SPEAK:
|
case RESPONSE_SPEAK:
|
||||||
|
if ( !response.ShouldntUseScene() )
|
||||||
{
|
{
|
||||||
if ( !result->ShouldntUseScene() )
|
// This generates a fake CChoreoScene wrapping the sound.txt name
|
||||||
{
|
spoke = SpeakAutoGeneratedScene( szResponse, delay );
|
||||||
// This generates a fake CChoreoScene wrapping the sound.txt name
|
}
|
||||||
spoke = SpeakAutoGeneratedScene( response, delay );
|
else
|
||||||
}
|
{
|
||||||
else
|
float speakTime = GetResponseDuration( response );
|
||||||
{
|
GetOuter()->EmitSound( szResponse );
|
||||||
float speakTime = GetResponseDuration( result );
|
|
||||||
GetOuter()->EmitSound( response );
|
|
||||||
|
|
||||||
DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) playing sound '%s'\n", GetOuter()->entindex(), STRING( GetOuter()->GetEntityName() ), response );
|
DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) playing sound '%s'\n", GetOuter()->entindex(), STRING( GetOuter()->GetEntityName() ), szResponse );
|
||||||
NoteSpeaking( speakTime, delay );
|
NoteSpeaking( speakTime, delay );
|
||||||
spoke = true;
|
spoke = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPONSE_SENTENCE:
|
case RESPONSE_SENTENCE:
|
||||||
{
|
spoke = ( -1 != SpeakRawSentence( szResponse, delay, VOL_NORM, soundlevel ) ) ? true : false;
|
||||||
spoke = ( -1 != SpeakRawSentence( response, delay, VOL_NORM, soundlevel ) ) ? true : false;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPONSE_SCENE:
|
case RESPONSE_SCENE:
|
||||||
{
|
spoke = SpeakRawScene( szResponse, delay, &response, filter );
|
||||||
spoke = SpeakRawScene( response, delay, result, filter );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPONSE_RESPONSE:
|
case RESPONSE_RESPONSE:
|
||||||
{
|
// This should have been recursively resolved already
|
||||||
// This should have been recursively resolved already
|
Assert( 0 );
|
||||||
Assert( 0 );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case RESPONSE_PRINT:
|
case RESPONSE_PRINT:
|
||||||
|
if ( g_pDeveloper->GetInt() > 0 )
|
||||||
{
|
{
|
||||||
if ( g_pDeveloper->GetInt() > 0 )
|
Vector vPrintPos;
|
||||||
{
|
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
|
||||||
Vector vPrintPos;
|
NDebugOverlay::Text( vPrintPos, szResponse, true, 1.5 );
|
||||||
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
|
spoke = true;
|
||||||
NDebugOverlay::Text( vPrintPos, response, true, 1.5 );
|
|
||||||
spoke = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -468,30 +429,27 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
|
|||||||
if ( spoke )
|
if ( spoke )
|
||||||
{
|
{
|
||||||
m_flLastTimeAcceptedSpeak = gpGlobals->curtime;
|
m_flLastTimeAcceptedSpeak = gpGlobals->curtime;
|
||||||
if ( DebuggingSpeech() && g_pDeveloper->GetInt() > 0 && response && result->GetType() != RESPONSE_PRINT )
|
if ( DebuggingSpeech() && g_pDeveloper->GetInt() > 0 && response.GetType() != RESPONSE_PRINT )
|
||||||
{
|
{
|
||||||
Vector vPrintPos;
|
Vector vPrintPos;
|
||||||
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
|
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
|
||||||
NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", concept, response ), true, 1.5 );
|
NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", concept, szResponse ), true, 1.5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( result->IsApplyContextToWorld() )
|
if ( response.IsApplyContextToWorld() )
|
||||||
{
|
{
|
||||||
CBaseEntity *pEntity = CBaseEntity::Instance( engine->PEntityOfEntIndex( 0 ) );
|
CBaseEntity *pEntity = CBaseEntity::Instance( engine->PEntityOfEntIndex( 0 ) );
|
||||||
if ( pEntity )
|
if ( pEntity )
|
||||||
{
|
{
|
||||||
pEntity->AddContext( result->GetContext() );
|
pEntity->AddContext( response.GetContext() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetOuter()->AddContext( result->GetContext() );
|
GetOuter()->AddContext( response.GetContext() );
|
||||||
}
|
}
|
||||||
SetSpokeConcept( concept, result );
|
|
||||||
}
|
SetSpokeConcept( concept, &response );
|
||||||
else
|
|
||||||
{
|
|
||||||
delete result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return spoke;
|
return spoke;
|
||||||
@ -502,44 +460,33 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
|
|||||||
// Input : *response -
|
// Input : *response -
|
||||||
// Output : float
|
// Output : float
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
float CAI_Expresser::GetResponseDuration( AI_Response *result )
|
float CAI_Expresser::GetResponseDuration( AI_Response& response )
|
||||||
{
|
{
|
||||||
Assert( result );
|
const char *szResponse = response.GetResponsePtr();
|
||||||
char response[ 256 ];
|
|
||||||
result->GetResponse( response, sizeof( response ) );
|
|
||||||
|
|
||||||
switch ( result->GetType() )
|
switch ( response.GetType() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case RESPONSE_NONE:
|
case RESPONSE_NONE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPONSE_SPEAK:
|
case RESPONSE_SPEAK:
|
||||||
{
|
return GetOuter()->GetSoundDuration( szResponse, STRING( GetOuter()->GetModelName() ) );
|
||||||
return GetOuter()->GetSoundDuration( response, STRING( GetOuter()->GetModelName() ) );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RESPONSE_SENTENCE:
|
case RESPONSE_SENTENCE:
|
||||||
{
|
Assert( 0 );
|
||||||
Assert( 0 );
|
return 999.0f;
|
||||||
return 999.0f;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RESPONSE_SCENE:
|
case RESPONSE_SCENE:
|
||||||
{
|
return GetSceneDuration( szResponse );
|
||||||
return GetSceneDuration( response );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RESPONSE_RESPONSE:
|
case RESPONSE_RESPONSE:
|
||||||
{
|
// This should have been recursively resolved already
|
||||||
// This should have been recursively resolved already
|
Assert( 0 );
|
||||||
Assert( 0 );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPONSE_PRINT:
|
case RESPONSE_PRINT:
|
||||||
{
|
return 1.0;
|
||||||
return 1.0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
@ -552,18 +499,18 @@ float CAI_Expresser::GetResponseDuration( AI_Response *result )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
|
bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
|
||||||
{
|
{
|
||||||
AI_Response *result = SpeakFindResponse( concept, modifiers );
|
AI_Response response;
|
||||||
|
bool result = SpeakFindResponse( response, concept, modifiers );
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)\n", STRING(GetOuter()->GetEntityName()), GetOuter(), concept, gpGlobals->curtime );
|
SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)\n", STRING(GetOuter()->GetEntityName()), GetOuter(), concept, gpGlobals->curtime );
|
||||||
|
|
||||||
bool spoke = SpeakDispatchResponse( concept, result, filter );
|
bool spoke = SpeakDispatchResponse( concept, response, filter );
|
||||||
if ( pszOutResponseChosen )
|
if ( pszOutResponseChosen )
|
||||||
{
|
{
|
||||||
result->GetResponse( pszOutResponseChosen, bufsize );
|
const char *szResponse = response.GetResponsePtr();
|
||||||
|
Q_strncpy( pszOutResponseChosen, szResponse, bufsize );
|
||||||
}
|
}
|
||||||
|
|
||||||
return spoke;
|
return spoke;
|
||||||
@ -808,17 +755,12 @@ void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response,
|
|||||||
ConceptHistory_t *slot = &m_ConceptHistories[ idx ];
|
ConceptHistory_t *slot = &m_ConceptHistories[ idx ];
|
||||||
|
|
||||||
slot->timeSpoken = gpGlobals->curtime;
|
slot->timeSpoken = gpGlobals->curtime;
|
||||||
|
|
||||||
// Update response info
|
// Update response info
|
||||||
if ( response )
|
if ( response )
|
||||||
{
|
{
|
||||||
AI_Response *r = slot->response;
|
delete slot->response;
|
||||||
if ( r )
|
slot->response = new AI_Response( *response );
|
||||||
{
|
|
||||||
delete r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Are we leaking AI_Responses?
|
|
||||||
slot->response = response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bCallback )
|
if ( bCallback )
|
||||||
@ -885,13 +827,13 @@ void CAI_Expresser::SpeechMsg( CBaseEntity *pFlex, const char *pszFormat, ... )
|
|||||||
|
|
||||||
if ( pFlex->MyNPCPointer() )
|
if ( pFlex->MyNPCPointer() )
|
||||||
{
|
{
|
||||||
DevMsg( pFlex->MyNPCPointer(), string );
|
DevMsg( pFlex->MyNPCPointer(), "%s", string );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DevMsg( "%s", string );
|
DevMsg( "%s", string );
|
||||||
}
|
}
|
||||||
UTIL_LogPrintf( string );
|
UTIL_LogPrintf( "%s", string );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ struct ConceptHistory_t
|
|||||||
ConceptHistory_t& operator = ( const ConceptHistory_t& src );
|
ConceptHistory_t& operator = ( const ConceptHistory_t& src );
|
||||||
|
|
||||||
~ConceptHistory_t();
|
~ConceptHistory_t();
|
||||||
|
|
||||||
float timeSpoken;
|
float timeSpoken;
|
||||||
AI_Response *response;
|
AI_Response *response;
|
||||||
};
|
};
|
||||||
@ -159,9 +159,9 @@ public:
|
|||||||
bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||||
|
|
||||||
// These two methods allow looking up a response and dispatching it to be two different steps
|
// These two methods allow looking up a response and dispatching it to be two different steps
|
||||||
AI_Response *SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
|
bool SpeakFindResponse( AI_Response &response, AIConcept_t concept, const char *modifiers = NULL );
|
||||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL );
|
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response &response, IRecipientFilter *filter = NULL );
|
||||||
float GetResponseDuration( AI_Response *response );
|
float GetResponseDuration( AI_Response &response );
|
||||||
|
|
||||||
virtual int SpeakRawSentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL );
|
virtual int SpeakRawSentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL );
|
||||||
|
|
||||||
@ -283,10 +283,10 @@ public:
|
|||||||
virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||||
|
|
||||||
// These two methods allow looking up a response and dispatching it to be two different steps
|
// These two methods allow looking up a response and dispatching it to be two different steps
|
||||||
AI_Response * SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
|
bool SpeakFindResponse( AI_Response& response, AIConcept_t concept, const char *modifiers = NULL );
|
||||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response );
|
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response& response );
|
||||||
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; }
|
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response& response ) { return; }
|
||||||
float GetResponseDuration( AI_Response *response );
|
float GetResponseDuration( AI_Response& response );
|
||||||
|
|
||||||
float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); }
|
float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); }
|
||||||
|
|
||||||
@ -360,15 +360,15 @@ inline IResponseSystem *CAI_ExpresserHost<BASE_NPC>::GetResponseSystem()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AI_Response& response, AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
||||||
{
|
{
|
||||||
return this->GetExpresser()->SpeakFindResponse( concept, modifiers );
|
return this->GetExpresser()->SpeakFindResponse( response, concept, modifiers );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t concept, AI_Response *response )
|
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t concept, AI_Response& response )
|
||||||
{
|
{
|
||||||
if ( this->GetExpresser()->SpeakDispatchResponse( concept, response ) )
|
if ( this->GetExpresser()->SpeakDispatchResponse( concept, response ) )
|
||||||
{
|
{
|
||||||
@ -382,7 +382,7 @@ inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t conc
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline float CAI_ExpresserHost<BASE_NPC>::GetResponseDuration( AI_Response *response )
|
inline float CAI_ExpresserHost<BASE_NPC>::GetResponseDuration( AI_Response& response )
|
||||||
{
|
{
|
||||||
return this->GetExpresser()->GetResponseDuration( response );
|
return this->GetExpresser()->GetResponseDuration( response );
|
||||||
}
|
}
|
||||||
|
@ -344,6 +344,8 @@ void CBaseEntityModelLoadProxy::Handler::OnModelLoadComplete( const model_t *pMo
|
|||||||
|
|
||||||
CBaseEntity::CBaseEntity( bool bServerOnly )
|
CBaseEntity::CBaseEntity( bool bServerOnly )
|
||||||
{
|
{
|
||||||
|
m_pAttributes = NULL;
|
||||||
|
|
||||||
COMPILE_TIME_ASSERT( MOVETYPE_LAST < (1 << MOVETYPE_MAX_BITS) );
|
COMPILE_TIME_ASSERT( MOVETYPE_LAST < (1 << MOVETYPE_MAX_BITS) );
|
||||||
COMPILE_TIME_ASSERT( MOVECOLLIDE_COUNT < (1 << MOVECOLLIDE_MAX_BITS) );
|
COMPILE_TIME_ASSERT( MOVECOLLIDE_COUNT < (1 << MOVECOLLIDE_MAX_BITS) );
|
||||||
|
|
||||||
@ -4822,7 +4824,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex )
|
|||||||
char token[256];
|
char token[256];
|
||||||
const char *pOptions = pEvent->pszOptions();
|
const char *pOptions = pEvent->pszOptions();
|
||||||
nexttoken( token, pOptions, ' ' );
|
nexttoken( token, pOptions, ' ' );
|
||||||
if ( token )
|
if ( token[0] )
|
||||||
{
|
{
|
||||||
PrecacheParticleSystem( token );
|
PrecacheParticleSystem( token );
|
||||||
}
|
}
|
||||||
@ -4908,7 +4910,9 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload )
|
|||||||
{
|
{
|
||||||
if ( !name || !*name )
|
if ( !name || !*name )
|
||||||
{
|
{
|
||||||
|
#ifdef STAGING_ONLY
|
||||||
Msg( "Attempting to precache model, but model name is NULL\n");
|
Msg( "Attempting to precache model, but model name is NULL\n");
|
||||||
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4917,8 +4921,7 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload )
|
|||||||
{
|
{
|
||||||
if ( !engine->IsModelPrecached( name ) )
|
if ( !engine->IsModelPrecached( name ) )
|
||||||
{
|
{
|
||||||
Assert( !"CBaseEntity::PrecacheModel: too late" );
|
DevMsg( "Late precache of %s -- not necessarily a bug now that we allow ~everything to be dynamically loaded.\n", name );
|
||||||
Warning( "Late precache of %s\n", name );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined( WATCHACCESS )
|
#if defined( WATCHACCESS )
|
||||||
@ -5316,11 +5319,6 @@ void CC_Ent_FireTarget( const CCommand& args )
|
|||||||
}
|
}
|
||||||
static ConCommand firetarget("firetarget", CC_Ent_FireTarget, 0, FCVAR_CHEAT);
|
static ConCommand firetarget("firetarget", CC_Ent_FireTarget, 0, FCVAR_CHEAT);
|
||||||
|
|
||||||
static bool UtlStringLessFunc( const CUtlString &lhs, const CUtlString &rhs )
|
|
||||||
{
|
|
||||||
return Q_stricmp( lhs.String(), rhs.String() ) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
class CEntFireAutoCompletionFunctor : public ICommandCallback, public ICommandCompletionCallback
|
class CEntFireAutoCompletionFunctor : public ICommandCallback, public ICommandCompletionCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -6656,23 +6654,19 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
|
|||||||
AI_Response result;
|
AI_Response result;
|
||||||
bool found = rs->FindBestResponse( set, result );
|
bool found = rs->FindBestResponse( set, result );
|
||||||
if ( !found )
|
if ( !found )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the response here...
|
// Handle the response here...
|
||||||
char response[ 256 ];
|
const char *szResponse = result.GetResponsePtr();
|
||||||
result.GetResponse( response, sizeof( response ) );
|
|
||||||
switch ( result.GetType() )
|
switch ( result.GetType() )
|
||||||
{
|
{
|
||||||
case RESPONSE_SPEAK:
|
case RESPONSE_SPEAK:
|
||||||
{
|
EmitSound( szResponse );
|
||||||
EmitSound( response );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPONSE_SENTENCE:
|
case RESPONSE_SENTENCE:
|
||||||
{
|
{
|
||||||
int sentenceIndex = SENTENCEG_Lookup( response );
|
int sentenceIndex = SENTENCEG_Lookup( szResponse );
|
||||||
if( sentenceIndex == -1 )
|
if( sentenceIndex == -1 )
|
||||||
{
|
{
|
||||||
// sentence not found
|
// sentence not found
|
||||||
@ -6684,16 +6678,13 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
|
|||||||
CBaseEntity::EmitSentenceByIndex( filter, entindex(), CHAN_VOICE, sentenceIndex, 1, result.GetSoundLevel(), 0, PITCH_NORM );
|
CBaseEntity::EmitSentenceByIndex( filter, entindex(), CHAN_VOICE, sentenceIndex, 1, result.GetSoundLevel(), 0, PITCH_NORM );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RESPONSE_SCENE:
|
|
||||||
{
|
|
||||||
// Try to fire scene w/o an actor
|
|
||||||
InstancedScriptedScene( NULL, response );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RESPONSE_PRINT:
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
case RESPONSE_SCENE:
|
||||||
|
// Try to fire scene w/o an actor
|
||||||
|
InstancedScriptedScene( NULL, szResponse );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RESPONSE_PRINT:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Don't know how to handle .vcds!!!
|
// Don't know how to handle .vcds!!!
|
||||||
@ -7051,7 +7042,7 @@ void CBaseEntity::SetRefEHandle( const CBaseHandle &handle )
|
|||||||
if ( edict() )
|
if ( edict() )
|
||||||
{
|
{
|
||||||
COMPILE_TIME_ASSERT( NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS <= 8*sizeof( edict()->m_NetworkSerialNumber ) );
|
COMPILE_TIME_ASSERT( NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS <= 8*sizeof( edict()->m_NetworkSerialNumber ) );
|
||||||
edict()->m_NetworkSerialNumber = (m_RefEHandle.GetSerialNumber() & (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1);
|
edict()->m_NetworkSerialNumber = m_RefEHandle.GetSerialNumber() & ( (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class CUserCmd;
|
|||||||
class CSkyCamera;
|
class CSkyCamera;
|
||||||
class CEntityMapData;
|
class CEntityMapData;
|
||||||
class INextBot;
|
class INextBot;
|
||||||
|
class IHasAttributes;
|
||||||
|
|
||||||
typedef CUtlVector< CBaseEntity* > EntityList_t;
|
typedef CUtlVector< CBaseEntity* > EntityList_t;
|
||||||
|
|
||||||
@ -1087,49 +1087,57 @@ public:
|
|||||||
int GetHealth() const { return m_iHealth; }
|
int GetHealth() const { return m_iHealth; }
|
||||||
void SetHealth( int amt ) { m_iHealth = amt; }
|
void SetHealth( int amt ) { m_iHealth = amt; }
|
||||||
|
|
||||||
|
float HealthFraction() const;
|
||||||
|
|
||||||
// Ugly code to lookup all functions to make sure they are in the table when set.
|
// Ugly code to lookup all functions to make sure they are in the table when set.
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void FunctionCheck( void *pFunction, const char *name );
|
|
||||||
|
|
||||||
|
#ifdef GNUC
|
||||||
|
#define ENTITYFUNCPTR_SIZE 8
|
||||||
|
#else
|
||||||
|
#define ENTITYFUNCPTR_SIZE 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void FunctionCheck( void *pFunction, const char *name );
|
||||||
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name )
|
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name )
|
||||||
{
|
{
|
||||||
#ifdef GNUC
|
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
|
||||||
#else
|
|
||||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
|
||||||
#endif
|
|
||||||
m_pfnTouch = func;
|
m_pfnTouch = func;
|
||||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnTouch)), name );
|
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnTouch)), name );
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
USEPTR UseSet( USEPTR func, char *name )
|
USEPTR UseSet( USEPTR func, char *name )
|
||||||
{
|
{
|
||||||
#ifdef GNUC
|
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
|
||||||
#else
|
|
||||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
|
||||||
#endif
|
|
||||||
m_pfnUse = func;
|
m_pfnUse = func;
|
||||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnUse)), name );
|
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnUse)), name );
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name )
|
ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name )
|
||||||
{
|
{
|
||||||
#ifdef GNUC
|
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
|
||||||
#else
|
|
||||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
|
||||||
#endif
|
|
||||||
m_pfnBlocked = func;
|
m_pfnBlocked = func;
|
||||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnBlocked)), name );
|
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnBlocked)), name );
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // _DEBUG
|
||||||
|
|
||||||
virtual void ModifyOrAppendCriteria( AI_CriteriaSet& set );
|
virtual void ModifyOrAppendCriteria( AI_CriteriaSet& set );
|
||||||
void AppendContextToCriteria( AI_CriteriaSet& set, const char *prefix = "" );
|
void AppendContextToCriteria( AI_CriteriaSet& set, const char *prefix = "" );
|
||||||
void DumpResponseCriteria( void );
|
void DumpResponseCriteria( void );
|
||||||
|
|
||||||
|
// Return the IHasAttributes interface for this base entity. Removes the need for:
|
||||||
|
// dynamic_cast< IHasAttributes * >( pEntity );
|
||||||
|
// Which is remarkably slow.
|
||||||
|
// GetAttribInterface( CBaseEntity *pEntity ) in attribute_manager.h uses
|
||||||
|
// this function, tests for NULL, and Asserts m_pAttributes == dynamic_cast.
|
||||||
|
inline IHasAttributes *GetHasAttributesInterfacePtr() const { return m_pAttributes; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// NOTE: m_pAttributes needs to be set in the leaf class constructor.
|
||||||
|
IHasAttributes *m_pAttributes;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class CAI_Senses;
|
friend class CAI_Senses;
|
||||||
CBaseEntity *m_pLink;// used for temporary link-list operations.
|
CBaseEntity *m_pLink;// used for temporary link-list operations.
|
||||||
|
@ -2555,7 +2555,7 @@ void CFlexCycler::Think( void )
|
|||||||
{
|
{
|
||||||
m_flexnum = LookupFlex( szTemp );
|
m_flexnum = LookupFlex( szTemp );
|
||||||
|
|
||||||
if (m_flexnum != -1 && m_flextarget[m_flexnum] != 1)
|
if (m_flexnum != LocalFlexController_t(-1) && m_flextarget[m_flexnum] != 1)
|
||||||
{
|
{
|
||||||
m_flextarget[m_flexnum] = 1.0;
|
m_flextarget[m_flexnum] = 1.0;
|
||||||
// SetFlexTarget( m_flexnum );
|
// SetFlexTarget( m_flexnum );
|
||||||
|
@ -87,10 +87,11 @@ IResponseSystem *CBaseMultiplayerPlayer::GetResponseSystem()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Doesn't actually speak the concept. Just finds a response in the system. You then have to play it yourself.
|
// Purpose: Doesn't actually speak the concept. Just finds a response in the system. You then have to play it yourself.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
AI_Response *CBaseMultiplayerPlayer::SpeakConcept( int iConcept )
|
bool CBaseMultiplayerPlayer::SpeakConcept( AI_Response &response, int iConcept )
|
||||||
{
|
{
|
||||||
|
// Save the current concept.
|
||||||
m_iCurrentConcept = iConcept;
|
m_iCurrentConcept = iConcept;
|
||||||
return SpeakFindResponse( g_pszMPConcepts[iConcept] );
|
return SpeakFindResponse( response, g_pszMPConcepts[iConcept] );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
|
|
||||||
virtual bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
virtual bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||||
virtual IResponseSystem *GetResponseSystem();
|
virtual IResponseSystem *GetResponseSystem();
|
||||||
AI_Response *SpeakConcept( int iConcept );
|
bool SpeakConcept( AI_Response& response, int iConcept );
|
||||||
virtual bool SpeakConceptIfAllowed( int iConcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
virtual bool SpeakConceptIfAllowed( int iConcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||||
|
|
||||||
virtual bool CanHearAndReadChatFrom( CBasePlayer *pPlayer );
|
virtual bool CanHearAndReadChatFrom( CBasePlayer *pPlayer );
|
||||||
|
@ -281,7 +281,11 @@ void CBaseEntityOutput::FireOutput(variant_t Value, CBaseEntity *pActivator, CBa
|
|||||||
Q_snprintf( szBuffer,
|
Q_snprintf( szBuffer,
|
||||||
sizeof(szBuffer),
|
sizeof(szBuffer),
|
||||||
"(%0.2f) output: (%s,%s) -> (%s,%s,%.1f)(%s)\n",
|
"(%0.2f) output: (%s,%s) -> (%s,%s,%.1f)(%s)\n",
|
||||||
|
#ifdef TF_DLL
|
||||||
engine->GetServerTime(),
|
engine->GetServerTime(),
|
||||||
|
#else
|
||||||
|
gpGlobals->curtime,
|
||||||
|
#endif
|
||||||
pCaller ? STRING(pCaller->m_iClassname) : "NULL",
|
pCaller ? STRING(pCaller->m_iClassname) : "NULL",
|
||||||
pCaller ? STRING(pCaller->GetEntityName()) : "NULL",
|
pCaller ? STRING(pCaller->GetEntityName()) : "NULL",
|
||||||
STRING(ev->m_iTarget),
|
STRING(ev->m_iTarget),
|
||||||
@ -298,7 +302,11 @@ void CBaseEntityOutput::FireOutput(variant_t Value, CBaseEntity *pActivator, CBa
|
|||||||
Q_snprintf( szBuffer,
|
Q_snprintf( szBuffer,
|
||||||
sizeof(szBuffer),
|
sizeof(szBuffer),
|
||||||
"(%0.2f) output: (%s,%s) -> (%s,%s)(%s)\n",
|
"(%0.2f) output: (%s,%s) -> (%s,%s)(%s)\n",
|
||||||
|
#ifdef TF_DLL
|
||||||
engine->GetServerTime(),
|
engine->GetServerTime(),
|
||||||
|
#else
|
||||||
|
gpGlobals->curtime,
|
||||||
|
#endif
|
||||||
pCaller ? STRING(pCaller->m_iClassname) : "NULL",
|
pCaller ? STRING(pCaller->m_iClassname) : "NULL",
|
||||||
pCaller ? STRING(pCaller->GetEntityName()) : "NULL", STRING(ev->m_iTarget),
|
pCaller ? STRING(pCaller->GetEntityName()) : "NULL", STRING(ev->m_iTarget),
|
||||||
STRING(ev->m_iTargetInput),
|
STRING(ev->m_iTargetInput),
|
||||||
@ -459,7 +467,7 @@ void CBaseEntityOutput::DeleteAllElements( void )
|
|||||||
m_ActionList = NULL;
|
m_ActionList = NULL;
|
||||||
while (pNext)
|
while (pNext)
|
||||||
{
|
{
|
||||||
register CEventAction *strikeThis = pNext;
|
CEventAction *strikeThis = pNext;
|
||||||
pNext = pNext->m_pNext;
|
pNext = pNext->m_pNext;
|
||||||
delete strikeThis;
|
delete strikeThis;
|
||||||
}
|
}
|
||||||
@ -767,7 +775,13 @@ void CEventQueue::Dump( void )
|
|||||||
{
|
{
|
||||||
EventQueuePrioritizedEvent_t *pe = m_Events.m_pNext;
|
EventQueuePrioritizedEvent_t *pe = m_Events.m_pNext;
|
||||||
|
|
||||||
Msg( "Dumping event queue. Current time is: %.2f\n", engine->GetServerTime() );
|
Msg("Dumping event queue. Current time is: %.2f\n",
|
||||||
|
#ifdef TF_DLL
|
||||||
|
engine->GetServerTime()
|
||||||
|
#else
|
||||||
|
gpGlobals->curtime
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
while ( pe != NULL )
|
while ( pe != NULL )
|
||||||
{
|
{
|
||||||
@ -795,7 +809,11 @@ void CEventQueue::AddEvent( const char *target, const char *targetInput, variant
|
|||||||
{
|
{
|
||||||
// build the new event
|
// build the new event
|
||||||
EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t;
|
EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t;
|
||||||
|
#ifdef TF_DLL
|
||||||
newEvent->m_flFireTime = engine->GetServerTime() + fireDelay; // priority key in the priority queue
|
newEvent->m_flFireTime = engine->GetServerTime() + fireDelay; // priority key in the priority queue
|
||||||
|
#else
|
||||||
|
newEvent->m_flFireTime = gpGlobals->curtime + fireDelay; // priority key in the priority queue
|
||||||
|
#endif
|
||||||
newEvent->m_iTarget = MAKE_STRING( target );
|
newEvent->m_iTarget = MAKE_STRING( target );
|
||||||
newEvent->m_pEntTarget = NULL;
|
newEvent->m_pEntTarget = NULL;
|
||||||
newEvent->m_iTargetInput = MAKE_STRING( targetInput );
|
newEvent->m_iTargetInput = MAKE_STRING( targetInput );
|
||||||
@ -814,7 +832,11 @@ void CEventQueue::AddEvent( CBaseEntity *target, const char *targetInput, varian
|
|||||||
{
|
{
|
||||||
// build the new event
|
// build the new event
|
||||||
EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t;
|
EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t;
|
||||||
|
#ifdef TF_DLL
|
||||||
newEvent->m_flFireTime = engine->GetServerTime() + fireDelay; // primary priority key in the priority queue
|
newEvent->m_flFireTime = engine->GetServerTime() + fireDelay; // primary priority key in the priority queue
|
||||||
|
#else
|
||||||
|
newEvent->m_flFireTime = gpGlobals->curtime + fireDelay; // primary priority key in the priority queue
|
||||||
|
#endif
|
||||||
newEvent->m_iTarget = NULL_STRING;
|
newEvent->m_iTarget = NULL_STRING;
|
||||||
newEvent->m_pEntTarget = target;
|
newEvent->m_pEntTarget = target;
|
||||||
newEvent->m_iTargetInput = MAKE_STRING( targetInput );
|
newEvent->m_iTargetInput = MAKE_STRING( targetInput );
|
||||||
@ -885,7 +907,11 @@ void CEventQueue::ServiceEvents( void )
|
|||||||
|
|
||||||
EventQueuePrioritizedEvent_t *pe = m_Events.m_pNext;
|
EventQueuePrioritizedEvent_t *pe = m_Events.m_pNext;
|
||||||
|
|
||||||
|
#ifdef TF_DLL
|
||||||
while ( pe != NULL && pe->m_flFireTime <= engine->GetServerTime() )
|
while ( pe != NULL && pe->m_flFireTime <= engine->GetServerTime() )
|
||||||
|
#else
|
||||||
|
while ( pe != NULL && pe->m_flFireTime <= gpGlobals->curtime )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
MDLCACHE_CRITICAL_SECTION();
|
MDLCACHE_CRITICAL_SECTION();
|
||||||
|
|
||||||
@ -1171,7 +1197,11 @@ int CEventQueue::Restore( IRestore &restore )
|
|||||||
AddEvent( tmpEvent.m_pEntTarget,
|
AddEvent( tmpEvent.m_pEntTarget,
|
||||||
STRING(tmpEvent.m_iTargetInput),
|
STRING(tmpEvent.m_iTargetInput),
|
||||||
tmpEvent.m_VariantValue,
|
tmpEvent.m_VariantValue,
|
||||||
|
#ifdef TF_DLL
|
||||||
tmpEvent.m_flFireTime - engine->GetServerTime(),
|
tmpEvent.m_flFireTime - engine->GetServerTime(),
|
||||||
|
#else
|
||||||
|
tmpEvent.m_flFireTime - gpGlobals->curtime,
|
||||||
|
#endif
|
||||||
tmpEvent.m_pActivator,
|
tmpEvent.m_pActivator,
|
||||||
tmpEvent.m_pCaller,
|
tmpEvent.m_pCaller,
|
||||||
tmpEvent.m_iOutputID );
|
tmpEvent.m_iOutputID );
|
||||||
@ -1181,7 +1211,11 @@ int CEventQueue::Restore( IRestore &restore )
|
|||||||
AddEvent( STRING(tmpEvent.m_iTarget),
|
AddEvent( STRING(tmpEvent.m_iTarget),
|
||||||
STRING(tmpEvent.m_iTargetInput),
|
STRING(tmpEvent.m_iTargetInput),
|
||||||
tmpEvent.m_VariantValue,
|
tmpEvent.m_VariantValue,
|
||||||
|
#ifdef TF_DLL
|
||||||
tmpEvent.m_flFireTime - engine->GetServerTime(),
|
tmpEvent.m_flFireTime - engine->GetServerTime(),
|
||||||
|
#else
|
||||||
|
tmpEvent.m_flFireTime - gpGlobals->curtime,
|
||||||
|
#endif
|
||||||
tmpEvent.m_pActivator,
|
tmpEvent.m_pActivator,
|
||||||
tmpEvent.m_pCaller,
|
tmpEvent.m_pCaller,
|
||||||
tmpEvent.m_iOutputID );
|
tmpEvent.m_iOutputID );
|
||||||
|
@ -1349,6 +1349,7 @@ void CC_HurtMe_f(const CCommand &args)
|
|||||||
|
|
||||||
static ConCommand hurtme("hurtme", CC_HurtMe_f, "Hurts the player.\n\tArguments: <health to lose>", FCVAR_CHEAT);
|
static ConCommand hurtme("hurtme", CC_HurtMe_f, "Hurts the player.\n\tArguments: <health to lose>", FCVAR_CHEAT);
|
||||||
|
|
||||||
|
#ifdef DBGFLAG_ASSERT
|
||||||
static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
|
static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
|
||||||
{
|
{
|
||||||
if ( !ground || !ent )
|
if ( !ground || !ent )
|
||||||
@ -1368,8 +1369,8 @@ static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int DescribeGroundList( CBaseEntity *ent )
|
static int DescribeGroundList( CBaseEntity *ent )
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,27 @@ public:
|
|||||||
virtual void ApplyMultiDamage( void );
|
virtual void ApplyMultiDamage( void );
|
||||||
virtual void AddMultiDamage( const CTakeDamageInfo &pTakeDamageInfo, CBaseEntity *pEntity );
|
virtual void AddMultiDamage( const CTakeDamageInfo &pTakeDamageInfo, CBaseEntity *pEntity );
|
||||||
virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRadius, int iClassIgnore, CBaseEntity *pEntityIgnore );
|
virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRadius, int iClassIgnore, CBaseEntity *pEntityIgnore );
|
||||||
|
|
||||||
virtual ITempEntsSystem *GetTempEntsSystem( void );
|
virtual ITempEntsSystem *GetTempEntsSystem( void );
|
||||||
|
virtual CBaseTempEntity *GetTempEntList( void );
|
||||||
|
virtual CGlobalEntityList *GetEntityList( void );
|
||||||
|
virtual bool IsEntityPtr( void *pTest );
|
||||||
|
virtual CBaseEntity *FindEntityByClassname( CBaseEntity *pStartEntity, const char *szName );
|
||||||
|
virtual CBaseEntity *FindEntityByName( CBaseEntity *pStartEntity, const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL, IEntityFindFilter *pFilter = NULL );
|
||||||
|
virtual CBaseEntity *FindEntityInSphere( CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius );
|
||||||
|
virtual CBaseEntity *FindEntityByTarget( CBaseEntity *pStartEntity, const char *szName );
|
||||||
|
virtual CBaseEntity *FindEntityByModel( CBaseEntity *pStartEntity, const char *szModelName );
|
||||||
|
virtual CBaseEntity *FindEntityByNameNearest( const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
||||||
|
virtual CBaseEntity *FindEntityByNameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
||||||
|
virtual CBaseEntity *FindEntityByClassnameNearest( const char *szName, const Vector &vecSrc, float flRadius );
|
||||||
|
virtual CBaseEntity *FindEntityByClassnameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius );
|
||||||
|
virtual CBaseEntity *FindEntityByClassnameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecMins, const Vector &vecMaxs );
|
||||||
|
virtual CBaseEntity *FindEntityGeneric( CBaseEntity *pStartEntity, const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
||||||
|
virtual CBaseEntity *FindEntityGenericWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
||||||
|
virtual CBaseEntity *FindEntityGenericNearest( const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
||||||
|
virtual CBaseEntity *FindEntityNearestFacing( const Vector &origin, const Vector &facing, float threshold );
|
||||||
|
virtual CBaseEntity *FindEntityClassNearestFacing( const Vector &origin, const Vector &facing, float threshold, char *classname );
|
||||||
|
virtual CBaseEntity *FindEntityProcedural( const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -64,10 +84,11 @@ static CServerTools g_ServerTools;
|
|||||||
|
|
||||||
// VSERVERTOOLS_INTERFACE_VERSION_1 is compatible with the latest since we're only adding things to the end, so expose that as well.
|
// VSERVERTOOLS_INTERFACE_VERSION_1 is compatible with the latest since we're only adding things to the end, so expose that as well.
|
||||||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CServerTools, IServerTools001, VSERVERTOOLS_INTERFACE_VERSION_1, g_ServerTools );
|
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CServerTools, IServerTools001, VSERVERTOOLS_INTERFACE_VERSION_1, g_ServerTools );
|
||||||
|
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CServerTools, IServerTools002, VSERVERTOOLS_INTERFACE_VERSION_2, g_ServerTools );
|
||||||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CServerTools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION, g_ServerTools );
|
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CServerTools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION, g_ServerTools );
|
||||||
|
|
||||||
// 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( VSERVERTOOLS_INTERFACE_VERSION_INT == 2 );
|
COMPILE_TIME_ASSERT( VSERVERTOOLS_INTERFACE_VERSION_INT == 3 );
|
||||||
|
|
||||||
|
|
||||||
IServerEntity *CServerTools::GetIServerEntity( IClientEntity *pClientEntity )
|
IServerEntity *CServerTools::GetIServerEntity( IClientEntity *pClientEntity )
|
||||||
@ -347,6 +368,101 @@ ITempEntsSystem *CServerTools::GetTempEntsSystem( void )
|
|||||||
return (ITempEntsSystem *)te;
|
return (ITempEntsSystem *)te;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CBaseTempEntity *CServerTools::GetTempEntList( void )
|
||||||
|
{
|
||||||
|
return CBaseTempEntity::GetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
CGlobalEntityList *CServerTools::GetEntityList( void )
|
||||||
|
{
|
||||||
|
return &gEntList;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CServerTools::IsEntityPtr( void *pTest )
|
||||||
|
{
|
||||||
|
return gEntList.IsEntityPtr( pTest );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByClassname( CBaseEntity *pStartEntity, const char *szName )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByClassname( pStartEntity, szName );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByName( CBaseEntity *pStartEntity, const char *szName, CBaseEntity *pSearchingEntity, CBaseEntity *pActivator, CBaseEntity *pCaller, IEntityFindFilter *pFilter )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByName( pStartEntity, szName, pSearchingEntity, pActivator, pCaller, pFilter );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityInSphere( CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityInSphere( pStartEntity, vecCenter, flRadius );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByTarget( CBaseEntity *pStartEntity, const char *szName )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByTarget( pStartEntity, szName );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByModel( CBaseEntity *pStartEntity, const char *szModelName )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByModel( pStartEntity, szModelName );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByNameNearest( const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity, CBaseEntity *pActivator, CBaseEntity *pCaller )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByNameNearest( szName, vecSrc, flRadius, pSearchingEntity, pActivator, pCaller );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByNameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity, CBaseEntity *pActivator, CBaseEntity *pCaller )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByNameWithin( pStartEntity, szName, vecSrc, flRadius, pSearchingEntity, pActivator, pCaller );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByClassnameNearest( const char *szName, const Vector &vecSrc, float flRadius )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByClassnameNearest( szName, vecSrc, flRadius );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByClassnameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByClassnameWithin( pStartEntity, szName, vecSrc, flRadius );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityByClassnameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecMins, const Vector &vecMaxs )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityByClassnameWithin( pStartEntity, szName, vecMins, vecMaxs );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityGeneric( CBaseEntity *pStartEntity, const char *szName, CBaseEntity *pSearchingEntity, CBaseEntity *pActivator, CBaseEntity *pCaller )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityGeneric( pStartEntity, szName, pSearchingEntity, pActivator, pCaller );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityGenericWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity, CBaseEntity *pActivator, CBaseEntity *pCaller )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityGenericWithin( pStartEntity, szName, vecSrc, flRadius, pSearchingEntity, pActivator, pCaller );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityGenericNearest( const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity, CBaseEntity *pActivator, CBaseEntity *pCaller )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityGenericNearest( szName, vecSrc, flRadius, pSearchingEntity, pActivator, pCaller );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityNearestFacing( const Vector &origin, const Vector &facing, float threshold )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityNearestFacing( origin, facing, threshold );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityClassNearestFacing( const Vector &origin, const Vector &facing, float threshold, char *classname )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityClassNearestFacing( origin, facing, threshold, classname );
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *CServerTools::FindEntityProcedural( const char *szName, CBaseEntity *pSearchingEntity, CBaseEntity *pActivator, CBaseEntity *pCaller )
|
||||||
|
{
|
||||||
|
return gEntList.FindEntityProcedural( szName, pSearchingEntity, pActivator, pCaller );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Interface from engine to tools for manipulating entities
|
// Interface from engine to tools for manipulating entities
|
||||||
class CServerChoreoTools : public IServerChoreoTools
|
class CServerChoreoTools : public IServerChoreoTools
|
||||||
|
@ -1105,7 +1105,7 @@ void CGlobalEntityList::OnAddEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
|||||||
|
|
||||||
void CGlobalEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
void CGlobalEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DBGFLAG_ASSERT
|
||||||
if ( !g_fInCleanupDelete )
|
if ( !g_fInCleanupDelete )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -155,7 +155,6 @@ public:
|
|||||||
|
|
||||||
CBaseEntity *FindEntityNearestFacing( const Vector &origin, const Vector &facing, float threshold);
|
CBaseEntity *FindEntityNearestFacing( const Vector &origin, const Vector &facing, float threshold);
|
||||||
CBaseEntity *FindEntityClassNearestFacing( const Vector &origin, const Vector &facing, float threshold, char *classname);
|
CBaseEntity *FindEntityClassNearestFacing( const Vector &origin, const Vector &facing, float threshold, char *classname);
|
||||||
CBaseEntity *FindEntityByNetname( CBaseEntity *pStartEntity, const char *szModelName );
|
|
||||||
|
|
||||||
CBaseEntity *FindEntityProcedural( const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
CBaseEntity *FindEntityProcedural( const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
||||||
|
|
||||||
|
@ -109,8 +109,6 @@ void CWindowPane::PaneTouch( CBaseEntity *pOther )
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void CWindowPane::Die( void )
|
void CWindowPane::Die( void )
|
||||||
{
|
{
|
||||||
Vector flForce = -1 * GetAbsVelocity();
|
|
||||||
|
|
||||||
CPASFilter filter( GetAbsOrigin() );
|
CPASFilter filter( GetAbsOrigin() );
|
||||||
te->ShatterSurface( filter, 0.0,
|
te->ShatterSurface( filter, 0.0,
|
||||||
&GetAbsOrigin(), &GetAbsAngles(),
|
&GetAbsOrigin(), &GetAbsAngles(),
|
||||||
|
@ -162,7 +162,7 @@ void CFunc_Dust::Spawn()
|
|||||||
|
|
||||||
//Since keyvalues can arrive in any order, and UTIL_StringToColor32 stomps alpha,
|
//Since keyvalues can arrive in any order, and UTIL_StringToColor32 stomps alpha,
|
||||||
//install the alpha value here.
|
//install the alpha value here.
|
||||||
color32 clr = { m_Color.m_Value.r, m_Color.m_Value.g, m_Color.m_Value.b, m_iAlpha };
|
color32 clr = { m_Color.m_Value.r, m_Color.m_Value.g, m_Color.m_Value.b, (byte)m_iAlpha };
|
||||||
m_Color.Set( clr );
|
m_Color.Set( clr );
|
||||||
|
|
||||||
BaseClass::Spawn();
|
BaseClass::Spawn();
|
||||||
|
@ -1927,6 +1927,15 @@ const char *CServerGameDLL::GetServerBrowserGameData()
|
|||||||
return rchResult;
|
return rchResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CServerGameDLL::Status( void (*print) (const char *fmt, ...) )
|
||||||
|
{
|
||||||
|
if ( g_pGameRules )
|
||||||
|
{
|
||||||
|
g_pGameRules->Status( print );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Called during a transition, to build a map adjacency list
|
// Purpose: Called during a transition, to build a map adjacency list
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -3332,7 +3341,7 @@ void MessageWriteEHandle( CBaseEntity *pEntity )
|
|||||||
{
|
{
|
||||||
EHANDLE hEnt = pEntity;
|
EHANDLE hEnt = pEntity;
|
||||||
|
|
||||||
int iSerialNum = hEnt.GetSerialNumber() & (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1;
|
int iSerialNum = hEnt.GetSerialNumber() & ( (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1 );
|
||||||
iEncodedEHandle = hEnt.GetEntryIndex() | (iSerialNum << MAX_EDICT_BITS);
|
iEncodedEHandle = hEnt.GetEntryIndex() | (iSerialNum << MAX_EDICT_BITS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -28,35 +28,35 @@ extern INetworkStringTable *g_pStringTableServerPopFiles;
|
|||||||
class CServerGameClients : public IServerGameClients
|
class CServerGameClients : public IServerGameClients
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool ClientConnect( edict_t *pEntity, char const* pszName, char const* pszAddress, char *reject, int maxrejectlen );
|
virtual bool ClientConnect( edict_t *pEntity, char const* pszName, char const* pszAddress, char *reject, int maxrejectlen ) OVERRIDE;
|
||||||
virtual void ClientActive( edict_t *pEntity, bool bLoadGame );
|
virtual void ClientActive( edict_t *pEntity, bool bLoadGame ) OVERRIDE;
|
||||||
virtual void ClientDisconnect( edict_t *pEntity );
|
virtual void ClientDisconnect( edict_t *pEntity ) OVERRIDE;
|
||||||
virtual void ClientPutInServer( edict_t *pEntity, const char *playername );
|
virtual void ClientPutInServer( edict_t *pEntity, const char *playername ) OVERRIDE;
|
||||||
virtual void ClientCommand( edict_t *pEntity, const CCommand &args );
|
virtual void ClientCommand( edict_t *pEntity, const CCommand &args ) OVERRIDE;
|
||||||
virtual void ClientSettingsChanged( edict_t *pEntity );
|
virtual void ClientSettingsChanged( edict_t *pEntity ) OVERRIDE;
|
||||||
virtual void ClientSetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char *pvs, int pvssize );
|
virtual void ClientSetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char *pvs, int pvssize ) OVERRIDE;
|
||||||
virtual float ProcessUsercmds( edict_t *player, bf_read *buf, int numcmds, int totalcmds,
|
virtual float ProcessUsercmds( edict_t *player, bf_read *buf, int numcmds, int totalcmds,
|
||||||
int dropped_packets, bool ignore, bool paused );
|
int dropped_packets, bool ignore, bool paused ) OVERRIDE;
|
||||||
// Player is running a command
|
// Player is running a command
|
||||||
virtual void PostClientMessagesSent_DEPRECIATED( void );
|
virtual void PostClientMessagesSent_DEPRECIATED( void ) OVERRIDE;
|
||||||
virtual void SetCommandClient( int index );
|
virtual void SetCommandClient( int index ) OVERRIDE;
|
||||||
virtual CPlayerState *GetPlayerState( edict_t *player );
|
virtual CPlayerState *GetPlayerState( edict_t *player ) OVERRIDE;
|
||||||
virtual void ClientEarPosition( edict_t *pEntity, Vector *pEarOrigin );
|
virtual void ClientEarPosition( edict_t *pEntity, Vector *pEarOrigin ) OVERRIDE;
|
||||||
|
|
||||||
virtual void GetPlayerLimits( int& minplayers, int& maxplayers, int &defaultMaxPlayers ) const;
|
virtual void GetPlayerLimits( int& minplayers, int& maxplayers, int &defaultMaxPlayers ) const OVERRIDE;
|
||||||
|
|
||||||
// returns number of delay ticks if player is in Replay mode (0 = no delay)
|
// returns number of delay ticks if player is in Replay mode (0 = no delay)
|
||||||
virtual int GetReplayDelay( edict_t *player, int& entity );
|
virtual int GetReplayDelay( edict_t *player, int& entity ) OVERRIDE;
|
||||||
// Anything this game .dll wants to add to the bug reporter text (e.g., the entity/model under the picker crosshair)
|
// Anything this game .dll wants to add to the bug reporter text (e.g., the entity/model under the picker crosshair)
|
||||||
// can be added here
|
// can be added here
|
||||||
virtual void GetBugReportInfo( char *buf, int buflen );
|
virtual void GetBugReportInfo( char *buf, int buflen ) OVERRIDE;
|
||||||
virtual void NetworkIDValidated( const char *pszUserName, const char *pszNetworkID );
|
virtual void NetworkIDValidated( const char *pszUserName, const char *pszNetworkID ) OVERRIDE;
|
||||||
|
|
||||||
// The client has submitted a keyvalues command
|
// The client has submitted a keyvalues command
|
||||||
virtual void ClientCommandKeyValues( edict_t *pEntity, KeyValues *pKeyValues );
|
virtual void ClientCommandKeyValues( edict_t *pEntity, KeyValues *pKeyValues ) OVERRIDE;
|
||||||
|
|
||||||
// Notify that the player is spawned
|
// Notify that the player is spawned
|
||||||
virtual void ClientSpawned( edict_t *pPlayer );
|
virtual void ClientSpawned( edict_t *pPlayer ) OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -64,73 +64,73 @@ class CServerGameDLL : public IServerGameDLL
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsFactory,
|
virtual bool DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsFactory,
|
||||||
CreateInterfaceFn fileSystemFactory, CGlobalVars *pGlobals);
|
CreateInterfaceFn fileSystemFactory, CGlobalVars *pGlobals) OVERRIDE;
|
||||||
virtual void DLLShutdown( void );
|
virtual void DLLShutdown( void ) OVERRIDE;
|
||||||
// Get the simulation interval (must be compiled with identical values into both client and game .dll for MOD!!!)
|
// Get the simulation interval (must be compiled with identical values into both client and game .dll for MOD!!!)
|
||||||
virtual bool ReplayInit( CreateInterfaceFn fnReplayFactory );
|
virtual bool ReplayInit( CreateInterfaceFn fnReplayFactory ) OVERRIDE;
|
||||||
virtual float GetTickInterval( void ) const;
|
virtual float GetTickInterval( void ) const OVERRIDE;
|
||||||
virtual bool GameInit( void );
|
virtual bool GameInit( void ) OVERRIDE;
|
||||||
virtual void GameShutdown( void );
|
virtual void GameShutdown( void ) OVERRIDE;
|
||||||
virtual bool LevelInit( const char *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background );
|
virtual bool LevelInit( const char *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background ) OVERRIDE;
|
||||||
virtual void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax );
|
virtual void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) OVERRIDE;
|
||||||
virtual void LevelShutdown( void );
|
virtual void LevelShutdown( void ) OVERRIDE;
|
||||||
virtual void GameFrame( bool simulating ); // could be called multiple times before sending data to clients
|
virtual void GameFrame( bool simulating ) OVERRIDE; // could be called multiple times before sending data to clients
|
||||||
virtual void PreClientUpdate( bool simulating ); // called after all GameFrame() calls, before sending data to clients
|
virtual void PreClientUpdate( bool simulating ) OVERRIDE; // called after all GameFrame() calls, before sending data to clients
|
||||||
|
|
||||||
virtual ServerClass* GetAllServerClasses( void );
|
virtual ServerClass* GetAllServerClasses( void ) OVERRIDE;
|
||||||
virtual const char *GetGameDescription( void );
|
virtual const char *GetGameDescription( void ) OVERRIDE;
|
||||||
virtual void CreateNetworkStringTables( void );
|
virtual void CreateNetworkStringTables( void ) OVERRIDE;
|
||||||
|
|
||||||
// Save/restore system hooks
|
// Save/restore system hooks
|
||||||
virtual CSaveRestoreData *SaveInit( int size );
|
virtual CSaveRestoreData *SaveInit( int size ) OVERRIDE;
|
||||||
virtual void SaveWriteFields( CSaveRestoreData *, char const* , void *, datamap_t *, typedescription_t *, int );
|
virtual void SaveWriteFields( CSaveRestoreData *, char const* , void *, datamap_t *, typedescription_t *, int ) OVERRIDE;
|
||||||
virtual void SaveReadFields( CSaveRestoreData *, char const* , void *, datamap_t *, typedescription_t *, int );
|
virtual void SaveReadFields( CSaveRestoreData *, char const* , void *, datamap_t *, typedescription_t *, int ) OVERRIDE;
|
||||||
virtual void SaveGlobalState( CSaveRestoreData * );
|
virtual void SaveGlobalState( CSaveRestoreData * ) OVERRIDE;
|
||||||
virtual void RestoreGlobalState( CSaveRestoreData * );
|
virtual void RestoreGlobalState( CSaveRestoreData * ) OVERRIDE;
|
||||||
virtual int CreateEntityTransitionList( CSaveRestoreData *, int );
|
virtual int CreateEntityTransitionList( CSaveRestoreData *, int ) OVERRIDE;
|
||||||
virtual void BuildAdjacentMapList( void );
|
virtual void BuildAdjacentMapList( void ) OVERRIDE;
|
||||||
|
|
||||||
virtual void PreSave( CSaveRestoreData * );
|
virtual void PreSave( CSaveRestoreData * ) OVERRIDE;
|
||||||
virtual void Save( CSaveRestoreData * );
|
virtual void Save( CSaveRestoreData * ) OVERRIDE;
|
||||||
virtual void GetSaveComment( char *comment, int maxlength, float flMinutes, float flSeconds, bool bNoTime = false );
|
virtual void GetSaveComment( char *comment, int maxlength, float flMinutes, float flSeconds, bool bNoTime = false ) OVERRIDE;
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
virtual void GetTitleName( const char *pMapName, char* pTitleBuff, int titleBuffSize );
|
virtual void GetTitleName( const char *pMapName, char* pTitleBuff, int titleBuffSize ) OVERRIDE;
|
||||||
#endif
|
#endif
|
||||||
virtual void WriteSaveHeaders( CSaveRestoreData * );
|
virtual void WriteSaveHeaders( CSaveRestoreData * ) OVERRIDE;
|
||||||
|
|
||||||
virtual void ReadRestoreHeaders( CSaveRestoreData * );
|
virtual void ReadRestoreHeaders( CSaveRestoreData * ) OVERRIDE;
|
||||||
virtual void Restore( CSaveRestoreData *, bool );
|
virtual void Restore( CSaveRestoreData *, bool ) OVERRIDE;
|
||||||
virtual bool IsRestoring();
|
virtual bool IsRestoring() OVERRIDE;
|
||||||
|
|
||||||
// Retrieve info needed for parsing the specified user message
|
// Retrieve info needed for parsing the specified user message
|
||||||
virtual bool GetUserMessageInfo( int msg_type, char *name, int maxnamelength, int& size );
|
virtual bool GetUserMessageInfo( int msg_type, char *name, int maxnamelength, int& size ) OVERRIDE;
|
||||||
|
|
||||||
virtual CStandardSendProxies* GetStandardSendProxies();
|
virtual CStandardSendProxies* GetStandardSendProxies() OVERRIDE;
|
||||||
|
|
||||||
virtual void PostInit();
|
virtual void PostInit() OVERRIDE;
|
||||||
virtual void Think( bool finalTick );
|
virtual void Think( bool finalTick ) OVERRIDE;
|
||||||
|
|
||||||
virtual void OnQueryCvarValueFinished( QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue );
|
virtual void OnQueryCvarValueFinished( QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue ) OVERRIDE;
|
||||||
|
|
||||||
virtual void PreSaveGameLoaded( char const *pSaveName, bool bInGame );
|
virtual void PreSaveGameLoaded( char const *pSaveName, bool bInGame ) OVERRIDE;
|
||||||
|
|
||||||
// Returns true if the game DLL wants the server not to be made public.
|
// Returns true if the game DLL wants the server not to be made public.
|
||||||
// Used by commentary system to hide multiplayer commentary servers from the master.
|
// Used by commentary system to hide multiplayer commentary servers from the master.
|
||||||
virtual bool ShouldHideServer( void );
|
virtual bool ShouldHideServer( void ) OVERRIDE;
|
||||||
|
|
||||||
virtual void InvalidateMdlCache();
|
virtual void InvalidateMdlCache() OVERRIDE;
|
||||||
|
|
||||||
virtual void SetServerHibernation( bool bHibernating );
|
virtual void SetServerHibernation( bool bHibernating ) OVERRIDE;
|
||||||
|
|
||||||
float m_fAutoSaveDangerousTime;
|
float m_fAutoSaveDangerousTime;
|
||||||
float m_fAutoSaveDangerousMinHealthToCommit;
|
float m_fAutoSaveDangerousMinHealthToCommit;
|
||||||
bool m_bIsHibernating;
|
bool m_bIsHibernating;
|
||||||
|
|
||||||
// Called after the steam API has been activated post-level startup
|
// Called after the steam API has been activated post-level startup
|
||||||
virtual void GameServerSteamAPIActivated( void );
|
virtual void GameServerSteamAPIActivated( void ) OVERRIDE;
|
||||||
|
|
||||||
// Called after the steam API has been shutdown post-level startup
|
// Called after the steam API has been shutdown post-level startup
|
||||||
virtual void GameServerSteamAPIShutdown( void );
|
virtual void GameServerSteamAPIShutdown( void ) OVERRIDE;
|
||||||
|
|
||||||
// interface to the new GC based lobby system
|
// interface to the new GC based lobby system
|
||||||
virtual IServerGCLobby *GetServerGCLobby() OVERRIDE;
|
virtual IServerGCLobby *GetServerGCLobby() OVERRIDE;
|
||||||
@ -138,6 +138,9 @@ public:
|
|||||||
virtual const char *GetServerBrowserMapOverride() OVERRIDE;
|
virtual const char *GetServerBrowserMapOverride() OVERRIDE;
|
||||||
virtual const char *GetServerBrowserGameData() OVERRIDE;
|
virtual const char *GetServerBrowserGameData() OVERRIDE;
|
||||||
|
|
||||||
|
// Called to add output to the status command
|
||||||
|
virtual void Status( void (*print) (const char *fmt, ...) );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// This can just be a wrapper on MapEntity_ParseAllEntities, but CS does some tricks in here
|
// This can just be a wrapper on MapEntity_ParseAllEntities, but CS does some tricks in here
|
||||||
|
@ -372,7 +372,7 @@ void CFlextalkActor::ProcessSceneEvents( void )
|
|||||||
{
|
{
|
||||||
m_flexnum = LookupFlex( szTemp );
|
m_flexnum = LookupFlex( szTemp );
|
||||||
|
|
||||||
if (m_flexnum != -1 && m_flextarget[m_flexnum] != 1)
|
if (m_flexnum != LocalFlexController_t(-1) && m_flextarget[m_flexnum] != 1)
|
||||||
{
|
{
|
||||||
m_flextarget[m_flexnum] = 1.0;
|
m_flextarget[m_flexnum] = 1.0;
|
||||||
// SetFlexTarget( m_flexnum );
|
// SetFlexTarget( m_flexnum );
|
||||||
|
@ -131,6 +131,7 @@ public:
|
|||||||
entity.name = m_nameList.AddString( pGlobalname );
|
entity.name = m_nameList.AddString( pGlobalname );
|
||||||
entity.levelName = m_nameList.AddString( pMapName );
|
entity.levelName = m_nameList.AddString( pMapName );
|
||||||
entity.state = state;
|
entity.state = state;
|
||||||
|
entity.counter = 0;
|
||||||
|
|
||||||
int index = GetIndex( m_nameList.String( entity.name ) );
|
int index = GetIndex( m_nameList.String( entity.name ) );
|
||||||
if ( index >= 0 )
|
if ( index >= 0 )
|
||||||
|
@ -143,23 +143,23 @@ struct citizen_expression_list_t
|
|||||||
// Scared
|
// Scared
|
||||||
citizen_expression_list_t ScaredExpressions[STATES_WITH_EXPRESSIONS] =
|
citizen_expression_list_t ScaredExpressions[STATES_WITH_EXPRESSIONS] =
|
||||||
{
|
{
|
||||||
{ "scenes/Expressions/citizen_scared_idle_01.vcd" },
|
{ { "scenes/Expressions/citizen_scared_idle_01.vcd" } },
|
||||||
{ "scenes/Expressions/citizen_scared_alert_01.vcd" },
|
{ { "scenes/Expressions/citizen_scared_alert_01.vcd" } },
|
||||||
{ "scenes/Expressions/citizen_scared_combat_01.vcd" },
|
{ { "scenes/Expressions/citizen_scared_combat_01.vcd" } },
|
||||||
};
|
};
|
||||||
// Normal
|
// Normal
|
||||||
citizen_expression_list_t NormalExpressions[STATES_WITH_EXPRESSIONS] =
|
citizen_expression_list_t NormalExpressions[STATES_WITH_EXPRESSIONS] =
|
||||||
{
|
{
|
||||||
{ "scenes/Expressions/citizen_normal_idle_01.vcd" },
|
{ { "scenes/Expressions/citizen_normal_idle_01.vcd" } },
|
||||||
{ "scenes/Expressions/citizen_normal_alert_01.vcd" },
|
{ { "scenes/Expressions/citizen_normal_alert_01.vcd" } },
|
||||||
{ "scenes/Expressions/citizen_normal_combat_01.vcd" },
|
{ { "scenes/Expressions/citizen_normal_combat_01.vcd" } },
|
||||||
};
|
};
|
||||||
// Angry
|
// Angry
|
||||||
citizen_expression_list_t AngryExpressions[STATES_WITH_EXPRESSIONS] =
|
citizen_expression_list_t AngryExpressions[STATES_WITH_EXPRESSIONS] =
|
||||||
{
|
{
|
||||||
{ "scenes/Expressions/citizen_angry_idle_01.vcd" },
|
{ { "scenes/Expressions/citizen_angry_idle_01.vcd" } },
|
||||||
{ "scenes/Expressions/citizen_angry_alert_01.vcd" },
|
{ { "scenes/Expressions/citizen_angry_alert_01.vcd" } },
|
||||||
{ "scenes/Expressions/citizen_angry_combat_01.vcd" },
|
{ { "scenes/Expressions/citizen_angry_combat_01.vcd" } },
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -4197,8 +4197,6 @@ void CNPC_Citizen::AddInsignia()
|
|||||||
|
|
||||||
void CNPC_Citizen::RemoveInsignia()
|
void CNPC_Citizen::RemoveInsignia()
|
||||||
{
|
{
|
||||||
// This is crap right now.
|
|
||||||
CBaseEntity *FirstEnt();
|
|
||||||
CBaseEntity *pEntity = gEntList.FirstEnt();
|
CBaseEntity *pEntity = gEntList.FirstEnt();
|
||||||
|
|
||||||
while( pEntity )
|
while( pEntity )
|
||||||
|
@ -1675,7 +1675,7 @@ float CNPC_MetroPolice::AimBurstAtReactionTime( float flReactionTime, float flDi
|
|||||||
#define AIM_AT_SHOT_SPEED_COUNT 6
|
#define AIM_AT_SHOT_SPEED_COUNT 6
|
||||||
#define AIM_AT_SHOT_DIST_COUNT 6
|
#define AIM_AT_SHOT_DIST_COUNT 6
|
||||||
|
|
||||||
static int s_pShotCountFraction[AIM_AT_TIME_DIST_COUNT][AIM_AT_TIME_SPEED_COUNT] =
|
static float s_pShotCountFraction[AIM_AT_TIME_DIST_COUNT][AIM_AT_TIME_SPEED_COUNT] =
|
||||||
{
|
{
|
||||||
{ 3.0f, 3.0f, 2.5f, 1.5f, 1.0f, 0.0f },
|
{ 3.0f, 3.0f, 2.5f, 1.5f, 1.0f, 0.0f },
|
||||||
{ 3.0f, 3.0f, 2.5f, 1.25f, 0.5f, 0.0f },
|
{ 3.0f, 3.0f, 2.5f, 1.25f, 0.5f, 0.0f },
|
||||||
|
@ -1988,7 +1988,7 @@ void CNPC_CScanner::BlindFlashTarget( CBaseEntity *pTarget )
|
|||||||
|
|
||||||
if ( tr.startsolid == false && tr.fraction == 1.0)
|
if ( tr.startsolid == false && tr.fraction == 1.0)
|
||||||
{
|
{
|
||||||
color32 white = { 255, 255, 255, SCANNER_FLASH_MAX_VALUE * dotPr };
|
color32 white = { 255, 255, 255, (byte)(SCANNER_FLASH_MAX_VALUE * dotPr) };
|
||||||
|
|
||||||
if ( ( g_pMaterialSystemHardwareConfig != NULL ) && ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE ) )
|
if ( ( g_pMaterialSystemHardwareConfig != NULL ) && ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE ) )
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ public:
|
|||||||
// Called during player movement to set up/restore after lag compensation
|
// Called during player movement to set up/restore after lag compensation
|
||||||
virtual void StartLagCompensation( CBasePlayer *player, CUserCmd *cmd ) = 0;
|
virtual void StartLagCompensation( CBasePlayer *player, CUserCmd *cmd ) = 0;
|
||||||
virtual void FinishLagCompensation( CBasePlayer *player ) = 0;
|
virtual void FinishLagCompensation( CBasePlayer *player ) = 0;
|
||||||
|
virtual bool IsCurrentlyDoingLagCompensation() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ILagCompensationManager *lagcompensation;
|
extern ILagCompensationManager *lagcompensation;
|
||||||
|
@ -191,7 +191,7 @@ void CFuncBrush::TurnOn( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CFuncBrush::IsOn( void )
|
bool CFuncBrush::IsOn( void ) const
|
||||||
{
|
{
|
||||||
return !IsEffectActive( EF_NODRAW );
|
return !IsEffectActive( EF_NODRAW );
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: basic solid geometry
|
// Purpose: basic solid geometry
|
||||||
// enabled state: brush is visible
|
// enabled state: brush is visible
|
||||||
// disabled staute: brush not visible
|
// disabled state: brush not visible
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
class CFuncBrush : public CBaseEntity
|
class CFuncBrush : public CBaseEntity
|
||||||
{
|
{
|
||||||
@ -32,8 +32,8 @@ public:
|
|||||||
|
|
||||||
virtual int DrawDebugTextOverlays( void );
|
virtual int DrawDebugTextOverlays( void );
|
||||||
|
|
||||||
void TurnOff( void );
|
virtual void TurnOff( void );
|
||||||
void TurnOn( void );
|
virtual void TurnOn( void );
|
||||||
|
|
||||||
// Input handlers
|
// Input handlers
|
||||||
void InputTurnOff( inputdata_t &inputdata );
|
void InputTurnOff( inputdata_t &inputdata );
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
DECLARE_DATADESC();
|
DECLARE_DATADESC();
|
||||||
|
|
||||||
virtual bool IsOn( void );
|
virtual bool IsOn( void ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -334,11 +334,11 @@ inline void DirectionToVector2D( NavDirType dir, Vector2D *v )
|
|||||||
{
|
{
|
||||||
switch( dir )
|
switch( dir )
|
||||||
{
|
{
|
||||||
|
default: Assert(0);
|
||||||
case NORTH: v->x = 0.0f; v->y = -1.0f; break;
|
case NORTH: v->x = 0.0f; v->y = -1.0f; break;
|
||||||
case SOUTH: v->x = 0.0f; v->y = 1.0f; break;
|
case SOUTH: v->x = 0.0f; v->y = 1.0f; break;
|
||||||
case EAST: v->x = 1.0f; v->y = 0.0f; break;
|
case EAST: v->x = 1.0f; v->y = 0.0f; break;
|
||||||
case WEST: v->x = -1.0f; v->y = 0.0f; break;
|
case WEST: v->x = -1.0f; v->y = 0.0f; break;
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,11 +348,11 @@ inline void CornerToVector2D( NavCornerType dir, Vector2D *v )
|
|||||||
{
|
{
|
||||||
switch( dir )
|
switch( dir )
|
||||||
{
|
{
|
||||||
|
default: Assert(0);
|
||||||
case NORTH_WEST: v->x = -1.0f; v->y = -1.0f; break;
|
case NORTH_WEST: v->x = -1.0f; v->y = -1.0f; break;
|
||||||
case NORTH_EAST: v->x = 1.0f; v->y = -1.0f; break;
|
case NORTH_EAST: v->x = 1.0f; v->y = -1.0f; break;
|
||||||
case SOUTH_EAST: v->x = 1.0f; v->y = 1.0f; break;
|
case SOUTH_EAST: v->x = 1.0f; v->y = 1.0f; break;
|
||||||
case SOUTH_WEST: v->x = -1.0f; v->y = 1.0f; break;
|
case SOUTH_WEST: v->x = -1.0f; v->y = 1.0f; break;
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
v->NormalizeInPlace();
|
v->NormalizeInPlace();
|
||||||
@ -365,6 +365,8 @@ inline void GetCornerTypesInDirection( NavDirType dir, NavCornerType *first, Nav
|
|||||||
{
|
{
|
||||||
switch ( dir )
|
switch ( dir )
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
Assert(0);
|
||||||
case NORTH:
|
case NORTH:
|
||||||
*first = NORTH_WEST;
|
*first = NORTH_WEST;
|
||||||
*second = NORTH_EAST;
|
*second = NORTH_EAST;
|
||||||
@ -381,8 +383,6 @@ inline void GetCornerTypesInDirection( NavDirType dir, NavCornerType *first, Nav
|
|||||||
*first = NORTH_WEST;
|
*first = NORTH_WEST;
|
||||||
*second = SOUTH_WEST;
|
*second = SOUTH_WEST;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +192,8 @@ CNavArea::CNavArea( void )
|
|||||||
m_avoidanceObstacleHeight = 0.0f;
|
m_avoidanceObstacleHeight = 0.0f;
|
||||||
|
|
||||||
m_totalCost = 0.0f;
|
m_totalCost = 0.0f;
|
||||||
|
m_costSoFar = 0.0f;
|
||||||
|
m_pathLengthSoFar = 0.0f;
|
||||||
|
|
||||||
ResetNodes();
|
ResetNodes();
|
||||||
|
|
||||||
@ -244,6 +246,8 @@ CNavArea::CNavArea( void )
|
|||||||
m_isInheritedFrom = false;
|
m_isInheritedFrom = false;
|
||||||
|
|
||||||
m_funcNavCostVector.RemoveAll();
|
m_funcNavCostVector.RemoveAll();
|
||||||
|
|
||||||
|
m_nVisTestCounter = (uint32)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
@ -3381,16 +3385,10 @@ void CNavArea::AddToOpenList( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// insert self in ascending cost order
|
// insert self in ascending cost order
|
||||||
// Since costs are positive, IEEE754 let's us compare as integers (see http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm)
|
|
||||||
CNavArea *area, *last = NULL;
|
CNavArea *area, *last = NULL;
|
||||||
int thisCostBits = *reinterpret_cast<const int *>(&m_totalCost);
|
|
||||||
|
|
||||||
Assert ( m_totalCost >= 0.0f );
|
|
||||||
for( area = m_openList; area; area = area->m_nextOpen )
|
for( area = m_openList; area; area = area->m_nextOpen )
|
||||||
{
|
{
|
||||||
Assert ( area->GetTotalCost() >= 0.0f );
|
if ( GetTotalCost() < area->GetTotalCost() )
|
||||||
int thoseCostBits = *reinterpret_cast<const int *>(&area->m_totalCost);
|
|
||||||
if ( thisCostBits < thoseCostBits )
|
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5630,7 +5628,7 @@ void CNavArea::ComputeVisibilityToMesh( void )
|
|||||||
/**
|
/**
|
||||||
* The center and all four corners must ALL be visible
|
* The center and all four corners must ALL be visible
|
||||||
*/
|
*/
|
||||||
bool CNavArea::IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore ) const
|
bool CNavArea::IsEntirelyVisible( const Vector &eye, const CBaseEntity *ignore ) const
|
||||||
{
|
{
|
||||||
Vector corner;
|
Vector corner;
|
||||||
trace_t result;
|
trace_t result;
|
||||||
@ -5663,7 +5661,7 @@ bool CNavArea::IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore ) const
|
|||||||
/**
|
/**
|
||||||
* The center or any of the four corners may be visible
|
* The center or any of the four corners may be visible
|
||||||
*/
|
*/
|
||||||
bool CNavArea::IsPartiallyVisible( const Vector &eye, CBaseEntity *ignore ) const
|
bool CNavArea::IsPartiallyVisible( const Vector &eye, const CBaseEntity *ignore ) const
|
||||||
{
|
{
|
||||||
Vector corner;
|
Vector corner;
|
||||||
trace_t result;
|
trace_t result;
|
||||||
|
@ -18,6 +18,15 @@
|
|||||||
// BOTPORT: Clean up relationship between team index and danger storage in nav areas
|
// BOTPORT: Clean up relationship between team index and danger storage in nav areas
|
||||||
enum { MAX_NAV_TEAMS = 2 };
|
enum { MAX_NAV_TEAMS = 2 };
|
||||||
|
|
||||||
|
#ifdef STAGING_ONLY
|
||||||
|
inline void DebuggerBreakOnNaN_StagingOnly( float val )
|
||||||
|
{
|
||||||
|
if ( IS_NAN( val ) )
|
||||||
|
DebuggerBreak();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define DebuggerBreakOnNaN_StagingOnly( _val )
|
||||||
|
#endif
|
||||||
|
|
||||||
class CFuncElevator;
|
class CFuncElevator;
|
||||||
class CFuncNavPrerequisite;
|
class CFuncNavPrerequisite;
|
||||||
@ -445,14 +454,14 @@ public:
|
|||||||
|
|
||||||
static void ClearSearchLists( void ); // clears the open and closed lists for a new search
|
static void ClearSearchLists( void ); // clears the open and closed lists for a new search
|
||||||
|
|
||||||
void SetTotalCost( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_totalCost = value; }
|
void SetTotalCost( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_totalCost = value; }
|
||||||
float GetTotalCost( void ) const { return m_totalCost; }
|
float GetTotalCost( void ) const { DebuggerBreakOnNaN_StagingOnly( m_totalCost ); return m_totalCost; }
|
||||||
|
|
||||||
void SetCostSoFar( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_costSoFar = value; }
|
void SetCostSoFar( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_costSoFar = value; }
|
||||||
float GetCostSoFar( void ) const { return m_costSoFar; }
|
float GetCostSoFar( void ) const { DebuggerBreakOnNaN_StagingOnly( m_costSoFar ); return m_costSoFar; }
|
||||||
|
|
||||||
void SetPathLengthSoFar( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_pathLengthSoFar = value; }
|
void SetPathLengthSoFar( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_pathLengthSoFar = value; }
|
||||||
float GetPathLengthSoFar( void ) const { return m_pathLengthSoFar; }
|
float GetPathLengthSoFar( void ) const { DebuggerBreakOnNaN_StagingOnly( m_pathLengthSoFar ); return m_pathLengthSoFar; }
|
||||||
|
|
||||||
//- editing -----------------------------------------------------------------------------------------
|
//- editing -----------------------------------------------------------------------------------------
|
||||||
virtual void Draw( void ) const; // draw area for debugging & editing
|
virtual void Draw( void ) const; // draw area for debugging & editing
|
||||||
@ -515,8 +524,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore = NULL ) const; // return true if entire area is visible from given eyepoint (CPU intensive)
|
virtual bool IsEntirelyVisible( const Vector &eye, const CBaseEntity *ignore = NULL ) const; // return true if entire area is visible from given eyepoint (CPU intensive)
|
||||||
virtual bool IsPartiallyVisible( const Vector &eye, CBaseEntity *ignore = NULL ) const; // return true if any portion of the area is visible from given eyepoint (CPU intensive)
|
virtual bool IsPartiallyVisible( const Vector &eye, const CBaseEntity *ignore = NULL ) const; // return true if any portion of the area is visible from given eyepoint (CPU intensive)
|
||||||
|
|
||||||
virtual bool IsPotentiallyVisible( const CNavArea *area ) const; // return true if given area is potentially visible from somewhere in this area (very fast)
|
virtual bool IsPotentiallyVisible( const CNavArea *area ) const; // return true if given area is potentially visible from somewhere in this area (very fast)
|
||||||
virtual bool IsPotentiallyVisibleToTeam( int team ) const; // return true if any portion of this area is visible to anyone on the given team (very fast)
|
virtual bool IsPotentiallyVisibleToTeam( int team ) const; // return true if any portion of this area is visible to anyone on the given team (very fast)
|
||||||
|
@ -1809,6 +1809,8 @@ void CNavMesh::StitchAreaIntoMesh( CNavArea *area, NavDirType dir, Functor &func
|
|||||||
Vector corner1, corner2;
|
Vector corner1, corner2;
|
||||||
switch ( dir )
|
switch ( dir )
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
Assert(0);
|
||||||
case NORTH:
|
case NORTH:
|
||||||
corner1 = area->GetCorner( NORTH_WEST );
|
corner1 = area->GetCorner( NORTH_WEST );
|
||||||
corner2 = area->GetCorner( NORTH_EAST );
|
corner2 = area->GetCorner( NORTH_EAST );
|
||||||
|
@ -49,7 +49,9 @@ ConVar nav_max_vis_delta_list_length( "nav_max_vis_delta_list_length", "64", FCV
|
|||||||
|
|
||||||
extern ConVar nav_show_potentially_visible;
|
extern ConVar nav_show_potentially_visible;
|
||||||
|
|
||||||
|
#ifdef STAGING_ONLY
|
||||||
int g_DebugPathfindCounter = 0;
|
int g_DebugPathfindCounter = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool FindGroundForNode( Vector *pos, Vector *normal );
|
bool FindGroundForNode( Vector *pos, Vector *normal );
|
||||||
|
@ -1259,8 +1259,10 @@ extern CNavMesh *TheNavMesh;
|
|||||||
// factory for creating the Navigation Mesh
|
// factory for creating the Navigation Mesh
|
||||||
extern CNavMesh *NavMeshFactory( void );
|
extern CNavMesh *NavMeshFactory( void );
|
||||||
|
|
||||||
|
#ifdef STAGING_ONLY
|
||||||
// for debugging the A* algorithm, if nonzero, show debug display and decrement for each pathfind
|
// for debugging the A* algorithm, if nonzero, show debug display and decrement for each pathfind
|
||||||
extern int g_DebugPathfindCounter;
|
extern int g_DebugPathfindCounter;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
#include "mathlib/ssemath.h"
|
#include "mathlib/ssemath.h"
|
||||||
#include "nav_area.h"
|
#include "nav_area.h"
|
||||||
|
|
||||||
|
#ifdef STAGING_ONLY
|
||||||
extern int g_DebugPathfindCounter;
|
extern int g_DebugPathfindCounter;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
@ -108,7 +110,9 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
|
|||||||
*closestArea = startArea;
|
*closestArea = startArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef STAGING_ONLY
|
||||||
bool isDebug = ( g_DebugPathfindCounter-- > 0 );
|
bool isDebug = ( g_DebugPathfindCounter-- > 0 );
|
||||||
|
#endif
|
||||||
|
|
||||||
if (startArea == NULL)
|
if (startArea == NULL)
|
||||||
return false;
|
return false;
|
||||||
@ -154,10 +158,12 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
|
|||||||
// get next area to check
|
// get next area to check
|
||||||
CNavArea *area = CNavArea::PopOpenList();
|
CNavArea *area = CNavArea::PopOpenList();
|
||||||
|
|
||||||
|
#ifdef STAGING_ONLY
|
||||||
if ( isDebug )
|
if ( isDebug )
|
||||||
{
|
{
|
||||||
area->DrawFilled( 0, 255, 0, 128, 30.0f );
|
area->DrawFilled( 0, 255, 0, 128, 30.0f );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// don't consider blocked areas
|
// don't consider blocked areas
|
||||||
if ( area->IsBlocked( teamID, ignoreNavBlockers ) )
|
if ( area->IsBlocked( teamID, ignoreNavBlockers ) )
|
||||||
@ -339,7 +345,13 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
float newCostSoFar = costFunc( newArea, area, ladder, elevator, length );
|
float newCostSoFar = costFunc( newArea, area, ladder, elevator, length );
|
||||||
|
|
||||||
|
// NaNs really mess this function up causing tough to track down hangs. If
|
||||||
|
// we get inf back, clamp it down to a really high number.
|
||||||
|
DebuggerBreakOnNaN_StagingOnly( newCostSoFar );
|
||||||
|
if ( IS_NAN( newCostSoFar ) )
|
||||||
|
newCostSoFar = 1e30f;
|
||||||
|
|
||||||
// check if cost functor says this area is a dead-end
|
// check if cost functor says this area is a dead-end
|
||||||
if ( newCostSoFar < 0.0f )
|
if ( newCostSoFar < 0.0f )
|
||||||
continue;
|
continue;
|
||||||
@ -352,7 +364,7 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
|
|||||||
// Make sure that any jump to a new area incurs some pathfinsing
|
// Make sure that any jump to a new area incurs some pathfinsing
|
||||||
// cost, to avoid us spinning our wheels over insignificant cost
|
// cost, to avoid us spinning our wheels over insignificant cost
|
||||||
// benefit, floating point precision bug, or busted cost functor.
|
// benefit, floating point precision bug, or busted cost functor.
|
||||||
float minNewCostSoFar = area->GetCostSoFar() * 1.00001 + 0.00001;
|
float minNewCostSoFar = area->GetCostSoFar() * 1.00001f + 0.00001f;
|
||||||
newCostSoFar = Max( newCostSoFar, minNewCostSoFar );
|
newCostSoFar = Max( newCostSoFar, minNewCostSoFar );
|
||||||
|
|
||||||
// stop if path length limit reached
|
// stop if path length limit reached
|
||||||
|
@ -24,7 +24,7 @@ class CStringTableSaveRestoreOps;
|
|||||||
#define MAX_MATERIAL_STRINGS ( 1 << MAX_MATERIAL_STRING_BITS )
|
#define MAX_MATERIAL_STRINGS ( 1 << MAX_MATERIAL_STRING_BITS )
|
||||||
#define OVERLAY_MATERIAL_INVALID_STRING ( MAX_MATERIAL_STRINGS - 1 )
|
#define OVERLAY_MATERIAL_INVALID_STRING ( MAX_MATERIAL_STRINGS - 1 )
|
||||||
|
|
||||||
#define MAX_CHOREO_SCENES_STRING_BITS 12
|
#define MAX_CHOREO_SCENES_STRING_BITS 13
|
||||||
#define MAX_CHOREO_SCENES_STRINGS ( 1 << MAX_CHOREO_SCENES_STRING_BITS )
|
#define MAX_CHOREO_SCENES_STRINGS ( 1 << MAX_CHOREO_SCENES_STRING_BITS )
|
||||||
#define CHOREO_SCENES_INVALID_STRING ( MAX_CHOREO_SCENES_STRINGS - 1 )
|
#define CHOREO_SCENES_INVALID_STRING ( MAX_CHOREO_SCENES_STRINGS - 1 )
|
||||||
|
|
||||||
|
@ -742,7 +742,9 @@ void CPhysicsPushedEntities::GenerateBlockingEntityListAddBox( const Vector &vec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TF_DLL
|
||||||
|
#include "tf_logic_robot_destruction.h"
|
||||||
|
#endif
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Gets a list of all entities hierarchically attached to the root
|
// Purpose: Gets a list of all entities hierarchically attached to the root
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1841,7 +1843,9 @@ void CBaseEntity::PhysicsStepRunTimestep( float timestep )
|
|||||||
{
|
{
|
||||||
bool wasonground;
|
bool wasonground;
|
||||||
bool inwater;
|
bool inwater;
|
||||||
|
#if 0
|
||||||
bool hitsound = false;
|
bool hitsound = false;
|
||||||
|
#endif
|
||||||
float speed, newspeed, control;
|
float speed, newspeed, control;
|
||||||
float friction;
|
float friction;
|
||||||
|
|
||||||
@ -1862,10 +1866,12 @@ void CBaseEntity::PhysicsStepRunTimestep( float timestep )
|
|||||||
{
|
{
|
||||||
if ( !( ( GetFlags() & FL_SWIM ) && ( GetWaterLevel() > 0 ) ) )
|
if ( !( ( GetFlags() & FL_SWIM ) && ( GetWaterLevel() > 0 ) ) )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if ( GetAbsVelocity()[2] < ( GetCurrentGravity() * -0.1 ) )
|
if ( GetAbsVelocity()[2] < ( GetCurrentGravity() * -0.1 ) )
|
||||||
{
|
{
|
||||||
hitsound = true;
|
hitsound = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( !inwater )
|
if ( !inwater )
|
||||||
{
|
{
|
||||||
|
@ -635,6 +635,8 @@ CBasePlayer::CBasePlayer( )
|
|||||||
|
|
||||||
m_flLastUserCommandTime = 0.f;
|
m_flLastUserCommandTime = 0.f;
|
||||||
m_flMovementTimeForUserCmdProcessingRemaining = 0.0f;
|
m_flMovementTimeForUserCmdProcessingRemaining = 0.0f;
|
||||||
|
|
||||||
|
m_flLastObjectiveTime = -1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBasePlayer::~CBasePlayer( )
|
CBasePlayer::~CBasePlayer( )
|
||||||
@ -2473,6 +2475,7 @@ void CBasePlayer::ValidateCurrentObserverTarget( void )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if !defined( TF_DLL )
|
||||||
// couldn't find new target, switch to temporary mode
|
// couldn't find new target, switch to temporary mode
|
||||||
if ( mp_forcecamera.GetInt() == OBS_ALLOW_ALL )
|
if ( mp_forcecamera.GetInt() == OBS_ALLOW_ALL )
|
||||||
{
|
{
|
||||||
@ -2480,10 +2483,11 @@ void CBasePlayer::ValidateCurrentObserverTarget( void )
|
|||||||
ForceObserverMode( OBS_MODE_ROAMING );
|
ForceObserverMode( OBS_MODE_ROAMING );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// fix player view right where it is
|
// fix player view right where it is
|
||||||
ForceObserverMode( OBS_MODE_FIXED );
|
ForceObserverMode( OBS_MODE_FIXED );
|
||||||
m_hObserverTarget.Set( NULL ); // no traget to follow
|
m_hObserverTarget.Set( NULL ); // no target to follow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7379,7 +7383,7 @@ void CBasePlayer::EquipWearable( CEconWearable *pItem )
|
|||||||
pItem->Equip( this );
|
pItem->Equip( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DBGFLAG_ASSERT
|
||||||
// Double check list integrity.
|
// Double check list integrity.
|
||||||
for ( int i = m_hMyWearables.Count()-1; i >= 0; --i )
|
for ( int i = m_hMyWearables.Count()-1; i >= 0; --i )
|
||||||
{
|
{
|
||||||
@ -7418,7 +7422,7 @@ void CBasePlayer::RemoveWearable( CEconWearable *pItem )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DBGFLAG_ASSERT
|
||||||
// Double check list integrity.
|
// Double check list integrity.
|
||||||
for ( int i = m_hMyWearables.Count()-1; i >= 0; --i )
|
for ( int i = m_hMyWearables.Count()-1; i >= 0; --i )
|
||||||
{
|
{
|
||||||
@ -8853,6 +8857,8 @@ void CBasePlayer::SetPlayerName( const char *name )
|
|||||||
Assert( strlen(name) > 0 );
|
Assert( strlen(name) > 0 );
|
||||||
|
|
||||||
Q_strncpy( m_szNetname, name, sizeof(m_szNetname) );
|
Q_strncpy( m_szNetname, name, sizeof(m_szNetname) );
|
||||||
|
// Be extra thorough
|
||||||
|
Q_RemoveAllEvilCharacters( m_szNetname );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8947,8 +8953,27 @@ void CBasePlayer::HandleAnimEvent( animevent_t *pEvent )
|
|||||||
BaseClass::HandleAnimEvent( pEvent );
|
BaseClass::HandleAnimEvent( pEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// CPlayerInfo functions (simple passthroughts to get around the CBasePlayer multiple inheritence limitation)
|
// Purpose:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool CBasePlayer::ShouldAnnounceAchievement( void )
|
||||||
|
{
|
||||||
|
m_flAchievementTimes.AddToTail( gpGlobals->curtime );
|
||||||
|
if ( m_flAchievementTimes.Count() > 3 )
|
||||||
|
{
|
||||||
|
m_flAchievementTimes.Remove( 0 );
|
||||||
|
if ( m_flAchievementTimes.Tail() - m_flAchievementTimes.Head() <= 60.0 )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// CPlayerInfo functions (simple pass-through to get around the CBasePlayer multiple inheritance limitation)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
const char *CPlayerInfo::GetName()
|
const char *CPlayerInfo::GetName()
|
||||||
{
|
{
|
||||||
|
@ -612,7 +612,7 @@ public:
|
|||||||
|
|
||||||
virtual void HandleAnimEvent( animevent_t *pEvent );
|
virtual void HandleAnimEvent( animevent_t *pEvent );
|
||||||
|
|
||||||
virtual bool ShouldAnnounceAchievement( void ){ return true; }
|
virtual bool ShouldAnnounceAchievement( void );
|
||||||
|
|
||||||
#if defined USES_ECON_ITEMS
|
#if defined USES_ECON_ITEMS
|
||||||
// Wearables
|
// Wearables
|
||||||
@ -820,7 +820,9 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// How long since this player last interacted with something the game considers an objective/target/goal
|
||||||
|
float GetTimeSinceLastObjective( void ) const { return ( m_flLastObjectiveTime == -1.f ) ? 999.f : gpGlobals->curtime - m_flLastObjectiveTime; }
|
||||||
|
void SetLastObjectiveTime( float flTime ) { m_flLastObjectiveTime = flTime; }
|
||||||
|
|
||||||
// Used by gamemovement to check if the entity is stuck.
|
// Used by gamemovement to check if the entity is stuck.
|
||||||
int m_StuckLast;
|
int m_StuckLast;
|
||||||
@ -895,6 +897,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
Activity m_Activity;
|
Activity m_Activity;
|
||||||
|
float m_flLastObjectiveTime; // Last curtime player touched/killed something the gamemode considers an objective
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -1210,6 +1213,9 @@ private:
|
|||||||
// Store the last time we successfully processed a usercommand
|
// Store the last time we successfully processed a usercommand
|
||||||
float m_flLastUserCommandTime;
|
float m_flLastUserCommandTime;
|
||||||
|
|
||||||
|
// used to prevent achievement announcement spam
|
||||||
|
CUtlVector< float > m_flAchievementTimes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual unsigned int PlayerSolidMask( bool brushOnly = false ) const; // returns the solid mask for the given player, so bots can have a more-restrictive set
|
virtual unsigned int PlayerSolidMask( bool brushOnly = false ) const; // returns the solid mask for the given player, so bots can have a more-restrictive set
|
||||||
|
|
||||||
|
@ -172,6 +172,7 @@ class CLagCompensationManager : public CAutoGameSystemPerFrame, public ILagCompe
|
|||||||
public:
|
public:
|
||||||
CLagCompensationManager( char const *name ) : CAutoGameSystemPerFrame( name ), m_flTeleportDistanceSqr( 64 *64 )
|
CLagCompensationManager( char const *name ) : CAutoGameSystemPerFrame( name ), m_flTeleportDistanceSqr( 64 *64 )
|
||||||
{
|
{
|
||||||
|
m_isCurrentlyDoingCompensation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IServerSystem stuff
|
// IServerSystem stuff
|
||||||
@ -194,6 +195,8 @@ public:
|
|||||||
void StartLagCompensation( CBasePlayer *player, CUserCmd *cmd );
|
void StartLagCompensation( CBasePlayer *player, CUserCmd *cmd );
|
||||||
void FinishLagCompensation( CBasePlayer *player );
|
void FinishLagCompensation( CBasePlayer *player );
|
||||||
|
|
||||||
|
bool IsCurrentlyDoingLagCompensation() const OVERRIDE { return m_isCurrentlyDoingCompensation; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void BacktrackPlayer( CBasePlayer *player, float flTargetTime );
|
void BacktrackPlayer( CBasePlayer *player, float flTargetTime );
|
||||||
|
|
||||||
@ -216,6 +219,8 @@ private:
|
|||||||
CBasePlayer *m_pCurrentPlayer; // The player we are doing lag compensation for
|
CBasePlayer *m_pCurrentPlayer; // The player we are doing lag compensation for
|
||||||
|
|
||||||
float m_flTeleportDistanceSqr;
|
float m_flTeleportDistanceSqr;
|
||||||
|
|
||||||
|
bool m_isCurrentlyDoingCompensation; // Sentinel to prevent calling StartLagCompensation a second time before a Finish.
|
||||||
};
|
};
|
||||||
|
|
||||||
static CLagCompensationManager g_LagCompensationManager( "CLagCompensationManager" );
|
static CLagCompensationManager g_LagCompensationManager( "CLagCompensationManager" );
|
||||||
@ -322,6 +327,8 @@ void CLagCompensationManager::FrameUpdatePostEntityThink()
|
|||||||
// Called during player movement to set up/restore after lag compensation
|
// Called during player movement to set up/restore after lag compensation
|
||||||
void CLagCompensationManager::StartLagCompensation( CBasePlayer *player, CUserCmd *cmd )
|
void CLagCompensationManager::StartLagCompensation( CBasePlayer *player, CUserCmd *cmd )
|
||||||
{
|
{
|
||||||
|
Assert( !m_isCurrentlyDoingCompensation );
|
||||||
|
|
||||||
//DONT LAG COMP AGAIN THIS FRAME IF THERES ALREADY ONE IN PROGRESS
|
//DONT LAG COMP AGAIN THIS FRAME IF THERES ALREADY ONE IN PROGRESS
|
||||||
//IF YOU'RE HITTING THIS THEN IT MEANS THERES A CODE BUG
|
//IF YOU'RE HITTING THIS THEN IT MEANS THERES A CODE BUG
|
||||||
if ( m_pCurrentPlayer )
|
if ( m_pCurrentPlayer )
|
||||||
@ -350,6 +357,8 @@ void CLagCompensationManager::StartLagCompensation( CBasePlayer *player, CUserCm
|
|||||||
Q_memset( m_RestoreData, 0, sizeof( m_RestoreData ) );
|
Q_memset( m_RestoreData, 0, sizeof( m_RestoreData ) );
|
||||||
Q_memset( m_ChangeData, 0, sizeof( m_ChangeData ) );
|
Q_memset( m_ChangeData, 0, sizeof( m_ChangeData ) );
|
||||||
|
|
||||||
|
m_isCurrentlyDoingCompensation = true;
|
||||||
|
|
||||||
// Get true latency
|
// Get true latency
|
||||||
|
|
||||||
// correct is the amout of time we have to correct game time
|
// correct is the amout of time we have to correct game time
|
||||||
@ -734,7 +743,10 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer *player )
|
|||||||
m_pCurrentPlayer = NULL;
|
m_pCurrentPlayer = NULL;
|
||||||
|
|
||||||
if ( !m_bNeedToRestore )
|
if ( !m_bNeedToRestore )
|
||||||
|
{
|
||||||
|
m_isCurrentlyDoingCompensation = false;
|
||||||
return; // no player was changed at all
|
return; // no player was changed at all
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate all active players
|
// Iterate all active players
|
||||||
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
|
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
|
||||||
@ -828,6 +840,8 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer *player )
|
|||||||
pPlayer->SetSimulationTime( restore->m_flSimulationTime );
|
pPlayer->SetSimulationTime( restore->m_flSimulationTime );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_isCurrentlyDoingCompensation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void CRecipientFilter::AddAllPlayers( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecipientFilter::AddRecipient( CBasePlayer *player )
|
void CRecipientFilter::AddRecipient( const CBasePlayer *player )
|
||||||
{
|
{
|
||||||
Assert( player );
|
Assert( player );
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
void AddRecipientsByPVS( const Vector& origin );
|
void AddRecipientsByPVS( const Vector& origin );
|
||||||
void RemoveRecipientsByPVS( const Vector& origin );
|
void RemoveRecipientsByPVS( const Vector& origin );
|
||||||
void AddRecipientsByPAS( const Vector& origin );
|
void AddRecipientsByPAS( const Vector& origin );
|
||||||
void AddRecipient( CBasePlayer *player );
|
void AddRecipient( const CBasePlayer *player );
|
||||||
void RemoveAllRecipients( void );
|
void RemoveAllRecipients( void );
|
||||||
void RemoveRecipient( CBasePlayer *player );
|
void RemoveRecipient( CBasePlayer *player );
|
||||||
void RemoveRecipientByPlayerIndex( int playerindex );
|
void RemoveRecipientByPlayerIndex( int playerindex );
|
||||||
@ -82,7 +82,7 @@ private:
|
|||||||
class CSingleUserRecipientFilter : public CRecipientFilter
|
class CSingleUserRecipientFilter : public CRecipientFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSingleUserRecipientFilter( CBasePlayer *player )
|
CSingleUserRecipientFilter( const CBasePlayer *player )
|
||||||
{
|
{
|
||||||
AddRecipient( player );
|
AddRecipient( player );
|
||||||
}
|
}
|
||||||
|
@ -2163,11 +2163,6 @@ void CSceneEntity::InputTriggerEvent( inputdata_t &inputdata )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NPCInterjection
|
|
||||||
{
|
|
||||||
AI_Response *response;
|
|
||||||
CAI_BaseActor *npc;
|
|
||||||
};
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Input : &inputdata -
|
// Input : &inputdata -
|
||||||
@ -2176,93 +2171,62 @@ void CSceneEntity::InputInterjectResponse( inputdata_t &inputdata )
|
|||||||
{
|
{
|
||||||
// Not currently playing a scene
|
// Not currently playing a scene
|
||||||
if ( !m_pScene )
|
if ( !m_pScene )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
CUtlVector< CAI_BaseActor * > candidates;
|
CUtlVector<CAI_BaseActor *> candidates;
|
||||||
int i;
|
|
||||||
for ( i = 0 ; i < m_pScene->GetNumActors(); i++ )
|
for ( int i = 0 ; i < m_pScene->GetNumActors(); i++ )
|
||||||
{
|
{
|
||||||
CBaseFlex *pTestActor = FindNamedActor( i );
|
CBaseFlex *pTestActor = FindNamedActor( i );
|
||||||
if ( !pTestActor )
|
if ( !pTestActor )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CAI_BaseActor *pBaseActor = dynamic_cast<CAI_BaseActor*>(pTestActor);
|
CAI_BaseActor *pBaseActor = dynamic_cast<CAI_BaseActor *>(pTestActor);
|
||||||
if ( !pBaseActor )
|
if ( !pBaseActor || !pBaseActor->IsAlive() )
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( !pBaseActor->IsAlive() )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
candidates.AddToTail( pBaseActor );
|
candidates.AddToTail( pBaseActor );
|
||||||
}
|
}
|
||||||
|
|
||||||
int c = candidates.Count();
|
int c = candidates.Count();
|
||||||
|
|
||||||
if ( !c )
|
if ( !c )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int useIndex = 0;
|
|
||||||
if ( !m_bIsPlayingBack )
|
if ( !m_bIsPlayingBack )
|
||||||
{
|
{
|
||||||
// Use any actor if not playing a scene
|
// Use any actor if not playing a scene
|
||||||
useIndex = RandomInt( 0, c - 1 );
|
// int useIndex = RandomInt( 0, c - 1 );
|
||||||
|
Assert( !"m_bIsPlayBack is false and this code does nothing. Should it?");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CUtlVector< NPCInterjection > validResponses;
|
CUtlString modifiers("scene:");
|
||||||
|
modifiers += STRING( GetEntityName() );
|
||||||
|
|
||||||
char modifiers[ 512 ];
|
while (candidates.Count() > 0)
|
||||||
Q_snprintf( modifiers, sizeof( modifiers ), "scene:%s", STRING( GetEntityName() ) );
|
|
||||||
|
|
||||||
for ( int i = 0; i < c; i++ )
|
|
||||||
{
|
{
|
||||||
CAI_BaseActor *npc = candidates[ i ];
|
// Pick a random slot in the candidates array.
|
||||||
Assert( npc );
|
int slot = RandomInt( 0, candidates.Count() - 1 );
|
||||||
|
|
||||||
AI_Response *response = npc->SpeakFindResponse( inputdata.value.String(), modifiers );
|
CAI_BaseActor *npc = candidates[ slot ];
|
||||||
if ( !response )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
float duration = npc->GetResponseDuration( response );
|
// Try to find the response for this slot.
|
||||||
// Couldn't look it up
|
AI_Response response;
|
||||||
if ( duration <= 0.0f )
|
bool result = npc->SpeakFindResponse( response, inputdata.value.String(), modifiers.Get() );
|
||||||
continue;
|
if ( result )
|
||||||
|
|
||||||
if ( !npc->PermitResponse( duration ) )
|
|
||||||
{
|
{
|
||||||
delete response;
|
float duration = npc->GetResponseDuration( response );
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
if ( ( duration > 0.0f ) && npc->PermitResponse( duration ) )
|
||||||
NPCInterjection inter;
|
|
||||||
inter.response = response;
|
|
||||||
inter.npc = npc;
|
|
||||||
|
|
||||||
validResponses.AddToTail( inter );
|
|
||||||
}
|
|
||||||
|
|
||||||
int rcount = validResponses.Count();
|
|
||||||
if ( rcount >= 1 )
|
|
||||||
{
|
|
||||||
int slot = RandomInt( 0, rcount - 1 );
|
|
||||||
|
|
||||||
for ( int i = 0; i < rcount; i++ )
|
|
||||||
{
|
|
||||||
NPCInterjection *pInterjection = &validResponses[ i ];
|
|
||||||
if ( i == slot )
|
|
||||||
{
|
{
|
||||||
pInterjection->npc->SpeakDispatchResponse( inputdata.value.String(), pInterjection->response );
|
// If we could look it up, dispatch it and bail.
|
||||||
}
|
npc->SpeakDispatchResponse( inputdata.value.String(), response );
|
||||||
else
|
return;
|
||||||
{
|
|
||||||
delete pInterjection->response;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove this entry and look for another one.
|
||||||
|
candidates.FastRemove(slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2783,12 +2747,12 @@ void CSceneEntity::QueueResumePlayback( void )
|
|||||||
CAI_BaseActor *pBaseActor = dynamic_cast<CAI_BaseActor*>(pActor);
|
CAI_BaseActor *pBaseActor = dynamic_cast<CAI_BaseActor*>(pActor);
|
||||||
if ( pBaseActor )
|
if ( pBaseActor )
|
||||||
{
|
{
|
||||||
AI_Response *result = pBaseActor->SpeakFindResponse( STRING(m_iszResumeSceneFile), NULL );
|
AI_Response response;
|
||||||
|
bool result = pBaseActor->SpeakFindResponse( response, STRING(m_iszResumeSceneFile), NULL );
|
||||||
if ( result )
|
if ( result )
|
||||||
{
|
{
|
||||||
char response[ 256 ];
|
const char *szResponse = response.GetResponsePtr();
|
||||||
result->GetResponse( response, sizeof( response ) );
|
bStartedScene = InstancedScriptedScene( NULL, szResponse, &m_hWaitingForThisResumeScene, 0, false ) != 0;
|
||||||
bStartedScene = InstancedScriptedScene( NULL, response, &m_hWaitingForThisResumeScene, 0, false ) != 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ void SendProxy_EHandleToInt( const SendProp *pProp, const void *pStruct, const v
|
|||||||
|
|
||||||
if ( pHandle && pHandle->Get() )
|
if ( pHandle && pHandle->Get() )
|
||||||
{
|
{
|
||||||
int iSerialNum = pHandle->GetSerialNumber() & (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1;
|
int iSerialNum = pHandle->GetSerialNumber() & ( (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1 );
|
||||||
pOut->m_Int = pHandle->GetEntryIndex() | (iSerialNum << MAX_EDICT_BITS);
|
pOut->m_Int = pHandle->GetEntryIndex() | (iSerialNum << MAX_EDICT_BITS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -106,6 +106,7 @@ REGISTER_SEND_PROXY_NON_MODIFIED_POINTER( SendProxy_OnlyToTeam );
|
|||||||
#define TIME_BITS 24
|
#define TIME_BITS 24
|
||||||
|
|
||||||
// This table encodes edict data.
|
// This table encodes edict data.
|
||||||
|
#if 0
|
||||||
static void SendProxy_Time( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID )
|
static void SendProxy_Time( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID )
|
||||||
{
|
{
|
||||||
float clock_base = floor( gpGlobals->curtime );
|
float clock_base = floor( gpGlobals->curtime );
|
||||||
@ -119,6 +120,7 @@ static void SendProxy_Time( const SendProp *pProp, const void *pStruct, const vo
|
|||||||
|
|
||||||
pOut->m_Int = addt;
|
pOut->m_Int = addt;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
|
@ -1187,7 +1187,7 @@ int SENTENCEG_PlayRndI(edict_t *entity, int isentenceg,
|
|||||||
name[0] = 0;
|
name[0] = 0;
|
||||||
|
|
||||||
ipick = engine->SentenceGroupPick( isentenceg, name, sizeof( name ) );
|
ipick = engine->SentenceGroupPick( isentenceg, name, sizeof( name ) );
|
||||||
if (ipick > 0 && name)
|
if ( ( ipick > 0 ) && name[0] )
|
||||||
{
|
{
|
||||||
int sentenceIndex = SENTENCEG_Lookup( name );
|
int sentenceIndex = SENTENCEG_Lookup( name );
|
||||||
CPASAttenuationFilter filter( GetContainingEntity( entity ), soundlevel );
|
CPASAttenuationFilter filter( GetContainingEntity( entity ), soundlevel );
|
||||||
|
@ -1267,7 +1267,7 @@ float CTeamControlPointMaster::GetPartialCapturePointRate( void )
|
|||||||
return m_flPartialCapturePointsRate;
|
return m_flPartialCapturePointsRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#ifdef STAGING_ONLY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1344,4 +1344,4 @@ void cc_PlayRound( const CCommand& args )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ConCommand playround( "playround", cc_PlayRound, "Play the selected round\n\tArgument: {round name given by \"listrounds\" command}", FCVAR_CHEAT );
|
static ConCommand playround( "playround", cc_PlayRound, "Play the selected round\n\tArgument: {round name given by \"listrounds\" command}", FCVAR_CHEAT );
|
||||||
*/
|
#endif
|
@ -121,14 +121,18 @@ public:
|
|||||||
bool ShouldScorePerCapture( void ){ return m_bScorePerCapture; }
|
bool ShouldScorePerCapture( void ){ return m_bScorePerCapture; }
|
||||||
bool ShouldPlayAllControlPointRounds( void ){ return m_bPlayAllRounds; }
|
bool ShouldPlayAllControlPointRounds( void ){ return m_bPlayAllRounds; }
|
||||||
int NumPlayableControlPointRounds( void ); // checks to see if there are any more rounds to play (but doesn't actually "get" one to play)
|
int NumPlayableControlPointRounds( void ); // checks to see if there are any more rounds to play (but doesn't actually "get" one to play)
|
||||||
|
|
||||||
// void ListRounds( void );
|
#ifdef STAGING_ONLY
|
||||||
|
void ListRounds( void );
|
||||||
|
#endif
|
||||||
|
|
||||||
float GetPartialCapturePointRate( void );
|
float GetPartialCapturePointRate( void );
|
||||||
|
|
||||||
void SetLastOwnershipChangeTime( float m_flTime ) { m_flLastOwnershipChangeTime = m_flTime; }
|
void SetLastOwnershipChangeTime( float m_flTime ) { m_flLastOwnershipChangeTime = m_flTime; }
|
||||||
float GetLastOwnershipChangeTime( void ) { return m_flLastOwnershipChangeTime; }
|
float GetLastOwnershipChangeTime( void ) { return m_flLastOwnershipChangeTime; }
|
||||||
|
|
||||||
|
int GetCurrentRoundIndex() { return m_iCurrentRoundIndex; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void EXPORT CPMThink( void );
|
void EXPORT CPMThink( void );
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ BEGIN_DATADESC( CTeamTrainWatcher )
|
|||||||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetSpeedForwardModifier", InputSetSpeedForwardModifier ),
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetSpeedForwardModifier", InputSetSpeedForwardModifier ),
|
||||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetTrainRecedeTime", InputSetTrainRecedeTime ),
|
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetTrainRecedeTime", InputSetTrainRecedeTime ),
|
||||||
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetTrainCanRecede", InputSetTrainCanRecede ),
|
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetTrainCanRecede", InputSetTrainCanRecede ),
|
||||||
|
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetTrainRecedeTimeAndUpdate", InputSetTrainRecedeTimeAndUpdate ),
|
||||||
|
|
||||||
// Outputs
|
// Outputs
|
||||||
DEFINE_OUTPUT( m_OnTrainStartRecede, "OnTrainStartRecede" ),
|
DEFINE_OUTPUT( m_OnTrainStartRecede, "OnTrainStartRecede" ),
|
||||||
@ -714,6 +715,24 @@ void CTeamTrainWatcher::InputSetTrainRecedeTime( inputdata_t &inputdata )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTeamTrainWatcher::InputSetTrainRecedeTimeAndUpdate(inputdata_t &inputdata)
|
||||||
|
{
|
||||||
|
InputSetTrainRecedeTime( inputdata );
|
||||||
|
|
||||||
|
// update our time if we're already counting down
|
||||||
|
if ( m_flRecedeTime > 0 )
|
||||||
|
{
|
||||||
|
m_flRecedeTotalTime = tf_escort_recede_time.GetFloat();
|
||||||
|
if ( m_nTrainRecedeTime > 0 )
|
||||||
|
{
|
||||||
|
m_flRecedeTotalTime = m_nTrainRecedeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_flRecedeStartTime = gpGlobals->curtime;
|
||||||
|
m_flRecedeTime = m_flRecedeStartTime + m_flRecedeTotalTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CTeamTrainWatcher::InputSetTrainCanRecede( inputdata_t &inputdata )
|
void CTeamTrainWatcher::InputSetTrainCanRecede( inputdata_t &inputdata )
|
||||||
{
|
{
|
||||||
m_bTrainCanRecede = inputdata.value.Bool();
|
m_bTrainCanRecede = inputdata.value.Bool();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user