This commit is contained in:
parent
0dcd0ddb68
commit
3ae08ab458
4 changed files with 47 additions and 38 deletions
|
@ -717,8 +717,6 @@ void CNpcEnemy::setToShutdown()
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool gitTrigger = false;
|
||||
|
||||
int CNpcEnemy::getFrameCount()
|
||||
{
|
||||
return( m_actorGfx->getFrameCount( m_animNo ) );
|
||||
|
@ -825,11 +823,6 @@ void CNpcEnemy::think(int _frames)
|
|||
{
|
||||
processTimer( moveFrames );
|
||||
}
|
||||
|
||||
if ( gitTrigger )
|
||||
{
|
||||
fireAsProjectile( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1453,7 +1446,7 @@ void CNpcEnemy::processEnemyCollision( CThing *thisThing )
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool CNpcEnemy::processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist )
|
||||
bool CNpcEnemy::processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist, u8 destroyAtTarget )
|
||||
{
|
||||
s32 moveX, moveY;
|
||||
s16 headingToTarget;
|
||||
|
@ -1522,6 +1515,27 @@ bool CNpcEnemy::processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist )
|
|||
}
|
||||
else
|
||||
{
|
||||
// has reached target point
|
||||
|
||||
if ( destroyAtTarget )
|
||||
{
|
||||
if ( m_data[m_type].respawning )
|
||||
{
|
||||
if ( m_isActive )
|
||||
{
|
||||
m_isCaught = false;
|
||||
m_isActive = false;
|
||||
|
||||
m_timerFunc = NPC_TIMER_RESPAWN;
|
||||
m_timerTimer = 1 * GameState::getOneSecondInFrames();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setToShutdown();
|
||||
}
|
||||
}
|
||||
|
||||
return( true );
|
||||
}
|
||||
}
|
||||
|
@ -1551,7 +1565,7 @@ bool CNpcEnemy::suckUp( DVECTOR *suckPos, int _frames )
|
|||
s32 targetXDist = suckPos->vx - Pos.vx;
|
||||
s32 targetYDist = suckPos->vy - Pos.vy;
|
||||
|
||||
returnVal = processCoralBlowerMovement( _frames, targetXDist, targetYDist );
|
||||
returnVal = processCoralBlowerMovement( _frames, targetXDist, targetYDist, true );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1601,7 +1615,7 @@ void CNpcEnemy::processCoralBlower( int _frames )
|
|||
targetXDist = m_caughtPos.vx - Pos.vx;
|
||||
targetYDist = m_caughtPos.vy - Pos.vy;
|
||||
|
||||
processCoralBlowerMovement( _frames, targetXDist, targetYDist );
|
||||
processCoralBlowerMovement( _frames, targetXDist, targetYDist, false );
|
||||
|
||||
if ( !targetXDist && !targetYDist )
|
||||
{
|
||||
|
@ -1624,25 +1638,3 @@ void CNpcEnemy::processCoralBlower( int _frames )
|
|||
|
||||
m_isBlowerOn = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcEnemy::fireAsProjectile( s16 heading )
|
||||
{
|
||||
m_isActive = false;
|
||||
setToShutdown();
|
||||
|
||||
DVECTOR newPos = Pos;
|
||||
|
||||
newPos.vy -= 10;
|
||||
|
||||
CEnemyAsProjectile *projectile;
|
||||
projectile = new( "blower projectile" ) CEnemyAsProjectile;
|
||||
projectile->init( newPos,
|
||||
heading,
|
||||
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,
|
||||
CPlayerProjectile::PLAYER_PROJECTILE_FINITE_LIFE,
|
||||
5*60);
|
||||
projectile->setLayerCollision( m_layerCollision );
|
||||
projectile->setGraphic( m_actorGfx );
|
||||
}
|
|
@ -116,7 +116,6 @@ public:
|
|||
|
||||
bool canBeSuckedUp();
|
||||
bool suckUp( DVECTOR *suckPos, int _frames );
|
||||
virtual void fireAsProjectile( s16 heading );
|
||||
|
||||
protected:
|
||||
class CLayerCollision *m_layerCollision;
|
||||
|
@ -253,7 +252,7 @@ protected:
|
|||
void reinit();
|
||||
|
||||
void processCoralBlower( int _frames );
|
||||
bool processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist );
|
||||
bool processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist, u8 destroyAtTarget );
|
||||
|
||||
// data
|
||||
|
||||
|
|
|
@ -946,7 +946,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
|||
0,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
},
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@
|
|||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PROJECTL_PRNPC_H__
|
||||
#include "projectl\prnpc.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -221,14 +225,12 @@ void CPlayerModeCoralBlower::think()
|
|||
}
|
||||
break;
|
||||
case BLOWER_STATE__FULL:
|
||||
m_enemy->suckUp(getSuckUpPoint(),1);
|
||||
if(getPadInputDown()&PI_ACTION&&getState()==STATE_IDLE)
|
||||
{
|
||||
m_blowerState=BLOWER_STATE__AIMING;
|
||||
}
|
||||
break;
|
||||
case BLOWER_STATE__AIMING:
|
||||
m_enemy->suckUp(getSuckUpPoint(),1);
|
||||
if(getState()!=STATE_IDLE)
|
||||
{
|
||||
m_blowerState=BLOWER_STATE__FULL;
|
||||
|
@ -237,7 +239,23 @@ void CPlayerModeCoralBlower::think()
|
|||
{
|
||||
// Fire!
|
||||
m_blowerState=BLOWER_STATE__EMPTY;
|
||||
m_enemy->fireAsProjectile(1024+(1024*m_player->getFacing()));
|
||||
|
||||
DVECTOR newPos = m_player->getPos();
|
||||
|
||||
newPos.vy -= 10;
|
||||
|
||||
CEnemyAsProjectile *projectile;
|
||||
projectile = new( "blower projectile" ) CEnemyAsProjectile;
|
||||
projectile->init( newPos,
|
||||
1024+(1024*m_player->getFacing()),
|
||||
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,
|
||||
CPlayerProjectile::PLAYER_PROJECTILE_FINITE_LIFE,
|
||||
5*60);
|
||||
projectile->setLayerCollision( m_player->getLayerCollision() );
|
||||
|
||||
CActorGfx *projectileGfx;
|
||||
projectileGfx=CActorPool::GetActor((FileEquate)ACTORS_SHELL_SBK);
|
||||
projectile->setGraphic( projectileGfx );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue