This commit is contained in:
parent
179b2a6231
commit
e77ef80771
@ -32,17 +32,10 @@ void CNpc::processCloseAnemone1Attack( int _frames )
|
||||
{
|
||||
s32 moveX, moveY;
|
||||
s16 decDir, incDir, moveDist;
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
DVECTOR playerPos = player->getPos();
|
||||
s32 xDist, yDist;
|
||||
s16 maxTurnRate = m_data[m_type].turnSpeed;
|
||||
bool withinRange = false;
|
||||
|
||||
xDist = playerPos.vx - this->Pos.vx;
|
||||
|
||||
yDist = playerPos.vy - this->Pos.vy;
|
||||
|
||||
s16 headingToPlayer = ratan2( yDist, xDist );
|
||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
||||
|
||||
decDir = m_fireHeading - headingToPlayer;
|
||||
|
||||
|
@ -26,18 +26,9 @@
|
||||
|
||||
void CNpc::processCloseBoogerMonsterAttack( int _frames )
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
DVECTOR playerPos = player->getPos();
|
||||
s32 xDist, yDist;
|
||||
s32 xDistSqr, yDistSqr;
|
||||
s32 velocity;
|
||||
|
||||
xDist = playerPos.vx - this->Pos.vx;
|
||||
xDistSqr = xDist * xDist;
|
||||
yDist = playerPos.vy - this->Pos.vy;
|
||||
yDistSqr = yDist * yDist;
|
||||
|
||||
if ( xDistSqr + yDistSqr > 10000 )
|
||||
if ( playerXDistSqr + playerYDistSqr > 10000 )
|
||||
{
|
||||
// user out of range, retract
|
||||
|
||||
|
@ -70,13 +70,7 @@ void CNpc::processIronDogfishMovement( int _frames )
|
||||
|
||||
void CNpc::processStandardIronDogfishAttack( int _frames )
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
DVECTOR playerPos = player->getPos();
|
||||
|
||||
s32 xDist = playerPos.vx - Pos.vx;
|
||||
s32 xDistSqr = xDist * xDist;
|
||||
|
||||
if ( xDist > 0 )
|
||||
if ( playerXDist > 0 )
|
||||
{
|
||||
m_extendDir = EXTEND_RIGHT;
|
||||
}
|
||||
@ -90,9 +84,9 @@ void CNpc::processStandardIronDogfishAttack( int _frames )
|
||||
case IRON_DOGFISH_THUMP_1:
|
||||
case IRON_DOGFISH_THUMP_2:
|
||||
{
|
||||
if ( xDistSqr > 100 )
|
||||
if ( playerXDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, 0, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, m_data[m_type].speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -110,9 +104,7 @@ void CNpc::processStandardIronDogfishAttack( int _frames )
|
||||
{
|
||||
// fire at user
|
||||
|
||||
s32 yDist = playerPos.vy - Pos.vy;
|
||||
|
||||
s16 headingToPlayer = ratan2( yDist, xDist );
|
||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
||||
|
||||
CProjectile *projectile;
|
||||
projectile = new( "test projectile" ) CProjectile;
|
||||
@ -134,9 +126,9 @@ void CNpc::processStandardIronDogfishAttack( int _frames )
|
||||
{
|
||||
// charge user
|
||||
|
||||
if ( xDistSqr > 100 )
|
||||
if ( playerXDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, 0, 6 );
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, 6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -71,13 +71,7 @@ void CNpc::processFlyingDutchmanMovement( int _frames )
|
||||
|
||||
void CNpc::processCloseFlyingDutchmanAttack( int _frames )
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
DVECTOR playerPos = player->getPos();
|
||||
|
||||
s32 yDist = playerPos.vy - Pos.vy;
|
||||
s32 yDistSqr = yDist * yDist;
|
||||
|
||||
if ( yDist > 0 )
|
||||
if ( playerYDist > 0 )
|
||||
{
|
||||
m_extendDir = EXTEND_DOWN;
|
||||
}
|
||||
@ -86,9 +80,9 @@ void CNpc::processCloseFlyingDutchmanAttack( int _frames )
|
||||
m_extendDir = EXTEND_UP;
|
||||
}
|
||||
|
||||
if ( yDistSqr > 100 )
|
||||
if ( playerYDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, 0, yDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, 0, playerYDist, m_data[m_type].speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -101,7 +95,7 @@ void CNpc::processCloseFlyingDutchmanAttack( int _frames )
|
||||
|
||||
s16 heading;
|
||||
|
||||
if ( playerPos.vx - Pos.vx > 0 )
|
||||
if ( playerXDist > 0 )
|
||||
{
|
||||
heading = 0;
|
||||
}
|
||||
@ -126,12 +120,9 @@ void CNpc::processCloseFlyingDutchmanAttack( int _frames )
|
||||
{
|
||||
// charge player
|
||||
|
||||
s32 xDist = playerPos.vx - Pos.vx;
|
||||
s32 xDistSqr = xDist * xDist;
|
||||
|
||||
if ( xDistSqr + yDistSqr > 100 )
|
||||
if ( playerXDistSqr + playerYDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, yDist, 6 );
|
||||
processGenericGotoTarget( _frames, playerXDist, playerYDist, 6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -55,10 +55,7 @@ void CNpc::processCloseGhostPirateAttack( int _frames )
|
||||
|
||||
s16 heading;
|
||||
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
DVECTOR playerPos = player->getPos();
|
||||
|
||||
if ( playerPos.vx > Pos.vx )
|
||||
if ( playerXDist > 0 )
|
||||
{
|
||||
heading = 0;
|
||||
}
|
||||
|
@ -32,20 +32,7 @@ void CNpc::processCloseNinjaStarfishAttack( int _frames )
|
||||
|
||||
s32 moveVel = 0;
|
||||
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
|
||||
DVECTOR playerPos = player->getPos();
|
||||
|
||||
s32 xDist, yDist;
|
||||
s32 xDistSqr, yDistSqr;
|
||||
|
||||
xDist = playerPos.vx - this->Pos.vx;
|
||||
xDistSqr = xDist * xDist;
|
||||
|
||||
yDist = playerPos.vy - this->Pos.vy;
|
||||
yDistSqr = yDist * yDist;
|
||||
|
||||
//if ( xDistSqr + yDistSqr > 22500 )
|
||||
//if ( playerXDistSqr + playerYDistSqr > 22500 )
|
||||
//{
|
||||
//this->m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
//}
|
||||
@ -53,7 +40,7 @@ void CNpc::processCloseNinjaStarfishAttack( int _frames )
|
||||
{
|
||||
bool pathComplete;
|
||||
|
||||
s16 headingToPlayer = ratan2( yDist, xDist );
|
||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
||||
s16 maxTurnRate = m_data[m_type].turnSpeed;
|
||||
s16 decDir, incDir;
|
||||
|
||||
|
@ -46,9 +46,15 @@
|
||||
#endif
|
||||
|
||||
|
||||
s32 CNpc::playerXDist;
|
||||
s32 CNpc::playerYDist;
|
||||
s32 CNpc::playerXDistSqr;
|
||||
s32 CNpc::playerYDistSqr;
|
||||
|
||||
|
||||
void CNpc::init()
|
||||
{
|
||||
m_type = NPC_CLAM;
|
||||
m_type = NPC_ANEMONE_1;
|
||||
|
||||
m_heading = m_fireHeading = 0;
|
||||
m_movementTimer = 0;
|
||||
@ -288,6 +294,12 @@ void CNpc::shutdown()
|
||||
|
||||
void CNpc::think(int _frames)
|
||||
{
|
||||
processGenericGetUserDist( _frames, &playerXDist, &playerYDist );
|
||||
playerXDistSqr = playerXDist * playerXDist;
|
||||
playerYDistSqr = playerYDist * playerYDist;
|
||||
|
||||
detectCollisionWithPlayer();
|
||||
|
||||
switch ( this->m_controlFunc )
|
||||
{
|
||||
case NPC_CONTROL_NONE:
|
||||
@ -325,6 +337,17 @@ void CNpc::think(int _frames)
|
||||
}
|
||||
|
||||
|
||||
void CNpc::detectCollisionWithPlayer()
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 400 )
|
||||
{
|
||||
// close enough for collision
|
||||
|
||||
m_controlFunc = NPC_CONTROL_COLLISION;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CNpc::processSensor()
|
||||
{
|
||||
switch( m_sensorFunc )
|
||||
@ -334,24 +357,11 @@ bool CNpc::processSensor()
|
||||
|
||||
default:
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
|
||||
DVECTOR playerPos = player->getPos();
|
||||
|
||||
s32 xDist, yDist;
|
||||
s32 xDistSqr, yDistSqr;
|
||||
|
||||
xDist = playerPos.vx - this->Pos.vx;
|
||||
xDistSqr = xDist * xDist;
|
||||
|
||||
yDist = playerPos.vy - this->Pos.vy;
|
||||
yDistSqr = yDist * yDist;
|
||||
|
||||
switch( m_sensorFunc )
|
||||
{
|
||||
case NPC_SENSOR_JELLYFISH_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 10000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_evadeClockwise = ( getRnd() % 2 ) - 1;
|
||||
@ -366,7 +376,7 @@ bool CNpc::processSensor()
|
||||
|
||||
case NPC_SENSOR_CLAM_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 10000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_extendDir = EXTEND_UP;
|
||||
@ -384,14 +394,14 @@ bool CNpc::processSensor()
|
||||
|
||||
case NPC_SENSOR_SPIDER_CRAB_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 10000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_extension = 0;
|
||||
m_velocity = 5;
|
||||
m_base = Pos;
|
||||
|
||||
if ( playerPos.vx < Pos.vx )
|
||||
if ( playerXDist < 0 )
|
||||
{
|
||||
m_extendDir = EXTEND_LEFT;
|
||||
}
|
||||
@ -411,7 +421,7 @@ bool CNpc::processSensor()
|
||||
case NPC_SENSOR_OIL_BLOB_USER_CLOSE:
|
||||
case NPC_SENSOR_NINJA_STARFISH_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 10000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_velocity = m_data[m_type].speed;
|
||||
@ -426,7 +436,7 @@ bool CNpc::processSensor()
|
||||
|
||||
case NPC_SENSOR_GHOST_PIRATE_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 10000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_extendDir = EXTEND_UP;
|
||||
@ -446,7 +456,7 @@ bool CNpc::processSensor()
|
||||
{
|
||||
s32 xDistWaypoint, yDistWaypoint;
|
||||
|
||||
if ( abs( xDist ) < 500 )
|
||||
if ( abs( playerXDist ) < 500 )
|
||||
{
|
||||
// within range
|
||||
|
||||
@ -456,9 +466,9 @@ bool CNpc::processSensor()
|
||||
|
||||
m_npcPath.getDistToNextWaypoint( Pos, &xDistWaypoint, &yDistWaypoint );
|
||||
|
||||
if ( abs( xDist ) < abs( xDistWaypoint ) )
|
||||
if ( abs( playerXDist ) < abs( xDistWaypoint ) )
|
||||
{
|
||||
s16 headingToPlayer = ratan2( yDist, xDist );
|
||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
||||
|
||||
s16 decDir, incDir, moveDist;
|
||||
|
||||
@ -548,7 +558,7 @@ bool CNpc::processSensor()
|
||||
case NPC_SENSOR_EYEBALL_USER_CLOSE:
|
||||
case NPC_SENSOR_FLAMING_SKULL_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 40000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 40000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
|
||||
@ -562,7 +572,7 @@ bool CNpc::processSensor()
|
||||
|
||||
case NPC_SENSOR_SKULL_STOMPER_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 40000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 40000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_extendDir = EXTEND_DOWN;
|
||||
@ -577,7 +587,7 @@ bool CNpc::processSensor()
|
||||
|
||||
case NPC_SENSOR_BOOGER_MONSTER_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 400 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 400 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_extendDir = EXTEND_UP;
|
||||
@ -592,7 +602,7 @@ bool CNpc::processSensor()
|
||||
|
||||
case NPC_SENSOR_IRON_DOGFISH_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 10000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
|
||||
@ -606,7 +616,7 @@ bool CNpc::processSensor()
|
||||
|
||||
case NPC_SENSOR_FISH_HOOK_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 400 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 400 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
|
||||
@ -620,7 +630,7 @@ bool CNpc::processSensor()
|
||||
|
||||
case NPC_SENSOR_FALLING_ITEM_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 40000 )
|
||||
if ( playerXDistSqr + playerYDistSqr < 40000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 3;
|
||||
@ -858,10 +868,7 @@ void CNpc::processClose(int _frames)
|
||||
|
||||
case NPC_CLOSE_GENERIC_USER_SEEK:
|
||||
{
|
||||
s32 distX, distY;
|
||||
|
||||
processGenericGetUserDist( _frames, &distX, &distY );
|
||||
processGenericGotoTarget( _frames, distX, distY, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, playerXDist, playerYDist, m_data[m_type].speed );
|
||||
|
||||
break;
|
||||
}
|
||||
@ -943,6 +950,9 @@ void CNpc::processClose(int _frames)
|
||||
|
||||
void CNpc::processCollision()
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
|
||||
//player->takeDamage( m_data[m_type].damageToUserType );
|
||||
}
|
||||
|
||||
void CNpc::processTimer(int _frames)
|
||||
|
@ -22,6 +22,10 @@
|
||||
#include "enemy\npcpath.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER_PLAYER_H__
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
class CNpc : public CThing
|
||||
@ -240,6 +244,7 @@ protected:
|
||||
bool canTalk;
|
||||
u8 speed;
|
||||
u16 turnSpeed;
|
||||
DAMAGE_TYPE damageToUserType;
|
||||
}
|
||||
NPC_DATA;
|
||||
|
||||
@ -252,6 +257,7 @@ protected:
|
||||
void processClose( int _frames );
|
||||
void processCollision();
|
||||
void processTimer( int _frames );
|
||||
void detectCollisionWithPlayer();
|
||||
|
||||
void processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed );
|
||||
void processGenericGetUserDist( int _frames, s32 *distX, s32 *distY );
|
||||
@ -341,6 +347,12 @@ protected:
|
||||
|
||||
static NPC_DATA m_data[NPC_UNIT_TYPE_MAX];
|
||||
|
||||
static s32 playerXDist;
|
||||
static s32 playerYDist;
|
||||
|
||||
static s32 playerXDistSqr;
|
||||
static s32 playerYDistSqr;
|
||||
|
||||
// internal variables
|
||||
|
||||
NPC_UNIT_TYPE m_type;
|
||||
|
@ -15,6 +15,10 @@
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER_PLAYER_H__
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
|
||||
CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
{
|
||||
@ -28,6 +32,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
true,
|
||||
3,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_FALLING_ITEM
|
||||
@ -40,6 +45,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_FISH_HOOK
|
||||
@ -52,6 +58,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_DUST_DEVIL
|
||||
@ -64,6 +71,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_PENDULUM
|
||||
@ -76,6 +84,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_FIREBALL
|
||||
@ -88,6 +97,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
40,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SAW_BLADE
|
||||
@ -100,6 +110,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SMALL_JELLYFISH_1
|
||||
@ -112,6 +123,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SMALL_JELLYFISH_2
|
||||
@ -124,6 +136,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_LARGE_JELLYFISH
|
||||
@ -136,6 +149,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_ANEMONE_1
|
||||
@ -148,6 +162,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
0,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_ANEMONE_2
|
||||
@ -160,6 +175,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
0,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_CLAM
|
||||
@ -171,6 +187,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_TIMER_NONE,
|
||||
0,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SQUID_DART
|
||||
@ -183,6 +200,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
5,
|
||||
256,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_FISH_FOLK
|
||||
@ -195,6 +213,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
2,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_PRICKLY_BUG
|
||||
@ -207,6 +226,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
1,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SEA_SNAKE_1
|
||||
@ -219,6 +239,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
256,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SEA_SNAKE_2
|
||||
@ -231,6 +252,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
256,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_PUFFA_FISH
|
||||
@ -243,6 +265,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
2,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_ANGLER_FISH
|
||||
@ -255,6 +278,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
1,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_HERMIT_CRAB
|
||||
@ -267,6 +291,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
2,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_MINE
|
||||
@ -279,6 +304,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
0,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_BOOGER_MONSTER
|
||||
@ -291,6 +317,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
0,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SPIDER_CRAB
|
||||
@ -303,6 +330,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_EYEBALL
|
||||
@ -315,6 +343,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
0,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_BABY_OCTOPUS
|
||||
@ -327,6 +356,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
2,
|
||||
512,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_ZOMBIE_FISH_FOLK
|
||||
@ -339,6 +369,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
2,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_NINJA_STARFISH
|
||||
@ -351,6 +382,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
64,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_GHOST
|
||||
@ -363,6 +395,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
2,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_GHOST_PIRATE
|
||||
@ -375,6 +408,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
0,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_FLAMING_SKULL
|
||||
@ -387,6 +421,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
128,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SHARK_MAN
|
||||
@ -399,6 +434,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_OIL_BLOB
|
||||
@ -411,6 +447,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
64,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SKULL_STOMPER
|
||||
@ -423,6 +460,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_MOTHER_JELLYFISH
|
||||
@ -435,6 +473,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
256,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_SUB_SHARK
|
||||
@ -447,6 +486,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
256,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_FLYING_DUTCHMAN
|
||||
@ -459,6 +499,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
256,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
|
||||
{ // NPC_IRON_DOGFISH
|
||||
@ -471,5 +512,6 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
false,
|
||||
3,
|
||||
2048,
|
||||
DAMAGE__LAVA,
|
||||
},
|
||||
};
|
@ -28,15 +28,8 @@ void CNpc::processCloseSharkManAttack( int _frames )
|
||||
{
|
||||
s32 moveX, moveY;
|
||||
s16 decDir, incDir, moveDist;
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
DVECTOR playerPos = player->getPos();
|
||||
s32 xDist, yDist;
|
||||
|
||||
xDist = playerPos.vx - this->Pos.vx;
|
||||
|
||||
yDist = playerPos.vy - this->Pos.vy;
|
||||
|
||||
s16 headingToPlayer = ratan2( yDist, xDist );
|
||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
||||
|
||||
decDir = m_heading - headingToPlayer;
|
||||
|
||||
@ -65,11 +58,11 @@ void CNpc::processCloseSharkManAttack( int _frames )
|
||||
|
||||
m_npcPath.getDistToNextWaypoint( Pos, &xDistWaypoint, &yDistWaypoint );
|
||||
|
||||
if ( abs( moveDist ) < 1024 && abs( xDistWaypoint ) >= abs( xDist ) )
|
||||
if ( abs( moveDist ) < 1024 && abs( xDistWaypoint ) >= abs( playerXDist ) )
|
||||
{
|
||||
// continue charge
|
||||
|
||||
if ( playerPos.vx < Pos.vx )
|
||||
if ( playerXDist < 0 )
|
||||
{
|
||||
m_heading = 2048;
|
||||
}
|
||||
|
@ -108,20 +108,7 @@ void CNpc::processCloseSmallJellyfishEvade( int _frames )
|
||||
|
||||
s32 moveVel = 0;
|
||||
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
|
||||
DVECTOR playerPos = player->getPos();
|
||||
|
||||
s32 xDist, yDist;
|
||||
s32 xDistSqr, yDistSqr;
|
||||
|
||||
xDist = playerPos.vx - this->Pos.vx;
|
||||
xDistSqr = xDist * xDist;
|
||||
|
||||
yDist = playerPos.vy - this->Pos.vy;
|
||||
yDistSqr = yDist * yDist;
|
||||
|
||||
if ( xDistSqr + yDistSqr > 22500 )
|
||||
if ( playerXDistSqr + playerYDistSqr > 22500 )
|
||||
{
|
||||
this->m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
}
|
||||
@ -138,7 +125,7 @@ void CNpc::processCloseSmallJellyfishEvade( int _frames )
|
||||
}
|
||||
else
|
||||
{
|
||||
s16 headingToPlayer = ratan2( yDist, xDist );
|
||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
||||
|
||||
if ( m_evadeClockwise )
|
||||
{
|
||||
|
@ -86,13 +86,7 @@ void CNpc::processSubSharkMovement( int _frames )
|
||||
|
||||
void CNpc::processCloseSubSharkAttack( int _frames )
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
DVECTOR playerPos = player->getPos();
|
||||
|
||||
s32 xDist = playerPos.vx - Pos.vx;
|
||||
s32 xDistSqr = xDist * xDist;
|
||||
|
||||
if ( xDist > 0 )
|
||||
if ( playerXDist > 0 )
|
||||
{
|
||||
m_extendDir = EXTEND_RIGHT;
|
||||
}
|
||||
@ -105,9 +99,9 @@ void CNpc::processCloseSubSharkAttack( int _frames )
|
||||
{
|
||||
case SUB_SHARK_MINE_1:
|
||||
{
|
||||
if ( xDistSqr > 100 )
|
||||
if ( playerXDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, 0, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, m_data[m_type].speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -124,9 +118,9 @@ void CNpc::processCloseSubSharkAttack( int _frames )
|
||||
|
||||
case SUB_SHARK_MINE_2:
|
||||
{
|
||||
if ( xDistSqr > 100 )
|
||||
if ( playerXDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, 0, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, m_data[m_type].speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -145,13 +139,9 @@ void CNpc::processCloseSubSharkAttack( int _frames )
|
||||
{
|
||||
// charge player
|
||||
|
||||
//s32 yDist = playerPos.vy - Pos.vy;
|
||||
//s32 yDistSqr = yDist * yDist;
|
||||
|
||||
//if ( xDistSqr + yDistSqr > 100 )
|
||||
if ( xDistSqr > 100 )
|
||||
if ( playerXDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, 0, 6 );
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, 6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user