This commit is contained in:
parent
47d5bb7fc7
commit
58756ef755
11 changed files with 287 additions and 33 deletions
|
@ -252,8 +252,8 @@ void CNpcAnemone2Enemy::postInit()
|
|||
|
||||
// move appropriate to scaling (anemone origin is 90 degrees off, hence:)
|
||||
|
||||
xDiff = ( m_scaleY * 40 ) >> 12;
|
||||
yDiff = ( m_scaleX * 40 ) >> 12;
|
||||
xDiff = ( m_scaleY * SPIKE_RADIUS ) >> 12;
|
||||
yDiff = ( m_scaleX * SPIKE_RADIUS ) >> 12;
|
||||
|
||||
offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12;
|
||||
offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12;
|
||||
|
@ -280,12 +280,123 @@ void CNpcAnemone2Enemy::postInit()
|
|||
|
||||
void CNpcAnemone2Enemy::shutdown()
|
||||
{
|
||||
deleteAllChild();
|
||||
CNpcEnemy::shutdown();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcAnemone2Enemy::processShot( int _frames )
|
||||
{
|
||||
switch( m_data[m_type].shotFunc )
|
||||
{
|
||||
case NPC_SHOT_NONE:
|
||||
{
|
||||
// do nothing
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_SHOT_GENERIC:
|
||||
{
|
||||
switch ( m_state )
|
||||
{
|
||||
case NPC_GENERIC_HIT_CHECK_HEALTH:
|
||||
{
|
||||
if ( CLevel::getCurrentChapter() == 1 && CLevel::getCurrentChapterLevel() == 1 )
|
||||
{
|
||||
m_state = NPC_GENERIC_HIT_DEATH_START;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_health -= 5;
|
||||
|
||||
if ( m_health < 0 )
|
||||
{
|
||||
m_state = NPC_GENERIC_HIT_DEATH_START;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_state = NPC_GENERIC_HIT_RECOIL;
|
||||
|
||||
m_animPlaying = true;
|
||||
m_animNo = m_data[m_type].recoilAnim;
|
||||
m_frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_GENERIC_HIT_RECOIL:
|
||||
{
|
||||
if ( !m_animPlaying )
|
||||
{
|
||||
m_state = 0;
|
||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_GENERIC_HIT_DEATH_START:
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_animNo = m_data[m_type].dieAnim;
|
||||
m_frame = 0;
|
||||
m_state = NPC_GENERIC_HIT_DEATH_END;
|
||||
|
||||
deleteAllChild();
|
||||
m_isDying = true;
|
||||
m_speed = -5;
|
||||
|
||||
if (m_data[m_type].skelType)
|
||||
{
|
||||
m_actorGfx->SetOtPos( 0 );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_GENERIC_HIT_DEATH_END:
|
||||
{
|
||||
m_drawRotation += 64 * _frames;
|
||||
m_drawRotation &= 4095;
|
||||
|
||||
Pos.vy += m_speed * _frames;
|
||||
|
||||
if ( m_speed < 5 )
|
||||
{
|
||||
m_speed++;
|
||||
}
|
||||
|
||||
DVECTOR offset = CLevel::getCameraPos();
|
||||
|
||||
if ( Pos.vy - offset.vy > VidGetScrH() )
|
||||
{
|
||||
if ( m_data[m_type].respawning )
|
||||
{
|
||||
m_isActive = false;
|
||||
|
||||
m_timerFunc = NPC_TIMER_RESPAWN;
|
||||
m_timerTimer = 4 * GameState::getOneSecondInFrames();
|
||||
}
|
||||
else
|
||||
{
|
||||
setToShutdown();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcAnemone2Enemy::processClose( int _frames )
|
||||
{
|
||||
int fireLoop;
|
||||
|
@ -354,8 +465,8 @@ void CNpcAnemone2Enemy::processClose( int _frames )
|
|||
|
||||
// move appropriate to scaling (anemone origin is 90 degrees off, hence:)
|
||||
|
||||
xDiff = ( m_scaleY * 40 ) >> 12;
|
||||
yDiff = ( m_scaleX * 40 ) >> 12;
|
||||
xDiff = ( m_scaleY * SPIKE_RADIUS ) >> 12;
|
||||
yDiff = ( m_scaleX * SPIKE_RADIUS ) >> 12;
|
||||
|
||||
offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12;
|
||||
offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12;
|
||||
|
@ -426,8 +537,8 @@ void CNpcAnemone2Enemy::processMovementModifier( int _frames, s32 distX, s32 dis
|
|||
|
||||
// move appropriate to scaling (anemone origin is 90 degrees off, hence:)
|
||||
|
||||
xDiff = ( m_scaleY * 40 ) >> 12;
|
||||
yDiff = ( m_scaleX * 40 ) >> 12;
|
||||
xDiff = ( m_scaleY * SPIKE_RADIUS ) >> 12;
|
||||
yDiff = ( m_scaleX * SPIKE_RADIUS ) >> 12;
|
||||
|
||||
offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12;
|
||||
offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12;
|
||||
|
|
|
@ -39,11 +39,17 @@ public:
|
|||
virtual void postInit();
|
||||
virtual void shutdown();
|
||||
virtual void render();
|
||||
virtual void processShot( int _frames );
|
||||
protected:
|
||||
virtual void processClose( int _frames );
|
||||
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||
|
||||
u16 m_scaleX, m_scaleY;
|
||||
|
||||
enum
|
||||
{
|
||||
SPIKE_RADIUS = 20,
|
||||
};
|
||||
};
|
||||
|
||||
class CNpcAnemone3Enemy : public CNpcAnemoneEnemy
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
NPC_PROJECTILE_JELLYFISH,
|
||||
NPC_MOTHER_JELLYFISH_BACKGROUND,
|
||||
NPC_SMALL_JELLYFISH_BACKGROUND,
|
||||
NPC_SMALL_JELLYFISH_2_BACKGROUND,
|
||||
NPC_UNIT_TYPE_MAX,
|
||||
};
|
||||
|
||||
|
|
|
@ -1056,6 +1056,29 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
|||
false,
|
||||
false,
|
||||
},
|
||||
|
||||
{ // NPC_SMALL_JELLYFISH_2_BACKGROUND
|
||||
0,//ACTORS_JELLYFISH1_SBK,
|
||||
FRM_JELLYFISH1_SWIM1,
|
||||
NPC_SENSOR_USER_CLOSE,
|
||||
NPC_MOVEMENT_FIXED_PATH,
|
||||
NPC_CLOSE_NONE,
|
||||
NPC_TIMER_NONE,
|
||||
false,
|
||||
2,
|
||||
128,
|
||||
DETECT_ALL_COLLISION,
|
||||
DAMAGE__SHOCK_ENEMY,
|
||||
16,
|
||||
FRM_JELLYFISH1_SWIM1,
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
FRM_JELLYFISH1_SWIM1,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
};
|
||||
|
||||
CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::mapEditConvertTable[NPC_UNIT_TYPE_MAX] =
|
||||
|
|
|
@ -195,6 +195,16 @@ void CNpcSmallJellyfishBackgroundEnemy::processUserCollision( CThing *thisThing
|
|||
|
||||
if ( !otherDelta.vx && !otherDelta.vy )
|
||||
{
|
||||
if ( !xDist )
|
||||
{
|
||||
xDist = 1;
|
||||
}
|
||||
|
||||
if ( !yDist )
|
||||
{
|
||||
yDist = 1;
|
||||
}
|
||||
|
||||
otherDelta.vx = ( 1 * xDist ) / abs( xDist );
|
||||
otherDelta.vy = ( 1 * yDist ) / abs( yDist );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue