This commit is contained in:
parent
4375b167d6
commit
add3cac234
2 changed files with 100 additions and 8 deletions
|
@ -52,6 +52,8 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||||
NPC_CLOSE_JELLYFISH_EVADE,
|
NPC_CLOSE_JELLYFISH_EVADE,
|
||||||
NPC_TIMER_NONE,
|
NPC_TIMER_NONE,
|
||||||
false,
|
false,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ // NPC_SANDY_CHEEKS
|
{ // NPC_SANDY_CHEEKS
|
||||||
|
@ -62,6 +64,8 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||||
NPC_CLOSE_NONE,
|
NPC_CLOSE_NONE,
|
||||||
NPC_TIMER_NONE,
|
NPC_TIMER_NONE,
|
||||||
true,
|
true,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ // NPC_SMALL_JELLYFISH_1
|
{ // NPC_SMALL_JELLYFISH_1
|
||||||
|
@ -72,6 +76,32 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||||
NPC_CLOSE_JELLYFISH_EVADE,
|
NPC_CLOSE_JELLYFISH_EVADE,
|
||||||
NPC_TIMER_NONE,
|
NPC_TIMER_NONE,
|
||||||
false,
|
false,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_SMALL_JELLYFISH_2
|
||||||
|
NPC_INIT_DEFAULT,
|
||||||
|
NPC_SENSOR_JELLYFISH_USER_CLOSE,
|
||||||
|
NPC_MOVEMENT_FIXED_PATH,
|
||||||
|
NPC_MOVEMENT_MODIFIER_JELLYFISH,
|
||||||
|
NPC_CLOSE_JELLYFISH_EVADE,
|
||||||
|
NPC_TIMER_NONE,
|
||||||
|
false,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_LARGE_JELLYFISH
|
||||||
|
NPC_INIT_DEFAULT,
|
||||||
|
NPC_SENSOR_NONE,
|
||||||
|
NPC_MOVEMENT_FIXED_PATH,
|
||||||
|
NPC_MOVEMENT_MODIFIER_NONE,
|
||||||
|
NPC_CLOSE_NONE,
|
||||||
|
NPC_TIMER_NONE,
|
||||||
|
false,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ // NPC_ANEMONE_1
|
{ // NPC_ANEMONE_1
|
||||||
|
@ -82,6 +112,8 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||||
NPC_CLOSE_NONE,
|
NPC_CLOSE_NONE,
|
||||||
NPC_TIMER_NONE,
|
NPC_TIMER_NONE,
|
||||||
false,
|
false,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ // NPC_CLAM
|
{ // NPC_CLAM
|
||||||
|
@ -91,13 +123,52 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||||
NPC_MOVEMENT_MODIFIER_NONE,
|
NPC_MOVEMENT_MODIFIER_NONE,
|
||||||
NPC_CLOSE_CLAM_ATTACK,
|
NPC_CLOSE_CLAM_ATTACK,
|
||||||
NPC_TIMER_NONE,
|
NPC_TIMER_NONE,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ // NPC_SQUID_DART
|
||||||
|
NPC_INIT_DEFAULT,
|
||||||
|
NPC_SENSOR_NONE,
|
||||||
|
NPC_MOVEMENT_FIXED_PATH,
|
||||||
|
NPC_MOVEMENT_MODIFIER_NONE,
|
||||||
|
NPC_CLOSE_NONE,
|
||||||
|
NPC_TIMER_NONE,
|
||||||
|
false,
|
||||||
|
5,
|
||||||
|
256,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_FISH_FOLK
|
||||||
|
NPC_INIT_DEFAULT,
|
||||||
|
NPC_SENSOR_NONE,
|
||||||
|
NPC_MOVEMENT_FIXED_PATH,
|
||||||
|
NPC_MOVEMENT_MODIFIER_NONE,
|
||||||
|
NPC_CLOSE_NONE,
|
||||||
|
NPC_TIMER_NONE,
|
||||||
|
false,
|
||||||
|
2,
|
||||||
|
128,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_PRICKLY_BUG
|
||||||
|
NPC_INIT_DEFAULT,
|
||||||
|
NPC_SENSOR_NONE,
|
||||||
|
NPC_MOVEMENT_FIXED_PATH,
|
||||||
|
NPC_MOVEMENT_MODIFIER_NONE,
|
||||||
|
NPC_CLOSE_NONE,
|
||||||
|
NPC_TIMER_NONE,
|
||||||
|
false,
|
||||||
|
1,
|
||||||
|
128,
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void CNpc::init()
|
void CNpc::init()
|
||||||
{
|
{
|
||||||
m_type = NPC_CLAM;
|
m_type = NPC_FISH_FOLK;
|
||||||
|
|
||||||
m_heading = 3072;
|
m_heading = 3072;
|
||||||
m_movementTimer = 0;
|
m_movementTimer = 0;
|
||||||
|
@ -287,6 +358,7 @@ void CNpc::processMovement(int _frames)
|
||||||
if ( !pathComplete )
|
if ( !pathComplete )
|
||||||
{
|
{
|
||||||
s16 decDir, incDir;
|
s16 decDir, incDir;
|
||||||
|
s16 maxTurnRate = m_data[m_type].turnSpeed;
|
||||||
|
|
||||||
decDir = m_heading - headingToTarget;
|
decDir = m_heading - headingToTarget;
|
||||||
|
|
||||||
|
@ -311,22 +383,35 @@ void CNpc::processMovement(int _frames)
|
||||||
moveDist = incDir;
|
moveDist = incDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( moveDist < -128 )
|
if ( moveDist < -maxTurnRate )
|
||||||
{
|
{
|
||||||
moveDist = -128;
|
moveDist = -maxTurnRate;
|
||||||
}
|
}
|
||||||
else if ( moveDist > 128 )
|
else if ( moveDist > maxTurnRate )
|
||||||
{
|
{
|
||||||
moveDist = 128;
|
moveDist = maxTurnRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_heading += moveDist;
|
m_heading += moveDist;
|
||||||
|
|
||||||
m_heading = m_heading % ONE;
|
m_heading = m_heading % ONE;
|
||||||
|
|
||||||
moveX = ( _frames * 3 * rcos( m_heading ) ) >> 12;
|
s32 preShiftX = _frames * m_data[m_type].speed * rcos( m_heading );
|
||||||
moveY = ( _frames * 3 * rsin( m_heading ) ) >> 12;
|
s32 preShiftY = _frames * m_data[m_type].speed * rsin( m_heading );
|
||||||
moveVel = ( _frames * 3 ) << 8;
|
|
||||||
|
moveX = preShiftX >> 12;
|
||||||
|
if ( !moveX && preShiftX )
|
||||||
|
{
|
||||||
|
moveX = preShiftX / abs( preShiftX );
|
||||||
|
}
|
||||||
|
|
||||||
|
moveY = preShiftY >> 12;
|
||||||
|
if ( !moveY && preShiftY )
|
||||||
|
{
|
||||||
|
moveY = preShiftY / abs( preShiftY );
|
||||||
|
}
|
||||||
|
|
||||||
|
moveVel = ( _frames * m_data[m_type].speed ) << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -42,8 +42,13 @@ protected:
|
||||||
NPC_TEST_TYPE = 0,
|
NPC_TEST_TYPE = 0,
|
||||||
NPC_SANDY_CHEEKS = 1,
|
NPC_SANDY_CHEEKS = 1,
|
||||||
NPC_SMALL_JELLYFISH_1,
|
NPC_SMALL_JELLYFISH_1,
|
||||||
|
NPC_SMALL_JELLYFISH_2,
|
||||||
|
NPC_LARGE_JELLYFISH,
|
||||||
NPC_ANEMONE_1,
|
NPC_ANEMONE_1,
|
||||||
NPC_CLAM,
|
NPC_CLAM,
|
||||||
|
NPC_SQUID_DART,
|
||||||
|
NPC_FISH_FOLK,
|
||||||
|
NPC_PRICKLY_BUG,
|
||||||
NPC_UNIT_TYPE_MAX,
|
NPC_UNIT_TYPE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -113,6 +118,8 @@ protected:
|
||||||
NPC_CLOSE_FUNC closeFunc;
|
NPC_CLOSE_FUNC closeFunc;
|
||||||
NPC_TIMER_FUNC timerFunc;
|
NPC_TIMER_FUNC timerFunc;
|
||||||
bool canTalk;
|
bool canTalk;
|
||||||
|
u8 speed;
|
||||||
|
u16 turnSpeed;
|
||||||
}
|
}
|
||||||
NPC_DATA;
|
NPC_DATA;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue