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

This commit is contained in:
Michael Sartain 2014-10-02 08:25:55 -07:00
parent 56accfdb9c
commit 55ed12f8d1
767 changed files with 119642 additions and 122204 deletions

11
.gitignore vendored
View File

@ -18,20 +18,15 @@ ipch
*.opensdf
*.idb
*.vcxproj
*.vcxproj.filters
*.sln
[Dd]ebug*/
[Rr]elease*/
# OSX/Linux build products
*.DS_Store
*.mak
*.mak.vpc_crc
*.xcodeproj/
obj*/
!devtools/*.mak
!utils/smdlexp/smdlexp.mak
*_osx32*
# Specific Source build products
client.pdb
@ -53,12 +48,6 @@ client.dylib.dSYM/
server.dylib
server.dylib.dSYM/
*.vpc.sentinel
*.vpc_crc
**/generated_proto/**
**/src/utils/sapi51/**
**/game/**/bin/**
# files generated by running a mod
config.cfg

View File

@ -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

View File

@ -1,3 +1 @@
pushd %~dp0
devtools\bin\vpc.exe /hl2mp +everything /mksln everything.sln
popd

View File

@ -1,3 +1 @@
pushd %~dp0
devtools\bin\vpc.exe /hl2mp +game /mksln games.sln
popd

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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++)
ifeq ($(CLANG_BUILD),1)
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
else
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive
endif
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
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
VALVE_BINDIR = /valve/steam-runtime/bin/
endif
GCC_VER =
MARCH_TARGET = pentium4
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
@ -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%!

Binary file not shown.

View File

@ -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,29 +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) );
}
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 )
{
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;
}
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);
@ -3902,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) );
}
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 )
@ -3950,33 +3939,21 @@ void C_BaseAnimating::FireObsoleteEvent( const Vector& origin, const QAngle& ang
// Obsolete. Use the AE_CL_CREATE_PARTICLE_EFFECT event instead, which uses the artist driven particle system & editor.
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) );
}
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 )
{
@ -5281,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 );
}
@ -5294,7 +5272,7 @@ 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;
@ -5302,9 +5280,12 @@ void C_BaseAnimating::ResetSequenceInfo( void )
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
SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) );
if ( pStudioHdr )
{
SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) );
}
}
//=========================================================

View File

@ -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.

View File

@ -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();

View File

@ -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 );

View File

@ -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 );

View File

@ -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.

View File

@ -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
}

View File

@ -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 );

View File

@ -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 );
}

View File

@ -214,11 +214,11 @@ 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 );
if (!CommandLine()->FindParm("-hushasserts"))
{
Assert( m_pScene );
@ -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...

View File

@ -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 )

View File

@ -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 );
}
}
}

View File

@ -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"

View File

@ -213,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 \
@ -227,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 ) ) );
@ -261,8 +263,6 @@ CClientVirtualReality::CClientVirtualReality()
m_rtLastMotionSample = 0;
m_bMotionUpdated = false;
m_bForceVRMode = false;
#if defined( USE_SDL )
m_nNonVRSDLDisplayIndex = 0;
#endif
@ -1367,7 +1367,7 @@ void CClientVirtualReality::Activate()
return;
// These checks don't apply if we're in VR mode because Steam said so.
if ( !m_bForceVRMode )
if ( !ShouldForceVRActive() )
{
// see if VR mode is even enabled
if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 )
@ -1441,7 +1441,7 @@ void CClientVirtualReality::Activate()
vgui::ivgui()->SetVRMode( true );
// we can skip this extra mode change if we've always been in VR mode
if ( !m_bForceVRMode )
if ( !ShouldForceVRActive() )
{
VRRect_t rect;
if ( g_pSourceVR->GetDisplayBounds( &rect ) )
@ -1510,10 +1510,7 @@ void CClientVirtualReality::Deactivate()
// Called when startup is complete
void CClientVirtualReality::StartupComplete()
{
if ( g_pSourceVR )
m_bForceVRMode = g_pSourceVR->ShouldForceVRMode();
if ( vr_activate_default.GetBool( ) || m_bForceVRMode )
if ( vr_activate_default.GetBool() || ShouldForceVRActive() )
Activate();
}

View File

@ -147,7 +147,6 @@ private:
int m_iAlignTorsoAndViewToWeaponCountdown;
bool m_bMotionUpdated;
bool m_bForceVRMode;
RTime32 m_rtLastMotionSample;

View File

@ -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 )
@ -502,4 +570,4 @@ C_BaseEntity* C_BaseEntityIterator::Next()
}
return NULL;
}
}

View File

@ -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;
}

View File

@ -229,12 +229,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 )

View File

@ -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 );

View File

@ -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 )
m_pHTMLMessage->SetVisible( false );
#endif
if ( m_pHTMLMessage )
m_pHTMLMessage->SetVisible( false );
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
}
}

View File

@ -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

View File

@ -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 );

View File

@ -65,6 +65,7 @@ void CHudBaseDeathNotice::Init( void )
ListenForGameEvent( "teamplay_point_captured" );
ListenForGameEvent( "teamplay_capture_blocked" );
ListenForGameEvent( "teamplay_flag_event" );
ListenForGameEvent( "rd_robot_killed" );
}
//-----------------------------------------------------------------------------

View File

@ -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 );

View File

@ -983,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 ) );
@ -1021,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;

View File

@ -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;

View File

@ -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();

View File

@ -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"
@ -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;

View File

@ -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 );
}
}
}
//-----------------------------------------------------------------------------

View File

@ -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

View File

@ -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 );

View File

@ -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 );
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;
}
//-----------------------------------------------------------------------------

View File

@ -84,8 +84,10 @@ private:
Q_strncpy( value, str, sizeof( value ) );
}
}
CUtlSymbol criterianame;
// We use CUtlRBTree CopyFrom() in ctor, so CritEntry_t must be POD. If you add
// CUtlString or something then you must change AI_CriteriaSet copy ctor.
CUtlSymbol criterianame;
char value[ 64 ];
float weight;
};
@ -178,10 +180,10 @@ public:
~AI_Response();
AI_Response &operator=( const AI_Response &from );
void Release();
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;
};

View File

@ -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;

View File

@ -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;
}

View File

@ -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 );
}

View File

@ -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,7 +7950,9 @@ 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() );
}

View File

@ -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 );

View File

@ -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() )
{

View File

@ -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)
{

View File

@ -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 );
//-----------------------------------------------------------------------------

View File

@ -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 } };
//---------------------------------

View File

@ -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) ) )

View File

@ -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;

View File

@ -248,21 +248,9 @@ 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;
EHANDLE hSpeechTarget;
std::string concept;
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(); }

View File

@ -38,10 +38,7 @@ CAI_TimedSemaphore g_AIFoesTalkSemaphore;
ConceptHistory_t::~ConceptHistory_t()
{
if ( response )
{
delete response;
}
delete response;
response = NULL;
}
@ -57,14 +54,16 @@ ConceptHistory_t::ConceptHistory_t( const ConceptHistory_t& src )
ConceptHistory_t& ConceptHistory_t::operator =( const ConceptHistory_t& src )
{
if ( this == &src )
return *this;
timeSpoken = src.timeSpoken;
response = NULL;
if ( src.response )
if ( this != &src )
{
response = new AI_Response( *src.response );
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 )
{
@ -151,7 +150,7 @@ public:
}
}
}
virtual void MakeEmpty( const SaveRestoreFieldInfo_t &fieldInfo )
{
}
@ -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,63 +376,52 @@ 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 ( !response.ShouldntUseScene() )
{
if ( !result->ShouldntUseScene() )
{
// This generates a fake CChoreoScene wrapping the sound.txt name
spoke = SpeakAutoGeneratedScene( response, delay );
}
else
{
float speakTime = GetResponseDuration( result );
GetOuter()->EmitSound( response );
// This generates a fake CChoreoScene wrapping the sound.txt name
spoke = SpeakAutoGeneratedScene( szResponse, delay );
}
else
{
float speakTime = GetResponseDuration( response );
GetOuter()->EmitSound( szResponse );
DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) playing sound '%s'\n", GetOuter()->entindex(), STRING( GetOuter()->GetEntityName() ), response );
NoteSpeaking( speakTime, delay );
spoke = true;
}
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 );
}
// This should have been recursively resolved already
Assert( 0 );
break;
case RESPONSE_PRINT:
if ( g_pDeveloper->GetInt() > 0 )
{
if ( g_pDeveloper->GetInt() > 0 )
{
Vector vPrintPos;
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
NDebugOverlay::Text( vPrintPos, response, true, 1.5 );
spoke = true;
}
Vector vPrintPos;
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
NDebugOverlay::Text( vPrintPos, szResponse, true, 1.5 );
spoke = true;
}
break;
}
@ -468,30 +429,27 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
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,44 +460,33 @@ 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;
Assert( 0 );
return 999.0f;
case RESPONSE_SCENE:
{
return GetSceneDuration( response );
}
break;
return GetSceneDuration( szResponse );
case RESPONSE_RESPONSE:
{
// This should have been recursively resolved already
Assert( 0 );
}
// This should have been recursively resolved already
Assert( 0 );
break;
case RESPONSE_PRINT:
{
return 1.0;
}
break;
return 1.0;
}
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 );
}

View File

@ -135,7 +135,7 @@ struct ConceptHistory_t
ConceptHistory_t& operator = ( const ConceptHistory_t& src );
~ConceptHistory_t();
float timeSpoken;
AI_Response *response;
};
@ -159,9 +159,9 @@ public:
bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
// 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 );
}

View File

@ -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 );
}
}

View File

@ -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.

View File

@ -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 );

View File

@ -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] );
}
//-----------------------------------------------------------------------------

View File

@ -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 );

View File

@ -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 );

View File

@ -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 )
{

View File

@ -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

View File

@ -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;

View File

@ -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 );

View File

@ -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(),

View File

@ -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();

View File

@ -1927,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
//-----------------------------------------------------------------------------
@ -3332,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

View File

@ -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

View File

@ -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 );

View File

@ -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 )

View File

@ -143,23 +143,23 @@ struct citizen_expression_list_t
// Scared
citizen_expression_list_t ScaredExpressions[STATES_WITH_EXPRESSIONS] =
{
{ "scenes/Expressions/citizen_scared_idle_01.vcd" },
{ "scenes/Expressions/citizen_scared_alert_01.vcd" },
{ "scenes/Expressions/citizen_scared_combat_01.vcd" },
{ { "scenes/Expressions/citizen_scared_idle_01.vcd" } },
{ { "scenes/Expressions/citizen_scared_alert_01.vcd" } },
{ { "scenes/Expressions/citizen_scared_combat_01.vcd" } },
};
// Normal
citizen_expression_list_t NormalExpressions[STATES_WITH_EXPRESSIONS] =
{
{ "scenes/Expressions/citizen_normal_idle_01.vcd" },
{ "scenes/Expressions/citizen_normal_alert_01.vcd" },
{ "scenes/Expressions/citizen_normal_combat_01.vcd" },
{ { "scenes/Expressions/citizen_normal_idle_01.vcd" } },
{ { "scenes/Expressions/citizen_normal_alert_01.vcd" } },
{ { "scenes/Expressions/citizen_normal_combat_01.vcd" } },
};
// Angry
citizen_expression_list_t AngryExpressions[STATES_WITH_EXPRESSIONS] =
{
{ "scenes/Expressions/citizen_angry_idle_01.vcd" },
{ "scenes/Expressions/citizen_angry_alert_01.vcd" },
{ "scenes/Expressions/citizen_angry_combat_01.vcd" },
{ { "scenes/Expressions/citizen_angry_idle_01.vcd" } },
{ { "scenes/Expressions/citizen_angry_alert_01.vcd" } },
{ { "scenes/Expressions/citizen_angry_combat_01.vcd" } },
};
//-----------------------------------------------------------------------------
@ -4197,8 +4197,6 @@ void CNPC_Citizen::AddInsignia()
void CNPC_Citizen::RemoveInsignia()
{
// This is crap right now.
CBaseEntity *FirstEnt();
CBaseEntity *pEntity = gEntList.FirstEnt();
while( pEntity )

View File

@ -1675,7 +1675,7 @@ float CNPC_MetroPolice::AimBurstAtReactionTime( float flReactionTime, float flDi
#define AIM_AT_SHOT_SPEED_COUNT 6
#define AIM_AT_SHOT_DIST_COUNT 6
static int s_pShotCountFraction[AIM_AT_TIME_DIST_COUNT][AIM_AT_TIME_SPEED_COUNT] =
static float s_pShotCountFraction[AIM_AT_TIME_DIST_COUNT][AIM_AT_TIME_SPEED_COUNT] =
{
{ 3.0f, 3.0f, 2.5f, 1.5f, 1.0f, 0.0f },
{ 3.0f, 3.0f, 2.5f, 1.25f, 0.5f, 0.0f },

View File

@ -1988,7 +1988,7 @@ void CNPC_CScanner::BlindFlashTarget( CBaseEntity *pTarget )
if ( tr.startsolid == false && tr.fraction == 1.0)
{
color32 white = { 255, 255, 255, SCANNER_FLASH_MAX_VALUE * dotPr };
color32 white = { 255, 255, 255, (byte)(SCANNER_FLASH_MAX_VALUE * dotPr) };
if ( ( g_pMaterialSystemHardwareConfig != NULL ) && ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE ) )
{

View File

@ -23,6 +23,7 @@ public:
// Called during player movement to set up/restore after lag compensation
virtual void StartLagCompensation( CBasePlayer *player, CUserCmd *cmd ) = 0;
virtual void FinishLagCompensation( CBasePlayer *player ) = 0;
virtual bool IsCurrentlyDoingLagCompensation() const = 0;
};
extern ILagCompensationManager *lagcompensation;

View File

@ -191,7 +191,7 @@ void CFuncBrush::TurnOn( void )
}
bool CFuncBrush::IsOn( void )
bool CFuncBrush::IsOn( void ) const
{
return !IsEffectActive( EF_NODRAW );
}

View File

@ -18,7 +18,7 @@
//-----------------------------------------------------------------------------
// Purpose: basic solid geometry
// enabled state: brush is visible
// disabled staute: brush not visible
// disabled state: brush not visible
//-----------------------------------------------------------------------------
class CFuncBrush : public CBaseEntity
{
@ -32,8 +32,8 @@ public:
virtual int DrawDebugTextOverlays( void );
void TurnOff( void );
void TurnOn( void );
virtual void TurnOff( void );
virtual void TurnOn( void );
// Input handlers
void InputTurnOff( inputdata_t &inputdata );
@ -56,7 +56,7 @@ public:
DECLARE_DATADESC();
virtual bool IsOn( void );
virtual bool IsOn( void ) const;
};

View File

@ -334,11 +334,11 @@ inline void DirectionToVector2D( NavDirType dir, Vector2D *v )
{
switch( dir )
{
default: Assert(0);
case NORTH: v->x = 0.0f; v->y = -1.0f; break;
case SOUTH: v->x = 0.0f; v->y = 1.0f; break;
case EAST: v->x = 1.0f; v->y = 0.0f; break;
case WEST: v->x = -1.0f; v->y = 0.0f; break;
default: break;
}
}
@ -348,11 +348,11 @@ inline void CornerToVector2D( NavCornerType dir, Vector2D *v )
{
switch( dir )
{
default: Assert(0);
case NORTH_WEST: v->x = -1.0f; v->y = -1.0f; break;
case NORTH_EAST: v->x = 1.0f; v->y = -1.0f; break;
case SOUTH_EAST: v->x = 1.0f; v->y = 1.0f; break;
case SOUTH_WEST: v->x = -1.0f; v->y = 1.0f; break;
default: break;
}
v->NormalizeInPlace();
@ -365,6 +365,8 @@ inline void GetCornerTypesInDirection( NavDirType dir, NavCornerType *first, Nav
{
switch ( dir )
{
default:
Assert(0);
case NORTH:
*first = NORTH_WEST;
*second = NORTH_EAST;
@ -381,8 +383,6 @@ inline void GetCornerTypesInDirection( NavDirType dir, NavCornerType *first, Nav
*first = NORTH_WEST;
*second = SOUTH_WEST;
break;
default:
break;
}
}

View File

@ -192,6 +192,8 @@ CNavArea::CNavArea( void )
m_avoidanceObstacleHeight = 0.0f;
m_totalCost = 0.0f;
m_costSoFar = 0.0f;
m_pathLengthSoFar = 0.0f;
ResetNodes();
@ -244,6 +246,8 @@ CNavArea::CNavArea( void )
m_isInheritedFrom = false;
m_funcNavCostVector.RemoveAll();
m_nVisTestCounter = (uint32)-1;
}
//--------------------------------------------------------------------------------------------------------------
@ -3381,16 +3385,10 @@ void CNavArea::AddToOpenList( void )
}
// insert self in ascending cost order
// Since costs are positive, IEEE754 let's us compare as integers (see http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm)
CNavArea *area, *last = NULL;
int thisCostBits = *reinterpret_cast<const int *>(&m_totalCost);
Assert ( m_totalCost >= 0.0f );
for( area = m_openList; area; area = area->m_nextOpen )
{
Assert ( area->GetTotalCost() >= 0.0f );
int thoseCostBits = *reinterpret_cast<const int *>(&area->m_totalCost);
if ( thisCostBits < thoseCostBits )
if ( GetTotalCost() < area->GetTotalCost() )
{
break;
}
@ -5630,7 +5628,7 @@ void CNavArea::ComputeVisibilityToMesh( void )
/**
* The center and all four corners must ALL be visible
*/
bool CNavArea::IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore ) const
bool CNavArea::IsEntirelyVisible( const Vector &eye, const CBaseEntity *ignore ) const
{
Vector corner;
trace_t result;
@ -5663,7 +5661,7 @@ bool CNavArea::IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore ) const
/**
* The center or any of the four corners may be visible
*/
bool CNavArea::IsPartiallyVisible( const Vector &eye, CBaseEntity *ignore ) const
bool CNavArea::IsPartiallyVisible( const Vector &eye, const CBaseEntity *ignore ) const
{
Vector corner;
trace_t result;

View File

@ -18,6 +18,15 @@
// BOTPORT: Clean up relationship between team index and danger storage in nav areas
enum { MAX_NAV_TEAMS = 2 };
#ifdef STAGING_ONLY
inline void DebuggerBreakOnNaN_StagingOnly( float val )
{
if ( IS_NAN( val ) )
DebuggerBreak();
}
#else
#define DebuggerBreakOnNaN_StagingOnly( _val )
#endif
class CFuncElevator;
class CFuncNavPrerequisite;
@ -445,14 +454,14 @@ public:
static void ClearSearchLists( void ); // clears the open and closed lists for a new search
void SetTotalCost( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_totalCost = value; }
float GetTotalCost( void ) const { return m_totalCost; }
void SetTotalCost( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_totalCost = value; }
float GetTotalCost( void ) const { DebuggerBreakOnNaN_StagingOnly( m_totalCost ); return m_totalCost; }
void SetCostSoFar( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_costSoFar = value; }
float GetCostSoFar( void ) const { return m_costSoFar; }
void SetCostSoFar( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_costSoFar = value; }
float GetCostSoFar( void ) const { DebuggerBreakOnNaN_StagingOnly( m_costSoFar ); return m_costSoFar; }
void SetPathLengthSoFar( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_pathLengthSoFar = value; }
float GetPathLengthSoFar( void ) const { return m_pathLengthSoFar; }
void SetPathLengthSoFar( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_pathLengthSoFar = value; }
float GetPathLengthSoFar( void ) const { DebuggerBreakOnNaN_StagingOnly( m_pathLengthSoFar ); return m_pathLengthSoFar; }
//- editing -----------------------------------------------------------------------------------------
virtual void Draw( void ) const; // draw area for debugging & editing
@ -515,8 +524,8 @@ public:
}
};
virtual bool IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore = NULL ) const; // return true if entire area is visible from given eyepoint (CPU intensive)
virtual bool IsPartiallyVisible( const Vector &eye, CBaseEntity *ignore = NULL ) const; // return true if any portion of the area is visible from given eyepoint (CPU intensive)
virtual bool IsEntirelyVisible( const Vector &eye, const CBaseEntity *ignore = NULL ) const; // return true if entire area is visible from given eyepoint (CPU intensive)
virtual bool IsPartiallyVisible( const Vector &eye, const CBaseEntity *ignore = NULL ) const; // return true if any portion of the area is visible from given eyepoint (CPU intensive)
virtual bool IsPotentiallyVisible( const CNavArea *area ) const; // return true if given area is potentially visible from somewhere in this area (very fast)
virtual bool IsPotentiallyVisibleToTeam( int team ) const; // return true if any portion of this area is visible to anyone on the given team (very fast)

View File

@ -1809,6 +1809,8 @@ void CNavMesh::StitchAreaIntoMesh( CNavArea *area, NavDirType dir, Functor &func
Vector corner1, corner2;
switch ( dir )
{
default:
Assert(0);
case NORTH:
corner1 = area->GetCorner( NORTH_WEST );
corner2 = area->GetCorner( NORTH_EAST );

View File

@ -49,7 +49,9 @@ ConVar nav_max_vis_delta_list_length( "nav_max_vis_delta_list_length", "64", FCV
extern ConVar nav_show_potentially_visible;
#ifdef STAGING_ONLY
int g_DebugPathfindCounter = 0;
#endif
bool FindGroundForNode( Vector *pos, Vector *normal );

View File

@ -1259,8 +1259,10 @@ extern CNavMesh *TheNavMesh;
// factory for creating the Navigation Mesh
extern CNavMesh *NavMeshFactory( void );
#ifdef STAGING_ONLY
// for debugging the A* algorithm, if nonzero, show debug display and decrement for each pathfind
extern int g_DebugPathfindCounter;
#endif
//--------------------------------------------------------------------------------------------------------------

View File

@ -16,7 +16,9 @@
#include "mathlib/ssemath.h"
#include "nav_area.h"
#ifdef STAGING_ONLY
extern int g_DebugPathfindCounter;
#endif
//-------------------------------------------------------------------------------------------------------------------
@ -108,7 +110,9 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
*closestArea = startArea;
}
#ifdef STAGING_ONLY
bool isDebug = ( g_DebugPathfindCounter-- > 0 );
#endif
if (startArea == NULL)
return false;
@ -154,10 +158,12 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
// get next area to check
CNavArea *area = CNavArea::PopOpenList();
#ifdef STAGING_ONLY
if ( isDebug )
{
area->DrawFilled( 0, 255, 0, 128, 30.0f );
}
#endif
// don't consider blocked areas
if ( area->IsBlocked( teamID, ignoreNavBlockers ) )
@ -339,7 +345,13 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
continue;
float newCostSoFar = costFunc( newArea, area, ladder, elevator, length );
// NaNs really mess this function up causing tough to track down hangs. If
// we get inf back, clamp it down to a really high number.
DebuggerBreakOnNaN_StagingOnly( newCostSoFar );
if ( IS_NAN( newCostSoFar ) )
newCostSoFar = 1e30f;
// check if cost functor says this area is a dead-end
if ( newCostSoFar < 0.0f )
continue;
@ -352,7 +364,7 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
// Make sure that any jump to a new area incurs some pathfinsing
// cost, to avoid us spinning our wheels over insignificant cost
// benefit, floating point precision bug, or busted cost functor.
float minNewCostSoFar = area->GetCostSoFar() * 1.00001 + 0.00001;
float minNewCostSoFar = area->GetCostSoFar() * 1.00001f + 0.00001f;
newCostSoFar = Max( newCostSoFar, minNewCostSoFar );
// stop if path length limit reached

View File

@ -24,7 +24,7 @@ class CStringTableSaveRestoreOps;
#define MAX_MATERIAL_STRINGS ( 1 << MAX_MATERIAL_STRING_BITS )
#define OVERLAY_MATERIAL_INVALID_STRING ( MAX_MATERIAL_STRINGS - 1 )
#define MAX_CHOREO_SCENES_STRING_BITS 12
#define MAX_CHOREO_SCENES_STRING_BITS 13
#define MAX_CHOREO_SCENES_STRINGS ( 1 << MAX_CHOREO_SCENES_STRING_BITS )
#define CHOREO_SCENES_INVALID_STRING ( MAX_CHOREO_SCENES_STRINGS - 1 )

View File

@ -742,7 +742,9 @@ void CPhysicsPushedEntities::GenerateBlockingEntityListAddBox( const Vector &vec
}
}
#ifdef TF_DLL
#include "tf_logic_robot_destruction.h"
#endif
//-----------------------------------------------------------------------------
// Purpose: Gets a list of all entities hierarchically attached to the root
//-----------------------------------------------------------------------------
@ -1841,7 +1843,9 @@ void CBaseEntity::PhysicsStepRunTimestep( float timestep )
{
bool wasonground;
bool inwater;
#if 0
bool hitsound = false;
#endif
float speed, newspeed, control;
float friction;
@ -1862,10 +1866,12 @@ void CBaseEntity::PhysicsStepRunTimestep( float timestep )
{
if ( !( ( GetFlags() & FL_SWIM ) && ( GetWaterLevel() > 0 ) ) )
{
#if 0
if ( GetAbsVelocity()[2] < ( GetCurrentGravity() * -0.1 ) )
{
hitsound = true;
}
#endif
if ( !inwater )
{

View File

@ -635,6 +635,8 @@ CBasePlayer::CBasePlayer( )
m_flLastUserCommandTime = 0.f;
m_flMovementTimeForUserCmdProcessingRemaining = 0.0f;
m_flLastObjectiveTime = -1.f;
}
CBasePlayer::~CBasePlayer( )
@ -2473,6 +2475,7 @@ void CBasePlayer::ValidateCurrentObserverTarget( void )
}
else
{
#if !defined( TF_DLL )
// couldn't find new target, switch to temporary mode
if ( mp_forcecamera.GetInt() == OBS_ALLOW_ALL )
{
@ -2480,10 +2483,11 @@ void CBasePlayer::ValidateCurrentObserverTarget( void )
ForceObserverMode( OBS_MODE_ROAMING );
}
else
#endif
{
// fix player view right where it is
ForceObserverMode( OBS_MODE_FIXED );
m_hObserverTarget.Set( NULL ); // no traget to follow
m_hObserverTarget.Set( NULL ); // no target to follow
}
}
}
@ -7379,7 +7383,7 @@ void CBasePlayer::EquipWearable( CEconWearable *pItem )
pItem->Equip( this );
}
#ifdef DEBUG
#ifdef DBGFLAG_ASSERT
// Double check list integrity.
for ( int i = m_hMyWearables.Count()-1; i >= 0; --i )
{
@ -7418,7 +7422,7 @@ void CBasePlayer::RemoveWearable( CEconWearable *pItem )
}
}
#ifdef DEBUG
#ifdef DBGFLAG_ASSERT
// Double check list integrity.
for ( int i = m_hMyWearables.Count()-1; i >= 0; --i )
{
@ -8853,6 +8857,8 @@ void CBasePlayer::SetPlayerName( const char *name )
Assert( strlen(name) > 0 );
Q_strncpy( m_szNetname, name, sizeof(m_szNetname) );
// Be extra thorough
Q_RemoveAllEvilCharacters( m_szNetname );
}
}
@ -8947,8 +8953,27 @@ void CBasePlayer::HandleAnimEvent( animevent_t *pEvent )
BaseClass::HandleAnimEvent( pEvent );
}
//-----------------------------------------------------------------------------
// CPlayerInfo functions (simple passthroughts to get around the CBasePlayer multiple inheritence limitation)
// Purpose:
//-----------------------------------------------------------------------------
bool CBasePlayer::ShouldAnnounceAchievement( void )
{
m_flAchievementTimes.AddToTail( gpGlobals->curtime );
if ( m_flAchievementTimes.Count() > 3 )
{
m_flAchievementTimes.Remove( 0 );
if ( m_flAchievementTimes.Tail() - m_flAchievementTimes.Head() <= 60.0 )
{
return false;
}
}
return true;
}
//-----------------------------------------------------------------------------
// CPlayerInfo functions (simple pass-through to get around the CBasePlayer multiple inheritance limitation)
//-----------------------------------------------------------------------------
const char *CPlayerInfo::GetName()
{

View File

@ -612,7 +612,7 @@ public:
virtual void HandleAnimEvent( animevent_t *pEvent );
virtual bool ShouldAnnounceAchievement( void ){ return true; }
virtual bool ShouldAnnounceAchievement( void );
#if defined USES_ECON_ITEMS
// Wearables
@ -820,7 +820,9 @@ private:
public:
// How long since this player last interacted with something the game considers an objective/target/goal
float GetTimeSinceLastObjective( void ) const { return ( m_flLastObjectiveTime == -1.f ) ? 999.f : gpGlobals->curtime - m_flLastObjectiveTime; }
void SetLastObjectiveTime( float flTime ) { m_flLastObjectiveTime = flTime; }
// Used by gamemovement to check if the entity is stuck.
int m_StuckLast;
@ -895,6 +897,7 @@ public:
private:
Activity m_Activity;
float m_flLastObjectiveTime; // Last curtime player touched/killed something the gamemode considers an objective
protected:
@ -1210,6 +1213,9 @@ private:
// Store the last time we successfully processed a usercommand
float m_flLastUserCommandTime;
// used to prevent achievement announcement spam
CUtlVector< float > m_flAchievementTimes;
public:
virtual unsigned int PlayerSolidMask( bool brushOnly = false ) const; // returns the solid mask for the given player, so bots can have a more-restrictive set

View File

@ -172,6 +172,7 @@ class CLagCompensationManager : public CAutoGameSystemPerFrame, public ILagCompe
public:
CLagCompensationManager( char const *name ) : CAutoGameSystemPerFrame( name ), m_flTeleportDistanceSqr( 64 *64 )
{
m_isCurrentlyDoingCompensation = false;
}
// IServerSystem stuff
@ -194,6 +195,8 @@ public:
void StartLagCompensation( CBasePlayer *player, CUserCmd *cmd );
void FinishLagCompensation( CBasePlayer *player );
bool IsCurrentlyDoingLagCompensation() const OVERRIDE { return m_isCurrentlyDoingCompensation; }
private:
void BacktrackPlayer( CBasePlayer *player, float flTargetTime );
@ -216,6 +219,8 @@ private:
CBasePlayer *m_pCurrentPlayer; // The player we are doing lag compensation for
float m_flTeleportDistanceSqr;
bool m_isCurrentlyDoingCompensation; // Sentinel to prevent calling StartLagCompensation a second time before a Finish.
};
static CLagCompensationManager g_LagCompensationManager( "CLagCompensationManager" );
@ -322,6 +327,8 @@ void CLagCompensationManager::FrameUpdatePostEntityThink()
// Called during player movement to set up/restore after lag compensation
void CLagCompensationManager::StartLagCompensation( CBasePlayer *player, CUserCmd *cmd )
{
Assert( !m_isCurrentlyDoingCompensation );
//DONT LAG COMP AGAIN THIS FRAME IF THERES ALREADY ONE IN PROGRESS
//IF YOU'RE HITTING THIS THEN IT MEANS THERES A CODE BUG
if ( m_pCurrentPlayer )
@ -350,6 +357,8 @@ void CLagCompensationManager::StartLagCompensation( CBasePlayer *player, CUserCm
Q_memset( m_RestoreData, 0, sizeof( m_RestoreData ) );
Q_memset( m_ChangeData, 0, sizeof( m_ChangeData ) );
m_isCurrentlyDoingCompensation = true;
// Get true latency
// correct is the amout of time we have to correct game time
@ -734,7 +743,10 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer *player )
m_pCurrentPlayer = NULL;
if ( !m_bNeedToRestore )
{
m_isCurrentlyDoingCompensation = false;
return; // no player was changed at all
}
// Iterate all active players
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
@ -828,6 +840,8 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer *player )
pPlayer->SetSimulationTime( restore->m_flSimulationTime );
}
}
m_isCurrentlyDoingCompensation = false;
}

View File

@ -98,7 +98,7 @@ void CRecipientFilter::AddAllPlayers( void )
}
}
void CRecipientFilter::AddRecipient( CBasePlayer *player )
void CRecipientFilter::AddRecipient( const CBasePlayer *player )
{
Assert( player );

View File

@ -46,7 +46,7 @@ public:
void AddRecipientsByPVS( const Vector& origin );
void RemoveRecipientsByPVS( const Vector& origin );
void AddRecipientsByPAS( const Vector& origin );
void AddRecipient( CBasePlayer *player );
void AddRecipient( const CBasePlayer *player );
void RemoveAllRecipients( void );
void RemoveRecipient( CBasePlayer *player );
void RemoveRecipientByPlayerIndex( int playerindex );
@ -82,7 +82,7 @@ private:
class CSingleUserRecipientFilter : public CRecipientFilter
{
public:
CSingleUserRecipientFilter( CBasePlayer *player )
CSingleUserRecipientFilter( const CBasePlayer *player )
{
AddRecipient( player );
}

View File

@ -2163,11 +2163,6 @@ void CSceneEntity::InputTriggerEvent( inputdata_t &inputdata )
}
}
struct NPCInterjection
{
AI_Response *response;
CAI_BaseActor *npc;
};
//-----------------------------------------------------------------------------
// Purpose:
// Input : &inputdata -
@ -2176,93 +2171,62 @@ void CSceneEntity::InputInterjectResponse( inputdata_t &inputdata )
{
// Not currently playing a scene
if ( !m_pScene )
{
return;
}
CUtlVector< CAI_BaseActor * > candidates;
int i;
for ( i = 0 ; i < m_pScene->GetNumActors(); i++ )
CUtlVector<CAI_BaseActor *> candidates;
for ( int i = 0 ; i < m_pScene->GetNumActors(); i++ )
{
CBaseFlex *pTestActor = FindNamedActor( i );
if ( !pTestActor )
continue;
CAI_BaseActor *pBaseActor = dynamic_cast<CAI_BaseActor*>(pTestActor);
if ( !pBaseActor )
continue;
if ( !pBaseActor->IsAlive() )
CAI_BaseActor *pBaseActor = dynamic_cast<CAI_BaseActor *>(pTestActor);
if ( !pBaseActor || !pBaseActor->IsAlive() )
continue;
candidates.AddToTail( pBaseActor );
}
int c = candidates.Count();
if ( !c )
{
return;
}
int useIndex = 0;
if ( !m_bIsPlayingBack )
{
// Use any actor if not playing a scene
useIndex = RandomInt( 0, c - 1 );
// int useIndex = RandomInt( 0, c - 1 );
Assert( !"m_bIsPlayBack is false and this code does nothing. Should it?");
}
else
{
CUtlVector< NPCInterjection > validResponses;
CUtlString modifiers("scene:");
modifiers += STRING( GetEntityName() );
char modifiers[ 512 ];
Q_snprintf( modifiers, sizeof( modifiers ), "scene:%s", STRING( GetEntityName() ) );
for ( int i = 0; i < c; i++ )
while (candidates.Count() > 0)
{
CAI_BaseActor *npc = candidates[ i ];
Assert( npc );
// Pick a random slot in the candidates array.
int slot = RandomInt( 0, candidates.Count() - 1 );
AI_Response *response = npc->SpeakFindResponse( inputdata.value.String(), modifiers );
if ( !response )
continue;
CAI_BaseActor *npc = candidates[ slot ];
float duration = npc->GetResponseDuration( response );
// Couldn't look it up
if ( duration <= 0.0f )
continue;
if ( !npc->PermitResponse( duration ) )
// Try to find the response for this slot.
AI_Response response;
bool result = npc->SpeakFindResponse( response, inputdata.value.String(), modifiers.Get() );
if ( result )
{
delete response;
continue;
}
float duration = npc->GetResponseDuration( response );
//
NPCInterjection inter;
inter.response = response;
inter.npc = npc;
validResponses.AddToTail( inter );
}
int rcount = validResponses.Count();
if ( rcount >= 1 )
{
int slot = RandomInt( 0, rcount - 1 );
for ( int i = 0; i < rcount; i++ )
{
NPCInterjection *pInterjection = &validResponses[ i ];
if ( i == slot )
if ( ( duration > 0.0f ) && npc->PermitResponse( duration ) )
{
pInterjection->npc->SpeakDispatchResponse( inputdata.value.String(), pInterjection->response );
}
else
{
delete pInterjection->response;
// If we could look it up, dispatch it and bail.
npc->SpeakDispatchResponse( inputdata.value.String(), response );
return;
}
}
// Remove this entry and look for another one.
candidates.FastRemove(slot);
}
}
}
@ -2783,12 +2747,12 @@ void CSceneEntity::QueueResumePlayback( void )
CAI_BaseActor *pBaseActor = dynamic_cast<CAI_BaseActor*>(pActor);
if ( pBaseActor )
{
AI_Response *result = pBaseActor->SpeakFindResponse( STRING(m_iszResumeSceneFile), NULL );
AI_Response response;
bool result = pBaseActor->SpeakFindResponse( response, STRING(m_iszResumeSceneFile), NULL );
if ( result )
{
char response[ 256 ];
result->GetResponse( response, sizeof( response ) );
bStartedScene = InstancedScriptedScene( NULL, response, &m_hWaitingForThisResumeScene, 0, false ) != 0;
const char *szResponse = response.GetResponsePtr();
bStartedScene = InstancedScriptedScene( NULL, szResponse, &m_hWaitingForThisResumeScene, 0, false ) != 0;
}
}
}

View File

@ -27,7 +27,7 @@ void SendProxy_EHandleToInt( const SendProp *pProp, const void *pStruct, const v
if ( pHandle && pHandle->Get() )
{
int iSerialNum = pHandle->GetSerialNumber() & (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1;
int iSerialNum = pHandle->GetSerialNumber() & ( (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1 );
pOut->m_Int = pHandle->GetEntryIndex() | (iSerialNum << MAX_EDICT_BITS);
}
else
@ -106,6 +106,7 @@ REGISTER_SEND_PROXY_NON_MODIFIED_POINTER( SendProxy_OnlyToTeam );
#define TIME_BITS 24
// This table encodes edict data.
#if 0
static void SendProxy_Time( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID )
{
float clock_base = floor( gpGlobals->curtime );
@ -119,6 +120,7 @@ static void SendProxy_Time( const SendProp *pProp, const void *pStruct, const vo
pOut->m_Int = addt;
}
#endif
//-----------------------------------------------------------------------------
// Purpose:

View File

@ -1187,7 +1187,7 @@ int SENTENCEG_PlayRndI(edict_t *entity, int isentenceg,
name[0] = 0;
ipick = engine->SentenceGroupPick( isentenceg, name, sizeof( name ) );
if (ipick > 0 && name)
if ( ( ipick > 0 ) && name[0] )
{
int sentenceIndex = SENTENCEG_Lookup( name );
CPASAttenuationFilter filter( GetContainingEntity( entity ), soundlevel );

View File

@ -1267,7 +1267,7 @@ float CTeamControlPointMaster::GetPartialCapturePointRate( void )
return m_flPartialCapturePointsRate;
}
/*
#ifdef STAGING_ONLY
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@ -1344,4 +1344,4 @@ void cc_PlayRound( const CCommand& args )
}
static ConCommand playround( "playround", cc_PlayRound, "Play the selected round\n\tArgument: {round name given by \"listrounds\" command}", FCVAR_CHEAT );
*/
#endif

View File

@ -121,14 +121,18 @@ public:
bool ShouldScorePerCapture( void ){ return m_bScorePerCapture; }
bool ShouldPlayAllControlPointRounds( void ){ return m_bPlayAllRounds; }
int NumPlayableControlPointRounds( void ); // checks to see if there are any more rounds to play (but doesn't actually "get" one to play)
// void ListRounds( void );
#ifdef STAGING_ONLY
void ListRounds( void );
#endif
float GetPartialCapturePointRate( void );
void SetLastOwnershipChangeTime( float m_flTime ) { m_flLastOwnershipChangeTime = m_flTime; }
float GetLastOwnershipChangeTime( void ) { return m_flLastOwnershipChangeTime; }
int GetCurrentRoundIndex() { return m_iCurrentRoundIndex; }
private:
void EXPORT CPMThink( void );

View File

@ -73,6 +73,7 @@ BEGIN_DATADESC( CTeamTrainWatcher )
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetSpeedForwardModifier", InputSetSpeedForwardModifier ),
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetTrainRecedeTime", InputSetTrainRecedeTime ),
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetTrainCanRecede", InputSetTrainCanRecede ),
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetTrainRecedeTimeAndUpdate", InputSetTrainRecedeTimeAndUpdate ),
// Outputs
DEFINE_OUTPUT( m_OnTrainStartRecede, "OnTrainStartRecede" ),
@ -714,6 +715,24 @@ void CTeamTrainWatcher::InputSetTrainRecedeTime( inputdata_t &inputdata )
}
}
void CTeamTrainWatcher::InputSetTrainRecedeTimeAndUpdate(inputdata_t &inputdata)
{
InputSetTrainRecedeTime( inputdata );
// update our time if we're already counting down
if ( m_flRecedeTime > 0 )
{
m_flRecedeTotalTime = tf_escort_recede_time.GetFloat();
if ( m_nTrainRecedeTime > 0 )
{
m_flRecedeTotalTime = m_nTrainRecedeTime;
}
m_flRecedeStartTime = gpGlobals->curtime;
m_flRecedeTime = m_flRecedeStartTime + m_flRecedeTotalTime;
}
}
void CTeamTrainWatcher::InputSetTrainCanRecede( inputdata_t &inputdata )
{
m_bTrainCanRecede = inputdata.value.Bool();

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