diff --git a/README.md b/README.md index a6d199a5..3c668d6a 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,26 @@ You can find Source 2013 CE's roadmap by going to our [Trello board](https://tre And you can also give us suggestions for fixes and features that you'd like to see in our Discord channel (`#source-SDK-2013-ce`) found in the Source Modding Community server, which you can join [here](https://discord.gg/BD6WpY5). -# Requirements -To be able to use Source 2013 CE you will need to download: -* Visual Studio 2019 -* Multibyte MFC Library for Visual Studio 2019 -* Windows SDK 10.0.22000.0 +# Building Guide + +## Windows +1. Install dependencies Visual Studio 2019 or higher, Multibyte MFC Library, Windows SDK 10.0.22000.0 +2. Navigate to `[SDK_ROOT]/[GAME]/src` and run `./createallprojects` or `./creategameprojects` +3. Open Everything.sln or Game.sln and right click on Everything or Game, then select Build Solution + +## Linux (Debian) +1. Install dependencies `sudo apt-get install build-essential gcc-multilib g++-multilib` +2. Download Valve's [Steam Runtime repo](https://github.com/ValveSoftware/steam-runtime) +3. Go into the steam-runtime directory and run: +```sh +./setup_chroot.sh --i386 +``` +4. Run the following commands: +```sh +cd [SDK_ROOT]/[GAME]/src +[SCRIPT] +sudo schroot --chroot steamrt_scout_i386 -- make -f [MAKEFILE].mak +``` # Contributing We appreciate any form of help so ideally if you want to help this project out the best way would be to make a pull request. @@ -27,5 +42,6 @@ Thank you for trying out this project we hope we will help you out with your Sou Made with :heart: by [@Nbc66](https://github.com/Nbc66) & [@GamerDude27](https://github.com/GamerDude27) -Credits for 2019 support: momentum mod, Brae, and Anthonypython +Credits for Linux support: Momentum Mod +Credits for 2019 support: Momentum Mod, Brae, and Anthonypython Credits for CI: TF2Vintage, Deathreus, Dio, Anthonypython diff --git a/sp/src/devtools/makefile_base_posix.mak b/sp/src/devtools/makefile_base_posix.mak index 7300f402..eac66898 100644 --- a/sp/src/devtools/makefile_base_posix.mak +++ b/sp/src/devtools/makefile_base_posix.mak @@ -2,9 +2,9 @@ # Base makefile for Linux. # # !!!!! Note to future editors !!!!! -# +# # before you make changes, make sure you grok: -# 1. the difference between =, :=, +=, and ?= +# 1. the difference between =, :=, +=, and ?= # 2. how and when this base makefile gets included in the generated makefile(s) # ( see http://www.gnu.org/software/make/manual/make.html#Flavors ) # @@ -48,7 +48,7 @@ else endif # CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags" -ARCH_FLAGS = +ARCH_FLAGS = BUILDING_MULTI_ARCH = 0 # Preserve cflags set in environment ENV_CFLAGS := $(CFLAGS) @@ -62,7 +62,7 @@ ifeq ($(CLANG_BUILD),1) CXXFLAGS = $(BASE_CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else $(ENV_CXXFLAGS) else # !!! ABI COMPAT: -fabi-compat-version=2 is needed to generate the proper symbols for linking - CXXFLAGS = $(BASE_CFLAGS) -std=gnu++0x -fpermissive -fabi-compat-version=2 $(ENV_CXXFLAGS) + CXXFLAGS = $(BASE_CFLAGS) -std=gnu++17 -fpermissive -fabi-compat-version=2 $(ENV_CXXFLAGS) # Diagnostics coloring CXXFLAGS += -fdiagnostics-color=always endif @@ -74,16 +74,16 @@ DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE # DEFINES += -D_FILE_OFFSET_BITS=64 LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel) -GENDEP_CXXFLAGS = -MMD -MP -MF $(@:.o=.P) +GENDEP_CXXFLAGS = -MMD -MP -MF $(@:.o=.P) MAP_FLAGS = -Srv_GAMEOUTPUTFILE = +Srv_GAMEOUTPUTFILE = COPY_DLL_TO_SRV = 0 # We should always specify -Wl,--build-id, as documented at: # http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId LDFLAGS += -Wl,--build-id -GCC_VER = +GCC_VER = -9 P4BIN = p4 CRYPTOPPDIR=ubuntu12_32 @@ -116,7 +116,7 @@ ifeq ($(origin AR), default) AR = ar crs endif ifeq ($(origin CC), default) - CC = $(CCACHE) gcc$(GCC_VER) + CC = $(CCACHE) gcc$(GCC_VER) endif ifeq ($(origin CXX), default) CXX = $(CCACHE) g++$(GCC_VER) @@ -143,17 +143,20 @@ endif ifeq ($(CLANG_BUILD),1) # Clang specific flags -else ifeq ($(GCC_VER),-4.8) +else ifeq ($(GCC_VER),-9) WARN_FLAGS += -Wno-unused-local-typedefs WARN_FLAGS += -Wno-unused-result WARN_FLAGS += -Wno-narrowing + WARN_FLAGS += -Wno-class-memaccess # WARN_FLAGS += -Wno-unused-function endif 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 -Wno-narrowing WARN_FLAGS += -fdiagnostics-show-option -Wformat -Wformat-security -WARN_FLAGS += -Wno-class-memaccess -Wno-unused-local-typedefs -Wno-ignored-attributes +# WARN_FLAGS += -Wno-class-memaccess -Wno-unused-local-typedefs -Wno-ignored-attributes + +WARN_FLAGS += -Werror=parentheses ifeq ($(TARGET_PLATFORM),linux64) # nocona = pentium4 + 64bit + MMX, SSE, SSE2, SSE3 - no SSSE3 (that's three s's - added in core2) @@ -163,10 +166,10 @@ ifeq ($(TARGET_PLATFORM),linux64) LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a) else # pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse - ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS) + ARCH_FLAGS += -m32 -fabi-compat-version=2 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS) LD_SO = ld-linux.so.2 - LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so) - LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so) + LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.a) + LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.a) LDFLAGS += -m32 endif @@ -197,7 +200,7 @@ PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRA $(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group -LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread +LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt @@ -227,8 +230,8 @@ C_TO_OBJ = $(MM_TO_OBJ:.c=.o) OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ))) ifeq ($(MAKE_VERBOSE),1) - QUIET_PREFIX = - QUIET_ECHO_POSTFIX = + QUIET_PREFIX = + QUIET_ECHO_POSTFIX = else QUIET_PREFIX = @ QUIET_ECHO_POSTFIX = > /dev/null @@ -253,9 +256,9 @@ endif # we generate dependencies as a side-effect of compilation now GEN_DEP_FILE= -PRE_COMPILE_FILE = +PRE_COMPILE_FILE = -POST_COMPILE_FILE = +POST_COMPILE_FILE = ifeq ($(BUILDING_MULTI_ARCH),1) SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS)) @@ -298,8 +301,8 @@ else P4_EDIT_START := for f in P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | $(P4BIN) -x - edit -c $(P4_EDIT_CHANGELIST); else $(P4BIN) edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX) - P4_REVERT_START := for f in - P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | $(P4BIN) -x - revert; else $(P4BIN) revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX) + P4_REVERT_START := for f in + P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | $(P4BIN) -x - revert; else $(P4BIN) revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX) endif ifeq ($(CONFTYPE),dll) @@ -386,8 +389,8 @@ cleantargets: $(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE) -$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS) - $(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END); +$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS) + $(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END); $(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES); SO_GameOutputFile = $(GAMEOUTPUTFILE) @@ -405,7 +408,7 @@ $(SO_GameOutputFile): $(SO_File) $(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX); $(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX); $(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); - $(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE); + $(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE); $(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE); $(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE); $(QUIET_PREFIX) if [ "$(COPY_DLL_TO_SRV)" = "1" ]; then\ diff --git a/sp/src/game/server/ai_basenpc.cpp b/sp/src/game/server/ai_basenpc.cpp index 1ce4f3cd..b69afd94 100644 --- a/sp/src/game/server/ai_basenpc.cpp +++ b/sp/src/game/server/ai_basenpc.cpp @@ -1,6 +1,6 @@ //========= Copyright Valve Corporation, All rights reserved. ============// // -// Purpose: +// Purpose: // //=============================================================================// @@ -302,7 +302,7 @@ CPostFrameNavigationHook *PostFrameNavigationSystem( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CPostFrameNavigationHook::Init( void ) { @@ -324,10 +324,10 @@ static void ProcessNavigationQueries( CFunctor **pData, unsigned int nCount ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CPostFrameNavigationHook::FrameUpdatePreEntityThink( void ) -{ +{ // If the thread is executing, then wait for it to finish if ( g_pQueuedNavigationQueryJob ) { @@ -335,11 +335,11 @@ void CPostFrameNavigationHook::FrameUpdatePreEntityThink( void ) g_pQueuedNavigationQueryJob = NULL; m_Functors.Purge(); } - + if ( ai_post_frame_navigation.GetBool() == false ) return; - SetGrameFrameRunning( true ); + SetGrameFrameRunning( true ); } //----------------------------------------------------------------------------- @@ -583,7 +583,7 @@ void CAI_BaseNPC::Event_Killed( const CTakeDamageInfo &info ) } Wake( false ); - + //Adrian: Select a death pose to extrapolate the ragdoll's velocity. SelectDeathPose( info ); @@ -605,7 +605,7 @@ void CAI_BaseNPC::Event_Killed( const CTakeDamageInfo &info ) { m_bImportanRagdoll = RagdollManager_SaveImportant( this ); } - + // Make sure this condition is fired too (OnTakeDamage breaks out before this happens on death) SetCondition( COND_LIGHT_DAMAGE ); SetIdealState( NPC_STATE_DEAD ); @@ -616,8 +616,8 @@ void CAI_BaseNPC::Event_Killed( const CTakeDamageInfo &info ) // because the AI code isn't going to pick up the change on the next think // for us. - // Adrian - Only set this if we are going to become a ragdoll. We still want to - // select SCHED_DIE or do something special when this NPC dies and we wont + // Adrian - Only set this if we are going to become a ragdoll. We still want to + // select SCHED_DIE or do something special when this NPC dies and we wont // catch the change of state if we set this to whatever the ideal state is. if ( CanBecomeRagdoll() || IsRagdoll() ) SetState( NPC_STATE_DEAD ); @@ -692,7 +692,7 @@ bool CAI_BaseNPC::PassesDamageFilter( const CTakeDamageInfo &info ) return false; } } - + if ( !BaseClass::PassesDamageFilter( info ) ) { m_fNoDamageDecal = true; @@ -769,7 +769,7 @@ int CAI_BaseNPC::OnTakeDamage_Alive( const CTakeDamageInfo &info ) if( info.GetAttacker()->IsPlayer() ) { m_OnDamagedByPlayer.FireOutput( info.GetAttacker(), this ); - + // This also counts as being harmed by player's squad. m_OnDamagedByPlayerSquad.FireOutput( info.GetAttacker(), this ); } @@ -885,7 +885,7 @@ int CAI_BaseNPC::OnTakeDamage_Alive( const CTakeDamageInfo &info ) { SetCondition(COND_REPEATED_DAMAGE); } - + NotifyFriendsOfDamage( info.GetAttacker() ); } @@ -1048,8 +1048,8 @@ void CAI_BaseNPC::DoRadiusDamage( const CTakeDamageInfo &info, const Vector &vec //----------------------------------------------------------------------------- // Set the contents types that are solid by default to all NPCs //----------------------------------------------------------------------------- -unsigned int CAI_BaseNPC::PhysicsSolidMaskForEntity( void ) const -{ +unsigned int CAI_BaseNPC::PhysicsSolidMaskForEntity( void ) const +{ return MASK_NPCSOLID; } @@ -1057,7 +1057,7 @@ unsigned int CAI_BaseNPC::PhysicsSolidMaskForEntity( void ) const //========================================================= //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::DecalTrace( trace_t *pTrace, char const *decalName ) { @@ -1071,7 +1071,7 @@ void CAI_BaseNPC::DecalTrace( trace_t *pTrace, char const *decalName ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { @@ -1239,7 +1239,7 @@ bool CAI_BaseNPC::PointInSpread( CBaseCombatCharacter *pCheckEntity, const Vecto Vector toTest = testPoint - sourcePos; float distTest = VectorNormalize(toTest); - // Only reject if target is on other side + // Only reject if target is on other side if (distTarget > distTest) { toTarget.z = 0.0; @@ -1403,7 +1403,7 @@ void CBaseEntity::TraceAttackToTriggers( const CTakeDamageInfo &info, const Vect } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: // Output : const char //----------------------------------------------------------------------------- const char *CAI_BaseNPC::GetTracerType( void ) @@ -1417,10 +1417,10 @@ const char *CAI_BaseNPC::GetTracerType( void ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : &vecTracerSrc - -// &tr - -// iTracerType - +// Purpose: +// Input : &vecTracerSrc - +// &tr - +// iTracerType - //----------------------------------------------------------------------------- void CAI_BaseNPC::MakeTracer( const Vector &vecTracerSrc, const trace_t &tr, int iTracerType ) { @@ -1434,7 +1434,7 @@ void CAI_BaseNPC::MakeTracer( const Vector &vecTracerSrc, const trace_t &tr, int } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::FireBullets( const FireBulletsInfo_t &info ) { @@ -1442,7 +1442,7 @@ void CAI_BaseNPC::FireBullets( const FireBulletsInfo_t &info ) // If we're shooting at a bullseye, become perfectly accurate if the bullseye demands it if ( GetEnemy() && GetEnemy()->Classify() == CLASS_BULLSEYE ) { - CNPC_Bullseye *pBullseye = dynamic_cast(GetEnemy()); + CNPC_Bullseye *pBullseye = dynamic_cast(GetEnemy()); if ( pBullseye && pBullseye->UsePerfectAccuracy() ) { FireBulletsInfo_t accurateInfo = info; @@ -1480,7 +1480,7 @@ void CBaseEntity::UpdateShotStatistics( const trace_t &tr ) //----------------------------------------------------------------------------- // Handle shot entering water //----------------------------------------------------------------------------- -void CBaseEntity::HandleShotImpactingGlass( const FireBulletsInfo_t &info, +void CBaseEntity::HandleShotImpactingGlass( const FireBulletsInfo_t &info, const trace_t &tr, const Vector &vecDir, ITraceFilter *pTraceFilter ) { // Move through the glass until we're at the other side @@ -1510,7 +1510,7 @@ void CBaseEntity::HandleShotImpactingGlass( const FireBulletsInfo_t &info, data.m_vNormal = penetrationTrace.plane.normal; data.m_vOrigin = penetrationTrace.endpos; - + DispatchEffect( "GlassImpact", data ); // Refire the round, as if starting from behind the glass @@ -1600,9 +1600,9 @@ void CAI_BaseNPC::MakeDamageBloodDecal ( int cCount, float flNoise, trace_t *ptr //----------------------------------------------------------------------------- -// Purpose: -// Input : &tr - -// nDamageType - +// Purpose: +// Input : &tr - +// nDamageType - //----------------------------------------------------------------------------- void CAI_BaseNPC::DoImpactEffect( trace_t &tr, int nDamageType ) { @@ -1619,17 +1619,17 @@ void CAI_BaseNPC::DoImpactEffect( trace_t &tr, int nDamageType ) //--------------------------------------------------------- #define InterruptFromCondition( iCondition ) \ AI_RemapFromGlobal( ( AI_IdIsLocal( iCondition ) ? GetClassScheduleIdSpace()->ConditionLocalToGlobal( iCondition ) : iCondition ) ) - + void CAI_BaseNPC::SetCondition( int iCondition ) { int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); return; } - + m_Conditions.Set( interrupt ); } @@ -1638,13 +1638,13 @@ void CAI_BaseNPC::SetCondition( int iCondition ) bool CAI_BaseNPC::HasCondition( int iCondition ) { int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); return false; } - + bool bReturn = m_Conditions.IsBitSet(interrupt); return (bReturn); } @@ -1655,15 +1655,15 @@ bool CAI_BaseNPC::HasCondition( int iCondition, bool bUseIgnoreConditions ) { if ( bUseIgnoreConditions ) return HasCondition( iCondition ); - + int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); return false; } - + bool bReturn = m_ConditionsPreIgnore.IsBitSet(interrupt); return (bReturn); } @@ -1673,13 +1673,13 @@ bool CAI_BaseNPC::HasCondition( int iCondition, bool bUseIgnoreConditions ) void CAI_BaseNPC::ClearCondition( int iCondition ) { int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); return; } - + m_Conditions.Clear(interrupt); } @@ -1691,13 +1691,13 @@ void CAI_BaseNPC::ClearConditions( int *pConditions, int nConditions ) { int iCondition = pConditions[i]; int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); continue; } - + m_Conditions.Clear( interrupt ); } } @@ -1710,13 +1710,13 @@ void CAI_BaseNPC::SetIgnoreConditions( int *pConditions, int nConditions ) { int iCondition = pConditions[i]; int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); continue; } - + m_InverseIgnoreConditions.Clear( interrupt ); // clear means ignore } } @@ -1727,13 +1727,13 @@ void CAI_BaseNPC::ClearIgnoreConditions( int *pConditions, int nConditions ) { int iCondition = pConditions[i]; int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); continue; } - + m_InverseIgnoreConditions.Set( interrupt ); // set means don't ignore } } @@ -1748,7 +1748,7 @@ bool CAI_BaseNPC::HasInterruptCondition( int iCondition ) } int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); @@ -1760,14 +1760,14 @@ bool CAI_BaseNPC::HasInterruptCondition( int iCondition ) //--------------------------------------------------------- //--------------------------------------------------------- bool CAI_BaseNPC::ConditionInterruptsCurSchedule( int iCondition ) -{ +{ if( !GetCurSchedule() ) { return false; } int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); @@ -1785,7 +1785,7 @@ bool CAI_BaseNPC::ConditionInterruptsSchedule( int localScheduleID, int iConditi return false; int interrupt = InterruptFromCondition( iCondition ); - + if ( interrupt == -1 ) { Assert(0); @@ -1801,7 +1801,7 @@ bool CAI_BaseNPC::ConditionInterruptsSchedule( int localScheduleID, int iConditi //----------------------------------------------------------------------------- void CAI_BaseNPC::SetScriptedScheduleIgnoreConditions( Interruptability_t interrupt ) { - static int g_GeneralConditions[] = + static int g_GeneralConditions[] = { COND_CAN_MELEE_ATTACK1, COND_CAN_MELEE_ATTACK2, @@ -1819,7 +1819,7 @@ void CAI_BaseNPC::SetScriptedScheduleIgnoreConditions( Interruptability_t interr COND_SMELL, }; - static int g_DamageConditions[] = + static int g_DamageConditions[] = { COND_HEAVY_DAMAGE, COND_LIGHT_DAMAGE, @@ -1851,7 +1851,7 @@ bool CAI_BaseNPC::HasConditionsToInterruptSchedule( int nLocalScheduleID ) CAI_ScheduleBits bitsOut; AccessConditionBits().And( bitsMask, &bitsOut ); - + return !bitsOut.IsAllClear(); } @@ -1861,13 +1861,13 @@ bool CAI_BaseNPC::HasConditionsToInterruptSchedule( int nLocalScheduleID ) bool CAI_BaseNPC::IsCustomInterruptConditionSet( int nCondition ) { int interrupt = InterruptFromCondition( nCondition ); - + if ( interrupt == -1 ) { Assert(0); return false; } - + return m_CustomInterruptConditions.IsBitSet( interrupt ); } @@ -1878,13 +1878,13 @@ bool CAI_BaseNPC::IsCustomInterruptConditionSet( int nCondition ) void CAI_BaseNPC::SetCustomInterruptCondition( int nCondition ) { int interrupt = InterruptFromCondition( nCondition ); - + if ( interrupt == -1 ) { Assert(0); return; } - + m_CustomInterruptConditions.Set( interrupt ); } @@ -1895,13 +1895,13 @@ void CAI_BaseNPC::SetCustomInterruptCondition( int nCondition ) void CAI_BaseNPC::ClearCustomInterruptCondition( int nCondition ) { int interrupt = InterruptFromCondition( nCondition ); - + if ( interrupt == -1 ) { Assert(0); return; } - + m_CustomInterruptConditions.Clear( interrupt ); } @@ -2102,9 +2102,9 @@ void CAI_BaseNPC::OnListened() // this is an audible sound. switch( pCurrentSound->SoundTypeNoContext() ) { - case SOUND_DANGER: + case SOUND_DANGER: if( gpGlobals->curtime > m_flIgnoreDangerSoundsUntil) - condition = COND_HEAR_DANGER; + condition = COND_HEAR_DANGER; break; case SOUND_THUMPER: condition = COND_HEAR_THUMPER; break; @@ -2114,7 +2114,7 @@ void CAI_BaseNPC::OnListened() { condition = COND_HEAR_SPOOKY; } - else + else { condition = COND_HEAR_COMBAT; } @@ -2270,7 +2270,7 @@ void CAI_BaseNPC::TryRestoreHull(void) //========================================================= int CAI_BaseNPC::GetSoundInterests( void ) { - return SOUND_WORLD | SOUND_COMBAT | SOUND_PLAYER | SOUND_PLAYER_VEHICLE | + return SOUND_WORLD | SOUND_COMBAT | SOUND_PLAYER | SOUND_PLAYER_VEHICLE | SOUND_BULLET_IMPACT; } @@ -2295,7 +2295,7 @@ int CAI_BaseNPC::GetSoundPriority( CSound *pSound ) return SOUND_PRIORITY_HIGH; } - + return SOUND_PRIORITY_NORMAL; } @@ -2354,7 +2354,7 @@ void CAI_BaseNPC::UnlockBestSound() //----------------------------------------------------------------------------- // Purpose: Return true if the specified sound is visible. Handles sounds generated by entities correctly. -// Input : *pSound - +// Input : *pSound - //----------------------------------------------------------------------------- bool CAI_BaseNPC::SoundIsVisible( CSound *pSound ) { @@ -2659,7 +2659,7 @@ void CAI_BaseNPC::SetAim( const Vector &aimDir ) // Msg("yaw %.0f (%.0f %.0f)\n", newYaw, angDir.y, GetAbsAngles().y ); // Calculate our interaction yaw. - // If we've got a small adjustment off our abs yaw, use that. + // If we've got a small adjustment off our abs yaw, use that. // Otherwise, use our abs yaw. if ( fabs(newYaw) < 20 ) { @@ -2683,7 +2683,7 @@ void CAI_BaseNPC::RelaxAim( ) SetPoseParameter( m_poseAim_Pitch, newPitch ); SetPoseParameter( m_poseAim_Yaw, newYaw ); - // DevMsg("relax aim %.0f %0.f\n", newPitch, newYaw ); + // DevMsg("relax aim %.0f %0.f\n", newPitch, newYaw ); } //----------------------------------------------------------------------------- @@ -2973,7 +2973,7 @@ void CAI_BaseNPC::RunAnimation( void ) return; float flInterval = GetAnimTimeInterval(); - + StudioFrameAdvance( ); // animate if ((CAI_BaseNPC::m_nDebugBits & bits_debugStepAI) && !GetNavigator()->IsGoalActive()) @@ -3005,8 +3005,8 @@ void CAI_BaseNPC::RunAnimation( void ) ResetSequence( iSequence ); // Set to new anim (if it's there) //Adrian: Basically everywhere else in the AI code this variable gets set to whatever our sequence is. - //But here it doesn't and not setting it causes any animation set through here to be stomped by the - //ideal sequence before it has a chance of playing out (since there's code that reselects the ideal + //But here it doesn't and not setting it causes any animation set through here to be stomped by the + //ideal sequence before it has a chance of playing out (since there's code that reselects the ideal //sequence if it doesn't match the current one). if ( hl2_episodic.GetBool() ) { @@ -3028,9 +3028,9 @@ void CAI_BaseNPC::PostRun( void ) if ( !IsMoving() ) { - if ( GetIdealActivity() == ACT_WALK || - GetIdealActivity() == ACT_RUN || - GetIdealActivity() == ACT_WALK_AIM || + if ( GetIdealActivity() == ACT_WALK || + GetIdealActivity() == ACT_RUN || + GetIdealActivity() == ACT_WALK_AIM || GetIdealActivity() == ACT_RUN_AIM ) { PostRunStopMoving(); @@ -3058,7 +3058,7 @@ void CAI_BaseNPC::PostRunStopMoving() bool CAI_BaseNPC::ShouldAlwaysThink() { - // @TODO (toml 07-08-03): This needs to be beefed up. + // @TODO (toml 07-08-03): This needs to be beefed up. // There are simple cases already seen where an AI can briefly leave // the PVS while navigating to the player. Perhaps should incorporate a heuristic taking into // account mode, enemy, last time saw player, player range etc. For example, if enemy is player, @@ -3110,7 +3110,7 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) //--------------------------------- - CBasePlayer *pPlayer = AI_GetSinglePlayer(); + CBasePlayer *pPlayer = AI_GetSinglePlayer(); static Vector vPlayerEyePosition; static Vector vPlayerForward; static int iPrevFrame = -1; @@ -3173,11 +3173,11 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) bool bFramerateOk = ( gpGlobals->frametime < ai_frametime_limit.GetFloat() ); - if ( m_bForceConditionsGather || + if ( m_bForceConditionsGather || gpGlobals->curtime - GetLastAttackTime() < .2 || gpGlobals->curtime - m_flLastDamageTime < .2 || ( GetState() < NPC_STATE_IDLE || GetState() > NPC_STATE_SCRIPT ) || - ( ( bInPVS || bInVisibilityPVS ) && + ( ( bInPVS || bInVisibilityPVS ) && ( ( GetTask() && !TaskIsRunning() ) || GetTaskInterrupt() > 0 || m_bInChoreo ) ) ) @@ -3199,11 +3199,11 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) // Stay normal if there's any chance of a relevant danger sound bool bPotentialDanger = false; - + if ( GetSoundInterests() & SOUND_DANGER ) { int iSound = CSoundEnt::ActiveList(); - + while ( iSound != SOUNDLIST_EMPTY ) { CSound *pCurrentSound = CSoundEnt::SoundPointerForIndex( iSound ); @@ -3221,7 +3221,7 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) break; } } - + iSound = pCurrentSound->NextSound(); } } @@ -3257,12 +3257,12 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) return; } - range = ( playerDist < 50*12 ) ? DIST_NEAR : + range = ( playerDist < 50*12 ) ? DIST_NEAR : ( playerDist < 200*12 ) ? DIST_MID : DIST_FAR; } else { - range = ( playerDist < 25*12 ) ? DIST_NEAR : + range = ( playerDist < 25*12 ) ? DIST_NEAR : ( playerDist < 100*12 ) ? DIST_MID : DIST_FAR; } @@ -3314,7 +3314,7 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) // Not in PVS AIE_NORMAL, AIE_EFFICIENT, - AIE_VERY_EFFICIENT, + AIE_VERY_EFFICIENT, }; static const int stateBase[] = { 0, 9, 18 }; @@ -3341,7 +3341,7 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) { maxEfficiency = AIE_VERY_EFFICIENT; } - + //--------------------------------- SetEfficiency( clamp( efficiency, minEfficiency, maxEfficiency ) ); @@ -3390,18 +3390,18 @@ void CAI_BaseNPC::UpdateSleepState( bool bInPVS ) Wake(); } } - + // Should check for visible danger sounds if ( (GetSoundInterests() & SOUND_DANGER) && !(HasSpawnFlags(SF_NPC_WAIT_TILL_SEEN)) ) { int iSound = CSoundEnt::ActiveList(); - + while ( iSound != SOUNDLIST_EMPTY ) { CSound *pCurrentSound = CSoundEnt::SoundPointerForIndex( iSound ); Assert( pCurrentSound ); - if ( (pCurrentSound->SoundType() & SOUND_DANGER) && + if ( (pCurrentSound->SoundType() & SOUND_DANGER) && GetSenses()->CanHearSound( pCurrentSound ) && SoundIsVisible( pCurrentSound )) { @@ -3524,7 +3524,7 @@ inline bool CAI_BaseNPC::CanThinkRebalance() return true; } -void CAI_BaseNPC::RebalanceThinks() +void CAI_BaseNPC::RebalanceThinks() { bool bDebugThinkTicks = ai_debug_think_ticks.GetBool(); if ( bDebugThinkTicks ) @@ -3574,7 +3574,7 @@ void CAI_BaseNPC::RebalanceThinks() { CAI_BaseNPC *pCandidate = g_AI_Manager.AccessAIs()[i]; if ( pCandidate->CanThinkRebalance() && - ( pCandidate->GetNextThinkTick() >= iMinTickRebalance && + ( pCandidate->GetNextThinkTick() >= iMinTickRebalance && pCandidate->GetNextThinkTick() < iMaxTickRebalance ) ) { int iInfo = rebalanceCandidates.AddToTail(); @@ -3611,7 +3611,7 @@ void CAI_BaseNPC::RebalanceThinks() int iMaxThinkersPerTick = ceil( (float)( rebalanceCandidates.Count() + 1 ) / (float)iTicksPer10Hz ); // +1 to account for "this" int iCurTickDistributing = MIN( gpGlobals->tickcount, rebalanceCandidates[0].iNextThinkTick ); - int iRemainingThinksToDistribute = iMaxThinkersPerTick - 1; // Start with one fewer first time because "this" is + int iRemainingThinksToDistribute = iMaxThinkersPerTick - 1; // Start with one fewer first time because "this" is // always gets a slot in the current tick to avoid complications // in the calculation of "last think" @@ -3744,16 +3744,16 @@ bool CAI_BaseNPC::PreNPCThink() return true; } -void CAI_BaseNPC::PostNPCThink( void ) -{ +void CAI_BaseNPC::PostNPCThink( void ) +{ if ( g_StartTimeCurThink != 0.0 && VCRGetMode() == VCR_Disabled ) { g_NpcTimeThisFrame += engine->Time() - g_StartTimeCurThink; } } -void CAI_BaseNPC::CallNPCThink( void ) -{ +void CAI_BaseNPC::CallNPCThink( void ) +{ RebalanceThinks(); //--------------------------------- @@ -3770,12 +3770,12 @@ void CAI_BaseNPC::CallNPCThink( void ) // reduce cache queries by locking model in memory MDLCACHE_CRITICAL_SECTION(); - this->NPCThink(); + this->NPCThink(); m_flLastRealThinkTime = gpGlobals->curtime; PostNPCThink(); -} +} bool NPC_CheckBrushExclude( CBaseEntity *pEntity, CBaseEntity *pBrush ) { @@ -3839,7 +3839,7 @@ void CAI_BaseNPC::SetPlayerAvoidState( void ) if ( pLocalPlayer ) { - bShouldPlayerAvoid = IsBoxIntersectingBox( GetAbsOrigin() + vMins, GetAbsOrigin() + vMaxs, + bShouldPlayerAvoid = IsBoxIntersectingBox( GetAbsOrigin() + vMins, GetAbsOrigin() + vMaxs, pLocalPlayer->GetAbsOrigin() + pLocalPlayer->WorldAlignMins(), pLocalPlayer->GetAbsOrigin() + pLocalPlayer->WorldAlignMaxs() ); } @@ -3914,7 +3914,7 @@ void CAI_BaseNPC::NPCThink( void ) //--------------------------------- bool bInPVS = CheckPVSCondition(); - + //--------------------------------- UpdateSleepState( bInPVS ); @@ -4012,7 +4012,7 @@ void CAI_BaseNPC::NPCThink( void ) "AIE_DORMANT", }; - static const char *ppszMoveEfficiencies[] = + static const char *ppszMoveEfficiencies[] = { "AIME_NORMAL", "AIME_EFFICIENT", @@ -4021,7 +4021,7 @@ void CAI_BaseNPC::NPCThink( void ) if ( ai_debug_efficiency.GetBool() ) DevMsg( this, "Eff: %s, Move: %s\n", ppszEfficiencies[GetEfficiency()], ppszMoveEfficiencies[GetMoveEfficiency()] ); - static float g_DecisionIntervals[] = + static float g_DecisionIntervals[] = { .1, // AIE_NORMAL .2, // AIE_EFFICIENT @@ -4224,7 +4224,7 @@ void CAI_BaseNPC::ClearAttackConditions( ) void CAI_BaseNPC::GatherAttackConditions( CBaseEntity *pTarget, float flDist ) { AI_PROFILE_SCOPE(CAI_BaseNPC_GatherAttackConditions); - + Vector vecLOS = ( pTarget->GetAbsOrigin() - GetAbsOrigin() ); vecLOS.z = 0; VectorNormalize( vecLOS ); @@ -4500,7 +4500,7 @@ void CAI_BaseNPC::CheckOnGround( void ) // parented objects are never floating if (GetMoveParent() != NULL) return; - + // NPCs in scripts with the fly flag shouldn't fall. // FIXME: should NPCS with FL_FLY ever fall? Doesn't seem like they should. if ( ( GetState() == NPC_STATE_SCRIPT ) && ( GetFlags() & FL_FLY ) ) @@ -4534,10 +4534,10 @@ void CAI_BaseNPC::CheckOnGround( void ) } else { - if ( trace.startsolid && trace.m_pEnt->GetMoveType() == MOVETYPE_VPHYSICS && + if ( trace.startsolid && trace.m_pEnt->GetMoveType() == MOVETYPE_VPHYSICS && trace.m_pEnt->VPhysicsGetObject() && trace.m_pEnt->VPhysicsGetObject()->GetMass() < VPHYSICS_LARGE_OBJECT_MASS ) { - // stuck inside a small physics object? + // stuck inside a small physics object? m_CheckOnGroundTimer.Set(0.1f); NPCPhysics_CreateSolver( this, trace.m_pEnt, true, 0.25f ); if ( VPhysicsGetObject() ) @@ -4573,7 +4573,7 @@ void CAI_BaseNPC::NotifyPushMove() } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::CanFlinch( void ) { @@ -4587,7 +4587,7 @@ bool CAI_BaseNPC::CanFlinch( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::CheckFlinches( void ) { @@ -4611,7 +4611,7 @@ void CAI_BaseNPC::CheckFlinches( void ) } else if ( !HasInterruptCondition(COND_HEAVY_DAMAGE) ) { - // If we have taken heavy damage, but the current schedule doesn't + // If we have taken heavy damage, but the current schedule doesn't // break on that, resort to just playing a gesture flinch. PlayFlinchGesture(); } @@ -4665,9 +4665,9 @@ void CAI_BaseNPC::GatherConditions( void ) // npc's PVS. NPCs in COMBAT state are allowed to simulate when there is no player in // the same PVS. This is so that any fights in progress will continue even if the player leaves the PVS. if ( !IsFlaggedEfficient() && - ( bForcedGather || + ( bForcedGather || HasCondition( COND_IN_PVS ) || - ShouldAlwaysThink() || + ShouldAlwaysThink() || m_NPCState == NPC_STATE_COMBAT ) ) { CheckOnGround(); @@ -4692,7 +4692,7 @@ void CAI_BaseNPC::GatherConditions( void ) if ( GetCurSchedule() && ( m_NPCState == NPC_STATE_IDLE || m_NPCState == NPC_STATE_ALERT) && GetEnemy() && - !HasCondition( COND_NEW_ENEMY ) && + !HasCondition( COND_NEW_ENEMY ) && GetCurSchedule()->HasInterrupt( COND_NEW_ENEMY ) ) { // @Note (toml 05-05-04): There seems to be a case where an NPC can not respond @@ -4704,7 +4704,7 @@ void CAI_BaseNPC::GatherConditions( void ) } else { - // if not done, can have problems if leave PVS in same frame heard/saw things, + // if not done, can have problems if leave PVS in same frame heard/saw things, // since only PerformSensing clears conditions ClearSenseConditions(); } @@ -4742,7 +4742,7 @@ void CAI_BaseNPC::GatherConditions( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::PrescheduleThink( void ) { @@ -4804,7 +4804,7 @@ void CAI_BaseNPC::RunAI( void ) for ( CAI_BaseNPC *pSquadMember = pSquad->GetFirstMember( &iter, false ); pSquadMember; pSquadMember = pSquad->GetNextMember( &iter, false ) ) { if ( pSquadMember != this ) - NDebugOverlay::Line( EyePosition(), pSquadMember->EyePosition(), 0, + NDebugOverlay::Line( EyePosition(), pSquadMember->EyePosition(), 0, CAI_Squad::IsSilentMember(pSquadMember) ? 127 : 255, 0, false , 0.1 ); } } @@ -4823,7 +4823,7 @@ void CAI_BaseNPC::RunAI( void ) NDebugOverlay::Line( vecPoint, vecPoint + Vector( 0, 0, 32 ) + right * 32, 255, 0, 0, false , 0.1 ); NDebugOverlay::Line( vecPoint, vecPoint + Vector( 0, 0, 32 ) - right * 32, 255, 0, 0, false , 0.1 ); } - + #ifdef _DEBUG m_bSelected = ( (m_debugOverlays & OVERLAY_NPC_SELECTED_BIT) != 0 ); #endif @@ -4853,11 +4853,11 @@ void CAI_BaseNPC::RunAI( void ) AI_PROFILE_SCOPE_END(); g_AIPrescheduleThinkTimer.End(); - + MaintainSchedule(); PostscheduleThink(); - + ClearTransientConditions(); g_AIRunTimer.End(); @@ -4892,9 +4892,9 @@ NPC_STATE CAI_BaseNPC::SelectIdleIdealState() // that a npc in combat has found a more suitable target to attack return NPC_STATE_COMBAT; } - + // Set our ideal yaw if we've taken damage - if ( HasCondition(COND_LIGHT_DAMAGE) || + if ( HasCondition(COND_LIGHT_DAMAGE) || HasCondition(COND_HEAVY_DAMAGE) || (!GetEnemy() && gpGlobals->curtime - GetEnemies()->LastTimeSeen( AI_UNKNOWN_ENEMY ) < TIME_CARE_ABOUT_DAMAGE ) ) { @@ -4950,12 +4950,12 @@ NPC_STATE CAI_BaseNPC::SelectIdleIdealState() } } } - + if ( HasInterruptCondition(COND_SMELL) ) { return NPC_STATE_ALERT; } - + return NPC_STATE_INVALID; } @@ -4973,7 +4973,7 @@ NPC_STATE CAI_BaseNPC::SelectAlertIdealState() { return NPC_STATE_COMBAT; } - + // Set our ideal yaw if we've taken damage if ( HasCondition(COND_LIGHT_DAMAGE) || HasCondition(COND_HEAVY_DAMAGE) || @@ -5018,12 +5018,12 @@ NPC_STATE CAI_BaseNPC::SelectAlertIdealState() return NPC_STATE_ALERT; } - + if ( ShouldGoToIdleState() ) { return NPC_STATE_IDLE; } - + return NPC_STATE_INVALID; } @@ -5160,7 +5160,7 @@ void CAI_BaseNPC::GiveWeapon( string_t iszWeaponName ) } //----------------------------------------------------------------------------- -// Rather specific function that tells us if an NPC is in the process of +// Rather specific function that tells us if an NPC is in the process of // moving to a weapon with the intent to pick it up. //----------------------------------------------------------------------------- bool CAI_BaseNPC::IsMovingToPickupWeapon() @@ -5362,9 +5362,9 @@ bool CAI_BaseNPC::InnateWeaponLOSCondition( const Vector &ownerPos, const Vector { return true; } - + CBaseEntity *pHitEntity = tr.m_pEnt; - + // Translate a hit vehicle into its passenger if found if ( GetEnemy() != NULL ) { @@ -5432,16 +5432,16 @@ bool CAI_BaseNPC::FCanCheckAttacks( void ) float CAI_BaseNPC::EnemyDistance( CBaseEntity *pEnemy ) { Vector enemyDelta = pEnemy->WorldSpaceCenter() - WorldSpaceCenter(); - + // NOTE: We ignore rotation for computing height. Assume it isn't an effect - // we care about, so we simply use OBBSize().z for height. + // we care about, so we simply use OBBSize().z for height. // Otherwise you'd do this: // pEnemy->CollisionProp()->WorldSpaceSurroundingBounds( &enemyMins, &enemyMaxs ); // float enemyHeight = enemyMaxs.z - enemyMins.z; float enemyHeight = pEnemy->CollisionProp()->OBBSize().z; float myHeight = CollisionProp()->OBBSize().z; - + // max distance our centers can be apart with the boxes still overlapping float flMaxZDist = ( enemyHeight + myHeight ) * 0.5f; @@ -5469,8 +5469,8 @@ float CAI_BaseNPC::EnemyDistance( CBaseEntity *pEnemy ) float CAI_BaseNPC::GetReactionDelay( CBaseEntity *pEnemy ) { - return ( m_NPCState == NPC_STATE_ALERT || m_NPCState == NPC_STATE_COMBAT ) ? - ai_reaction_delay_alert.GetFloat() : + return ( m_NPCState == NPC_STATE_ALERT || m_NPCState == NPC_STATE_COMBAT ) ? + ai_reaction_delay_alert.GetFloat() : ai_reaction_delay_idle.GetFloat(); } @@ -5482,9 +5482,9 @@ float CAI_BaseNPC::GetReactionDelay( CBaseEntity *pEnemy ) bool CAI_BaseNPC::UpdateEnemyMemory( CBaseEntity *pEnemy, const Vector &position, CBaseEntity *pInformer ) { bool firstHand = ( pInformer == NULL || pInformer == this ); - + AI_PROFILE_SCOPE(CAI_BaseNPC_UpdateEnemyMemory); - + if ( GetEnemies() ) { // If the was eluding me and allow the NPC to play a sound @@ -5624,12 +5624,12 @@ void CAI_BaseNPC::GatherEnemyConditions( CBaseEntity *pEnemy ) ClearCondition( COND_SEE_ENEMY ); ClearCondition( COND_ENEMY_OCCLUDED ); return; - } - + } + float flDistToEnemy = EnemyDistance(pEnemy); AI_PROFILE_SCOPE_BEGIN(CAI_BaseNPC_GatherEnemyConditions_SeeEnemy); - + if ( HasCondition( COND_SEE_ENEMY ) ) { // Trail the enemy a bit if he's moving @@ -5659,8 +5659,8 @@ void CAI_BaseNPC::GatherEnemyConditions( CBaseEntity *pEnemy ) { // if the enemy is not occluded, and unseen, that means it is behind or beside the npc. // if the enemy is near enough the npc, we go ahead and let the npc know where the - // enemy is. Send the enemy in as the informer so this knowledge will be regarded as - // secondhand so that the NPC doesn't + // enemy is. Send the enemy in as the informer so this knowledge will be regarded as + // secondhand so that the NPC doesn't UpdateEnemyMemory( pEnemy, pEnemy->GetAbsOrigin(), pEnemy ); } @@ -5748,7 +5748,7 @@ float CAI_BaseNPC::GetGoalRepathTolerance( CBaseEntity *pGoalEnt, GoalType_t typ float distToGoal = ( GetAbsOrigin() - curTargetPos ).Length() - GetNavigator()->GetArrivalDistance(); float distMoved1Sec = GetSmoothedVelocity().Length(); float result = 120; // FIXME: why 120? - + if (distMoved1Sec > 0.0) { float t = distToGoal / distMoved1Sec; @@ -5756,10 +5756,10 @@ float CAI_BaseNPC::GetGoalRepathTolerance( CBaseEntity *pGoalEnt, GoalType_t typ result = clamp( 120.f * t, 0.f, 120.f ); // Msg("t %.2f : d %.0f (%.0f)\n", t, result, distMoved1Sec ); } - + if ( !pGoalEnt->IsPlayer() ) result *= 1.20; - + return result; } @@ -5776,7 +5776,7 @@ void CAI_BaseNPC::UpdateEnemyPos() { // FIXME: does GetGoalRepathTolerance() limit re-routing enough to remove this? // m_UpdateEnemyPosTimer.Set( 0.5, 1.0 ); - + // If my enemy has moved significantly, or if the enemy has changed update my path if ( GetNavigator()->GetGoalType() == GOALTYPE_ENEMY ) { @@ -5794,7 +5794,7 @@ void CAI_BaseNPC::UpdateEnemyPos() // FIXME: when fleeing crowds, won't this severely limit the effectiveness of each individual? Shouldn't this be a mutex that's held for some period so that at least one attacker is effective? m_AnyUpdateEnemyPosTimer.Set( 0.1 ); // FIXME: what's a reasonable interval? if ( !GetNavigator()->RefindPathToGoal( false ) ) - { + { TaskFail( FAIL_NO_ROUTE ); } } @@ -5905,8 +5905,8 @@ CAI_BaseNPC *CAI_BaseNPC::CreateCustomTarget( const Vector &vecOrigin, float dur } //----------------------------------------------------------------------------- -// Purpose: -// Input : eNewActivity - +// Purpose: +// Input : eNewActivity - // Output : Activity //----------------------------------------------------------------------------- Activity CAI_BaseNPC::NPC_TranslateActivity( Activity eNewActivity ) @@ -6010,10 +6010,10 @@ Activity CAI_BaseNPC::TranslateActivity( Activity idealActivity, Activity *pIdea if ( last == ACT_SCRIPT_CUSTOM_MOVE ) return ACT_SCRIPT_CUSTOM_MOVE; - + if ( HaveSequenceForActivity( weaponTranslation ) ) return weaponTranslation; - + if ( bWeaponRequired ) { // only complain about an activity once @@ -6022,7 +6022,7 @@ Activity CAI_BaseNPC::TranslateActivity( Activity idealActivity, Activity *pIdea if (!sUniqueActivities.Find( weaponTranslation)) { // FIXME: warning - DevWarning( "%s missing activity \"%s\" needed by weapon\"%s\"\n", + DevWarning( "%s missing activity \"%s\" needed by weapon\"%s\"\n", GetClassname(), GetActivityName( weaponTranslation ), GetActiveWeapon()->GetClassname() ); sUniqueActivities.AddToTail( weaponTranslation ); @@ -6052,11 +6052,11 @@ Activity CAI_BaseNPC::TranslateActivity( Activity idealActivity, Activity *pIdea } //----------------------------------------------------------------------------- -// Purpose: -// Input : NewActivity - -// iSequence - -// translatedActivity - -// weaponActivity - +// Purpose: +// Input : NewActivity - +// iSequence - +// translatedActivity - +// weaponActivity - //----------------------------------------------------------------------------- void CAI_BaseNPC::ResolveActivityToSequence(Activity NewActivity, int &iSequence, Activity &translatedActivity, Activity &weaponActivity) { @@ -6105,11 +6105,11 @@ void CAI_BaseNPC::ResolveActivityToSequence(Activity NewActivity, int &iSequence //----------------------------------------------------------------------------- -// Purpose: -// Input : NewActivity - -// iSequence - -// translatedActivity - -// weaponActivity - +// Purpose: +// Input : NewActivity - +// iSequence - +// translatedActivity - +// weaponActivity - //----------------------------------------------------------------------------- extern ConVar ai_sequence_debug; @@ -6119,11 +6119,11 @@ void CAI_BaseNPC::SetActivityAndSequence(Activity NewActivity, int iSequence, Ac if (ai_sequence_debug.GetBool() == true && (m_debugOverlays & OVERLAY_NPC_SELECTED_BIT)) { - DevMsg("SetActivityAndSequence : %s: %s:%s -> %s:%s / %s:%s\n", GetClassname(), + DevMsg("SetActivityAndSequence : %s: %s:%s -> %s:%s / %s:%s\n", GetClassname(), GetActivityName(GetActivity()), GetSequenceName(GetSequence()), - GetActivityName(NewActivity), GetSequenceName(iSequence), + GetActivityName(NewActivity), GetSequenceName(iSequence), GetActivityName(translatedActivity), GetActivityName(weaponActivity) ); - + } // Set to the desired anim, or default anim if the desired is not present @@ -6133,7 +6133,7 @@ void CAI_BaseNPC::SetActivityAndSequence(Activity NewActivity, int iSequence, Ac { // // Don't reset frame between movement phased animations - if (!IsActivityMovementPhased( m_Activity ) || + if (!IsActivityMovementPhased( m_Activity ) || !IsActivityMovementPhased( NewActivity )) { SetCycle( 0 ); @@ -6173,7 +6173,7 @@ void CAI_BaseNPC::SetActivityAndSequence(Activity NewActivity, int iSequence, Ac //----------------------------------------------------------------------------- // Purpose: Sets the activity to the desired activity immediately, skipping any // transition sequences. -// Input : NewActivity - +// Input : NewActivity - //----------------------------------------------------------------------------- void CAI_BaseNPC::SetActivity( Activity NewActivity ) { @@ -6214,7 +6214,7 @@ void CAI_BaseNPC::SetActivity( Activity NewActivity ) //----------------------------------------------------------------------------- // Purpose: Sets the activity that we would like to transition toward. -// Input : NewActivity - +// Input : NewActivity - //----------------------------------------------------------------------------- void CAI_BaseNPC::SetIdealActivity( Activity NewActivity ) { @@ -6339,11 +6339,11 @@ void CAI_BaseNPC::MaintainActivity(void) { if (ai_sequence_debug.GetBool() == true && (m_debugOverlays & OVERLAY_NPC_SELECTED_BIT)) { - DevMsg("MaintainActivity %s : %s:%s -> %s:%s\n", GetClassname(), - GetActivityName(GetActivity()), GetSequenceName(GetSequence()), + DevMsg("MaintainActivity %s : %s:%s -> %s:%s\n", GetClassname(), + GetActivityName(GetActivity()), GetSequenceName(GetSequence()), GetActivityName(m_IdealActivity), GetSequenceName(m_nIdealSequence)); } - + bool bAdvance = false; // If we're in a transition activity, see if we are done with the transition. @@ -6365,7 +6365,7 @@ void CAI_BaseNPC::MaintainActivity(void) ResolveActivityToSequence(m_IdealActivity, m_nIdealSequence, m_IdealTranslatedActivity, m_IdealWeaponActivity); bAdvance = true; } - + if (bAdvance) { // Try to go to the next sequence closer to our ideal sequence. @@ -6406,11 +6406,11 @@ bool CAI_BaseNPC::IsActivityMovementPhased( Activity activity ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::OnChangeActivity( Activity eNewActivity ) { - if ( eNewActivity == ACT_RUN || + if ( eNewActivity == ACT_RUN || eNewActivity == ACT_RUN_AIM || eNewActivity == ACT_WALK ) { @@ -6561,7 +6561,7 @@ float CAI_BaseNPC::ThrowLimit( const Vector &vecStart, void CAI_BaseNPC::SetupVPhysicsHull() { #ifdef SDK2013CE - + if ( GetModelPtr() == NULL ) { UTIL_Remove(this); @@ -6575,7 +6575,7 @@ void CAI_BaseNPC::SetupVPhysicsHull() if ( VPhysicsGetObject() ) { - // Disable collisions to get + // Disable collisions to get VPhysicsGetObject()->EnableCollisions(false); VPhysicsDestroyObject(); } @@ -6603,7 +6603,7 @@ void CAI_BaseNPC::SetupVPhysicsHull() // Check for problematic physics objects resting on this NPC. -// They can screw up his navigation, so attach a controller to +// They can screw up his navigation, so attach a controller to // help separate the NPC & physics when you encounter these. ConVar ai_auto_contact_solver( "ai_auto_contact_solver", "1" ); void CAI_BaseNPC::CheckPhysicsContacts() @@ -6632,14 +6632,14 @@ void CAI_BaseNPC::CheckPhysicsContacts() { float otherMass = PhysGetEntityMass(pOtherEntity); - if ( pOtherEntity->GetMoveType() == MOVETYPE_VPHYSICS && pOther->IsMoveable() && + if ( pOtherEntity->GetMoveType() == MOVETYPE_VPHYSICS && pOther->IsMoveable() && otherMass < VPHYSICS_LARGE_OBJECT_MASS && !pOtherEntity->GetServerVehicle() ) { m_bCheckContacts = true; Vector vel, point; pOther->GetVelocity( &vel, NULL ); pSnapshot->GetContactPoint( point ); - + // compare the relative velocity vel -= npcVel; @@ -6704,7 +6704,7 @@ void CAI_BaseNPC::SetHullSizeNormal( bool force ) const float flScale = GetModelScale(); Vector vecMins = ( GetHullMins() * flScale ); Vector vecMaxs = ( GetHullMaxs() * flScale ); - + UTIL_SetSize( this, vecMins, vecMaxs ); m_fIsUsingSmallHull = false; @@ -6754,7 +6754,7 @@ bool CAI_BaseNPC::IsNavHullValid() const { Assert( VPhysicsGetObject() ); const CPhysCollide *pPhysCollide = VPhysicsGetObject()->GetCollide(); - physcollision->CollideGetAABB( &vecMins, &vecMaxs, pPhysCollide, GetAbsOrigin(), GetAbsAngles() ); + physcollision->CollideGetAABB( &vecMins, &vecMaxs, pPhysCollide, GetAbsOrigin(), GetAbsAngles() ); vecMins -= GetAbsOrigin(); vecMaxs -= GetAbsOrigin(); } @@ -6931,7 +6931,7 @@ void CAI_BaseNPC::NPCInit ( void ) m_flTimeLastMovement = FLT_MAX; m_flIgnoreDangerSoundsUntil = 0; - + SetDeathPose( ACT_INVALID ); SetDeathPoseFrame( 0 ); @@ -6998,7 +6998,7 @@ bool CAI_BaseNPC::CanHolsterWeapon( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- int CAI_BaseNPC::HolsterWeapon( void ) { @@ -7037,7 +7037,7 @@ int CAI_BaseNPC::HolsterWeapon( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- int CAI_BaseNPC::UnholsterWeapon( void ) { @@ -7070,7 +7070,7 @@ int CAI_BaseNPC::UnholsterWeapon( void ) // Refill the clip if ( GetActiveWeapon()->UsesClipsForAmmo1() ) { - GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1(); + GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1(); } // Make sure we don't try to reload while we're unholstering @@ -7086,7 +7086,7 @@ int CAI_BaseNPC::UnholsterWeapon( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::InputHolsterWeapon( inputdata_t &inputdata ) { @@ -7094,7 +7094,7 @@ void CAI_BaseNPC::InputHolsterWeapon( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::InputHolsterAndDestroyWeapon( inputdata_t &inputdata ) { @@ -7102,7 +7102,7 @@ void CAI_BaseNPC::InputHolsterAndDestroyWeapon( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::InputUnholsterWeapon( inputdata_t &inputdata ) { @@ -7110,7 +7110,7 @@ void CAI_BaseNPC::InputUnholsterWeapon( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::IsWeaponHolstered( void ) { @@ -7124,7 +7124,7 @@ bool CAI_BaseNPC::IsWeaponHolstered( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::IsWeaponStateChanging( void ) { @@ -7400,7 +7400,7 @@ void CAI_BaseNPC::StartNPC( void ) gm_flTimeLastSpawn = gpGlobals->curtime; } - static const float nextThinkTimes[20] = + static const float nextThinkTimes[20] = { .0, .150, .075, .225, .030, .180, .120, .270, .045, .210, .105, .255, .015, .165, .090, .240, .135, .060, .195, .285 }; @@ -7676,12 +7676,12 @@ bool CAI_BaseNPC::IsValidEnemy( CBaseEntity *pEnemy ) } -bool CAI_BaseNPC::CanBeAnEnemyOf( CBaseEntity *pEnemy ) -{ +bool CAI_BaseNPC::CanBeAnEnemyOf( CBaseEntity *pEnemy ) +{ if ( GetSleepState() > AISS_WAITING_FOR_THREAT ) return false; - return true; + return true; } @@ -7720,10 +7720,13 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void ) if (!pEnemy || !pEnemy->IsAlive()) { if ( pEnemy ) + { DbgEnemyMsg( this, " %s rejected: dead\n", pEnemy->GetDebugName() ); + } + continue; } - + if ( (pEnemy->GetFlags() & FL_NOTARGET) ) { DbgEnemyMsg( this, " %s rejected: no target\n", pEnemy->GetDebugName() ); @@ -7795,7 +7798,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(); @@ -7809,7 +7814,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. @@ -7832,7 +7839,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void ) ThreeState_t fCurSeen = TRS_NONE; ThreeState_t fCurVisible = TRS_NONE; - // The following code is constructed in such a verbose manner to + // The following code is constructed in such a verbose manner to // ensure the expensive calls only occur if absolutely needed // If current is farther, and best has previously been confirmed as seen or visible, move on @@ -7943,7 +7950,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; @@ -8110,10 +8119,10 @@ Vector CAI_BaseNPC::EyeOffset( Activity nActivity ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: // Output : Vector //----------------------------------------------------------------------------- -Vector CAI_BaseNPC::EyePosition( void ) +Vector CAI_BaseNPC::EyePosition( void ) { if ( IsCrouching() ) return GetAbsOrigin() + GetCrouchEyeOffset(); @@ -8393,7 +8402,7 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent ) if ( GetActiveWeapon() ) { GetActiveWeapon()->WeaponSound( RELOAD_NPC ); - GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1(); + GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1(); ClearCondition(COND_LOW_PRIMARY_AMMO); ClearCondition(COND_NO_PRIMARY_AMMO); ClearCondition(COND_NO_SECONDARY_AMMO); @@ -8414,7 +8423,7 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent ) { if ( GetActiveWeapon() ) { - GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1(); + GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1(); ClearCondition(COND_LOW_PRIMARY_AMMO); ClearCondition(COND_NO_PRIMARY_AMMO); ClearCondition(COND_NO_SECONDARY_AMMO); @@ -8434,7 +8443,7 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent ) { OpenPropDoorNow( pDoor ); } - + break; } @@ -8444,9 +8453,9 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent ) if (pEvent->event == AE_NPC_HOLSTER) { // Cache off the weapon. - CBaseCombatWeapon *pWeapon = GetActiveWeapon(); + CBaseCombatWeapon *pWeapon = GetActiveWeapon(); - Assert( pWeapon != NULL ); + Assert( pWeapon != NULL ); GetActiveWeapon()->Holster(); SetActiveWeapon( NULL ); @@ -8593,7 +8602,7 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent ) pTarget = this; pAttacker = m_hInteractionPartner; } - else if ( !Q_strncmp( pszParam, "THEM", 4 ) ) + else if ( !Q_strncmp( pszParam, "THEM", 4 ) ) { pAttacker = this; pTarget = m_hInteractionPartner; @@ -8617,7 +8626,7 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent ) } } } - + // Bad data. Explain how to use this anim event. const char *pName = EventList_NameForIndex( pEvent->event ); DevWarning( 1, "Bad %s format. Should be: { AE_NPC_HURT_INTERACTION_PARTNER \" \" }\n", pName ); @@ -8669,7 +8678,7 @@ void CAI_BaseNPC::DrawDebugGeometryOverlays(void) // ------------------------------ // properly kill an NPC. // ------------------------------ - if (m_debugOverlays & OVERLAY_NPC_KILL_BIT) + if (m_debugOverlays & OVERLAY_NPC_KILL_BIT) { CTakeDamageInfo info; @@ -8769,7 +8778,7 @@ void CAI_BaseNPC::DrawDebugGeometryOverlays(void) { if ( ppAIs[i] == NULL || ppAIs[i] == this ) continue; - + // Get our relation to the target nRelationship = IRelationType( ppAIs[i] ); @@ -9200,8 +9209,8 @@ int CAI_BaseNPC::DrawDebugTextOverlays(void) if ( GetAbsVelocity() != vec3_origin || GetLocalAngularVelocity() != vec3_angle ) { char tmp[512]; - Q_snprintf( tmp, sizeof(tmp), "Vel %.1f %.1f %.1f Ang: %.1f %.1f %.1f\n", - GetAbsVelocity().x, GetAbsVelocity().y, GetAbsVelocity().z, + Q_snprintf( tmp, sizeof(tmp), "Vel %.1f %.1f %.1f Ang: %.1f %.1f %.1f\n", + GetAbsVelocity().x, GetAbsVelocity().y, GetAbsVelocity().z, GetLocalAngularVelocity().x, GetLocalAngularVelocity().y, GetLocalAngularVelocity().z ); EntityText(text_offset,tmp,0); text_offset++; @@ -9353,7 +9362,7 @@ void CAI_BaseNPC::ReportOverThinkLimit( float time ) g_AIPostRunTimer.GetDuration().GetMillisecondsF(), g_AIMoveTimer.GetDuration().GetMillisecondsF() ); - if (ai_think_limit_label.GetBool()) + if (ai_think_limit_label.GetBool()) { Vector tmp; CollisionProp()->NormalizedToWorldSpace( Vector( 0.5f, 0.5f, 1.0f ), &tmp ); @@ -9459,8 +9468,8 @@ CanPlaySequence_t CAI_BaseNPC::CanPlaySequence( bool fDisregardNPCState, int int //----------------------------------------------------------------------------- -void CAI_BaseNPC::SetHintGroup( string_t newGroup, bool bHintGroupNavLimiting ) -{ +void CAI_BaseNPC::SetHintGroup( string_t newGroup, bool bHintGroupNavLimiting ) +{ string_t oldGroup = m_strHintGroup; m_strHintGroup = newGroup; m_bHintGroupNavLimiting = bHintGroupNavLimiting; @@ -9511,7 +9520,7 @@ Vector CAI_BaseNPC::GetShootEnemyDir( const Vector &shootOrigin, bool bNoisy ) } //----------------------------------------------------------------------------- -// Simulates many times and reports statistical accuracy. +// Simulates many times and reports statistical accuracy. //----------------------------------------------------------------------------- void CAI_BaseNPC::CollectShotStats( const Vector &vecShootOrigin, const Vector &vecShootDir ) { @@ -9597,7 +9606,7 @@ Vector CAI_BaseNPC::GetActualShootPosition( const Vector &shootOrigin ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- float CAI_BaseNPC::GetSpreadBias( CBaseCombatWeapon *pWeapon, CBaseEntity *pTarget ) { @@ -9665,17 +9674,17 @@ Vector CAI_BaseNPC::GetAttackSpread( CBaseCombatWeapon *pWeapon, CBaseEntity *pT } //----------------------------------------------------------------------------- -// Similar to calling GetShootEnemyDir, but returns the exact trajectory to -// fire the bullet along, after calculating for target speed, location, +// Similar to calling GetShootEnemyDir, but returns the exact trajectory to +// fire the bullet along, after calculating for target speed, location, // concealment, etc. // // Ultimately, this code results in the shooter aiming his weapon somewhere ahead of // a moving target. Since bullet traces are instant, aiming ahead of a target // will result in more misses than hits. This is designed to provide targets with -// a bonus when moving perpendicular to the shooter's line of sight. +// a bonus when moving perpendicular to the shooter's line of sight. // // Do not confuse this with leading a target in an effort to more easily hit it. -// +// // This code PENALIZES a target for moving directly along the shooter's line of sight. // // This code REWARDS a target for moving perpendicular to the shooter's line of sight. @@ -9707,7 +9716,7 @@ Vector CAI_BaseNPC::GetActualShootTrajectory( const Vector &shootOrigin ) Vector vecAimPos = GetEnemy()->EyePosition() + ( 48.0f * vecEnemyForward ) + (flVelocityScale * GetEnemy()->GetSmoothedVelocity() ); //NDebugOverlay::Cross3D(vecAimPos, Vector(-16,-16,-16), Vector(16,16,16), 255, 255, 0, true, 1.0f ); - + //vecAimPos.z = UTIL_WaterLevel( vecAimPos, vecAimPos.z, vecAimPos.z + 400.0f ); //NDebugOverlay::Cross3D(vecAimPos, Vector(-32,-32,-32), Vector(32,32,32), 255, 0, 0, true, 1.0f ); @@ -9745,14 +9754,14 @@ Vector CAI_BaseNPC::GetActualShootTrajectory( const Vector &shootOrigin ) // NOW we have a shoot direction. Where a 100% accurate bullet should go. // Modify it by weapon proficiency. - // construct a manipulator + // construct a manipulator CShotManipulator manipulator( shotDir ); // Apply appropriate accuracy. bool bUsePerfectAccuracy = false; if ( GetEnemy() && GetEnemy()->Classify() == CLASS_BULLSEYE ) { - CNPC_Bullseye *pBullseye = dynamic_cast(GetEnemy()); + CNPC_Bullseye *pBullseye = dynamic_cast(GetEnemy()); if ( pBullseye && pBullseye->UsePerfectAccuracy() ) { bUsePerfectAccuracy = true; @@ -9785,7 +9794,7 @@ Vector CAI_BaseNPC::GetActualShootTrajectory( const Vector &shootOrigin ) // Find something interesting around the enemy to shoot instead of just missing. CBaseEntity *pMissTarget = pEnemy->FindMissTarget(); - + if( pMissTarget ) { shotDir = pMissTarget->WorldSpaceCenter() - shootOrigin; @@ -9799,8 +9808,8 @@ Vector CAI_BaseNPC::GetActualShootTrajectory( const Vector &shootOrigin ) //----------------------------------------------------------------------------- -Vector CAI_BaseNPC::BodyTarget( const Vector &posSrc, bool bNoisy ) -{ +Vector CAI_BaseNPC::BodyTarget( const Vector &posSrc, bool bNoisy ) +{ Vector low = WorldSpaceCenter() - ( WorldSpaceCenter() - GetAbsOrigin() ) * .25; Vector high = EyePosition(); Vector delta = high - low; @@ -9813,7 +9822,7 @@ Vector CAI_BaseNPC::BodyTarget( const Vector &posSrc, bool bNoisy ) result = low + delta * rand1 + delta * rand2; } else - result = low + delta * 0.5; + result = low + delta * 0.5; return result; } @@ -9821,8 +9830,8 @@ Vector CAI_BaseNPC::BodyTarget( const Vector &posSrc, bool bNoisy ) //----------------------------------------------------------------------------- bool CAI_BaseNPC::ShouldMoveAndShoot() -{ - return ( ( CapabilitiesGet() & bits_CAP_MOVE_SHOOT ) != 0 ); +{ + return ( ( CapabilitiesGet() & bits_CAP_MOVE_SHOOT ) != 0 ); } @@ -10072,9 +10081,9 @@ bool CAI_BaseNPC::BBoxFlat ( void ) //----------------------------------------------------------------------------- -// Purpose: -// Input : *pEnemy - -// bSetCondNewEnemy - +// Purpose: +// Input : *pEnemy - +// bSetCondNewEnemy - //----------------------------------------------------------------------------- void CAI_BaseNPC::SetEnemy( CBaseEntity *pEnemy, bool bSetCondNewEnemy ) { @@ -10180,7 +10189,7 @@ bool CAI_BaseNPC::ShouldChooseNewEnemy() if ( m_FailChooseEnemyTimer.Expired() ) { m_FailChooseEnemyTimer.Set( 1.5 ); - if ( HasCondition( COND_TASK_FAILED ) || + if ( HasCondition( COND_TASK_FAILED ) || ( pInfo && ( pInfo->timeAtFirstHand == AI_INVALID_TIME || gpGlobals->curtime - pInfo->timeLastSeen > 10 ) ) ) { return true; @@ -10586,7 +10595,7 @@ BEGIN_DATADESC( CAI_BaseNPC ) DEFINE_KEYFIELD( m_flWakeRadius, FIELD_FLOAT, "wakeradius" ), DEFINE_KEYFIELD( m_bWakeSquad, FIELD_BOOLEAN, "wakesquad" ), DEFINE_FIELD( m_nWakeTick, FIELD_TICK ), - + DEFINE_CUSTOM_FIELD( m_Activity, ActivityDataOps() ), DEFINE_CUSTOM_FIELD( m_translatedActivity, ActivityDataOps() ), DEFINE_CUSTOM_FIELD( m_IdealActivity, ActivityDataOps() ), @@ -10851,7 +10860,7 @@ void CAI_BaseNPC::PostConstructor( const char *szClassname ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::Activate( void ) { @@ -10917,7 +10926,7 @@ const short AI_EXTENDED_SAVE_HEADER_FIRST_VERSION_WITH_NAVIGATOR_SAVE = 5; struct AIExtendedSaveHeader_t { AIExtendedSaveHeader_t() - : version(AI_EXTENDED_SAVE_HEADER_VERSION), + : version(AI_EXTENDED_SAVE_HEADER_VERSION), flags(0), scheduleCrc(0) { @@ -10934,7 +10943,7 @@ struct AIExtendedSaveHeader_t char szIdealSchedule[128]; char szFailSchedule[128]; char szSequence[128]; - + DECLARE_SIMPLE_DATADESC(); }; @@ -10962,14 +10971,14 @@ END_DATADESC() int CAI_BaseNPC::Save( ISave &save ) { AIExtendedSaveHeader_t saveHeader; - + if ( GetEnemy() ) saveHeader.flags |= AIESH_HAD_ENEMY; if ( GetTarget() ) saveHeader.flags |= AIESH_HAD_TARGET; if ( GetNavigator()->IsGoalActive() ) saveHeader.flags |= AIESH_HAD_NAVGOAL; - + if ( m_pSchedule ) { const char *pszSchedule = m_pSchedule->GetName(); @@ -11117,7 +11126,7 @@ int CAI_BaseNPC::Restore( IRestore &restore ) GetNavigator()->Restore( restore ); restore.EndBlock(); } - + // do a normal restore int status = BaseClass::Restore(restore); if ( !status ) @@ -11154,7 +11163,7 @@ int CAI_BaseNPC::Restore( IRestore &restore ) } bool bLostScript = ( m_NPCState == NPC_STATE_SCRIPT && m_hCine == NULL ); - bool bDiscardScheduleState = ( bLostScript || + bool bDiscardScheduleState = ( bLostScript || bLostSequence || saveHeader.szSchedule[0] == 0 || saveHeader.version < AI_EXTENDED_SAVE_HEADER_RESET_VERSION || @@ -11186,7 +11195,7 @@ int CAI_BaseNPC::Restore( IRestore &restore ) if ( !bDiscardScheduleState ) m_bDoPostRestoreRefindPath = ( ( saveHeader.flags & AIESH_HAD_NAVGOAL) != 0 ); - else + else { m_bDoPostRestoreRefindPath = false; DiscardScheduleState(); @@ -11239,7 +11248,7 @@ bool CAI_BaseNPC::KeyValue( const char *szKeyName, const char *szValue ) { // Defer unhandled Keys to behaviors CAI_BehaviorBase **ppBehaviors = AccessBehaviors(); - + for ( int i = 0; i < NumBehaviors(); i++ ) { if( ppBehaviors[ i ]->KeyValue( szKeyName, szValue ) ) @@ -11255,7 +11264,7 @@ bool CAI_BaseNPC::KeyValue( const char *szKeyName, const char *szValue ) //----------------------------------------------------------------------------- // Purpose: Debug function to make this NPC freeze in place (or unfreeze). //----------------------------------------------------------------------------- -void CAI_BaseNPC::ToggleFreeze(void) +void CAI_BaseNPC::ToggleFreeze(void) { if (!IsCurSchedule(SCHED_NPC_FREEZE)) { @@ -11371,7 +11380,7 @@ CAI_BaseNPC::CAI_BaseNPC(void) m_nDebugPauseIndex = 0; g_AI_Manager.AddAI( this ); - + if ( g_AI_Manager.NumAIs() == 1 ) { m_AnyUpdateEnemyPosTimer.Force(); @@ -11382,7 +11391,7 @@ CAI_BaseNPC::CAI_BaseNPC(void) m_iFrameBlocked = -1; m_bInChoreo = true; // assume so until call to UpdateEfficiency() - + SetCollisionGroup( COLLISION_GROUP_NPC ); } @@ -11464,11 +11473,11 @@ bool CAI_BaseNPC::CreateComponents() m_pPathfinder = CreatePathfinder(); if ( !m_pPathfinder ) return false; - + m_pTacticalServices = CreateTacticalServices(); if ( !m_pTacticalServices ) return false; - + m_MoveAndShootOverlay.SetOuter( this ); m_pMotor->Init( m_pLocalNavigator ); @@ -11476,7 +11485,7 @@ bool CAI_BaseNPC::CreateComponents() m_pNavigator->Init( g_pBigAINet ); m_pPathfinder->Init( g_pBigAINet ); m_pTacticalServices->Init( g_pBigAINet ); - + return true; } @@ -11568,7 +11577,7 @@ void CAI_BaseNPC::InputSetHealth( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::InputBeginRappel( inputdata_t &inputdata ) { @@ -11679,8 +11688,8 @@ void CAI_BaseNPC::InputUpdateEnemyMemory( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : &inputdata - +// Purpose: +// Input : &inputdata - //----------------------------------------------------------------------------- void CAI_BaseNPC::InputOutsideTransition( inputdata_t &inputdata ) { @@ -11688,7 +11697,7 @@ void CAI_BaseNPC::InputOutsideTransition( inputdata_t &inputdata ) //----------------------------------------------------------------------------- // Purpose: Called when this NPC transitions to another level with the player -// Input : &inputdata - +// Input : &inputdata - //----------------------------------------------------------------------------- void CAI_BaseNPC::InputInsideTransition( inputdata_t &inputdata ) { @@ -11702,7 +11711,7 @@ void CAI_BaseNPC::InputInsideTransition( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::CleanupScriptsOnTeleport( bool bEnrouteAsWell ) { @@ -11735,7 +11744,7 @@ bool CAI_BaseNPC::HandleInteraction(int interactionType, void *data, CBaseCombat #ifdef HL2_DLL if ( interactionType == g_interactionBarnacleVictimGrab ) { - // Make the victim stop thinking so they're as good as dead without + // Make the victim stop thinking so they're as good as dead without // shocking the system by destroying the entity. StopLoopingSounds(); BarnacleDeathSound(); @@ -11825,7 +11834,7 @@ bool CAI_BaseNPC::CineCleanup() m_hCine->SetTarget( NULL ); // NOTE that this will have had EF_NODRAW removed in script.dll when it's cached off SetEffects( m_hCine->m_saved_effects ); - + SetCollisionGroup( m_hCine->m_savedCollisionGroup ); } else @@ -11833,7 +11842,7 @@ bool CAI_BaseNPC::CineCleanup() // arg, punt AddSolidFlags( FSOLID_NOT_STANDABLE ); } - + m_hCine = NULL; SetTarget( NULL ); SetGoalEnt( NULL ); @@ -11844,7 +11853,7 @@ bool CAI_BaseNPC::CineCleanup() { m_iHealth = 0; } - + AddSolidFlags( FSOLID_NOT_SOLID ); SetState( NPC_STATE_DEAD ); m_lifeState = LIFE_DEAD; @@ -12040,7 +12049,7 @@ bool CAI_BaseNPC::FindSpotForNPCInRadius( Vector *pResult, const Vector &vStartP bool CAI_BaseNPC::IsNavigationUrgent() { // return true if the navigation is for something that can't react well to failure - if ( IsCurSchedule( SCHED_SCRIPTED_WALK, false ) || + if ( IsCurSchedule( SCHED_SCRIPTED_WALK, false ) || IsCurSchedule( SCHED_SCRIPTED_RUN, false ) || IsCurSchedule( SCHED_SCRIPTED_CUSTOM_MOVE, false ) || ( IsCurSchedule( SCHED_SCENE_GENERIC, false ) && IsInLockedScene() ) ) @@ -12070,7 +12079,7 @@ bool CAI_BaseNPC::ShouldFailNav( bool bMovementFailed ) #endif // HL2_EPISODIC - // It's up to the schedule that requested movement to deal with failed movement. Currently, only a handfull of + // It's up to the schedule that requested movement to deal with failed movement. Currently, only a handfull of // schedules are considered Urgent, and they need to deal with what to do when there's no route, which by inspection // they'd don't. @@ -12196,15 +12205,15 @@ bool CAI_BaseNPC::OnObstructingDoor( AILocalMoveGoal_t *pMoveGoal, //----------------------------------------------------------------------------- -// Purpose: -// Input : pMoveGoal - -// pDoor - -// distClear - -// default - -// spawn - -// oldorg - -// pfPosition - -// neworg - +// Purpose: +// Input : pMoveGoal - +// pDoor - +// distClear - +// default - +// spawn - +// oldorg - +// pfPosition - +// neworg - // Output : Returns true if movement is solved, false otherwise. //----------------------------------------------------------------------------- @@ -12237,17 +12246,17 @@ bool CAI_BaseNPC::OnUpcomingPropDoor( AILocalMoveGoal_t *pMoveGoal, opendata_t opendata; pDoor->GetNPCOpenData(this, opendata); - + // dvs: FIXME: local route might not be sufficient pOpenDoorRoute = GetPathfinder()->BuildLocalRoute( - GetLocalOrigin(), + GetLocalOrigin(), opendata.vecStandPos, - NULL, - bits_WP_TO_DOOR | bits_WP_DONT_SIMPLIFY, + NULL, + bits_WP_TO_DOOR | bits_WP_DONT_SIMPLIFY, NO_NODE, bits_BUILD_GROUND | bits_BUILD_IGNORE_NPCS, 0.0); - + if ( pOpenDoorRoute ) { if ( AIIsDebuggingDoors(this) ) @@ -12266,7 +12275,7 @@ bool CAI_BaseNPC::OnUpcomingPropDoor( AILocalMoveGoal_t *pMoveGoal, m_hOpeningDoor = pDoor; pMoveGoal->maxDist = distClear; *pResult = AIMR_CHANGE_TYPE; - + return true; } else @@ -12316,7 +12325,7 @@ void CAI_BaseNPC::OpenPropDoorNow( CBasePropDoor *pDoor ) //----------------------------------------------------------------------------- // Purpose: Called when the door we were trying to open becomes fully open. -// Input : pDoor - +// Input : pDoor - //----------------------------------------------------------------------------- void CAI_BaseNPC::OnDoorFullyOpen(CBasePropDoor *pDoor) { @@ -12327,7 +12336,7 @@ void CAI_BaseNPC::OnDoorFullyOpen(CBasePropDoor *pDoor) //----------------------------------------------------------------------------- // Purpose: Called when the door we were trying to open becomes blocked before opening. -// Input : pDoor - +// Input : pDoor - //----------------------------------------------------------------------------- void CAI_BaseNPC::OnDoorBlocked(CBasePropDoor *pDoor) { @@ -12360,10 +12369,10 @@ int CAI_BaseNPC::FlyMove( const Vector& pfPosition, unsigned int mask ) Vector oldorg, neworg; trace_t trace; - // try the move + // try the move VectorCopy( GetAbsOrigin(), oldorg ); VectorAdd( oldorg, pfPosition, neworg ); - UTIL_TraceEntity( this, oldorg, neworg, mask, &trace ); + UTIL_TraceEntity( this, oldorg, neworg, mask, &trace ); if (trace.fraction == 1) { if ( (GetFlags() & FL_SWIM) && enginetrace->GetPointContents(trace.endpos) == CONTENTS_EMPTY ) @@ -12379,15 +12388,15 @@ int CAI_BaseNPC::FlyMove( const Vector& pfPosition, unsigned int mask ) //----------------------------------------------------------------------------- -// Purpose: -// Input : ent - +// Purpose: +// Input : ent - // Dir - Normalized direction vector for movement. // dist - Distance along 'Dir' to move. -// iMode - +// iMode - // Output : Returns nonzero on success, zero on failure. //----------------------------------------------------------------------------- int CAI_BaseNPC::WalkMove( const Vector& vecPosition, unsigned int mask ) -{ +{ if ( GetFlags() & (FL_FLY | FL_SWIM) ) { return FlyMove( vecPosition, mask ); @@ -12432,7 +12441,7 @@ int CAI_BaseNPC::WalkMove( const Vector& vecPosition, unsigned int mask ) SetGroundEntity( NULL ); return true; } - + return false; // walked off an edge } @@ -12442,7 +12451,7 @@ int CAI_BaseNPC::WalkMove( const Vector& vecPosition, unsigned int mask ) if (UTIL_CheckBottom( this, NULL, flStepSize ) == 0) { if ( GetFlags() & FL_PARTIALGROUND ) - { + { // entity had floor mostly pulled out from underneath it // and is trying to correct PhysicsTouchTriggers(); @@ -12456,7 +12465,7 @@ int CAI_BaseNPC::WalkMove( const Vector& vecPosition, unsigned int mask ) if ( GetFlags() & FL_PARTIALGROUND ) { - // Con_Printf ("back on ground\n"); + // Con_Printf ("back on ground\n"); RemoveFlag( FL_PARTIALGROUND ); } @@ -12480,9 +12489,9 @@ static void AIMsgGuts( CAI_BaseNPC *pAI, unsigned flags, const char *pszMsg ) } else pszFmt2 = "%s (%s: %d/%s) [%d]"; - - DevMsg( pszFmt2, - pszMsg, + + DevMsg( pszFmt2, + pszMsg, pAI->GetClassname(), pAI->entindex(), ( pAI->GetEntityName() == NULL_STRING ) ? "" : STRING(pAI->GetEntityName()), @@ -12521,11 +12530,11 @@ void DevMsg( CAI_BaseNPC *pAI, const char *pszFormat, ... ) //----------------------------------------------------------------------------- -bool CAI_BaseNPC::IsPlayerAlly( CBasePlayer *pPlayer ) -{ +bool CAI_BaseNPC::IsPlayerAlly( CBasePlayer *pPlayer ) +{ if ( pPlayer == NULL ) { - // in multiplayer mode we need a valid pPlayer + // in multiplayer mode we need a valid pPlayer // or override this virtual function if ( !AI_IsSinglePlayer() ) return false; @@ -12534,30 +12543,30 @@ bool CAI_BaseNPC::IsPlayerAlly( CBasePlayer *pPlayer ) pPlayer = UTIL_GetLocalPlayer(); } - return ( !pPlayer || IRelationType( pPlayer ) == D_LI ); + return ( !pPlayer || IRelationType( pPlayer ) == D_LI ); } //----------------------------------------------------------------------------- void CAI_BaseNPC::SetCommandGoal( const Vector &vecGoal ) -{ - m_vecCommandGoal = vecGoal; - m_CommandMoveMonitor.ClearMark(); +{ + m_vecCommandGoal = vecGoal; + m_CommandMoveMonitor.ClearMark(); } //----------------------------------------------------------------------------- void CAI_BaseNPC::ClearCommandGoal() -{ - m_vecCommandGoal = vec3_invalid; - m_CommandMoveMonitor.ClearMark(); +{ + m_vecCommandGoal = vec3_invalid; + m_CommandMoveMonitor.ClearMark(); } //----------------------------------------------------------------------------- bool CAI_BaseNPC::IsInPlayerSquad() const -{ - return ( m_pSquad && MAKE_STRING(m_pSquad->GetName()) == GetPlayerSquadName() && !CAI_Squad::IsSilentMember(this) ); +{ + return ( m_pSquad && MAKE_STRING(m_pSquad->GetName()) == GetPlayerSquadName() && !CAI_Squad::IsSilentMember(this) ); } @@ -12680,7 +12689,7 @@ void CAI_BaseNPC::TestPlayerPushing( CBaseEntity *pEntity ) CBasePlayer *pPlayer = ToBasePlayer( pEntity ); if ( pPlayer && !( pPlayer->GetFlags() & FL_NOTARGET ) ) { - if ( (pPlayer->m_nButtons & (IN_FORWARD|IN_BACK|IN_MOVELEFT|IN_MOVERIGHT)) || + if ( (pPlayer->m_nButtons & (IN_FORWARD|IN_BACK|IN_MOVELEFT|IN_MOVERIGHT)) || pPlayer->GetAbsVelocity().AsVector2D().LengthSqr() > 50*50 ) { SetCondition( COND_PLAYER_PUSHING ); @@ -12808,12 +12817,12 @@ bool CAI_BaseNPC::FindNearestValidGoalPos( const Vector &vTestPoint, Vector *pRe int iNearestNode = GetPathfinder()->NearestNodeToPoint( vTestPoint ); if ( iNearestNode != NO_NODE ) { - GetMoveProbe()->MoveLimit( NAV_GROUND, - g_pBigAINet->GetNodePosition(GetHullType(), iNearestNode ), - vTestPoint, - MASK_SOLID_BRUSHONLY, - NULL, - 0, + GetMoveProbe()->MoveLimit( NAV_GROUND, + g_pBigAINet->GetNodePosition(GetHullType(), iNearestNode ), + vTestPoint, + MASK_SOLID_BRUSHONLY, + NULL, + 0, &moveTrace ); if ( ( moveTrace.vEndPosition - vTestPoint ).Length2DSqr() < Square( GetHullWidth() * 3.0 ) && GetMoveProbe()->CheckStandPosition( moveTrace.vEndPosition, MASK_SOLID_BRUSHONLY ) ) @@ -12838,12 +12847,12 @@ bool CAI_BaseNPC::FindNearestValidGoalPos( const Vector &vTestPoint, Vector *pRe if ( vCandidate == vec3_invalid ) { - GetMoveProbe()->MoveLimit( NAV_GROUND, - GetAbsOrigin(), - vTestPoint, - MASK_SOLID_BRUSHONLY, - NULL, - 0, + GetMoveProbe()->MoveLimit( NAV_GROUND, + GetAbsOrigin(), + vTestPoint, + MASK_SOLID_BRUSHONLY, + NULL, + 0, &moveTrace ); vCandidate = moveTrace.vEndPosition; } @@ -12876,12 +12885,12 @@ float CAI_BaseNPC::LineOfSightDist( const Vector &vecDir, float zEye ) testDir = vecDir; } - if ( zEye == FLT_MAX ) + if ( zEye == FLT_MAX ) zEye = EyePosition().z; - + trace_t tr; // Need to center trace so don't get erratic results based on orientation - Vector testPos( GetAbsOrigin().x, GetAbsOrigin().y, zEye ); + Vector testPos( GetAbsOrigin().x, GetAbsOrigin().y, zEye ); AI_TraceLOS( testPos, testPos + testDir * MAX_COORD_RANGE, this, &tr ); return (tr.startpos - tr.endpos ).Length(); } @@ -12921,10 +12930,10 @@ void CAI_BaseNPC::InputSetSpeedModifierSpeed( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- -bool CAI_BaseNPC::IsAllowedToDodge( void ) -{ +bool CAI_BaseNPC::IsAllowedToDodge( void ) +{ // Can't do it if I'm not available if ( m_NPCState != NPC_STATE_IDLE && m_NPCState != NPC_STATE_ALERT && m_NPCState != NPC_STATE_COMBAT ) return false; @@ -12933,12 +12942,12 @@ bool CAI_BaseNPC::IsAllowedToDodge( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::ParseScriptedNPCInteractions( void ) { // Already parsed them? - if ( m_ScriptedInteractions.Count() ) + if ( m_ScriptedInteractions.Count() ) return; // Parse the model's key values and find any dynamic interactions @@ -12947,7 +12956,7 @@ void CAI_BaseNPC::ParseScriptedNPCInteractions( void ) if (! modelinfo->GetModelKeyValue( GetModel(), buf )) return; - + if ( modelKeyValues->LoadFromBuffer( modelinfo->GetModelName( GetModel() ), buf ) ) { // Do we have a dynamic interactions section? @@ -13004,7 +13013,7 @@ void CAI_BaseNPC::ParseScriptedNPCInteractions( void ) UTIL_StringToVector( sInteraction.angRelativeAngles.Base(), pszAngles ); } - // Velocity + // Velocity const char *pszVelocity = pkvNode->GetString( "velocity_relative", NULL ); if ( pszVelocity ) { @@ -13071,7 +13080,7 @@ void CAI_BaseNPC::ParseScriptedNPCInteractions( void ) { sInteraction.iFlags |= SCNPC_FLAG_DONT_TELEPORT_AT_END_ME; } - else if ( !Q_stricmp( pszDontFixup, "them" ) || !Q_stricmp( pszDontFixup, "both" ) ) + else if ( !Q_stricmp( pszDontFixup, "them" ) || !Q_stricmp( pszDontFixup, "both" ) ) { sInteraction.iFlags |= SCNPC_FLAG_DONT_TELEPORT_AT_END_THEM; } @@ -13085,11 +13094,11 @@ void CAI_BaseNPC::ParseScriptedNPCInteractions( void ) { sInteraction.iFlags |= SCNPC_FLAG_NEEDS_WEAPON_ME; } - else if ( !Q_strncmp( pszNeedsWeapon, "THEM", 4 ) ) + else if ( !Q_strncmp( pszNeedsWeapon, "THEM", 4 ) ) { sInteraction.iFlags |= SCNPC_FLAG_NEEDS_WEAPON_THEM; } - else if ( !Q_strncmp( pszNeedsWeapon, "BOTH", 4 ) ) + else if ( !Q_strncmp( pszNeedsWeapon, "BOTH", 4 ) ) { sInteraction.iFlags |= SCNPC_FLAG_NEEDS_WEAPON_ME; sInteraction.iFlags |= SCNPC_FLAG_NEEDS_WEAPON_THEM; @@ -13123,7 +13132,7 @@ void CAI_BaseNPC::ParseScriptedNPCInteractions( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::AddScriptedNPCInteraction( ScriptedNPCInteraction_t *pInteraction ) { @@ -13143,7 +13152,7 @@ void CAI_BaseNPC::AddScriptedNPCInteraction( ScriptedNPCInteraction_t *pInteract } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- const char *CAI_BaseNPC::GetScriptedNPCInteractionSequence( ScriptedNPCInteraction_t *pInteraction, int iPhase ) { @@ -13160,7 +13169,7 @@ const char *CAI_BaseNPC::GetScriptedNPCInteractionSequence( ScriptedNPCInteracti } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::StartRunningInteraction( CAI_BaseNPC *pOtherNPC, bool bActive ) { @@ -13182,13 +13191,13 @@ void CAI_BaseNPC::StartRunningInteraction( CAI_BaseNPC *pOtherNPC, bool bActive // Prepare the NPC for the script. Setting this allows the scripted sequences // that we're about to create to immediately grab & use this NPC right away. - // This prevents the NPC from being able to make any schedule decisions + // This prevents the NPC from being able to make any schedule decisions // before the DSS gets underway. m_scriptState = SCRIPT_PLAYING; } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::StartScriptedNPCInteraction( CAI_BaseNPC *pOtherNPC, ScriptedNPCInteraction_t *pInteraction, Vector vecOtherOrigin, QAngle angOtherAngles ) { @@ -13281,7 +13290,7 @@ void CAI_BaseNPC::StartScriptedNPCInteraction( CAI_BaseNPC *pOtherNPC, ScriptedN pTheirSequence->ForceSetTargetEntity( pOtherNPC, true ); pTheirSequence->SetName( iszSSName ); pTheirSequence->AddSpawnFlags( SF_SCRIPT_NOINTERRUPT | SF_SCRIPT_HIGH_PRIORITY | SF_SCRIPT_OVERRIDESTATE ); - if ((pInteraction->iFlags & SCNPC_FLAG_DONT_TELEPORT_AT_END_THEM) != 0) + if ((pInteraction->iFlags & SCNPC_FLAG_DONT_TELEPORT_AT_END_THEM) != 0) { pTheirSequence->AddSpawnFlags( SF_SCRIPT_DONT_TELEPORT_AT_END ); } @@ -13342,7 +13351,7 @@ void CAI_BaseNPC::StartScriptedNPCInteraction( CAI_BaseNPC *pOtherNPC, ScriptedN } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::CanRunAScriptedNPCInteraction( bool bForced ) { @@ -13385,7 +13394,7 @@ bool CAI_BaseNPC::CanRunAScriptedNPCInteraction( bool bForced ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::CheckForScriptedNPCInteractions( void ) { @@ -13531,7 +13540,7 @@ void CAI_BaseNPC::CalculateValidEnemyInteractions( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::CheckForcedNPCInteractions( void ) { @@ -13576,7 +13585,7 @@ void CAI_BaseNPC::CheckForcedNPCInteractions( void ) } } } - + if ( bAbort ) { if ( m_hForcedInteractionPartner ) @@ -13660,7 +13669,7 @@ bool CanNPCsTradePlaces( CAI_BaseNPC *pNPC1, CAI_BaseNPC *pNPC2, bool bDebug ) //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::InteractionCouldStart( CAI_BaseNPC *pOtherNPC, ScriptedNPCInteraction_t *pInteraction, Vector &vecOrigin, QAngle &angAngles ) { @@ -13786,7 +13795,7 @@ bool CAI_BaseNPC::InteractionCouldStart( CAI_BaseNPC *pOtherNPC, ScriptedNPCInte } // Finally, make sure the NPC can actually fit at the interaction position - // This solves problems with NPCs who are a few units or so above the + // This solves problems with NPCs who are a few units or so above the // interaction point, and would sink into the ground when playing the anim. CTraceFilterSkipTwoEntities traceFilter( pOtherNPC, this, COLLISION_GROUP_NONE ); AI_TraceHull( vecOrigin, vecOrigin, pOtherNPC->GetHullMins(), pOtherNPC->GetHullMaxs(), MASK_SOLID, &traceFilter, &tr ); @@ -13805,7 +13814,7 @@ bool CAI_BaseNPC::InteractionCouldStart( CAI_BaseNPC *pOtherNPC, ScriptedNPCInte { return false; } - + return true; } @@ -13819,8 +13828,8 @@ bool CAI_BaseNPC::HasInteractionCantDie( void ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : &inputdata - +// Purpose: +// Input : &inputdata - //----------------------------------------------------------------------------- void CAI_BaseNPC::InputForceInteractionWithNPC( inputdata_t &inputdata ) { @@ -13898,7 +13907,7 @@ void CAI_BaseNPC::InputForceInteractionWithNPC( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::StartForcedInteraction( CAI_BaseNPC *pNPC, int iInteraction ) { @@ -13911,7 +13920,7 @@ void CAI_BaseNPC::StartForcedInteraction( CAI_BaseNPC *pNPC, int iInteraction ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::CleanupForcedInteraction( void ) { @@ -13923,7 +13932,7 @@ void CAI_BaseNPC::CleanupForcedInteraction( void ) //----------------------------------------------------------------------------- // Purpose: Calculate a position to move to so that I can interact with my -// target NPC. +// target NPC. // // FIXME: THIS ONLY WORKS FOR INTERACTIONS THAT REQUIRE THE TARGET // NPC TO BE SOME DISTANCE DIRECTLY IN FRONT OF ME. @@ -13953,8 +13962,8 @@ void CAI_BaseNPC::CalculateForcedInteractionPosition( void ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : *pPlayer - +// Purpose: +// Input : *pPlayer - //----------------------------------------------------------------------------- void CAI_BaseNPC::PlayerHasIlluminatedNPC( CBasePlayer *pPlayer, float flDot ) { @@ -13979,7 +13988,7 @@ void CAI_BaseNPC::PlayerHasIlluminatedNPC( CBasePlayer *pPlayer, float flDot ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CAI_BaseNPC::ModifyOrAppendCriteria( AI_CriteriaSet& set ) { @@ -14019,7 +14028,7 @@ bool CAI_BaseNPC::CouldShootIfCrouching( CBaseEntity *pTarget ) { vecTarget = pTarget->BodyTarget( GetActiveWeapon()->GetLocalOrigin() ); } - else + else { vecTarget = pTarget->BodyTarget( GetLocalOrigin() ); } @@ -14035,7 +14044,7 @@ bool CAI_BaseNPC::CouldShootIfCrouching( CBaseEntity *pTarget ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::IsCrouchedActivity( Activity activity ) { @@ -14078,7 +14087,7 @@ Vector CAI_BaseNPC::Weapon_ShootPosition( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::ShouldProbeCollideAgainstEntity( CBaseEntity *pEntity ) { @@ -14097,16 +14106,16 @@ bool CAI_BaseNPC::ShouldProbeCollideAgainstEntity( CBaseEntity *pEntity ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::Crouch( void ) -{ - m_bIsCrouching = true; +{ + m_bIsCrouching = true; return true; } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::IsCrouching( void ) { @@ -14114,24 +14123,24 @@ bool CAI_BaseNPC::IsCrouching( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CAI_BaseNPC::Stand( void ) -{ +{ if ( m_bForceCrouch ) return false; - m_bIsCrouching = false; - DesireStand(); + m_bIsCrouching = false; + DesireStand(); return true; } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- -void CAI_BaseNPC::DesireCrouch( void ) -{ - m_bCrouchDesired = true; +void CAI_BaseNPC::DesireCrouch( void ) +{ + m_bCrouchDesired = true; } bool CAI_BaseNPC::IsInChoreo() const diff --git a/sp/src/game/server/baseentity.cpp b/sp/src/game/server/baseentity.cpp index b42f2abe..808aeb4f 100644 --- a/sp/src/game/server/baseentity.cpp +++ b/sp/src/game/server/baseentity.cpp @@ -111,7 +111,7 @@ void SendProxy_AnimTime( const SendProp *pProp, const void *pStruct, const void Assert( !pAnimating->IsUsingClientSideAnimation() ); } #endif - + int ticknumber = TIME_TO_TICKS( pEntity->m_flAnimTime ); // Tickbase is current tick rounded down to closes 100 ticks int tickbase = gpGlobals->GetNetworkBase( gpGlobals->tickcount, pEntity->entindex() ); @@ -151,12 +151,12 @@ void* SendProxy_ClientSideAnimation( const SendProp *pProp, const void *pStruct, return (void*)pVarData; else return NULL; // Don't send animtime unless the client needs it. -} +} REGISTER_SEND_PROXY_NON_MODIFIED_POINTER( SendProxy_ClientSideAnimation ); BEGIN_SEND_TABLE_NOBASE( CBaseEntity, DT_AnimTimeMustBeFirst ) - // NOTE: Animtime must be sent before origin and angles ( from pev ) because it has a + // NOTE: Animtime must be sent before origin and angles ( from pev ) because it has a // proxy on the client that stores off the old values before writing in the new values and // if it is sent after the new values, then it will only have the new origin and studio model, etc. // interpolation will be busted @@ -178,7 +178,7 @@ static void* SendProxy_SendPredictableId( const SendProp *pProp, const void *pSt int id_player_index = pEntity->m_PredictableID->GetPlayer(); pRecipients->SetOnly( id_player_index ); - + return ( void * )pVarData; } REGISTER_SEND_PROXY_NON_MODIFIED_POINTER( SendProxy_SendPredictableId ); @@ -261,7 +261,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CBaseEntity, DT_BaseEntity ) SendPropDataTable( "AnimTimeMustBeFirst", 0, &REFERENCE_SEND_TABLE(DT_AnimTimeMustBeFirst), SendProxy_ClientSideAnimation ), SendPropInt (SENDINFO(m_flSimulationTime), SIMULATION_TIME_WINDOW_BITS, SPROP_UNSIGNED|SPROP_CHANGES_OFTEN|SPROP_ENCODED_AGAINST_TICKCOUNT, SendProxy_SimulationTime), -#if PREDICTION_ERROR_CHECK_LEVEL > 1 +#if PREDICTION_ERROR_CHECK_LEVEL > 1 SendPropVector (SENDINFO(m_vecOrigin), -1, SPROP_NOSCALE|SPROP_CHANGES_OFTEN, 0.0f, HIGH_DEFAULT, SendProxy_Origin ), #else SendPropVector (SENDINFO(m_vecOrigin), -1, SPROP_COORD|SPROP_CHANGES_OFTEN, 0.0f, HIGH_DEFAULT, SendProxy_Origin ), @@ -285,7 +285,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CBaseEntity, DT_BaseEntity ) SendPropInt (SENDINFO_NAME( m_MoveType, movetype ), MOVETYPE_MAX_BITS, SPROP_UNSIGNED ), SendPropInt (SENDINFO_NAME( m_MoveCollide, movecollide ), MOVECOLLIDE_MAX_BITS, SPROP_UNSIGNED ), -#if PREDICTION_ERROR_CHECK_LEVEL > 1 +#if PREDICTION_ERROR_CHECK_LEVEL > 1 SendPropVector (SENDINFO(m_angRotation), -1, SPROP_NOSCALE|SPROP_CHANGES_OFTEN, 0, HIGH_DEFAULT, SendProxy_Angles ), #else SendPropQAngles (SENDINFO(m_angRotation), 13, SPROP_CHANGES_OFTEN, SendProxy_Angles ), @@ -490,14 +490,14 @@ void CBaseEntity::PostConstructor( const char *szClassname ) NetworkProp()->AttachEdict( g_pForceAttachEdict ); g_pForceAttachEdict = NULL; } - + // Some ents like the player override the AttachEdict function and do it at a different time. // While precaching, they don't ever have an edict, so we don't need to add them to // the entity list in that case. if ( edict() ) { gEntList.AddNetworkableEntity( this, entindex() ); - + // Cache our IServerNetworkable pointer for the engine for fast access. if ( edict() ) edict()->m_pNetworkable = NetworkProp(); @@ -540,7 +540,7 @@ static void AddDataMapFieldNamesToList( KeyValueNameList_t &list, datamap_t *pDa list.AddToTail( pField->externalName ); } } - + pDataMap = pDataMap->baseMap; } } @@ -629,11 +629,11 @@ void CBaseEntity::SetModelIndex( int index ) { sg_DynamicLoadHandlers.Remove( this ); } - + modelinfo->ReleaseDynamicModel( m_nModelIndex ); modelinfo->AddRefDynamicModel( index ); m_nModelIndex = index; - + m_bDynamicModelSetBounds = false; if ( IsDynamicModelIndex( index ) ) @@ -668,15 +668,15 @@ void CBaseEntity::SetModelIndexOverride( int index, int nValue ) if ( nValue != m_nModelIndexOverrides[index] ) { m_nModelIndexOverrides.Set( index, nValue ); - } + } } #endif } - + // position to shoot at -Vector CBaseEntity::BodyTarget( const Vector &posSrc, bool bNoisy) -{ - return WorldSpaceCenter( ); +Vector CBaseEntity::BodyTarget( const Vector &posSrc, bool bNoisy) +{ + return WorldSpaceCenter( ); } // return the position of my head. someone's trying to attack it. @@ -691,7 +691,7 @@ struct TimedOverlay_t char *msg; int msgEndTime; int msgStartTime; - TimedOverlay_t *pNextTimedOverlay; + TimedOverlay_t *pNextTimedOverlay; }; //----------------------------------------------------------------------------- @@ -757,7 +757,7 @@ void CBaseEntity::DrawAbsBoxOverlay() } void CBaseEntity::DrawRBoxOverlay() -{ +{ } @@ -814,7 +814,7 @@ void CBaseEntity::DrawTimedOverlays(void) Q_snprintf( tempstr, sizeof( tempstr ), "[%s]", GetDebugName() ); EntityText(0,tempstr, 0); } - + // Now draw overlays TimedOverlay_t* pTO = m_pTimedOverlay; TimedOverlay_t* pNextTO = NULL; @@ -843,7 +843,7 @@ void CBaseEntity::DrawTimedOverlays(void) else { int nAlpha = 0; - + // If messages aren't paused fade out if (!CBaseEntity::Debug_IsPaused()) { @@ -876,25 +876,25 @@ void CBaseEntity::DrawTimedOverlays(void) // Input : // Output : Current text offset from the top //----------------------------------------------------------------------------- -void CBaseEntity::DrawDebugGeometryOverlays(void) +void CBaseEntity::DrawDebugGeometryOverlays(void) { DrawTimedOverlays(); DrawDebugTextOverlays(); - if (m_debugOverlays & OVERLAY_NAME_BIT) - { + if (m_debugOverlays & OVERLAY_NAME_BIT) + { EntityText(0,GetDebugName(), 0); } - if (m_debugOverlays & OVERLAY_BBOX_BIT) - { + if (m_debugOverlays & OVERLAY_BBOX_BIT) + { DrawBBoxOverlay(); } if (m_debugOverlays & OVERLAY_ABSBOX_BIT ) { DrawAbsBoxOverlay(); } - if (m_debugOverlays & OVERLAY_PIVOT_BIT) - { + if (m_debugOverlays & OVERLAY_PIVOT_BIT) + { SendDebugPivotOverlay(); } if( m_debugOverlays & OVERLAY_RBOX_BIT ) @@ -952,7 +952,7 @@ void CBaseEntity::DrawDebugGeometryOverlays(void) if( ((int)gpGlobals->curtime) % 2 == 1 ) { - r = 255; + r = 255; g = 255; b = 255; @@ -994,10 +994,10 @@ void CBaseEntity::DrawDebugGeometryOverlays(void) // Purpose: Draw any text overlays (override in subclass to add additional text) // Output : Current text offset from the top //----------------------------------------------------------------------------- -int CBaseEntity::DrawDebugTextOverlays(void) +int CBaseEntity::DrawDebugTextOverlays(void) { int offset = 1; - if (m_debugOverlays & OVERLAY_TEXT_BIT) + if (m_debugOverlays & OVERLAY_TEXT_BIT) { char tempstr[512]; Q_snprintf( tempstr, sizeof(tempstr), "(%d) Name: %s (%s)", entindex(), GetDebugName(), GetClassname() ); @@ -1032,7 +1032,7 @@ int CBaseEntity::DrawDebugTextOverlays(void) } if (m_debugOverlays & OVERLAY_VIEWOFFSET) - { + { NDebugOverlay::Cross3D( EyePosition(), 16, 255, 0, 0, true, 0.05f ); } @@ -1091,7 +1091,7 @@ void CBaseEntity::TransformStepData_ParentToParent( CBaseEntity *pOldParent, CBa // Convert our positions UTIL_ParentToWorldSpace( pOldParent, step->m_Previous2.vecOrigin, step->m_Previous2.qRotation ); UTIL_WorldToParentSpace( pNewParent, step->m_Previous2.vecOrigin, step->m_Previous2.qRotation ); - + UTIL_ParentToWorldSpace( pOldParent, step->m_Previous.vecOrigin, step->m_Previous.qRotation ); UTIL_WorldToParentSpace( pNewParent, step->m_Previous.vecOrigin, step->m_Previous.qRotation ); } @@ -1143,7 +1143,7 @@ void CBaseEntity::SetParent( CBaseEntity *pParentEntity, int iAttachment ) Assert(0); m_pParent = NULL; } - + if ( m_pParent == NULL ) { m_iParent = NULL_STRING; @@ -1183,7 +1183,7 @@ void CBaseEntity::SetParent( CBaseEntity *pParentEntity, int iAttachment ) matrix.InitFromEntity( const_cast(pParentEntity), m_iParentAttachment ); // parent->world childMatrix.InitFromEntityLocal( this ); // child->world Vector localOrigin = matrix.WorldToLocal( GetLocalOrigin() ); - + // I have the axes of local space in world space. (childMatrix) // I want to compute those world space axes in the parent's local space // and set that transform (as angles) on the child's object so the net @@ -1223,7 +1223,7 @@ void CBaseEntity::SetParent( CBaseEntity *pParentEntity, int iAttachment ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CBaseEntity::ValidateEntityConnections() { @@ -1276,7 +1276,7 @@ void CBaseEntity::ValidateEntityConnections() } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CBaseEntity::FireNamedOutput( const char *pszOutput, variant_t variant, CBaseEntity *pActivator, CBaseEntity *pCaller, float flDelay ) { @@ -1323,7 +1323,7 @@ void CBaseEntity::Activate( void ) if (m_iInitialTeamNum) { ChangeTeam( m_iInitialTeamNum ); - } + } // Get a handle to my damage filter entity if there is one. if ( m_iszDamageFilterName != NULL_STRING ) @@ -1332,7 +1332,7 @@ void CBaseEntity::Activate( void ) } // Add any non-null context strings to our context vector - if ( m_iszResponseContext != NULL_STRING ) + if ( m_iszResponseContext != NULL_STRING ) { AddContext( m_iszResponseContext.ToCStr() ); } @@ -1345,7 +1345,7 @@ void CBaseEntity::Activate( void ) //////////////////////////// old CBaseEntity stuff /////////////////////////////////// -// give health. +// give health. // Returns the amount of health actually taken. int CBaseEntity::TakeHealth( float flHealth, int bitsDamageType ) { @@ -1389,7 +1389,7 @@ int CBaseEntity::OnTakeDamage( const CTakeDamageInfo &info ) // this global is still used for glass and other non-NPC killables, along with decals. g_vecAttackDir = vecTemp; VectorNormalize(g_vecAttackDir); - + // save damage based on the target's armor level // figure momentum add (don't let hurt brushes or other triggers move player) @@ -1403,7 +1403,7 @@ int CBaseEntity::OnTakeDamage( const CTakeDamageInfo &info ) } else { - if ( info.GetInflictor() && (GetMoveType() == MOVETYPE_WALK || GetMoveType() == MOVETYPE_STEP) && + if ( info.GetInflictor() && (GetMoveType() == MOVETYPE_WALK || GetMoveType() == MOVETYPE_STEP) && !info.GetAttacker()->IsSolidFlagSet(FSOLID_TRIGGER) ) { Vector vecDir, vecInflictorCentroid; @@ -1413,8 +1413,8 @@ int CBaseEntity::OnTakeDamage( const CTakeDamageInfo &info ) VectorNormalize( vecDir ); float flForce = info.GetDamage() * ((32 * 32 * 72.0) / (WorldAlignSize().x * WorldAlignSize().y * WorldAlignSize().z)) * 5; - - if (flForce > 1000.0) + + if (flForce > 1000.0) flForce = 1000.0; ApplyAbsVelocityImpulse( vecDir * flForce ); } @@ -1447,10 +1447,10 @@ void CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo ) if ( bHasPhysicsForceDamage && inputInfo.GetDamageType() != DMG_GENERIC ) { // If you hit this assert, you've called TakeDamage with a damage type that requires a physics damage - // force & position without specifying one or both of them. Decide whether your damage that's causing - // this is something you believe should impart physics force on the receiver. If it is, you need to + // force & position without specifying one or both of them. Decide whether your damage that's causing + // this is something you believe should impart physics force on the receiver. If it is, you need to // setup the damage force & position inside the CTakeDamageInfo (Utility functions for this are in - // takedamageinfo.cpp. If you think the damage shouldn't cause force (unlikely!) then you can set the + // takedamageinfo.cpp. If you think the damage shouldn't cause force (unlikely!) then you can set the // damage type to DMG_GENERIC, or | DMG_CRUSH if you need to preserve the damage type for purposes of HUD display. if ( inputInfo.GetDamageForce() == vec3_origin || inputInfo.GetDamagePosition() == vec3_origin ) @@ -1488,7 +1488,7 @@ void CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo ) else { CTakeDamageInfo info = inputInfo; - + // Scale the damage by the attacker's modifier. if ( info.GetAttacker() ) { @@ -1554,10 +1554,10 @@ int CBaseEntity::VPhysicsTakeDamage( const CTakeDamageInfo &info ) Vector offset = info.GetDamagePosition(); // If you hit this assert, you've called TakeDamage with a damage type that requires a physics damage - // force & position without specifying one or both of them. Decide whether your damage that's causing - // this is something you believe should impart physics force on the receiver. If it is, you need to + // force & position without specifying one or both of them. Decide whether your damage that's causing + // this is something you believe should impart physics force on the receiver. If it is, you need to // setup the damage force & position inside the CTakeDamageInfo (Utility functions for this are in - // takedamageinfo.cpp. If you think the damage shouldn't cause force (unlikely!) then you can set the + // takedamageinfo.cpp. If you think the damage shouldn't cause force (unlikely!) then you can set the // damage type to DMG_GENERIC, or | DMG_CRUSH if you need to preserve the damage type for purposes of HUD display. #if !defined( TF_DLL ) Assert( force != vec3_origin && offset != vec3_origin ); @@ -1635,7 +1635,7 @@ void CBaseEntity::SendOnKilledGameEvent( const CTakeDamageInfo &info ) if ( info.GetInflictor()) { event->SetInt( "entindex_inflictor", info.GetInflictor()->entindex() ); - } + } event->SetInt( "damagebits", info.GetDamageType() ); gameeventmanager->FireEvent( event ); } @@ -1806,7 +1806,7 @@ BEGIN_DATADESC_NO_BASE( CBaseEntity ) DEFINE_KEYFIELD( m_iszDamageFilterName, FIELD_STRING, "damagefilter" ), DEFINE_FIELD( m_hDamageFilter, FIELD_EHANDLE ), - + DEFINE_FIELD( m_debugOverlays, FIELD_INTEGER ), DEFINE_GLOBAL_FIELD( m_pParent, FIELD_EHANDLE ), @@ -1814,7 +1814,7 @@ BEGIN_DATADESC_NO_BASE( CBaseEntity ) DEFINE_GLOBAL_FIELD( m_hMoveParent, FIELD_EHANDLE ), DEFINE_GLOBAL_FIELD( m_hMoveChild, FIELD_EHANDLE ), DEFINE_GLOBAL_FIELD( m_hMovePeer, FIELD_EHANDLE ), - + DEFINE_FIELD( m_iEFlags, FIELD_INTEGER ), DEFINE_FIELD( m_iName, FIELD_STRING ), @@ -1838,7 +1838,7 @@ BEGIN_DATADESC_NO_BASE( CBaseEntity ) DEFINE_FIELD( m_hGroundEntity, FIELD_EHANDLE ), DEFINE_FIELD( m_flGroundChangeTime, FIELD_TIME ), DEFINE_GLOBAL_KEYFIELD( m_ModelName, FIELD_MODELNAME, "model" ), - + DEFINE_KEYFIELD( m_vecBaseVelocity, FIELD_VECTOR, "basevelocity" ), DEFINE_FIELD( m_vecAbsVelocity, FIELD_VECTOR ), DEFINE_KEYFIELD( m_vecAngVelocity, FIELD_VECTOR, "avelocity" ), @@ -1969,9 +1969,9 @@ extern bool g_bReceivedChainedUpdateOnRemove; // destructed (especially since the entity list order is more or less random!). // NOTE: You should never call delete directly on an entity (there's an assert now), see note // at CBaseEntity::~CBaseEntity for more information. -// +// // NOTE: You should chain to BaseClass::UpdateOnRemove after doing your own cleanup code, e.g.: -// +// // void CDerived::UpdateOnRemove( void ) // { // ... cleanup code @@ -2048,7 +2048,7 @@ void CBaseEntity::UpdateOnRemove( void ) { sg_DynamicLoadHandlers.Remove( this ); } - + if ( IsDynamicModelIndex( m_nModelIndex ) ) { modelinfo->ReleaseDynamicModel( m_nModelIndex ); // no-op if not dynamic @@ -2059,7 +2059,7 @@ void CBaseEntity::UpdateOnRemove( void ) //----------------------------------------------------------------------------- // capabilities //----------------------------------------------------------------------------- -int CBaseEntity::ObjectCaps( void ) +int CBaseEntity::ObjectCaps( void ) { #if 1 model_t *pModel = GetModel(); @@ -2082,7 +2082,7 @@ int CBaseEntity::ObjectCaps( void ) return caps; } - else if ( !bIsBrush ) + else if ( !bIsBrush ) { return FCAP_ACROSS_TRANSITION; } @@ -2096,7 +2096,7 @@ int CBaseEntity::ObjectCaps( void ) { parentCaps = GetParent()->ObjectCaps(); parentCaps &= ( FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE | FCAP_ONOFF_USE | FCAP_DIRECTIONAL_USE ); - } + } model_t *pModel = GetModel(); if ( pModel && modelinfo->GetModelType( pModel ) == mod_brush ) @@ -2114,8 +2114,8 @@ void CBaseEntity::StartTouch( CBaseEntity *pOther ) } void CBaseEntity::Touch( CBaseEntity *pOther ) -{ - if ( m_pfnTouch ) +{ + if ( m_pfnTouch ) (this->*m_pfnTouch)( pOther ); // notify parent of touch @@ -2138,7 +2138,7 @@ void CBaseEntity::EndTouch( CBaseEntity *pOther ) // Input : pOther - The entity that is blocking us. //----------------------------------------------------------------------------- void CBaseEntity::Blocked( CBaseEntity *pOther ) -{ +{ if ( m_pfnBlocked ) { (this->*m_pfnBlocked)( pOther ); @@ -2156,14 +2156,14 @@ void CBaseEntity::Blocked( CBaseEntity *pOther ) //----------------------------------------------------------------------------- // Purpose: Dispatches use events to this entity's use handler, set via SetUse. -// Input : pActivator - -// pCaller - -// useType - -// value - +// Input : pActivator - +// pCaller - +// useType - +// value - //----------------------------------------------------------------------------- -void CBaseEntity::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) +void CBaseEntity::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - if ( m_pfnUse != NULL ) + if ( m_pfnUse != NULL ) { (this->*m_pfnUse)( pActivator, pCaller, useType, value ); } @@ -2434,7 +2434,7 @@ void CBaseEntity::VPhysicsUpdatePusher( IPhysicsObject *pPhysics ) QAngle angles; // physics updated the shadow, so check to see if I got blocked - // NOTE: SOLID_BSP cannont compute consistent collisions wrt vphysics, so + // NOTE: SOLID_BSP cannont compute consistent collisions wrt vphysics, so // don't allow vphysics to block. Assume game physics has handled it. if ( GetSolid() != SOLID_BSP && pPhysics->GetShadowPosition( &origin, &angles ) ) { @@ -2602,14 +2602,14 @@ void CBaseEntity::PhysicsTouchTriggers( const Vector *pPrevAbsOrigin ) { Assert(CollisionProp()); bool isTriggerCheckSolids = IsSolidFlagSet( FSOLID_TRIGGER ); - bool isSolidCheckTriggers = IsSolid() && !isTriggerCheckSolids; // NOTE: Moving triggers (items, ammo etc) are not + bool isSolidCheckTriggers = IsSolid() && !isTriggerCheckSolids; // NOTE: Moving triggers (items, ammo etc) are not // checked against other triggers to reduce the number of touchlinks created if ( !(isSolidCheckTriggers || isTriggerCheckSolids) ) return; - if ( GetSolid() == SOLID_BSP ) + if ( GetSolid() == SOLID_BSP ) { - if ( !GetModel() && Q_strlen( STRING( GetModelName() ) ) == 0 ) + if ( !GetModel() && Q_strlen( STRING( GetModelName() ) ) == 0 ) { Warning( "Inserted %s with no model\n", GetClassname() ); return; @@ -2756,7 +2756,7 @@ bool CBaseEntity::Intersects( CBaseEntity *pOther ) CCollisionProperty *pMyProp = CollisionProp(); CCollisionProperty *pOtherProp = pOther->CollisionProp(); - return IsOBBIntersectingOBB( + return IsOBBIntersectingOBB( pMyProp->GetCollisionOrigin(), pMyProp->GetCollisionAngles(), pMyProp->OBBMins(), pMyProp->OBBMaxs(), pOtherProp->GetCollisionOrigin(), pOtherProp->GetCollisionAngles(), pOtherProp->OBBMins(), pOtherProp->OBBMaxs() ); } @@ -2777,7 +2777,7 @@ bool CBaseEntity::FVisible( CBaseEntity *pEntity, int traceMask, CBaseEntity **p #if HL1_DLL // FIXME: only block LOS through opaque water // don't look through water - if ((m_nWaterLevel != 3 && pEntity->m_nWaterLevel == 3) + if ((m_nWaterLevel != 3 && pEntity->m_nWaterLevel == 3) || (m_nWaterLevel == 3 && pEntity->m_nWaterLevel == 0)) return false; #endif @@ -2808,7 +2808,7 @@ bool CBaseEntity::FVisible( CBaseEntity *pEntity, int traceMask, CBaseEntity **p CTraceFilterLOS traceFilter( this, COLLISION_GROUP_NONE, pEntity ); UTIL_TraceLine( vecLookerOrigin, vecTargetOrigin, traceMask, &traceFilter, &tr ); } - + if (tr.fraction != 1.0 || tr.startsolid ) { // If we hit the entity we're looking for, it's visible @@ -2841,7 +2841,7 @@ bool CBaseEntity::FVisible( CBaseEntity *pEntity, int traceMask, CBaseEntity **p bool CBaseEntity::FVisible( const Vector &vecTarget, int traceMask, CBaseEntity **ppBlocker ) { #if HL1_DLL - + // don't look through water // FIXME: only block LOS through opaque water bool inWater = ( UTIL_PointContents( vecTarget ) & (CONTENTS_SLIME|CONTENTS_WATER) ) ? true : false; @@ -2850,7 +2850,7 @@ bool CBaseEntity::FVisible( const Vector &vecTarget, int traceMask, CBaseEntity if ( ( m_nWaterLevel == 3 && !inWater ) || ( m_nWaterLevel != 3 && inWater ) ) return false; -#endif +#endif trace_t tr; Vector vecLookerOrigin = EyePosition();// look through the caller's 'eyes' @@ -2918,7 +2918,7 @@ ConVar ai_debug_los("ai_debug_los", "0", FCVAR_CHEAT, "NPC Line-Of-Sight debug m Class_T CBaseEntity::Classify ( void ) -{ +{ return CLASS_NONE; } @@ -3031,7 +3031,7 @@ void CBaseEntity::MakeDormant( void ) return; SETBITS( m_iEFlags, EFL_DORMANT ); - + // Don't touch AddSolidFlags( FSOLID_NOT_SOLID ); // Don't move @@ -3049,11 +3049,11 @@ int CBaseEntity::IsDormant( void ) bool CBaseEntity::IsInWorld( void ) const -{ +{ if ( !edict() ) return true; - // position + // position if (GetAbsOrigin().x >= MAX_COORD_INTEGER) return false; if (GetAbsOrigin().y >= MAX_COORD_INTEGER) return false; if (GetAbsOrigin().z >= MAX_COORD_INTEGER) return false; @@ -3194,7 +3194,7 @@ int CBaseEntity::Restore( IRestore &restore ) // so update with the worldspace leveltransition transform parentSpaceOffset += pGameInfo->GetLandmark(); } - + // NOTE: Do *not* use GetAbsOrigin() here because it will // try to recompute m_rgflCoordinateFrame! MatrixSetColumn( m_vecAbsOrigin, 3, m_rgflCoordinateFrame ); @@ -3252,7 +3252,7 @@ void CBaseEntity::OnRestore() char szMsg[256]; V_snprintf( szMsg, sizeof(szMsg), "\nInvalid save, unable to load. Please run \"map %s\" to restart this level manually\n\n", gpGlobals->mapname.ToCStr() ); Msg( "%s", szMsg ); - + engine->ServerCommand("wait;wait;disconnect;showconsole\n"); } #endif @@ -3360,7 +3360,7 @@ void CBaseEntity::operator delete( void *pMem ) #ifdef _DEBUG void CBaseEntity::FunctionCheck( void *pFunction, const char *name ) -{ +{ #ifdef USES_SAVERESTORE // Note, if you crash here and your class is using multiple inheritance, it is // probably the case that CBaseEntity (or a descendant) is not the first @@ -3413,7 +3413,7 @@ void CBaseEntity::SetMoveType( MoveType_t val, MoveCollide_t moveCollide ) if ( VPhysicsGetObject() && val != MOVETYPE_NONE ) { // What am I supposed to do with the physics object if - // you're changing away from MOVETYPE_VPHYSICS without making the object + // you're changing away from MOVETYPE_VPHYSICS without making the object // shadow? This isn't likely to work, assert. // You probably meant to call VPhysicsInitShadow() instead of VPhysicsInitNormal()! Assert( VPhysicsGetObject()->GetShadowController() ); @@ -3470,7 +3470,7 @@ void CBaseEntity::SetMoveType( MoveType_t val, MoveCollide_t moveCollide ) CheckHasGamePhysicsSimulation(); } -void CBaseEntity::Spawn( void ) +void CBaseEntity::Spawn( void ) { } @@ -3498,11 +3498,11 @@ int CBaseEntity::SetTransmitState( int nFlag) return 0; // clear current flags = check ShouldTransmit() - ed->ClearTransmitState(); - + ed->ClearTransmitState(); + int oldFlags = ed->m_fStateFlags; ed->m_fStateFlags |= nFlag; - + // Tell the engine (used for a network backdoor optimization). if ( (oldFlags & FL_EDICT_DONTSEND) != (ed->m_fStateFlags & FL_EDICT_DONTSEND) ) engine->NotifyEdictFlagsChange( entindex() ); @@ -3515,10 +3515,10 @@ int CBaseEntity::UpdateTransmitState() // If you get this assert, you should be calling DispatchUpdateTransmitState // instead of UpdateTransmitState. Assert( g_nInsideDispatchUpdateTransmitState > 0 ); - + // If an object is the moveparent of something else, don't skip it just because it's marked EF_NODRAW or else // the client won't have a proper origin for the child since the hierarchy won't be correctly transmitted down - if ( IsEffectActive( EF_NODRAW ) && + if ( IsEffectActive( EF_NODRAW ) && !m_hMoveChild.Get() ) { return SetTransmitState( FL_EDICT_DONTSEND ); @@ -3552,20 +3552,20 @@ int CBaseEntity::DispatchUpdateTransmitState() edict_t *ed = edict(); if ( m_nTransmitStateOwnedCounter != 0 ) return ed ? ed->m_fStateFlags : 0; - + g_nInsideDispatchUpdateTransmitState++; int ret = UpdateTransmitState(); g_nInsideDispatchUpdateTransmitState--; - + return ret; } //----------------------------------------------------------------------------- // Purpose: Note, an entity can override the send table ( e.g., to send less data or to send minimal data for // objects ( prob. players ) that are not in the pvs. -// Input : **ppSendTable - -// *recipient - -// *pvs - +// Input : **ppSendTable - +// *recipient - +// *pvs - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- int CBaseEntity::ShouldTransmit( const CCheckTransmitInfo *pInfo ) @@ -3593,18 +3593,18 @@ int CBaseEntity::ShouldTransmit( const CCheckTransmitInfo *pInfo ) CBaseEntity *pRecipientEntity = CBaseEntity::Instance( pInfo->m_pClientEnt ); Assert( pRecipientEntity->IsPlayer() ); - + CBasePlayer *pRecipientPlayer = static_cast( pRecipientEntity ); // FIXME: Refactor once notion of "team" is moved into HL2 code // Team rules may tell us that we should - if ( pRecipientPlayer->GetTeam() ) + if ( pRecipientPlayer->GetTeam() ) { if ( pRecipientPlayer->GetTeam()->ShouldTransmitToPlayer( pRecipientPlayer, this )) return FL_EDICT_ALWAYS; } - + /*#ifdef INVASION_DLL // Check test network vis distance stuff. Eventually network LOD will do this. @@ -3638,15 +3638,15 @@ void CBaseEntity::SetTransmit( CCheckTransmitInfo *pInfo, bool bAlways ) if ( pInfo->m_pTransmitAlways ) { // in HLTV/Replay mode always transmit entitys with move-parents - // HLTV/Replay can't resolve the mode-parents relationships + // HLTV/Replay can't resolve the mode-parents relationships if ( bAlways || pNetworkParent ) { // tell HLTV/Replay that this entity is always transmitted pInfo->m_pTransmitAlways->Set( index ); } - else + else { - // HLTV/Replay will PVS cull this entity, so update the + // HLTV/Replay will PVS cull this entity, so update the // node/cluster infos if necessary m_Network.RecomputePVSInformation(); } @@ -3714,7 +3714,7 @@ const char *CBaseEntity::GetDebugName(void) if ( this == NULL ) return "<>"; - if ( m_iName != NULL_STRING ) + if ( m_iName != NULL_STRING ) { return STRING(m_iName); } @@ -3877,7 +3877,7 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator, NDebugOverlay::Box( pCaller->GetAbsOrigin(), Vector(-4, -4, -4), Vector(4, 4, 4), 255, 0, 0, 0, 3 ); } - NDebugOverlay::Text( GetAbsOrigin(), szInputName, false, 3 ); + NDebugOverlay::Text( GetAbsOrigin(), szInputName, false, 3 ); NDebugOverlay::Box( GetAbsOrigin(), Vector(-4, -4, -4), Vector(4, 4, 4), 0, 255, 0, 0, 3 ); } @@ -3919,8 +3919,8 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator, if ( !Value.Convert( (fieldtype_t)dmap->dataDesc[i].fieldType ) ) { // bad conversion - Warning( "!! ERROR: bad input/output link:\n!! %s(%s,%s) doesn't match type from %s(%s)\n", - STRING(m_iClassname), GetDebugName(), szInputName, + Warning( "!! ERROR: bad input/output link:\n!! %s(%s,%s) doesn't match type from %s(%s)\n", + STRING(m_iClassname), GetDebugName(), szInputName, ( pCaller != NULL ) ? STRING(pCaller->m_iClassname) : "", ( pCaller != NULL ) ? STRING(pCaller->m_iName) : "" ); return false; @@ -3932,7 +3932,7 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator, inputfunc_t pfnInput = dmap->dataDesc[i].inputFunc; if ( pfnInput ) - { + { // Package the data into a struct for passing to the input handler. inputdata_t data; data.pActivator = pActivator; @@ -3946,7 +3946,7 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator, { // set the value directly Value.SetOther( ((char*)this) + dmap->dataDesc[i].fieldOffset[ TD_OFFSET_NORMAL ]); - + // TODO: if this becomes evil and causes too many full entity updates, then we should make // a macro like this: // @@ -4054,7 +4054,7 @@ void CBaseEntity::InputDisableDamageForces( inputdata_t &inputdata ) AddEFlags( EFL_NO_DAMAGE_FORCES ); } - + //----------------------------------------------------------------------------- // Purpose: Sets the damage filter on the object //----------------------------------------------------------------------------- @@ -4096,7 +4096,7 @@ void CBaseEntity::InputDispatchEffect( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: Returns the origin at which to play an inputted dispatcheffect +// Purpose: Returns the origin at which to play an inputted dispatcheffect //----------------------------------------------------------------------------- void CBaseEntity::GetInputDispatchEffectPosition( const char *sInputString, Vector &pOrigin, QAngle &pAngles ) { @@ -4155,7 +4155,7 @@ void CBaseEntity::InputSetParent( inputdata_t &inputdata ) } //------------------------------------------------------------------------------ -// Purpose: +// Purpose: //------------------------------------------------------------------------------ void CBaseEntity::SetParentAttachment( const char *szInputName, const char *szAttachment, bool bMaintainOffset ) { @@ -4247,10 +4247,10 @@ void CBaseEntity::GetVelocity(Vector *vVelocity, AngularImpulse *vAngVelocity) } bool CBaseEntity::IsMoving() -{ +{ Vector velocity; GetVelocity( &velocity, NULL ); - return velocity != vec3_origin; + return velocity != vec3_origin; } //----------------------------------------------------------------------------- @@ -4266,25 +4266,25 @@ void CBaseEntity::GetVectors(Vector* pForward, Vector* pRight, Vector* pUp) cons if (pForward != NULL) { - MatrixGetColumn( entityToWorld, 0, *pForward ); + MatrixGetColumn( entityToWorld, 0, *pForward ); } if (pRight != NULL) { - MatrixGetColumn( entityToWorld, 1, *pRight ); + MatrixGetColumn( entityToWorld, 1, *pRight ); *pRight *= -1.0f; } if (pUp != NULL) { - MatrixGetColumn( entityToWorld, 2, *pUp ); + MatrixGetColumn( entityToWorld, 2, *pUp ); } } //----------------------------------------------------------------------------- // Purpose: Sets the model, validates that it's of the appropriate type -// Input : *szModelName - +// Input : *szModelName - //----------------------------------------------------------------------------- void CBaseEntity::SetModel( const char *szModelName ) { @@ -4362,7 +4362,7 @@ bool CBaseEntity::IsInTeam( CTeam *pTeam ) const } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- int CBaseEntity::GetTeamNumber( void ) const { @@ -4370,7 +4370,7 @@ int CBaseEntity::GetTeamNumber( void ) const } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CBaseEntity::IsInAnyTeam( void ) const { @@ -4487,7 +4487,7 @@ static void TeleportEntity( CBaseEntity *pSourceEntity, TeleportListEntry_t &ent static void BuildTeleportList_r( CBaseEntity *pTeleport, CUtlVector &teleportList ) { TeleportListEntry_t entry; - + entry.pEntity = pTeleport; entry.prevAbsOrigin = pTeleport->GetAbsOrigin(); entry.prevAbsAngles = pTeleport->GetAbsAngles(); @@ -4561,7 +4561,7 @@ CStudioHdr *ModelSoundsCache_LoadModel( const char *filename ) model_t *mdl = (model_t *)modelinfo->GetModel( idx ); if ( mdl ) { - CStudioHdr *studioHdr = new CStudioHdr( modelinfo->GetStudiomodel( mdl ), mdlcache ); + CStudioHdr *studioHdr = new CStudioHdr( modelinfo->GetStudiomodel( mdl ), mdlcache ); if ( studioHdr->IsValid() ) { return studioHdr; @@ -4582,7 +4582,7 @@ void ModelSoundsCache_PrecacheScriptSound( const char *soundname ) CBaseEntity::PrecacheScriptSound( soundname ); } -static CUtlCachedFileData< CModelSoundsCache > g_ModelSoundsCache( "modelsounds.cache", MODELSOUNDSCACHE_VERSION, 0, UTL_CACHED_FILE_USE_FILESIZE, false ); +static CUtlCachedFileData< CModelSoundsCache > g_ModelSoundsCache( "modelsounds.cache", MODELSOUNDSCACHE_VERSION, 0, UTL_CACHED_FILE_USE_FILESIZE, false ); void ClearModelSoundsCache() { @@ -4595,7 +4595,7 @@ void ClearModelSoundsCache() } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool ModelSoundsCacheInit() @@ -4609,7 +4609,7 @@ bool ModelSoundsCacheInit() } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void ModelSoundsCacheShutdown() { @@ -4786,7 +4786,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex ) { KeyValues *pParticleEffects = pModelKeyValues->FindKey("Particles"); if ( pParticleEffects ) - { + { // Start grabbing the sounds and slotting them in for ( KeyValues *pSingleEffect = pParticleEffects->GetFirstSubKey(); pSingleEffect; pSingleEffect = pSingleEffect->GetNextKey() ) { @@ -4800,7 +4800,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex ) // model anim event owned components { // Check animevents for particle events - CStudioHdr studioHdr( modelinfo->GetStudiomodel( pModel ), mdlcache ); + CStudioHdr studioHdr( modelinfo->GetStudiomodel( pModel ), mdlcache ); if ( studioHdr.IsValid() ) { // force animation event resolution!!! @@ -4822,7 +4822,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex ) char token[256]; const char *pOptions = pEvent->pszOptions(); nexttoken( token, pOptions, ' ' ); - if ( token ) + if ( token ) { PrecacheParticleSystem( token ); } @@ -4877,7 +4877,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex ) } else { - Warning( "-- Error --: empty soundname, .qc error on AE_CL_PLAYSOUND in model %s, sequence %s, animevent # %i\n", + Warning( "-- Error --: empty soundname, .qc error on AE_CL_PLAYSOUND in model %s, sequence %s, animevent # %i\n", studioHdr.GetRenderHdr()->pszName(), seq.pszLabel(), j+1 ); } } @@ -4898,7 +4898,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex ) } - + //----------------------------------------------------------------------------- // Purpose: Add model to level precache list // Input : *name - model name @@ -4942,7 +4942,7 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CBaseEntity::Remove( ) { @@ -4962,7 +4962,7 @@ extern CBaseEntity *GetNextCommandEntity( CBasePlayer *pPlayer, const char *name void ConsoleFireTargets( CBasePlayer *pPlayer, const char *name) { // If no name was given use the picker - if (FStrEq(name,"")) + if (FStrEq(name,"")) { CBaseEntity *pEntity = FindPickerEntity( pPlayer ); if ( pEntity && !pEntity->IsMarkedForDeletion()) @@ -4977,7 +4977,7 @@ void ConsoleFireTargets( CBasePlayer *pPlayer, const char *name) } //------------------------------------------------------------------------------ -// Purpose : +// Purpose : // Input : // Output : //------------------------------------------------------------------------------ @@ -5037,11 +5037,11 @@ void CC_Ent_Remove( const CCommand& args ) CBaseEntity *pEntity = NULL; // If no name was given set bits based on the picked - if ( FStrEq( args[1],"") ) + if ( FStrEq( args[1],"") ) { pEntity = FindPickerEntity( UTIL_GetCommandClient() ); } - else + else { int index = atoi( args[1] ); if ( index ) @@ -5054,7 +5054,7 @@ void CC_Ent_Remove( const CCommand& args ) CBaseEntity *ent = NULL; while ( (ent = gEntList.NextEnt(ent)) != NULL ) { - if ( (ent->GetEntityName() != NULL_STRING && FStrEq(args[1], STRING(ent->GetEntityName()))) || + if ( (ent->GetEntityName() != NULL_STRING && FStrEq(args[1], STRING(ent->GetEntityName()))) || (ent->m_iClassname != NULL_STRING && FStrEq(args[1], STRING(ent->m_iClassname))) || (ent->GetClassname()!=NULL && FStrEq(args[1], ent->GetClassname()))) { @@ -5082,14 +5082,14 @@ void CC_Ent_RemoveAll( const CCommand& args ) { Msg( "Removes all entities of the specified type\n\tArguments: {entity_name} / {class_name}\n" ); } - else + else { // Otherwise remove based on name or classname int iCount = 0; CBaseEntity *ent = NULL; while ( (ent = gEntList.NextEnt(ent)) != NULL ) { - if ( (ent->GetEntityName() != NULL_STRING && FStrEq(args[1], STRING(ent->GetEntityName()))) || + if ( (ent->GetEntityName() != NULL_STRING && FStrEq(args[1], STRING(ent->GetEntityName()))) || (ent->m_iClassname != NULL_STRING && FStrEq(args[1], STRING(ent->m_iClassname))) || (ent->GetClassname()!=NULL && FStrEq(args[1], ent->GetClassname()))) { @@ -5126,17 +5126,17 @@ void CC_Ent_SetName( const CCommand& args ) else { // If no name was given set bits based on the picked - if ( FStrEq( args[2],"") ) + if ( FStrEq( args[2],"") ) { pEntity = FindPickerEntity( UTIL_GetCommandClient() ); } - else + else { // Otherwise set bits based on name or classname CBaseEntity *ent = NULL; while ( (ent = gEntList.NextEnt(ent)) != NULL ) { - if ( (ent->GetEntityName() != NULL_STRING && FStrEq(args[1], STRING(ent->GetEntityName()))) || + if ( (ent->GetEntityName() != NULL_STRING && FStrEq(args[1], STRING(ent->GetEntityName()))) || (ent->m_iClassname != NULL_STRING && FStrEq(args[1], STRING(ent->m_iClassname))) || (ent->GetClassname()!=NULL && FStrEq(args[1], ent->GetClassname()))) { @@ -5226,7 +5226,7 @@ void CC_Find_Ent_Index( const CCommand& args ) } static ConCommand find_ent_index("find_ent_index", CC_Find_Ent_Index, "Display data for entity matching specified index.\nFormat: find_ent_index \n", FCVAR_CHEAT); -// Purpose : +// Purpose : //------------------------------------------------------------------------------ void CC_Ent_Dump( const CCommand& args ) { @@ -5306,7 +5306,7 @@ static ConCommand ent_dump("ent_dump", CC_Ent_Dump, "Usage:\n ent_dump \n" ); @@ -5626,7 +5626,7 @@ static ConCommand ent_info("ent_info", CC_Ent_Info, "Usage:\n ent_info EntityToWorldTransform(); } @@ -5887,7 +5887,7 @@ matrix3x4_t& CBaseEntity::GetParentToWorldTransform( matrix3x4_t &tempMatrix ) void CBaseEntity::SetAbsOrigin( const Vector& absOrigin ) { AssertMsg( absOrigin.IsValid(), "Invalid origin set" ); - + // This is necessary to get the other fields of m_rgflCoordinateFrame ok CalcAbsolutePosition(); @@ -5899,8 +5899,8 @@ void CBaseEntity::SetAbsOrigin( const Vector& absOrigin ) RemoveEFlags( EFL_DIRTY_ABSTRANSFORM ); m_vecAbsOrigin = absOrigin; - - MatrixSetColumn( absOrigin, 3, m_rgflCoordinateFrame ); + + MatrixSetColumn( absOrigin, 3, m_rgflCoordinateFrame ); Vector vecNewOrigin; CBaseEntity *pMoveParent = GetMoveParent(); @@ -5942,7 +5942,7 @@ void CBaseEntity::SetAbsAngles( const QAngle& absAngles ) m_angAbsRotation = absAngles; AngleMatrix( absAngles, m_rgflCoordinateFrame ); - MatrixSetColumn( m_vecAbsOrigin, 3, m_rgflCoordinateFrame ); + MatrixSetColumn( m_vecAbsOrigin, 3, m_rgflCoordinateFrame ); QAngle angNewRotation; CBaseEntity *pMoveParent = GetMoveParent(); @@ -6067,7 +6067,7 @@ void CBaseEntity::SetLocalOrigin( const Vector& origin ) Assert( origin.y >= -largeVal && origin.y <= largeVal ); Assert( origin.z >= -largeVal && origin.z <= largeVal ); #endif - + InvalidatePhysicsRecursive( POSITION_CHANGED ); m_vecOrigin = origin; SetSimulationTime( gpGlobals->curtime ); @@ -6194,10 +6194,10 @@ bool CBaseEntity::IsFloating() //----------------------------------------------------------------------------- // Purpose: Created predictable and sets up Id. Note that persist is ignored on the server. -// Input : *classname - -// *module - -// line - -// persist - +// Input : *classname - +// *module - +// line - +// persist - // Output : CBaseEntity //----------------------------------------------------------------------------- CBaseEntity *CBaseEntity::CreatePredictedEntityByName( const char *classname, const char *module, int line, bool persist /* = false */ ) @@ -6289,8 +6289,8 @@ void CBaseEntity::RemoveAllDecals( void ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : set - +// Purpose: +// Input : set - //----------------------------------------------------------------------------- void CBaseEntity::ModifyOrAppendCriteria( AI_CriteriaSet& set ) { @@ -6317,7 +6317,7 @@ void CBaseEntity::ModifyOrAppendCriteria( AI_CriteriaSet& set ) // Go through all the global states and append them - for ( int i = 0; i < GlobalEntity_GetNumGlobals(); i++ ) + for ( int i = 0; i < GlobalEntity_GetNumGlobals(); i++ ) { const char *szGlobalName = GlobalEntity_GetName(i); int iGlobalState = (int)GlobalEntity_GetStateByIndex(i); @@ -6341,9 +6341,9 @@ void CBaseEntity::ModifyOrAppendCriteria( AI_CriteriaSet& set ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : set - -// "" - +// Purpose: +// Input : set - +// "" - //----------------------------------------------------------------------------- void CBaseEntity::AppendContextToCriteria( AI_CriteriaSet& set, const char *prefix /*= ""*/ ) { @@ -6366,7 +6366,7 @@ void CBaseEntity::AppendContextToCriteria( AI_CriteriaSet& set, const char *pref //----------------------------------------------------------------------------- // Purpose: Removes expired concepts from list -// Output : +// Output : //----------------------------------------------------------------------------- void CBaseEntity::RemoveExpiredConcepts( void ) { @@ -6395,8 +6395,8 @@ int CBaseEntity::GetContextCount() const } //----------------------------------------------------------------------------- -// Purpose: -// Input : index - +// Purpose: +// Input : index - // Output : const char //----------------------------------------------------------------------------- const char *CBaseEntity::GetContextName( int index ) const @@ -6411,8 +6411,8 @@ const char *CBaseEntity::GetContextName( int index ) const } //----------------------------------------------------------------------------- -// Purpose: -// Input : index - +// Purpose: +// Input : index - // Output : const char //----------------------------------------------------------------------------- const char *CBaseEntity::GetContextValue( int index ) const @@ -6428,7 +6428,7 @@ const char *CBaseEntity::GetContextValue( int index ) const //----------------------------------------------------------------------------- // Purpose: Check if context has expired -// Input : index - +// Input : index - // Output : bool //----------------------------------------------------------------------------- bool CBaseEntity::ContextExpired( int index ) const @@ -6449,7 +6449,7 @@ bool CBaseEntity::ContextExpired( int index ) const //----------------------------------------------------------------------------- // Purpose: Search for index of named context string -// Input : *name - +// Input : *name - // Output : int //----------------------------------------------------------------------------- int CBaseEntity::FindContextByName( const char *name ) const @@ -6465,8 +6465,8 @@ int CBaseEntity::FindContextByName( const char *name ) const } //----------------------------------------------------------------------------- -// Purpose: -// Input : inputdata - +// Purpose: +// Input : inputdata - //----------------------------------------------------------------------------- void CBaseEntity::InputAddContext( inputdata_t& inputdata ) { @@ -6511,8 +6511,8 @@ void CBaseEntity::InputFireUser4( inputdata_t& inputdata ) //----------------------------------------------------------------------------- -// Purpose: -// Input : *contextName - +// Purpose: +// Input : *contextName - //----------------------------------------------------------------------------- void CBaseEntity::AddContext( const char *contextName ) { @@ -6549,8 +6549,8 @@ void CBaseEntity::AddContext( const char *contextName ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : inputdata - +// Purpose: +// Input : inputdata - //----------------------------------------------------------------------------- void CBaseEntity::InputRemoveContext( inputdata_t& inputdata ) { @@ -6563,8 +6563,8 @@ void CBaseEntity::InputRemoveContext( inputdata_t& inputdata ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : inputdata - +// Purpose: +// Input : inputdata - //----------------------------------------------------------------------------- void CBaseEntity::InputClearContext( inputdata_t& inputdata ) { @@ -6572,7 +6572,7 @@ void CBaseEntity::InputClearContext( inputdata_t& inputdata ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: // Output : IResponseSystem //----------------------------------------------------------------------------- IResponseSystem *CBaseEntity::GetResponseSystem() @@ -6581,8 +6581,8 @@ IResponseSystem *CBaseEntity::GetResponseSystem() } //----------------------------------------------------------------------------- -// Purpose: -// Input : inputdata - +// Purpose: +// Input : inputdata - //----------------------------------------------------------------------------- void CBaseEntity::InputDispatchResponse( inputdata_t& inputdata ) { @@ -6605,7 +6605,7 @@ void CBaseEntity::InputEnableShadow( inputdata_t &inputdata ) //----------------------------------------------------------------------------- // Purpose: An input to add a new connection from this entity -// Input : &inputdata - +// Input : &inputdata - //----------------------------------------------------------------------------- void CBaseEntity::InputAddOutput( inputdata_t &inputdata ) { @@ -6632,8 +6632,8 @@ void CBaseEntity::InputAddOutput( inputdata_t &inputdata ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : *conceptName - +// Purpose: +// Input : *conceptName - //----------------------------------------------------------------------------- void CBaseEntity::DispatchResponse( const char *conceptName ) { @@ -6702,7 +6702,7 @@ void CBaseEntity::DispatchResponse( const char *conceptName ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- void CBaseEntity::DumpResponseCriteria( void ) { @@ -6745,11 +6745,11 @@ void CC_Ent_Autoaim( const CCommand& args ) static ConCommand ent_autoaim("ent_autoaim", CC_Ent_Autoaim, "Displays the entity's autoaim radius.\n\tArguments: {entity_name} / {class_name} / no argument picks what player is looking at", FCVAR_CHEAT ); //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- -CAI_BaseNPC *CBaseEntity::MyNPCPointer( void ) -{ - if ( IsNPC() ) +CAI_BaseNPC *CBaseEntity::MyNPCPointer( void ) +{ + if ( IsNPC() ) return assert_cast(this); return NULL; @@ -6759,7 +6759,7 @@ ConVar step_spline( "step_spline", "0" ); //----------------------------------------------------------------------------- // Purpose: Run one tick's worth of faked simulation -// Input : *step - +// Input : *step - //----------------------------------------------------------------------------- void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) { @@ -6796,7 +6796,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) frac = (float)( gpGlobals->tickcount - step->m_Previous.nTickCount ) / (float) tickdelta; frac = clamp( frac, 0.0f, 1.0f ); } - + if (step->m_Previous2.nTickCount == 0 || step->m_Previous2.nTickCount >= step->m_Previous.nTickCount) { Vector delta = step->m_Next.vecOrigin - step->m_Previous.vecOrigin; @@ -6806,7 +6806,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) { StepSimulationStep *pOlder = &step->m_Previous; StepSimulationStep *pNewer = &step->m_Next; - + if (step->m_Discontinuity.nTickCount > step->m_Previous.nTickCount) { if (gpGlobals->tickcount > step->m_Discontinuity.nTickCount) @@ -6817,7 +6817,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) { pNewer = &step->m_Discontinuity; } - + tickdelta = pNewer->nTickCount - pOlder->nTickCount; if ( tickdelta > 0 ) { @@ -6825,7 +6825,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) frac = clamp( frac, 0.0f, 1.0f ); } } - + Vector delta = pNewer->vecOrigin - pOlder->vecOrigin; VectorMA( pOlder->vecOrigin, frac, delta, step->m_vecNetworkOrigin ); } @@ -6854,7 +6854,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) frac = (float)( gpGlobals->tickcount - step->m_Previous.nTickCount ) / (float) tickdelta; frac = clamp( frac, 0.0f, 1.0f ); } - + if (step->m_Previous2.nTickCount == 0 || step->m_Previous2.nTickCount >= step->m_Previous.nTickCount) { // Pure blend between start/end orientations @@ -6866,7 +6866,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) { StepSimulationStep *pOlder = &step->m_Previous; StepSimulationStep *pNewer = &step->m_Next; - + if (step->m_Discontinuity.nTickCount > step->m_Previous.nTickCount) { if (gpGlobals->tickcount > step->m_Discontinuity.nTickCount) @@ -6877,7 +6877,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) { pNewer = &step->m_Discontinuity; } - + tickdelta = pNewer->nTickCount - pOlder->nTickCount; if ( tickdelta > 0 ) { @@ -6885,7 +6885,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) frac = clamp( frac, 0.0f, 1.0f ); } } - + // Pure blend between start/end orientations Quaternion outangles; QuaternionBlend( pOlder->qRotation, pNewer->qRotation, frac, outangles ); @@ -6942,7 +6942,7 @@ bool CBaseEntity::UseStepSimulationNetworkAngles( const QAngle **out_a ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- bool CBaseEntity::AddStepDiscontinuity( float flTime, const Vector &vecOrigin, const QAngle &vecAngles ) @@ -6968,8 +6968,8 @@ bool CBaseEntity::AddStepDiscontinuity( float flTime, const Vector &vecOrigin, c } -Vector CBaseEntity::GetStepOrigin( void ) const -{ +Vector CBaseEntity::GetStepOrigin( void ) const +{ return GetLocalOrigin(); } @@ -6979,9 +6979,9 @@ QAngle CBaseEntity::GetStepAngles( void ) const } //----------------------------------------------------------------------------- -// Purpose: For each client who appears to be a valid recipient, checks the client has disabled CC and if so, removes them from +// Purpose: For each client who appears to be a valid recipient, checks the client has disabled CC and if so, removes them from // the recipient list. -// Input : filter - +// Input : filter - //----------------------------------------------------------------------------- void CBaseEntity::RemoveRecipientsIfNotCloseCaptioning( CRecipientFilter& filter ) { @@ -7023,24 +7023,24 @@ void CBaseEntity::RemoveRecipientsIfNotCloseCaptioning( CRecipientFilter& filter //----------------------------------------------------------------------------- // Purpose: Wrapper to emit a sentence and also a close caption token for the sentence as appropriate. -// Input : filter - -// iEntIndex - -// iChannel - -// iSentenceIndex - -// flVolume - -// iSoundlevel - -// iFlags - -// iPitch - -// bUpdatePositions - -// soundtime - -//----------------------------------------------------------------------------- -void CBaseEntity::EmitSentenceByIndex( IRecipientFilter& filter, int iEntIndex, int iChannel, int iSentenceIndex, +// Input : filter - +// iEntIndex - +// iChannel - +// iSentenceIndex - +// flVolume - +// iSoundlevel - +// iFlags - +// iPitch - +// bUpdatePositions - +// soundtime - +//----------------------------------------------------------------------------- +void CBaseEntity::EmitSentenceByIndex( IRecipientFilter& filter, int iEntIndex, int iChannel, int iSentenceIndex, float flVolume, soundlevel_t iSoundlevel, int iFlags /*= 0*/, int iPitch /*=PITCH_NORM*/, - const Vector *pOrigin /*=NULL*/, const Vector *pDirection /*=NULL*/, + const Vector *pOrigin /*=NULL*/, const Vector *pDirection /*=NULL*/, bool bUpdatePositions /*=true*/, float soundtime /*=0.0f*/ ) { CUtlVector< Vector > dummy; - enginesound->EmitSentenceByIndex( filter, iEntIndex, iChannel, iSentenceIndex, + enginesound->EmitSentenceByIndex( filter, iEntIndex, iChannel, iSentenceIndex, flVolume, iSoundlevel, iFlags, iPitch, 0, pOrigin, pDirection, &dummy, bUpdatePositions, soundtime ); } @@ -7051,12 +7051,12 @@ 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 ); } } -bool CPointEntity::KeyValue( const char *szKeyName, const char *szValue ) +bool CPointEntity::KeyValue( const char *szKeyName, const char *szValue ) { if ( FStrEq( szKeyName, "mins" ) || FStrEq( szKeyName, "maxs" ) ) { @@ -7065,9 +7065,9 @@ bool CPointEntity::KeyValue( const char *szKeyName, const char *szValue ) } return BaseClass::KeyValue( szKeyName, szValue ); -} +} -bool CServerOnlyPointEntity::KeyValue( const char *szKeyName, const char *szValue ) +bool CServerOnlyPointEntity::KeyValue( const char *szKeyName, const char *szValue ) { if ( FStrEq( szKeyName, "mins" ) || FStrEq( szKeyName, "maxs" ) ) { @@ -7078,7 +7078,7 @@ bool CServerOnlyPointEntity::KeyValue( const char *szKeyName, const char *szValu return BaseClass::KeyValue( szKeyName, szValue ); } -bool CLogicalEntity::KeyValue( const char *szKeyName, const char *szValue ) +bool CLogicalEntity::KeyValue( const char *szKeyName, const char *szValue ) { if ( FStrEq( szKeyName, "mins" ) || FStrEq( szKeyName, "maxs" ) ) { @@ -7219,7 +7219,7 @@ void CBaseEntity::SUB_FadeOut( void ) SetRenderColorA( 255 ); return; } - + SUB_PerformFadeOut(); if ( m_clrRender->a == 0 ) @@ -7243,8 +7243,8 @@ inline bool AnyPlayersInHierarchy_R( CBaseEntity *pEnt ) if ( AnyPlayersInHierarchy_R( pCur ) ) return true; } - - return false; + + return false; } @@ -7275,9 +7275,9 @@ void CBaseEntity::OnModelLoadComplete( const model_t* model ) { Assert( m_bDynamicModelPending && IsDynamicModelIndex( m_nModelIndex ) ); Assert( model == modelinfo->GetModel( m_nModelIndex ) ); - + m_bDynamicModelPending = false; - + if ( m_bDynamicModelSetBounds ) { m_bDynamicModelSetBounds = false; @@ -7361,7 +7361,7 @@ void CC_Ent_Create( const CCommand& args ) Vector forward; pPlayer->EyeVectors( &forward ); UTIL_TraceLine(pPlayer->EyePosition(), - pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_SOLID, + pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_SOLID, pPlayer, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction != 1.0 ) { @@ -7415,7 +7415,7 @@ bool CC_GetCommandEnt( const CCommand& args, CBaseEntity **ent, Vector *vecTarge Vector forward; pPlayer->EyeVectors( &forward ); UTIL_TraceLine(pPlayer->EyePosition(), - pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_NPCSOLID, + pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_NPCSOLID, pPlayer, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction != 1.0 ) diff --git a/sp/src/game/server/episodic/singleplayer_animstate.h b/sp/src/game/server/episodic/singleplayer_animstate.h index 177f3438..04d7e483 100644 --- a/sp/src/game/server/episodic/singleplayer_animstate.h +++ b/sp/src/game/server/episodic/singleplayer_animstate.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Single Player animation state 'handler'. This utility is used // to evaluate the pose parameter value based on the direction @@ -13,7 +13,7 @@ #endif #include "cbase.h" -#include "..\public\datacache\imdlcache.h" +#include "datacache/imdlcache.h" #ifdef CLIENT_DLL #include "c_baseplayer.h" @@ -81,4 +81,4 @@ class CSinglePlayerAnimState CSinglePlayerAnimState* CreatePlayerAnimationState(CBasePlayer* pPlayer); -#endif // SINGLEPLAYER_ANIMSTATE_H \ No newline at end of file +#endif // SINGLEPLAYER_ANIMSTATE_H diff --git a/sp/src/game/server/gameinterface.cpp b/sp/src/game/server/gameinterface.cpp index 4efde47a..1f8fed69 100644 --- a/sp/src/game/server/gameinterface.cpp +++ b/sp/src/game/server/gameinterface.cpp @@ -137,7 +137,7 @@ extern ConVar commentary; #ifndef NO_STEAM // this context is not available on dedicated servers // WARNING! always check if interfaces are available before using -static CSteamAPIContext s_SteamAPIContext; +static CSteamAPIContext s_SteamAPIContext; CSteamAPIContext *steamapicontext = &s_SteamAPIContext; // this context is not available on a pure client connected to a remote server. @@ -274,7 +274,7 @@ class CPostFrameNavigationHook; extern CPostFrameNavigationHook *PostFrameNavigationSystem( void ); //----------------------------------------------------------------------------- -// Purpose: +// Purpose: // Output : int //----------------------------------------------------------------------------- int UTIL_GetCommandClientIndex( void ) @@ -287,7 +287,7 @@ int UTIL_GetCommandClientIndex( void ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: // Output : CBasePlayer //----------------------------------------------------------------------------- CBasePlayer *UTIL_GetCommandClient( void ) @@ -319,7 +319,7 @@ bool UTIL_GetModDir( char *lpszTextOut, unsigned int nSize ) { // Strip the last directory off (which will be our game dir) Q_StripLastDir( lpszTextOut, nSize ); - + // Find the difference in string lengths and take that difference from the original string as the mod dir int dirlen = Q_strlen( lpszTextOut ); Q_strncpy( lpszTextOut, pGameDir + dirlen, Q_strlen( pGameDir ) - dirlen + 1 ); @@ -346,7 +346,7 @@ extern ConVar think_limit; #if 0 //----------------------------------------------------------------------------- // Purpose: Draw output overlays for any measure sections -// Input : +// Input : //----------------------------------------------------------------------------- void DrawMeasuredSections(void) { @@ -359,7 +359,7 @@ void DrawMeasuredSections(void) char str[256]; Q_snprintf(str,sizeof(str),"%s",p->GetName()); NDebugOverlay::ScreenText( 0.01,0.51+(row*rowheight),str, 255,255,255,255, 0.0 ); - + Q_snprintf(str,sizeof(str),"%5.2f\n",p->GetTime().GetMillisecondsF()); //Q_snprintf(str,sizeof(str),"%3.3f\n",p->GetTime().GetSeconds() * 100.0 / engine->Time()); NDebugOverlay::ScreenText( 0.28,0.51+(row*rowheight),str, 255,255,255,255, 0.0 ); @@ -392,7 +392,7 @@ void DrawMeasuredSections(void) p = CMeasureSection::GetList(); while ( p ) { - // Update max + // Update max p->UpdateMax(); // Reset regular accum. @@ -411,7 +411,7 @@ void DrawMeasuredSections(void) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void DrawAllDebugOverlays( void ) +void DrawAllDebugOverlays( void ) { // If in debug select mode print the selection entities name or classname if (CBaseEntity::m_bInDebugSelect) @@ -423,7 +423,7 @@ void DrawAllDebugOverlays( void ) // First try to trace a hull to an entity CBaseEntity *pEntity = FindPickerEntity( pPlayer ); - if ( pEntity ) + if ( pEntity ) { pEntity->DrawDebugTextOverlays(); pEntity->DrawBBoxOverlay(); @@ -433,7 +433,7 @@ void DrawAllDebugOverlays( void ) } // -------------------------------------------------------- - // Draw debug overlay lines + // Draw debug overlay lines // -------------------------------------------------------- UTIL_DrawOverlayLines(); @@ -443,7 +443,7 @@ void DrawAllDebugOverlays( void ) if (engine->IsInEditMode()) { CBasePlayer* pPlayer = UTIL_PlayerByIndex( CBaseEntity::m_nDebugPlayer ); - if (pPlayer) + if (pPlayer) { if (g_pAINetworkManager->GetEditOps()->m_bLinkEditMode) { @@ -455,7 +455,7 @@ void DrawAllDebugOverlays( void ) Vector endPos = g_pBigAINet->GetNode(pAILink->m_iDestID)->GetPosition(g_pAINetworkManager->GetEditOps()->m_iHullDrawNum); Vector linkDir = startPos-endPos; float linkLen = VectorNormalize( linkDir ); - + // Draw in green if link that's been turned off if (pAILink->m_LinkInfo & bits_LINK_OFF) { @@ -545,9 +545,9 @@ void DrawAllDebugOverlays( void ) continue; char tempstr[512]; - Q_snprintf(tempstr, sizeof(tempstr),"%s: Mass: %.2f kg / %.2f lb (%s)", - STRING( ent->GetModelName() ), ent->VPhysicsGetObject()->GetMass(), - kg2lbs(ent->VPhysicsGetObject()->GetMass()), + Q_snprintf(tempstr, sizeof(tempstr),"%s: Mass: %.2f kg / %.2f lb (%s)", + STRING( ent->GetModelName() ), ent->VPhysicsGetObject()->GetMass(), + kg2lbs(ent->VPhysicsGetObject()->GetMass()), GetMassEquivalent(ent->VPhysicsGetObject()->GetMass())); ent->EntityText(0, tempstr, 0); } @@ -565,8 +565,8 @@ EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameDLL, IServerGameDLL, INTERFACEVERSI // When bumping the version to this interface, check that our assumption is still valid and expose the older version in the same way COMPILE_TIME_ASSERT( INTERFACEVERSION_SERVERGAMEDLL_INT == 9 ); -bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, - CreateInterfaceFn physicsFactory, CreateInterfaceFn fileSystemFactory, +bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, + CreateInterfaceFn physicsFactory, CreateInterfaceFn fileSystemFactory, CGlobalVars *pGlobals) { ConnectTier1Libraries( &appSystemFactory, 1 ); @@ -641,7 +641,7 @@ bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, gpGlobals = pGlobals; g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo(); - + MathLib_Init( 2.2f, 2.2f, 0.0f, 2.0f ); // save these in case other system inits need them @@ -651,12 +651,12 @@ bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, factories.physicsFactory = physicsFactory; FactoryList_Store( factories ); - // load used game events + // load used game events gameeventmanager->LoadEventsFromFile("resource/gameevents.res"); // init the cvar list first in case inits want to reference them InitializeCvars(); - + // Initialize the particle system if ( !g_pParticleSystemMgr->Init( g_pParticleSystemQuery ) ) { @@ -687,14 +687,14 @@ bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, // Physics must occur before the sound envelope manager IGameSystem::Add( PhysicsGameSystem() ); - + // Used to service deferred navigation queries for NPCs IGameSystem::Add( (IGameSystem *) PostFrameNavigationSystem() ); // Add game log system IGameSystem::Add( GameLogSystem() ); #ifndef _XBOX - // Add HLTV director + // Add HLTV director IGameSystem::Add( HLTVDirectorSystem() ); #endif // Add sound emitter @@ -794,10 +794,10 @@ void CServerGameDLL::DLLShutdown( void ) #ifndef _X360 s_SteamAPIContext.Clear(); // Steam API context shutdown s_SteamGameServerAPIContext.Clear(); -#endif +#endif gameeventmanager = NULL; - + DisconnectTier3Libraries(); DisconnectTier2Libraries(); ConVar_Unregister(); @@ -895,7 +895,7 @@ void EndRestoreEntities() { if ( !g_InRestore ) return; - + // The entire hierarchy is restored, so we can call GetAbsOrigin again. //CBaseEntity::SetAbsQueriesValid( true ); @@ -1113,9 +1113,9 @@ void CServerGameDLL::ServerActivate( edict_t *pEdictList, int edictCount, int cl BeginCheckChainedActivate(); pClass->Activate(); - + // We don't care if it finished activating if it decided to remove itself. - EndCheckChainedActivate( !( pClass->GetEFlags() & EFL_KILLME ) ); + EndCheckChainedActivate( !( pClass->GetEFlags() & EFL_KILLME ) ); } } @@ -1240,7 +1240,7 @@ void CServerGameDLL::GameFrame( bool simulating ) g_pServerBenchmark->UpdateBenchmark(); Physics_RunThinkFunctions( simulating ); - + IGameSystem::FrameUpdatePostEntityThinkAllSystems(); // UNDONE: Make these systems IGameSystems and move these calls into FrameUpdatePostEntityThink() @@ -1284,7 +1284,7 @@ void CServerGameDLL::GameFrame( bool simulating ) //----------------------------------------------------------------------------- // Purpose: Called every frame even if not ticking -// Input : simulating - +// Input : simulating - //----------------------------------------------------------------------------- void CServerGameDLL::PreClientUpdate( bool simulating ) { @@ -1301,7 +1301,7 @@ void CServerGameDLL::PreClientUpdate( bool simulating ) //#ifdef _DEBUG - allow this in release for now DrawAllDebugOverlays(); //#endif - + IGameSystem::PreClientUpdateAllSystems(); #ifdef _DEBUG @@ -1406,8 +1406,8 @@ void CServerGameDLL::LevelShutdown( void ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : +// Purpose: +// Input : // Output : ServerClass* //----------------------------------------------------------------------------- ServerClass* CServerGameDLL::GetAllServerClasses() @@ -1451,7 +1451,7 @@ void CServerGameDLL::CreateNetworkStringTables( void ) g_pStringTableMaterials && g_pStringTableInfoPanel && g_pStringTableClientSideChoreoScenes && - g_pStringTableServerMapCycle && + g_pStringTableServerMapCycle && bPopFilesValid ); @@ -1531,10 +1531,10 @@ void CServerGameDLL::Restore( CSaveRestoreData *s, bool b) } //----------------------------------------------------------------------------- -// Purpose: -// Input : msg_type - -// *name - -// size - +// Purpose: +// Input : msg_type - +// *name - +// size - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- @@ -1646,7 +1646,7 @@ static TITLECOMMENT gTitleComments[] = { "d1_trainstation_05", "#HL2_Chapter2_Title" }, { "d1_trainstation_06", "#HL2_Chapter2_Title" }, - + { "d1_trainstation_", "#HL2_Chapter1_Title" }, { "d1_canals_06", "#HL2_Chapter4_Title" }, @@ -1654,7 +1654,7 @@ static TITLECOMMENT gTitleComments[] = { "d1_canals_08", "#HL2_Chapter4_Title" }, { "d1_canals_09", "#HL2_Chapter4_Title" }, { "d1_canals_1", "#HL2_Chapter4_Title" }, - + { "d1_canals_0", "#HL2_Chapter3_Title" }, { "d1_eli_", "#HL2_Chapter5_Title" }, @@ -1704,20 +1704,20 @@ static TITLECOMMENT gTitleComments[] = { "ep2_outland_03", "#ep2_Chapter2_Title" }, { "ep2_outland_04", "#ep2_Chapter2_Title" }, { "ep2_outland_05", "#ep2_Chapter3_Title" }, - + { "ep2_outland_06a", "#ep2_Chapter4_Title" }, { "ep2_outland_06", "#ep2_Chapter3_Title" }, { "ep2_outland_07", "#ep2_Chapter4_Title" }, { "ep2_outland_08", "#ep2_Chapter4_Title" }, { "ep2_outland_09", "#ep2_Chapter5_Title" }, - + { "ep2_outland_10a", "#ep2_Chapter5_Title" }, { "ep2_outland_10", "#ep2_Chapter5_Title" }, { "ep2_outland_11a", "#ep2_Chapter6_Title" }, { "ep2_outland_11", "#ep2_Chapter6_Title" }, - + { "ep2_outland_12a", "#ep2_Chapter7_Title" }, { "ep2_outland_12", "#ep2_Chapter6_Title" }, #endif @@ -1772,7 +1772,7 @@ void CServerGameDLL::GetSaveComment( char *text, int maxlength, float flMinutes, break; } } - + // If we didn't get one, use the designer's map name, or the BSP name itself if ( !pName ) { @@ -1865,7 +1865,7 @@ IServerGCLobby *CServerGameDLL::GetServerGCLobby() { #ifdef TF_DLL return GTFGCClientSystem(); -#else +#else return NULL; #endif } @@ -2072,7 +2072,7 @@ void UpdateChapterRestrictions( const char *mapname ) // make sure the specified chapter title is unlocked strlwr( chapterTitle ); - + // Get our active mod directory name char modDir[MAX_PATH]; if ( UTIL_GetModDir( modDir, sizeof(modDir) ) == false ) @@ -2208,7 +2208,7 @@ void UpdateRichPresence ( void ) Warning( "GameInterface: UserSetContext failed.\n" ); } } - + // Set which game the user is playing if ( !xboxsystem->UserSetContext( XBX_GetPrimaryUserId(), CONTEXT_GAME, iGameID, true ) ) { @@ -2245,7 +2245,7 @@ int GetMaterialIndex( const char *pMaterialName ) if (pMaterialName) { int nIndex = g_pStringTableMaterials->FindStringIndex( pMaterialName ); - + if (nIndex != INVALID_STRING_INDEX ) { return nIndex; @@ -2325,7 +2325,7 @@ class CServerGameEnts : public IServerGameEnts public: virtual void SetDebugEdictBase(edict_t *base); virtual void MarkEntitiesAsTouching( edict_t *e1, edict_t *e2 ); - virtual void FreeContainingEntity( edict_t * ); + virtual void FreeContainingEntity( edict_t * ); virtual edict_t* BaseEntityToEdict( CBaseEntity *pEnt ); virtual CBaseEntity* EdictToBaseEntity( edict_t *pEdict ); virtual void CheckTransmit( CCheckTransmitInfo *pInfo, const unsigned short *pEdictIndices, int nEdicts ); @@ -2339,8 +2339,8 @@ void CServerGameEnts::SetDebugEdictBase(edict_t *base) //----------------------------------------------------------------------------- // Purpose: Marks entities as touching -// Input : *e1 - -// *e2 - +// Input : *e1 - +// *e2 - //----------------------------------------------------------------------------- void CServerGameEnts::MarkEntitiesAsTouching( edict_t *e1, edict_t *e2 ) { @@ -2408,7 +2408,7 @@ void CServerGameEnts::CheckTransmit( CCheckTransmitInfo *pInfo, const unsigned s Assert( pRecipientEntity && pRecipientEntity->IsPlayer() ); if ( !pRecipientEntity ) return; - + MDLCACHE_CRITICAL_SECTION(); CBasePlayer *pRecipientPlayer = static_cast( pRecipientEntity ); const int skyBoxArea = pRecipientPlayer->m_Local.m_skybox3d.area; @@ -2433,26 +2433,26 @@ void CServerGameEnts::CheckTransmit( CCheckTransmitInfo *pInfo, const unsigned s // entity needs no transmit if ( nFlags & FL_EDICT_DONTSEND ) continue; - + // entity is already marked for sending if ( pInfo->m_pTransmitEdict->Get( iEdict ) ) continue; - + if ( nFlags & FL_EDICT_ALWAYS ) { - // FIXME: Hey! Shouldn't this be using SetTransmit so as + // FIXME: Hey! Shouldn't this be using SetTransmit so as // to also force network down dependent entities? while ( true ) { // mark entity for sending pInfo->m_pTransmitEdict->Set( iEdict ); - + #ifndef _X360 if ( bIsHLTV || bIsReplay ) { pInfo->m_pTransmitAlways->Set( iEdict ); } -#endif +#endif CServerNetworkProperty *pEnt = static_cast( pEdict->GetNetworkable() ); if ( !pEnt ) break; @@ -2482,7 +2482,7 @@ void CServerGameEnts::CheckTransmit( CCheckTransmitInfo *pInfo, const unsigned s { pEnt->SetTransmit( pInfo, true ); continue; - } + } } // don't send this entity @@ -2605,10 +2605,10 @@ EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameClients, IServerGameClients, INTERF // Output : Returns TRUE if player is allowed to join, FALSE if connection is denied. //----------------------------------------------------------------------------- bool CServerGameClients::ClientConnect( edict_t *pEdict, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen ) -{ +{ if ( !g_pGameRules ) return false; - + return g_pGameRules->ClientConnected( pEdict, pszName, pszAddress, reject, maxrejectlen ); } @@ -2619,7 +2619,7 @@ bool CServerGameClients::ClientConnect( edict_t *pEdict, const char *pszName, co void CServerGameClients::ClientActive( edict_t *pEdict, bool bLoadGame ) { MDLCACHE_CRITICAL_SECTION(); - + ::ClientActive( pEdict, bLoadGame ); // If we just loaded from a save file, call OnRestore on valid entities @@ -2657,7 +2657,7 @@ void CServerGameClients::ClientActive( edict_t *pEdict, bool bLoadGame ) } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: // Input : *pPlayer - the player //----------------------------------------------------------------------------- void CServerGameClients::ClientSpawned( edict_t *pPlayer ) @@ -2686,7 +2686,7 @@ void CServerGameClients::ClientDisconnect( edict_t *pEdict ) CSound *pSound; pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( pEdict ) ); { - // since this client isn't around to think anymore, reset their sound. + // since this client isn't around to think anymore, reset their sound. if ( pSound ) { pSound->Reset(); @@ -2746,7 +2746,7 @@ void CServerGameClients::ClientCommand( edict_t *pEntity, const CCommand &args ) } //----------------------------------------------------------------------------- -// Purpose: called after the player changes userinfo - gives dll a chance to modify +// Purpose: called after the player changes userinfo - gives dll a chance to modify // it before it gets sent into the rest of the engine-> // Input : *pEdict - the player // *infobuffer - their infobuffer @@ -2758,7 +2758,7 @@ void CServerGameClients::ClientSettingsChanged( edict_t *pEdict ) return; CBasePlayer *player = ( CBasePlayer * )CBaseEntity::Instance( pEdict ); - + if ( !player ) return; @@ -2769,12 +2769,12 @@ void CServerGameClients::ClientSettingsChanged( edict_t *pEdict ) #define QUICKGETCVARVALUE(v) (engine->GetClientConVarValue( player->entindex(), v )) // get network setting for prediction & lag compensation - + // Unfortunately, we have to duplicate the code in cdll_bounded_cvars.cpp here because the client // doesn't send the virtualized value up (because it has no way to know when the virtualized value // changes). Possible todo: put the responsibility on the bounded cvar to notify the engine when - // its virtualized value has changed. - + // its virtualized value has changed. + player->m_nUpdateRate = Q_atoi( QUICKGETCVARVALUE("cl_updaterate") ); static const ConVar *pMinUpdateRate = g_pCVar->FindVar( "sv_minupdaterate" ); static const ConVar *pMaxUpdateRate = g_pCVar->FindVar( "sv_maxupdaterate" ); @@ -2807,7 +2807,7 @@ void CServerGameClients::ClientSettingsChanged( edict_t *pEdict ) { player->m_fLerpTime = 0.0f; } - + #if !defined( NO_ENTITY_PREDICTION ) bool usePrediction = Q_atoi( QUICKGETCVARVALUE("cl_predict")) != 0; @@ -2822,7 +2822,7 @@ void CServerGameClients::ClientSettingsChanged( edict_t *pEdict ) player->m_bPredictWeapons = false; player->m_bLagCompensation = false; } - + #undef QUICKGETCVARVALUE } @@ -2853,7 +2853,7 @@ int TestAreaPortalVisibilityThroughPortals ( CFuncAreaPortalBase* pAreaPortal, e CProp_Portal* pRemotePortal = pLocalPortal->m_hLinkedPortal.Get(); // Make sure this portal's linked portal is in the PVS before we add what it can see - if ( pRemotePortal && pRemotePortal->m_bActivated && pRemotePortal->NetworkProp() && + if ( pRemotePortal && pRemotePortal->m_bActivated && pRemotePortal->NetworkProp() && pRemotePortal->NetworkProp()->IsInPVS( pViewEntity, pvs, pvssize ) ) { bool bIsOpenOnClient = true; @@ -2869,7 +2869,7 @@ int TestAreaPortalVisibilityThroughPortals ( CFuncAreaPortalBase* pAreaPortal, e } } } - + return 0; } #endif @@ -2881,10 +2881,10 @@ int TestAreaPortalVisibilityThroughPortals ( CFuncAreaPortalBase* pAreaPortal, e // From the eye position, we set up the PAS and PVS to use for filtering network messages to the client. At this point, we could // override the actual PAS or PVS values, or use a different origin. // NOTE: Do not cache the values of pas and pvs, as they depend on reusable memory in the engine, they are only good for this one frame -// Input : *pViewEntity - -// *pClient - -// **pvs - -// **pas - +// Input : *pViewEntity - +// *pClient - +// **pvs - +// **pas - //----------------------------------------------------------------------------- void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char *pvs, int pvssize ) { @@ -2921,7 +2921,7 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p unsigned char portalBits[MAX_AREA_PORTAL_STATE_BYTES]; memset( portalBits, 0, sizeof( portalBits ) ); - + int portalNums[512]; int isOpen[512]; int iOutPortal = 0; @@ -2931,8 +2931,8 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p CFuncAreaPortalBase *pCur = g_AreaPortals[i]; bool bIsOpenOnClient = true; - - // Update our array of which portals are open and flush it if necessary. + + // Update our array of which portals are open and flush it if necessary. portalNums[iOutPortal] = pCur->m_portalNumber; isOpen[iOutPortal] = pCur->UpdateVisibility( org, fovDistanceAdjustFactor, bIsOpenOnClient ); @@ -2964,7 +2964,7 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p Error( "ClientSetupVisibility: portal number (%d) too large", pCur->m_portalNumber ); else portalBits[pCur->m_portalNumber >> 3] |= (1 << (pCur->m_portalNumber & 7)); - } + } } // Flush the remaining areaportal states. @@ -2975,7 +2975,7 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p // Update the area bits that get sent to the client. pPlayer->m_Local.UpdateAreaBits( pPlayer, portalBits ); -#ifdef PORTAL +#ifdef PORTAL // *After* the player's view has updated its area bits, add on any other areas seen by portals CPortal_Player* pPortalPlayer = dynamic_cast( pPlayer ); if ( pPortalPlayer ) @@ -2990,14 +2990,14 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p //----------------------------------------------------------------------------- -// Purpose: -// Input : *player - -// *buf - -// numcmds - -// totalcmds - -// dropped_packets - -// ignore - -// paused - +// Purpose: +// Input : *player - +// *buf - +// numcmds - +// totalcmds - +// dropped_packets - +// ignore - +// paused - // Output : float //----------------------------------------------------------------------------- #define CMD_MAXBACKUP 64 @@ -3008,12 +3008,12 @@ float CServerGameClients::ProcessUsercmds( edict_t *player, bf_read *buf, int nu int i; CUserCmd *from, *to; - // We track last three command in case we drop some + // We track last three command in case we drop some // packets but get them back. - CUserCmd cmds[ CMD_MAXBACKUP ]; + CUserCmd cmds[ CMD_MAXBACKUP ]; CUserCmd cmdNull; // For delta compression - + Assert( numcmds >= 0 ); Assert( ( totalcmds - numcmds ) >= 0 ); @@ -3104,8 +3104,8 @@ void CServerGameClients::ClientEarPosition( edict_t *pEdict, Vector *pEarOrigin } //----------------------------------------------------------------------------- -// Purpose: -// Input : *player - +// Purpose: +// Input : *player - // Output : CPlayerState //----------------------------------------------------------------------------- CPlayerState *CServerGameClients::GetPlayerState( edict_t *player ) @@ -3124,8 +3124,8 @@ CPlayerState *CServerGameClients::GetPlayerState( edict_t *player ) //----------------------------------------------------------------------------- // Purpose: 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 -// Input : *buf - -// buflen - +// Input : *buf - +// buflen - //----------------------------------------------------------------------------- void CServerGameClients::GetBugReportInfo( char *buf, int buflen ) { @@ -3162,7 +3162,7 @@ void CServerGameClients::GetBugReportInfo( char *buf, int buflen ) } //----------------------------------------------------------------------------- -// Purpose: A user has had their network id setup and validated +// Purpose: A user has had their network id setup and validated //----------------------------------------------------------------------------- void CServerGameClients::NetworkIDValidated( const char *pszUserName, const char *pszNetworkID ) { @@ -3181,11 +3181,11 @@ void CServerGameClients::ClientCommandKeyValues( edict_t *pEntity, KeyValues *pK } //----------------------------------------------------------------------------- -// Purpose: +// Purpose: //----------------------------------------------------------------------------- static bf_write *g_pMsgBuffer = NULL; -void EntityMessageBegin( CBaseEntity * entity, bool reliable /*= false*/ ) +void EntityMessageBegin( CBaseEntity * entity, bool reliable /*= false*/ ) { Assert( !g_pMsgBuffer ); @@ -3201,7 +3201,7 @@ void UserMessageBegin( IRecipientFilter& filter, const char *messagename ) Assert( messagename ); int msg_type = usermessages->LookupUserMessage( messagename ); - + if ( msg_type == -1 ) { Error( "UserMessageBegin: Unregistered message '%s'\n", messagename ); @@ -3329,19 +3329,19 @@ void MessageWriteEHandle( CBaseEntity *pEntity ) Error( "WriteEHandle called with no active message\n" ); long iEncodedEHandle; - + if( 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 { iEncodedEHandle = INVALID_NETWORKED_EHANDLE_VALUE; } - + g_pMsgBuffer->WriteLong( iEncodedEHandle ); } diff --git a/sp/src/game/server/sendproxy.cpp b/sp/src/game/server/sendproxy.cpp index ad017c64..08a9cfa5 100644 --- a/sp/src/game/server/sendproxy.cpp +++ b/sp/src/game/server/sendproxy.cpp @@ -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 @@ -77,10 +77,10 @@ SendProp SendPropIntWithMinusOneFlag( const char *pVarName, int offset, int size //----------------------------------------------------------------------------- // Purpose: Proxy that only sends data to team members -// Input : *pStruct - -// *pData - -// *pOut - -// objectID - +// Input : *pStruct - +// *pData - +// *pOut - +// objectID - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- void* SendProxy_OnlyToTeam( const SendProp *pProp, const void *pStruct, const void *pVarData, CSendProxyRecipients *pRecipients, int objectID ) @@ -94,7 +94,7 @@ void* SendProxy_OnlyToTeam( const SendProp *pProp, const void *pStruct, const vo pRecipients->ClearAllRecipients(); for ( int i=0; i < pTeam->GetNumPlayers(); i++ ) pRecipients->SetRecipient( pTeam->GetPlayer( i )->GetClientIndex() ); - + return (void*)pVarData; } } @@ -121,11 +121,11 @@ static void SendProxy_Time( const SendProp *pProp, const void *pStruct, const vo } //----------------------------------------------------------------------------- -// Purpose: -// Input : *pVarName - -// sizeofVar - -// flags - -// pId - +// Purpose: +// Input : *pVarName - +// sizeofVar - +// flags - +// pId - // Output : SendProp //----------------------------------------------------------------------------- SendProp SendPropTime( @@ -144,11 +144,11 @@ SendProp SendPropTime( //----------------------------------------------------------------------------- // Purpose: Converts a predictable Id to an integer -// Input : *pStruct - -// *pVarData - -// *pOut - -// iElement - -// objectID - +// Input : *pStruct - +// *pVarData - +// *pOut - +// iElement - +// objectID - //----------------------------------------------------------------------------- static void SendProxy_PredictableIdToInt( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID ) { @@ -164,11 +164,11 @@ static void SendProxy_PredictableIdToInt( const SendProp *pProp, const void *pSt } //----------------------------------------------------------------------------- -// Purpose: -// Input : *pVarName - -// sizeofVar - -// flags - -// pId - +// Purpose: +// Input : *pVarName - +// sizeofVar - +// flags - +// pId - // Output : SendProp //----------------------------------------------------------------------------- SendProp SendPropPredictableId( diff --git a/sp/src/lib/public/linux32/mathlib.a b/sp/src/lib/public/linux32/mathlib.a index 225b51a7..cbd5ade0 100644 Binary files a/sp/src/lib/public/linux32/mathlib.a and b/sp/src/lib/public/linux32/mathlib.a differ diff --git a/sp/src/lib/public/linux32/raytrace.a b/sp/src/lib/public/linux32/raytrace.a index 881256ad..df574d45 100644 Binary files a/sp/src/lib/public/linux32/raytrace.a and b/sp/src/lib/public/linux32/raytrace.a differ diff --git a/sp/src/lib/public/linux32/tier1.a b/sp/src/lib/public/linux32/tier1.a index 9fe363f1..45788395 100644 Binary files a/sp/src/lib/public/linux32/tier1.a and b/sp/src/lib/public/linux32/tier1.a differ diff --git a/sp/src/lib/public/linux32/vgui_controls.a b/sp/src/lib/public/linux32/vgui_controls.a index 84aa3533..1e2f66f2 100644 Binary files a/sp/src/lib/public/linux32/vgui_controls.a and b/sp/src/lib/public/linux32/vgui_controls.a differ diff --git a/sp/src/tier1/generichash.cpp b/sp/src/tier1/generichash.cpp index a3a4a8a5..7716f182 100644 --- a/sp/src/tier1/generichash.cpp +++ b/sp/src/tier1/generichash.cpp @@ -78,7 +78,7 @@ static unsigned g_nRandomValues[256] = }; //----------------------------------------------------------------------------- -// String +// String //----------------------------------------------------------------------------- unsigned FASTCALL HashString( const char *pszKey ) { @@ -101,7 +101,7 @@ unsigned FASTCALL HashString( const char *pszKey ) //----------------------------------------------------------------------------- -// Case-insensitive string +// Case-insensitive string //----------------------------------------------------------------------------- unsigned FASTCALL HashStringCaseless( const char *pszKey ) { @@ -123,7 +123,7 @@ unsigned FASTCALL HashStringCaseless( const char *pszKey ) } //----------------------------------------------------------------------------- -// 32 bit conventional case-insensitive string +// 32 bit conventional case-insensitive string //----------------------------------------------------------------------------- unsigned FASTCALL HashStringCaselessConventional( const char *pszKey ) { @@ -147,9 +147,9 @@ unsigned FASTCALL HashInt( const int n ) odd = g_nRandomValues[((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ (n >> 24)]; - odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; - even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; - odd = g_nRandomValues[even ^ (n & 0xff)]; + odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)]; + even = g_nRandomValues[odd ^ (((n >> 8) & 0xff))]; + odd = g_nRandomValues[even ^ ((n & 0xff))]; return (even << 8) | odd; } @@ -168,7 +168,7 @@ unsigned FASTCALL Hash4( const void *pKey ) odd = g_nRandomValues[((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ (n >> 24)]; - odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; + odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)]; @@ -190,7 +190,7 @@ unsigned FASTCALL Hash8( const void *pKey ) odd = g_nRandomValues[((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ (n >> 24)]; - odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; + odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)]; @@ -218,7 +218,7 @@ unsigned FASTCALL Hash12( const void *pKey ) odd = g_nRandomValues[((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ (n >> 24)]; - odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; + odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)]; @@ -252,7 +252,7 @@ unsigned FASTCALL Hash16( const void *pKey ) odd = g_nRandomValues[((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ (n >> 24)]; - odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; + odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)]; @@ -330,11 +330,11 @@ uint32 MurmurHash2( const void * key, int len, uint32 seed ) { uint32 k = LittleDWord( *(uint32 *)data ); - k *= m; - k ^= k >> r; - k *= m; + k *= m; + k ^= k >> r; + k *= m; - h *= m; + h *= m; h ^= k; data += 4; @@ -434,4 +434,3 @@ uint64 MurmurHash64( const void * key, int len, uint32 seed ) return h; } - diff --git a/sp/src/vpc_scripts/groups.vgc b/sp/src/vpc_scripts/groups.vgc index 78744853..d5fd8ca2 100644 --- a/sp/src/vpc_scripts/groups.vgc +++ b/sp/src/vpc_scripts/groups.vgc @@ -55,7 +55,7 @@ $Group "everything" "vtfdiff" "vvis_dll" "vvis_launcher" - "togl" + //"togl" } $Group "dedicated"