diff --git a/makefile.gaz b/makefile.gaz index 8f683e9b0..16ebc4f4a 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -77,7 +77,8 @@ enemy_src := npc \ nplatfrm \ nworm \ nhcrab \ - nbblob + nbblob \ + npuffa projectl_src := projectl diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 43e3fc5c2..00293215f 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -584,15 +584,17 @@ void CNpcEnemy::think(int _frames) 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 { - m_frame = frameCount - 1; + m_frame = ( frameCount - 1 ) << 8; 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: { 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_OCTOPUS_USER_CLOSE: + case NPC_SENSOR_HERMIT_CRAB_USER_CLOSE: { 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: return( false ); } @@ -1341,6 +1332,11 @@ void CNpcEnemy::processClose(int _frames) break; + case NPC_CLOSE_PUFFA_FISH_INFLATE: + processClosePuffaFishInflate( _frames ); + + break; + default: break; } @@ -1407,7 +1403,7 @@ void CNpcEnemy::render() { 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); } } } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 04f97e519..b900748a4 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -237,6 +237,7 @@ protected: NPC_SENSOR_FLAMING_SKULL_USER_CLOSE, NPC_SENSOR_HERMIT_CRAB_USER_CLOSE, NPC_SENSOR_OCTOPUS_USER_CLOSE, + NPC_SENSOR_PUFFA_FISH_USER_CLOSE, }; enum NPC_CLOSE_FUNC @@ -265,6 +266,7 @@ protected: NPC_CLOSE_SKELETAL_FISH_ATTACK, NPC_CLOSE_HERMIT_CRAB_ATTACK, NPC_CLOSE_OCTOPUS_ATTACK, + NPC_CLOSE_PUFFA_FISH_INFLATE, }; enum NPC_MOVEMENT_FUNC @@ -349,7 +351,14 @@ protected: { HERMIT_CRAB_NO_ATTACK = 0, 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 @@ -445,6 +454,10 @@ protected: void processCloseGhostPirateAttack( int _frames ); + // puffa fish functions + + void processClosePuffaFishInflate( int _frames ); + // shark man functions void processSharkManMovement( int _frames, s32 *moveX, s32 *moveY ); @@ -543,7 +556,7 @@ protected: bool m_reversed; s32 m_health; - int m_frame; + s32 m_frame; int m_animNo; CActorGfx *m_actorGfx; DVECTOR m_drawOffset; diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 575dc93dc..a7601dbf2 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -514,10 +514,10 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = ACTORS_PUFFAFISH_SBK, ANIM_PUFFAFISH_PUFFUPIDLE, NPC_INIT_DEFAULT, - NPC_SENSOR_NONE, + NPC_SENSOR_PUFFA_FISH_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH, NPC_MOVEMENT_MODIFIER_NONE, - NPC_CLOSE_NONE, + NPC_CLOSE_PUFFA_FISH_INFLATE, NPC_TIMER_NONE, false, 2, diff --git a/source/enemy/nsjfish.cpp b/source/enemy/nsjfish.cpp index ddf7c1470..7715b13cd 100644 --- a/source/enemy/nsjfish.cpp +++ b/source/enemy/nsjfish.cpp @@ -28,6 +28,7 @@ void CNpcEnemy::processSmallJellyfishMovementModifier( int _frames, s32 distX, s { s32 newX, newY; s32 preShiftX, preShiftY; + s16 headingVal; //u16 jellyfishData[5] = { 96, 192, 256, 192, 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(); } - 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 absVelocity = abs( m_velocity ); @@ -72,9 +73,15 @@ void CNpcEnemy::processSmallJellyfishMovementModifier( int _frames, s32 distX, s m_velocity += resistance; + headingVal = abs( headingChange ); + if ( headingVal > 128 ) + { + headingVal = 128; + } + reqVelocity = dist * jellyfishData[dataPoint]; reqVelocity >>= 8; - reqVelocity *= 128 + ( 128 - headingChange ); + reqVelocity *= 128 + ( 128 - headingVal ); reqVelocity >>= 8; s32 absReqVelocity = abs( reqVelocity ); diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index af06155cb..47e1c85df 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -201,6 +201,10 @@ SOURCE=..\..\..\source\enemy\nplatfrm.h # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\npuffa.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nscrab.cpp # End Source File # Begin Source File