This commit is contained in:
parent
796aeddca7
commit
bc760c2dd3
@ -15,6 +15,10 @@
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NANEMONE_H__
|
||||
#include "enemy\nanemone.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PROJECTL_PROJECTL_H__
|
||||
#include "projectl\projectl.h"
|
||||
#endif
|
||||
@ -40,6 +44,29 @@
|
||||
#endif
|
||||
|
||||
|
||||
bool CNpcAnemoneEnemy::processSensor()
|
||||
{
|
||||
switch( m_sensorFunc )
|
||||
{
|
||||
case NPC_SENSOR_NONE:
|
||||
return( false );
|
||||
|
||||
default:
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 40000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
|
||||
return( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CNpcEnemy::processCloseAnemone1Attack( int _frames )
|
||||
{
|
||||
s32 moveX, moveY;
|
||||
|
@ -11,10 +11,66 @@
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __ENEMY_NPC_H__
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NGEN_H__
|
||||
#include "enemy\ngen.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NSCRAB_H__
|
||||
#include "enemy\nscrab.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcEnemyGenerator::think(int _frames)
|
||||
{
|
||||
if ( getNumChildren() < 3 )
|
||||
{
|
||||
m_movementTimer -= _frames;
|
||||
|
||||
if ( m_movementTimer < 0 )
|
||||
{
|
||||
m_movementTimer = 3 * GameState::getOneSecondInFrames();
|
||||
|
||||
CNpcEnemy *enemy;
|
||||
enemy = new( "spider crab" ) CNpcSpiderCrabEnemy;
|
||||
ASSERT(enemy);
|
||||
enemy->setType( CNpcEnemy::NPC_SPIDER_CRAB );
|
||||
enemy->init();
|
||||
enemy->setLayerCollision( m_layerCollision );
|
||||
enemy->setStartPos( Pos.vx >> 4, Pos.vy >> 4 );
|
||||
|
||||
CNpcWaypoint *sourceWaypoint = m_npcPath.getWaypointList();
|
||||
|
||||
if ( sourceWaypoint )
|
||||
{
|
||||
// skip first waypoint
|
||||
|
||||
sourceWaypoint = sourceWaypoint->nextWaypoint;
|
||||
|
||||
while( sourceWaypoint )
|
||||
{
|
||||
enemy->addWaypoint( sourceWaypoint->pos.vx >> 4, sourceWaypoint->pos.vy >> 4 );
|
||||
sourceWaypoint = sourceWaypoint->nextWaypoint;
|
||||
}
|
||||
}
|
||||
|
||||
enemy->setPathType( m_npcPath.getPathType() );
|
||||
|
||||
enemy->postInit();
|
||||
|
||||
addChild( enemy );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcEnemyGenerator::render()
|
||||
|
@ -14,8 +14,7 @@
|
||||
#ifndef __ENEMY_NGEN_H__
|
||||
#define __ENEMY_NGEN_H__
|
||||
|
||||
|
||||
#ifndef __ENEMY_NPC_H__
|
||||
#ifndef __ENEMY_NPC_H__
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
@ -23,6 +22,7 @@ class CNpcEnemyGenerator : public CNpcEnemy
|
||||
{
|
||||
public:
|
||||
void render();
|
||||
void think(int _frames);
|
||||
};
|
||||
|
||||
#endif
|
@ -15,6 +15,10 @@
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NHCRAB_H__
|
||||
#include "enemy\nhcrab.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
@ -27,7 +31,30 @@
|
||||
#include <ACTOR_HERMITCRAB_ANIM.h>
|
||||
#endif
|
||||
|
||||
void CNpcEnemy::processCloseHermitCrabAttack( int _frames )
|
||||
bool CNpcHermitCrabEnemy::processSensor()
|
||||
{
|
||||
switch( m_sensorFunc )
|
||||
{
|
||||
case NPC_SENSOR_NONE:
|
||||
return( false );
|
||||
|
||||
default:
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 400 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
|
||||
return( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CNpcHermitCrabEnemy::processClose( int _frames )
|
||||
{
|
||||
if ( m_state == HERMIT_CRAB_NO_ATTACK )
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*=========================================================================
|
||||
|
||||
nhcrab.cpp
|
||||
nhcrab.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
@ -12,6 +12,7 @@
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __ENEMY_NHCRAB_H__
|
||||
#define __ENEMY_NHCRAB_H__
|
||||
|
||||
#ifndef __ENEMY_NPC_H__
|
||||
#include "enemy\npc.h"
|
||||
|
@ -188,6 +188,13 @@ s32 CNpcEnemy::playerYDistSqr;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::getTypeFromMapEdit( u16 newType )
|
||||
{
|
||||
return( mapEditConvertTable[newType - NPC_ENEMY_MAPEDIT_OFFSET] );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcEnemy::setTypeFromMapEdit( u16 newType )
|
||||
{
|
||||
m_type = mapEditConvertTable[newType - NPC_ENEMY_MAPEDIT_OFFSET];
|
||||
@ -814,21 +821,6 @@ bool CNpcEnemy::processSensor()
|
||||
{
|
||||
switch( m_sensorFunc )
|
||||
{
|
||||
case NPC_SENSOR_JELLYFISH_USER_CLOSE:
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 5625 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_evadeClockwise = getRnd() % 2;
|
||||
|
||||
return( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
|
||||
case NPC_SENSOR_CLAM_USER_CLOSE:
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
@ -847,47 +839,6 @@ bool CNpcEnemy::processSensor()
|
||||
}
|
||||
}
|
||||
|
||||
case NPC_SENSOR_SPIDER_CRAB_USER_CLOSE:
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
// only attack if within path extents
|
||||
|
||||
s32 minX, maxX;
|
||||
m_npcPath.getPathXExtents( &minX, &maxX );
|
||||
|
||||
if ( playerXDist < 0 )
|
||||
{
|
||||
m_extendDir = EXTEND_LEFT;
|
||||
|
||||
if ( ( Pos.vx + playerXDist - 128 ) < minX )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_extendDir = EXTEND_RIGHT;
|
||||
|
||||
if ( ( Pos.vx + playerXDist + 128 ) > maxX )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_extension = 0;
|
||||
m_velocity = 5;
|
||||
m_base = Pos;
|
||||
|
||||
return( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
|
||||
case NPC_SENSOR_OIL_BLOB_USER_CLOSE:
|
||||
case NPC_SENSOR_NINJA_STARFISH_USER_CLOSE:
|
||||
{
|
||||
@ -1024,7 +975,6 @@ bool CNpcEnemy::processSensor()
|
||||
}
|
||||
}
|
||||
|
||||
case NPC_SENSOR_ANEMONE_USER_CLOSE:
|
||||
case NPC_SENSOR_EYEBALL_USER_CLOSE:
|
||||
case NPC_SENSOR_FLAMING_SKULL_USER_CLOSE:
|
||||
case NPC_SENSOR_PARASITIC_WORM_USER_CLOSE:
|
||||
@ -1102,7 +1052,6 @@ bool CNpcEnemy::processSensor()
|
||||
|
||||
case NPC_SENSOR_FISH_HOOK_USER_CLOSE:
|
||||
case NPC_SENSOR_OCTOPUS_USER_CLOSE:
|
||||
case NPC_SENSOR_HERMIT_CRAB_USER_CLOSE:
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 400 )
|
||||
{
|
||||
@ -1277,20 +1226,6 @@ void CNpcEnemy::processMovement(int _frames)
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_MOVEMENT_SPIDER_CRAB_SPAWNER:
|
||||
{
|
||||
processSpiderCrabSpawnerMovement( _frames );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_MOVEMENT_SPIDER_CRAB_INITJUMP:
|
||||
{
|
||||
processSpiderCrabInitJumpMovement( _frames );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
@ -1318,13 +1253,6 @@ void CNpcEnemy::processMovementModifier(int _frames, s32 distX, s32 distY, s32 d
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_MOVEMENT_MODIFIER_JELLYFISH:
|
||||
{
|
||||
processSmallJellyfishMovementModifier( _frames, distX, distY, dist, headingChange );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_MOVEMENT_MODIFIER_FISH_FOLK:
|
||||
{
|
||||
processFishFolkMovementModifier( _frames, distX, distY );
|
||||
@ -1439,11 +1367,6 @@ void CNpcEnemy::processClose(int _frames)
|
||||
{
|
||||
switch( m_data[this->m_type].closeFunc )
|
||||
{
|
||||
case NPC_CLOSE_JELLYFISH_EVADE:
|
||||
processCloseSmallJellyfishEvade( _frames );
|
||||
|
||||
break;
|
||||
|
||||
case NPC_CLOSE_CLAM_JUMP_ATTACK:
|
||||
processCloseClamJumpAttack( _frames );
|
||||
|
||||
@ -1454,11 +1377,6 @@ void CNpcEnemy::processClose(int _frames)
|
||||
|
||||
break;
|
||||
|
||||
case NPC_CLOSE_SPIDER_CRAB_ATTACK:
|
||||
processCloseSpiderCrabAttack( _frames );
|
||||
|
||||
break;
|
||||
|
||||
case NPC_CLOSE_GENERIC_USER_SEEK:
|
||||
{
|
||||
processGenericGotoTarget( _frames, playerXDist, playerYDist, m_data[m_type].speed );
|
||||
@ -1546,11 +1464,6 @@ void CNpcEnemy::processClose(int _frames)
|
||||
|
||||
break;
|
||||
|
||||
case NPC_CLOSE_HERMIT_CRAB_ATTACK:
|
||||
processCloseHermitCrabAttack( _frames );
|
||||
|
||||
break;
|
||||
|
||||
case NPC_CLOSE_OCTOPUS_ATTACK:
|
||||
processCloseOctopusAttack( _frames );
|
||||
|
||||
@ -1575,26 +1488,11 @@ void CNpcEnemy::processClose(int _frames)
|
||||
|
||||
void CNpcEnemy::processCollision()
|
||||
{
|
||||
switch( m_data[m_type].collisionFunc )
|
||||
{
|
||||
case NPC_COLLISION_GENERIC:
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
|
||||
player->takeDamage( m_data[m_type].damageToUserType );
|
||||
player->takeDamage( m_data[m_type].damageToUserType );
|
||||
|
||||
m_controlFunc = m_oldControlFunc;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_COLLISION_SPIDER_CRAB_BITE:
|
||||
{
|
||||
processSpiderCrabCollision();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_controlFunc = m_oldControlFunc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1644,6 +1542,8 @@ void CNpcEnemy::processTimer(int _frames)
|
||||
|
||||
void CNpcEnemy::render()
|
||||
{
|
||||
SprFrame = NULL;
|
||||
|
||||
if ( m_isActive )
|
||||
{
|
||||
CEnemyThing::render();
|
||||
@ -1659,7 +1559,7 @@ void CNpcEnemy::render()
|
||||
{
|
||||
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
|
||||
{
|
||||
m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
|
||||
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,12 +162,13 @@ public:
|
||||
void init();
|
||||
void postInit();
|
||||
void shutdown();
|
||||
void think(int _frames);
|
||||
void render();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
void processEvent( GAME_EVENT evt, CThing *sourceThing );
|
||||
void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;}
|
||||
void setType( NPC_UNIT_TYPE newType ) {m_type = newType;}
|
||||
void setTypeFromMapEdit( u16 newType );
|
||||
static NPC_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||
void setHeading( s32 newHeading ) {m_heading = newHeading;}
|
||||
void setHeading( s32 xPos, s32 yPos );
|
||||
void addWaypoint( s32 xPos, s32 yPos );
|
||||
@ -177,7 +178,7 @@ public:
|
||||
bool canBeCaughtByNet();
|
||||
void caughtWithNet();
|
||||
|
||||
private:
|
||||
protected:
|
||||
class CLayerCollision *m_layerCollision;
|
||||
|
||||
protected:
|
||||
@ -223,14 +224,12 @@ protected:
|
||||
enum NPC_SENSOR_FUNC
|
||||
{
|
||||
NPC_SENSOR_NONE = 0,
|
||||
NPC_SENSOR_JELLYFISH_USER_CLOSE = 1,
|
||||
NPC_SENSOR_USER_CLOSE = 1,
|
||||
NPC_SENSOR_CLAM_USER_CLOSE,
|
||||
NPC_SENSOR_SPIDER_CRAB_USER_CLOSE,
|
||||
NPC_SENSOR_NINJA_STARFISH_USER_CLOSE,
|
||||
NPC_SENSOR_GHOST_PIRATE_USER_CLOSE,
|
||||
NPC_SENSOR_GENERIC_USER_VISIBLE,
|
||||
NPC_SENSOR_OIL_BLOB_USER_CLOSE,
|
||||
NPC_SENSOR_ANEMONE_USER_CLOSE,
|
||||
NPC_SENSOR_EYEBALL_USER_CLOSE,
|
||||
NPC_SENSOR_SKULL_STOMPER_USER_CLOSE,
|
||||
NPC_SENSOR_BOOGER_MONSTER_USER_CLOSE,
|
||||
@ -238,7 +237,6 @@ protected:
|
||||
NPC_SENSOR_FALLING_ITEM_USER_CLOSE,
|
||||
NPC_SENSOR_FISH_HOOK_USER_CLOSE,
|
||||
NPC_SENSOR_FLAMING_SKULL_USER_CLOSE,
|
||||
NPC_SENSOR_HERMIT_CRAB_USER_CLOSE,
|
||||
NPC_SENSOR_OCTOPUS_USER_CLOSE,
|
||||
NPC_SENSOR_PUFFA_FISH_USER_CLOSE,
|
||||
NPC_SENSOR_PARASITIC_WORM_USER_CLOSE,
|
||||
@ -247,10 +245,8 @@ protected:
|
||||
enum NPC_CLOSE_FUNC
|
||||
{
|
||||
NPC_CLOSE_NONE = 0,
|
||||
NPC_CLOSE_JELLYFISH_EVADE = 1,
|
||||
NPC_CLOSE_CLAM_JUMP_ATTACK,
|
||||
NPC_CLOSE_CLAM_JUMP_ATTACK = 1,
|
||||
NPC_CLOSE_CLAM_SNAP_ATTACK,
|
||||
NPC_CLOSE_SPIDER_CRAB_ATTACK,
|
||||
NPC_CLOSE_GHOST_PIRATE_ATTACK,
|
||||
NPC_CLOSE_SHARK_MAN_ATTACK,
|
||||
NPC_CLOSE_GENERIC_USER_SEEK,
|
||||
@ -292,7 +288,6 @@ protected:
|
||||
NPC_MOVEMENT_SHARK_MAN,
|
||||
NPC_MOVEMENT_BALL_BLOB,
|
||||
NPC_MOVEMENT_RETURNING_HAZARD_GROUND,
|
||||
NPC_MOVEMENT_SPIDER_CRAB_SPAWNER,
|
||||
NPC_MOVEMENT_SPIDER_CRAB_INITJUMP,
|
||||
};
|
||||
|
||||
@ -300,7 +295,6 @@ protected:
|
||||
{
|
||||
NPC_MOVEMENT_MODIFIER_NONE = 0,
|
||||
NPC_MOVEMENT_MODIFIER_BOB = 1,
|
||||
NPC_MOVEMENT_MODIFIER_JELLYFISH,
|
||||
NPC_MOVEMENT_MODIFIER_FISH_FOLK,
|
||||
NPC_MOVEMENT_MODIFIER_OCTOPUS,
|
||||
};
|
||||
@ -319,12 +313,6 @@ protected:
|
||||
NPC_SHOT_GENERIC = 1,
|
||||
};
|
||||
|
||||
enum NPC_COLLISION_FUNC
|
||||
{
|
||||
NPC_COLLISION_GENERIC = 0,
|
||||
NPC_COLLISION_SPIDER_CRAB_BITE = 1,
|
||||
};
|
||||
|
||||
enum NPC_MOTHER_JELLYFISH_STATE
|
||||
{
|
||||
MOTHER_JELLYFISH_RETURN_TO_START_1 = 0,
|
||||
@ -436,7 +424,6 @@ protected:
|
||||
NPC_SHOT_FUNC shotFunc;
|
||||
u16 dieAnim;
|
||||
u16 recoilAnim;
|
||||
NPC_COLLISION_FUNC collisionFunc;
|
||||
bool canBeNetted;
|
||||
bool respawning;
|
||||
}
|
||||
@ -446,12 +433,12 @@ protected:
|
||||
|
||||
// functions
|
||||
|
||||
bool processSensor();
|
||||
void processMovement( int _frames );
|
||||
void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||
virtual bool processSensor();
|
||||
virtual void processMovement( int _frames );
|
||||
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||
void processShot();
|
||||
void processClose( int _frames );
|
||||
void processCollision();
|
||||
virtual void processClose( int _frames );
|
||||
virtual void processCollision();
|
||||
void processTimer( int _frames );
|
||||
bool isCollisionWithGround();
|
||||
|
||||
@ -466,7 +453,6 @@ protected:
|
||||
// small jellyfish functions
|
||||
|
||||
void processSmallJellyfishSensor();
|
||||
void processSmallJellyfishMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||
void processCloseSmallJellyfishEvade( int _frames );
|
||||
|
||||
// baby octopus functions
|
||||
@ -487,17 +473,6 @@ protected:
|
||||
void processCloseClamJumpAttack( int _frames );
|
||||
void processCloseClamSnapAttack( int _frames );
|
||||
|
||||
// spider crab functions
|
||||
|
||||
void processCloseSpiderCrabAttack( int _frames );
|
||||
void processSpiderCrabCollision();
|
||||
void processSpiderCrabSpawnerMovement( int _frames );
|
||||
void processSpiderCrabInitJumpMovement( int _frames );
|
||||
|
||||
// hermit crab functions
|
||||
|
||||
void processCloseHermitCrabAttack( int _frames );
|
||||
|
||||
// ghost pirate functions
|
||||
|
||||
void processCloseGhostPirateAttack( int _frames );
|
||||
@ -614,6 +589,7 @@ protected:
|
||||
int m_animNo;
|
||||
CActorGfx *m_actorGfx;
|
||||
DVECTOR m_drawOffset;
|
||||
POLY_FT4 *SprFrame;
|
||||
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
|
||||
|
@ -334,7 +334,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -358,7 +357,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -382,7 +380,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -406,7 +403,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -430,7 +426,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -454,7 +449,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -463,10 +457,10 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
ACTORS_JELLYFISH1_SBK,
|
||||
ANIM_JELLYFISH1_IDLE,
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_SENSOR_JELLYFISH_USER_CLOSE,
|
||||
NPC_SENSOR_USER_CLOSE,
|
||||
NPC_MOVEMENT_FIXED_PATH,
|
||||
NPC_MOVEMENT_MODIFIER_JELLYFISH,
|
||||
NPC_CLOSE_JELLYFISH_EVADE,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_NONE,
|
||||
NPC_TIMER_NONE,
|
||||
false,
|
||||
2,
|
||||
@ -478,7 +472,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
ANIM_JELLYFISH1_SWIM,
|
||||
NPC_COLLISION_GENERIC,
|
||||
true,
|
||||
true,
|
||||
},
|
||||
@ -487,10 +480,10 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
ACTORS_CLAM_SBK,
|
||||
ANIM_CLAM_SIDESNAP,
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_SENSOR_JELLYFISH_USER_CLOSE,
|
||||
NPC_SENSOR_USER_CLOSE,
|
||||
NPC_MOVEMENT_FIXED_PATH,
|
||||
NPC_MOVEMENT_MODIFIER_JELLYFISH,
|
||||
NPC_CLOSE_JELLYFISH_EVADE,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_NONE,
|
||||
NPC_TIMER_NONE,
|
||||
false,
|
||||
3,
|
||||
@ -502,7 +495,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
true,
|
||||
},
|
||||
@ -511,7 +503,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
ACTORS_ANENOMELVL1_SBK,
|
||||
ANIM_ANENOMELVL1_BEND,
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_SENSOR_ANEMONE_USER_CLOSE,
|
||||
NPC_SENSOR_USER_CLOSE,
|
||||
NPC_MOVEMENT_STATIC_CYCLE_ANIM,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_ANEMONE_1_ATTACK,
|
||||
@ -526,7 +518,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -535,7 +526,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
ACTORS_SPIKEYANENOME_SBK,
|
||||
ANIM_SPIKEYANENOME_BODY,
|
||||
NPC_INIT_ANEMONE_2,
|
||||
NPC_SENSOR_ANEMONE_USER_CLOSE,
|
||||
NPC_SENSOR_USER_CLOSE,
|
||||
NPC_MOVEMENT_STATIC_CYCLE_ANIM,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_ANEMONE_2_ATTACK,
|
||||
@ -550,7 +541,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -559,7 +549,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
ACTORS_ANENOMELVL3_SBK,
|
||||
ANIM_ANENOMELVL3_BEND,
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_SENSOR_ANEMONE_USER_CLOSE,
|
||||
NPC_SENSOR_USER_CLOSE,
|
||||
NPC_MOVEMENT_STATIC_CYCLE_ANIM,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_ANEMONE_3_ATTACK,
|
||||
@ -574,7 +564,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -598,7 +587,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
ANIM_SKELETALFISH_DIE,
|
||||
ANIM_SKELETALFISH_GETHIT,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -622,7 +610,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -646,7 +633,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -670,7 +656,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -694,7 +679,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -718,7 +702,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
ANIM_CATERPILLAR_DIE,
|
||||
ANIM_CATERPILLAR_GETHIT,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -742,7 +725,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -766,7 +748,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -790,7 +771,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -799,7 +779,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
ACTORS_HERMITCRAB_SBK,
|
||||
ANIM_HERMITCRAB_IDLE,
|
||||
NPC_INIT_HERMIT_CRAB,
|
||||
NPC_SENSOR_HERMIT_CRAB_USER_CLOSE,
|
||||
NPC_SENSOR_USER_CLOSE,
|
||||
NPC_MOVEMENT_FIXED_PATH_WALK,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_HERMIT_CRAB_ATTACK,
|
||||
@ -814,7 +794,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
ANIM_HERMITCRAB_DIE,
|
||||
ANIM_HERMITCRAB_GETHIT,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -838,7 +817,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -862,7 +840,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -871,10 +848,10 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
ACTORS_SPIDERCRAB_SBK,
|
||||
ANIM_SPIDERCRAB_IDLE,
|
||||
NPC_INIT_SPIDER_CRAB,
|
||||
NPC_SENSOR_SPIDER_CRAB_USER_CLOSE,
|
||||
NPC_SENSOR_USER_CLOSE,
|
||||
NPC_MOVEMENT_FIXED_PATH_WALK,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_SPIDER_CRAB_ATTACK,
|
||||
NPC_CLOSE_NONE,
|
||||
NPC_TIMER_NONE,
|
||||
false,
|
||||
3,
|
||||
@ -886,7 +863,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
ANIM_SPIDERCRAB_DIE,
|
||||
ANIM_SPIDERCRAB_HIT,
|
||||
NPC_COLLISION_SPIDER_CRAB_BITE,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -896,7 +872,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
ANIM_SPIDERCRAB_IDLE,
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_SENSOR_NONE,
|
||||
NPC_MOVEMENT_SPIDER_CRAB_SPAWNER,
|
||||
NPC_MOVEMENT_STATIC,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_NONE,
|
||||
NPC_TIMER_NONE,
|
||||
@ -910,7 +886,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_NONE,
|
||||
ANIM_SPIDERCRAB_DIE,
|
||||
ANIM_SPIDERCRAB_HIT,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -934,7 +909,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -958,7 +932,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
ANIM_BABYOCTOPUS_DIE,
|
||||
ANIM_BABYOCTOPUS_HIT,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -982,7 +955,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1006,7 +978,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1030,7 +1001,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1054,7 +1024,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1078,7 +1047,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1102,7 +1070,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
ANIM_SHARKMAN_DIE,
|
||||
ANIM_SHARKMAN_BLOCK,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1126,7 +1093,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1150,7 +1116,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1174,7 +1139,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1198,7 +1162,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1222,7 +1185,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1246,7 +1208,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
ANIM_FLYINGDUTCHMAN_GETHIT,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1270,7 +1231,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
ANIM_IRONDOGFISH_GETHIT,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1294,7 +1254,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
@ -1318,7 +1277,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
NPC_SHOT_GENERIC,
|
||||
0,
|
||||
0,
|
||||
NPC_COLLISION_GENERIC,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
|
@ -15,6 +15,10 @@
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NSCRAB_H__
|
||||
#include "enemy\nscrab.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
@ -28,7 +32,61 @@
|
||||
#endif
|
||||
|
||||
|
||||
void CNpcEnemy::processCloseSpiderCrabAttack( int _frames )
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool CNpcSpiderCrabEnemy::processSensor()
|
||||
{
|
||||
switch( m_sensorFunc )
|
||||
{
|
||||
case NPC_SENSOR_NONE:
|
||||
return( false );
|
||||
|
||||
default:
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
// only attack if within path extents
|
||||
|
||||
s32 minX, maxX;
|
||||
m_npcPath.getPathXExtents( &minX, &maxX );
|
||||
|
||||
if ( playerXDist < 0 )
|
||||
{
|
||||
m_extendDir = EXTEND_LEFT;
|
||||
|
||||
if ( ( Pos.vx + playerXDist - 128 ) < minX )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_extendDir = EXTEND_RIGHT;
|
||||
|
||||
if ( ( Pos.vx + playerXDist + 128 ) > maxX )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_extension = 0;
|
||||
m_velocity = 5;
|
||||
m_base = Pos;
|
||||
|
||||
return( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcSpiderCrabEnemy::processClose( int _frames )
|
||||
{
|
||||
s32 velocity;
|
||||
DVECTOR newPos = Pos;
|
||||
@ -112,7 +170,9 @@ void CNpcEnemy::processCloseSpiderCrabAttack( int _frames )
|
||||
}
|
||||
}
|
||||
|
||||
void CNpcEnemy::processSpiderCrabCollision()
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcSpiderCrabEnemy::processCollision()
|
||||
{
|
||||
if ( m_oldControlFunc == NPC_CONTROL_CLOSE )
|
||||
{
|
||||
@ -148,7 +208,9 @@ void CNpcEnemy::processSpiderCrabCollision()
|
||||
}
|
||||
}
|
||||
|
||||
void CNpcEnemy::processSpiderCrabInitJumpMovement( int _frames )
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcSpiderCrabEnemy::processSpiderCrabInitJumpMovement( int _frames )
|
||||
{
|
||||
s32 velocity;
|
||||
bool completed = false;
|
||||
@ -189,44 +251,34 @@ void CNpcEnemy::processSpiderCrabInitJumpMovement( int _frames )
|
||||
}
|
||||
}
|
||||
|
||||
void CNpcEnemy::processSpiderCrabSpawnerMovement( int _frames )
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcSpiderCrabEnemy::processMovement(int _frames)
|
||||
{
|
||||
if ( getNumChildren() < 3 )
|
||||
if ( _frames > 2 )
|
||||
{
|
||||
m_movementTimer -= _frames;
|
||||
_frames = 2;
|
||||
}
|
||||
|
||||
if ( m_movementTimer < 0 )
|
||||
s32 moveX = 0, moveY = 0;
|
||||
s32 moveVel = 0;
|
||||
s32 moveDist = 0;
|
||||
|
||||
if ( m_movementFunc == NPC_MOVEMENT_SPIDER_CRAB_INITJUMP )
|
||||
{
|
||||
processSpiderCrabInitJumpMovement( _frames );
|
||||
}
|
||||
else
|
||||
{
|
||||
processGenericFixedPathWalk( _frames, &moveX, &moveY );
|
||||
|
||||
if ( !m_animPlaying )
|
||||
{
|
||||
m_movementTimer = 3 * GameState::getOneSecondInFrames();
|
||||
|
||||
CNpcEnemy *enemy;
|
||||
enemy = new( "spider crab" ) CNpcEnemy;
|
||||
ASSERT(enemy);
|
||||
enemy->setType( CNpcEnemy::NPC_SPIDER_CRAB );
|
||||
enemy->init();
|
||||
enemy->setLayerCollision( m_layerCollision );
|
||||
enemy->setStartPos( Pos.vx >> 4, Pos.vy >> 4 );
|
||||
|
||||
CNpcWaypoint *sourceWaypoint = m_npcPath.getWaypointList();
|
||||
|
||||
if ( sourceWaypoint )
|
||||
{
|
||||
// skip first waypoint
|
||||
|
||||
sourceWaypoint = sourceWaypoint->nextWaypoint;
|
||||
|
||||
while( sourceWaypoint )
|
||||
{
|
||||
enemy->addWaypoint( sourceWaypoint->pos.vx >> 4, sourceWaypoint->pos.vy >> 4 );
|
||||
sourceWaypoint = sourceWaypoint->nextWaypoint;
|
||||
}
|
||||
}
|
||||
|
||||
enemy->setPathType( m_npcPath.getPathType() );
|
||||
|
||||
enemy->postInit();
|
||||
|
||||
addChild( enemy );
|
||||
m_animPlaying = true;
|
||||
m_animNo = m_data[m_type].moveAnim;
|
||||
m_frame = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processMovementModifier( _frames, moveX, moveY, moveVel, moveDist );
|
||||
}
|
||||
|
@ -15,6 +15,14 @@
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NSJFISH_H__
|
||||
#include "enemy\nsjfish.h"
|
||||
#endif
|
||||
|
||||
#ifndef __UTILS_HEADER__
|
||||
#include "utils\utils.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
@ -23,94 +31,17 @@
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
|
||||
void CNpcEnemy::processSmallJellyfishMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
|
||||
void CNpcSmallJellyfishEnemy::render()
|
||||
{
|
||||
s32 newX, newY;
|
||||
s32 preShiftX, preShiftY;
|
||||
s16 headingVal;
|
||||
CNpcEnemy::render();
|
||||
|
||||
//u16 jellyfishData[5] = { 96, 192, 256, 192, 128, };
|
||||
u16 jellyfishData[6] = { 256, 192, 96, 48, 96, 128, };
|
||||
|
||||
u32 dataPoint;
|
||||
|
||||
m_movementTimer += _frames;
|
||||
|
||||
if ( m_movementTimer > GameState::getOneSecondInFrames() )
|
||||
if ( SprFrame )
|
||||
{
|
||||
m_movementTimer = 0;
|
||||
setRGB0( SprFrame, 255, 128, 255 );
|
||||
}
|
||||
|
||||
dataPoint = 5 * m_movementTimer;
|
||||
|
||||
if ( dataPoint != 0 )
|
||||
{
|
||||
dataPoint /= GameState::getOneSecondInFrames();
|
||||
}
|
||||
|
||||
m_frame = ( ( m_movementTimer * ( m_actorGfx->getFrameCount(m_animNo) - 1 ) << 8 ) ) / GameState::getOneSecondInFrames();
|
||||
|
||||
s32 resistance;
|
||||
s32 absVelocity = abs( m_velocity );
|
||||
s32 reqVelocity = dist;
|
||||
|
||||
resistance = _frames * NPC_JELLYFISH_RESISTANCE;
|
||||
|
||||
if ( absVelocity < resistance )
|
||||
{
|
||||
resistance = absVelocity;
|
||||
}
|
||||
|
||||
if ( absVelocity != 0 )
|
||||
{
|
||||
resistance = -( resistance * m_velocity ) / absVelocity;
|
||||
}
|
||||
else
|
||||
{
|
||||
resistance = 0;
|
||||
}
|
||||
|
||||
m_velocity += resistance;
|
||||
|
||||
headingVal = abs( headingChange );
|
||||
if ( headingVal > 128 )
|
||||
{
|
||||
headingVal = 128;
|
||||
}
|
||||
|
||||
reqVelocity = dist * jellyfishData[dataPoint];
|
||||
reqVelocity >>= 8;
|
||||
reqVelocity *= 128 + ( 128 - headingVal );
|
||||
reqVelocity >>= 8;
|
||||
|
||||
s32 absReqVelocity = abs( reqVelocity );
|
||||
|
||||
if ( absReqVelocity > absVelocity )
|
||||
{
|
||||
m_velocity += reqVelocity >> 1;
|
||||
}
|
||||
|
||||
preShiftX = ( m_velocity >> 8 ) * rcos( m_heading );
|
||||
preShiftY = ( m_velocity >> 8 ) * rsin( m_heading );
|
||||
|
||||
newX = preShiftX >> 12;
|
||||
if ( !newX && preShiftX )
|
||||
{
|
||||
newX = preShiftX / abs( preShiftX );
|
||||
}
|
||||
|
||||
newY = preShiftY >> 12;
|
||||
if ( !newY && preShiftY )
|
||||
{
|
||||
newY = preShiftY / abs( preShiftY );
|
||||
}
|
||||
|
||||
Pos.vx += newX;
|
||||
Pos.vy += newY;
|
||||
}
|
||||
|
||||
void CNpcEnemy::processCloseSmallJellyfishEvade( int _frames )
|
||||
void CNpcSmallJellyfishEnemy::processClose( int _frames )
|
||||
{
|
||||
s32 moveX = 0, moveY = 0;
|
||||
|
||||
@ -241,3 +172,113 @@ void CNpcEnemy::processCloseSmallJellyfishEvade( int _frames )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CNpcSmallJellyfishEnemy::processSensor()
|
||||
{
|
||||
switch( m_sensorFunc )
|
||||
{
|
||||
case NPC_SENSOR_NONE:
|
||||
return( false );
|
||||
|
||||
default:
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 5625 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_evadeClockwise = getRnd() % 2;
|
||||
|
||||
return( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CNpcSmallJellyfishEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
|
||||
{
|
||||
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, };
|
||||
|
||||
u32 dataPoint;
|
||||
|
||||
m_movementTimer += _frames;
|
||||
|
||||
if ( m_movementTimer > GameState::getOneSecondInFrames() )
|
||||
{
|
||||
m_movementTimer = 0;
|
||||
}
|
||||
|
||||
dataPoint = 5 * m_movementTimer;
|
||||
|
||||
if ( dataPoint != 0 )
|
||||
{
|
||||
dataPoint /= GameState::getOneSecondInFrames();
|
||||
}
|
||||
|
||||
m_frame = ( ( m_movementTimer * ( m_actorGfx->getFrameCount(m_animNo) - 1 ) << 8 ) ) / GameState::getOneSecondInFrames();
|
||||
|
||||
s32 resistance;
|
||||
s32 absVelocity = abs( m_velocity );
|
||||
s32 reqVelocity = dist;
|
||||
|
||||
resistance = _frames * NPC_JELLYFISH_RESISTANCE;
|
||||
|
||||
if ( absVelocity < resistance )
|
||||
{
|
||||
resistance = absVelocity;
|
||||
}
|
||||
|
||||
if ( absVelocity != 0 )
|
||||
{
|
||||
resistance = -( resistance * m_velocity ) / absVelocity;
|
||||
}
|
||||
else
|
||||
{
|
||||
resistance = 0;
|
||||
}
|
||||
|
||||
m_velocity += resistance;
|
||||
|
||||
headingVal = abs( headingChange );
|
||||
if ( headingVal > 128 )
|
||||
{
|
||||
headingVal = 128;
|
||||
}
|
||||
|
||||
reqVelocity = dist * jellyfishData[dataPoint];
|
||||
reqVelocity >>= 8;
|
||||
reqVelocity *= 128 + ( 128 - headingVal );
|
||||
reqVelocity >>= 8;
|
||||
|
||||
s32 absReqVelocity = abs( reqVelocity );
|
||||
|
||||
if ( absReqVelocity > absVelocity )
|
||||
{
|
||||
m_velocity += reqVelocity >> 1;
|
||||
}
|
||||
|
||||
preShiftX = ( m_velocity >> 8 ) * rcos( m_heading );
|
||||
preShiftY = ( m_velocity >> 8 ) * rsin( m_heading );
|
||||
|
||||
newX = preShiftX >> 12;
|
||||
if ( !newX && preShiftX )
|
||||
{
|
||||
newX = preShiftX / abs( preShiftX );
|
||||
}
|
||||
|
||||
newY = preShiftY >> 12;
|
||||
if ( !newY && preShiftY )
|
||||
{
|
||||
newY = preShiftY / abs( preShiftY );
|
||||
}
|
||||
|
||||
Pos.vx += newX;
|
||||
Pos.vy += newY;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*=========================================================================
|
||||
|
||||
nsjfish.cpp
|
||||
nsjfish.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
@ -12,6 +12,7 @@
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __ENEMY_NSJFISH_H__
|
||||
#define __ENEMY_NSJFISH_H__
|
||||
|
||||
#ifndef __ENEMY_NPC_H__
|
||||
#include "enemy\npc.h"
|
||||
@ -20,6 +21,7 @@
|
||||
class CNpcSmallJellyfishEnemy : public CNpcEnemy
|
||||
{
|
||||
public:
|
||||
void render();
|
||||
protected:
|
||||
virtual bool processSensor();
|
||||
virtual void processClose( int _frames );
|
||||
|
@ -27,10 +27,26 @@
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NSJFISH_H__
|
||||
#include "enemy\nsjfish.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NHCRAB_H__
|
||||
#include "enemy\nhcrab.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NSCRAB_H__
|
||||
#include "enemy\nscrab.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NGEN_H__
|
||||
#include "enemy\ngen.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NANEMONE_H__
|
||||
#include "enemy\nanemone.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ENEMY_NPLATFRM_H__
|
||||
#include "enemy\nplatfrm.h"
|
||||
#endif
|
||||
@ -309,51 +325,60 @@ void CGameScene::initLevel()
|
||||
case CActorPool::ACTOR_ENEMY_NPC:
|
||||
{
|
||||
CNpcEnemy *enemy;
|
||||
enemy = new ("npc enemy") CNpcEnemy;
|
||||
ASSERT(enemy);
|
||||
enemy->setTypeFromMapEdit( actorList[actorNum]->Type );
|
||||
enemy->init();
|
||||
enemy->setLayerCollision( Level.getCollisionLayer() );
|
||||
|
||||
u16 *PntList=(u16*)MakePtr(actorList[actorNum],sizeof(sThingActor));
|
||||
CNpcEnemy::NPC_UNIT_TYPE enemyType = CNpcEnemy::getTypeFromMapEdit( actorList[actorNum]->Type );
|
||||
|
||||
u16 newXPos, newYPos;
|
||||
|
||||
newXPos = (u16) *PntList;
|
||||
PntList++;
|
||||
newYPos = (u16) *PntList;
|
||||
PntList++;
|
||||
|
||||
enemy->setStartPos( newXPos, newYPos );
|
||||
enemy->addWaypoint( newXPos, newYPos );
|
||||
|
||||
if ( actorList[actorNum]->PointCount > 1 )
|
||||
switch( enemyType )
|
||||
{
|
||||
for ( pointNum = 1 ; pointNum < actorList[actorNum]->PointCount ; pointNum++ )
|
||||
case CNpcEnemy::NPC_SMALL_JELLYFISH_1:
|
||||
{
|
||||
newXPos = (u16) *PntList;
|
||||
PntList++;
|
||||
newYPos = (u16) *PntList;
|
||||
PntList++;
|
||||
enemy = new ("small jellyfish") CNpcSmallJellyfishEnemy;
|
||||
break;
|
||||
}
|
||||
|
||||
enemy->addWaypoint( newXPos, newYPos );
|
||||
case CNpcEnemy::NPC_HERMIT_CRAB:
|
||||
{
|
||||
enemy = new ("hermit crab") CNpcHermitCrabEnemy;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( pointNum == 1 )
|
||||
{
|
||||
enemy->setHeading( newXPos, newYPos );
|
||||
}
|
||||
case CNpcEnemy::NPC_SPIDER_CRAB:
|
||||
{
|
||||
enemy = new ("spider crab") CNpcSpiderCrabEnemy;
|
||||
break;
|
||||
}
|
||||
|
||||
case CNpcEnemy::NPC_SPIDER_CRAB_SPAWNER:
|
||||
{
|
||||
enemy = new ("spider crab spawner") CNpcEnemyGenerator;
|
||||
break;
|
||||
}
|
||||
|
||||
case CNpcEnemy::NPC_ANEMONE_1:
|
||||
{
|
||||
enemy = new ("anemone 1") CNpcAnemone1Enemy;
|
||||
break;
|
||||
}
|
||||
|
||||
case CNpcEnemy::NPC_ANEMONE_2:
|
||||
{
|
||||
enemy = new ("anemone 2") CNpcAnemone2Enemy;
|
||||
break;
|
||||
}
|
||||
|
||||
case CNpcEnemy::NPC_ANEMONE_3:
|
||||
{
|
||||
enemy = new ("anemone 3") CNpcAnemone3Enemy;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
enemy = new ("npc enemy") CNpcEnemy;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
enemy->postInit();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case CActorPool::ACTOR_ENEMY_GENERATOR_NPC:
|
||||
{
|
||||
CNpcEnemyGenerator *enemy;
|
||||
enemy = new ("npc enemy generator") CNpcEnemyGenerator;
|
||||
ASSERT(enemy);
|
||||
enemy->setTypeFromMapEdit( actorList[actorNum]->Type );
|
||||
enemy->init();
|
||||
|
@ -58,7 +58,7 @@ CActorPool::ACTOR_TYPE CActorPool::actorType[39] =
|
||||
ACTOR_ENEMY_NPC, //Squiddart=35
|
||||
ACTOR_ENEMY_NPC, //Stomper=36
|
||||
ACTOR_ENEMY_NPC, //DustDevil=37
|
||||
ACTOR_ENEMY_GENERATOR_NPC, //SiderCrabSpawner=38
|
||||
ACTOR_ENEMY_NPC, //SiderCrabSpawner=38
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -69,7 +69,6 @@ public:
|
||||
ACTOR_PLAYER = 0,
|
||||
ACTOR_FRIEND_NPC = 1,
|
||||
ACTOR_ENEMY_NPC,
|
||||
ACTOR_ENEMY_GENERATOR_NPC,
|
||||
ACTOR_UNKNOWN,
|
||||
};
|
||||
|
||||
|
@ -113,6 +113,10 @@ SOURCE=..\..\..\source\enemy\nanemone.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nanemone.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nbblob.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -173,6 +177,10 @@ SOURCE=..\..\..\source\enemy\nhcrab.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nhcrab.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nmjfish.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -217,6 +225,10 @@ SOURCE=..\..\..\source\enemy\nscrab.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nscrab.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nshrkman.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -225,6 +237,10 @@ SOURCE=..\..\..\source\enemy\nsjfish.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nsjfish.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nsklfish.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
Loading…
Reference in New Issue
Block a user