This commit is contained in:
parent
8679995a69
commit
9bf66ef925
10 changed files with 115 additions and 26 deletions
|
@ -15,6 +15,10 @@
|
||||||
#include "enemy\nboss.h"
|
#include "enemy\nboss.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GAME_GAME_H__
|
||||||
|
#include "game\game.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -22,6 +26,7 @@ void CNpcBossEnemy::postInit()
|
||||||
{
|
{
|
||||||
m_meterOn=false;
|
m_meterOn=false;
|
||||||
m_energyBar = NULL;
|
m_energyBar = NULL;
|
||||||
|
m_invulnerableTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -38,6 +43,18 @@ void CNpcBossEnemy::shutdown()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcBossEnemy::think( int _frames )
|
||||||
|
{
|
||||||
|
if ( m_invulnerableTimer > 0 )
|
||||||
|
{
|
||||||
|
m_invulnerableTimer -= _frames;
|
||||||
|
}
|
||||||
|
|
||||||
|
CNpcEnemy::think( _frames );
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcBossEnemy::addHealthMeter()
|
void CNpcBossEnemy::addHealthMeter()
|
||||||
{
|
{
|
||||||
if (!m_meterOn)
|
if (!m_meterOn)
|
||||||
|
@ -83,6 +100,7 @@ void CNpcBossEnemy::processShot( int _frames )
|
||||||
m_animPlaying = true;
|
m_animPlaying = true;
|
||||||
m_animNo = m_data[m_type].recoilAnim;
|
m_animNo = m_data[m_type].recoilAnim;
|
||||||
m_frame = 0;
|
m_frame = 0;
|
||||||
|
m_invulnerableTimer = 2 * GameState::getOneSecondInFrames();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -26,12 +26,14 @@ class CNpcBossEnemy : public CNpcEnemy
|
||||||
public:
|
public:
|
||||||
virtual void postInit();
|
virtual void postInit();
|
||||||
virtual void shutdown();
|
virtual void shutdown();
|
||||||
|
void think( int _frames );
|
||||||
protected:
|
protected:
|
||||||
void addHealthMeter();
|
void addHealthMeter();
|
||||||
virtual void processShot( int _frames );
|
virtual void processShot( int _frames );
|
||||||
|
|
||||||
bool m_meterOn;
|
bool m_meterOn;
|
||||||
CFXNRGBar *m_energyBar;
|
CFXNRGBar *m_energyBar;
|
||||||
|
s32 m_invulnerableTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -535,7 +535,7 @@ void CNpcIronDogfishEnemy::collidedWith( CThing *_thisThing )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( m_vulnerableTimer > 0 )
|
else if ( m_vulnerableTimer > 0 && m_invulnerableTimer <= 0 )
|
||||||
{
|
{
|
||||||
// player is attacking, respond appropriately
|
// player is attacking, respond appropriately
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ void CNpcFlyingDutchmanEnemy::think( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CNpcEnemy::think( _frames );
|
CNpcBossEnemy::think( _frames );
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -760,7 +760,7 @@ void CNpcFlyingDutchmanEnemy::collidedWith(CThing *_thisThing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if ( m_invulnerableTimer <= 0 )
|
||||||
{
|
{
|
||||||
// player is attacking, respond appropriately
|
// player is attacking, respond appropriately
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,6 @@ void CNpcMotherJellyfishEnemy::postInit()
|
||||||
m_renderScale = 2048 + ( ( ( 4096 - 2048 ) * m_health ) / m_data[m_type].initHealth );
|
m_renderScale = 2048 + ( ( ( 4096 - 2048 ) * m_health ) / m_data[m_type].initHealth );
|
||||||
m_speed = m_data[m_type].speed + ( ( 2 * ( m_data[m_type].initHealth - m_health ) ) / m_data[m_type].initHealth );
|
m_speed = m_data[m_type].speed + ( ( 2 * ( m_data[m_type].initHealth - m_health ) ) / m_data[m_type].initHealth );
|
||||||
m_pauseTimer = m_maxPauseTimer = ( GameState::getOneSecondInFrames() * m_health ) / m_data[m_type].initHealth;
|
m_pauseTimer = m_maxPauseTimer = ( GameState::getOneSecondInFrames() * m_health ) / m_data[m_type].initHealth;
|
||||||
m_invulnerableTimer = 0;
|
|
||||||
|
|
||||||
m_attackCounter = 0;
|
m_attackCounter = 0;
|
||||||
m_patternNum = 0;
|
m_patternNum = 0;
|
||||||
|
@ -193,11 +192,6 @@ void CNpcMotherJellyfishEnemy::setupWaypoints( sThingActor *ThisActor )
|
||||||
|
|
||||||
void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
if ( m_invulnerableTimer > 0 )
|
|
||||||
{
|
|
||||||
m_invulnerableTimer -= _frames;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( m_state )
|
switch( m_state )
|
||||||
{
|
{
|
||||||
case MOTHER_JELLYFISH_CYCLE:
|
case MOTHER_JELLYFISH_CYCLE:
|
||||||
|
|
|
@ -66,7 +66,6 @@ protected:
|
||||||
s32 m_cycleWidth;
|
s32 m_cycleWidth;
|
||||||
s32 m_halfCycleWidth;
|
s32 m_halfCycleWidth;
|
||||||
s16 m_renderScale;
|
s16 m_renderScale;
|
||||||
s32 m_invulnerableTimer;
|
|
||||||
u8 m_attackCounter;
|
u8 m_attackCounter;
|
||||||
u8 m_patternNum;
|
u8 m_patternNum;
|
||||||
u8 m_patternPoint;
|
u8 m_patternPoint;
|
||||||
|
|
|
@ -63,8 +63,6 @@ void CNpcSubSharkEnemy::postInit()
|
||||||
m_speed = m_data[m_type].speed + ( ( 3 * ( m_data[m_type].initHealth - m_health ) ) / m_data[m_type].initHealth );
|
m_speed = m_data[m_type].speed + ( ( 3 * ( m_data[m_type].initHealth - m_health ) ) / m_data[m_type].initHealth );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_invulnerableTimer = 0;
|
|
||||||
|
|
||||||
m_timerTimer = 0;
|
m_timerTimer = 0;
|
||||||
m_salvoCount = 5;
|
m_salvoCount = 5;
|
||||||
m_carryPlayer = false;
|
m_carryPlayer = false;
|
||||||
|
@ -75,18 +73,6 @@ void CNpcSubSharkEnemy::postInit()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcSubSharkEnemy::think( int _frames )
|
|
||||||
{
|
|
||||||
if ( m_invulnerableTimer > 0 )
|
|
||||||
{
|
|
||||||
m_invulnerableTimer -= _frames;
|
|
||||||
}
|
|
||||||
|
|
||||||
CNpcEnemy::think( _frames );
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void CNpcSubSharkEnemy::processMovement( int _frames )
|
void CNpcSubSharkEnemy::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
if ( m_movementTimer > 0 )
|
if ( m_movementTimer > 0 )
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
class CNpcSubSharkEnemy : public CNpcBossEnemy
|
class CNpcSubSharkEnemy : public CNpcBossEnemy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void think( int _frames );
|
|
||||||
void postInit();
|
void postInit();
|
||||||
void render();
|
void render();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
@ -54,7 +53,6 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 m_salvoCount;
|
u8 m_salvoCount;
|
||||||
s32 m_invulnerableTimer;
|
|
||||||
DVECTOR m_targetPos;
|
DVECTOR m_targetPos;
|
||||||
u8 m_carryPlayer;
|
u8 m_carryPlayer;
|
||||||
PLAYER_MODE m_oldPlayerMode;
|
PLAYER_MODE m_oldPlayerMode;
|
||||||
|
|
|
@ -1168,6 +1168,8 @@ void CNpcSeaSnakeEnemy::processShot( int _frames )
|
||||||
m_collTimer = GameState::getOneSecondInFrames();
|
m_collTimer = GameState::getOneSecondInFrames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_invulnerableTimer = 2 * GameState::getOneSecondInFrames();
|
||||||
|
|
||||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1239,3 +1241,92 @@ void CNpcSeaSnakeEnemy::addHealthMeter()
|
||||||
m_meterOn=true;
|
m_meterOn=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcSeaSnakeEnemy::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:
|
||||||
|
{
|
||||||
|
if ( m_controlFunc != NPC_CONTROL_COLLISION )
|
||||||
|
{
|
||||||
|
m_oldControlFunc = m_controlFunc;
|
||||||
|
m_controlFunc = NPC_CONTROL_COLLISION;
|
||||||
|
}
|
||||||
|
|
||||||
|
processUserCollision( _thisThing );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case DETECT_ATTACK_COLLISION_GENERIC:
|
||||||
|
{
|
||||||
|
processAttackCollision();
|
||||||
|
processUserCollision( _thisThing );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( m_invulnerableTimer <= 0 )
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
drawAttackEffect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TYPE_ENEMY:
|
||||||
|
{
|
||||||
|
CNpcEnemy *enemy = (CNpcEnemy *) _thisThing;
|
||||||
|
|
||||||
|
if ( canCollideWithEnemy() && enemy->canCollideWithEnemy() )
|
||||||
|
{
|
||||||
|
processEnemyCollision( _thisThing );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ protected:
|
||||||
void moveEntireSnake( DVECTOR const &newPos );
|
void moveEntireSnake( DVECTOR const &newPos );
|
||||||
void addHealthMeter();
|
void addHealthMeter();
|
||||||
void updateTail( DVECTOR &oldPos, int _frames );
|
void updateTail( DVECTOR &oldPos, int _frames );
|
||||||
|
void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue