This commit is contained in:
Charles 2001-06-12 21:47:22 +00:00
parent 2dfc0db9c4
commit e5f97683f6
4 changed files with 89 additions and 0 deletions

View file

@ -55,6 +55,8 @@
#include "projectl\prnpc.h" #include "projectl\prnpc.h"
#endif #endif
#include "fx\fx.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __ENEMY_NSJFISH_H__ #ifndef __ENEMY_NSJFISH_H__
@ -757,6 +759,46 @@ void CNpcEnemy::processAttackCollision()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::drawAttackEffect()
{
CRECT rect;
rect = getCollisionArea();
DVECTOR thwakPos;
s32 xDist;
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
xDist = playerPos.vx - this->Pos.vx;
if ( xDist > 0 )
{
thwakPos.vx = rect.x2;
if ( rect.x1 > thwakPos.vx )
{
thwakPos.vx = rect.x1;
}
}
else
{
thwakPos.vx = rect.x1;
if ( rect.x2 < thwakPos.vx )
{
thwakPos.vx = rect.x2;
}
}
thwakPos.vy = ( rect.y1 + rect.y2 ) >> 1;
CFX::Create( CFX::FX_TYPE_THWACK, thwakPos );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::collidedWith( CThing *_thisThing ) void CNpcEnemy::collidedWith( CThing *_thisThing )
{ {
if ( m_isActive && !m_isCaught && !m_isDying ) if ( m_isActive && !m_isCaught && !m_isDying )
@ -814,6 +856,8 @@ void CNpcEnemy::collidedWith( CThing *_thisThing )
} }
m_controlFunc = NPC_CONTROL_SHOT; m_controlFunc = NPC_CONTROL_SHOT;
m_state = NPC_GENERIC_HIT_CHECK_HEALTH; m_state = NPC_GENERIC_HIT_CHECK_HEALTH;
drawAttackEffect();
} }
} }
@ -1076,6 +1120,7 @@ void CNpcEnemy::processShot( int _frames )
case NPC_SHOT_NONE: case NPC_SHOT_NONE:
{ {
// do nothing // do nothing
m_controlFunc = m_oldControlFunc;
break; break;
} }

View file

@ -270,6 +270,8 @@ protected:
void processCoralBlower( int _frames ); void processCoralBlower( int _frames );
bool processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist, u8 destroyAtTarget ); bool processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist, u8 destroyAtTarget );
void drawAttackEffect();
// data // data
static NPC_DATA m_data[NPC_UNIT_TYPE_MAX]; static NPC_DATA m_data[NPC_UNIT_TYPE_MAX];

View file

@ -164,3 +164,44 @@ const CRECT *CNpcSkullStomperEnemy::getThinkBBox()
return &objThinkBox; return &objThinkBox;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSkullStomperEnemy::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() )
{
CPlayer *player = GameScene.getPlayer();
player->takeDamage( m_data[m_type].damageToUserType,REACT__GET_DIRECTION_FROM_THING,(CThing*)this );
}
}
else
{
drawAttackEffect();
}
break;
}
case TYPE_ENEMY:
break;
default:
ASSERT(0);
break;
}
}
}

View file

@ -23,6 +23,7 @@ protected:
virtual void processEnemyCollision( CThing *thisThing ); virtual void processEnemyCollision( CThing *thisThing );
virtual bool processSensor(); virtual bool processSensor();
virtual void processClose( int _frames ); virtual void processClose( int _frames );
virtual void collidedWith(CThing *_thisThing);
}; };
#endif #endif