Skip to content

Commit

Permalink
Merge branch 'hlfixed' into opforfixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nekonomicon committed Nov 15, 2023
2 parents d13dec7 + bee6aa0 commit 24268b0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dlls/barney.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ BOOL CBarney::NoFriendlyFire()
CPlane backPlane;
CPlane leftPlane;
CPlane rightPlane;
CPlane frontPlane;

Vector vecLeftSide;
Vector vecRightSide;
Expand All @@ -793,9 +794,13 @@ BOOL CBarney::NoFriendlyFire()

v_left = gpGlobals->v_right * -1.0f;

CBaseEntity* pEnemy = m_hEnemy;
const Vector enemyCenter = pEnemy->Center();

leftPlane.InitializePlane( gpGlobals->v_right, vecLeftSide );
rightPlane.InitializePlane( v_left, vecRightSide );
backPlane.InitializePlane( gpGlobals->v_forward, pev->origin );
frontPlane.InitializePlane( gpGlobals->v_forward * -1, enemyCenter + gpGlobals->v_forward * pEnemy->pev->size.Length2D() / 2 );

for( int k = 1; k <= gpGlobals->maxClients; k++ )
{
Expand All @@ -808,7 +813,10 @@ BOOL CBarney::NoFriendlyFire()
{
//ALERT(at_aiconsole, "%s: Ally player at fire plane!\n", STRING(pev->classname));
// player is in the check volume! Don't shoot!
return FALSE;
if (frontPlane.PointInFront( pPlayer->pev->origin ))
return FALSE;
else if (pEnemy->pev->deadflag == DEAD_DYING || pEnemy->pev->deadflag == DEAD_DEAD) // don't shoot when ally is behind the dying enemy
return FALSE;
}
}
}
Expand Down

0 comments on commit 24268b0

Please sign in to comment.