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 /mp/src/game/server | |
| 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 'mp/src/game/server')
| -rw-r--r-- | mp/src/game/server/ai_behavior_lead.cpp | 3 | ||||
| -rw-r--r-- | mp/src/game/server/ai_networkmanager.cpp | 2 | ||||
| -rw-r--r-- | mp/src/game/server/ai_tacticalservices.cpp | 2 | ||||
| -rw-r--r-- | mp/src/game/server/baseentity.cpp | 31 | ||||
| -rw-r--r-- | mp/src/game/server/baseentity.h | 2 | ||||
| -rw-r--r-- | mp/src/game/server/client.cpp | 18 | ||||
| -rw-r--r-- | mp/src/game/server/doors.cpp | 14 | ||||
| -rw-r--r-- | mp/src/game/server/doors.h | 1 | ||||
| -rw-r--r-- | mp/src/game/server/episodic/npc_hunter.cpp | 6 | ||||
| -rw-r--r-- | mp/src/game/server/hl2/npc_barnacle.cpp | 5 | ||||
| -rw-r--r-- | mp/src/game/server/hl2/npc_zombine.cpp | 2 | ||||
| -rw-r--r-- | mp/src/game/server/player.h | 40 | ||||
| -rw-r--r-- | mp/src/game/server/props.cpp | 12 | ||||
| -rw-r--r-- | mp/src/game/server/server_base.vpc | 42 | ||||
| -rw-r--r-- | mp/src/game/server/testfunctions.cpp | 26 | ||||
| -rw-r--r-- | mp/src/game/server/util.cpp | 3 |
16 files changed, 154 insertions, 55 deletions
diff --git a/mp/src/game/server/ai_behavior_lead.cpp b/mp/src/game/server/ai_behavior_lead.cpp index 10462e08..cc4e0aed 100644 --- a/mp/src/game/server/ai_behavior_lead.cpp +++ b/mp/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/mp/src/game/server/ai_networkmanager.cpp b/mp/src/game/server/ai_networkmanager.cpp index 00826e02..69d6319e 100644 --- a/mp/src/game/server/ai_networkmanager.cpp +++ b/mp/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/mp/src/game/server/ai_tacticalservices.cpp b/mp/src/game/server/ai_tacticalservices.cpp index 08d32699..70fc643c 100644 --- a/mp/src/game/server/ai_tacticalservices.cpp +++ b/mp/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/mp/src/game/server/baseentity.cpp b/mp/src/game/server/baseentity.cpp index 689aa020..48f1a4a7 100644 --- a/mp/src/game/server/baseentity.cpp +++ b/mp/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/mp/src/game/server/baseentity.h b/mp/src/game/server/baseentity.h index 016915ca..7bcc3c2e 100644 --- a/mp/src/game/server/baseentity.h +++ b/mp/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/mp/src/game/server/client.cpp b/mp/src/game/server/client.cpp index 2fd87cfe..39905046 100644 --- a/mp/src/game/server/client.cpp +++ b/mp/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/mp/src/game/server/doors.cpp b/mp/src/game/server/doors.cpp index 53abb829..d8f06c49 100644 --- a/mp/src/game/server/doors.cpp +++ b/mp/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/mp/src/game/server/doors.h b/mp/src/game/server/doors.h index 0de009dc..0a545ecf 100644 --- a/mp/src/game/server/doors.h +++ b/mp/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/mp/src/game/server/episodic/npc_hunter.cpp b/mp/src/game/server/episodic/npc_hunter.cpp index fa9daff8..9d7dfd3e 100644 --- a/mp/src/game/server/episodic/npc_hunter.cpp +++ b/mp/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/mp/src/game/server/hl2/npc_barnacle.cpp b/mp/src/game/server/hl2/npc_barnacle.cpp index 92201730..012d371d 100644 --- a/mp/src/game/server/hl2/npc_barnacle.cpp +++ b/mp/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/mp/src/game/server/hl2/npc_zombine.cpp b/mp/src/game/server/hl2/npc_zombine.cpp index 5c74e1a9..611dc682 100644 --- a/mp/src/game/server/hl2/npc_zombine.cpp +++ b/mp/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/mp/src/game/server/player.h b/mp/src/game/server/player.h index c17ff974..c1fa4f69 100644 --- a/mp/src/game/server/player.h +++ b/mp/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/mp/src/game/server/props.cpp b/mp/src/game/server/props.cpp index eefa467b..d20756f3 100644 --- a/mp/src/game/server/props.cpp +++ b/mp/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/mp/src/game/server/server_base.vpc b/mp/src/game/server/server_base.vpc index 8b24610b..94dfd0f9 100644 --- a/mp/src/game/server/server_base.vpc +++ b/mp/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/mp/src/game/server/testfunctions.cpp b/mp/src/game/server/testfunctions.cpp index c949a1da..c6f452b2 100644 --- a/mp/src/game/server/testfunctions.cpp +++ b/mp/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/mp/src/game/server/util.cpp b/mp/src/game/server/util.cpp index 8b2365f7..431c8561 100644 --- a/mp/src/game/server/util.cpp +++ b/mp/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 );
|