@@ -689,7 +689,11 @@ void CAI_BaseNPC::Ignite( float flFlameLifetime, bool bNPCOnly, float flSize, bo
689689#endif
690690
691691#ifdef HL2_EPISODIC
692+ #ifdef MAPBASE_MP // From SecobMod
693+ CBasePlayer *pPlayer = UTIL_GetNearestPlayer( GetAbsOrigin() );
694+ #else
692695 CBasePlayer *pPlayer = AI_GetSinglePlayer();
696+ #endif
693697 if ( pPlayer && pPlayer->IRelationType( this ) != D_LI )
694698 {
695699 CNPC_Alyx *alyx = CNPC_Alyx::GetAlyx();
@@ -1200,7 +1204,11 @@ int CAI_BaseNPC::OnTakeDamage_Alive( const CTakeDamageInfo &info )
12001204 {
12011205 // See if the person that injured me is an NPC.
12021206 CAI_BaseNPC *pAttacker = info.GetAttacker()->MyNPCPointer();
1207+ #ifdef MAPBASE_MP // From SecobMod
1208+ CBasePlayer *pPlayer = UTIL_GetNearestPlayer( GetAbsOrigin() );
1209+ #else
12031210 CBasePlayer *pPlayer = AI_GetSinglePlayer();
1211+ #endif
12041212
12051213 if( pAttacker && pAttacker->IsAlive() && pPlayer )
12061214 {
@@ -3738,7 +3746,11 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS )
37383746
37393747 //---------------------------------
37403748
3749+ #ifdef MAPBASE_MP // From SecobMod
3750+ CBasePlayer *pPlayer = UTIL_GetNearestPlayer( GetAbsOrigin() );
3751+ #else
37413752 CBasePlayer *pPlayer = AI_GetSinglePlayer();
3753+ #endif
37423754 static Vector vPlayerEyePosition;
37433755 static Vector vPlayerForward;
37443756 static int iPrevFrame = -1;
@@ -3985,7 +3997,11 @@ void CAI_BaseNPC::UpdateSleepState( bool bInPVS )
39853997#ifdef MAPBASE
39863998#define Wake() Wake(pLocalPlayer)
39873999#endif
4000+ #ifdef MAPBASE_MP
4001+ CBasePlayer *pLocalPlayer = UTIL_GetNearestPlayer( GetAbsOrigin() );
4002+ #else
39884003 CBasePlayer *pLocalPlayer = AI_GetSinglePlayer();
4004+ #endif
39894005 if ( !pLocalPlayer )
39904006 {
39914007 if ( gpGlobals->maxClients > 1 )
@@ -4188,7 +4204,11 @@ void CAI_BaseNPC::RebalanceThinks()
41884204
41894205 int i;
41904206
4207+ #ifdef MAPBASE_MP
4208+ CBasePlayer *pPlayer = UTIL_GetNearestPlayer( GetAbsOrigin() );
4209+ #else
41914210 CBasePlayer *pPlayer = AI_GetSinglePlayer();
4211+ #endif
41924212 Vector vPlayerForward;
41934213 Vector vPlayerEyePosition;
41944214
@@ -4469,7 +4489,11 @@ void CAI_BaseNPC::SetPlayerAvoidState( void )
44694489
44704490 GetPlayerAvoidBounds( &vMins, &vMaxs );
44714491
4492+ #ifdef MAPBASE_MP
4493+ CBasePlayer *pLocalPlayer = UTIL_GetNearestPlayer( GetAbsOrigin() );
4494+ #else
44724495 CBasePlayer *pLocalPlayer = AI_GetSinglePlayer();
4496+ #endif
44734497
44744498 if ( pLocalPlayer )
44754499 {
@@ -5571,14 +5595,22 @@ void CAI_BaseNPC::RunAI( void )
55715595 }
55725596 }
55735597
5598+ #ifdef MAPBASE_MP // From SecobMod
5599+ if( ai_debug_loners.GetBool() && !IsInSquad() )
5600+ #else
55745601 if( ai_debug_loners.GetBool() && !IsInSquad() && AI_IsSinglePlayer() )
5602+ #endif
55755603 {
55765604 Vector right;
55775605 Vector vecPoint;
55785606
55795607 vecPoint = EyePosition() + Vector( 0, 0, 12 );
55805608
5609+ #ifdef MAPBASE_MP // From SecobMod
5610+ UTIL_GetNearestPlayer( GetAbsOrigin() )->GetVectors( NULL, &right, NULL );
5611+ #else
55815612 UTIL_GetLocalPlayer()->GetVectors( NULL, &right, NULL );
5613+ #endif
55825614
55835615 NDebugOverlay::Line( vecPoint, vecPoint + Vector( 0, 0, 64 ), 255, 0, 0, false , 0.1 );
55845616 NDebugOverlay::Line( vecPoint, vecPoint + Vector( 0, 0, 32 ) + right * 32, 255, 0, 0, false , 0.1 );
@@ -10325,7 +10357,11 @@ void CAI_BaseNPC::DrawDebugGeometryOverlays(void)
1032510357
1032610358 info.SetDamage( m_iHealth );
1032710359 info.SetAttacker( this );
10360+ #ifdef MAPBASE_MP // From SecobMod
10361+ info.SetInflictor( (CBaseEntity *)this );
10362+ #else
1032810363 info.SetInflictor( ( AI_IsSinglePlayer() ) ? (CBaseEntity *)AI_GetSinglePlayer() : (CBaseEntity *)this );
10364+ #endif
1032910365 info.SetDamageType( DMG_GENERIC );
1033010366
1033110367 m_debugOverlays &= ~OVERLAY_NPC_KILL_BIT;
@@ -13970,7 +14006,11 @@ bool CAI_BaseNPC::CineCleanup()
1397014006 {
1397114007 SetLocalOrigin( origin );
1397214008
14009+ #ifdef MAPBASE_MP // From SecobMod
14010+ int drop = UTIL_DropToFloor( this, MASK_NPCSOLID, UTIL_GetNearestVisiblePlayer( this ) );
14011+ #else
1397314012 int drop = UTIL_DropToFloor( this, MASK_NPCSOLID, UTIL_GetLocalPlayer() );
14013+ #endif
1397414014
1397514015 // Origin in solid? Set to org at the end of the sequence
1397614016 if ( ( drop < 0 ) || sv_test_scripted_sequences.GetBool() )
@@ -14051,7 +14091,11 @@ void CAI_BaseNPC::Teleport( const Vector *newPosition, const QAngle *newAngles,
1405114091
1405214092bool CAI_BaseNPC::FindSpotForNPCInRadius( Vector *pResult, const Vector &vStartPos, CAI_BaseNPC *pNPC, float radius, bool bOutOfPlayerViewcone )
1405314093{
14094+ #ifdef MAPBASE_MP // From SecobMod
14095+ CBasePlayer *pPlayer = UTIL_GetNearestPlayer( pNPC->GetAbsOrigin() );
14096+ #else
1405414097 CBasePlayer *pPlayer = AI_GetSinglePlayer();
14098+ #endif
1405514099 QAngle fan;
1405614100
1405714101 fan.x = 0;
@@ -14644,13 +14688,17 @@ bool CAI_BaseNPC::IsPlayerAlly( CBasePlayer *pPlayer )
1464414688{
1464514689 if ( pPlayer == NULL )
1464614690 {
14691+ #ifdef MAPBASE_MP // From SecobMod
14692+ pPlayer = UTIL_GetNearestPlayer( GetAbsOrigin() );
14693+ #else
1464714694 // in multiplayer mode we need a valid pPlayer
1464814695 // or override this virtual function
1464914696 if ( !AI_IsSinglePlayer() )
1465014697 return false;
1465114698
1465214699 // NULL means single player mode
1465314700 pPlayer = UTIL_GetLocalPlayer();
14701+ #endif
1465414702 }
1465514703
1465614704 return ( !pPlayer || IRelationType( pPlayer ) == D_LI );
@@ -14948,7 +14996,11 @@ bool CAI_BaseNPC::FindNearestValidGoalPos( const Vector &vTestPoint, Vector *pRe
1494814996
1494914997 if ( vCandidate != vec3_invalid )
1495014998 {
14999+ #ifdef MAPBASE_MP // From SecobMod
15000+ AI_Waypoint_t *pPathToPoint = GetPathfinder()->BuildRoute( GetAbsOrigin(), vCandidate, UTIL_GetNearestPlayer( GetAbsOrigin() ), 5 * 12, NAV_NONE, true );
15001+ #else
1495115002 AI_Waypoint_t *pPathToPoint = GetPathfinder()->BuildRoute( GetAbsOrigin(), vCandidate, AI_GetSinglePlayer(), 5*12, NAV_NONE, true );
15003+ #endif
1495215004 if ( pPathToPoint )
1495315005 {
1495415006 GetPathfinder()->UnlockRouteNodes( pPathToPoint );
0 commit comments