diff options
| author | Joe Ludwig <[email protected]> | 2013-09-02 11:39:10 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-09-02 11:39:10 -0700 |
| commit | a0c29e7dd67abb15c74c85f07741784877edfdcd (patch) | |
| tree | 35bd6b4580afa14648895b0f321d33a712a5d0fa /sp/src/game | |
| parent | Added bloom shader and screenspace effect helpers as examples for the SDK. (diff) | |
| download | source-sdk-2013-a0c29e7dd67abb15c74c85f07741784877edfdcd.tar.xz source-sdk-2013-a0c29e7dd67abb15c74c85f07741784877edfdcd.zip | |
General:
* Fixed a variety of server browser issues with mods based on this SDK
* Fixed many warnings on various platforms
* Added source code for fgdlib and raytrace
* Updated many source files with the latest shared source from TF2.
OSX:
* Added support for Xcode 4.6
* Switched OSX builds to use Xcode instead of makefiles
* Moved libs from src/lib/osx32 to src/lib/public/osx32 or src/lib/common/osx32 to match windows better.
Linux:
* Moved libs from src/lib/linux32 to src/lib/public/linux32 or src/lib/common/linux32 to match windows better.
Diffstat (limited to 'sp/src/game')
29 files changed, 305 insertions, 178 deletions
diff --git a/sp/src/game/client/c_baseentity.cpp b/sp/src/game/client/c_baseentity.cpp index 8e2e752d..89b503d4 100644 --- a/sp/src/game/client/c_baseentity.cpp +++ b/sp/src/game/client/c_baseentity.cpp @@ -2462,27 +2462,36 @@ void C_BaseEntity::UnlinkFromHierarchy() void C_BaseEntity::ValidateModelIndex( void )
{
#ifdef TF_CLIENT_DLL
- if ( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_DEFAULT] > 0 )
+ if ( m_nModelIndexOverrides[VISION_MODE_NONE] > 0 )
{
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_HALLOWEEN ) )
{
- if ( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_HALLOWEEN] > 0 )
+ if ( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] > 0 )
{
- SetModelByIndex( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_HALLOWEEN] );
+ SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_PYRO ) )
{
- if ( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_PYRO] > 0 )
+ if ( m_nModelIndexOverrides[VISION_MODE_PYRO] > 0 )
{
- SetModelByIndex( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_PYRO] );
+ SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_PYRO] );
return;
}
}
- SetModelByIndex( m_nModelIndexOverrides[MODEL_INDEX_OVERRIDE_DEFAULT] );
+ if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_ROME ) )
+ {
+ if ( m_nModelIndexOverrides[VISION_MODE_ROME] > 0 )
+ {
+ SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_ROME] );
+ return;
+ }
+ }
+
+ SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_NONE] );
return;
}
@@ -3597,6 +3606,48 @@ void C_BaseEntity::AddStudioDecal( const Ray_t& ray, int hitbox, int decalIndex, }
}
+//-----------------------------------------------------------------------------
+void C_BaseEntity::AddColoredStudioDecal( const Ray_t& ray, int hitbox, int decalIndex,
+ bool doTrace, trace_t& tr, Color cColor, int maxLODToDecal )
+{
+ if (doTrace)
+ {
+ enginetrace->ClipRayToEntity( ray, MASK_SHOT, this, &tr );
+
+ // Trace the ray against the entity
+ if (tr.fraction == 1.0f)
+ return;
+
+ // Set the trace index appropriately...
+ tr.m_pEnt = this;
+ }
+
+ // Exit out after doing the trace so any other effects that want to happen can happen.
+ if ( !r_drawmodeldecals.GetBool() )
+ return;
+
+ // Found the point, now lets apply the decals
+ CreateModelInstance();
+
+ // FIXME: Pass in decal up?
+ Vector up(0, 0, 1);
+
+ if (doTrace && (GetSolid() == SOLID_VPHYSICS) && !tr.startsolid && !tr.allsolid)
+ {
+ // Choose a more accurate normal direction
+ // Also, since we have more accurate info, we can avoid pokethru
+ Vector temp;
+ VectorSubtract( tr.endpos, tr.plane.normal, temp );
+ Ray_t betterRay;
+ betterRay.Init( tr.endpos, temp );
+ modelrender->AddColoredDecal( m_ModelInstance, betterRay, up, decalIndex, GetStudioBody(), cColor, true, maxLODToDecal );
+ }
+ else
+ {
+ modelrender->AddColoredDecal( m_ModelInstance, ray, up, decalIndex, GetStudioBody(), cColor, false, maxLODToDecal );
+ }
+}
+
//-----------------------------------------------------------------------------
// This method works when we've got a brush model
@@ -3648,6 +3699,56 @@ void C_BaseEntity::AddDecal( const Vector& rayStart, const Vector& rayEnd, }
//-----------------------------------------------------------------------------
+void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd,
+ const Vector& decalCenter, int hitbox, int decalIndex, bool doTrace, trace_t& tr, Color cColor, int maxLODToDecal )
+{
+ Ray_t ray;
+ ray.Init( rayStart, rayEnd );
+
+ // FIXME: Better bloat?
+ // Bloat a little bit so we get the intersection
+ ray.m_Delta *= 1.1f;
+
+ int modelType = modelinfo->GetModelType( model );
+ if ( doTrace )
+ {
+ enginetrace->ClipRayToEntity( ray, MASK_SHOT, this, &tr );
+ switch ( modelType )
+ {
+ case mod_studio:
+ tr.m_pEnt = this;
+ break;
+ case mod_brush:
+ if ( tr.fraction == 1.0f )
+ return; // Explicitly end
+ default:
+ // By default, no collision
+ tr.fraction = 1.0f;
+ break;
+ }
+ }
+
+ switch ( modelType )
+ {
+ case mod_studio:
+ AddColoredStudioDecal( ray, hitbox, decalIndex, doTrace, tr, cColor, maxLODToDecal );
+ break;
+
+ case mod_brush:
+ {
+ color32 cColor32 = { cColor.r(), cColor.g(), cColor.b(), cColor.a() };
+ effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
+ }
+ break;
+
+ default:
+ // By default, no collision
+ tr.fraction = 1.0f;
+ break;
+ }
+}
+
+//-----------------------------------------------------------------------------
// A method to remove all decals from an entity
//-----------------------------------------------------------------------------
void C_BaseEntity::RemoveAllDecals( void )
diff --git a/sp/src/game/client/c_baseentity.h b/sp/src/game/client/c_baseentity.h index 3ea4b7fd..e00513df 100644 --- a/sp/src/game/client/c_baseentity.h +++ b/sp/src/game/client/c_baseentity.h @@ -770,6 +770,10 @@ public: // A method to apply a decal to an entity
virtual void AddDecal( const Vector& rayStart, const Vector& rayEnd,
const Vector& decalCenter, int hitbox, int decalIndex, bool doTrace, trace_t& tr, int maxLODToDecal = ADDDECAL_TO_ALL_LODS );
+
+ virtual void AddColoredDecal( const Vector& rayStart, const Vector& rayEnd,
+ const Vector& decalCenter, int hitbox, int decalIndex, bool doTrace, trace_t& tr, Color cColor, int maxLODToDecal = ADDDECAL_TO_ALL_LODS );
+
// A method to remove all decals from an entity
void RemoveAllDecals( void );
@@ -1317,7 +1321,7 @@ public: short m_nModelIndex;
#ifdef TF_CLIENT_DLL
- int m_nModelIndexOverrides[MAX_MODEL_INDEX_OVERRIDES];
+ int m_nModelIndexOverrides[MAX_VISION_MODES];
#endif
char m_takedamage;
@@ -1464,6 +1468,7 @@ private: // methods related to decal adding
void AddStudioDecal( const Ray_t& ray, int hitbox, int decalIndex, bool doTrace, trace_t& tr, int maxLODToDecal = ADDDECAL_TO_ALL_LODS );
+ void AddColoredStudioDecal( const Ray_t& ray, int hitbox, int decalIndex, bool doTrace, trace_t& tr, Color cColor, int maxLODToDecal );
void AddBrushModelDecal( const Ray_t& ray, const Vector& decalCenter, int decalIndex, bool doTrace, trace_t& tr );
void ComputePackedOffsets( void );
diff --git a/sp/src/game/client/c_baseplayer.cpp b/sp/src/game/client/c_baseplayer.cpp index 8e4ff89f..74c12bbc 100644 --- a/sp/src/game/client/c_baseplayer.cpp +++ b/sp/src/game/client/c_baseplayer.cpp @@ -2178,7 +2178,7 @@ void C_BasePlayer::PlayPlayerJingle() if ( !filesystem->FileExists( fullsoundname ) )
{
char custname[ 512 ];
- Q_snprintf( custname, sizeof( custname ), "downloads/%s.dat", soundhex );
+ Q_snprintf( custname, sizeof( custname ), "download/user_custom/%c%c/%s.dat", soundhex[0], soundhex[1], soundhex );
// it may have been downloaded but not copied under materials folder
if ( !filesystem->FileExists( custname ) )
return; // not downloaded yet
diff --git a/sp/src/game/client/cdll_client_int.cpp b/sp/src/game/client/cdll_client_int.cpp index c8f7f40b..4e856c95 100644 --- a/sp/src/game/client/cdll_client_int.cpp +++ b/sp/src/game/client/cdll_client_int.cpp @@ -116,6 +116,7 @@ #include "rtime.h"
#include "tf_hud_disconnect_prompt.h"
#include "../engine/audio/public/sound.h"
+#include "tf_shared_content_manager.h"
#endif
#include "clientsteamcontext.h"
#include "renamed_recvtable_compat.h"
@@ -1018,6 +1019,7 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi #if defined( TF_CLIENT_DLL )
IGameSystem::Add( CustomTextureToolCacheGameSystem() );
+ IGameSystem::Add( TFSharedContentManager() );
#endif
#if defined( TF_CLIENT_DLL )
diff --git a/sp/src/game/client/client_base.vpc b/sp/src/game/client/client_base.vpc index 8acae4f7..757a4cce 100644 --- a/sp/src/game/client/client_base.vpc +++ b/sp/src/game/client/client_base.vpc @@ -44,14 +44,18 @@ $Configuration "Release" $Configuration
{
+ $General
+ {
+ $OutputDirectory ".\$GAMENAME" [$OSXALL]
+ }
+
$Compiler
{
$AdditionalIncludeDirectories ".\;$BASE;$SRCDIR\vgui2\include;$SRCDIR\vgui2\controls;$SRCDIR\game\shared;.\game_controls;$SRCDIR\thirdparty\sixensesdk\include"
$PreprocessorDefinitions "$BASE;NO_STRING_T;CLIENT_DLL;VECTOR;VERSION_SAFE_STEAM_API_INTERFACES;PROTECTED_THINGS_ENABLE;strncpy=use_Q_strncpy_instead;_snprintf=use_Q_snprintf_instead"
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;fopen=dont_use_fopen" [$WIN32]
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;" [$OSXALL]
- $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;" [$LINUX]
- $PreprocessorDefinitions "$BASE;USE_WEBM_FOR_REPLAY" [$LINUX]
+ $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;USE_WEBM_FOR_REPLAY;" [$LINUXALL]
$PreprocessorDefinitions "$BASE;CURL_STATICLIB" [$WIN32 && $BUILD_REPLAY]
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
$Create/UsePCHThroughFile "cbase.h"
@@ -1232,55 +1236,7 @@ $Project $File "game_controls\IconPanel.h"
}
- $Folder "Link Libraries" [$WIN32]
- {
- $DynamicFile "$SRCDIR\lib\public\bitmap.lib"
- $DynamicFile "$SRCDIR\lib\public\choreoobjects.lib"
- $DynamicFile "$SRCDIR\lib\public\dmxloader.lib"
- $DynamicFile "$SRCDIR\lib\public\mathlib.lib"
- $DynamicFile "$SRCDIR\lib\public\matsys_controls.lib"
- $DynamicFile "$SRCDIR\lib\public\particles.lib"
- $DynamicFile "$SRCDIR\lib\public\tier1.lib"
- $DynamicFile "$SRCDIR\lib\public\tier2.lib"
- $DynamicFile "$SRCDIR\lib\public\tier3.lib"
- $DynamicFile "$SRCDIR\lib\public\vgui_controls.lib"
- $DynamicFile "$SRCDIR\lib\public\steam_api.lib"
- $DynamicFile "$SRCDIR\lib\public\vtf.lib"
- $DynamicFile "$SRCDIR\lib\win32\release\libcurl.lib" [$BUILD_REPLAY]
- }
-
- $Folder "Link Libraries" [$X360]
- {
- $DynamicFile "$SRCDIR\lib\public\bitmap_360.lib"
- $DynamicFile "$SRCDIR\lib\public\choreoobjects_360.lib"
- $DynamicFile "$SRCDIR\lib\public\dmxloader_360.lib"
- $DynamicFile "$SRCDIR\lib\public\mathlib_360.lib"
- $DynamicFile "$SRCDIR\lib\public\matsys_controls_360.lib"
- $DynamicFile "$SRCDIR\lib\public\particles_360.lib"
- $DynamicFile "$SRCDIR\lib\public\tier1_360.lib"
- $DynamicFile "$SRCDIR\lib\public\tier2_360.lib"
- $DynamicFile "$SRCDIR\lib\public\tier3_360.lib"
- $DynamicFile "$SRCDIR\lib\public\vgui_controls_360.lib"
- }
-
- $Folder "Link Libraries" [$POSIX && !$LINUX]
- {
- $DynamicFile "$SRCDIR\lib\$PLATFORM\libcurl$_IMPLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\bitmap$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\choreoobjects$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\dmxloader$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\mathlib$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\matsys_controls$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\particles$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\tier1$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\tier2$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\tier3$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\vgui_controls$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\$_IMPLIB_PREFIXsteam_api$_IMPLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\vtf$_STATICLIB_EXT"
- }
-
- $Folder "Link Libraries" [$LINUX]
+ $Folder "Link Libraries"
{
$Lib bitmap
$Lib choreoobjects
@@ -1292,12 +1248,20 @@ $Project $Lib tier2
$Lib tier3
$Lib vgui_controls
- $Lib vtf
- $DynamicFile "$SRCDIR\lib\$PLATFORM\$_IMPLIB_PREFIXsteam_api$_IMPLIB_EXT"
- $DynamicFile "$SRCDIR/lib/linux32/libcurl$_STATICLIB_EXT" [$DEDICATED]
- $DynamicFile "$SRCDIR/lib/linux32/libcurlssl$_STATICLIB_EXT" [!$DEDICATED]
- $DynamicFile "$SRCDIR/lib/linux32/libssl$_STATICLIB_EXT" [!$DEDICATED]
- $DynamicFile "$SRCDIR/lib/linux32/release/libcrypto$_STATICLIB_EXT" [!$DEDICATED]
+ $Lib vtf
+ $ImpLib steam_api
+
+ $Lib $LIBCOMMON/libcrypto [$POSIX]
+
+ $ImpLib "$LIBCOMMON\curl" [$OSXALL]
+
+ $Lib "$LIBCOMMON\libcurl" [$WIN32]
+ $Lib "libz" [$WIN32]
+
+ $Libexternal libz [$LINUXALL]
+ $Libexternal "$LIBCOMMON/libcurl" [$LINUXALL]
+ $Libexternal "$LIBCOMMON/libcurlssl" [$LINUXALL]
+ $Libexternal "$LIBCOMMON/libssl" [$LINUXALL]
}
}
diff --git a/sp/src/game/client/client_episodic.vpc b/sp/src/game/client/client_episodic.vpc index a45cc175..249ea267 100644 --- a/sp/src/game/client/client_episodic.vpc +++ b/sp/src/game/client/client_episodic.vpc @@ -10,9 +10,6 @@ $Macro GAMENAME "mod_episodic" [$SOURCESDK] $Include "$SRCDIR\game\client\client_base.vpc"
-$macro VSLIBDIR "." [!$VS2010]
-$macro VSLIBDIR "VS2010" [$VS2010]
-
$Configuration
{
$Compiler
@@ -131,17 +128,5 @@ $Project "Client (Episodic)" $File "episodic\c_npc_puppet.cpp"
}
}
-
- $Folder "Libraries"
- {
- $File "$SRCDIR\lib\$PLATFORM\release\$VSLIBDIR\libprotobuf.lib" [$WINDOWS]
- {
- $Configuration "Debug" { $ExcludedFromBuild "Yes" }
- }
- $File "$SRCDIR\lib\$PLATFORM\debug\$VSLIBDIR\libprotobuf.lib" [$WINDOWS]
- {
- $Configuration "Release" { $ExcludedFromBuild "Yes" }
- }
- $File "$SRCDIR\lib\$PLATFORM\release\libprotobuf.a" [$POSIX]
- }
+
}
diff --git a/sp/src/game/client/client_hl2.vpc b/sp/src/game/client/client_hl2.vpc index 5cc5b863..a5598a1d 100644 --- a/sp/src/game/client/client_hl2.vpc +++ b/sp/src/game/client/client_hl2.vpc @@ -11,9 +11,6 @@ $Macro GAMENAME "mod_hl2" [$SOURCESDK] $Include "$SRCDIR\game\client\client_base.vpc"
$Include "$SRCDIR\game\protobuf_include.vpc"
-$macro VSLIBDIR "." [!$VS2010]
-$macro VSLIBDIR "VS2010" [$VS2010]
-
$Configuration
{
$Compiler
@@ -117,17 +114,4 @@ $Project "Client (HL2)" $File "episodic\c_vort_charge_token.cpp"
}
}
-
- $Folder "Libraries"
- {
- $File "$SRCDIR\lib\$PLATFORM\release\$VSLIBDIR\libprotobuf.lib" [$WINDOWS]
- {
- $Configuration "Debug" { $ExcludedFromBuild "Yes" }
- }
- $File "$SRCDIR\lib\$PLATFORM\debug\$VSLIBDIR\libprotobuf.lib" [$WINDOWS]
- {
- $Configuration "Release" { $ExcludedFromBuild "Yes" }
- }
- $File "$SRCDIR\lib\$PLATFORM\release\libprotobuf.a" [$POSIX]
- }
}
diff --git a/sp/src/game/client/death.cpp b/sp/src/game/client/death.cpp index fa63ede8..50463d57 100644 --- a/sp/src/game/client/death.cpp +++ b/sp/src/game/client/death.cpp @@ -289,7 +289,7 @@ void CHudDeathNotice::FireGameEvent( KeyValues * event) if ( !strcmp( killedwith+2, "gauss" ) )
Q_strncpy( killedwith, "d_tau cannon", sizeof( killedwith ) );
- Msg( killedwith+2 ); // skip over the "d_" part
+ Msg( "%s", killedwith+2 ); // skip over the "d_" part
}
Msg( "\n" );
diff --git a/sp/src/game/protobuf_include.vpc b/sp/src/game/protobuf_include.vpc index 6b21fb6a..75392eda 100644 --- a/sp/src/game/protobuf_include.vpc +++ b/sp/src/game/protobuf_include.vpc @@ -6,25 +6,10 @@ $MacroRequired "PLATFORM"
-$macro VSLIBDIR "." [!$VS2010]
-$macro VSLIBDIR "VS2010" [$VS2010]
-
$Project
{
$Folder "Libraries"
{
- // Always use the release version of libprotobuf.lib because the debug
- // version uses iterator debugging, which is incompatible with the rest of
- // the Valve world.
- $File "$SRCDIR\lib\$PLATFORM\release\$VSLIBDIR\libprotobuf.lib" [$WINDOWS && $VS2010]
- $File "$SRCDIR\lib\$PLATFORM\release\$VSLIBDIR\libprotobuf.lib" [$WINDOWS && !$VS2010]
- {
- $Configuration "Debug" { $ExcludedFromBuild "Yes" }
- }
- $File "$SRCDIR\lib\$PLATFORM\debug\$VSLIBDIR\libprotobuf.lib" [$WINDOWS && !$VS2010]
- {
- $Configuration "Release" { $ExcludedFromBuild "Yes" }
- }
- $File "$SRCDIR\lib\$PLATFORM\release\libprotobuf.a" [$POSIX]
+ $Libexternal libprotobuf
}
}
diff --git a/sp/src/game/server/ai_behavior_lead.cpp b/sp/src/game/server/ai_behavior_lead.cpp index 10462e08..cc4e0aed 100644 --- a/sp/src/game/server/ai_behavior_lead.cpp +++ b/sp/src/game/server/ai_behavior_lead.cpp @@ -3,7 +3,8 @@ // Purpose:
//
//=============================================================================//
-
+#undef strncpy // we use std::string below that needs a good strncpy define
+#undef sprintf // "
#include "cbase.h"
#include "ai_behavior_lead.h"
diff --git a/sp/src/game/server/ai_networkmanager.cpp b/sp/src/game/server/ai_networkmanager.cpp index 00826e02..69d6319e 100644 --- a/sp/src/game/server/ai_networkmanager.cpp +++ b/sp/src/game/server/ai_networkmanager.cpp @@ -48,7 +48,7 @@ inline void DebugConnectMsg( int node1, int node2, const char *pszFormat, ... ) Q_vsnprintf( string, sizeof(string), pszFormat, argptr );
va_end( argptr );
- DevMsg( string );
+ DevMsg( "%s", string );
}
}
diff --git a/sp/src/game/server/ai_tacticalservices.cpp b/sp/src/game/server/ai_tacticalservices.cpp index 08d32699..70fc643c 100644 --- a/sp/src/game/server/ai_tacticalservices.cpp +++ b/sp/src/game/server/ai_tacticalservices.cpp @@ -347,7 +347,7 @@ int CAI_TacticalServices::FindCoverNode(const Vector &vNearPos, const Vector &vT MARK_TASK_EXPENSIVE();
- DebugFindCover( g_AIDebugFindCoverNode, GetOuter()->EyePosition(), vThreatEyePos, 0, 255, 255 );
+ DebugFindCover( NO_NODE, GetOuter()->EyePosition(), vThreatEyePos, 0, 255, 255 );
int iMyNode = GetPathfinder()->NearestNodeToPoint( vNearPos );
diff --git a/sp/src/game/server/baseentity.cpp b/sp/src/game/server/baseentity.cpp index 689aa020..48f1a4a7 100644 --- a/sp/src/game/server/baseentity.cpp +++ b/sp/src/game/server/baseentity.cpp @@ -653,7 +653,7 @@ void CBaseEntity::SetModelIndex( int index ) void CBaseEntity::ClearModelIndexOverrides( void )
{
#ifdef TF_DLL
- for ( int index = 0 ; index < MAX_MODEL_INDEX_OVERRIDES ; index++ )
+ for ( int index = 0 ; index < MAX_VISION_MODES ; index++ )
{
m_nModelIndexOverrides.Set( index, 0 );
}
@@ -663,7 +663,7 @@ void CBaseEntity::ClearModelIndexOverrides( void ) void CBaseEntity::SetModelIndexOverride( int index, int nValue )
{
#ifdef TF_DLL
- if ( ( index >= MODEL_INDEX_OVERRIDE_DEFAULT ) && ( index < MAX_MODEL_INDEX_OVERRIDES ) )
+ if ( ( index >= VISION_MODE_NONE ) && ( index < MAX_VISION_MODES ) )
{
if ( nValue != m_nModelIndexOverrides[index] )
{
@@ -1950,7 +1950,7 @@ BEGIN_DATADESC_NO_BASE( CBaseEntity ) // DEFINE_FIELD( m_fDataObjectTypes, FIELD_INTEGER ),
#ifdef TF_DLL
- DEFINE_ARRAY( m_nModelIndexOverrides, FIELD_INTEGER, MAX_MODEL_INDEX_OVERRIDES ),
+ DEFINE_ARRAY( m_nModelIndexOverrides, FIELD_INTEGER, MAX_VISION_MODES ),
#endif
END_DATADESC()
@@ -7302,6 +7302,30 @@ void CC_Ent_Create( const CCommand& args ) {
MDLCACHE_CRITICAL_SECTION();
+ CBasePlayer *pPlayer = UTIL_GetCommandClient();
+ if (!pPlayer)
+ {
+ return;
+ }
+
+ // Don't allow regular users to create point_servercommand entities for the same reason as blocking ent_fire
+ if ( !Q_stricmp( args[1], "point_servercommand" ) )
+ {
+ if ( engine->IsDedicatedServer() )
+ {
+ // We allow people with disabled autokick to do it, because they already have rcon.
+ if ( pPlayer->IsAutoKickDisabled() == false )
+ return;
+ }
+ else if ( gpGlobals->maxClients > 1 )
+ {
+ // On listen servers with more than 1 player, only allow the host to create point_servercommand.
+ CBasePlayer *pHostPlayer = UTIL_GetListenServerHost();
+ if ( pPlayer != pHostPlayer )
+ return;
+ }
+ }
+
bool allowPrecache = CBaseEntity::IsPrecacheAllowed();
CBaseEntity::SetAllowPrecache( true );
@@ -7322,7 +7346,6 @@ void CC_Ent_Create( const CCommand& args ) DispatchSpawn(entity);
// Now attempt to drop into the world
- CBasePlayer* pPlayer = UTIL_GetCommandClient();
trace_t tr;
Vector forward;
pPlayer->EyeVectors( &forward );
diff --git a/sp/src/game/server/baseentity.h b/sp/src/game/server/baseentity.h index 016915ca..7bcc3c2e 100644 --- a/sp/src/game/server/baseentity.h +++ b/sp/src/game/server/baseentity.h @@ -792,7 +792,7 @@ public: CNetworkVar( short, m_nModelIndex );
#ifdef TF_DLL
- CNetworkArray( int, m_nModelIndexOverrides, MAX_MODEL_INDEX_OVERRIDES ); // used to override the base model index on the client if necessary
+ CNetworkArray( int, m_nModelIndexOverrides, MAX_VISION_MODES ); // used to override the base model index on the client if necessary
#endif
// was pev->rendercolor
diff --git a/sp/src/game/server/client.cpp b/sp/src/game/server/client.cpp index 2fd87cfe..39905046 100644 --- a/sp/src/game/server/client.cpp +++ b/sp/src/game/server/client.cpp @@ -798,6 +798,24 @@ CON_COMMAND( give, "Give item to player.\n\tArguments: <item_name>" ) Q_strncpy( item_to_give, args[1], sizeof( item_to_give ) );
Q_strlower( item_to_give );
+ // Don't allow regular users to create point_servercommand entities for the same reason as blocking ent_fire
+ if ( !Q_stricmp( item_to_give, "point_servercommand" ) )
+ {
+ if ( engine->IsDedicatedServer() )
+ {
+ // We allow people with disabled autokick to do it, because they already have rcon.
+ if ( pPlayer->IsAutoKickDisabled() == false )
+ return;
+ }
+ else if ( gpGlobals->maxClients > 1 )
+ {
+ // On listen servers with more than 1 player, only allow the host to create point_servercommand.
+ CBasePlayer *pHostPlayer = UTIL_GetListenServerHost();
+ if ( pPlayer != pHostPlayer )
+ return;
+ }
+ }
+
// Dirty hack to avoid suit playing it's pickup sound
if ( !Q_stricmp( item_to_give, "item_suit" ) )
{
diff --git a/sp/src/game/server/doors.cpp b/sp/src/game/server/doors.cpp index 53abb829..d8f06c49 100644 --- a/sp/src/game/server/doors.cpp +++ b/sp/src/game/server/doors.cpp @@ -340,12 +340,11 @@ void CBaseDoor::Spawn() #ifdef TF_DLL
if ( TFGameRules() && TFGameRules()->IsMultiplayer() )
{
- if ( !m_flBlockDamage )
- {
- // Never block doors in TF2 - to prevent various exploits.
- m_flBlockDamage = 10.f;
- }
+ // Never block doors in TF2 - to prevent various exploits.
+ m_bIgnoreNonPlayerEntsOnBlock = true;
}
+#else
+ m_bIgnoreNonPlayerEntsOnBlock = false;
#endif // TF_DLL
}
@@ -1207,6 +1206,11 @@ void CBaseDoor::Blocked( CBaseEntity *pOther ) pOther->TakeDamage( CTakeDamageInfo( this, this, m_flBlockDamage, DMG_CRUSH ) );
}
}
+ // If set, ignore non-player ents that block us. Mainly of use in multiplayer to prevent exploits.
+ else if ( pOther && !pOther->IsPlayer() && m_bIgnoreNonPlayerEntsOnBlock )
+ {
+ return;
+ }
// If we're set to force ourselves closed, keep going
if ( m_bForceClosed )
diff --git a/sp/src/game/server/doors.h b/sp/src/game/server/doors.h index 0de009dc..0a545ecf 100644 --- a/sp/src/game/server/doors.h +++ b/sp/src/game/server/doors.h @@ -114,6 +114,7 @@ public: bool m_bDoorGroup;
bool m_bLocked; // Whether the door is locked
bool m_bIgnoreDebris;
+ bool m_bIgnoreNonPlayerEntsOnBlock; // Non-player entities should never block. This variable needs more letters.
FuncDoorSpawnPos_t m_eSpawnPosition;
diff --git a/sp/src/game/server/episodic/npc_hunter.cpp b/sp/src/game/server/episodic/npc_hunter.cpp index fa9daff8..9d7dfd3e 100644 --- a/sp/src/game/server/episodic/npc_hunter.cpp +++ b/sp/src/game/server/episodic/npc_hunter.cpp @@ -2199,7 +2199,7 @@ void CNPC_Hunter::PrescheduleThink() if ( m_flPupilDilateTime < gpGlobals->curtime )
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex( 1 );
- if ( pPlayer && !pPlayer->IsIlluminatedByFlashlight( this, NULL ) || !PlayerFlashlightOnMyEyes( pPlayer ) )
+ if ( ( pPlayer && !pPlayer->IsIlluminatedByFlashlight( this, NULL ) ) || !PlayerFlashlightOnMyEyes( pPlayer ) )
{
//Msg( "NOT SHINING FLASHLIGHT ON ME\n" );
@@ -6347,13 +6347,13 @@ void CNPC_Hunter::FootFX( const Vector &origin ) CBaseEntity *CNPC_Hunter::GetEnemyVehicle()
{
if ( GetEnemy() == NULL )
- return false;
+ return NULL;
CBaseCombatCharacter *pCCEnemy = GetEnemy()->MyCombatCharacterPointer();
if ( pCCEnemy != NULL )
return pCCEnemy->GetVehicleEntity();
- return false;
+ return NULL;
}
diff --git a/sp/src/game/server/hl2/npc_barnacle.cpp b/sp/src/game/server/hl2/npc_barnacle.cpp index 92201730..012d371d 100644 --- a/sp/src/game/server/hl2/npc_barnacle.cpp +++ b/sp/src/game/server/hl2/npc_barnacle.cpp @@ -1810,7 +1810,10 @@ void CNPC_Barnacle::SwallowPrey( void ) #if HL2_EPISODIC
// digest poisonous things for just a moment before being killed by them (it looks wierd if it's instant)
- m_flDigestFinish = gpGlobals->curtime + m_bSwallowingPoison ? 0.48f : 10.0f;
+ // Parentheses were probably intended around the ?: part of the expression, but putting them there now
+ // would change the behavior which is undesirable, so parentheses were placed around the '+' to suppress
+ // compiler warnings.
+ m_flDigestFinish = ( gpGlobals->curtime + m_bSwallowingPoison ) ? 0.48f : 10.0f;
#else
m_flDigestFinish = gpGlobals->curtime + 10.0;
#endif
diff --git a/sp/src/game/server/hl2/npc_zombine.cpp b/sp/src/game/server/hl2/npc_zombine.cpp index 5c74e1a9..611dc682 100644 --- a/sp/src/game/server/hl2/npc_zombine.cpp +++ b/sp/src/game/server/hl2/npc_zombine.cpp @@ -571,7 +571,7 @@ void CNPC_Zombine::HandleAnimEvent( animevent_t *pEvent ) {
pNPC = ppAIs[i];
- if( pNPC->Classify() == CLASS_PLAYER_ALLY || pNPC->Classify() == CLASS_PLAYER_ALLY_VITAL && pNPC->FVisible(this) )
+ if( pNPC->Classify() == CLASS_PLAYER_ALLY || ( pNPC->Classify() == CLASS_PLAYER_ALLY_VITAL && pNPC->FVisible(this) ) )
{
int priority;
Disposition_t disposition;
diff --git a/sp/src/game/server/player.cpp b/sp/src/game/server/player.cpp index 2738e40a..2bed6415 100644 --- a/sp/src/game/server/player.cpp +++ b/sp/src/game/server/player.cpp @@ -3311,7 +3311,8 @@ void CBasePlayer::PhysicsSimulate( void ) }
#endif // _DEBUG
- if ( int numUsrCmdProcessTicksMax = sv_maxusrcmdprocessticks.GetInt() )
+ int numUsrCmdProcessTicksMax = sv_maxusrcmdprocessticks.GetInt();
+ if ( gpGlobals->maxClients != 1 && numUsrCmdProcessTicksMax ) // don't apply this filter in SP games
{
// Grant the client some time buffer to execute user commands
m_flMovementTimeForUserCmdProcessingRemaining += TICK_INTERVAL;
diff --git a/sp/src/game/server/player.h b/sp/src/game/server/player.h index c17ff974..c1fa4f69 100644 --- a/sp/src/game/server/player.h +++ b/sp/src/game/server/player.h @@ -358,7 +358,7 @@ public: bool IsHLTV( void ) const { return pl.hltv; }
bool IsReplay( void ) const { return pl.replay; }
- virtual bool IsPlayer( void ) const { return true; } // Spectators return TRUE for this, use IsObserver to seperate cases
+ virtual bool IsPlayer( void ) const { return true; } // Spectators return TRUE for this, use IsObserver to separate cases
virtual bool IsNetClient( void ) const { return true; } // Bots should return FALSE for this, they can't receive NET messages
// Spectators should return TRUE for this
@@ -1500,6 +1500,44 @@ int CollectPlayers( CUtlVector< T * > *playerVector, int team = TEAM_ANY, bool i return playerVector->Count();
}
+template < typename T >
+int CollectHumanPlayers( CUtlVector< T * > *playerVector, int team = TEAM_ANY, bool isAlive = false, bool shouldAppend = false )
+{
+ if ( !shouldAppend )
+ {
+ playerVector->RemoveAll();
+ }
+
+ for( int i=1; i<=gpGlobals->maxClients; ++i )
+ {
+ CBasePlayer *player = UTIL_PlayerByIndex( i );
+
+ if ( player == NULL )
+ continue;
+
+ if ( FNullEnt( player->edict() ) )
+ continue;
+
+ if ( !player->IsPlayer() )
+ continue;
+
+ if ( player->IsBot() )
+ continue;
+
+ if ( !player->IsConnected() )
+ continue;
+
+ if ( team != TEAM_ANY && player->GetTeamNumber() != team )
+ continue;
+
+ if ( isAlive && !player->IsAlive() )
+ continue;
+
+ playerVector->AddToTail( assert_cast< T * >( player ) );
+ }
+
+ return playerVector->Count();
+}
enum
{
diff --git a/sp/src/game/server/props.cpp b/sp/src/game/server/props.cpp index eefa467b..d20756f3 100644 --- a/sp/src/game/server/props.cpp +++ b/sp/src/game/server/props.cpp @@ -1937,6 +1937,18 @@ void CDynamicProp::Spawn( ) }
//m_debugOverlays |= OVERLAY_ABSBOX_BIT;
+
+#ifdef TF_DLL
+ const char *pszModelName = modelinfo->GetModelName( GetModel() );
+ if ( pszModelName && pszModelName[0] )
+ {
+ if ( FStrEq( pszModelName, "models/bots/boss_bot/carrier_parts.mdl" ) )
+ {
+ SetModelIndexOverride( VISION_MODE_NONE, modelinfo->GetModelIndex( pszModelName ) );
+ SetModelIndexOverride( VISION_MODE_ROME, modelinfo->GetModelIndex( "models/bots/tw2/boss_bot/twcarrier_addon.mdl" ) );
+ }
+ }
+#endif
}
//-----------------------------------------------------------------------------
diff --git a/sp/src/game/server/server_base.vpc b/sp/src/game/server/server_base.vpc index 8b24610b..94dfd0f9 100644 --- a/sp/src/game/server/server_base.vpc +++ b/sp/src/game/server/server_base.vpc @@ -44,6 +44,11 @@ $Configuration "Release" $Configuration
{
+ $General
+ {
+ $OutputDirectory ".\$GAMENAME" [$OSXALL]
+ }
+
$Compiler
{
$AdditionalIncludeDirectories "$BASE;.\;$SRCDIR\game\shared;$SRCDIR\utils\common;$SRCDIR\game\shared\econ;$SRCDIR\game\server\NextBot"
@@ -998,40 +1003,7 @@ $Project $File "toolframework_server.h"
}
-
- $Folder "Link Libraries" [$WIN32]
- {
- $DynamicFile "$SRCDIR\lib\public\choreoobjects.lib"
- $DynamicFile "$SRCDIR\lib\public\dmxloader.lib"
- $DynamicFile "$SRCDIR\lib\public\mathlib.lib"
- $DynamicFile "$SRCDIR\lib\public\particles.lib"
- $DynamicFile "$SRCDIR\lib\public\tier2.lib"
- $DynamicFile "$SRCDIR\lib\public\tier3.lib"
- $DynamicFile "$SRCDIR\lib\public\steam_api.lib"
- }
-
- $Folder "Link Libraries" [$X360]
- {
- $DynamicFile "$SRCDIR\lib\public\choreoobjects_360.lib"
- $DynamicFile "$SRCDIR\lib\public\dmxloader_360.lib"
- $DynamicFile "$SRCDIR\lib\public\mathlib_360.lib"
- $DynamicFile "$SRCDIR\lib\public\particles_360.lib"
- $DynamicFile "$SRCDIR\lib\public\tier2_360.lib"
- $DynamicFile "$SRCDIR\lib\public\tier3_360.lib"
- }
-
- $Folder "Link Libraries" [$POSIX && !$LINUX]
- {
- $DynamicFile "$SRCDIR\lib\$PLATFORM\choreoobjects$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\dmxloader$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\mathlib$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\particles$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\tier2$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\tier3$_STATICLIB_EXT"
- $DynamicFile "$SRCDIR\lib\$PLATFORM\$_IMPLIB_PREFIXsteam_api$_IMPLIB_EXT"
- }
-
- $Folder "Link Libraries" [$LINUX]
+ $Folder "Link Libraries"
{
$Lib choreoobjects
$Lib dmxloader
@@ -1039,6 +1011,6 @@ $Project $Lib particles
$Lib tier2
$Lib tier3
- $DynamicFile "$SRCDIR\lib\$PLATFORM\$_IMPLIB_PREFIXsteam_api$_EXTERNAL_IMPLIB_EXT"
+ $ImpLibexternal steam_api
}
}
diff --git a/sp/src/game/server/testfunctions.cpp b/sp/src/game/server/testfunctions.cpp index c949a1da..c6f452b2 100644 --- a/sp/src/game/server/testfunctions.cpp +++ b/sp/src/game/server/testfunctions.cpp @@ -16,6 +16,14 @@ void Test_CreateEntity( const CCommand &args )
{
+ CBasePlayer *pPlayer = UTIL_GetCommandClient();
+
+ // Require a player entity or that the command was entered from the dedicated server console
+ if ( !pPlayer && UTIL_GetCommandClientIndex() > 0 )
+ {
+ return;
+ }
+
if ( args.ArgC() < 2 )
{
Error( "Test_CreateEntity: requires entity classname argument." );
@@ -23,6 +31,24 @@ void Test_CreateEntity( const CCommand &args ) const char *pClassName = args[ 1 ];
+ // Don't allow regular users to create point_servercommand entities for the same reason as blocking ent_fire
+ if ( pPlayer && !Q_stricmp( pClassName, "point_servercommand" ) )
+ {
+ if ( engine->IsDedicatedServer() )
+ {
+ // We allow people with disabled autokick to do it, because they already have rcon.
+ if ( pPlayer->IsAutoKickDisabled() == false )
+ return;
+ }
+ else if ( gpGlobals->maxClients > 1 )
+ {
+ // On listen servers with more than 1 player, only allow the host to create point_servercommand.
+ CBasePlayer *pHostPlayer = UTIL_GetListenServerHost();
+ if ( pPlayer != pHostPlayer )
+ return;
+ }
+ }
+
if ( !CreateEntityByName( pClassName ) )
{
Error( "Test_CreateEntity( %s ) failed.", pClassName );
diff --git a/sp/src/game/server/util.cpp b/sp/src/game/server/util.cpp index 8b2365f7..431c8561 100644 --- a/sp/src/game/server/util.cpp +++ b/sp/src/game/server/util.cpp @@ -1892,7 +1892,8 @@ int DispatchSpawn( CBaseEntity *pEntity ) // Don't allow the PVS check to skip animation setup during spawning
pAnimating->SetBoneCacheFlags( BCF_IS_IN_SPAWN );
pEntity->Spawn();
- pAnimating->ClearBoneCacheFlags( BCF_IS_IN_SPAWN );
+ if ( pEntSafe != NULL )
+ pAnimating->ClearBoneCacheFlags( BCF_IS_IN_SPAWN );
}
mdlcache->SetAsyncLoad( MDLCACHE_ANIMBLOCK, bAsyncAnims );
diff --git a/sp/src/game/shared/GameStats.cpp b/sp/src/game/shared/GameStats.cpp index 3571827d..e81eaed6 100644 --- a/sp/src/game/shared/GameStats.cpp +++ b/sp/src/game/shared/GameStats.cpp @@ -3,10 +3,8 @@ // Purpose:
//
//=============================================================================
-
#include "cbase.h"
-
#include "igamesystem.h"
#include "gamestats.h"
#include "tier1/utlstring.h"
diff --git a/sp/src/game/shared/playernet_vars.h b/sp/src/game/shared/playernet_vars.h index 9fdeec0f..abb49765 100644 --- a/sp/src/game/shared/playernet_vars.h +++ b/sp/src/game/shared/playernet_vars.h @@ -77,10 +77,10 @@ struct fogplayerparams_t {
m_hCtrl.Set( NULL );
m_flTransitionTime = -1.0f;
- m_OldColor.r = m_OldColor.g = m_OldColor.g = m_OldColor.a = 0.0f;
+ m_OldColor.r = m_OldColor.g = m_OldColor.b = m_OldColor.a = 0;
m_flOldStart = 0.0f;
m_flOldEnd = 0.0f;
- m_NewColor.r = m_NewColor.g = m_NewColor.g = m_NewColor.a = 0.0f;
+ m_NewColor.r = m_NewColor.g = m_NewColor.b = m_NewColor.a = 0;
m_flNewStart = 0.0f;
m_flNewEnd = 0.0f;
}
diff --git a/sp/src/game/shared/shareddefs.h b/sp/src/game/shared/shareddefs.h index 4dbab433..868ae046 100644 --- a/sp/src/game/shared/shareddefs.h +++ b/sp/src/game/shared/shareddefs.h @@ -919,14 +919,17 @@ enum #define TF_VISION_FILTER_NONE 0
#define TF_VISION_FILTER_PYRO (1<<0) // 1
#define TF_VISION_FILTER_HALLOWEEN (1<<1) // 2
+#define TF_VISION_FILTER_ROME (1<<2) // 4
+// THIS ENUM SHOULD MATCH THE ORDER OF THE FLAGS ABOVE
enum
{
- MODEL_INDEX_OVERRIDE_DEFAULT = 0,
- MODEL_INDEX_OVERRIDE_PYRO,
- MODEL_INDEX_OVERRIDE_HALLOWEEN,
+ VISION_MODE_NONE = 0,
+ VISION_MODE_PYRO,
+ VISION_MODE_HALLOWEEN,
+ VISION_MODE_ROME,
- MAX_MODEL_INDEX_OVERRIDES
+ MAX_VISION_MODES
};
#endif // TF_DLL || TF_CLIENT_DLL
|