mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2026-10-10 03:43:06 +08:00
Sync with latest source-sdk-2013.
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
// Resource counts;
|
||||
#define MAX_MODEL_INDEX_BITS 11 // sent as a short
|
||||
#define MAX_MODEL_INDEX_BITS 12 // sent as a short
|
||||
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
|
||||
|
||||
#define MAX_GENERIC_INDEX_BITS 9
|
||||
|
||||
+5
-8
@@ -11,8 +11,11 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "strtools.h"
|
||||
#include "steam/steamclientpublic.h"
|
||||
#if !defined( INCLUDED_STEAM_STEAMUSERIDTYPES_H )
|
||||
#include "SteamCommon.h"
|
||||
#define INCLUDED_STEAM2_USERID_STRUCTS
|
||||
#include "SteamCommon.h"
|
||||
#endif
|
||||
|
||||
#define IDTYPE_WON 0
|
||||
@@ -23,13 +26,7 @@
|
||||
typedef struct USERID_s
|
||||
{
|
||||
int idtype;
|
||||
|
||||
union
|
||||
{
|
||||
TSteamGlobalUserID steamid;
|
||||
} uid;
|
||||
|
||||
// unsigned int clientip;
|
||||
CSteamID steamid;
|
||||
} USERID_t;
|
||||
|
||||
#endif // USERID_H
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
pushd %~dp0
|
||||
devtools\bin\vpc.exe /hl2mp +everything /mksln everything.sln
|
||||
popd
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
pushd %~dp0
|
||||
devtools\bin\vpc.exe /hl2mp +game /mksln games.sln
|
||||
popd
|
||||
|
||||
@@ -25,7 +25,7 @@ GCC_REUSE_STRINGS = YES
|
||||
// following line to the xcconfig:
|
||||
// CLANG_CXX_LIBRARY = libc++
|
||||
GCC_PREPROCESSOR_DEFINITIONS = _DLL_EXT=.dylib NO_MALLOC_OVERRIDE=1 VPROF_LEVEL=1 NO_HOOK_MALLOC=1 PNG_NO_PEDANTIC_WARNINGS CPP11_NO_LIBCXX
|
||||
BASE_CFLAGS= -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
|
||||
BASE_CFLAGS= -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE -ftemplate-depth=512
|
||||
|
||||
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO
|
||||
WARNING_CFLAGS = -Wno-deprecated-writable-strings -Wno-switch-enum -Wno-switch -Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses -Wno-c++11-narrowing
|
||||
@@ -41,6 +41,6 @@ CLANG_CXX_LANGUAGE_STANDARD = gnu++11
|
||||
// gets into the header map, so sacrifice speed for corectness.
|
||||
USE_HEADERMAP = NO
|
||||
|
||||
SDKROOT = macosx10.7
|
||||
SDKROOT = macosx10.9
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.5
|
||||
GCC_FAST_MATH = YES
|
||||
|
||||
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:
|
||||
# CC = clang
|
||||
# CXX = clang++
|
||||
ifneq (,$(findstring clang,$(CXX)))
|
||||
CLANG_BUILD = 1
|
||||
endif
|
||||
|
||||
ifeq ($(CFG), release)
|
||||
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3.
|
||||
# There also was no speed difference running at 1280x1024. May 2012, mikesart.
|
||||
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
|
||||
# -fno-omit-frame-pointer: need this for stack traces with perf.
|
||||
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
|
||||
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
|
||||
OptimizerLevel_CompilerSpecific = -O0
|
||||
#-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
|
||||
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive
|
||||
# turns these into warnings in gcc, and -Wno-c++11-narrowing suppresses them entirely in clang 3.1+.
|
||||
ifeq ($(CXX),clang++)
|
||||
CXXFLAGS = $(CFLAGS) -Wno-c++11-narrowing
|
||||
ifeq ($(CLANG_BUILD),1)
|
||||
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
|
||||
else
|
||||
CXXFLAGS = $(CFLAGS) -fpermissive
|
||||
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive
|
||||
endif
|
||||
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
|
||||
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
|
||||
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
|
||||
GENDEP_CXXFLAGS = -MMD -MP -MF $(@:.o=.P)
|
||||
MAP_FLAGS =
|
||||
Srv_GAMEOUTPUTFILE =
|
||||
COPY_DLL_TO_SRV = 0
|
||||
@@ -57,11 +66,30 @@ COPY_DLL_TO_SRV = 0
|
||||
ifeq ($(STEAM_BRANCH),1)
|
||||
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
|
||||
else
|
||||
WARN_FLAGS = -Wno-write-strings -Wno-multichar
|
||||
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
|
||||
|
||||
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)
|
||||
# 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
|
||||
# buildbot and everyone has a bit of time to get it installed.
|
||||
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
|
||||
# The steam-runtime is incompatible with clang at this point, so disable it
|
||||
# if clang is enabled.
|
||||
ifneq ($(CXX),clang++)
|
||||
VALVE_BINDIR = /valve/steam-runtime/bin/
|
||||
endif
|
||||
endif
|
||||
|
||||
GCC_VER =
|
||||
MARCH_TARGET = pentium4
|
||||
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
|
||||
@@ -98,7 +123,10 @@ ifeq ($(OS),Linux)
|
||||
STRIP_FLAGS = -x
|
||||
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
|
||||
# instruction set extensions are available by default.
|
||||
SSE_GEN_FLAGS = -msse2
|
||||
@@ -114,19 +142,18 @@ ifeq ($(OS),Linux)
|
||||
ifeq ($(origin AR), default)
|
||||
AR = $(VALVE_BINDIR)ar crs
|
||||
endif
|
||||
ifeq ($(origin CC),default)
|
||||
ifeq ($(origin CC), default)
|
||||
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
|
||||
endif
|
||||
ifeq ($(origin CXX), default)
|
||||
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
|
||||
endif
|
||||
|
||||
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
|
||||
# a ccache quirk. Could also upgrade ccache.
|
||||
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
|
||||
ifeq ($(CC),clang)
|
||||
ifeq ($(CLANG_BUILD),1)
|
||||
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
|
||||
endif
|
||||
ifeq ($(CXX),clang++)
|
||||
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
|
||||
endif
|
||||
LINK ?= $(CC)
|
||||
@@ -180,84 +207,6 @@ ifeq ($(OS),Linux)
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
|
||||
MAC_SDK_VER ?= 10.6
|
||||
MAC_SDK := macosx$(MAC_SDK_VER)
|
||||
SYSROOT := $(shell xcodebuild -sdk $(MAC_SDK) -version Path)
|
||||
|
||||
ifneq ($(origin MAC_SDK_VER), file)
|
||||
$(warning Attempting build with SDK version $(MAC_SDK_VER), only 10.6 is supported and recommended!)
|
||||
endif
|
||||
|
||||
ifeq ($(SYSROOT),)
|
||||
FIRSTSDK := $(firstword $(sort $(shell xcodebuild -showsdks | grep macosx | sed 's/.*macosx//')))
|
||||
$(error Could not find SDK version $(MAC_SDK_VER). Install and configure Xcode 4.3, or build with: make MAC_SDK_VER=$(FIRSTSDK))
|
||||
endif
|
||||
|
||||
ifeq ($(origin CC), default)
|
||||
# Test to see if you have a compiler in the right place, if you
|
||||
# don't abort with an error
|
||||
CLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang)
|
||||
ifeq ($(wildcard $(CLANG)),)
|
||||
$(error Unable to find C compiler, install and configure Xcode 4.3)
|
||||
endif
|
||||
|
||||
CC := $(CCACHE) $(CLANG) -Qunused-arguments
|
||||
endif
|
||||
|
||||
ifeq ($(origin CXX), default)
|
||||
CXXLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang++)
|
||||
ifeq ($(wildcard $(CXXLANG)),)
|
||||
$(error Unable to find C++ compiler, install and configure Xcode 4.3)
|
||||
endif
|
||||
|
||||
CXX := $(CCACHE) $(CXXLANG) -Qunused-arguments
|
||||
endif
|
||||
LINK ?= $(CXX)
|
||||
|
||||
ifeq ($(origin AR), default)
|
||||
AR := $(shell xcrun -sdk $(MAC_SDK) -find libtool) -static -o
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_PLATFORM),osx64)
|
||||
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
|
||||
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
|
||||
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
|
||||
else
|
||||
# dirty hack to build a universal binary - don't specify the architecture
|
||||
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
|
||||
endif
|
||||
|
||||
GEN_SYM ?= $(shell xcrun -sdk $(MAC_SDK) -find dsymutil)
|
||||
ifeq ($(CFG),release)
|
||||
STRIP ?= strip -S
|
||||
else
|
||||
STRIP ?= true
|
||||
endif
|
||||
ifeq ($(SOURCE_SDK), 1)
|
||||
VSIGN ?= true
|
||||
else
|
||||
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
|
||||
endif
|
||||
|
||||
CPPFLAGS += -I$(SYSROOT)/usr/include/malloc
|
||||
CFLAGS += -isysroot $(SYSROOT) -mmacosx-version-min=10.5 -fasm-blocks
|
||||
|
||||
LIB_START_EXE = -lm -ldl -lpthread
|
||||
LIB_END_EXE =
|
||||
|
||||
LIB_START_SHLIB =
|
||||
LIB_END_SHLIB =
|
||||
|
||||
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
||||
|
||||
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
|
||||
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
# Profile-directed optimizations.
|
||||
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "base.xcconfig"
|
||||
|
||||
GCC_OPTIMIZATION_LEVEL = 2
|
||||
OTHER_CFLAGS = $(derived) $(BASE_CFLAGS) -ftree-vectorize -fpredictive-commoning -funswitch-loops
|
||||
OTHER_CFLAGS = $(derived) $(BASE_CFLAGS) -ftree-vectorize -funswitch-loops
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -589,7 +589,7 @@ void DrawTeslaSegs( int noise_divisions, float *prgNoise, const model_t* spritem
|
||||
curSeg.m_flWidth = ((fraction*(endWidth-startWidth))+startWidth) * 2;
|
||||
|
||||
// Reduce the width by the current number of branches we've had
|
||||
for ( int j = 0; i < iBranches; j++ )
|
||||
for ( int j = 0; j < iBranches; j++ )
|
||||
{
|
||||
curSeg.m_flWidth *= 0.5;
|
||||
}
|
||||
@@ -619,7 +619,7 @@ void DrawTeslaSegs( int noise_divisions, float *prgNoise, const model_t* spritem
|
||||
|
||||
// Reduce the end width by the current number of branches we've had
|
||||
flEndWidth = endWidth;
|
||||
for ( int j = 0; i < iBranches; j++ )
|
||||
for ( int j = 0; j < iBranches; j++ )
|
||||
{
|
||||
flEndWidth *= 0.5;
|
||||
}
|
||||
|
||||
@@ -3531,7 +3531,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer
|
||||
p = nexttoken( token, p, ' ' );
|
||||
|
||||
// Find the weapon type
|
||||
if ( token )
|
||||
if ( token[0] )
|
||||
{
|
||||
//TODO: Parse the type from a list instead
|
||||
if ( Q_stricmp( token, "COMBINE" ) == 0 )
|
||||
@@ -3577,7 +3577,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer
|
||||
int attachmentIndex = -1;
|
||||
|
||||
// Find the attachment name
|
||||
if ( token )
|
||||
if ( token[0] )
|
||||
{
|
||||
attachmentIndex = LookupAttachment( token );
|
||||
|
||||
@@ -3684,27 +3684,25 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
||||
// Get the particle effect name
|
||||
const char *p = options;
|
||||
p = nexttoken(token, p, ' ');
|
||||
if ( token )
|
||||
{
|
||||
|
||||
const char* mtoken = ModifyEventParticles( token );
|
||||
if ( !mtoken || mtoken[0] == '\0' )
|
||||
return;
|
||||
Q_strncpy( szParticleEffect, mtoken, sizeof(szParticleEffect) );
|
||||
}
|
||||
|
||||
// Get the attachment type
|
||||
p = nexttoken(token, p, ' ');
|
||||
if ( token )
|
||||
{
|
||||
|
||||
iAttachType = GetAttachTypeFromString( token );
|
||||
if ( iAttachType == -1 )
|
||||
{
|
||||
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
|
||||
p = nexttoken(token, p, ' ');
|
||||
if ( token )
|
||||
if ( token[0] )
|
||||
{
|
||||
iAttachment = atoi(token);
|
||||
|
||||
@@ -3900,26 +3898,19 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
||||
|
||||
case AE_CL_BODYGROUP_SET_VALUE:
|
||||
{
|
||||
char szBodygroupName[256];
|
||||
int value = 0;
|
||||
|
||||
int value;
|
||||
char token[256];
|
||||
char szBodygroupName[256];
|
||||
|
||||
const char *p = options;
|
||||
|
||||
// Bodygroup Name
|
||||
p = nexttoken(token, p, ' ');
|
||||
if ( token )
|
||||
{
|
||||
Q_strncpy( szBodygroupName, token, sizeof(szBodygroupName) );
|
||||
}
|
||||
|
||||
// Get the desired value
|
||||
p = nexttoken(token, p, ' ');
|
||||
if ( token )
|
||||
{
|
||||
value = atoi( token );
|
||||
}
|
||||
value = token[0] ? atoi( token ) : 0;
|
||||
|
||||
int index = FindBodygroupByName( szBodygroupName );
|
||||
if ( index >= 0 )
|
||||
@@ -3948,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.
|
||||
case AE_CLIENT_EFFECT_ATTACH:
|
||||
{
|
||||
int iAttachment = -1;
|
||||
int iParam = 0;
|
||||
int iAttachment;
|
||||
int iParam;
|
||||
char token[128];
|
||||
char effectFunc[128];
|
||||
|
||||
const char *p = options;
|
||||
|
||||
p = nexttoken(token, p, ' ');
|
||||
|
||||
if( token )
|
||||
{
|
||||
Q_strncpy( effectFunc, token, sizeof(effectFunc) );
|
||||
}
|
||||
|
||||
p = nexttoken(token, p, ' ');
|
||||
|
||||
if( token )
|
||||
{
|
||||
iAttachment = atoi(token);
|
||||
}
|
||||
iAttachment = token[0] ? atoi(token) : -1;
|
||||
|
||||
p = nexttoken(token, p, ' ');
|
||||
|
||||
if( token )
|
||||
{
|
||||
iParam = atoi(token);
|
||||
}
|
||||
iParam = token[0] ? atoi(token) : 0;
|
||||
|
||||
if ( iAttachment != -1 && m_Attachments.Count() >= iAttachment )
|
||||
{
|
||||
@@ -5279,8 +5258,9 @@ float C_BaseAnimating::FrameAdvance( float flInterval )
|
||||
// Stubs for weapon prediction
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -5292,17 +5272,20 @@ void C_BaseAnimating::ResetSequenceInfo( void )
|
||||
|
||||
CStudioHdr *pStudioHdr = GetModelPtr();
|
||||
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_flPlaybackRate = 1.0;
|
||||
m_bSequenceFinished = false;
|
||||
m_flLastEventCheck = 0;
|
||||
|
||||
m_nNewSequenceParity = ( ++m_nNewSequenceParity ) & EF_PARITY_MASK;
|
||||
m_nResetEventsParity = ( ++m_nResetEventsParity ) & EF_PARITY_MASK;
|
||||
m_nNewSequenceParity = ( m_nNewSequenceParity + 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
|
||||
if ( pStudioHdr )
|
||||
{
|
||||
SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) );
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
||||
@@ -571,7 +571,8 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar )
|
||||
{
|
||||
Msg( "--------------------------------------------------\n" );
|
||||
int i = pVar->GetHead();
|
||||
CApparentVelocity<Vector> apparent;
|
||||
Vector v0(0, 0, 0);
|
||||
CApparentVelocity<Vector> apparent(v0);
|
||||
float prevtime = 0.0f;
|
||||
while ( 1 )
|
||||
{
|
||||
@@ -594,7 +595,8 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f
|
||||
|
||||
Msg( "--------------------------------------------------\n" );
|
||||
int i = pVar->GetHead();
|
||||
CApparentVelocity<Vector> apparent;
|
||||
Vector v0(0, 0, 0);
|
||||
CApparentVelocity<Vector> apparent(v0);
|
||||
float newtime = 999999.0f;
|
||||
Vector newVec( 0, 0, 0 );
|
||||
bool bSpew = true;
|
||||
@@ -662,7 +664,7 @@ void SpewInterpolatedVar( CInterpolatedVar< float > *pVar )
|
||||
{
|
||||
Msg( "--------------------------------------------------\n" );
|
||||
int i = pVar->GetHead();
|
||||
CApparentVelocity<float> apparent;
|
||||
CApparentVelocity<float> apparent(0.0f);
|
||||
while ( 1 )
|
||||
{
|
||||
float changetime;
|
||||
@@ -684,7 +686,8 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar<T> *pVar, float &flMin, float
|
||||
flMax = -1e23;
|
||||
|
||||
int i = pVar->GetHead();
|
||||
CApparentVelocity<Vector> apparent;
|
||||
Vector v0(0, 0, 0);
|
||||
CApparentVelocity<Vector> apparent(v0);
|
||||
while ( 1 )
|
||||
{
|
||||
float changetime;
|
||||
@@ -892,6 +895,8 @@ C_BaseEntity::C_BaseEntity() :
|
||||
m_iv_angRotation( "C_BaseEntity::m_iv_angRotation" ),
|
||||
m_iv_vecVelocity( "C_BaseEntity::m_iv_vecVelocity" )
|
||||
{
|
||||
m_pAttributes = NULL;
|
||||
|
||||
AddVar( &m_vecOrigin, &m_iv_vecOrigin, LATCH_SIMULATION_VAR );
|
||||
AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR );
|
||||
// Removing this until we figure out why velocity introduces view hitching.
|
||||
@@ -1299,19 +1304,6 @@ bool C_BaseEntity::VPhysicsIsFlesh( void )
|
||||
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.
|
||||
@@ -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:
|
||||
// Input : *context -
|
||||
@@ -3741,7 +3752,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd
|
||||
|
||||
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 );
|
||||
}
|
||||
break;
|
||||
@@ -6309,6 +6320,9 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
|
||||
|
||||
if ( FStrEq( pszModel, "models/props_lakeside_event/bomb_temp_hat.mdl" ) )
|
||||
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.
|
||||
|
||||
@@ -58,6 +58,7 @@ class C_BaseCombatCharacter;
|
||||
class CEntityMapData;
|
||||
class ConVar;
|
||||
class CDmgAccumulator;
|
||||
class IHasAttributes;
|
||||
|
||||
struct CSoundParameters;
|
||||
|
||||
@@ -335,6 +336,7 @@ public:
|
||||
// save out interpolated values
|
||||
virtual void PreDataUpdate( DataUpdateType_t updateType );
|
||||
virtual void PostDataUpdate( DataUpdateType_t updateType );
|
||||
virtual void OnDataUnchangedInPVS();
|
||||
|
||||
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
|
||||
virtual void ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs );
|
||||
virtual float GetHealthBarHeightOffset() const { return 0.f; }
|
||||
|
||||
// Returns the entity-to-world transform
|
||||
matrix3x4_t &EntityToWorldTransform();
|
||||
@@ -686,7 +689,7 @@ public:
|
||||
|
||||
virtual bool ShouldDraw();
|
||||
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
|
||||
// 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 int GetHealth() const { return 0; }
|
||||
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
|
||||
float HealthFraction() const;
|
||||
@@ -1172,7 +1176,17 @@ public:
|
||||
// Sets the origin + angles to match the last position received
|
||||
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:
|
||||
// NOTE: m_pAttributes needs to be set in the leaf class constructor.
|
||||
IHasAttributes *m_pAttributes;
|
||||
|
||||
// Only meant to be called from subclasses
|
||||
void DestroyModelInstance();
|
||||
|
||||
|
||||
@@ -562,11 +562,11 @@ Vector C_BaseFlex::SetViewTarget( CStudioHdr *pStudioHdr )
|
||||
m_iEyeUpdown = FindFlexController( "eyes_updown" );
|
||||
m_iEyeRightleft = FindFlexController( "eyes_rightleft" );
|
||||
|
||||
if ( m_iEyeUpdown != -1 )
|
||||
if ( m_iEyeUpdown != LocalFlexController_t(-1) )
|
||||
{
|
||||
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" );
|
||||
}
|
||||
@@ -594,13 +594,13 @@ Vector C_BaseFlex::SetViewTarget( CStudioHdr *pStudioHdr )
|
||||
// calculate animated eye deflection
|
||||
Vector eyeDeflect;
|
||||
QAngle eyeAng( 0, 0, 0 );
|
||||
if ( m_iEyeUpdown != -1 )
|
||||
if ( m_iEyeUpdown != LocalFlexController_t(-1) )
|
||||
{
|
||||
mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeUpdown );
|
||||
eyeAng.x = g_flexweight[ pflex->localToGlobal ];
|
||||
}
|
||||
|
||||
if ( m_iEyeRightleft != -1 )
|
||||
if ( m_iEyeRightleft != LocalFlexController_t(-1) )
|
||||
{
|
||||
mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeRightleft );
|
||||
eyeAng.y = g_flexweight[ pflex->localToGlobal ];
|
||||
@@ -1057,7 +1057,7 @@ void C_BaseFlex::GetToolRecordingState( KeyValues *msg )
|
||||
Vector viewtarget = m_viewtarget; // Use the unfiltered value
|
||||
|
||||
// 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 *flexrightleft = hdr->pFlexcontroller( m_iEyeRightleft );
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
virtual void NotifyShouldTransmit( ShouldTransmitState_t state );
|
||||
virtual void PreDataUpdate( DataUpdateType_t updateType );
|
||||
virtual void PostDataUpdate( DataUpdateType_t updateType );
|
||||
virtual void OnDataUnchangedInPVS( void ) { }
|
||||
virtual void OnPreDataChanged( DataUpdateType_t updateType );
|
||||
virtual void OnDataChanged( DataUpdateType_t updateType );
|
||||
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
|
||||
// If cl_righthand is set, then we want them all right-handed.
|
||||
|
||||
@@ -122,7 +122,7 @@ void C_ColorCorrection::ClientThink()
|
||||
return;
|
||||
}
|
||||
|
||||
CBaseEntity *pPlayer = UTIL_PlayerByIndex(1);
|
||||
C_BaseEntity *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||
if( !pPlayer )
|
||||
return;
|
||||
|
||||
|
||||
@@ -575,7 +575,10 @@ void C_EntityDissolve::ClientThink( void )
|
||||
#ifdef TF_CLIENT_DLL
|
||||
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
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ private:
|
||||
Assert( type < NUM_EDGE_STYLES );
|
||||
Assert( type >= 0 );
|
||||
// Clear old value
|
||||
m_nPanelBits[ w ][ h ] &= ( ~0x03 << 2 );
|
||||
m_nPanelBits[ w ][ h ] &= 0xF0; // ( ~0x03 << 2 ); Left shifting a negative value has undefined behavior. Use the constant 0xF0 instead.
|
||||
// Insert new value
|
||||
m_nPanelBits[ w ][ h ] |= ( type << 2 );
|
||||
}
|
||||
|
||||
@@ -198,12 +198,19 @@ void ParticleEffectCallback( const CEffectData &data )
|
||||
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",
|
||||
C_BaseEntity::Instance( data.m_hEntity )->GetDebugName(), pszName );
|
||||
if ( pEffect.IsValid() && pEffect->IsValid() )
|
||||
{
|
||||
if ( (ParticleAttachment_t)data.m_nDamageType == PATTACH_CUSTOMORIGIN )
|
||||
if ( iAttachType == PATTACH_CUSTOMORIGIN )
|
||||
{
|
||||
pEffect->SetSortOrigin( data.m_vOrigin );
|
||||
pEffect->SetControlPoint( 0, data.m_vOrigin );
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
if( pReturn == NULL )
|
||||
{
|
||||
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 );
|
||||
m_DeleteOnSwitch[m_nCurrentStack].AddToTail( pReturn );
|
||||
}
|
||||
|
||||
@@ -214,8 +214,8 @@ void C_SceneEntity::SetupClientOnlyScene( const char *pszFilename, C_BaseFlex *p
|
||||
V_strcpy( szFilename, szSceneHWM );
|
||||
}
|
||||
|
||||
Assert( szFilename && szFilename[ 0 ] );
|
||||
if ( szFilename && szFilename[ 0 ] )
|
||||
Assert( szFilename[ 0 ] );
|
||||
if ( szFilename[ 0 ] )
|
||||
{
|
||||
LoadSceneFromFile( szFilename );
|
||||
|
||||
@@ -335,8 +335,8 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType )
|
||||
|
||||
if ( updateType == DATA_UPDATE_CREATED )
|
||||
{
|
||||
Assert( szFilename && szFilename[ 0 ] );
|
||||
if ( szFilename && szFilename[ 0 ] )
|
||||
Assert( szFilename[ 0 ] );
|
||||
if ( szFilename[ 0 ] )
|
||||
{
|
||||
LoadSceneFromFile( szFilename );
|
||||
|
||||
@@ -373,6 +373,8 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType )
|
||||
|
||||
SetNextClientThink( CLIENT_THINK_ALWAYS );
|
||||
}
|
||||
|
||||
m_bWasPlaying = !m_bIsPlayingBack; // force it to be "changed"
|
||||
}
|
||||
|
||||
// Playback state changed...
|
||||
|
||||
@@ -114,7 +114,7 @@ void TE_BloodStream( IRecipientFilter& filter, float delay,
|
||||
float arc = 0.05;
|
||||
int count, count2;
|
||||
float num;
|
||||
int speedCopy = amount;
|
||||
float speedCopy = amount;
|
||||
|
||||
Vector dir;
|
||||
VectorCopy( *direction, dir );
|
||||
|
||||
@@ -139,7 +139,7 @@ void TE_Decal( IRecipientFilter& filter, float delay,
|
||||
// Only decal the world + brush models
|
||||
// Here we deal with decals on entities.
|
||||
C_BaseEntity* ent;
|
||||
if ( ( ent = cl_entitylist->GetEnt( entity ) ) == false )
|
||||
if ( ( ent = cl_entitylist->GetEnt( entity ) ) == NULL )
|
||||
return;
|
||||
|
||||
ent->AddDecal( *start, *pos, *pos, hitbox,
|
||||
|
||||
@@ -1539,7 +1539,7 @@ void CTempEnts::BloodSprite( const Vector &org, int r, int g, int b, int a, int
|
||||
{
|
||||
C_LocalTempEntity *pTemp;
|
||||
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
|
||||
if ( ( pTemp = TempEntAllocHigh( org, model ) ) != NULL )
|
||||
|
||||
@@ -163,18 +163,13 @@ void C_TeamTrainWatcher::OnDataChanged( DataUpdateType_t updateType )
|
||||
int nNumHills = ObjectiveResource()->GetNumNodeHillData( GetTeamNumber() );
|
||||
if ( nNumHills > 0 )
|
||||
{
|
||||
float flStart, flEnd;
|
||||
float flStart = 0, flEnd = 0;
|
||||
for ( int i = 0 ; i < nNumHills ; i++ )
|
||||
{
|
||||
ObjectiveResource()->GetHillData( GetTeamNumber(), i, flStart, flEnd );
|
||||
if ( m_flTotalProgress >= flStart && m_flTotalProgress<= flEnd )
|
||||
{
|
||||
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, false );
|
||||
}
|
||||
|
||||
bool state = ( m_flTotalProgress >= flStart && m_flTotalProgress <= flEnd );
|
||||
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, state );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1717,7 +1717,11 @@ void CHLClient::LevelShutdown( void )
|
||||
|
||||
messagechars->Clear();
|
||||
|
||||
#ifndef TF_CLIENT_DLL
|
||||
// don't want to do this for TF2 because we have particle systems in our
|
||||
// character loadout screen that can be viewed when we're not connected to a server
|
||||
g_pParticleSystemMgr->UncacheAllParticleSystems();
|
||||
#endif
|
||||
UncacheAllMaterials();
|
||||
|
||||
#ifdef _XBOX
|
||||
|
||||
@@ -53,9 +53,8 @@ $Configuration
|
||||
{
|
||||
$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;ENABLE_CHROMEHTMLWINDOW;fopen=dont_use_fopen" [$WIN32]
|
||||
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;" [$OSXALL]
|
||||
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;USE_WEBM_FOR_REPLAY;" [$LINUXALL]
|
||||
$PreprocessorDefinitions "$BASE;fopen=dont_use_fopen" [$WIN32]
|
||||
$PreprocessorDefinitions "$BASE;USE_WEBM_FOR_REPLAY;" [$LINUXALL]
|
||||
$PreprocessorDefinitions "$BASE;CURL_STATICLIB" [$WIN32 && $BUILD_REPLAY]
|
||||
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
|
||||
$Create/UsePCHThroughFile "cbase.h"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "vgui_controls/Controls.h"
|
||||
#include "tier0/vprof_telemetry.h"
|
||||
#include <time.h>
|
||||
#include "steam/steam_api.h"
|
||||
|
||||
const char *COM_GetModDirectory(); // return the mod dir (rather than the complete -game param, which can be a path)
|
||||
|
||||
@@ -212,6 +213,7 @@ void CalcFovFromProjection ( float *pFov, const VMatrix &proj )
|
||||
Assert ( proj.m[3][2] == -1.0f );
|
||||
Assert ( proj.m[3][3] == 0.0f );
|
||||
|
||||
/*
|
||||
// The math here:
|
||||
// A view-space vector (x,y,z,1) is transformed by the projection matrix
|
||||
// / xscale 0 xoffset 0 \
|
||||
@@ -226,6 +228,7 @@ void CalcFovFromProjection ( float *pFov, const VMatrix &proj )
|
||||
// = xscale*(x/z) + xoffset (I flipped the signs of both sides)
|
||||
// => (+-1 - xoffset)/xscale = x/z
|
||||
// ...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_nx = 2.0f * RAD2DEG ( atanf ( fabsf ( ( -1.0f - xoffset ) / xscale ) ) );
|
||||
@@ -1363,8 +1366,11 @@ void CClientVirtualReality::Activate()
|
||||
if( !g_pSourceVR )
|
||||
return;
|
||||
|
||||
// These checks don't apply if we're in VR mode because Steam said so.
|
||||
if ( !ShouldForceVRActive() )
|
||||
{
|
||||
// see if VR mode is even enabled
|
||||
if( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 )
|
||||
if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 )
|
||||
{
|
||||
Warning( "Enable VR mode in the video options before trying to use it.\n" );
|
||||
return;
|
||||
@@ -1372,20 +1378,21 @@ void CClientVirtualReality::Activate()
|
||||
|
||||
// See if we have an actual adapter
|
||||
int32 nVRModeAdapter = g_pSourceVR->GetVRModeAdapter();
|
||||
if( nVRModeAdapter == -1 )
|
||||
if ( nVRModeAdapter == -1 )
|
||||
{
|
||||
Warning( "Unable to get VRMode adapter from OpenVR. VR mode cannot be enabled. Try restarting and then enabling VR again.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// we can only activate if we've got a VR device
|
||||
if( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter != nVRModeAdapter )
|
||||
if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter != nVRModeAdapter )
|
||||
{
|
||||
Warning( "VR Mode expects adapter %d which is different from %d which we are currently using. Try restarting and enabling VR mode again.\n",
|
||||
nVRModeAdapter, materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter );
|
||||
engine->ExecuteClientCmd( "mat_enable_vrmode 0\n" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// can't activate twice
|
||||
@@ -1429,19 +1436,23 @@ void CClientVirtualReality::Activate()
|
||||
int nViewportWidth, nViewportHeight;
|
||||
|
||||
g_pSourceVR->GetViewportBounds( ISourceVirtualReality::VREye_Left, NULL, NULL, &nViewportWidth, &nViewportHeight );
|
||||
vgui::surface()->SetFullscreenViewportAndRenderTarget( 0, 0, nViewportWidth, nViewportHeight, g_pSourceVR->GetRenderTarget( ISourceVirtualReality::VREye_Left, ISourceVirtualReality::RT_Color ) );
|
||||
g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( 0, 0, nViewportWidth, nViewportHeight, g_pSourceVR->GetRenderTarget( ISourceVirtualReality::VREye_Left, ISourceVirtualReality::RT_Color ) );
|
||||
|
||||
vgui::ivgui()->SetVRMode( true );
|
||||
|
||||
// we can skip this extra mode change if we've always been in VR mode
|
||||
if ( !ShouldForceVRActive() )
|
||||
{
|
||||
VRRect_t rect;
|
||||
if( g_pSourceVR->GetDisplayBounds( &rect ) )
|
||||
if ( g_pSourceVR->GetDisplayBounds( &rect ) )
|
||||
{
|
||||
|
||||
// set mode
|
||||
char szCmd[ 256 ];
|
||||
Q_snprintf( szCmd, sizeof( szCmd ), "mat_setvideomode %i %i %i\n", rect.nWidth, rect.nHeight, vr_force_windowed.GetBool()? 1 : 0 );
|
||||
char szCmd[256];
|
||||
Q_snprintf( szCmd, sizeof(szCmd), "mat_setvideomode %i %i %i\n", rect.nWidth, rect.nHeight, vr_force_windowed.GetBool() ? 1 : 0 );
|
||||
engine->ClientCmd_Unrestricted( szCmd );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1455,7 +1466,7 @@ void CClientVirtualReality::Deactivate()
|
||||
|
||||
g_pMatSystemSurface->ForceScreenSizeOverride(false, 0, 0 );
|
||||
g_pMaterialSystem->GetRenderContext()->Viewport( 0, 0, m_nNonVRWidth, m_nNonVRHeight );
|
||||
vgui::surface()->SetFullscreenViewportAndRenderTarget( 0, 0, m_nNonVRWidth, m_nNonVRHeight, NULL );
|
||||
g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( 0, 0, m_nNonVRWidth, m_nNonVRHeight, NULL );
|
||||
|
||||
static ConVarRef cl_software_cursor( "cl_software_cursor" );
|
||||
vgui::surface()->SetSoftwareCursor( cl_software_cursor.GetBool() );
|
||||
@@ -1499,7 +1510,7 @@ void CClientVirtualReality::Deactivate()
|
||||
// Called when startup is complete
|
||||
void CClientVirtualReality::StartupComplete()
|
||||
{
|
||||
if( vr_activate_default.GetBool() )
|
||||
if ( vr_activate_default.GetBool() || ShouldForceVRActive() )
|
||||
Activate();
|
||||
}
|
||||
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
@@ -380,6 +441,13 @@ void CClientEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle
|
||||
|
||||
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->ObjectCaps() & FCAP_SAVE_NON_NETWORKABLE )
|
||||
|
||||
@@ -228,9 +228,9 @@ static void __MsgFunc_VGUIMenu( bf_read &msg )
|
||||
&& keys->GetInt( "type", 0 ) == 2 // URL message type
|
||||
) {
|
||||
const char *pszURL = keys->GetString( "msg", "" );
|
||||
if ( Q_strncmp( pszURL, "http://", 7 ) != 0 && Q_strncmp( pszURL, "https://", 8 ) != 0 )
|
||||
if ( Q_strncmp( pszURL, "http://", 7 ) != 0 && Q_strncmp( pszURL, "https://", 8 ) != 0 && Q_stricmp( pszURL, "about:blank" ) != 0 )
|
||||
{
|
||||
Warning( "Blocking MOTD URL '%s'; must begin with 'http://' or 'https://'\n", pszURL );
|
||||
Warning( "Blocking MOTD URL '%s'; must begin with 'http://' or 'https://' or be about:blank\n", pszURL );
|
||||
keys->deleteThis();
|
||||
return;
|
||||
}
|
||||
@@ -470,8 +470,17 @@ bool ClientModeShared::ShouldDrawEntity(C_BaseEntity *pEnt)
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1481,7 +1481,7 @@ void CDetailObjectSystem::LevelInitPreEntity()
|
||||
PrecacheMaterial( DETAIL_SPRITE_MATERIAL );
|
||||
IMaterial *pMat = m_DetailSpriteMaterial;
|
||||
// adjust for non-square textures (cropped)
|
||||
float flRatio = pMat->GetMappingWidth() / pMat->GetMappingHeight();
|
||||
float flRatio = (float)( pMat->GetMappingWidth() ) / pMat->GetMappingHeight();
|
||||
if ( flRatio > 1.0 )
|
||||
{
|
||||
for( int i = 0; i<m_DetailSpriteDict.Count(); i++ )
|
||||
|
||||
@@ -18,7 +18,7 @@ class CFlashlightEffect
|
||||
public:
|
||||
|
||||
CFlashlightEffect(int nEntIndex = 0);
|
||||
~CFlashlightEffect();
|
||||
virtual ~CFlashlightEffect();
|
||||
|
||||
virtual void UpdateLight(const Vector &vecPos, const Vector &vecDir, const Vector &vecRight, const Vector &vecUp, int nDistance);
|
||||
void TurnOn();
|
||||
|
||||
@@ -231,12 +231,11 @@ void CBaseViewport::CreateDefaultPanels( void )
|
||||
AddNewPanel( CreatePanelByName( PANEL_SCOREBOARD ), "PANEL_SCOREBOARD" );
|
||||
AddNewPanel( CreatePanelByName( PANEL_INFO ), "PANEL_INFO" );
|
||||
AddNewPanel( CreatePanelByName( PANEL_SPECGUI ), "PANEL_SPECGUI" );
|
||||
#if !defined( TF_CLIENT_DLL )
|
||||
AddNewPanel( CreatePanelByName( PANEL_SPECMENU ), "PANEL_SPECMENU" );
|
||||
AddNewPanel( CreatePanelByName( PANEL_NAV_PROGRESS ), "PANEL_NAV_PROGRESS" );
|
||||
// AddNewPanel( CreatePanelByName( PANEL_TEAM ), "PANEL_TEAM" );
|
||||
// AddNewPanel( CreatePanelByName( PANEL_CLASS ), "PANEL_CLASS" );
|
||||
// AddNewPanel( CreatePanelByName( PANEL_BUY ), "PANEL_BUY" );
|
||||
#endif
|
||||
#endif // !TF_CLIENT_DLL
|
||||
#endif // !_XBOX
|
||||
}
|
||||
|
||||
void CBaseViewport::UpdateAllPanels( void )
|
||||
|
||||
@@ -86,7 +86,6 @@ void CBuyMenu::ShowPanel(bool bShow)
|
||||
void CBuyMenu::Update()
|
||||
{
|
||||
//Don't need to do anything, but do need to implement this function as base is pure virtual
|
||||
NULL;
|
||||
}
|
||||
void CBuyMenu::OnClose()
|
||||
{
|
||||
|
||||
@@ -190,6 +190,7 @@ void CTeamMenu::LoadMapPage( const char *mapName )
|
||||
char mapRES[ MAX_PATH ];
|
||||
|
||||
char uilanguage[ 64 ];
|
||||
uilanguage[0] = 0;
|
||||
engine->GetUILanguage( uilanguage, sizeof( 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 );
|
||||
|
||||
m_pTextMessage = new TextEntry( this, "TextMessage" );
|
||||
#if defined( ENABLE_CHROMEHTMLWINDOW )
|
||||
m_pHTMLMessage = new CMOTDHTML( this,"HTMLMessage" );
|
||||
#else
|
||||
m_pHTMLMessage = NULL;
|
||||
#endif
|
||||
m_pTitleLabel = new Label( this, "MessageTitle", "Message Title" );
|
||||
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 )
|
||||
{
|
||||
#if defined( ENABLE_CHROMEHTMLWINDOW )
|
||||
#ifdef _DEBUG
|
||||
Msg( "CTextWindow::ShowURL( %s )\n", URL );
|
||||
#endif
|
||||
@@ -196,8 +191,6 @@ void CTextWindow::ShowURL( const char *URL, bool bAllowUserToDisable )
|
||||
m_pHTMLMessage->SetVisible( true );
|
||||
m_pHTMLMessage->OpenURL( URL, NULL );
|
||||
m_bShownURL = true;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void CTextWindow::ShowIndex( const char *entry )
|
||||
@@ -286,9 +279,8 @@ void CTextWindow::Update( void )
|
||||
|
||||
m_pTitleLabel->SetText( m_szTitle );
|
||||
|
||||
#if defined( ENABLE_CHROMEHTMLWINDOW )
|
||||
if ( m_pHTMLMessage )
|
||||
m_pHTMLMessage->SetVisible( false );
|
||||
#endif
|
||||
m_pTextMessage->SetVisible( false );
|
||||
|
||||
if ( m_nContentType == TYPE_INDEX )
|
||||
@@ -427,13 +419,11 @@ void CTextWindow::ShowPanel( bool bShow )
|
||||
SetVisible( false );
|
||||
SetMouseInputEnabled( false );
|
||||
|
||||
#if defined( ENABLE_CHROMEHTMLWINDOW )
|
||||
if ( m_bUnloadOnDismissal && m_bShownURL )
|
||||
if ( m_bUnloadOnDismissal && m_bShownURL && m_pHTMLMessage )
|
||||
{
|
||||
m_pHTMLMessage->OpenURL( "about:blank", NULL );
|
||||
m_bShownURL = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ void CHudDamageIndicator::DrawDamageIndicator(int side)
|
||||
|
||||
int x1 = m_flDmgX;
|
||||
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 };
|
||||
|
||||
// see if we're high damage
|
||||
|
||||
@@ -598,13 +598,13 @@ void CHudWeaponSelection::Paint()
|
||||
|
||||
// bucket style
|
||||
int screenCenterX = (int) fCenterX;
|
||||
int screenCenterY = (int) fCenterY - 15; // Height isn't quite screen height, so adjust for center alignement
|
||||
int screenCenterY = (int) fCenterY - 15; // Height isn't quite screen height, so adjust for center alignment
|
||||
|
||||
// Modifiers for the four directions. Used to change the x and y offsets
|
||||
// of each box based on which bucket we're drawing. Bucket directions are
|
||||
// 0 = UP, 1 = RIGHT, 2 = DOWN, 3 = LEFT
|
||||
int xModifiers[] = { 0, 1, 0, -1 };
|
||||
int yModifiers[] = { -1, 0, 1, 0 };
|
||||
int xModifiers[] = { 0, 1, 0, -1, -1, 1 };
|
||||
int yModifiers[] = { -1, 0, 1, 0, 1, 1 };
|
||||
|
||||
// Draw the four buckets
|
||||
for ( int i = 0; i < MAX_WEAPON_SLOTS; ++i )
|
||||
@@ -1453,7 +1453,7 @@ void CHudWeaponSelection::SelectWeaponSlot( int iSlot )
|
||||
return;
|
||||
|
||||
// Don't try and read past our possible number of slots
|
||||
if ( iSlot > MAX_WEAPON_SLOTS )
|
||||
if ( iSlot >= MAX_WEAPON_SLOTS )
|
||||
return;
|
||||
|
||||
// Make sure the player's allowed to switch weapons
|
||||
|
||||
+3
-3
@@ -512,7 +512,7 @@ void CHud::Shutdown( void )
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: LevelInit's called whenever a new level's starting
|
||||
// Purpose: LevelInit's called whenever a new level is starting
|
||||
//-----------------------------------------------------------------------------
|
||||
void CHud::LevelInit( void )
|
||||
{
|
||||
@@ -533,11 +533,11 @@ void CHud::LevelInit( void )
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: LevelShutdown's called whenever a level's finishing
|
||||
// Purpose: LevelShutdown's called whenever a level is finishing
|
||||
//-----------------------------------------------------------------------------
|
||||
void CHud::LevelShutdown( void )
|
||||
{
|
||||
// Tell all the registered hud elements to LevelInit
|
||||
// Tell all the registered hud elements to LevelShutdown
|
||||
for ( int i = 0; i < m_HudList.Size(); i++ )
|
||||
{
|
||||
m_HudList[i]->LevelShutdown();
|
||||
|
||||
+2
-2
@@ -107,9 +107,9 @@ public:
|
||||
void VidInit( void );
|
||||
// Shutdown's called when the engine's shutting down
|
||||
void Shutdown( void );
|
||||
// LevelInit's called whenever a new level's starting
|
||||
// LevelInit's called whenever a new level is starting
|
||||
void LevelInit( void );
|
||||
// LevelShutdown's called whenever a level's finishing
|
||||
// LevelShutdown's called whenever a level is finishing
|
||||
void LevelShutdown( void );
|
||||
|
||||
void ResetHUD( void );
|
||||
|
||||
@@ -241,7 +241,7 @@ public:
|
||||
void MsgFunc_TextMsg(const char *pszName, int iSize, void *pbuf);
|
||||
|
||||
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 StopMessageMode( void );
|
||||
|
||||
@@ -65,6 +65,7 @@ void CHudBaseDeathNotice::Init( void )
|
||||
ListenForGameEvent( "teamplay_point_captured" );
|
||||
ListenForGameEvent( "teamplay_capture_blocked" );
|
||||
ListenForGameEvent( "teamplay_flag_event" );
|
||||
ListenForGameEvent( "rd_robot_killed" );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -844,6 +844,7 @@ CHudCloseCaption::CHudCloseCaption( const char *pElementName )
|
||||
HOOK_HUD_MESSAGE( CHudCloseCaption, CloseCaption );
|
||||
|
||||
char uilanguage[ 64 ];
|
||||
uilanguage[0] = 0;
|
||||
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
|
||||
|
||||
if ( !Q_stricmp( uilanguage, "english" ) )
|
||||
@@ -2752,6 +2753,7 @@ void OnCaptionLanguageChanged( IConVar *pConVar, const char *pOldString, float f
|
||||
}
|
||||
|
||||
char uilanguage[ 64 ];
|
||||
uilanguage[0] = 0;
|
||||
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
|
||||
|
||||
CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption );
|
||||
|
||||
@@ -662,7 +662,8 @@ void CVoteSetupDialog::OnItemSelected( vgui::Panel *panel )
|
||||
for ( int index = 0; index < m_VoteIssuesPopFiles.Count(); index++ )
|
||||
{
|
||||
// Don't show the current pop file
|
||||
if ( TFObjectiveResource()->GetMvMPopFileName() == '\0' )
|
||||
const char *pszPopFileName = TFObjectiveResource()->GetMvMPopFileName();
|
||||
if ( !pszPopFileName || !pszPopFileName[0] )
|
||||
{
|
||||
// Use the map name
|
||||
char szShortMapName[ MAX_MAP_NAME ];
|
||||
@@ -982,6 +983,12 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
|
||||
|
||||
char szTime[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 );
|
||||
g_pVGuiLocalize->ConvertANSIToUnicode( szTime, wszTime, sizeof( wszTime ) );
|
||||
|
||||
@@ -1020,8 +1027,8 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg )
|
||||
m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_map_name_required" );
|
||||
break;
|
||||
|
||||
case VOTE_FAILED_FAILED_RECENTLY:
|
||||
g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof(wszHeaderString), g_pVGuiLocalize->Find( "#GameUI_vote_failed_recently" ), 1, wszTime );
|
||||
case VOTE_FAILED_ON_COOLDOWN:
|
||||
g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof( wszHeaderString ), g_pVGuiLocalize->Find( pszTimeString ), 1, wszTime );
|
||||
pwszHeaderString = wszHeaderString;
|
||||
m_pCallVoteFailed->SetDialogVariable( "FailedReason", pwszHeaderString );
|
||||
break;
|
||||
|
||||
@@ -36,9 +36,9 @@ public:
|
||||
// called whenever the video mode changes, and whenever Init() would be called, so the hud can vid init itself
|
||||
virtual void VidInit( void ) { return; }
|
||||
|
||||
// LevelInit's called whenever a new level's starting
|
||||
// LevelInit's called whenever a new level is starting
|
||||
virtual void LevelInit( void ) { return; };
|
||||
// LevelShutdown's called whenever a level's finishing
|
||||
// LevelShutdown's called whenever a level is finishing
|
||||
virtual void LevelShutdown( void ) { return; };
|
||||
|
||||
// called whenever the hud receives "reset" message, which is (usually) every time the client respawns after getting killed
|
||||
|
||||
@@ -846,6 +846,8 @@ void CInput::JoyStickMove( float frametime, CUserCmd *cmd )
|
||||
{
|
||||
angle = m_flPreviousJoystickYaw * joy_yawsensitivity.GetFloat() * aspeed * 180.0;
|
||||
}
|
||||
|
||||
angle = JoyStickAdjustYaw( angle );
|
||||
viewangles[YAW] += angle;
|
||||
cmd->mousedx = angle;
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ private:
|
||||
void ControllerMove ( float frametime, CUserCmd *cmd );
|
||||
void JoyStickMove ( float frametime, CUserCmd *cmd );
|
||||
float ScaleAxisValue( const float axisValue, const float axisThreshold );
|
||||
virtual float JoyStickAdjustYaw( float flSpeed ) { return flSpeed; }
|
||||
|
||||
// Call this to get the cursor position. The call will be logged in the VCR file if there is one.
|
||||
void GetMousePos(int &x, int &y);
|
||||
|
||||
@@ -97,8 +97,8 @@ CParticleSubTextureGroup::~CParticleSubTextureGroup()
|
||||
|
||||
CParticleSubTexture::CParticleSubTexture()
|
||||
{
|
||||
m_tCoordMins[0] = m_tCoordMins[0] = 0;
|
||||
m_tCoordMaxs[0] = m_tCoordMaxs[0] = 1;
|
||||
m_tCoordMins[0] = m_tCoordMins[1] = 0;
|
||||
m_tCoordMaxs[0] = m_tCoordMaxs[1] = 1;
|
||||
m_pGroup = &m_DefaultGroup;
|
||||
m_pMaterial = NULL;
|
||||
|
||||
|
||||
@@ -931,7 +931,8 @@ void CPrediction::SetIdealPitch ( C_BasePlayer *player, const Vector& origin, co
|
||||
Vector top, bottom;
|
||||
float floor_height[MAX_FORWARD];
|
||||
int i, j;
|
||||
int step, dir, steps;
|
||||
float step, dir;
|
||||
int steps;
|
||||
trace_t tr;
|
||||
|
||||
if ( player->GetGroundEntity() == NULL )
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "confirm_dialog.h"
|
||||
#include "replay/vgui/replaybrowserdetailspanel.h"
|
||||
|
||||
#include "base_gcmessages.h"
|
||||
#include "base_gcmessages.pb.h"
|
||||
|
||||
#include "youtubeapi.h"
|
||||
#include "steamworks_gamestats.h"
|
||||
|
||||
@@ -576,7 +576,7 @@ public:
|
||||
BaseClass::PerformLayout();
|
||||
|
||||
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 nLastY = -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( "BlueLabel" ) )
|
||||
};
|
||||
int nMargins[2] = { XRES( 5 ), YRES( 2 ) };
|
||||
int nMargins[2] = { (int)XRES( 5 ), (int)YRES( 2 ) };
|
||||
for ( int i = 0; i < 2; ++i )
|
||||
{
|
||||
pRedBlueLabels[i]->SizeToContents();
|
||||
@@ -2473,6 +2473,7 @@ void CReplayPerformanceEditorPanel::OnCommand( const char *command )
|
||||
{
|
||||
ReplayCamera()->SetMode( OBS_MODE_ROAMING );
|
||||
UpdateCameraSelectionPosition( CAM_FREE );
|
||||
m_bCurrentTargetNeedsVisibilityUpdate = true;
|
||||
g_pReplayPerformanceController->AddEvent_Camera_Change_Free( flCurTime );
|
||||
AddSetViewEvent();
|
||||
DisplayPerformanceTip( "#Replay_PerfTip_EnterFreeCam", &replay_perftip_count_freecam_enter, MAX_TIP_DISPLAYS );
|
||||
|
||||
@@ -879,10 +879,6 @@ bool SixenseGestureBindings::ActionTokenToStr( sixenseUtils::IButtonStates::Acti
|
||||
{
|
||||
Q_snprintf( buf, buflen, "tilt_gesture" );
|
||||
}
|
||||
else if( action == sixenseUtils::IButtonStates::ACTION_BUTTON_PRESS )
|
||||
{
|
||||
Q_snprintf( buf, buflen, "button_press" );
|
||||
}
|
||||
else if( action == sixenseUtils::IButtonStates::ACTION_TRIGGER_PRESS )
|
||||
{
|
||||
Q_snprintf( buf, buflen, "trigger_press" );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "filesystem.h"
|
||||
#include "../common/xbox/xboxstubs.h"
|
||||
#include "steam/steam_api.h"
|
||||
#include "tier0/cpumonitoring.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
@@ -189,12 +190,12 @@ void GetFPSColor( int nFps, unsigned char ucColor[3] )
|
||||
if ( IsPC() && g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 95 )
|
||||
{
|
||||
nFPSThreshold1 = 60;
|
||||
nFPSThreshold1 = 50;
|
||||
nFPSThreshold2 = 50;
|
||||
}
|
||||
else if ( IsX360() || g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 90 )
|
||||
{
|
||||
nFPSThreshold1 = 30;
|
||||
nFPSThreshold1 = 25;
|
||||
nFPSThreshold2 = 25;
|
||||
}
|
||||
|
||||
if ( nFps >= nFPSThreshold1 )
|
||||
@@ -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:
|
||||
// Input :
|
||||
@@ -272,6 +295,17 @@ void CFPSPanel::Paint()
|
||||
GetFPSColor( nFps, ucColor );
|
||||
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;
|
||||
|
||||
@@ -235,9 +235,10 @@ int CMessageCharsPanel::AddText(
|
||||
|
||||
Assert( !msg->text );
|
||||
|
||||
msg->text = new char[ Q_strlen( data ) + 1 ];
|
||||
int textLength = Q_strlen( data ) + 1;
|
||||
msg->text = new char[ textLength ];
|
||||
Assert( msg->text );
|
||||
Q_strncpy( msg->text, data, sizeof( msg->text ) );
|
||||
Q_strncpy( msg->text, data, textLength );
|
||||
|
||||
if ( flTime )
|
||||
msg->fTTL = gpGlobals->curtime + flTime;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <vgui/IScheme.h>
|
||||
#include <vgui/ILocalize.h>
|
||||
#include "tier0/vprof.h"
|
||||
#include "tier0/cpumonitoring.h"
|
||||
#include "cdll_bounded_cvars.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 );
|
||||
|
||||
int interpcolor[ 3 ] = { GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE };
|
||||
int interpcolor[ 3 ] = { (int)GRAPH_RED, (int)GRAPH_GREEN, (int)GRAPH_BLUE };
|
||||
float flInterp = GetClientInterpAmount();
|
||||
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 );
|
||||
|
||||
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 )
|
||||
{
|
||||
@@ -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" );
|
||||
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()
|
||||
{
|
||||
#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
|
||||
const uint8 strOAccent[] = { 0xd3, 0x00 };
|
||||
#endif
|
||||
|
||||
@@ -1885,7 +1885,8 @@ static void DrawPyroVignette( int nDestX, int nDestY, int nWidth, int nHeight, /
|
||||
|
||||
if ( pyro_vignette.GetInt() > 1 )
|
||||
{
|
||||
Vector2D vMaxSize( ( float )nScreenWidth / ( float )nScreenWidth / NUM_PYRO_SEGMENTS * 2.0f, ( float )nScreenHeight / ( float )nScreenHeight / NUM_PYRO_SEGMENTS * 2.0f );
|
||||
float flPyroSegments = 2.0f / NUM_PYRO_SEGMENTS;
|
||||
Vector2D vMaxSize( flPyroSegments, flPyroSegments );
|
||||
|
||||
if ( !bInit )
|
||||
{
|
||||
|
||||
+15
-11
@@ -1435,8 +1435,8 @@ static void GetFogColorTransition( fogparams_t *pFogParams, float *pColorPrimary
|
||||
{
|
||||
float flPercent = 1.0f - (( pFogParams->lerptime - gpGlobals->curtime ) / pFogParams->duration );
|
||||
|
||||
float flPrimaryColorLerp[3] = { pFogParams->colorPrimaryLerpTo.GetR(), pFogParams->colorPrimaryLerpTo.GetG(), pFogParams->colorPrimaryLerpTo.GetB() };
|
||||
float flSecondaryColorLerp[3] = { pFogParams->colorSecondaryLerpTo.GetR(), pFogParams->colorSecondaryLerpTo.GetG(), pFogParams->colorSecondaryLerpTo.GetB() };
|
||||
float flPrimaryColorLerp[3] = { (float)pFogParams->colorPrimaryLerpTo.GetR(), (float)pFogParams->colorPrimaryLerpTo.GetG(), (float)pFogParams->colorPrimaryLerpTo.GetB() };
|
||||
float flSecondaryColorLerp[3] = { (float)pFogParams->colorSecondaryLerpTo.GetR(), (float)pFogParams->colorSecondaryLerpTo.GetG(), (float)pFogParams->colorSecondaryLerpTo.GetB() };
|
||||
|
||||
CheckAndTransitionColor( flPercent, pColorPrimary, flPrimaryColorLerp );
|
||||
CheckAndTransitionColor( flPercent, pColorSecondary, flSecondaryColorLerp );
|
||||
@@ -1459,8 +1459,8 @@ static void GetFogColor( fogparams_t *pFogParams, float *pColor )
|
||||
}
|
||||
else
|
||||
{
|
||||
float flPrimaryColor[3] = { pFogParams->colorPrimary.GetR(), pFogParams->colorPrimary.GetG(), pFogParams->colorPrimary.GetB() };
|
||||
float flSecondaryColor[3] = { pFogParams->colorSecondary.GetR(), pFogParams->colorSecondary.GetG(), pFogParams->colorSecondary.GetB() };
|
||||
float flPrimaryColor[3] = { (float)pFogParams->colorPrimary.GetR(), (float)pFogParams->colorPrimary.GetG(), (float)pFogParams->colorPrimary.GetB() };
|
||||
float flSecondaryColor[3] = { (float)pFogParams->colorSecondary.GetR(), (float)pFogParams->colorSecondary.GetG(), (float)pFogParams->colorSecondary.GetB() };
|
||||
|
||||
GetFogColorTransition( pFogParams, flPrimaryColor, flSecondaryColor );
|
||||
|
||||
@@ -2248,7 +2248,7 @@ void CViewRender::RenderView( const CViewSetup &view, int nClearFlags, int whatT
|
||||
// let vgui know where to render stuff for the forced-to-framebuffer panels
|
||||
if( UseVR() )
|
||||
{
|
||||
vgui::surface()->SetFullscreenViewportAndRenderTarget( viewFramebufferX, viewFramebufferY, viewFramebufferWidth, viewFramebufferHeight, saveRenderTarget );
|
||||
g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( viewFramebufferX, viewFramebufferY, viewFramebufferWidth, viewFramebufferHeight, saveRenderTarget );
|
||||
}
|
||||
|
||||
// clear the render target if we need to
|
||||
@@ -3885,7 +3885,7 @@ static void DrawOpaqueRenderables_DrawStaticProps( CClientRenderablesList::CEntr
|
||||
for( CClientRenderablesList::CEntry *itEntity = pEntitiesBegin; itEntity < pEntitiesEnd; ++ itEntity )
|
||||
{
|
||||
if ( itEntity->m_pRenderable )
|
||||
NULL;
|
||||
/**/;
|
||||
else
|
||||
continue;
|
||||
|
||||
@@ -3935,7 +3935,7 @@ void CRendering3dView::DrawOpaqueRenderables( ERenderDepthMode DepthMode )
|
||||
RopeManager()->ResetRenderCache();
|
||||
g_pParticleSystemMgr->ResetRenderCache();
|
||||
|
||||
bool const bDrawopaquestaticpropslast = r_drawopaquestaticpropslast.GetBool();
|
||||
//bool const bDrawopaquestaticpropslast = r_drawopaquestaticpropslast.GetBool();
|
||||
|
||||
|
||||
//
|
||||
@@ -4101,16 +4101,20 @@ void CRendering3dView::DrawOpaqueRenderables( ERenderDepthMode DepthMode )
|
||||
|
||||
for ( int bucket = 0; bucket < RENDER_GROUP_CFG_NUM_OPAQUE_ENT_BUCKETS; ++ bucket )
|
||||
{
|
||||
if ( bDrawopaquestaticpropslast )
|
||||
// PVS-Studio pointed out that the two sides of the if/else were identical. Fixing
|
||||
// this long-broken behavior would change rendering, so I fixed the code but
|
||||
// commented out the new behavior. Uncomment the if statement and else block
|
||||
// when needed.
|
||||
//if ( bDrawopaquestaticpropslast )
|
||||
{
|
||||
DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode );
|
||||
DrawOpaqueRenderables_DrawStaticProps( pProps[bucket][0], pProps[bucket][1], DepthMode );
|
||||
}
|
||||
else
|
||||
/*else
|
||||
{
|
||||
DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode );
|
||||
DrawOpaqueRenderables_DrawStaticProps( pProps[bucket][0], pProps[bucket][1], DepthMode );
|
||||
}
|
||||
DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode );
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ $MacroRequired "PLATFORM"
|
||||
|
||||
$Project
|
||||
{
|
||||
$Folder "Libraries"
|
||||
$Folder "Link Libraries"
|
||||
{
|
||||
$Libexternal libprotobuf [!$VS2012 && !$VS2013]
|
||||
$Libexternal $SRCDIR\lib\public\2010\libprotobuf [$VS2010]
|
||||
$Libexternal 2012\libprotobuf [$VS2012]
|
||||
$Libexternal 2013\libprotobuf [$VS2013]
|
||||
$Libexternal libprotobuf [$VS2013 || !$WINDOWS]
|
||||
}
|
||||
}
|
||||
|
||||
+50
-65
@@ -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 )
|
||||
{
|
||||
m_Lookup.Purge();
|
||||
for ( short i = src.m_Lookup.FirstInorder();
|
||||
i != src.m_Lookup.InvalidIndex();
|
||||
i = src.m_Lookup.NextInorder( i ) )
|
||||
{
|
||||
m_Lookup.Insert( src.m_Lookup[ i ] );
|
||||
}
|
||||
// Use fast Copy CUtlRBTree CopyFrom. WARNING: It only handles POD.
|
||||
m_Lookup.CopyFrom( src.m_Lookup );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -162,7 +157,6 @@ void AI_CriteriaSet::Describe()
|
||||
{
|
||||
for ( short i = m_Lookup.FirstInorder(); i != m_Lookup.InvalidIndex(); i = m_Lookup.NextInorder( i ) )
|
||||
{
|
||||
|
||||
CritEntry_t *entry = &m_Lookup[ i ];
|
||||
|
||||
if ( entry->weight != 1.0f )
|
||||
@@ -199,9 +193,9 @@ AI_Response::AI_Response()
|
||||
{
|
||||
m_Type = RESPONSE_NONE;
|
||||
m_szResponseName[0] = 0;
|
||||
m_szMatchingRule[0] = 0;
|
||||
|
||||
m_pCriteria = NULL;
|
||||
m_szMatchingRule[0]=0;
|
||||
m_szContext = NULL;
|
||||
m_bApplyContextToWorld = false;
|
||||
}
|
||||
|
||||
@@ -209,13 +203,8 @@ AI_Response::AI_Response()
|
||||
//-----------------------------------------------------------------------------
|
||||
AI_Response::AI_Response( const AI_Response &from )
|
||||
{
|
||||
Assert( (void*)(&m_Type) == (void*)this );
|
||||
m_pCriteria = NULL;
|
||||
memcpy( this, &from, sizeof(*this) );
|
||||
m_pCriteria = NULL;
|
||||
m_szContext = NULL;
|
||||
SetContext( from.m_szContext );
|
||||
m_bApplyContextToWorld = from.m_bApplyContextToWorld;
|
||||
*this = from;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -224,20 +213,34 @@ AI_Response::AI_Response( const AI_Response &from )
|
||||
AI_Response::~AI_Response()
|
||||
{
|
||||
delete m_pCriteria;
|
||||
delete[] m_szContext;
|
||||
m_pCriteria = NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
AI_Response &AI_Response::operator=( const AI_Response &from )
|
||||
{
|
||||
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;
|
||||
m_pCriteria = NULL;
|
||||
memcpy( this, &from, sizeof(*this) );
|
||||
m_pCriteria = NULL;
|
||||
m_szContext = NULL;
|
||||
SetContext( from.m_szContext );
|
||||
|
||||
// Copy criteria.
|
||||
if (from.m_pCriteria)
|
||||
m_pCriteria = new AI_CriteriaSet(*from.m_pCriteria);
|
||||
|
||||
m_Params = from.m_Params;
|
||||
|
||||
m_szContext = from.m_szContext;
|
||||
m_bApplyContextToWorld = from.m_bApplyContextToWorld;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -246,15 +249,22 @@ AI_Response &AI_Response::operator=( const AI_Response &from )
|
||||
// Input : *response -
|
||||
// *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;
|
||||
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
|
||||
Assert( !m_pCriteria );
|
||||
m_pCriteria = new AI_CriteriaSet( criteria );
|
||||
Q_strncpy( m_szMatchingRule, ruleName ? ruleName : "NULL", sizeof( m_szMatchingRule ) );
|
||||
|
||||
m_Params = responseparams;
|
||||
SetContext( applyContext );
|
||||
|
||||
m_szContext = applyContext;
|
||||
m_bApplyContextToWorld = bApplyContextToWorld;
|
||||
}
|
||||
|
||||
@@ -269,35 +279,29 @@ void AI_Response::Describe()
|
||||
m_pCriteria->Describe();
|
||||
}
|
||||
if ( m_szMatchingRule[ 0 ] )
|
||||
{
|
||||
DevMsg( "Matched rule '%s', ", m_szMatchingRule );
|
||||
}
|
||||
if ( m_szContext )
|
||||
{
|
||||
DevMsg( "Contexts to set '%s' on %s, ", m_szContext, m_bApplyContextToWorld ? "world" : "speaker" );
|
||||
}
|
||||
if ( m_szContext.Length() )
|
||||
DevMsg( "Contexts to set '%s' on %s, ", m_szContext.Get(), m_bApplyContextToWorld ? "world" : "speaker" );
|
||||
|
||||
DevMsg( "response %s = '%s'\n", DescribeResponse( (ResponseType_t)m_Type ), m_szResponseName );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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:
|
||||
// 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:
|
||||
// Input : type -
|
||||
@@ -313,25 +317,15 @@ const char *AI_Response::DescribeResponse( ResponseType_t type )
|
||||
|
||||
switch( type )
|
||||
{
|
||||
default:
|
||||
{
|
||||
Assert( 0 );
|
||||
}
|
||||
// Fall through
|
||||
case RESPONSE_NONE:
|
||||
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";
|
||||
case RESPONSE_NONE: 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";
|
||||
}
|
||||
|
||||
@@ -447,16 +441,7 @@ float AI_Response::GetPreDelay() const
|
||||
//-----------------------------------------------------------------------------
|
||||
void AI_Response::SetContext( const char *context )
|
||||
{
|
||||
delete[] m_szContext;
|
||||
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;
|
||||
}
|
||||
m_szContext = context;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -85,6 +85,8 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
// 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 ];
|
||||
float weight;
|
||||
@@ -180,8 +182,8 @@ public:
|
||||
|
||||
void Release();
|
||||
|
||||
void GetName( char *buf, size_t buflen ) const;
|
||||
void GetResponse( char *buf, size_t buflen ) const;
|
||||
const char * GetNamePtr() const;
|
||||
const char * GetResponsePtr() const;
|
||||
const AI_ResponseParams *GetParams() const { return &m_Params; }
|
||||
ResponseType_t GetType() const { return (ResponseType_t)m_Type; }
|
||||
soundlevel_t GetSoundLevel() const;
|
||||
@@ -195,7 +197,7 @@ public:
|
||||
float GetPreDelay() const;
|
||||
|
||||
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; }
|
||||
|
||||
@@ -230,7 +232,7 @@ private:
|
||||
|
||||
AI_ResponseParams m_Params;
|
||||
|
||||
char * m_szContext;
|
||||
CUtlString m_szContext;
|
||||
bool m_bApplyContextToWorld;
|
||||
};
|
||||
|
||||
|
||||
@@ -104,9 +104,14 @@ void CAnimationLayer::Init( CBaseAnimatingOverlay *pOverlay )
|
||||
m_nSequence = 0;
|
||||
m_nPriority = 0;
|
||||
m_nOrder.Set( CBaseAnimatingOverlay::MAX_OVERLAYS );
|
||||
|
||||
m_flBlendIn = 0.0;
|
||||
m_flBlendOut = 0.0;
|
||||
|
||||
m_flKillRate = 100.0;
|
||||
m_flKillDelay = 0.0;
|
||||
m_flPlaybackRate = 1.0;
|
||||
m_flLastEventCheck = 0.0;
|
||||
m_flLastAccess = gpGlobals->curtime;
|
||||
m_flLayerAnimtime = 0;
|
||||
m_flLayerFadeOuttime = 0;
|
||||
|
||||
@@ -95,7 +95,7 @@ void CEnvFade::InputFade( inputdata_t &inputdata )
|
||||
|
||||
if ( m_spawnflags & SF_FADE_ONLYONE )
|
||||
{
|
||||
if ( inputdata.pActivator->IsNetClient() )
|
||||
if ( inputdata.pActivator && inputdata.pActivator->IsNetClient() )
|
||||
{
|
||||
UTIL_ScreenFade( inputdata.pActivator, m_clrRender, Duration(), HoldTime(), fadeFlags );
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ void CMaterialModifyControl::InputStartFloatLerp( inputdata_t &inputdata )
|
||||
{
|
||||
bool bWrap = atoi(pszParam) != 0;
|
||||
// We don't implement wrap currently.
|
||||
bWrap = bWrap;
|
||||
NOTE_UNUSED( bWrap );
|
||||
|
||||
// Got all the parameters. Save 'em and return;
|
||||
m_flFloatLerpStartValue = flStartValue;
|
||||
|
||||
@@ -108,6 +108,9 @@ IHandleEntity *CServerNetworkProperty::GetEntityHandle( )
|
||||
void CServerNetworkProperty::Release()
|
||||
{
|
||||
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_ARM );
|
||||
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 )
|
||||
{
|
||||
DbgEnemyMsg( this, " %s rejected: dead\n", pEnemy->GetDebugName() );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7785,7 +7787,9 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
||||
{
|
||||
DbgEnemyMsg( this, " %s accepted (1)\n", pEnemy->GetDebugName() );
|
||||
if ( pBestEnemy )
|
||||
{
|
||||
DbgEnemyMsg( this, " (%s displaced)\n", pBestEnemy->GetDebugName() );
|
||||
}
|
||||
|
||||
iBestPriority = IRelationPriority ( pEnemy );
|
||||
iBestDistSq = (pEnemy->GetAbsOrigin() - GetAbsOrigin() ).LengthSqr();
|
||||
@@ -7799,7 +7803,9 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
||||
{
|
||||
DbgEnemyMsg( this, " %s accepted\n", pEnemy->GetDebugName() );
|
||||
if ( pBestEnemy )
|
||||
{
|
||||
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
|
||||
// currently think is the best visible enemy. No need to do
|
||||
// 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() );
|
||||
if ( pBestEnemy )
|
||||
{
|
||||
DbgEnemyMsg( this, " (%s displaced due to distance/visibility)\n", pBestEnemy->GetDebugName() );
|
||||
}
|
||||
fBestSeen = fCurSeen;
|
||||
fBestVisible = fCurVisible;
|
||||
iBestDistSq = iDistSq;
|
||||
@@ -7942,8 +7950,10 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
||||
bBestUnreachable = bUnreachable;
|
||||
}
|
||||
else
|
||||
{
|
||||
DbgEnemyMsg( this, " %s rejected: lower priority\n", pEnemy->GetDebugName() );
|
||||
}
|
||||
}
|
||||
|
||||
DbgEnemyMsg( this, "} == %s\n", pBestEnemy->GetDebugName() );
|
||||
|
||||
@@ -8033,6 +8043,7 @@ float CAI_BaseNPC::CalcIdealYaw( const Vector &vecTarget )
|
||||
{
|
||||
vecProjection.x = -vecTarget.y;
|
||||
vecProjection.y = vecTarget.x;
|
||||
vecProjection.z = 0;
|
||||
|
||||
return UTIL_VecToYaw( vecProjection - GetLocalOrigin() );
|
||||
}
|
||||
@@ -8040,6 +8051,7 @@ float CAI_BaseNPC::CalcIdealYaw( const Vector &vecTarget )
|
||||
{
|
||||
vecProjection.x = vecTarget.y;
|
||||
vecProjection.y = vecTarget.x;
|
||||
vecProjection.z = 0;
|
||||
|
||||
return UTIL_VecToYaw( vecProjection - GetLocalOrigin() );
|
||||
}
|
||||
|
||||
@@ -1761,7 +1761,6 @@ public:
|
||||
|
||||
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 void Event_Killed( const CTakeDamageInfo &info );
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ bool CAI_LeadBehavior::GetClosestPointOnRoute( const Vector &targetPos, Vector *
|
||||
float flNearestDist = 999999999;
|
||||
float flPathDist, flPathDist2D;
|
||||
|
||||
Vector vecNearestPoint;
|
||||
Vector vecNearestPoint(0, 0, 0);
|
||||
Vector vecPrevPos = GetOuter()->GetAbsOrigin();
|
||||
for ( ; (waypoint != NULL) ; waypoint = waypoint->GetNext() )
|
||||
{
|
||||
|
||||
@@ -1864,7 +1864,7 @@ float ChangeDistance( float flInterval, float flGoalDistance, float flGoalVeloci
|
||||
// I need to speed up
|
||||
flNewVelocity = flCurVelocity + flGoalAccel * flInterval;
|
||||
if (flNewVelocity > flGoalVelocity)
|
||||
flGoalVelocity = flGoalVelocity;
|
||||
flNewVelocity = flGoalVelocity;
|
||||
}
|
||||
else if (flNewVelocity < flIdealVelocity)
|
||||
{
|
||||
|
||||
@@ -51,8 +51,8 @@ enum AIMsgFlags
|
||||
AIMF_IGNORE_SELECTED = 0x01
|
||||
};
|
||||
|
||||
void DevMsg( CAI_BaseNPC *pAI, unsigned flags, PRINTF_FORMAT_STRING const char *pszFormat, ... );
|
||||
void DevMsg( CAI_BaseNPC *pAI, 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, ... ) FMTFUNCTION( 2, 3 );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -114,7 +114,7 @@ bool CAI_MoveSolver::Solve( const AI_MoveSuggestion_t *pSuggestions, int nSugges
|
||||
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 \
|
||||
{ \
|
||||
if (DbgNav()) \
|
||||
DevMsg( pAI, CFmtStr( "[Nav] %s", static_cast<const char *>(pszMsg) ) ); \
|
||||
DevMsg( pAI, "[Nav] %s", static_cast<const char *>(pszMsg) ); \
|
||||
} while (0)
|
||||
#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) ) )
|
||||
|
||||
@@ -548,10 +548,11 @@ void CAI_PlayerAlly::PrescheduleThink( void )
|
||||
if ( m_flNextIdleSpeechTime && m_flNextIdleSpeechTime < gpGlobals->curtime )
|
||||
{
|
||||
AISpeechSelection_t selection;
|
||||
|
||||
if ( SelectNonCombatSpeech( &selection ) )
|
||||
{
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||
m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 );
|
||||
}
|
||||
else
|
||||
@@ -593,22 +594,23 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM
|
||||
{
|
||||
if ( IsAllowedToSpeak( concept ) )
|
||||
{
|
||||
AI_Response *pResponse = SpeakFindResponse( concept, pszModifiers );
|
||||
if ( pResponse )
|
||||
bool result = SpeakFindResponse( pSelection->Response, concept, pszModifiers );
|
||||
if ( result )
|
||||
{
|
||||
pSelection->Set( concept, pResponse, pTarget );
|
||||
pSelection->concept = concept;
|
||||
pSelection->hSpeechTarget = pTarget;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
pResponse->Release();
|
||||
m_PendingResponse = Response;
|
||||
m_PendingConcept = concept;
|
||||
m_TimePendingSet = gpGlobals->curtime;
|
||||
}
|
||||
@@ -690,7 +692,7 @@ bool CAI_PlayerAlly::SelectInterjection()
|
||||
if ( SelectIdleSpeech( &selection ) )
|
||||
{
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -889,9 +891,8 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN
|
||||
}
|
||||
}
|
||||
|
||||
Assert( selection.pResponse );
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||
|
||||
// Prevent idle speech for a while
|
||||
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() )
|
||||
{
|
||||
AISpeechSelection_t selection;
|
||||
|
||||
if ( SelectNonCombatSpeech( &selection ) )
|
||||
{
|
||||
Assert( selection.pResponse );
|
||||
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:
|
||||
if ( !m_PendingConcept.empty() )
|
||||
{
|
||||
AI_Response *pResponse = new AI_Response;
|
||||
*pResponse = m_PendingResponse;
|
||||
SpeakDispatchResponse( m_PendingConcept.c_str(), pResponse );
|
||||
SpeakDispatchResponse( m_PendingConcept.c_str(), m_PendingResponse );
|
||||
m_PendingConcept.erase();
|
||||
TaskComplete();
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskFail( FAIL_NO_SOUND );
|
||||
}
|
||||
break;
|
||||
|
||||
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
|
||||
// player dying or something equally important.
|
||||
AI_Response *result = SpeakFindResponse( ResponseConcept, NULL );
|
||||
AI_Response response;
|
||||
bool result = SpeakFindResponse( response, ResponseConcept, NULL );
|
||||
if ( result )
|
||||
{
|
||||
// We've got something to say. Stop any scenes we're in, and speak the response.
|
||||
if ( bCancelScene )
|
||||
RemoveActorFromScriptedScenes( this, false );
|
||||
|
||||
bool spoke = SpeakDispatchResponse( ResponseConcept, result );
|
||||
return spoke;
|
||||
return SpeakDispatchResponse( ResponseConcept, response );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -248,20 +248,8 @@ enum AISpeechTargetSearchFlags_t
|
||||
|
||||
struct AISpeechSelection_t
|
||||
{
|
||||
AISpeechSelection_t()
|
||||
: pResponse(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void Set( AIConcept_t newConcept, AI_Response *pNewResponse, CBaseEntity *pTarget = NULL )
|
||||
{
|
||||
pResponse = pNewResponse;
|
||||
concept = newConcept;
|
||||
hSpeechTarget = pTarget;
|
||||
}
|
||||
|
||||
std::string concept;
|
||||
AI_Response * pResponse;
|
||||
AI_Response Response;
|
||||
EHANDLE hSpeechTarget;
|
||||
};
|
||||
|
||||
@@ -347,7 +335,7 @@ public:
|
||||
//---------------------------------
|
||||
|
||||
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();
|
||||
bool HasPendingSpeech() { return !m_PendingConcept.empty(); }
|
||||
|
||||
|
||||
+67
-125
@@ -38,10 +38,7 @@ CAI_TimedSemaphore g_AIFoesTalkSemaphore;
|
||||
|
||||
ConceptHistory_t::~ConceptHistory_t()
|
||||
{
|
||||
if ( response )
|
||||
{
|
||||
delete response;
|
||||
}
|
||||
response = NULL;
|
||||
}
|
||||
|
||||
@@ -57,15 +54,17 @@ ConceptHistory_t::ConceptHistory_t( const ConceptHistory_t& src )
|
||||
|
||||
ConceptHistory_t& ConceptHistory_t::operator =( const ConceptHistory_t& src )
|
||||
{
|
||||
if ( this == &src )
|
||||
return *this;
|
||||
|
||||
if ( this != &src )
|
||||
{
|
||||
timeSpoken = src.timeSpoken;
|
||||
|
||||
delete response;
|
||||
response = NULL;
|
||||
if ( src.response )
|
||||
{
|
||||
response = new AI_Response( *src.response );
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -89,14 +88,14 @@ public:
|
||||
|
||||
pSave->StartBlock();
|
||||
{
|
||||
|
||||
// Write element name
|
||||
pSave->WriteString( ch->GetElementName( i ) );
|
||||
|
||||
// Write data
|
||||
pSave->WriteAll( pHistory );
|
||||
|
||||
// Write response blob
|
||||
bool hasresponse = pHistory->response != NULL ? true : false;
|
||||
bool hasresponse = !!pHistory->response;
|
||||
pSave->WriteBool( &hasresponse );
|
||||
if ( hasresponse )
|
||||
{
|
||||
@@ -118,6 +117,7 @@ public:
|
||||
{
|
||||
char conceptname[ 512 ];
|
||||
conceptname[ 0 ] = 0;
|
||||
|
||||
ConceptHistory_t history;
|
||||
|
||||
pRestore->StartBlock();
|
||||
@@ -127,7 +127,6 @@ public:
|
||||
pRestore->ReadAll( &history );
|
||||
|
||||
bool hasresponse = false;
|
||||
|
||||
pRestore->ReadBool( &hasresponse );
|
||||
if ( hasresponse )
|
||||
{
|
||||
@@ -251,14 +250,14 @@ void CAI_Expresser::TestAllResponses()
|
||||
if ( pResponseSystem )
|
||||
{
|
||||
CUtlVector<AI_Response *> responses;
|
||||
|
||||
pResponseSystem->GetAllResponses( &responses );
|
||||
for ( int i = 0; i < responses.Count(); i++ )
|
||||
{
|
||||
char response[ 256 ];
|
||||
responses[i]->GetResponse( response, sizeof( response ) );
|
||||
const char *szResponse = responses[i]->GetResponsePtr();
|
||||
|
||||
Msg( "Response: %s\n", response );
|
||||
SpeakDispatchResponse( "", responses[i] );
|
||||
Msg( "Response: %s\n", szResponse );
|
||||
SpeakDispatchResponse( "", *responses[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -273,13 +272,13 @@ static const int LEN_SPECIFIC_SCENE_MODIFIER = strlen( AI_SPECIFIC_SCENE_MODIFIE
|
||||
// NULL -
|
||||
// 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();
|
||||
if ( !rs )
|
||||
{
|
||||
Assert( !"No response system installed for CAI_Expresser::GetOuter()!!!" );
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
AI_CriteriaSet set;
|
||||
@@ -287,7 +286,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *
|
||||
set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT );
|
||||
|
||||
// Always include any optional modifiers
|
||||
if ( modifiers != NULL )
|
||||
if ( modifiers )
|
||||
{
|
||||
char copy_modifiers[ 255 ];
|
||||
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
|
||||
AI_Response *result = new AI_Response;
|
||||
Assert( result && "new AI_Response: Returned a NULL AI_Response!" );
|
||||
bool found = rs->FindBestResponse( set, *result, this );
|
||||
bool found = rs->FindBestResponse( set, outResponse, this );
|
||||
|
||||
if ( rr_debugresponses.GetInt() == 3 )
|
||||
{
|
||||
if ( ( GetOuter()->MyNPCPointer() && GetOuter()->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT ) || GetOuter()->IsPlayer() )
|
||||
{
|
||||
const char *pszName;
|
||||
if ( GetOuter()->IsPlayer() )
|
||||
{
|
||||
pszName = ((CBasePlayer*)GetOuter())->GetPlayerName();
|
||||
}
|
||||
else
|
||||
{
|
||||
pszName = GetOuter()->GetDebugName();
|
||||
}
|
||||
const char *pszName = GetOuter()->IsPlayer() ?
|
||||
((CBasePlayer*)GetOuter())->GetPlayerName() : GetOuter()->GetDebugName();
|
||||
|
||||
if ( found )
|
||||
{
|
||||
char response[ 256 ];
|
||||
result->GetResponse( response, sizeof( response ) );
|
||||
|
||||
Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, response );
|
||||
const char *szReponse = outResponse.GetResponsePtr();
|
||||
Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, szReponse );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -353,44 +341,28 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *
|
||||
}
|
||||
|
||||
if ( !found )
|
||||
{
|
||||
//Assert( !"rs->FindBestResponse: Returned a NULL AI_Response!" );
|
||||
delete result;
|
||||
return NULL;
|
||||
}
|
||||
return false;
|
||||
|
||||
char response[ 256 ];
|
||||
result->GetResponse( response, sizeof( response ) );
|
||||
const char *szReponse = outResponse.GetResponsePtr();
|
||||
if ( !szReponse[0] )
|
||||
return false;
|
||||
|
||||
if ( !response[0] )
|
||||
{
|
||||
delete result;
|
||||
return NULL;
|
||||
}
|
||||
if ( ( outResponse.GetOdds() < 100 ) && ( random->RandomInt( 1, 100 ) <= outResponse.GetOdds() ) )
|
||||
return false;
|
||||
|
||||
if ( result->GetOdds() < 100 && random->RandomInt( 1, 100 ) <= result->GetOdds() )
|
||||
{
|
||||
delete result;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Dispatches the result
|
||||
// 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;
|
||||
|
||||
soundlevel_t soundlevel = result->GetSoundLevel();
|
||||
float delay = response.GetDelay();
|
||||
const char *szResponse = response.GetResponsePtr();
|
||||
soundlevel_t soundlevel = response.GetSoundLevel();
|
||||
|
||||
if ( IsSpeaking() && concept[0] != 0 )
|
||||
{
|
||||
@@ -404,94 +376,80 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
|
||||
if ( IsRunningScriptedScene( GetOuter() ) )
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
switch ( result->GetType() )
|
||||
switch ( response.GetType() )
|
||||
{
|
||||
default:
|
||||
case RESPONSE_NONE:
|
||||
break;
|
||||
|
||||
case RESPONSE_SPEAK:
|
||||
{
|
||||
if ( !result->ShouldntUseScene() )
|
||||
if ( !response.ShouldntUseScene() )
|
||||
{
|
||||
// This generates a fake CChoreoScene wrapping the sound.txt name
|
||||
spoke = SpeakAutoGeneratedScene( response, delay );
|
||||
spoke = SpeakAutoGeneratedScene( szResponse, delay );
|
||||
}
|
||||
else
|
||||
{
|
||||
float speakTime = GetResponseDuration( result );
|
||||
GetOuter()->EmitSound( response );
|
||||
float speakTime = GetResponseDuration( response );
|
||||
GetOuter()->EmitSound( szResponse );
|
||||
|
||||
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 );
|
||||
spoke = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_SENTENCE:
|
||||
{
|
||||
spoke = ( -1 != SpeakRawSentence( response, delay, VOL_NORM, soundlevel ) ) ? true : false;
|
||||
}
|
||||
spoke = ( -1 != SpeakRawSentence( szResponse, delay, VOL_NORM, soundlevel ) ) ? true : false;
|
||||
break;
|
||||
|
||||
case RESPONSE_SCENE:
|
||||
{
|
||||
spoke = SpeakRawScene( response, delay, result, filter );
|
||||
}
|
||||
spoke = SpeakRawScene( szResponse, delay, &response, filter );
|
||||
break;
|
||||
|
||||
case RESPONSE_RESPONSE:
|
||||
{
|
||||
// This should have been recursively resolved already
|
||||
Assert( 0 );
|
||||
}
|
||||
break;
|
||||
case RESPONSE_PRINT:
|
||||
{
|
||||
if ( g_pDeveloper->GetInt() > 0 )
|
||||
{
|
||||
Vector vPrintPos;
|
||||
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
|
||||
NDebugOverlay::Text( vPrintPos, response, true, 1.5 );
|
||||
NDebugOverlay::Text( vPrintPos, szResponse, true, 1.5 );
|
||||
spoke = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( spoke )
|
||||
{
|
||||
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;
|
||||
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 ) );
|
||||
if ( pEntity )
|
||||
{
|
||||
pEntity->AddContext( result->GetContext() );
|
||||
pEntity->AddContext( response.GetContext() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetOuter()->AddContext( result->GetContext() );
|
||||
GetOuter()->AddContext( response.GetContext() );
|
||||
}
|
||||
SetSpokeConcept( concept, result );
|
||||
}
|
||||
else
|
||||
{
|
||||
delete result;
|
||||
|
||||
SetSpokeConcept( concept, &response );
|
||||
}
|
||||
|
||||
return spoke;
|
||||
@@ -502,45 +460,34 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
|
||||
// Input : *response -
|
||||
// Output : float
|
||||
//-----------------------------------------------------------------------------
|
||||
float CAI_Expresser::GetResponseDuration( AI_Response *result )
|
||||
float CAI_Expresser::GetResponseDuration( AI_Response& response )
|
||||
{
|
||||
Assert( result );
|
||||
char response[ 256 ];
|
||||
result->GetResponse( response, sizeof( response ) );
|
||||
const char *szResponse = response.GetResponsePtr();
|
||||
|
||||
switch ( result->GetType() )
|
||||
switch ( response.GetType() )
|
||||
{
|
||||
default:
|
||||
case RESPONSE_NONE:
|
||||
break;
|
||||
|
||||
case RESPONSE_SPEAK:
|
||||
{
|
||||
return GetOuter()->GetSoundDuration( response, STRING( GetOuter()->GetModelName() ) );
|
||||
}
|
||||
break;
|
||||
return GetOuter()->GetSoundDuration( szResponse, STRING( GetOuter()->GetModelName() ) );
|
||||
|
||||
case RESPONSE_SENTENCE:
|
||||
{
|
||||
Assert( 0 );
|
||||
return 999.0f;
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_SCENE:
|
||||
{
|
||||
return GetSceneDuration( response );
|
||||
}
|
||||
break;
|
||||
return GetSceneDuration( szResponse );
|
||||
|
||||
case RESPONSE_RESPONSE:
|
||||
{
|
||||
// This should have been recursively resolved already
|
||||
Assert( 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_PRINT:
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
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 */ )
|
||||
{
|
||||
AI_Response *result = SpeakFindResponse( concept, modifiers );
|
||||
AI_Response response;
|
||||
bool result = SpeakFindResponse( response, concept, modifiers );
|
||||
if ( !result )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
result->GetResponse( pszOutResponseChosen, bufsize );
|
||||
const char *szResponse = response.GetResponsePtr();
|
||||
Q_strncpy( pszOutResponseChosen, szResponse, bufsize );
|
||||
}
|
||||
|
||||
return spoke;
|
||||
@@ -808,17 +755,12 @@ void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response,
|
||||
ConceptHistory_t *slot = &m_ConceptHistories[ idx ];
|
||||
|
||||
slot->timeSpoken = gpGlobals->curtime;
|
||||
|
||||
// Update response info
|
||||
if ( response )
|
||||
{
|
||||
AI_Response *r = slot->response;
|
||||
if ( r )
|
||||
{
|
||||
delete r;
|
||||
}
|
||||
|
||||
// FIXME: Are we leaking AI_Responses?
|
||||
slot->response = response;
|
||||
delete slot->response;
|
||||
slot->response = new AI_Response( *response );
|
||||
}
|
||||
|
||||
if ( bCallback )
|
||||
@@ -885,13 +827,13 @@ void CAI_Expresser::SpeechMsg( CBaseEntity *pFlex, const char *pszFormat, ... )
|
||||
|
||||
if ( pFlex->MyNPCPointer() )
|
||||
{
|
||||
DevMsg( pFlex->MyNPCPointer(), string );
|
||||
DevMsg( pFlex->MyNPCPointer(), "%s", string );
|
||||
}
|
||||
else
|
||||
{
|
||||
DevMsg( "%s", string );
|
||||
}
|
||||
UTIL_LogPrintf( string );
|
||||
UTIL_LogPrintf( "%s", string );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-11
@@ -159,9 +159,9 @@ public:
|
||||
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
|
||||
AI_Response *SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
|
||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL );
|
||||
float GetResponseDuration( AI_Response *response );
|
||||
bool SpeakFindResponse( AI_Response &response, AIConcept_t concept, const char *modifiers = NULL );
|
||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response &response, IRecipientFilter *filter = NULL );
|
||||
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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
// 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 SpeakDispatchResponse( AIConcept_t concept, AI_Response *response );
|
||||
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; }
|
||||
float GetResponseDuration( AI_Response *response );
|
||||
bool SpeakFindResponse( AI_Response& response, AIConcept_t concept, const char *modifiers = NULL );
|
||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response& response );
|
||||
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response& response ) { return; }
|
||||
float GetResponseDuration( AI_Response& response );
|
||||
|
||||
float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); }
|
||||
|
||||
@@ -360,15 +360,15 @@ inline IResponseSystem *CAI_ExpresserHost<BASE_NPC>::GetResponseSystem()
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
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>
|
||||
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 ) )
|
||||
{
|
||||
@@ -382,7 +382,7 @@ inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t conc
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ END_DATADESC()
|
||||
CAI_ShotRegulator::CAI_ShotRegulator() : m_nMinBurstShots(1), m_nMaxBurstShots(1)
|
||||
{
|
||||
m_flMinRestInterval = 0.0f;
|
||||
m_flMinRestInterval = 0.0f;
|
||||
m_flMaxRestInterval = 0.0f;
|
||||
m_flMinBurstInterval = 0.0f;
|
||||
m_flMaxBurstInterval = 0.0f;
|
||||
m_flNextShotTime = -1;
|
||||
|
||||
+18
-27
@@ -303,7 +303,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CBaseEntity, DT_BaseEntity )
|
||||
SendPropBool( SENDINFO( m_bAlternateSorting )),
|
||||
|
||||
#ifdef TF_DLL
|
||||
SendPropArray3( SENDINFO_ARRAY3(m_nModelIndexOverrides), SendPropInt( SENDINFO_ARRAY(m_nModelIndexOverrides), SP_MODEL_INDEX_BITS, SPROP_UNSIGNED ) ),
|
||||
SendPropArray3( SENDINFO_ARRAY3(m_nModelIndexOverrides), SendPropInt( SENDINFO_ARRAY(m_nModelIndexOverrides), SP_MODEL_INDEX_BITS, 0 ) ),
|
||||
#endif
|
||||
|
||||
END_SEND_TABLE()
|
||||
@@ -344,6 +344,8 @@ void CBaseEntityModelLoadProxy::Handler::OnModelLoadComplete( const model_t *pMo
|
||||
|
||||
CBaseEntity::CBaseEntity( bool bServerOnly )
|
||||
{
|
||||
m_pAttributes = NULL;
|
||||
|
||||
COMPILE_TIME_ASSERT( MOVETYPE_LAST < (1 << MOVETYPE_MAX_BITS) );
|
||||
COMPILE_TIME_ASSERT( MOVECOLLIDE_COUNT < (1 << MOVECOLLIDE_MAX_BITS) );
|
||||
|
||||
@@ -4822,7 +4824,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex )
|
||||
char token[256];
|
||||
const char *pOptions = pEvent->pszOptions();
|
||||
nexttoken( token, pOptions, ' ' );
|
||||
if ( token )
|
||||
if ( token[0] )
|
||||
{
|
||||
PrecacheParticleSystem( token );
|
||||
}
|
||||
@@ -4908,7 +4910,9 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload )
|
||||
{
|
||||
if ( !name || !*name )
|
||||
{
|
||||
#ifdef STAGING_ONLY
|
||||
Msg( "Attempting to precache model, but model name is NULL\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -4917,8 +4921,7 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload )
|
||||
{
|
||||
if ( !engine->IsModelPrecached( name ) )
|
||||
{
|
||||
Assert( !"CBaseEntity::PrecacheModel: too late" );
|
||||
Warning( "Late precache of %s\n", name );
|
||||
DevMsg( "Late precache of %s -- not necessarily a bug now that we allow ~everything to be dynamically loaded.\n", name );
|
||||
}
|
||||
}
|
||||
#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 bool UtlStringLessFunc( const CUtlString &lhs, const CUtlString &rhs )
|
||||
{
|
||||
return Q_stricmp( lhs.String(), rhs.String() ) < 0;
|
||||
}
|
||||
|
||||
class CEntFireAutoCompletionFunctor : public ICommandCallback, public ICommandCompletionCallback
|
||||
{
|
||||
public:
|
||||
@@ -6656,23 +6654,19 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
|
||||
AI_Response result;
|
||||
bool found = rs->FindBestResponse( set, result );
|
||||
if ( !found )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the response here...
|
||||
char response[ 256 ];
|
||||
result.GetResponse( response, sizeof( response ) );
|
||||
const char *szResponse = result.GetResponsePtr();
|
||||
switch ( result.GetType() )
|
||||
{
|
||||
case RESPONSE_SPEAK:
|
||||
{
|
||||
EmitSound( response );
|
||||
}
|
||||
EmitSound( szResponse );
|
||||
break;
|
||||
|
||||
case RESPONSE_SENTENCE:
|
||||
{
|
||||
int sentenceIndex = SENTENCEG_Lookup( response );
|
||||
int sentenceIndex = SENTENCEG_Lookup( szResponse );
|
||||
if( sentenceIndex == -1 )
|
||||
{
|
||||
// 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 );
|
||||
}
|
||||
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;
|
||||
default:
|
||||
// Don't know how to handle .vcds!!!
|
||||
@@ -7051,7 +7042,7 @@ void CBaseEntity::SetRefEHandle( const CBaseHandle &handle )
|
||||
if ( edict() )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+26
-18
@@ -83,7 +83,7 @@ class CUserCmd;
|
||||
class CSkyCamera;
|
||||
class CEntityMapData;
|
||||
class INextBot;
|
||||
|
||||
class IHasAttributes;
|
||||
|
||||
typedef CUtlVector< CBaseEntity* > EntityList_t;
|
||||
|
||||
@@ -1087,49 +1087,57 @@ public:
|
||||
int GetHealth() const { return m_iHealth; }
|
||||
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.
|
||||
#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 )
|
||||
{
|
||||
#ifdef GNUC
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
||||
#endif
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||
m_pfnTouch = func;
|
||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnTouch)), name );
|
||||
return func;
|
||||
}
|
||||
USEPTR UseSet( USEPTR func, char *name )
|
||||
{
|
||||
#ifdef GNUC
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
||||
#endif
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||
m_pfnUse = func;
|
||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnUse)), name );
|
||||
return func;
|
||||
}
|
||||
ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name )
|
||||
{
|
||||
#ifdef GNUC
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
||||
#endif
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||
m_pfnBlocked = func;
|
||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnBlocked)), name );
|
||||
return func;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _DEBUG
|
||||
|
||||
virtual void ModifyOrAppendCriteria( AI_CriteriaSet& set );
|
||||
void AppendContextToCriteria( AI_CriteriaSet& set, const char *prefix = "" );
|
||||
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:
|
||||
friend class CAI_Senses;
|
||||
CBaseEntity *m_pLink;// used for temporary link-list operations.
|
||||
|
||||
@@ -1318,9 +1318,9 @@ static Activity DetermineExpressionMoveActivity( CChoreoEvent *event, CAI_BaseNP
|
||||
|
||||
// Custom distance styles are appended to param2 with a space as a separator
|
||||
const char *pszAct = Q_strstr( sParam2, " " );
|
||||
char szActName[256];
|
||||
if ( pszAct )
|
||||
{
|
||||
char szActName[256];
|
||||
Q_strncpy( szActName, sParam2, sizeof(szActName) );
|
||||
szActName[ (pszAct-sParam2) ] = '\0';
|
||||
pszAct = szActName;
|
||||
@@ -2555,7 +2555,7 @@ void CFlexCycler::Think( void )
|
||||
{
|
||||
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;
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
AI_Response *CBaseMultiplayerPlayer::SpeakConcept( int iConcept )
|
||||
bool CBaseMultiplayerPlayer::SpeakConcept( AI_Response &response, int iConcept )
|
||||
{
|
||||
// Save the current concept.
|
||||
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 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 CanHearAndReadChatFrom( CBasePlayer *pPlayer );
|
||||
|
||||
+36
-2
@@ -281,7 +281,11 @@ void CBaseEntityOutput::FireOutput(variant_t Value, CBaseEntity *pActivator, CBa
|
||||
Q_snprintf( szBuffer,
|
||||
sizeof(szBuffer),
|
||||
"(%0.2f) output: (%s,%s) -> (%s,%s,%.1f)(%s)\n",
|
||||
#ifdef TF_DLL
|
||||
engine->GetServerTime(),
|
||||
#else
|
||||
gpGlobals->curtime,
|
||||
#endif
|
||||
pCaller ? STRING(pCaller->m_iClassname) : "NULL",
|
||||
pCaller ? STRING(pCaller->GetEntityName()) : "NULL",
|
||||
STRING(ev->m_iTarget),
|
||||
@@ -298,7 +302,11 @@ void CBaseEntityOutput::FireOutput(variant_t Value, CBaseEntity *pActivator, CBa
|
||||
Q_snprintf( szBuffer,
|
||||
sizeof(szBuffer),
|
||||
"(%0.2f) output: (%s,%s) -> (%s,%s)(%s)\n",
|
||||
#ifdef TF_DLL
|
||||
engine->GetServerTime(),
|
||||
#else
|
||||
gpGlobals->curtime,
|
||||
#endif
|
||||
pCaller ? STRING(pCaller->m_iClassname) : "NULL",
|
||||
pCaller ? STRING(pCaller->GetEntityName()) : "NULL", STRING(ev->m_iTarget),
|
||||
STRING(ev->m_iTargetInput),
|
||||
@@ -459,7 +467,7 @@ void CBaseEntityOutput::DeleteAllElements( void )
|
||||
m_ActionList = NULL;
|
||||
while (pNext)
|
||||
{
|
||||
register CEventAction *strikeThis = pNext;
|
||||
CEventAction *strikeThis = pNext;
|
||||
pNext = pNext->m_pNext;
|
||||
delete strikeThis;
|
||||
}
|
||||
@@ -767,7 +775,13 @@ void CEventQueue::Dump( void )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
@@ -795,7 +809,11 @@ void CEventQueue::AddEvent( const char *target, const char *targetInput, variant
|
||||
{
|
||||
// build the new event
|
||||
EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t;
|
||||
#ifdef TF_DLL
|
||||
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_pEntTarget = NULL;
|
||||
newEvent->m_iTargetInput = MAKE_STRING( targetInput );
|
||||
@@ -814,7 +832,11 @@ void CEventQueue::AddEvent( CBaseEntity *target, const char *targetInput, varian
|
||||
{
|
||||
// build the new event
|
||||
EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t;
|
||||
#ifdef TF_DLL
|
||||
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_pEntTarget = target;
|
||||
newEvent->m_iTargetInput = MAKE_STRING( targetInput );
|
||||
@@ -885,7 +907,11 @@ void CEventQueue::ServiceEvents( void )
|
||||
|
||||
EventQueuePrioritizedEvent_t *pe = m_Events.m_pNext;
|
||||
|
||||
#ifdef TF_DLL
|
||||
while ( pe != NULL && pe->m_flFireTime <= engine->GetServerTime() )
|
||||
#else
|
||||
while ( pe != NULL && pe->m_flFireTime <= gpGlobals->curtime )
|
||||
#endif
|
||||
{
|
||||
MDLCACHE_CRITICAL_SECTION();
|
||||
|
||||
@@ -1171,7 +1197,11 @@ int CEventQueue::Restore( IRestore &restore )
|
||||
AddEvent( tmpEvent.m_pEntTarget,
|
||||
STRING(tmpEvent.m_iTargetInput),
|
||||
tmpEvent.m_VariantValue,
|
||||
#ifdef TF_DLL
|
||||
tmpEvent.m_flFireTime - engine->GetServerTime(),
|
||||
#else
|
||||
tmpEvent.m_flFireTime - gpGlobals->curtime,
|
||||
#endif
|
||||
tmpEvent.m_pActivator,
|
||||
tmpEvent.m_pCaller,
|
||||
tmpEvent.m_iOutputID );
|
||||
@@ -1181,7 +1211,11 @@ int CEventQueue::Restore( IRestore &restore )
|
||||
AddEvent( STRING(tmpEvent.m_iTarget),
|
||||
STRING(tmpEvent.m_iTargetInput),
|
||||
tmpEvent.m_VariantValue,
|
||||
#ifdef TF_DLL
|
||||
tmpEvent.m_flFireTime - engine->GetServerTime(),
|
||||
#else
|
||||
tmpEvent.m_flFireTime - gpGlobals->curtime,
|
||||
#endif
|
||||
tmpEvent.m_pActivator,
|
||||
tmpEvent.m_pCaller,
|
||||
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);
|
||||
|
||||
#ifdef DBGFLAG_ASSERT
|
||||
static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
|
||||
{
|
||||
if ( !ground || !ent )
|
||||
@@ -1368,8 +1369,8 @@ static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static int DescribeGroundList( CBaseEntity *ent )
|
||||
{
|
||||
|
||||
@@ -53,7 +53,27 @@ public:
|
||||
virtual void ApplyMultiDamage( void );
|
||||
virtual void AddMultiDamage( const CTakeDamageInfo &pTakeDamageInfo, CBaseEntity *pEntity );
|
||||
virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRadius, int iClassIgnore, CBaseEntity *pEntityIgnore );
|
||||
|
||||
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.
|
||||
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 );
|
||||
|
||||
// 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 )
|
||||
@@ -347,6 +368,101 @@ ITempEntsSystem *CServerTools::GetTempEntsSystem( void )
|
||||
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
|
||||
class CServerChoreoTools : public IServerChoreoTools
|
||||
|
||||
@@ -1105,7 +1105,7 @@ void CGlobalEntityList::OnAddEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
||||
|
||||
void CGlobalEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef DBGFLAG_ASSERT
|
||||
if ( !g_fInCleanupDelete )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -155,7 +155,6 @@ public:
|
||||
|
||||
CBaseEntity *FindEntityNearestFacing( const Vector &origin, const Vector &facing, float threshold);
|
||||
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 );
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ void CEnvTonemapController::InputSetBloomScaleRange( inputdata_t &inputdata )
|
||||
return;
|
||||
}
|
||||
m_flCustomBloomScale=bloom_max;
|
||||
m_flCustomBloomScale=bloom_min;
|
||||
m_flCustomBloomScaleMinimum=bloom_min;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -109,8 +109,6 @@ void CWindowPane::PaneTouch( CBaseEntity *pOther )
|
||||
//------------------------------------------------------------------------------
|
||||
void CWindowPane::Die( void )
|
||||
{
|
||||
Vector flForce = -1 * GetAbsVelocity();
|
||||
|
||||
CPASFilter filter( GetAbsOrigin() );
|
||||
te->ShatterSurface( filter, 0.0,
|
||||
&GetAbsOrigin(), &GetAbsAngles(),
|
||||
|
||||
@@ -162,7 +162,7 @@ void CFunc_Dust::Spawn()
|
||||
|
||||
//Since keyvalues can arrive in any order, and UTIL_StringToColor32 stomps alpha,
|
||||
//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 );
|
||||
|
||||
BaseClass::Spawn();
|
||||
|
||||
@@ -1888,9 +1888,13 @@ void CServerGameDLL::SetServerHibernation( bool bHibernating )
|
||||
const char *CServerGameDLL::GetServerBrowserMapOverride()
|
||||
{
|
||||
#ifdef TF_DLL
|
||||
if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && g_pPopulationManager && g_pPopulationManager->GetPopulationFilenameShort() != '\0' )
|
||||
if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() )
|
||||
{
|
||||
return g_pPopulationManager->GetPopulationFilenameShort();
|
||||
const char *pszFilenameShort = g_pPopulationManager ? g_pPopulationManager->GetPopulationFilenameShort() : NULL;
|
||||
if ( pszFilenameShort && pszFilenameShort[0] )
|
||||
{
|
||||
return pszFilenameShort;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
@@ -1923,6 +1927,15 @@ const char *CServerGameDLL::GetServerBrowserGameData()
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2964,6 +2977,8 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p
|
||||
// Flush the remaining areaportal states.
|
||||
engine->SetAreaPortalStates( portalNums, isOpen, iOutPortal );
|
||||
|
||||
if ( pPlayer )
|
||||
{
|
||||
// Update the area bits that get sent to the client.
|
||||
pPlayer->m_Local.UpdateAreaBits( pPlayer, portalBits );
|
||||
|
||||
@@ -2975,6 +2990,7 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p
|
||||
pPortalPlayer->UpdatePortalViewAreaBits( pvs, pvssize );
|
||||
}
|
||||
#endif //PORTAL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3325,7 +3341,7 @@ void MessageWriteEHandle( CBaseEntity *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);
|
||||
}
|
||||
else
|
||||
|
||||
+61
-58
@@ -28,35 +28,35 @@ extern INetworkStringTable *g_pStringTableServerPopFiles;
|
||||
class CServerGameClients : public IServerGameClients
|
||||
{
|
||||
public:
|
||||
virtual bool ClientConnect( edict_t *pEntity, char const* pszName, char const* pszAddress, char *reject, int maxrejectlen );
|
||||
virtual void ClientActive( edict_t *pEntity, bool bLoadGame );
|
||||
virtual void ClientDisconnect( edict_t *pEntity );
|
||||
virtual void ClientPutInServer( edict_t *pEntity, const char *playername );
|
||||
virtual void ClientCommand( edict_t *pEntity, const CCommand &args );
|
||||
virtual void ClientSettingsChanged( edict_t *pEntity );
|
||||
virtual void ClientSetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char *pvs, int pvssize );
|
||||
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 ) OVERRIDE;
|
||||
virtual void ClientDisconnect( edict_t *pEntity ) OVERRIDE;
|
||||
virtual void ClientPutInServer( edict_t *pEntity, const char *playername ) OVERRIDE;
|
||||
virtual void ClientCommand( edict_t *pEntity, const CCommand &args ) OVERRIDE;
|
||||
virtual void ClientSettingsChanged( edict_t *pEntity ) OVERRIDE;
|
||||
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,
|
||||
int dropped_packets, bool ignore, bool paused );
|
||||
int dropped_packets, bool ignore, bool paused ) OVERRIDE;
|
||||
// Player is running a command
|
||||
virtual void PostClientMessagesSent_DEPRECIATED( void );
|
||||
virtual void SetCommandClient( int index );
|
||||
virtual CPlayerState *GetPlayerState( edict_t *player );
|
||||
virtual void ClientEarPosition( edict_t *pEntity, Vector *pEarOrigin );
|
||||
virtual void PostClientMessagesSent_DEPRECIATED( void ) OVERRIDE;
|
||||
virtual void SetCommandClient( int index ) OVERRIDE;
|
||||
virtual CPlayerState *GetPlayerState( edict_t *player ) OVERRIDE;
|
||||
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)
|
||||
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)
|
||||
// can be added here
|
||||
virtual void GetBugReportInfo( char *buf, int buflen );
|
||||
virtual void NetworkIDValidated( const char *pszUserName, const char *pszNetworkID );
|
||||
virtual void GetBugReportInfo( char *buf, int buflen ) OVERRIDE;
|
||||
virtual void NetworkIDValidated( const char *pszUserName, const char *pszNetworkID ) OVERRIDE;
|
||||
|
||||
// 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
|
||||
virtual void ClientSpawned( edict_t *pPlayer );
|
||||
virtual void ClientSpawned( edict_t *pPlayer ) OVERRIDE;
|
||||
};
|
||||
|
||||
|
||||
@@ -64,73 +64,73 @@ class CServerGameDLL : public IServerGameDLL
|
||||
{
|
||||
public:
|
||||
virtual bool DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsFactory,
|
||||
CreateInterfaceFn fileSystemFactory, CGlobalVars *pGlobals);
|
||||
virtual void DLLShutdown( void );
|
||||
CreateInterfaceFn fileSystemFactory, CGlobalVars *pGlobals) OVERRIDE;
|
||||
virtual void DLLShutdown( void ) OVERRIDE;
|
||||
// Get the simulation interval (must be compiled with identical values into both client and game .dll for MOD!!!)
|
||||
virtual bool ReplayInit( CreateInterfaceFn fnReplayFactory );
|
||||
virtual float GetTickInterval( void ) const;
|
||||
virtual bool GameInit( void );
|
||||
virtual void GameShutdown( void );
|
||||
virtual bool LevelInit( const char *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background );
|
||||
virtual void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax );
|
||||
virtual void LevelShutdown( void );
|
||||
virtual void GameFrame( bool simulating ); // 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 bool ReplayInit( CreateInterfaceFn fnReplayFactory ) OVERRIDE;
|
||||
virtual float GetTickInterval( void ) const OVERRIDE;
|
||||
virtual bool GameInit( void ) OVERRIDE;
|
||||
virtual void GameShutdown( void ) OVERRIDE;
|
||||
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 ) OVERRIDE;
|
||||
virtual void LevelShutdown( void ) OVERRIDE;
|
||||
virtual void GameFrame( bool simulating ) OVERRIDE; // could be called multiple times 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 const char *GetGameDescription( void );
|
||||
virtual void CreateNetworkStringTables( void );
|
||||
virtual ServerClass* GetAllServerClasses( void ) OVERRIDE;
|
||||
virtual const char *GetGameDescription( void ) OVERRIDE;
|
||||
virtual void CreateNetworkStringTables( void ) OVERRIDE;
|
||||
|
||||
// Save/restore system hooks
|
||||
virtual CSaveRestoreData *SaveInit( int size );
|
||||
virtual void SaveWriteFields( CSaveRestoreData *, char const* , void *, datamap_t *, typedescription_t *, int );
|
||||
virtual void SaveReadFields( CSaveRestoreData *, char const* , void *, datamap_t *, typedescription_t *, int );
|
||||
virtual void SaveGlobalState( CSaveRestoreData * );
|
||||
virtual void RestoreGlobalState( CSaveRestoreData * );
|
||||
virtual int CreateEntityTransitionList( CSaveRestoreData *, int );
|
||||
virtual void BuildAdjacentMapList( void );
|
||||
virtual CSaveRestoreData *SaveInit( int size ) OVERRIDE;
|
||||
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 ) OVERRIDE;
|
||||
virtual void SaveGlobalState( CSaveRestoreData * ) OVERRIDE;
|
||||
virtual void RestoreGlobalState( CSaveRestoreData * ) OVERRIDE;
|
||||
virtual int CreateEntityTransitionList( CSaveRestoreData *, int ) OVERRIDE;
|
||||
virtual void BuildAdjacentMapList( void ) OVERRIDE;
|
||||
|
||||
virtual void PreSave( CSaveRestoreData * );
|
||||
virtual void Save( CSaveRestoreData * );
|
||||
virtual void GetSaveComment( char *comment, int maxlength, float flMinutes, float flSeconds, bool bNoTime = false );
|
||||
virtual void PreSave( CSaveRestoreData * ) OVERRIDE;
|
||||
virtual void Save( CSaveRestoreData * ) OVERRIDE;
|
||||
virtual void GetSaveComment( char *comment, int maxlength, float flMinutes, float flSeconds, bool bNoTime = false ) OVERRIDE;
|
||||
#ifdef _XBOX
|
||||
virtual void GetTitleName( const char *pMapName, char* pTitleBuff, int titleBuffSize );
|
||||
virtual void GetTitleName( const char *pMapName, char* pTitleBuff, int titleBuffSize ) OVERRIDE;
|
||||
#endif
|
||||
virtual void WriteSaveHeaders( CSaveRestoreData * );
|
||||
virtual void WriteSaveHeaders( CSaveRestoreData * ) OVERRIDE;
|
||||
|
||||
virtual void ReadRestoreHeaders( CSaveRestoreData * );
|
||||
virtual void Restore( CSaveRestoreData *, bool );
|
||||
virtual bool IsRestoring();
|
||||
virtual void ReadRestoreHeaders( CSaveRestoreData * ) OVERRIDE;
|
||||
virtual void Restore( CSaveRestoreData *, bool ) OVERRIDE;
|
||||
virtual bool IsRestoring() OVERRIDE;
|
||||
|
||||
// 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 Think( bool finalTick );
|
||||
virtual void PostInit() OVERRIDE;
|
||||
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.
|
||||
// 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_fAutoSaveDangerousMinHealthToCommit;
|
||||
bool m_bIsHibernating;
|
||||
|
||||
// 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
|
||||
virtual void GameServerSteamAPIShutdown( void );
|
||||
virtual void GameServerSteamAPIShutdown( void ) OVERRIDE;
|
||||
|
||||
// interface to the new GC based lobby system
|
||||
virtual IServerGCLobby *GetServerGCLobby() OVERRIDE;
|
||||
@@ -138,6 +138,9 @@ public:
|
||||
virtual const char *GetServerBrowserMapOverride() OVERRIDE;
|
||||
virtual const char *GetServerBrowserGameData() OVERRIDE;
|
||||
|
||||
// Called to add output to the status command
|
||||
virtual void Status( void (*print) (const char *fmt, ...) );
|
||||
|
||||
private:
|
||||
|
||||
// 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 );
|
||||
|
||||
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;
|
||||
// SetFlexTarget( m_flexnum );
|
||||
|
||||
@@ -131,6 +131,7 @@ public:
|
||||
entity.name = m_nameList.AddString( pGlobalname );
|
||||
entity.levelName = m_nameList.AddString( pMapName );
|
||||
entity.state = state;
|
||||
entity.counter = 0;
|
||||
|
||||
int index = GetIndex( m_nameList.String( entity.name ) );
|
||||
if ( index >= 0 )
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user