diff --git a/source/enemy/nanemone.cpp b/source/enemy/nanemone.cpp index d6cd5b74c..3a2e1c0fc 100644 --- a/source/enemy/nanemone.cpp +++ b/source/enemy/nanemone.cpp @@ -194,6 +194,30 @@ void CNpcAnemone1Enemy::processClose( int _frames ) } } +void CNpcAnemone2Enemy::postInit() +{ + CProjectile *projectile; + s16 heading; + + for ( int fireLoop = 0 ; fireLoop < 5 ; fireLoop++ ) + { + DVECTOR spikePos; + + heading = m_heading - 1024 + ( fireLoop * 512 ); + heading &= 4095; + + spikePos = Pos; + spikePos.vx += ( 40 * rcos( heading ) ) >> 12; + spikePos.vy += ( 40 * rsin( heading ) ) >> 12; + + projectile = new( "anemone lev2 projectile" ) CProjectile; + projectile->init( spikePos, heading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE ); + projectile->setLayerCollision( m_layerCollision ); + + addChild( projectile ); + } +} + void CNpcAnemone2Enemy::processClose( int _frames ) { int fireLoop; diff --git a/source/enemy/nanemone.h b/source/enemy/nanemone.h index a2dd7e566..ab5e5dcb0 100644 --- a/source/enemy/nanemone.h +++ b/source/enemy/nanemone.h @@ -32,6 +32,8 @@ protected: class CNpcAnemone2Enemy : public CNpcAnemoneEnemy { +public: + virtual void postInit(); protected: virtual void processClose( int _frames ); }; diff --git a/source/enemy/nbblob.cpp b/source/enemy/nbblob.cpp index 1ba3902da..cf24c66ef 100644 --- a/source/enemy/nbblob.cpp +++ b/source/enemy/nbblob.cpp @@ -27,6 +27,13 @@ #include #endif +void CNpcBallBlobEnemy::postInit() +{ + m_heading = m_fireHeading = 128; + + m_npcPath.setPathType( CNpcPath::PONG_PATH ); +} + void CNpcBallBlobEnemy::processMovement( int _frames ) { s32 moveX = 0, moveY = 0; diff --git a/source/enemy/nbblob.h b/source/enemy/nbblob.h index 95aac2f6b..286c706a1 100644 --- a/source/enemy/nbblob.h +++ b/source/enemy/nbblob.h @@ -16,6 +16,8 @@ class CNpcBallBlobEnemy : public CNpcEnemy { +public: + virtual void postInit(); protected: virtual void processMovement( int _frames ); }; diff --git a/source/enemy/nbooger.cpp b/source/enemy/nbooger.cpp index 929e837a9..b95e3b368 100644 --- a/source/enemy/nbooger.cpp +++ b/source/enemy/nbooger.cpp @@ -15,6 +15,10 @@ #include "enemy\npc.h" #endif +#ifndef __ENEMY_NBOOGER_H__ +#include "enemy\nbooger.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -24,7 +28,31 @@ #endif -void CNpcEnemy::processCloseBoogerMonsterAttack( int _frames ) +bool CNpcBoogerMonsterEnemy::processSensor() +{ + switch( m_sensorFunc ) + { + case NPC_SENSOR_NONE: + return( false ); + + default: + { + if ( playerXDistSqr + playerYDistSqr < 400 ) + { + m_controlFunc = NPC_CONTROL_CLOSE; + m_extendDir = EXTEND_UP; + + return( true ); + } + else + { + return( false ); + } + } + } +} + +void CNpcBoogerMonsterEnemy::processClose( int _frames ) { s32 velocity; diff --git a/source/enemy/ndogfish.cpp b/source/enemy/ndogfish.cpp index d0c6e4ecd..3ff810efe 100644 --- a/source/enemy/ndogfish.cpp +++ b/source/enemy/ndogfish.cpp @@ -15,6 +15,10 @@ #include "enemy\npc.h" #endif +#ifndef __ENEMY_NDOGFISH_H__ +#include "enemy\ndogfish.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -31,7 +35,36 @@ #include #endif -void CNpcEnemy::processIronDogfishMovement( int _frames ) +void CNpcIronDogfishEnemy::postInit() +{ + m_state = IRON_DOGFISH_THUMP_1; + m_extendDir = EXTEND_RIGHT; +} + +bool CNpcIronDogfishEnemy::processSensor() +{ + switch( m_sensorFunc ) + { + case NPC_SENSOR_NONE: + return( false ); + + default: + { + if ( playerXDistSqr + playerYDistSqr < 10000 ) + { + m_controlFunc = NPC_CONTROL_CLOSE; + + return( true ); + } + else + { + return( false ); + } + } + } +} + +void CNpcIronDogfishEnemy::processMovement( int _frames ) { if ( m_movementTimer > 0 ) { @@ -79,7 +112,7 @@ void CNpcEnemy::processIronDogfishMovement( int _frames ) } } -void CNpcEnemy::processStandardIronDogfishAttack( int _frames ) +void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames ) { if ( playerXDist > 0 ) { @@ -176,7 +209,7 @@ void CNpcEnemy::processStandardIronDogfishAttack( int _frames ) } } -void CNpcEnemy::processCloseIronDogfishAttack( int _frames ) +void CNpcIronDogfishEnemy::processClose( int _frames ) { // swipe at player diff --git a/source/enemy/nfdutch.cpp b/source/enemy/nfdutch.cpp index 9eff5015f..3be83882b 100644 --- a/source/enemy/nfdutch.cpp +++ b/source/enemy/nfdutch.cpp @@ -15,6 +15,10 @@ #include "enemy\npc.h" #endif +#ifndef __ENEMY_NFDUTCH_H__ +#include "enemy\nfdutch.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -31,7 +35,18 @@ #include #endif -void CNpcEnemy::processFlyingDutchmanMovement( int _frames ) +void CNpcFlyingDutchmanEnemy::postInit() +{ + m_state = FLYING_DUTCHMAN_ATTACK_PLAYER_1; + m_extendDir = EXTEND_UP; + + s32 minX, maxX; + m_npcPath.getPathXExtents( &minX, &maxX ); + + m_extension = minX; +} + +void CNpcFlyingDutchmanEnemy::processMovement( int _frames ) { if ( !m_animPlaying ) { @@ -98,7 +113,7 @@ void CNpcEnemy::processFlyingDutchmanMovement( int _frames ) } } -void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames ) +void CNpcFlyingDutchmanEnemy::processClose( int _frames ) { if ( playerYDist > 0 ) { diff --git a/source/enemy/nffolk.cpp b/source/enemy/nffolk.cpp index 0180f6755..1e1842cd1 100644 --- a/source/enemy/nffolk.cpp +++ b/source/enemy/nffolk.cpp @@ -28,6 +28,25 @@ #endif +void CNpcFishFolk::postInit() +{ + m_heading = m_fireHeading = 0; + + DVECTOR newPos; + + newPos.vx = 200; + newPos.vy = 400; + + m_npcPath.addWaypoint( newPos ); + + newPos.vx = 500; + newPos.vy = 400; + + m_npcPath.addWaypoint( newPos ); + + m_npcPath.setPathType( CNpcPath::PONG_PATH ); +} + void CNpcFishFolk::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ) { Pos.vy += distY; diff --git a/source/enemy/nffolk.h b/source/enemy/nffolk.h index 0b93abfda..e15f8d2a4 100644 --- a/source/enemy/nffolk.h +++ b/source/enemy/nffolk.h @@ -16,6 +16,8 @@ class CNpcFishFolk : public CNpcEnemy { +public: + virtual void postInit(); protected: virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); }; diff --git a/source/enemy/ngeneric.cpp b/source/enemy/ngeneric.cpp index 81e7d9a36..a1dc71600 100644 --- a/source/enemy/ngeneric.cpp +++ b/source/enemy/ngeneric.cpp @@ -73,12 +73,42 @@ void CNpcEnemy::processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 moveX = preShiftX / abs( preShiftX ); } + if ( xDist > 0 ) + { + if ( moveX > xDist ) + { + moveX = xDist; + } + } + else + { + if ( moveX < xDist ) + { + moveX = xDist; + } + } + moveY = preShiftY >> 12; if ( !moveY && preShiftY ) { moveY = preShiftY / abs( preShiftY ); } + if ( yDist > 0 ) + { + if ( moveY > yDist ) + { + moveY = yDist; + } + } + else + { + if ( moveY < yDist ) + { + moveY = yDist; + } + } + Pos.vx += moveX; Pos.vy += moveY; } diff --git a/source/enemy/ngpirate.cpp b/source/enemy/ngpirate.cpp index b399bf47f..8c34d4a3e 100644 --- a/source/enemy/ngpirate.cpp +++ b/source/enemy/ngpirate.cpp @@ -32,6 +32,11 @@ #endif +void CNpcGhostPirateEnemy::postInit() +{ + m_heading = m_fireHeading = 3072; +} + bool CNpcGhostPirateEnemy::processSensor() { switch( m_sensorFunc ) diff --git a/source/enemy/ngpirate.h b/source/enemy/ngpirate.h index 2da54b1b8..27d9cc095 100644 --- a/source/enemy/ngpirate.h +++ b/source/enemy/ngpirate.h @@ -16,6 +16,8 @@ class CNpcGhostPirateEnemy : public CNpcEnemy { +public: + virtual void postInit(); protected: virtual bool processSensor(); virtual void processClose( int _frames ); diff --git a/source/enemy/nhcrab.cpp b/source/enemy/nhcrab.cpp index 199c7f6e4..a05db3bc1 100644 --- a/source/enemy/nhcrab.cpp +++ b/source/enemy/nhcrab.cpp @@ -31,6 +31,13 @@ #include #endif +void CNpcHermitCrabEnemy::postInit() +{ + m_npcPath.setPathType( CNpcPath::PONG_PATH ); + + m_state = HERMIT_CRAB_NO_ATTACK; +} + bool CNpcHermitCrabEnemy::processSensor() { switch( m_sensorFunc ) diff --git a/source/enemy/nhcrab.h b/source/enemy/nhcrab.h index e56e07db5..c7beb0677 100644 --- a/source/enemy/nhcrab.h +++ b/source/enemy/nhcrab.h @@ -21,9 +21,17 @@ class CNpcHermitCrabEnemy : public CNpcEnemy { public: + virtual void postInit(); protected: virtual bool processSensor(); virtual void processClose( int _frames ); + + enum NPC_HERMIT_CRAB_STATE + { + HERMIT_CRAB_NO_ATTACK = 0, + HERMIT_CRAB_PUNCH_ATTACK = 1, + HERMIT_CRAB_ROLL_ATTACK, + }; }; #endif diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index 6327c7e43..793fe31e3 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -1,6 +1,6 @@ /*========================================================================= - nnjfish.cpp + nmjfish.cpp Author: CRB Created: @@ -15,6 +15,10 @@ #include "enemy\npc.h" #endif +#ifndef __ENEMY_NMJFISH_H__ +#include "enemy\nmjfish.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -27,7 +31,12 @@ #define MJ_HALF_CYCLE_WIDTH ( MJ_CYCLE_WIDTH >> 1 ) -void CNpcEnemy::processMotherJellyfishMovement( int _frames ) +void CNpcMotherJellyfishEnemy::postInit() +{ + m_state = MOTHER_JELLYFISH_RETURN_TO_START_1; +} + +void CNpcMotherJellyfishEnemy::processMovement( int _frames ) { s32 xDist, yDist; s32 xDistSqr, yDistSqr; @@ -125,7 +134,7 @@ void CNpcEnemy::processMotherJellyfishMovement( int _frames ) } } -void CNpcEnemy::processCloseMotherJellyfishAttack( int _frames ) +void CNpcMotherJellyfishEnemy::processClose( int _frames ) { switch( m_state ) { diff --git a/source/enemy/nocto.cpp b/source/enemy/nocto.cpp index c882acb61..ae384b63a 100644 --- a/source/enemy/nocto.cpp +++ b/source/enemy/nocto.cpp @@ -87,7 +87,7 @@ void CNpcBabyOctopusEnemy::processMovementModifier( int _frames, s32 distX, s32 s32 absVelocity = abs( m_velocity ); s32 reqVelocity = dist; - resistance = _frames * NPC_JELLYFISH_RESISTANCE; + resistance = _frames * NPC_OCTOPUS_RESISTANCE; if ( absVelocity < resistance ) { diff --git a/source/enemy/nocto.h b/source/enemy/nocto.h index 6203e5a2e..09dd2d955 100644 --- a/source/enemy/nocto.h +++ b/source/enemy/nocto.h @@ -20,6 +20,11 @@ protected: virtual bool processSensor(); virtual void processClose( int _frames ); virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); + + enum + { + NPC_OCTOPUS_RESISTANCE = 64, + }; }; #endif \ No newline at end of file diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index eb07bdd1b..3daded7dd 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -114,6 +114,38 @@ #include "enemy\nfskull.h" #endif +#ifndef __ENEMY_NSSTOMP_H__ +#include "enemy\nsstomp.h" +#endif + +#ifndef __ENEMY_NBOOGER_H__ +#include "enemy\nbooger.h" +#endif + +#ifndef __ENEMY_NMJFISH_H__ +#include "enemy\nmjfish.h" +#endif + +#ifndef __ENEMY_NSSHARK_H__ +#include "enemy\nsshark.h" +#endif + +#ifndef __ENEMY_NWORM_H__ +#include "enemy\nworm.h" +#endif + +#ifndef __ENEMY_NFDUTCH_H__ +#include "enemy\nfdutch.h" +#endif + +#ifndef __ENEMY_NDOGFISH_H__ +#include "enemy\ndogfish.h" +#endif + +#ifndef __ENEMY_NHAZARD_H__ +#include "enemy\nhazard.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Friend NPCs @@ -375,6 +407,84 @@ CNpcEnemy *CNpcEnemy::Create(sThingActor *ThisActor) break; } + case CNpcEnemy::NPC_SKULL_STOMPER: + { + enemy = new ("skull stomper") CNpcSkullStomperEnemy; + break; + } + + case CNpcEnemy::NPC_BOOGER_MONSTER: + { + enemy = new ("booger monster") CNpcBoogerMonsterEnemy; + break; + } + + case CNpcEnemy::NPC_MOTHER_JELLYFISH: + { + enemy = new ("mother jellyfish") CNpcMotherJellyfishEnemy; + break; + } + + case CNpcEnemy::NPC_SUB_SHARK: + { + enemy = new ("sub shark") CNpcSubSharkEnemy; + break; + } + + case CNpcEnemy::NPC_PARASITIC_WORM: + { + enemy = new ("parasitic worm") CNpcParasiticWormEnemy; + break; + } + + case CNpcEnemy::NPC_FLYING_DUTCHMAN: + { + enemy = new ("flying dutchman") CNpcFlyingDutchmanEnemy; + break; + } + + case CNpcEnemy::NPC_IRON_DOGFISH: + { + enemy = new ("iron dogfish") CNpcIronDogfishEnemy; + break; + } + + case CNpcEnemy::NPC_FALLING_ITEM: + { + enemy = new ("falling item") CNpcFallingItemHazard; + break; + } + + case CNpcEnemy::NPC_FISH_HOOK: + { + enemy = new ("fish hook") CNpcFishHookHazard; + break; + } + + case CNpcEnemy::NPC_PENDULUM: + { + enemy = new ("pendulum") CNpcPendulumHazard; + break; + } + + case CNpcEnemy::NPC_FIREBALL: + { + enemy = new ("fireball") CNpcFireballHazard; + break; + } + + case CNpcEnemy::NPC_SAW_BLADE: + { + enemy = new ("saw blade") CNpcReturningHazard; + break; + } + + case CNpcEnemy::NPC_DUST_DEVIL: + { + enemy = new ("dust devil") CNpcReturningGroundHazard; + break; + } + default: { enemy = new ("npc enemy") CNpcEnemy; @@ -513,288 +623,7 @@ void CNpcEnemy::init() void CNpcEnemy::postInit() { - switch ( m_data[this->m_type].initFunc ) - { - case NPC_INIT_DEFAULT: - { - m_npcPath.setPathType( CNpcPath::PONG_PATH ); - - break; - } - - case NPC_INIT_BALL_BLOB: - { - m_heading = m_fireHeading = 128; - - m_npcPath.setPathType( CNpcPath::PONG_PATH ); - - break; - } - - case NPC_INIT_HERMIT_CRAB: - { - m_npcPath.setPathType( CNpcPath::PONG_PATH ); - - m_state = HERMIT_CRAB_NO_ATTACK; - - break; - } - - case NPC_INIT_GHOST_PIRATE: - m_heading = m_fireHeading = 3072; - - break; - - case NPC_INIT_SKULL_STOMPER: - { - m_extendDir = EXTEND_DOWN; - - break; - } - - case NPC_INIT_MOTHER_JELLYFISH: - { - m_state = MOTHER_JELLYFISH_RETURN_TO_START_1; - - break; - } - - case NPC_INIT_FLYING_DUTCHMAN: - { - m_state = FLYING_DUTCHMAN_ATTACK_PLAYER_1; - m_extendDir = EXTEND_UP; - - s32 minX, maxX; - m_npcPath.getPathXExtents( &minX, &maxX ); - - m_extension = minX; - - break; - } - - case NPC_INIT_SUB_SHARK: - { - m_state = SUB_SHARK_MINE_1; - m_extendDir = EXTEND_RIGHT; - - break; - } - - case NPC_INIT_IRON_DOGFISH: - { - m_state = IRON_DOGFISH_THUMP_1; - m_extendDir = EXTEND_RIGHT; - - break; - } - - case NPC_INIT_FISH_HOOK: - { - m_heading = m_fireHeading = 3072; - - DVECTOR newPos; - - newPos.vx = 100; - newPos.vy = -100; - - m_npcPath.addWaypoint( newPos ); - - m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH ); - - break; - } - - case NPC_INIT_PENDULUM: - { - m_extendDir = EXTEND_LEFT; - m_extension = 0; - m_heading = 1024; - - break; - } - - case NPC_INIT_FIREBALL: - { - DVECTOR newPos; - - newPos.vx = 300; - newPos.vy = 100; - - m_npcPath.addWaypoint( newPos ); - m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH ); - - m_extension = 0; - m_velocity = m_data[m_type].speed; - m_timerTimer = GameState::getOneSecondInFrames() * 4; - - break; - } - - case NPC_INIT_RETURNING_HAZARD: - { - m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH ); - - break; - } - - case NPC_INIT_FISH_FOLK: - { - m_heading = m_fireHeading = 0; - - DVECTOR newPos; - - newPos.vx = 200; - newPos.vy = 400; - - m_npcPath.addWaypoint( newPos ); - - newPos.vx = 500; - newPos.vy = 400; - - m_npcPath.addWaypoint( newPos ); - - m_npcPath.setPathType( CNpcPath::PONG_PATH ); - - break; - } - - case NPC_INIT_ANEMONE_2: - { - CProjectile *projectile; - s16 heading; - - for ( int fireLoop = 0 ; fireLoop < 5 ; fireLoop++ ) - { - DVECTOR spikePos; - - heading = m_heading - 1024 + ( fireLoop * 512 ); - heading &= 4095; - - spikePos = Pos; - spikePos.vx += ( 40 * rcos( heading ) ) >> 12; - spikePos.vy += ( 40 * rsin( heading ) ) >> 12; - - projectile = new( "anemone lev2 projectile" ) CProjectile; - projectile->init( spikePos, heading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE ); - projectile->setLayerCollision( m_layerCollision ); - - addChild( projectile ); - } - - break; - } - - case NPC_INIT_CIRCULAR_PLATFORM: - { - Pos.vx = 300; - Pos.vy = 300; - - m_base = Pos; - - m_extendDir = EXTEND_CLOCKWISE; - m_extension = 100; - - break; - } - - case NPC_INIT_PARASITIC_WORM: - { - DVECTOR newPos; - - newPos.vx = 100; - //newPos.vy = 10; - newPos.vy = 100; - - m_npcPath.addWaypoint( newPos ); - - newPos.vx = 500; - //newPos.vy = 10; - newPos.vy = 100; - - m_npcPath.addWaypoint( newPos ); - - newPos.vx = 500; - //newPos.vy = 100; - newPos.vy = 300; - - m_npcPath.addWaypoint( newPos ); - - newPos.vx = 100; - //newPos.vy = 100; - newPos.vy = 300; - - m_npcPath.addWaypoint( newPos ); - - m_npcPath.setPathType( CNpcPath::PONG_PATH ); - - // create start of list - CNpcPositionHistory *newPosition; - newPosition = new ("position history") CNpcPositionHistory; - newPosition->pos = Pos; - m_positionHistory = newPosition; - - CNpcPositionHistory *currentPosition = m_positionHistory; - - // create rest of list - - for ( int histLength = 1 ; histLength < ( NPC_PARASITIC_WORM_LENGTH * NPC_PARASITIC_WORM_SPACING ) ; histLength++ ) - { - newPosition = new ("position history") CNpcPositionHistory; - newPosition->pos = Pos; - newPosition->next = NULL; - newPosition->prev = currentPosition; - - currentPosition->next = newPosition; - currentPosition = newPosition; - } - - // link ends together for circular list - - currentPosition->next = m_positionHistory; - m_positionHistory->prev = currentPosition; - - for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ ) - { - CNpcEnemy *segment; - segment = new ("segment") CNpcEnemy; - segment->setType( CNpcEnemy::NPC_PARASITIC_WORM_SEGMENT ); - segment->init(); - segment->setLayerCollision( m_layerCollision ); - - this->addChild( segment ); - } - - m_movementTimer = 2 * GameState::getOneSecondInFrames(); - - break; - } - - case NPC_INIT_PARASITIC_WORM_SEGMENT: - { - break; - } - - case NPC_INIT_SPIDER_CRAB: - { - m_npcPath.setPathType( CNpcPath::PONG_PATH ); - - if ( m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, 16 ) < 0 ) - //if ( m_layerCollision->Get( Pos.vx >> 4, Pos.vy >> 4 ) ) - { - // starting off below ground, jump initially - - m_velocity = 5; - - m_movementFunc = NPC_MOVEMENT_SPIDER_CRAB_INITJUMP; - } - - break; - } - - default: - - break; - } + m_npcPath.setPathType( CNpcPath::PONG_PATH ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1030,16 +859,6 @@ void CNpcEnemy::collidedWith( CThing *_thisThing ) bool CNpcEnemy::processSensor() { - /*// temporary - if ( playerXDistSqr + playerYDistSqr < 10000 ) - { - m_controlFunc = NPC_CONTROL_SHOT; - m_state = NPC_GENERIC_HIT_CHECK_HEALTH; - - return( true ); - } - // temporary*/ - switch( m_sensorFunc ) { case NPC_SENSOR_NONE: @@ -1049,8 +868,7 @@ bool CNpcEnemy::processSensor() { switch( m_sensorFunc ) { - case NPC_SENSOR_OIL_BLOB_USER_CLOSE: - case NPC_SENSOR_NINJA_STARFISH_USER_CLOSE: + case NPC_SENSOR_GENERIC_USER_CLOSE: { if ( playerXDistSqr + playerYDistSqr < 10000 ) { @@ -1167,93 +985,6 @@ bool CNpcEnemy::processSensor() } } - case NPC_SENSOR_PARASITIC_WORM_USER_CLOSE: - { - if ( playerXDistSqr + playerYDistSqr < 40000 ) - { - m_controlFunc = NPC_CONTROL_CLOSE; - - return( true ); - } - else - { - return( false ); - } - } - - case NPC_SENSOR_SKULL_STOMPER_USER_CLOSE: - { - if ( playerXDistSqr < 10000 && playerYDist >= 0 ) - { - m_controlFunc = NPC_CONTROL_CLOSE; - m_extendDir = EXTEND_DOWN; - - return( true ); - } - else - { - return( false ); - } - } - - case NPC_SENSOR_BOOGER_MONSTER_USER_CLOSE: - { - if ( playerXDistSqr + playerYDistSqr < 400 ) - { - m_controlFunc = NPC_CONTROL_CLOSE; - m_extendDir = EXTEND_UP; - - return( true ); - } - else - { - return( false ); - } - } - - case NPC_SENSOR_IRON_DOGFISH_USER_CLOSE: - { - if ( playerXDistSqr + playerYDistSqr < 10000 ) - { - m_controlFunc = NPC_CONTROL_CLOSE; - - return( true ); - } - else - { - return( false ); - } - } - - case NPC_SENSOR_FISH_HOOK_USER_CLOSE: - { - if ( playerXDistSqr + playerYDistSqr < 400 ) - { - m_controlFunc = NPC_CONTROL_CLOSE; - - return( true ); - } - else - { - return( false ); - } - } - - case NPC_SENSOR_FALLING_ITEM_USER_CLOSE: - { - if ( playerXDistSqr + playerYDistSqr < 40000 ) - { - m_controlFunc = NPC_CONTROL_CLOSE; - m_movementTimer = GameState::getOneSecondInFrames() * 3; - - return( true ); - } - else - { - return( false ); - } - } - default: return( false ); } @@ -1323,69 +1054,6 @@ void CNpcEnemy::processMovement(int _frames) break; } - case NPC_MOVEMENT_MOTHER_JELLYFISH: - { - processMotherJellyfishMovement( _frames ); - - break; - } - - case NPC_MOVEMENT_FLYING_DUTCHMAN: - { - processFlyingDutchmanMovement( _frames ); - - break; - } - - case NPC_MOVEMENT_PARASITIC_WORM: - { - processParasiticWormMovement( _frames ); - - break; - } - - case NPC_MOVEMENT_SUB_SHARK: - { - processSubSharkMovement( _frames ); - - break; - } - - case NPC_MOVEMENT_IRON_DOGFISH: - { - processIronDogfishMovement( _frames ); - - break; - } - - case NPC_MOVEMENT_PENDULUM: - { - processPendulumMovement( _frames ); - - break; - } - - case NPC_MOVEMENT_FIREBALL: - { - processFireballMovement( _frames ); - - break; - } - - case NPC_MOVEMENT_RETURNING_HAZARD: - { - processReturningHazardMovement( _frames ); - - break; - } - - case NPC_MOVEMENT_RETURNING_HAZARD_GROUND: - { - processReturningHazardMovementGround( _frames ); - - break; - } - default: break; @@ -1507,51 +1175,6 @@ void CNpcEnemy::processClose(int _frames) break; } - case NPC_CLOSE_SKULL_STOMPER_ATTACK: - processCloseSkullStomperAttack( _frames ); - - break; - - case NPC_CLOSE_BOOGER_MONSTER_ATTACK: - processCloseBoogerMonsterAttack( _frames ); - - break; - - case NPC_CLOSE_MOTHER_JELLYFISH_ATTACK: - processCloseMotherJellyfishAttack( _frames ); - - break; - - case NPC_CLOSE_FLYING_DUTCHMAN_ATTACK: - processCloseFlyingDutchmanAttack( _frames ); - - break; - - case NPC_CLOSE_SUB_SHARK_ATTACK: - processCloseSubSharkAttack( _frames ); - - break; - - case NPC_CLOSE_IRON_DOGFISH_ATTACK: - processCloseIronDogfishAttack( _frames ); - - break; - - case NPC_CLOSE_FALLING_ITEM_FALL: - processCloseFallingItemFall( _frames ); - - break; - - case NPC_CLOSE_FISH_HOOK_RISE: - processCloseFishHookRise( _frames ); - - break; - - case NPC_CLOSE_PARASITIC_WORM_ATTACK: - processCloseParasiticWormAttack( _frames ); - - break; - default: break; } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index a8885076d..d8cb14ab6 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -187,32 +187,6 @@ protected: protected: // NPC data structure definitions // - enum NPC_INIT_FUNC - { - NPC_INIT_DEFAULT = 0, - NPC_INIT_SNAKE = 1, - NPC_INIT_ACID, - NPC_INIT_GHOST_PIRATE, - NPC_INIT_SKULL_STOMPER, - NPC_INIT_MOTHER_JELLYFISH, - NPC_INIT_SUB_SHARK, - NPC_INIT_FLYING_DUTCHMAN, - NPC_INIT_IRON_DOGFISH, - NPC_INIT_FALLING_ITEM, - NPC_INIT_FISH_HOOK, - NPC_INIT_PENDULUM, - NPC_INIT_FIREBALL, - NPC_INIT_RETURNING_HAZARD, - NPC_INIT_FISH_FOLK, - NPC_INIT_CIRCULAR_PLATFORM, - NPC_INIT_PARASITIC_WORM, - NPC_INIT_PARASITIC_WORM_SEGMENT, - NPC_INIT_HERMIT_CRAB, - NPC_INIT_BALL_BLOB, - NPC_INIT_ANEMONE_2, - NPC_INIT_SPIDER_CRAB, - }; - enum NPC_CONTROL_FUNC { NPC_CONTROL_NONE, @@ -226,31 +200,14 @@ protected: { NPC_SENSOR_NONE = 0, NPC_SENSOR_USER_CLOSE = 1, - NPC_SENSOR_NINJA_STARFISH_USER_CLOSE, + NPC_SENSOR_GENERIC_USER_CLOSE, NPC_SENSOR_GENERIC_USER_VISIBLE, - NPC_SENSOR_OIL_BLOB_USER_CLOSE, - NPC_SENSOR_SKULL_STOMPER_USER_CLOSE, - NPC_SENSOR_BOOGER_MONSTER_USER_CLOSE, - NPC_SENSOR_IRON_DOGFISH_USER_CLOSE, - NPC_SENSOR_FALLING_ITEM_USER_CLOSE, - NPC_SENSOR_FISH_HOOK_USER_CLOSE, - NPC_SENSOR_PARASITIC_WORM_USER_CLOSE, }; enum NPC_CLOSE_FUNC { NPC_CLOSE_NONE = 0, NPC_CLOSE_GENERIC_USER_SEEK = 1, - NPC_CLOSE_SKULL_STOMPER_ATTACK, - NPC_CLOSE_BOOGER_MONSTER_ATTACK, - NPC_CLOSE_MOTHER_JELLYFISH_ATTACK, - NPC_CLOSE_SUB_SHARK_ATTACK, - NPC_CLOSE_FLYING_DUTCHMAN_ATTACK, - NPC_CLOSE_IRON_DOGFISH_ATTACK, - NPC_CLOSE_FALLING_ITEM_FALL, - NPC_CLOSE_FISH_HOOK_RISE, - NPC_CLOSE_HERMIT_CRAB_ATTACK, - NPC_CLOSE_PARASITIC_WORM_ATTACK, }; enum NPC_MOVEMENT_FUNC @@ -258,18 +215,7 @@ protected: NPC_MOVEMENT_STATIC = 0, NPC_MOVEMENT_FIXED_PATH = 1, NPC_MOVEMENT_FIXED_PATH_WALK, - NPC_MOVEMENT_MOTHER_JELLYFISH, - NPC_MOVEMENT_SUB_SHARK, - NPC_MOVEMENT_FLYING_DUTCHMAN, - NPC_MOVEMENT_IRON_DOGFISH, - NPC_MOVEMENT_PENDULUM, - NPC_MOVEMENT_FIREBALL, - NPC_MOVEMENT_RETURNING_HAZARD, - NPC_MOVEMENT_CLAM_RETRACT, - NPC_MOVEMENT_PARASITIC_WORM, NPC_MOVEMENT_STATIC_CYCLE_ANIM, - NPC_MOVEMENT_RETURNING_HAZARD_GROUND, - NPC_MOVEMENT_SPIDER_CRAB_INITJUMP, }; enum NPC_TIMER_FUNC @@ -286,50 +232,6 @@ protected: NPC_SHOT_GENERIC = 1, }; - enum NPC_MOTHER_JELLYFISH_STATE - { - MOTHER_JELLYFISH_RETURN_TO_START_1 = 0, - MOTHER_JELLYFISH_CYCLE_1 = 1, - MOTHER_JELLYFISH_ATTACK_PLAYER_SPAWN_1, - MOTHER_JELLYFISH_RETURN_TO_START_2, - MOTHER_JELLYFISH_CYCLE_2, - MOTHER_JELLYFISH_ATTACK_PLAYER_SPAWN_2, - MOTHER_JELLYFISH_RETURN_TO_START_3, - MOTHER_JELLYFISH_CYCLE_3, - MOTHER_JELLYFISH_ATTACK_PLAYER_SHOCK, - }; - - enum NPC_SUB_SHARK_STATE - { - SUB_SHARK_MINE_1 = 0, - SUB_SHARK_MINE_2 = 1, - SUB_SHARK_CYCLE, - SUB_SHARK_SWALLOW, - }; - - enum NPC_FLYING_DUTCHMAN_STATE - { - FLYING_DUTCHMAN_ATTACK_PLAYER_1 = 0, - FLYING_DUTCHMAN_ATTACK_PLAYER_2 = 1, - FLYING_DUTCHMAN_ATTACK_PLAYER_3, - }; - - enum NPC_IRON_DOGFISH_STATE - { - IRON_DOGFISH_THUMP_1 = 0, - IRON_DOGFISH_LASER_EYE_1 = 1, - IRON_DOGFISH_THUMP_2, - IRON_DOGFISH_ROLL, - IRON_DOGFISH_LASER_EYE_2, - }; - - enum NPC_HERMIT_CRAB_STATE - { - HERMIT_CRAB_NO_ATTACK = 0, - HERMIT_CRAB_PUNCH_ATTACK = 1, - HERMIT_CRAB_ROLL_ATTACK, - }; - enum NPC_GENERIC_HIT_STATE { NPC_GENERIC_HIT_CHECK_HEALTH = 100, @@ -340,11 +242,6 @@ protected: enum { - NPC_JELLYFISH_RESISTANCE = 64, - NPC_BOOGER_MONSTER_MAX_EXTENSION = 20, - NPC_SUB_SHARK_HIGH_SPEED = 6, - NPC_PARASITIC_WORM_SPACING = 6, - NPC_PARASITIC_WORM_LENGTH = 10, EXTEND_UP = true, EXTEND_DOWN = false, EXTEND_RIGHT = true, @@ -368,7 +265,6 @@ protected: int skelType; // FileEquate animData; u16 initAnim; - NPC_INIT_FUNC initFunc; NPC_SENSOR_FUNC sensorFunc; NPC_MOVEMENT_FUNC movementFunc; NPC_CLOSE_FUNC closeFunc; @@ -409,54 +305,6 @@ protected: void reinit(); - // flaming skull functions - - void processCloseFlamingSkullAttack( int _frames ); - - // skull stomper functions - - void processCloseSkullStomperAttack( int _frames ); - - // booger monster functions - - void processCloseBoogerMonsterAttack( int _frames ); - - // mother jellyfish functions - - void processMotherJellyfishMovement( int _frames ); - void processCloseMotherJellyfishAttack( int _frames ); - - // sub shark functions - - void processSubSharkMovement( int _frames ); - void processCloseSubSharkAttack( int _frames ); - - // parasitic worm functions - - void processParasiticWormMovement( int _frames ); - void resetParasiticWormHeadToTail(); - void processCloseParasiticWormAttack( int _frames ); - - // flying dutchman functions - - void processFlyingDutchmanMovement( int _frames ); - void processCloseFlyingDutchmanAttack( int _frames ); - - // iron dogfish functions - - void processIronDogfishMovement( int _frames ); - void processStandardIronDogfishAttack( int _frames ); - void processCloseIronDogfishAttack( int _frames ); - - // hazard functions - - void processCloseFallingItemFall( int _frames ); - void processCloseFishHookRise( int _frames ); - void processPendulumMovement( int _frames ); - void processFireballMovement( int _frames ); - void processReturningHazardMovement( int _frames ); - void processReturningHazardMovementGround( int _frames ); - // data static NPC_DATA m_data[NPC_UNIT_TYPE_MAX]; diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index e25ad2bbc..14fe4fe9d 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -321,11 +321,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_FALLING_ITEM ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, - //NPC_SENSOR_FALLING_ITEM_USER_CLOSE, - NPC_SENSOR_NONE, + NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC, - NPC_CLOSE_FALLING_ITEM_FALL, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 8, @@ -344,10 +342,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_FISH_HOOK ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_FISH_HOOK, - NPC_SENSOR_FISH_HOOK_USER_CLOSE, + NPC_SENSOR_NONE, NPC_MOVEMENT_STATIC, - NPC_CLOSE_FISH_HOOK_RISE, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 3, @@ -366,9 +363,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_DUST_DEVIL ACTORS_DUSTDEVIL_SBK, ANIM_DUSTDEVIL_TWIST, - NPC_INIT_RETURNING_HAZARD, NPC_SENSOR_NONE, - NPC_MOVEMENT_RETURNING_HAZARD_GROUND, + NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, NPC_TIMER_NONE, false, @@ -388,9 +384,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_PENDULUM ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_PENDULUM, NPC_SENSOR_NONE, - NPC_MOVEMENT_PENDULUM, + NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, NPC_TIMER_NONE, false, @@ -410,9 +405,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_FIREBALL ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_FIREBALL, NPC_SENSOR_NONE, - NPC_MOVEMENT_FIREBALL, + NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, NPC_TIMER_NONE, false, @@ -432,9 +426,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SAW_BLADE ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_RETURNING_HAZARD, NPC_SENSOR_NONE, - NPC_MOVEMENT_RETURNING_HAZARD, + NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, NPC_TIMER_NONE, false, @@ -454,7 +447,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SMALL_JELLYFISH_1 0,//ACTORS_JELLYFISH1_SBK, FRM_JELLYFISH1_SWIM1, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -476,7 +468,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SMALL_JELLYFISH_2 ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -498,7 +489,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_ANEMONE_1 ACTORS_ANENOMELVL1_SBK, ANIM_ANENOMELVL1_BEND, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC_CYCLE_ANIM, NPC_CLOSE_NONE, @@ -520,7 +510,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_ANEMONE_2 ACTORS_SPIKEYANENOME_SBK, ANIM_SPIKEYANENOME_BODY, - NPC_INIT_ANEMONE_2, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC_CYCLE_ANIM, NPC_CLOSE_NONE, @@ -542,7 +531,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_ANEMONE_3 ACTORS_ANENOMELVL3_SBK, ANIM_ANENOMELVL3_BEND, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC_CYCLE_ANIM, NPC_CLOSE_NONE, @@ -564,7 +552,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SKELETAL_FISH ACTORS_SKELETALFISH_SBK, ANIM_SKELETALFISH_IDLE, - NPC_INIT_DEFAULT, NPC_SENSOR_GENERIC_USER_VISIBLE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -586,7 +573,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_CLAM_JUMP ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, @@ -608,7 +594,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_CLAM_STATIC ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, @@ -630,7 +615,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SQUID_DART 0,//ACTORS_SQUIDDART_SBK, FRM_SQUIDDART_SWIM0001, - NPC_INIT_DEFAULT, NPC_SENSOR_NONE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -652,7 +636,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_FISH_FOLK ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_FISH_FOLK, NPC_SENSOR_NONE, NPC_MOVEMENT_FIXED_PATH_WALK, NPC_CLOSE_NONE, @@ -674,7 +657,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_PRICKLY_BUG ACTORS_CATERPILLAR_SBK, ANIM_CATERPILLAR_CRAWL, - NPC_INIT_DEFAULT, NPC_SENSOR_NONE, NPC_MOVEMENT_FIXED_PATH_WALK, NPC_CLOSE_NONE, @@ -696,7 +678,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SEA_SNAKE ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, NPC_SENSOR_NONE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -718,7 +699,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_PUFFA_FISH ACTORS_PUFFAFISH_SBK, ANIM_PUFFAFISH_PUFFUPIDLE, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -740,7 +720,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_ANGLER_FISH ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, NPC_SENSOR_NONE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -762,10 +741,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_HERMIT_CRAB ACTORS_HERMITCRAB_SBK, ANIM_HERMITCRAB_IDLE, - NPC_INIT_HERMIT_CRAB, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH_WALK, - NPC_CLOSE_HERMIT_CRAB_ATTACK, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 2, @@ -784,7 +762,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_MINE ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, NPC_SENSOR_NONE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, @@ -806,10 +783,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_BOOGER_MONSTER ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, - NPC_SENSOR_BOOGER_MONSTER_USER_CLOSE, + NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC, - NPC_CLOSE_BOOGER_MONSTER_ATTACK, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 0, @@ -828,7 +804,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SPIDER_CRAB ACTORS_SPIDERCRAB_SBK, ANIM_SPIDERCRAB_IDLE, - NPC_INIT_SPIDER_CRAB, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH_WALK, NPC_CLOSE_NONE, @@ -850,7 +825,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SPIDER_CRAB_SPAWNER ACTORS_SPIDERCRAB_SBK, ANIM_SPIDERCRAB_IDLE, - NPC_INIT_DEFAULT, NPC_SENSOR_NONE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, @@ -872,7 +846,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_EYEBALL ACTORS_EYEBALL_SBK, ANIM_EYEBALL_STALK, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, @@ -894,7 +867,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_BABY_OCTOPUS ACTORS_BABYOCTOPUS_SBK, ANIM_BABYOCTOPUS_IDLE, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -916,7 +888,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_ZOMBIE_FISH_FOLK ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_FISH_FOLK, NPC_SENSOR_NONE, NPC_MOVEMENT_FIXED_PATH_WALK, NPC_CLOSE_NONE, @@ -938,8 +909,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_NINJA_STARFISH ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, - NPC_SENSOR_NINJA_STARFISH_USER_CLOSE, + NPC_SENSOR_GENERIC_USER_CLOSE, NPC_MOVEMENT_STATIC, NPC_CLOSE_GENERIC_USER_SEEK, NPC_TIMER_NONE, @@ -960,7 +930,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_GHOST ACTORS_GHOST_SBK, ANIM_GHOST_IDLE, - NPC_INIT_DEFAULT, NPC_SENSOR_NONE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, @@ -982,7 +951,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_GHOST_PIRATE ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_GHOST_PIRATE, NPC_SENSOR_NONE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, @@ -1004,7 +972,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_FLAMING_SKULL ACTORS_FLAMINGSKULL_SBK, ANIM_FLAMINGSKULL_MOVE, - NPC_INIT_DEFAULT, NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC_CYCLE_ANIM, NPC_CLOSE_NONE, @@ -1026,7 +993,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SHARK_MAN ACTORS_SHARKMAN_SBK, ANIM_SHARKMAN_IDLE1_, - NPC_INIT_DEFAULT, NPC_SENSOR_GENERIC_USER_VISIBLE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, @@ -1048,8 +1014,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_OIL_BLOB ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_DEFAULT, - NPC_SENSOR_OIL_BLOB_USER_CLOSE, + NPC_SENSOR_GENERIC_USER_CLOSE, NPC_MOVEMENT_STATIC, NPC_CLOSE_GENERIC_USER_SEEK, NPC_TIMER_NONE, @@ -1070,10 +1035,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SKULL_STOMPER ACTORS_STOMPER_SBK, ANIM_STOMPER_CRUSH, - NPC_INIT_SKULL_STOMPER, - NPC_SENSOR_SKULL_STOMPER_USER_CLOSE, + NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_STATIC, - NPC_CLOSE_SKULL_STOMPER_ATTACK, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 5, @@ -1092,10 +1056,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_MOTHER_JELLYFISH ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_MOTHER_JELLYFISH, NPC_SENSOR_NONE, - NPC_MOVEMENT_MOTHER_JELLYFISH, - NPC_CLOSE_MOTHER_JELLYFISH_ATTACK, + NPC_MOVEMENT_STATIC, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 3, @@ -1114,10 +1077,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SUB_SHARK ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_SUB_SHARK, NPC_SENSOR_NONE, - NPC_MOVEMENT_SUB_SHARK, - NPC_CLOSE_SUB_SHARK_ATTACK, + NPC_MOVEMENT_STATIC, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 3, @@ -1136,10 +1098,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_PARASITIC_WORM ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_PARASITIC_WORM, - NPC_SENSOR_PARASITIC_WORM_USER_CLOSE, - NPC_MOVEMENT_PARASITIC_WORM, - NPC_CLOSE_PARASITIC_WORM_ATTACK, + NPC_SENSOR_USER_CLOSE, + NPC_MOVEMENT_STATIC, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 3, @@ -1158,10 +1119,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_FLYING_DUTCHMAN ACTORS_FLYINGDUTCHMAN_SBK, ANIM_FLYINGDUTCHMAN_FLY, - NPC_INIT_FLYING_DUTCHMAN, NPC_SENSOR_NONE, - NPC_MOVEMENT_FLYING_DUTCHMAN, - NPC_CLOSE_FLYING_DUTCHMAN_ATTACK, + NPC_MOVEMENT_STATIC, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 3, @@ -1180,10 +1140,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_IRON_DOGFISH ACTORS_IRONDOGFISH_SBK, ANIM_IRONDOGFISH_IDLE, - NPC_INIT_IRON_DOGFISH, - NPC_SENSOR_IRON_DOGFISH_USER_CLOSE, - NPC_MOVEMENT_IRON_DOGFISH, - NPC_CLOSE_IRON_DOGFISH_ATTACK, + NPC_SENSOR_USER_CLOSE, + NPC_MOVEMENT_STATIC, + NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 3, @@ -1202,7 +1161,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_PARASITIC_WORM_SEGMENT ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, - NPC_INIT_PARASITIC_WORM_SEGMENT, NPC_SENSOR_NONE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, @@ -1224,7 +1182,6 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_BALL_BLOB ACTORS_BALLBLOB_SBK, ANIM_BALLBLOB_WOBBLE, - NPC_INIT_BALL_BLOB, NPC_SENSOR_NONE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, diff --git a/source/enemy/nscrab.cpp b/source/enemy/nscrab.cpp index 62eaaf1b8..79705806b 100644 --- a/source/enemy/nscrab.cpp +++ b/source/enemy/nscrab.cpp @@ -32,6 +32,22 @@ #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcSpiderCrabEnemy::postInit() +{ + m_npcPath.setPathType( CNpcPath::PONG_PATH ); + + if ( m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, 16 ) < 0 ) + { + // starting off below ground, jump initially + + m_velocity = 5; + + m_state = SPIDER_CRAB_INIT_JUMP; + } +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// bool CNpcSpiderCrabEnemy::processSensor() @@ -247,7 +263,7 @@ void CNpcSpiderCrabEnemy::processSpiderCrabInitJumpMovement( int _frames ) if ( completed || collision ) { - m_movementFunc = m_data[m_type].movementFunc; + m_state = SPIDER_CRAB_DEFAULT; } } @@ -264,7 +280,7 @@ void CNpcSpiderCrabEnemy::processMovement(int _frames) s32 moveVel = 0; s32 moveDist = 0; - if ( m_movementFunc == NPC_MOVEMENT_SPIDER_CRAB_INITJUMP ) + if ( m_state == SPIDER_CRAB_INIT_JUMP ) { processSpiderCrabInitJumpMovement( _frames ); } diff --git a/source/enemy/nscrab.h b/source/enemy/nscrab.h index c33eef7dd..ebe095543 100644 --- a/source/enemy/nscrab.h +++ b/source/enemy/nscrab.h @@ -21,12 +21,19 @@ class CNpcSpiderCrabEnemy : public CNpcEnemy { public: + virtual void postInit(); protected: virtual bool processSensor(); virtual void processClose( int _frames ); virtual void processCollision(); virtual void processMovement( int _frames ); void processSpiderCrabInitJumpMovement( int _frames ); + + enum NPC_SPIDER_CRAB_STATE + { + SPIDER_CRAB_DEFAULT = 0, + SPIDER_CRAB_INIT_JUMP = 1, + }; }; #endif diff --git a/source/enemy/nsjfish.h b/source/enemy/nsjfish.h index 3a7d64ac1..dc9773e54 100644 --- a/source/enemy/nsjfish.h +++ b/source/enemy/nsjfish.h @@ -27,6 +27,11 @@ protected: virtual bool processSensor(); virtual void processClose( int _frames ); virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); + + enum + { + NPC_JELLYFISH_RESISTANCE = 64, + }; }; #endif diff --git a/source/enemy/nsshark.cpp b/source/enemy/nsshark.cpp index 17f0a2a5b..cd0c4165a 100644 --- a/source/enemy/nsshark.cpp +++ b/source/enemy/nsshark.cpp @@ -15,6 +15,10 @@ #include "enemy\npc.h" #endif +#ifndef __ENEMY_NSSHARK_H__ +#include "enemy\nsshark.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -32,7 +36,13 @@ #endif -void CNpcEnemy::processSubSharkMovement( int _frames ) +void CNpcSubSharkEnemy::postInit() +{ + m_state = SUB_SHARK_MINE_1; + m_extendDir = EXTEND_RIGHT; +} + +void CNpcSubSharkEnemy::processMovement( int _frames ) { if ( !m_animPlaying ) { @@ -116,7 +126,7 @@ void CNpcEnemy::processSubSharkMovement( int _frames ) } } -void CNpcEnemy::processCloseSubSharkAttack( int _frames ) +void CNpcSubSharkEnemy::processClose( int _frames ) { if ( m_state != SUB_SHARK_SWALLOW ) { diff --git a/source/enemy/nsstomp.cpp b/source/enemy/nsstomp.cpp index a4f4a5ce7..acf957d45 100644 --- a/source/enemy/nsstomp.cpp +++ b/source/enemy/nsstomp.cpp @@ -15,6 +15,10 @@ #include "enemy\npc.h" #endif +#ifndef __ENEMY_NSSTOMP_H__ +#include "enemy\nsstomp.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -28,7 +32,36 @@ #endif -void CNpcEnemy::processCloseSkullStomperAttack( int _frames ) +void CNpcSkullStomperEnemy::postInit() +{ + m_extendDir = EXTEND_DOWN; +} + +bool CNpcSkullStomperEnemy::processSensor() +{ + switch( m_sensorFunc ) + { + case NPC_SENSOR_NONE: + return( false ); + + default: + { + if ( playerXDistSqr < 10000 && playerYDist >= 0 ) + { + m_controlFunc = NPC_CONTROL_CLOSE; + m_extendDir = EXTEND_DOWN; + + return( true ); + } + else + { + return( false ); + } + } + } +} + +void CNpcSkullStomperEnemy::processClose( int _frames ) { s8 groundHeight; s8 yMovement; diff --git a/source/enemy/nworm.cpp b/source/enemy/nworm.cpp index 3be7322a6..3cb04ffc8 100644 --- a/source/enemy/nworm.cpp +++ b/source/enemy/nworm.cpp @@ -15,6 +15,10 @@ #include "enemy\npc.h" #endif +#ifndef __ENEMY_NWORM_H__ +#include "enemy\nworm.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -23,7 +27,96 @@ #include "player\player.h" #endif -void CNpcEnemy::processParasiticWormMovement( int _frames ) +void CNpcParasiticWormEnemy::postInit() +{ + DVECTOR newPos; + + newPos.vx = 100; + //newPos.vy = 10; + newPos.vy = 100; + + m_npcPath.addWaypoint( newPos ); + + newPos.vx = 500; + //newPos.vy = 10; + newPos.vy = 100; + + m_npcPath.addWaypoint( newPos ); + + newPos.vx = 500; + //newPos.vy = 100; + newPos.vy = 300; + + m_npcPath.addWaypoint( newPos ); + + newPos.vx = 100; + //newPos.vy = 100; + newPos.vy = 300; + + m_npcPath.addWaypoint( newPos ); + + m_npcPath.setPathType( CNpcPath::PONG_PATH ); + + // create start of list + CNpcPositionHistory *newPosition; + newPosition = new ("position history") CNpcPositionHistory; + newPosition->pos = Pos; + m_positionHistory = newPosition; + + CNpcPositionHistory *currentPosition = m_positionHistory; + + // create rest of list + + for ( int histLength = 1 ; histLength < ( NPC_PARASITIC_WORM_LENGTH * NPC_PARASITIC_WORM_SPACING ) ; histLength++ ) + { + newPosition = new ("position history") CNpcPositionHistory; + newPosition->pos = Pos; + newPosition->next = NULL; + newPosition->prev = currentPosition; + + currentPosition->next = newPosition; + currentPosition = newPosition; + } + + // link ends together for circular list + + currentPosition->next = m_positionHistory; + m_positionHistory->prev = currentPosition; + + for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ ) + { + CNpcEnemy *segment; + segment = new ("segment") CNpcParasiticWormSegment; + segment->setType( CNpcEnemy::NPC_PARASITIC_WORM_SEGMENT ); + segment->init(); + segment->setLayerCollision( m_layerCollision ); + segment->postInit(); + + this->addChild( segment ); + } + + m_movementTimer = 2 * GameState::getOneSecondInFrames(); +} + +void CNpcParasiticWormSegment::postInit() +{ +} + +bool CNpcParasiticWormEnemy::processSensor() +{ + if ( playerXDistSqr + playerYDistSqr < 40000 ) + { + m_controlFunc = NPC_CONTROL_CLOSE; + + return( true ); + } + else + { + return( false ); + } +} + +void CNpcParasiticWormEnemy::processMovement( int _frames ) { s32 moveX = 0, moveY = 0; s32 moveVel = 0; @@ -110,7 +203,7 @@ void CNpcEnemy::processParasiticWormMovement( int _frames ) } } -void CNpcEnemy::resetParasiticWormHeadToTail() +void CNpcParasiticWormEnemy::resetParasiticWormHeadToTail() { DVECTOR startPos; DVECTOR endPos; @@ -182,7 +275,7 @@ void CNpcEnemy::resetParasiticWormHeadToTail() } } -void CNpcEnemy::processCloseParasiticWormAttack( int _frames ) +void CNpcParasiticWormEnemy::processClose( int _frames ) { resetParasiticWormHeadToTail(); diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index f8e286216..8bf2e7732 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -129,6 +129,10 @@ SOURCE=..\..\..\source\enemy\nbooger.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nbooger.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nclam.cpp # End Source File # Begin Source File @@ -141,6 +145,10 @@ SOURCE=..\..\..\source\enemy\ndogfish.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\ndogfish.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\neyeball.cpp # End Source File # Begin Source File @@ -153,6 +161,10 @@ SOURCE=..\..\..\source\enemy\nfdutch.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nfdutch.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nffolk.cpp # End Source File # Begin Source File @@ -197,6 +209,10 @@ SOURCE=..\..\..\source\enemy\nhazard.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nhazard.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nhcrab.cpp # End Source File # Begin Source File @@ -209,6 +225,10 @@ SOURCE=..\..\..\source\enemy\nmjfish.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nmjfish.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nocto.cpp # End Source File # Begin Source File @@ -289,12 +309,24 @@ SOURCE=..\..\..\source\enemy\nsshark.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nsshark.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nsstomp.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nsstomp.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nworm.cpp # End Source File +# Begin Source File + +SOURCE=..\..\..\source\enemy\nworm.h +# End Source File # End Group # Begin Group "fileio"