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.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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" ) )
|
||||
{
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user