This commit is contained in:
Charles 2001-04-05 15:54:40 +00:00
parent 5b8ef72209
commit 0f094cd65a
6 changed files with 61 additions and 40 deletions

View file

@ -77,7 +77,8 @@ enemy_src := npc \
nplatfrm \ nplatfrm \
nworm \ nworm \
nhcrab \ nhcrab \
nbblob nbblob \
npuffa
projectl_src := projectl projectl_src := projectl

View file

@ -584,15 +584,17 @@ void CNpcEnemy::think(int _frames)
if ( m_animPlaying ) if ( m_animPlaying )
{ {
int frameCount = m_actorGfx->getFrameCount(m_animNo); s32 frameCount = m_actorGfx->getFrameCount(m_animNo);
s32 frameShift = ( _frames << 8 ) >> 1;
if ( frameCount - m_frame > _frames >> 1 ) if ( ( frameCount << 8 ) - m_frame > frameShift ) //( _frames >> 1 ) )
{ {
m_frame += _frames >> 1; //m_frame += _frames >> 1;
m_frame += frameShift;
} }
else else
{ {
m_frame = frameCount - 1; m_frame = ( frameCount - 1 ) << 8;
m_animPlaying = false; m_animPlaying = false;
} }
} }
@ -930,20 +932,6 @@ bool CNpcEnemy::processSensor()
} }
} }
case NPC_SENSOR_HERMIT_CRAB_USER_CLOSE:
{
if ( playerXDistSqr + playerYDistSqr < 400 )
{
m_controlFunc = NPC_CONTROL_CLOSE;
return( true );
}
else
{
return( false );
}
}
case NPC_SENSOR_BOOGER_MONSTER_USER_CLOSE: case NPC_SENSOR_BOOGER_MONSTER_USER_CLOSE:
{ {
if ( playerXDistSqr + playerYDistSqr < 400 ) if ( playerXDistSqr + playerYDistSqr < 400 )
@ -973,7 +961,24 @@ bool CNpcEnemy::processSensor()
} }
} }
case NPC_SENSOR_PUFFA_FISH_USER_CLOSE:
{
if ( playerXDistSqr + playerYDistSqr < 10000 )
{
m_state = PUFFA_FISH_NO_INFLATE;
m_controlFunc = NPC_CONTROL_CLOSE;
return( true );
}
else
{
return( false );
}
}
case NPC_SENSOR_FISH_HOOK_USER_CLOSE: case NPC_SENSOR_FISH_HOOK_USER_CLOSE:
case NPC_SENSOR_OCTOPUS_USER_CLOSE:
case NPC_SENSOR_HERMIT_CRAB_USER_CLOSE:
{ {
if ( playerXDistSqr + playerYDistSqr < 400 ) if ( playerXDistSqr + playerYDistSqr < 400 )
{ {
@ -1002,20 +1007,6 @@ bool CNpcEnemy::processSensor()
} }
} }
case NPC_SENSOR_OCTOPUS_USER_CLOSE:
{
if ( playerXDistSqr + playerYDistSqr < 400 )
{
m_controlFunc = NPC_CONTROL_CLOSE;
return( true );
}
else
{
return( false );
}
}
default: default:
return( false ); return( false );
} }
@ -1341,6 +1332,11 @@ void CNpcEnemy::processClose(int _frames)
break; break;
case NPC_CLOSE_PUFFA_FISH_INFLATE:
processClosePuffaFishInflate( _frames );
break;
default: default:
break; break;
} }
@ -1407,7 +1403,7 @@ void CNpcEnemy::render()
{ {
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() ) if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{ {
m_actorGfx->Render(renderPos,m_animNo,m_frame,m_reversed); m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
} }
} }
} }

View file

@ -237,6 +237,7 @@ protected:
NPC_SENSOR_FLAMING_SKULL_USER_CLOSE, NPC_SENSOR_FLAMING_SKULL_USER_CLOSE,
NPC_SENSOR_HERMIT_CRAB_USER_CLOSE, NPC_SENSOR_HERMIT_CRAB_USER_CLOSE,
NPC_SENSOR_OCTOPUS_USER_CLOSE, NPC_SENSOR_OCTOPUS_USER_CLOSE,
NPC_SENSOR_PUFFA_FISH_USER_CLOSE,
}; };
enum NPC_CLOSE_FUNC enum NPC_CLOSE_FUNC
@ -265,6 +266,7 @@ protected:
NPC_CLOSE_SKELETAL_FISH_ATTACK, NPC_CLOSE_SKELETAL_FISH_ATTACK,
NPC_CLOSE_HERMIT_CRAB_ATTACK, NPC_CLOSE_HERMIT_CRAB_ATTACK,
NPC_CLOSE_OCTOPUS_ATTACK, NPC_CLOSE_OCTOPUS_ATTACK,
NPC_CLOSE_PUFFA_FISH_INFLATE,
}; };
enum NPC_MOVEMENT_FUNC enum NPC_MOVEMENT_FUNC
@ -349,7 +351,14 @@ protected:
{ {
HERMIT_CRAB_NO_ATTACK = 0, HERMIT_CRAB_NO_ATTACK = 0,
HERMIT_CRAB_PUNCH_ATTACK = 1, HERMIT_CRAB_PUNCH_ATTACK = 1,
HERMIT_CRAB_ROLL_ATTACK = 2, HERMIT_CRAB_ROLL_ATTACK,
};
enum NPC_PUFFA_FISH_STATE
{
PUFFA_FISH_NO_INFLATE = 0,
PUFFA_FISH_TURN = 1,
PUFFA_FISH_INFLATE,
}; };
enum enum
@ -445,6 +454,10 @@ protected:
void processCloseGhostPirateAttack( int _frames ); void processCloseGhostPirateAttack( int _frames );
// puffa fish functions
void processClosePuffaFishInflate( int _frames );
// shark man functions // shark man functions
void processSharkManMovement( int _frames, s32 *moveX, s32 *moveY ); void processSharkManMovement( int _frames, s32 *moveX, s32 *moveY );
@ -543,7 +556,7 @@ protected:
bool m_reversed; bool m_reversed;
s32 m_health; s32 m_health;
int m_frame; s32 m_frame;
int m_animNo; int m_animNo;
CActorGfx *m_actorGfx; CActorGfx *m_actorGfx;
DVECTOR m_drawOffset; DVECTOR m_drawOffset;

View file

@ -514,10 +514,10 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ACTORS_PUFFAFISH_SBK, ACTORS_PUFFAFISH_SBK,
ANIM_PUFFAFISH_PUFFUPIDLE, ANIM_PUFFAFISH_PUFFUPIDLE,
NPC_INIT_DEFAULT, NPC_INIT_DEFAULT,
NPC_SENSOR_NONE, NPC_SENSOR_PUFFA_FISH_USER_CLOSE,
NPC_MOVEMENT_FIXED_PATH, NPC_MOVEMENT_FIXED_PATH,
NPC_MOVEMENT_MODIFIER_NONE, NPC_MOVEMENT_MODIFIER_NONE,
NPC_CLOSE_NONE, NPC_CLOSE_PUFFA_FISH_INFLATE,
NPC_TIMER_NONE, NPC_TIMER_NONE,
false, false,
2, 2,

View file

@ -28,6 +28,7 @@ void CNpcEnemy::processSmallJellyfishMovementModifier( int _frames, s32 distX, s
{ {
s32 newX, newY; s32 newX, newY;
s32 preShiftX, preShiftY; s32 preShiftX, preShiftY;
s16 headingVal;
//u16 jellyfishData[5] = { 96, 192, 256, 192, 128, }; //u16 jellyfishData[5] = { 96, 192, 256, 192, 128, };
u16 jellyfishData[6] = { 256, 192, 96, 48, 96, 128, }; u16 jellyfishData[6] = { 256, 192, 96, 48, 96, 128, };
@ -48,7 +49,7 @@ void CNpcEnemy::processSmallJellyfishMovementModifier( int _frames, s32 distX, s
dataPoint /= GameState::getOneSecondInFrames(); dataPoint /= GameState::getOneSecondInFrames();
} }
m_frame = ( m_movementTimer * ( m_actorGfx->getFrameCount(m_animNo) - 1 ) ) / GameState::getOneSecondInFrames(); m_frame = ( ( m_movementTimer * ( m_actorGfx->getFrameCount(m_animNo) - 1 ) << 8 ) ) / GameState::getOneSecondInFrames();
s32 resistance; s32 resistance;
s32 absVelocity = abs( m_velocity ); s32 absVelocity = abs( m_velocity );
@ -72,9 +73,15 @@ void CNpcEnemy::processSmallJellyfishMovementModifier( int _frames, s32 distX, s
m_velocity += resistance; m_velocity += resistance;
headingVal = abs( headingChange );
if ( headingVal > 128 )
{
headingVal = 128;
}
reqVelocity = dist * jellyfishData[dataPoint]; reqVelocity = dist * jellyfishData[dataPoint];
reqVelocity >>= 8; reqVelocity >>= 8;
reqVelocity *= 128 + ( 128 - headingChange ); reqVelocity *= 128 + ( 128 - headingVal );
reqVelocity >>= 8; reqVelocity >>= 8;
s32 absReqVelocity = abs( reqVelocity ); s32 absReqVelocity = abs( reqVelocity );

View file

@ -201,6 +201,10 @@ SOURCE=..\..\..\source\enemy\nplatfrm.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\source\enemy\npuffa.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\nscrab.cpp SOURCE=..\..\..\source\enemy\nscrab.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File