This commit is contained in:
parent
26ef34db73
commit
ce0c6759fb
@ -44,16 +44,22 @@
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcClamEnemy::processEnemyCollision( CThing *thisThing )
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcClamEnemy::processUserCollision( CThing *thisThing )
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool CNpcClamEnemy::processSensor()
|
||||
{
|
||||
switch( m_sensorFunc )
|
||||
@ -81,6 +87,8 @@ bool CNpcClamEnemy::processSensor()
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcJumpingClamEnemy::postInit()
|
||||
{
|
||||
CNpcClamEnemy::postInit();
|
||||
@ -88,6 +96,8 @@ void CNpcJumpingClamEnemy::postInit()
|
||||
m_drawRotation = m_heading + 1024;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcJumpingClamEnemy::processClose( int _frames )
|
||||
{
|
||||
s32 velocity;
|
||||
@ -151,6 +161,8 @@ void CNpcJumpingClamEnemy::processClose( int _frames )
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcStaticClamEnemy::postInit()
|
||||
{
|
||||
CNpcClamEnemy::postInit();
|
||||
@ -170,26 +182,32 @@ void CNpcStaticClamEnemy::postInit()
|
||||
platform->postInit();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcStaticClamEnemy::processClose( int _frames )
|
||||
{
|
||||
if ( !m_isAnimating && !m_isStunned )
|
||||
if ( !m_animPlaying && !m_isStunned )
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_animNo = ANIM_CLAM_SIDESNAP;
|
||||
m_frame = 0;
|
||||
m_isAnimating = true;
|
||||
}
|
||||
else if ( !m_animPlaying )
|
||||
/*else if ( !m_animPlaying )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
m_animNo = m_data[m_type].initAnim;
|
||||
m_frame = 0;
|
||||
m_isAnimating = false;
|
||||
}
|
||||
}*/
|
||||
|
||||
m_isStunned = false;
|
||||
if ( m_isStunned )
|
||||
{
|
||||
m_isStunned = false;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcStaticClamEnemy::collidedWith( CThing *_thisThing )
|
||||
{
|
||||
if ( m_isActive && !m_isCaught && !m_isDying )
|
||||
@ -198,7 +216,18 @@ void CNpcStaticClamEnemy::collidedWith( CThing *_thisThing )
|
||||
{
|
||||
case TYPE_PLAYER:
|
||||
{
|
||||
m_isStunned = true;
|
||||
if ( m_frame < ( 5 << 8 ) )
|
||||
{
|
||||
m_animNo = ANIM_CLAM_SIDESNAP;
|
||||
m_frame = 0;
|
||||
m_isStunned = true;
|
||||
m_animPlaying = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oldControlFunc = m_controlFunc;
|
||||
m_controlFunc = NPC_CONTROL_COLLISION;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -208,3 +237,29 @@ void CNpcStaticClamEnemy::collidedWith( CThing *_thisThing )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcStaticClamEnemy::processCollision()
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
|
||||
player->takeDamage( m_data[m_type].damageToUserType,REACT__GET_DIRECTION_FROM_THING,(CThing*)this );
|
||||
processUserCollision( (CThing *) player );
|
||||
|
||||
m_controlFunc = m_oldControlFunc;
|
||||
|
||||
if ( !m_animPlaying && !m_isStunned )
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_animNo = ANIM_CLAM_SIDESNAP;
|
||||
m_frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
s32 CNpcStaticClamEnemy::getFrameShift( int _frames )
|
||||
{
|
||||
return( ( _frames << 8 ) >> 2 );
|
||||
}
|
||||
|
@ -38,8 +38,10 @@ public:
|
||||
virtual void postInit();
|
||||
virtual u8 hasBeenAttacked() {return( false );}
|
||||
protected:
|
||||
virtual s32 getFrameShift( int _frames );
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
virtual void processClose( int _frames );
|
||||
virtual void processCollision();
|
||||
|
||||
u8 m_isStunned;
|
||||
u8 m_isAnimating;
|
||||
|
Loading…
Reference in New Issue
Block a user