This commit is contained in:
Charles 2001-03-05 21:11:51 +00:00
parent 4eef48176b
commit 93c3ae5e34
5 changed files with 60 additions and 31 deletions

View file

@ -453,8 +453,6 @@ void CNpcEnemy::think(int _frames)
playerXDistSqr = playerXDist * playerXDist;
playerYDistSqr = playerYDist * playerYDist;
detectCollisionWithPlayer();
if ( m_animPlaying )
{
int frameCount = m_skel.getFrameCount();
@ -519,14 +517,24 @@ void CNpcEnemy::think(int _frames)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::detectCollisionWithPlayer()
void CNpcEnemy::collidedWith( CThing *_thisThing )
{
if ( m_data[m_type].detectCollision && playerXDistSqr + playerYDistSqr < 400 )
switch(_thisThing->getThingType())
{
// close enough for collision
case TYPE_PLAYER:
{
if ( m_data[m_type].detectCollision )
{
m_oldControlFunc = m_controlFunc;
m_controlFunc = NPC_CONTROL_COLLISION;
}
m_oldControlFunc = m_controlFunc;
m_controlFunc = NPC_CONTROL_COLLISION;
break;
}
default:
ASSERT(0);
break;
}
}