This commit is contained in:
parent
f83b0938ea
commit
76f68fe28a
3 changed files with 58 additions and 78 deletions
|
@ -85,3 +85,59 @@ void CNpcSmallJellyfish2BackgroundEnemy::render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcSmallJellyfish2BackgroundEnemy::collidedWith( CThing *_thisThing )
|
||||||
|
{
|
||||||
|
if ( m_isActive && !m_isCaught && !m_isDying )
|
||||||
|
{
|
||||||
|
switch(_thisThing->getThingType())
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
CPlayer *player = (CPlayer *) _thisThing;
|
||||||
|
|
||||||
|
ATTACK_STATE playerState = player->getAttackState();
|
||||||
|
|
||||||
|
if(playerState==ATTACK_STATE__NONE)
|
||||||
|
{
|
||||||
|
if ( !player->isRecoveringFromHit() )
|
||||||
|
{
|
||||||
|
switch( m_data[m_type].detectCollision )
|
||||||
|
{
|
||||||
|
case DETECT_NO_COLLISION:
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case DETECT_ALL_COLLISION:
|
||||||
|
{
|
||||||
|
m_oldControlFunc = m_controlFunc;
|
||||||
|
m_controlFunc = NPC_CONTROL_COLLISION;
|
||||||
|
|
||||||
|
processUserCollision( _thisThing );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case DETECT_ATTACK_COLLISION_GENERIC:
|
||||||
|
{
|
||||||
|
processAttackCollision();
|
||||||
|
processUserCollision( _thisThing );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ class CNpcSmallJellyfish2BackgroundEnemy : public CNpcSmallJellyfishBackgroundEn
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void render();
|
virtual void render();
|
||||||
|
protected:
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -282,82 +282,4 @@ u8 CNpcSmallJellyfishBackgroundEnemy::hasBeenAttacked()
|
||||||
void CNpcSmallJellyfishBackgroundEnemy::collidedWith( CThing *_thisThing )
|
void CNpcSmallJellyfishBackgroundEnemy::collidedWith( CThing *_thisThing )
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
/*if ( m_isActive && !m_isCaught && !m_isDying )
|
|
||||||
{
|
|
||||||
switch(_thisThing->getThingType())
|
|
||||||
{
|
|
||||||
case TYPE_PLAYER:
|
|
||||||
{
|
|
||||||
CPlayer *player = (CPlayer *) _thisThing;
|
|
||||||
|
|
||||||
ATTACK_STATE playerState = player->getAttackState();
|
|
||||||
|
|
||||||
if(playerState==ATTACK_STATE__NONE)
|
|
||||||
{
|
|
||||||
if ( !player->isRecoveringFromHit() )
|
|
||||||
{
|
|
||||||
switch( m_data[m_type].detectCollision )
|
|
||||||
{
|
|
||||||
case DETECT_NO_COLLISION:
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case DETECT_ALL_COLLISION:
|
|
||||||
{
|
|
||||||
m_oldControlFunc = m_controlFunc;
|
|
||||||
m_controlFunc = NPC_CONTROL_COLLISION;
|
|
||||||
|
|
||||||
processUserCollision( _thisThing );
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case DETECT_ATTACK_COLLISION_GENERIC:
|
|
||||||
{
|
|
||||||
processAttackCollision();
|
|
||||||
processUserCollision( _thisThing );
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// player is attacking, respond appropriately
|
|
||||||
|
|
||||||
if ( m_controlFunc != NPC_CONTROL_SHOT )
|
|
||||||
{
|
|
||||||
if(playerState==ATTACK_STATE__BUTT_BOUNCE)
|
|
||||||
{
|
|
||||||
player->justButtBouncedABadGuy();
|
|
||||||
}
|
|
||||||
m_controlFunc = NPC_CONTROL_SHOT;
|
|
||||||
m_state = NPC_GENERIC_HIT_CHECK_HEALTH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case TYPE_ENEMY:
|
|
||||||
{
|
|
||||||
CNpcEnemy *enemy = (CNpcEnemy *) _thisThing;
|
|
||||||
|
|
||||||
if ( canCollideWithEnemy() && enemy->canCollideWithEnemy() )
|
|
||||||
{
|
|
||||||
processEnemyCollision( _thisThing );
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
ASSERT(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue