From bb1837c2d3bfe004aa42a7c1a6b2abaa2badb983 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 27 Feb 2001 21:25:22 +0000 Subject: [PATCH] --- source/enemy/nanemone.cpp | 6 +- source/enemy/nbooger.cpp | 2 +- source/enemy/nclam.cpp | 4 +- source/enemy/ndogfish.cpp | 6 +- source/enemy/neyeball.cpp | 2 +- source/enemy/nfdutch.cpp | 4 +- source/enemy/nffolk.cpp | 2 +- source/enemy/nfskull.cpp | 2 +- source/enemy/ngary.cpp | 4 +- source/enemy/ngeneric.cpp | 14 +-- source/enemy/ngpirate.cpp | 2 +- source/enemy/nmjfish.cpp | 4 +- source/enemy/nocto.cpp | 2 +- source/enemy/npc.cpp | 235 ++++++++++++++++++++++++++++++++++---- source/enemy/npc.h | 89 +++++++++++++-- source/enemy/npcdata.cpp | 29 ++--- source/enemy/nscrab.cpp | 2 +- source/enemy/nshrkman.cpp | 2 +- source/enemy/nsjfish.cpp | 4 +- source/enemy/nsklfish.cpp | 2 +- source/enemy/nsshark.cpp | 4 +- source/enemy/nsstomp.cpp | 2 +- source/game/game.cpp | 4 +- 23 files changed, 342 insertions(+), 85 deletions(-) diff --git a/source/enemy/nanemone.cpp b/source/enemy/nanemone.cpp index 2fdf70ae2..286c21a4c 100644 --- a/source/enemy/nanemone.cpp +++ b/source/enemy/nanemone.cpp @@ -28,7 +28,7 @@ #endif -void CNpc::processCloseAnemone1Attack( int _frames ) +void CNpcEnemy::processCloseAnemone1Attack( int _frames ) { s32 moveX, moveY; s16 decDir, incDir, moveDist; @@ -121,7 +121,7 @@ void CNpc::processCloseAnemone1Attack( int _frames ) } } -void CNpc::processCloseAnemone2Attack( int _frames ) +void CNpcEnemy::processCloseAnemone2Attack( int _frames ) { int fireLoop; CProjectile *projectile; @@ -142,7 +142,7 @@ void CNpc::processCloseAnemone2Attack( int _frames ) m_sensorFunc = NPC_SENSOR_NONE; } -void CNpc::processCloseAnemone3Attack( int _frames ) +void CNpcEnemy::processCloseAnemone3Attack( int _frames ) { CProjectile *projectile; u8 lifetime = 8; diff --git a/source/enemy/nbooger.cpp b/source/enemy/nbooger.cpp index 7a6752ec9..929e837a9 100644 --- a/source/enemy/nbooger.cpp +++ b/source/enemy/nbooger.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processCloseBoogerMonsterAttack( int _frames ) +void CNpcEnemy::processCloseBoogerMonsterAttack( int _frames ) { s32 velocity; diff --git a/source/enemy/nclam.cpp b/source/enemy/nclam.cpp index 72f19ea5e..1d36b7470 100644 --- a/source/enemy/nclam.cpp +++ b/source/enemy/nclam.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processCloseClamAttack( int _frames ) +void CNpcEnemy::processCloseClamAttack( int _frames ) { s32 velocity; @@ -77,7 +77,7 @@ void CNpc::processCloseClamAttack( int _frames ) } } -void CNpc::processClamRetract( int _frames ) +void CNpcEnemy::processClamRetract( int _frames ) { s32 velocity; diff --git a/source/enemy/ndogfish.cpp b/source/enemy/ndogfish.cpp index 82b9d3db6..b0452b084 100644 --- a/source/enemy/ndogfish.cpp +++ b/source/enemy/ndogfish.cpp @@ -27,7 +27,7 @@ #include "projectl\projectl.h" #endif -void CNpc::processIronDogfishMovement( int _frames ) +void CNpcEnemy::processIronDogfishMovement( int _frames ) { if ( m_movementTimer > 0 ) { @@ -68,7 +68,7 @@ void CNpc::processIronDogfishMovement( int _frames ) } } -void CNpc::processStandardIronDogfishAttack( int _frames ) +void CNpcEnemy::processStandardIronDogfishAttack( int _frames ) { if ( playerXDist > 0 ) { @@ -141,7 +141,7 @@ void CNpc::processStandardIronDogfishAttack( int _frames ) } } -void CNpc::processCloseIronDogfishAttack( int _frames ) +void CNpcEnemy::processCloseIronDogfishAttack( int _frames ) { // swipe at player diff --git a/source/enemy/neyeball.cpp b/source/enemy/neyeball.cpp index f7ec4fe87..bc8982325 100644 --- a/source/enemy/neyeball.cpp +++ b/source/enemy/neyeball.cpp @@ -28,7 +28,7 @@ #endif -void CNpc::processCloseEyeballAttack( int _frames ) +void CNpcEnemy::processCloseEyeballAttack( int _frames ) { if ( Next ) { diff --git a/source/enemy/nfdutch.cpp b/source/enemy/nfdutch.cpp index e21d9a526..483763573 100644 --- a/source/enemy/nfdutch.cpp +++ b/source/enemy/nfdutch.cpp @@ -28,7 +28,7 @@ #endif -void CNpc::processFlyingDutchmanMovement( int _frames ) +void CNpcEnemy::processFlyingDutchmanMovement( int _frames ) { if ( m_movementTimer > 0 ) { @@ -69,7 +69,7 @@ void CNpc::processFlyingDutchmanMovement( int _frames ) } } -void CNpc::processCloseFlyingDutchmanAttack( int _frames ) +void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames ) { if ( playerYDist > 0 ) { diff --git a/source/enemy/nffolk.cpp b/source/enemy/nffolk.cpp index b9314d97e..f1edcb60f 100644 --- a/source/enemy/nffolk.cpp +++ b/source/enemy/nffolk.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processFishFolkMovementModifier( int _frames, s32 distX, s32 distY ) +void CNpcEnemy::processFishFolkMovementModifier( int _frames, s32 distX, s32 distY ) { Pos.vy += distY; diff --git a/source/enemy/nfskull.cpp b/source/enemy/nfskull.cpp index 173b39478..b2d0ceb58 100644 --- a/source/enemy/nfskull.cpp +++ b/source/enemy/nfskull.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processCloseFlamingSkullAttack( int _frames ) +void CNpcEnemy::processCloseFlamingSkullAttack( int _frames ) { s32 distX, distY; s32 distXSqr, distYSqr; diff --git a/source/enemy/ngary.cpp b/source/enemy/ngary.cpp index f12866375..b164dc7aa 100644 --- a/source/enemy/ngary.cpp +++ b/source/enemy/ngary.cpp @@ -20,11 +20,11 @@ #endif -void CNpc::processGaryMovement( int _frames ) +void CNpcFriend::processGaryMovement( int _frames ) { s8 multiplier = -1 + ( 2 * m_extension ); s32 maxHeight = 10; - s32 fallSpeed = 5; + s32 fallSpeed = 3; s8 yMovement = fallSpeed * _frames; s8 groundHeight; diff --git a/source/enemy/ngeneric.cpp b/source/enemy/ngeneric.cpp index b43f70ce0..62a85057d 100644 --- a/source/enemy/ngeneric.cpp +++ b/source/enemy/ngeneric.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed ) +void CNpcEnemy::processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed ) { s16 decDir, incDir, moveDist; s32 moveX, moveY; @@ -83,7 +83,7 @@ void CNpc::processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 spee Pos.vy += moveY; } -void CNpc::processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ) +void CNpcEnemy::processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ) { s32 moveX = 0, moveY = 0; @@ -99,7 +99,7 @@ void CNpc::processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ) *distY = playerPos.vy - this->Pos.vy; } -bool CNpc::processGroundCollisionReverse( s32 *moveX, s32 *moveY ) +bool CNpcEnemy::processGroundCollisionReverse( s32 *moveX, s32 *moveY ) { bool xBlocked = false; bool yBlocked = false; @@ -153,7 +153,7 @@ bool CNpc::processGroundCollisionReverse( s32 *moveX, s32 *moveY ) return( xBlocked | yBlocked ); } -void CNpc::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist ) +void CNpcEnemy::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist ) { bool pathComplete; bool waypointChange; @@ -226,7 +226,7 @@ void CNpc::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY, s32 } } -void CNpc::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY ) +void CNpcEnemy::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY ) { s32 maxHeight = 10; s32 distX, distY; @@ -295,7 +295,7 @@ void CNpc::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY ) } } -void CNpc::processGenericCircularPath( int _frames ) +void CNpcEnemy::processGenericCircularPath( int _frames ) { m_rotation += m_data[m_type].speed; m_rotation %= 4096; @@ -305,7 +305,7 @@ void CNpc::processGenericCircularPath( int _frames ) } -bool CNpc::isCollisionWithGround() +bool CNpcEnemy::isCollisionWithGround() { ASSERT(m_layerCollision); return m_layerCollision->Get( Pos.vx >> 4, ( Pos.vy + 1 ) >> 4 ) ? 16:0; diff --git a/source/enemy/ngpirate.cpp b/source/enemy/ngpirate.cpp index 8939b1961..b8a008eac 100644 --- a/source/enemy/ngpirate.cpp +++ b/source/enemy/ngpirate.cpp @@ -28,7 +28,7 @@ #endif -void CNpc::processCloseGhostPirateAttack( int _frames ) +void CNpcEnemy::processCloseGhostPirateAttack( int _frames ) { s32 velocity; diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index a817c5cfc..a33b95c59 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processMotherJellyfishMovement( int _frames ) +void CNpcEnemy::processMotherJellyfishMovement( int _frames ) { s32 xDist, yDist; s32 xDistSqr, yDistSqr; @@ -106,7 +106,7 @@ void CNpc::processMotherJellyfishMovement( int _frames ) } } -void CNpc::processCloseMotherJellyfishAttack( int _frames ) +void CNpcEnemy::processCloseMotherJellyfishAttack( int _frames ) { // seek position above user diff --git a/source/enemy/nocto.cpp b/source/enemy/nocto.cpp index 58b05c3aa..236473d12 100644 --- a/source/enemy/nocto.cpp +++ b/source/enemy/nocto.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processBabyOctopusMovementModifier( int _frames, s32 dist, s16 headingChange ) +void CNpcEnemy::processBabyOctopusMovementModifier( int _frames, s32 dist, s16 headingChange ) { s32 newX, newY; s32 preShiftX, preShiftY; diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 853596fa6..9855e173b 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -45,17 +45,176 @@ #include "game\convo.h" #endif +#include "Gfx\Skel.h" +#include "gfx\anim.h" -s32 CNpc::playerXDist; -s32 CNpc::playerYDist; -s32 CNpc::playerXDistSqr; -s32 CNpc::playerYDistSqr; -class CLayerCollision *CNpc::m_layerCollision; +#ifndef __VID_HEADER_ +#include "system\vid.h" +#endif -void CNpc::init() +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Friend NPCs +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +class CLayerCollision *CNpcFriend::m_layerCollision; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcFriend::init() +{ + CNpcThing::init(); + + sActorHdr *Hdr=m_skel.Load(ACTORS_SPONGEBOB_A3D); + m_skel.Init(Hdr); + TPLoadTex(ACTORS_ACTOR_SPONGEBOB_TEX); + m_skel.setAnimDatabase(CAnimDB::Load(ACTORS_SPONGEBOB_ABK)); + + Pos.vx = 100; + Pos.vy = 100; + + m_extension = EXTEND_RIGHT; + + // temporary + m_animNo = 0; + m_frame = 0; + + m_type = NPC_FRIEND_GARY; + + //m_spriteBank=new ("enemy sprites") SpriteBank(); + //m_spriteBank->load(UI_UIGFX_SPR); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcFriend::shutdown() +{ + //m_spriteBank->dump(); delete m_spriteBank; + + CNpcThing::shutdown(); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcFriend::think(int _frames) +{ + CNpcThing::think(_frames); + + switch( m_data[m_type].movementFunc ) + { + case NPC_FRIEND_MOVEMENT_GARY: + processGaryMovement( _frames ); + + break; + + case NPC_FRIEND_MOVEMENT_STATIC: + default: + break; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcFriend::render() +{ + CNpcThing::render(); + + // Render + DVECTOR renderPos; + DVECTOR offset = CLevel::getCameraPos(); + + renderPos.vx = ( Pos.vx - offset.vx - ( VidGetScrW() >> 1 ) ) * 20; + renderPos.vy = ( Pos.vy - offset.vy - ( VidGetScrH() >> 1 ) ) * 20; + + m_skel.setPos( renderPos ); + m_skel.setFrame(m_frame); + m_skel.setAnimNo(m_animNo); + m_skel.Animate(this); + m_skel.Render(this); + + /*s32 x,y; + s32 scrnWidth = VidGetScrW(); + s32 scrnHeight = VidGetScrH(); + s32 spriteWidth = m_spriteBank->getFrameWidth(FRM_BARNACLEBOY); + s32 spriteHeight = m_spriteBank->getFrameHeight(FRM_BARNACLEBOY); + + x = Pos.vx - offset.vx - ( spriteWidth >> 1 ); + y = Pos.vy - offset.vy - ( spriteHeight >> 1 ); + + //if ( x < -spriteWidth || y < -spriteHeight || x > scrnWidth || y > scrnHeight ) + //{ + //return; + //} + + m_spriteBank->printFT4(FRM_BARNACLEBOY,x,y,0,0,0);*/ +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcFriend::processEvent( GAME_EVENT evt, CThing *sourceThing ) +{ + switch( evt ) + { + case USER_REQUEST_TALK_EVENT: + { + if ( m_data[this->m_type].canTalk ) + { + DVECTOR sourcePos; + s32 xDiffSqr, yDiffSqr; + + // check talk distance + + sourcePos = sourceThing->getPos(); + + xDiffSqr = this->Pos.vx - sourcePos.vx; + xDiffSqr *= xDiffSqr; + + yDiffSqr = this->Pos.vy - sourcePos.vy; + yDiffSqr *= yDiffSqr; + + if ( xDiffSqr + yDiffSqr < 10000 ) + { + if( !CConversation::isActive() ) + { + CConversation::trigger( SCRIPTS_SPEECHTEST_DAT ); + } + } + } + + break; + } + + default: + // ignore + + break; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Enemy NPCs +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +s32 CNpcEnemy::playerXDist; +s32 CNpcEnemy::playerYDist; +s32 CNpcEnemy::playerXDistSqr; +s32 CNpcEnemy::playerYDistSqr; +class CLayerCollision *CNpcEnemy::m_layerCollision; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::init() { CEnemyThing::init(); + sActorHdr *Hdr=m_skel.Load(ACTORS_SPONGEBOB_A3D); + m_skel.Init(Hdr); + TPLoadTex(ACTORS_ACTOR_SPONGEBOB_TEX); + m_skel.setAnimDatabase(CAnimDB::Load(ACTORS_SPONGEBOB_ABK)); + + // temporary + m_animNo = 0; + m_frame = 0; + m_type = NPC_CIRCULAR_PLATFORM; m_heading = m_fireHeading = 0; @@ -278,16 +437,18 @@ m_npcPath.initPath(); } } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void CNpc::shutdown() +void CNpcEnemy::shutdown() { m_npcPath.removeAllWaypoints(); CEnemyThing::shutdown(); } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void CNpc::think(int _frames) +void CNpcEnemy::think(int _frames) { CEnemyThing::think(_frames); @@ -333,8 +494,9 @@ void CNpc::think(int _frames) processTimer(_frames); } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void CNpc::detectCollisionWithPlayer() +void CNpcEnemy::detectCollisionWithPlayer() { if ( m_data[m_type].detectCollision && playerXDistSqr + playerYDistSqr < 400 ) { @@ -345,8 +507,9 @@ void CNpc::detectCollisionWithPlayer() } } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool CNpc::processSensor() +bool CNpcEnemy::processSensor() { switch( m_sensorFunc ) { @@ -650,7 +813,9 @@ bool CNpc::processSensor() } } -void CNpc::processMovement(int _frames) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::processMovement(int _frames) { if ( _frames > 2 ) { @@ -738,13 +903,6 @@ void CNpc::processMovement(int _frames) break; } - case NPC_MOVEMENT_GARY: - { - processGaryMovement( _frames ); - } - - break; - default: break; @@ -753,7 +911,9 @@ void CNpc::processMovement(int _frames) processMovementModifier( _frames, moveX, moveY, moveVel, moveDist ); } -void CNpc::processMovementModifier(int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::processMovementModifier(int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange) { switch( m_data[m_type].movementModifierFunc ) { @@ -793,11 +953,15 @@ void CNpc::processMovementModifier(int _frames, s32 distX, s32 distY, s32 dist, } } -void CNpc::processShot() +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::processShot() { } -void CNpc::processClose(int _frames) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::processClose(int _frames) { switch( m_data[this->m_type].closeFunc ) { @@ -908,7 +1072,9 @@ void CNpc::processClose(int _frames) } } -void CNpc::processCollision() +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::processCollision() { CPlayer *player = GameScene.getPlayer(); @@ -917,7 +1083,9 @@ void CNpc::processCollision() m_controlFunc = m_oldControlFunc; } -void CNpc::processTimer(int _frames) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::processTimer(int _frames) { if ( m_timerTimer > 0 ) { @@ -948,12 +1116,29 @@ void CNpc::processTimer(int _frames) } } -void CNpc::render() +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::render() { CEnemyThing::render(); + + // Render + DVECTOR renderPos; + DVECTOR offset = CLevel::getCameraPos(); + + renderPos.vx = ( Pos.vx - offset.vx ) * 20; + renderPos.vy = ( Pos.vy - offset.vy ) * 20; + + m_skel.setPos( renderPos ); + m_skel.setFrame(m_frame); + m_skel.setAnimNo(m_animNo); + m_skel.Animate(this); + m_skel.Render(this); } -void CNpc::processEvent( GAME_EVENT evt, CThing *sourceThing ) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemy::processEvent( GAME_EVENT evt, CThing *sourceThing ) { switch( evt ) { diff --git a/source/enemy/npc.h b/source/enemy/npc.h index db3f3ec2c..10edbce8c 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -30,17 +30,87 @@ #include "player\player.h" #endif +// temporary +#ifndef __GFX_SPRBANK_H__ +#include "gfx\sprbank.h" +#endif + /*****************************************************************************/ -class CNpc : public CEnemyThing +class CNpcFriend : public CNpcThing +{ +public: + enum NPC_FRIEND_UNIT_TYPE + { + NPC_FRIEND_SANDY_CHEEKS = 0, + NPC_FRIEND_GARY = 1, + NPC_FRIEND_UNIT_TYPE_MAX, + }; + + void init(); + void shutdown(); + void think(int _frames); + virtual void render(); + void processEvent( GAME_EVENT evt, CThing *sourceThing ); + void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;} + +protected: + enum NPC_FRIEND_MOVEMENT_FUNC + { + NPC_FRIEND_MOVEMENT_STATIC = 0, + NPC_FRIEND_MOVEMENT_GARY = 1, + }; + + typedef struct NPC_FRIEND_DATA_TYPE + { + //NPC_FRIEND_INIT_FUNC initFunc; + //NPC_FRIEND_SENSOR_FUNC sensorFunc; + NPC_FRIEND_MOVEMENT_FUNC movementFunc; + //NPC_FRIEND_MOVEMENT_MODIFIER_FUNC movementModifierFunc; + //NPC_FRIEND_CLOSE_FUNC closeFunc; + //NPC_FRIEND_TIMER_FUNC timerFunc; + bool canTalk; + u8 speed; + u16 turnSpeed; + bool detectCollision; + DAMAGE_TYPE damageToUserType; + } + NPC_FRIEND_DATA; + + // gary functions + + void processGaryMovement( int _frames ); + + // data + + static NPC_FRIEND_DATA m_data[NPC_FRIEND_UNIT_TYPE_MAX]; + + static class CLayerCollision *m_layerCollision; + //class SpriteBank *m_spriteBank; + + enum + { + EXTEND_RIGHT = true, + EXTEND_LEFT = false, + }; + + // internal variables + + NPC_FRIEND_UNIT_TYPE m_type; + s32 m_extension; + + int m_frame; + int m_animNo; + CSkel m_skel; +}; + +class CNpcEnemy : public CEnemyThing { public: enum NPC_UNIT_TYPE { - NPC_SANDY_CHEEKS = 0, - NPC_GARY = 1, - NPC_FALLING_ITEM, - NPC_FISH_HOOK, + NPC_FALLING_ITEM = 0, + NPC_FISH_HOOK = 1, NPC_DUST_DEVIL, NPC_PENDULUM, NPC_FIREBALL, @@ -182,7 +252,6 @@ protected: NPC_MOVEMENT_FIREBALL, NPC_MOVEMENT_RETURNING_HAZARD, NPC_MOVEMENT_CLAM_RETRACT, - NPC_MOVEMENT_GARY, }; enum NPC_MOVEMENT_MODIFIER_FUNC @@ -371,10 +440,6 @@ protected: void processFireballMovement( int _frames ); void processReturningHazardMovement( int _frames ); - // gary functions - - void processGaryMovement( int _frames ); - // data static NPC_DATA m_data[NPC_UNIT_TYPE_MAX]; @@ -407,6 +472,10 @@ protected: DVECTOR m_base; u8 m_state; u8 m_salvoCount; + + int m_frame; + int m_animNo; + CSkel m_skel; }; diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index cf449e3d7..0bfd78d61 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -20,15 +20,15 @@ #endif -CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = +CNpcFriend::NPC_FRIEND_DATA CNpcFriend::m_data[NPC_FRIEND_UNIT_TYPE_MAX] = { { // NPC_SANDY_CHEEKS - NPC_INIT_DEFAULT, - NPC_SENSOR_NONE, - NPC_MOVEMENT_STATIC, - NPC_MOVEMENT_MODIFIER_NONE, - NPC_CLOSE_NONE, - NPC_TIMER_NONE, + //NPC_FRIEND_INIT_DEFAULT, + //NPC_FRIEND_SENSOR_NONE, + NPC_FRIEND_MOVEMENT_STATIC, + //NPC_FRIEND_MOVEMENT_MODIFIER_NONE, + //NPC_FRIEND_CLOSE_NONE, + //NPC_FRIEND_TIMER_NONE, true, 3, 128, @@ -37,19 +37,22 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = }, { // NPC_GARY - NPC_INIT_DEFAULT, - NPC_SENSOR_NONE, - NPC_MOVEMENT_GARY, - NPC_MOVEMENT_MODIFIER_NONE, - NPC_CLOSE_NONE, - NPC_TIMER_NONE, + //NPC_FRIEND_INIT_DEFAULT, + //NPC_FRIEND_SENSOR_NONE, + NPC_FRIEND_MOVEMENT_GARY, + //NPC_FRIEND_MOVEMENT_MODIFIER_NONE, + //NPC_FRIEND_CLOSE_NONE, + //NPC_FRIEND_TIMER_NONE, false, 3, 2048, false, DAMAGE__HIT_ENEMY, }, +}; +CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = +{ { // NPC_FALLING_ITEM NPC_INIT_DEFAULT, NPC_SENSOR_FALLING_ITEM_USER_CLOSE, diff --git a/source/enemy/nscrab.cpp b/source/enemy/nscrab.cpp index 29ac680c1..c6e505570 100644 --- a/source/enemy/nscrab.cpp +++ b/source/enemy/nscrab.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processCloseSpiderCrabAttack( int _frames ) +void CNpcEnemy::processCloseSpiderCrabAttack( int _frames ) { s32 velocity; DVECTOR newPos = Pos; diff --git a/source/enemy/nshrkman.cpp b/source/enemy/nshrkman.cpp index e9c19ba83..57aba3885 100644 --- a/source/enemy/nshrkman.cpp +++ b/source/enemy/nshrkman.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processCloseSharkManAttack( int _frames ) +void CNpcEnemy::processCloseSharkManAttack( int _frames ) { s32 moveX = 0, moveY = 0; s32 groundHeight; diff --git a/source/enemy/nsjfish.cpp b/source/enemy/nsjfish.cpp index cdeb15c39..f9c2a655e 100644 --- a/source/enemy/nsjfish.cpp +++ b/source/enemy/nsjfish.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processSmallJellyfishMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ) +void CNpcEnemy::processSmallJellyfishMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ) { s32 newX, newY; s32 preShiftX, preShiftY; @@ -100,7 +100,7 @@ void CNpc::processSmallJellyfishMovementModifier( int _frames, s32 distX, s32 di Pos.vy += newY; } -void CNpc::processCloseSmallJellyfishEvade( int _frames ) +void CNpcEnemy::processCloseSmallJellyfishEvade( int _frames ) { s32 moveX = 0, moveY = 0; diff --git a/source/enemy/nsklfish.cpp b/source/enemy/nsklfish.cpp index 0b77a254f..8ea943469 100644 --- a/source/enemy/nsklfish.cpp +++ b/source/enemy/nsklfish.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processCloseSkeletalFishAttack( int _frames ) +void CNpcEnemy::processCloseSkeletalFishAttack( int _frames ) { s32 moveX, moveY; s16 decDir, incDir, moveDist; diff --git a/source/enemy/nsshark.cpp b/source/enemy/nsshark.cpp index ce29ccda9..5d2d11072 100644 --- a/source/enemy/nsshark.cpp +++ b/source/enemy/nsshark.cpp @@ -27,7 +27,7 @@ #include "projectl\projectl.h" #endif -void CNpc::processSubSharkMovement( int _frames ) +void CNpcEnemy::processSubSharkMovement( int _frames ) { if ( m_timerTimer <= 0 ) { @@ -84,7 +84,7 @@ void CNpc::processSubSharkMovement( int _frames ) } } -void CNpc::processCloseSubSharkAttack( int _frames ) +void CNpcEnemy::processCloseSubSharkAttack( int _frames ) { if ( playerXDist > 0 ) { diff --git a/source/enemy/nsstomp.cpp b/source/enemy/nsstomp.cpp index 816157034..af37a452c 100644 --- a/source/enemy/nsstomp.cpp +++ b/source/enemy/nsstomp.cpp @@ -24,7 +24,7 @@ #endif -void CNpc::processCloseSkullStomperAttack( int _frames ) +void CNpcEnemy::processCloseSkullStomperAttack( int _frames ) { s8 groundHeight; s8 yMovement; diff --git a/source/game/game.cpp b/source/game/game.cpp index c3c2ab9f8..a9874d39f 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -100,8 +100,8 @@ void CGameScene::init() Level.init(); #ifdef __USER_charles__ - C2dEnemy *enemy; - enemy=new ("test enemy") C2dEnemy; + CNpcFriend *enemy; + enemy=new ("test enemy") CNpcFriend; enemy->init(); enemy->setLayerCollision( Level.getCollisionLayer() ); #endif