@@ -1033,12 +1033,20 @@ void CBaseEntity::DrawDebugGeometryOverlays(void)
10331033 NDebugOverlay::EntityBounds (this , 255 , 255 , 255 , 0 , 0 );
10341034 }
10351035 }
1036- if ( m_debugOverlays & OVERLAY_AUTOAIM_BIT && (GetFlags ()&FL_AIMTARGET) && AI_GetSinglePlayer () != NULL )
1036+
1037+ #ifdef BDSBASE
1038+ CBasePlayer* pPlayer = UTIL_GetNearestPlayer (GetAbsOrigin ());
1039+ if (m_debugOverlays & OVERLAY_AUTOAIM_BIT && (GetFlags () & FL_AIMTARGET) && pPlayer != NULL )
1040+ #else
1041+ if (m_debugOverlays & OVERLAY_AUTOAIM_BIT && (GetFlags () & FL_AIMTARGET) && AI_GetSinglePlayer () != NULL )
1042+ #endif // BDSBASE
10371043 {
10381044 // Crude, but it gets the point across.
10391045 Vector vecCenter = GetAutoAimCenter ();
10401046 Vector vecRight, vecUp, vecDiag;
1041- CBasePlayer *pPlayer = AI_GetSinglePlayer ();
1047+ #ifndef BDSBASE
1048+ CBasePlayer* pPlayer = AI_GetSinglePlayer ();
1049+ #endif // BDSBASE
10421050 float radius = GetAutoAimRadius ();
10431051
10441052 QAngle angles = pPlayer->EyeAngles ();
@@ -1841,25 +1849,16 @@ int CBaseEntity::VPhysicsTakeDamage( const CTakeDamageInfo &info )
18411849 {
18421850 // if the player is holding the object, use it's real mass (player holding reduced the mass)
18431851#ifdef BDSBASE
1852+ // See which MP player is holding the physics object and then use that player to get the real mass of the object.
1853+ // This is ugly but better than having linkage between an object and its "holding" player.
18441854 CBasePlayer* pPlayer = NULL ;
1845-
1846- if (gpGlobals->maxClients == 1 )
1847- {
1848- pPlayer = UTIL_GetLocalPlayer ();
1849- }
1850- else
1855+ for (int i = 1 ; i <= gpGlobals->maxClients ; i++)
18511856 {
1852- // See which MP player is holding the physics object and then use that player to get the real mass of the object.
1853- // This is ugly but better than having linkage between an object and its "holding" player.
1854- for (int i = 1 ; i <= gpGlobals->maxClients ; i++)
1857+ CBasePlayer* tempPlayer = UTIL_PlayerByIndex (i);
1858+ if (tempPlayer && (tempPlayer->GetHeldObject () == this ))
18551859 {
1856- CBasePlayer* tempPlayer = UTIL_PlayerByIndex (i);
1857-
1858- if (tempPlayer && (tempPlayer->GetHeldObject () == this ))
1859- {
1860- pPlayer = tempPlayer;
1861- break ;
1862- }
1860+ pPlayer = tempPlayer;
1861+ break ;
18631862 }
18641863 }
18651864#else
@@ -7926,7 +7925,11 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
79267925 ModifyOrAppendCriteria ( set );
79277926
79287927 // Append local player criteria to set,too
7929- CBasePlayer *pPlayer = UTIL_GetLocalPlayer ();
7928+ #ifdef BDSBASE
7929+ CBasePlayer* pPlayer = UTIL_GetNearestPlayer (GetAbsOrigin ());
7930+ #else
7931+ CBasePlayer* pPlayer = UTIL_GetLocalPlayer ();
7932+ #endif // BDSBASE
79307933 if ( pPlayer )
79317934 pPlayer->ModifyOrAppendPlayerCriteria ( set );
79327935
@@ -7985,7 +7988,11 @@ void CBaseEntity::DumpResponseCriteria( void )
79857988 ModifyOrAppendCriteria ( set );
79867989
79877990 // Append local player criteria to set,too
7988- CBasePlayer *pPlayer = UTIL_GetLocalPlayer ();
7991+ #ifdef BDSBASE
7992+ CBasePlayer* pPlayer = UTIL_GetNearestPlayer (GetAbsOrigin ());
7993+ #else
7994+ CBasePlayer* pPlayer = UTIL_GetLocalPlayer ();
7995+ #endif // BDSBASE
79897996 if ( pPlayer )
79907997 {
79917998 pPlayer->ModifyOrAppendPlayerCriteria ( set );
@@ -8470,7 +8477,11 @@ bool CBaseEntity::SUB_AllowedToFade( void )
84708477
84718478 // on Xbox, allow these to fade out
84728479#ifndef _XBOX
8473- CBasePlayer *pPlayer = ( AI_IsSinglePlayer () ) ? UTIL_GetLocalPlayer () : NULL ;
8480+ #ifdef BDSBASE
8481+ CBasePlayer* pPlayer = UTIL_GetNearestVisiblePlayer (this );
8482+ #else
8483+ CBasePlayer* pPlayer = (AI_IsSinglePlayer ()) ? UTIL_GetLocalPlayer () : NULL ;
8484+ #endif // BDSBASE
84748485
84758486 if ( pPlayer && pPlayer->FInViewCone ( this ) )
84768487 return false ;
0 commit comments