This commit is contained in:
parent
d3d5d831dc
commit
fdf83f928a
4 changed files with 99 additions and 3 deletions
|
@ -1072,6 +1072,13 @@ void CNpcEnemy::processMovement(int _frames)
|
|||
break;
|
||||
}
|
||||
|
||||
case NPC_MOVEMENT_SHARK_MAN:
|
||||
{
|
||||
processSharkManMovement( _frames, &moveX, &moveY );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
|
@ -1310,8 +1317,8 @@ void CNpcEnemy::render()
|
|||
|
||||
int W=m_actorGfx->getFrameWidth(m_animNo,m_frame);
|
||||
int H=m_actorGfx->getFrameHeight(m_animNo,m_frame);
|
||||
renderPos.vx = Pos.vx - offset.vx /*+ ( scrnWidth >> 1 )*/ - ( W >> 1 );
|
||||
renderPos.vy = Pos.vy - offset.vy /*+ ( scrnHeight >> 1 )*/ - ( H >> 1 );
|
||||
renderPos.vx = Pos.vx - offset.vx;
|
||||
renderPos.vy = Pos.vy - offset.vy - H;
|
||||
|
||||
m_actorGfx->Render(renderPos,m_animNo,m_frame,m_reversed);
|
||||
}
|
||||
|
|
|
@ -274,6 +274,7 @@ protected:
|
|||
NPC_MOVEMENT_CLAM_RETRACT,
|
||||
NPC_MOVEMENT_PARASITIC_WORM,
|
||||
NPC_MOVEMENT_STATIC_CYCLE_ANIM,
|
||||
NPC_MOVEMENT_SHARK_MAN,
|
||||
};
|
||||
|
||||
enum NPC_MOVEMENT_MODIFIER_FUNC
|
||||
|
@ -432,6 +433,7 @@ protected:
|
|||
|
||||
// shark man functions
|
||||
|
||||
void processSharkManMovement( int _frames, s32 *moveX, s32 *moveY );
|
||||
void processCloseSharkManAttack( int _frames );
|
||||
|
||||
// anemone functions
|
||||
|
|
|
@ -740,7 +740,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
|||
ANIM_SHARKMAN_IDLE1_,
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_SENSOR_GENERIC_USER_VISIBLE,
|
||||
NPC_MOVEMENT_FIXED_PATH_WALK,
|
||||
NPC_MOVEMENT_SHARK_MAN,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_SHARK_MAN_ATTACK,
|
||||
NPC_TIMER_NONE,
|
||||
|
|
|
@ -23,11 +23,96 @@
|
|||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
#ifndef __UTILS_HEADER__
|
||||
#include "utils\utils.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ANIM_SHARKMAN_HEADER__
|
||||
#include <ACTOR_SHARKMAN_ANIM.h>
|
||||
#endif
|
||||
|
||||
|
||||
void CNpcEnemy::processSharkManMovement( int _frames, s32 *moveX, s32 *moveY )
|
||||
{
|
||||
if ( m_movementTimer > 0 )
|
||||
{
|
||||
m_movementTimer -= _frames;
|
||||
|
||||
if ( m_animNo == m_data[m_type].moveAnim )
|
||||
{
|
||||
processGenericFixedPathWalk( _frames, moveX, moveY );
|
||||
}
|
||||
|
||||
if ( !m_animPlaying )
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_frame = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// change anim
|
||||
|
||||
if ( m_animNo == m_data[m_type].moveAnim )
|
||||
{
|
||||
u8 newAction = getRnd() % 5;
|
||||
|
||||
switch( newAction )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 3;
|
||||
m_animNo = ANIM_SHARKMAN_IDLE1_;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 8;
|
||||
m_animNo = m_data[m_type].moveAnim;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 1;
|
||||
m_animNo = ANIM_SHARKMAN_IDLE2_;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3:
|
||||
{
|
||||
m_movementTimer = GameState::getOneSecondInFrames() >> 1;
|
||||
m_animNo = ANIM_SHARKMAN_KICK_SAND;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 3;
|
||||
m_animNo = ANIM_SHARKMAN_PUSHUPS;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// return to move anim
|
||||
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 8;
|
||||
m_animNo = m_data[m_type].moveAnim;
|
||||
}
|
||||
|
||||
m_animPlaying = true;
|
||||
m_frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CNpcEnemy::processCloseSharkManAttack( int _frames )
|
||||
{
|
||||
s32 moveX = 0, moveY = 0;
|
||||
|
@ -95,6 +180,7 @@ void CNpcEnemy::processCloseSharkManAttack( int _frames )
|
|||
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
||||
m_timerTimer = GameState::getOneSecondInFrames();
|
||||
m_sensorFunc = NPC_SENSOR_NONE;
|
||||
m_animNo = m_data[m_type].moveAnim;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -123,5 +209,6 @@ void CNpcEnemy::processCloseSharkManAttack( int _frames )
|
|||
else
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
m_animNo = m_data[m_type].moveAnim;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue