From 63598d2f7306447bb2cf7e589aac4851783e6102 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 18 Apr 2001 23:12:24 +0000 Subject: [PATCH] --- makefile.gaz | 3 +- source/enemy/ngen.cpp | 26 ++++++ source/enemy/ngen.h | 28 +++++++ source/enemy/npc.cpp | 49 +++++++---- source/enemy/npc.h | 8 +- source/enemy/npcdata.cpp | 27 +++++- source/enemy/npcpath.cpp | 12 ++- source/enemy/npcpath.h | 2 + source/enemy/nscrab.cpp | 83 +++++++++++++++++++ source/game/game.cpp | 78 +++++++++++++---- source/gfx/actor.cpp | 77 ++++++++--------- source/gfx/actor.h | 1 + source/thing/thing.cpp | 18 ++++ source/thing/thing.h | 4 +- tools/Data/bin/MkLevel.ini | 1 + tools/MapEdit/actor.ini | 10 +++ .../spongebob project/spongebob project.dsp | 8 ++ 17 files changed, 363 insertions(+), 72 deletions(-) create mode 100644 source/enemy/ngen.cpp create mode 100644 source/enemy/ngen.h diff --git a/makefile.gaz b/makefile.gaz index 9fa005c7d..166e0daca 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -78,7 +78,8 @@ enemy_src := npc \ nworm \ nhcrab \ nbblob \ - npuffa + npuffa \ + ngen projectl_src := projectl diff --git a/source/enemy/ngen.cpp b/source/enemy/ngen.cpp new file mode 100644 index 000000000..e242ac59b --- /dev/null +++ b/source/enemy/ngen.cpp @@ -0,0 +1,26 @@ +/*========================================================================= + + ngen.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __ENEMY_NGEN_H__ +#include "enemy\ngen.h" +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcEnemyGenerator::render() +{ + // do nothing +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + diff --git a/source/enemy/ngen.h b/source/enemy/ngen.h new file mode 100644 index 000000000..c3e7650d3 --- /dev/null +++ b/source/enemy/ngen.h @@ -0,0 +1,28 @@ +/*========================================================================= + + ngen.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __ENEMY_NGEN_H__ +#define __ENEMY_NGEN_H__ + + +#ifndef __ENEMY_NPC_H__ +#include "enemy\npc.h" +#endif + +class CNpcEnemyGenerator : public CNpcEnemy +{ +public: + void render(); +}; + +#endif \ No newline at end of file diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index e1c61ee8e..27d3fc77f 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -261,6 +261,7 @@ void CNpcEnemy::init() m_timerFunc = m_data[this->m_type].timerFunc; m_sensorFunc = m_data[this->m_type].sensorFunc; + m_movementFunc = m_data[this->m_type].movementFunc; m_controlFunc = NPC_CONTROL_MOVEMENT; @@ -560,6 +561,23 @@ void CNpcEnemy::postInit() 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; @@ -590,6 +608,7 @@ void CNpcEnemy::reinit() m_timerFunc = m_data[this->m_type].timerFunc; m_sensorFunc = m_data[this->m_type].sensorFunc; + m_movementFunc = m_data[this->m_type].movementFunc; m_controlFunc = NPC_CONTROL_MOVEMENT; @@ -623,18 +642,6 @@ void CNpcEnemy::shutdown() delete m_actorGfx; - // remove child elements - - CThing *List = this->getNext(); - - while ( List ) - { - CThing *Next = List->getNext(); - List->shutdown(); - - List = Next; - } - CEnemyThing::shutdown(); } @@ -1156,7 +1163,7 @@ void CNpcEnemy::processMovement(int _frames) s32 moveVel = 0; s32 moveDist = 0; - switch( m_data[this->m_type].movementFunc ) + switch( m_movementFunc ) { case NPC_MOVEMENT_STATIC: { @@ -1280,6 +1287,20 @@ 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; @@ -1735,4 +1756,4 @@ void CNpcEnemy::caughtWithNet() { shutdown(); } -} \ No newline at end of file +} diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 4492d8d29..11a60b4e6 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -138,6 +138,7 @@ public: NPC_MINE, NPC_BOOGER_MONSTER, NPC_SPIDER_CRAB, + NPC_SPIDER_CRAB_SPAWNER, NPC_EYEBALL, NPC_BABY_OCTOPUS, NPC_ZOMBIE_FISH_FOLK, @@ -209,6 +210,7 @@ protected: NPC_INIT_EYEBALL, NPC_INIT_BALL_BLOB, NPC_INIT_ANEMONE_2, + NPC_INIT_SPIDER_CRAB, }; enum NPC_CONTROL_FUNC @@ -292,6 +294,8 @@ protected: NPC_MOVEMENT_SHARK_MAN, NPC_MOVEMENT_BALL_BLOB, NPC_MOVEMENT_RETURNING_HAZARD_GROUND, + NPC_MOVEMENT_SPIDER_CRAB_SPAWNER, + NPC_MOVEMENT_SPIDER_CRAB_INITJUMP, }; enum NPC_MOVEMENT_MODIFIER_FUNC @@ -489,6 +493,8 @@ protected: void processCloseSpiderCrabAttack( int _frames ); void processSpiderCrabCollision(); + void processSpiderCrabSpawnerMovement( int _frames ); + void processSpiderCrabInitJumpMovement( int _frames ); // hermit crab functions @@ -586,6 +592,7 @@ protected: NPC_CONTROL_FUNC m_oldControlFunc; NPC_TIMER_FUNC m_timerFunc; NPC_SENSOR_FUNC m_sensorFunc; + NPC_MOVEMENT_FUNC m_movementFunc; CNpcPath m_npcPath; s32 m_heading; s32 m_fireHeading; @@ -625,6 +632,5 @@ protected: CNpcPositionHistory *m_positionHistory; }; - /*****************************************************************************/ #endif diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 5c81af565..b395a12f6 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -870,7 +870,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SPIDER_CRAB ACTORS_SPIDERCRAB_SBK, ANIM_SPIDERCRAB_IDLE, - NPC_INIT_DEFAULT, + NPC_INIT_SPIDER_CRAB, NPC_SENSOR_SPIDER_CRAB_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH_WALK, NPC_MOVEMENT_MODIFIER_NONE, @@ -891,6 +891,30 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = false, }, + { // NPC_SPIDER_CRAB_SPAWNER + ACTORS_SPIDERCRAB_SBK, + ANIM_SPIDERCRAB_IDLE, + NPC_INIT_DEFAULT, + NPC_SENSOR_NONE, + NPC_MOVEMENT_SPIDER_CRAB_SPAWNER, + NPC_MOVEMENT_MODIFIER_NONE, + NPC_CLOSE_NONE, + NPC_TIMER_NONE, + false, + 3, + 2048, + DETECT_NO_COLLISION, + DAMAGE__PINCH_ENEMY, + 0, + ANIM_SPIDERCRAB_RUN, + NPC_SHOT_NONE, + ANIM_SPIDERCRAB_DIE, + ANIM_SPIDERCRAB_HIT, + NPC_COLLISION_GENERIC, + false, + false, + }, + { // NPC_EYEBALL ACTORS_EYEBALL_SBK, ANIM_EYEBALL_STALK, @@ -1330,6 +1354,7 @@ CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::mapEditConvertTable[NPC_UNIT_TYPE_MAX] = NPC_SQUID_DART, NPC_SKULL_STOMPER, NPC_DUST_DEVIL, + NPC_SPIDER_CRAB_SPAWNER, NPC_FALLING_ITEM, NPC_FISH_HOOK, NPC_PENDULUM, diff --git a/source/enemy/npcpath.cpp b/source/enemy/npcpath.cpp index e52d630e7..19faae214 100644 --- a/source/enemy/npcpath.cpp +++ b/source/enemy/npcpath.cpp @@ -147,6 +147,11 @@ void CNpcPath::setPathType( u8 newPathType ) pathType = (NPC_PATH_TYPE) newPathType; } +u8 CNpcPath::getPathType() +{ + return( pathType ); +} + bool CNpcPath::incPath() { if ( !reversePath ) @@ -349,4 +354,9 @@ bool CNpcPath::thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX } return( pointChange ); -} \ No newline at end of file +} + +CNpcWaypoint *CNpcPath::getWaypointList() +{ + return( waypoint ); +} diff --git a/source/enemy/npcpath.h b/source/enemy/npcpath.h index 9242d357a..168791dc3 100644 --- a/source/enemy/npcpath.h +++ b/source/enemy/npcpath.h @@ -40,6 +40,7 @@ public: void addWaypoint( DVECTOR newPos ); void removeAllWaypoints(); void setPathType( u8 newPathType ); + u8 getPathType(); bool incPath(); void resetPath(); void reversePathDir(); @@ -49,6 +50,7 @@ public: bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY ); void getPathXExtents( s32 *minExtent, s32 *maxExtent ); void getPathYExtents( s32 *minExtent, s32 *maxExtent ); + CNpcWaypoint *getWaypointList(); private: CNpcWaypoint *waypoint; diff --git a/source/enemy/nscrab.cpp b/source/enemy/nscrab.cpp index aa2dbcda4..07673989d 100644 --- a/source/enemy/nscrab.cpp +++ b/source/enemy/nscrab.cpp @@ -146,4 +146,87 @@ void CNpcEnemy::processSpiderCrabCollision() m_controlFunc = m_oldControlFunc; } +} + +void CNpcEnemy::processSpiderCrabInitJumpMovement( int _frames ) +{ + s32 velocity; + bool completed = false; + bool collision = false; + + if ( m_animNo != ANIM_SPIDERCRAB_JUMP ) + { + m_animPlaying = true; + m_animNo = ANIM_SPIDERCRAB_JUMP; + m_frame = 0; + } + + velocity = m_velocity * _frames; + + m_extension += velocity; + + if ( m_extension > 128 ) + { + m_extension = 128; + completed = true; + } + + Pos.vy = m_base.vy - ( ( 50 * rsin( abs( m_extension ) << 4 ) ) >> 12 ); + + if ( m_extension > 64 ) + { + // check for collision on the way back down + + if ( m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy ) < 0 ) + { + collision = true; + } + } + + if ( completed || collision ) + { + m_movementFunc = m_data[m_type].movementFunc; + } +} + +void CNpcEnemy::processSpiderCrabSpawnerMovement( int _frames ) +{ + if ( getNumChildren() < 3 ) + { + m_movementTimer -= _frames; + + if ( m_movementTimer < 0 ) + { + 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 ); + } + } } \ No newline at end of file diff --git a/source/game/game.cpp b/source/game/game.cpp index adc2465aa..82004704b 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -27,6 +27,10 @@ #include "enemy\npc.h" #endif +#ifndef __ENEMY_NGEN_H__ +#include "enemy\ngen.h" +#endif + #ifndef __ENEMY_NPLATFRM_H__ #include "enemy\nplatfrm.h" #endif @@ -109,7 +113,7 @@ const s32 Scale = (512<<12)/(256); /*****************************************************************************/ void CGameScene::init() -{ +{ // Setup Constant Camera Matrix SetIdentNoTrans(&CamMtx); CamMtx.t[2]=ZPos; @@ -159,7 +163,7 @@ void CGameScene::shutdown() { // CFileIO::EnableASync(false); shutdownLevel(); - CSoundMediator::dumpSong(); + CSoundMediator::dumpSong(); m_pauseMenu->shutdown(); delete m_pauseMenu; s_genericFont->dump(); delete s_genericFont; @@ -179,7 +183,7 @@ void CGameScene::render() /*****************************************************************************/ void CGameScene::think(int _frames) { -//#ifdef __USER_paul__ +//#ifdef __USER_paul__ // if(!CConversation::isActive()&&PadGetDown(0)&PAD_START) // { // CConversation::trigger(SCRIPTS_SPEECHTEST_DAT); @@ -201,7 +205,7 @@ void CGameScene::think(int _frames) s_levelFinished=false; } - + if(!m_pauseMenu->isActive()&&PadGetDown(0)&PAD_START&&canPause()) { m_pauseMenu->select(); @@ -217,7 +221,7 @@ void CGameScene::think(int _frames) //PKG // if(camPos.vx<0){camPos.vx=0;PAUL_DBGMSG("cx<0");} // if(camPos.vy<0){camPos.vy=0;PAUL_DBGMSG("cy<0");} -//PKG +//PKG /* if (!s_levelFinished) */CBubicleFactory::setMapOffset(&camPos); /* if (!s_levelFinished) */Level.setCameraCentre(camPos); /* if (!s_levelFinished) */Level.think(_frames); @@ -268,15 +272,15 @@ void CGameScene::initLevel() pos.vx+=64; createPickup(PICKUP__LIFE,&pos); pos.vx+=64; createPickup(PICKUP__SPATULA,&pos); pos.vx+=64; createPickup(PICKUP__JELLY_LAUNCHER_AMMO,&pos); - pos.vx+=64; createPickup(PICKUP__BUBBLE_MIXTURE,&pos); - pos.vx+=64; createPickup(PICKUP__BUBBLE_WAND,&pos); - pos.vx+=64; createPickup(PICKUP__NET,&pos); - pos.vx+=64; createPickup(PICKUP__GLASSES,&pos); - pos.vx+=64; createPickup(PICKUP__SQUEAKY_SHOES,&pos); - pos.vx+=64; createPickup(PICKUP__BALLOON,&pos); - pos.vx+=64; createPickup(PICKUP__HELMET,&pos); - pos.vx+=64; createPickup(PICKUP__CORAL_BLOWER,&pos); - pos.vx+=64; createPickup(PICKUP__QUEST_ITEM__TEST,&pos); + pos.vx+=64; createPickup(PICKUP__BUBBLE_MIXTURE,&pos); + pos.vx+=64; createPickup(PICKUP__BUBBLE_WAND,&pos); + pos.vx+=64; createPickup(PICKUP__NET,&pos); + pos.vx+=64; createPickup(PICKUP__GLASSES,&pos); + pos.vx+=64; createPickup(PICKUP__SQUEAKY_SHOES,&pos); + pos.vx+=64; createPickup(PICKUP__BALLOON,&pos); + pos.vx+=64; createPickup(PICKUP__HELMET,&pos); + pos.vx+=64; createPickup(PICKUP__CORAL_BLOWER,&pos); + pos.vx+=64; createPickup(PICKUP__QUEST_ITEM__TEST,&pos); // CNpcPlatform *platform; // platform=new ("test platform") CNpcPlatform; @@ -351,6 +355,50 @@ void CGameScene::initLevel() break; } + case CActorPool::ACTOR_ENEMY_GENERATOR_NPC: + { + CNpcEnemyGenerator *enemy; + enemy = new ("npc enemy generator") CNpcEnemyGenerator; + ASSERT(enemy); + enemy->setTypeFromMapEdit( actorList[actorNum]->Type ); + enemy->init(); + enemy->setLayerCollision( Level.getCollisionLayer() ); + + u16 *PntList=(u16*)MakePtr(actorList[actorNum],sizeof(sThingActor)); + + u16 newXPos, newYPos; + + newXPos = (u16) *PntList; + PntList++; + newYPos = (u16) *PntList; + PntList++; + + enemy->setStartPos( newXPos, newYPos ); + enemy->addWaypoint( newXPos, newYPos ); + + if ( actorList[actorNum]->PointCount > 1 ) + { + for ( pointNum = 1 ; pointNum < actorList[actorNum]->PointCount ; pointNum++ ) + { + newXPos = (u16) *PntList; + PntList++; + newYPos = (u16) *PntList; + PntList++; + + enemy->addWaypoint( newXPos, newYPos ); + + if ( pointNum == 1 ) + { + enemy->setHeading( newXPos, newYPos ); + } + } + } + + enemy->postInit(); + + break; + } + default: break; } @@ -418,4 +466,4 @@ void CGameScene::shutdownLevel() Level.shutdown(); } -/*****************************************************************************/ +/*****************************************************************************/ \ No newline at end of file diff --git a/source/gfx/actor.cpp b/source/gfx/actor.cpp index 77bef0235..108fedd87 100644 --- a/source/gfx/actor.cpp +++ b/source/gfx/actor.cpp @@ -18,46 +18,47 @@ int ShadowYOfs=32; /*****************************************************************************/ -CActorPool::ACTOR_TYPE CActorPool::actorType[38] = +CActorPool::ACTOR_TYPE CActorPool::actorType[39] = { - ACTOR_PLAYER, //SpongeBob=0 - ACTOR_FRIEND_NPC, //BarnacleBoy=1 - ACTOR_FRIEND_NPC, //Gary=2 - ACTOR_FRIEND_NPC, //Krusty=3 - ACTOR_FRIEND_NPC, //MermaidMan=4 - ACTOR_FRIEND_NPC, //Patrick=5 - ACTOR_FRIEND_NPC, //Sandy=6 - ACTOR_FRIEND_NPC, //Squidward=7 - ACTOR_FRIEND_NPC, //Plankton=8 + ACTOR_PLAYER, //SpongeBob=0 + ACTOR_FRIEND_NPC, //BarnacleBoy=1 + ACTOR_FRIEND_NPC, //Gary=2 + ACTOR_FRIEND_NPC, //Krusty=3 + ACTOR_FRIEND_NPC, //MermaidMan=4 + ACTOR_FRIEND_NPC, //Patrick=5 + ACTOR_FRIEND_NPC, //Sandy=6 + ACTOR_FRIEND_NPC, //Squidward=7 + ACTOR_FRIEND_NPC, //Plankton=8 ACTOR_UNKNOWN, - ACTOR_ENEMY_NPC, //SmallJellyfish-Level1=10 - ACTOR_ENEMY_NPC, //SmallJellyfish-Level2=11 - ACTOR_ENEMY_NPC, //Motherjellyfish=12 - ACTOR_ENEMY_NPC, //Anenome-Level1=13 - ACTOR_ENEMY_NPC, //SpikeyAnenome=14 - ACTOR_ENEMY_NPC, //Anenome-Level3=15 - ACTOR_ENEMY_NPC, //BabyOctopus=16 - ACTOR_ENEMY_NPC, //Ballblob=17 - ACTOR_ENEMY_NPC, //Boogermonster=18 - ACTOR_ENEMY_NPC, //Caterpillar=19 - ACTOR_ENEMY_NPC, //Clam-Level1=20 - ACTOR_ENEMY_NPC, //Clam-Level2=21 - ACTOR_ENEMY_NPC, //Eyeball=22 - ACTOR_ENEMY_NPC, //Flamingskull=23 - ACTOR_ENEMY_NPC, //FlyingDutchman=24 - ACTOR_ENEMY_NPC, //Ghost=25 - ACTOR_ENEMY_NPC, //GiantWorm=26 - ACTOR_ENEMY_NPC, //HermitCrab=27 - ACTOR_ENEMY_NPC, //IronDogFish=28 - ACTOR_ENEMY_NPC, //PuffaFish=29 - ACTOR_ENEMY_NPC, //SeaSnake=30 - ACTOR_ENEMY_NPC, //Sharkman=31 - ACTOR_ENEMY_NPC, //SharkSub=32 - ACTOR_ENEMY_NPC, //Skeletalfish=33 - ACTOR_ENEMY_NPC, //SpiderCrab=34 - ACTOR_ENEMY_NPC, //Squiddart=35 - ACTOR_ENEMY_NPC, //Stomper=36 - ACTOR_ENEMY_NPC, //DustDevil=37 + ACTOR_ENEMY_NPC, //SmallJellyfish-Level1=10 + ACTOR_ENEMY_NPC, //SmallJellyfish-Level2=11 + ACTOR_ENEMY_NPC, //Motherjellyfish=12 + ACTOR_ENEMY_NPC, //Anenome-Level1=13 + ACTOR_ENEMY_NPC, //SpikeyAnenome=14 + ACTOR_ENEMY_NPC, //Anenome-Level3=15 + ACTOR_ENEMY_NPC, //BabyOctopus=16 + ACTOR_ENEMY_NPC, //Ballblob=17 + ACTOR_ENEMY_NPC, //Boogermonster=18 + ACTOR_ENEMY_NPC, //Caterpillar=19 + ACTOR_ENEMY_NPC, //Clam-Level1=20 + ACTOR_ENEMY_NPC, //Clam-Level2=21 + ACTOR_ENEMY_NPC, //Eyeball=22 + ACTOR_ENEMY_NPC, //Flamingskull=23 + ACTOR_ENEMY_NPC, //FlyingDutchman=24 + ACTOR_ENEMY_NPC, //Ghost=25 + ACTOR_ENEMY_NPC, //GiantWorm=26 + ACTOR_ENEMY_NPC, //HermitCrab=27 + ACTOR_ENEMY_NPC, //IronDogFish=28 + ACTOR_ENEMY_NPC, //PuffaFish=29 + ACTOR_ENEMY_NPC, //SeaSnake=30 + ACTOR_ENEMY_NPC, //Sharkman=31 + ACTOR_ENEMY_NPC, //SharkSub=32 + ACTOR_ENEMY_NPC, //Skeletalfish=33 + ACTOR_ENEMY_NPC, //SpiderCrab=34 + ACTOR_ENEMY_NPC, //Squiddart=35 + ACTOR_ENEMY_NPC, //Stomper=36 + ACTOR_ENEMY_NPC, //DustDevil=37 + ACTOR_ENEMY_GENERATOR_NPC, //SiderCrabSpawner=38 }; /*****************************************************************************/ diff --git a/source/gfx/actor.h b/source/gfx/actor.h index 4fd692a5a..888a223b6 100644 --- a/source/gfx/actor.h +++ b/source/gfx/actor.h @@ -69,6 +69,7 @@ public: ACTOR_PLAYER = 0, ACTOR_FRIEND_NPC = 1, ACTOR_ENEMY_NPC, + ACTOR_ENEMY_GENERATOR_NPC, ACTOR_UNKNOWN, }; diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index 373fc763b..0d37dae25 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -354,6 +354,7 @@ void CThing::init() { Parent=NULL; Next=NULL; + m_numChildren = 0; Pos.vx=Pos.vy=10; @@ -511,12 +512,14 @@ CThing *List=Next; } List->Next=Child; Child->Parent=this; + m_numChildren++; } else { // List does not exist, create Next = Child; Child->Parent=this; + m_numChildren++; } } @@ -552,6 +555,8 @@ CThing *Last=NULL; this->Next = List->Next; } + m_numChildren--; + Child->Parent=NULL; } @@ -573,6 +578,19 @@ CThing *List=Next; List=Next; } Next=NULL; + + m_numChildren = 0; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int CThing::getNumChildren() +{ + return( m_numChildren ); } /*---------------------------------------------------------------------- diff --git a/source/thing/thing.h b/source/thing/thing.h index e5b3f8f59..72f012511 100644 --- a/source/thing/thing.h +++ b/source/thing/thing.h @@ -106,6 +106,7 @@ public: void removeChild(CThing *Child); void removeAllChild(); bool hasChild(CThing *Child); + int getNumChildren(); DVECTOR getPos() {return Pos;} @@ -122,7 +123,8 @@ protected: // Linkage CThing *Parent,*Next; - +// Count + int m_numChildren; // Pos DVECTOR Pos, PosLast, PosDelta; diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index 36d7fc61b..84f7371e6 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -49,6 +49,7 @@ SpiderCrab=34 Squiddart=35 Stomper=36 DustDevil=37 +SpiderCrabSpawner=38 ################################################ diff --git a/tools/MapEdit/actor.ini b/tools/MapEdit/actor.ini index f164d8c1d..4fe012001 100644 --- a/tools/MapEdit/actor.ini +++ b/tools/MapEdit/actor.ini @@ -352,3 +352,13 @@ TurnRate=0 Collision=0 Health=0 AttackStrength=20 + +[SpiderCrabSpawner] +Gfx=..\..\graphics\characters\spidercrab\render\psx\SpiderCrab_Idle0001.bmp +WayPoints=16 +Speed=3 +TurnRate=0 +Collision=1 +Health=2 +# 1st shot stuns, if shot again is killed +AttackStrength=20 diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index e4da275c2..0ef76e60b 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -149,6 +149,14 @@ SOURCE=..\..\..\source\enemy\ngary.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\ngen.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\enemy\ngen.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\ngeneric.cpp # End Source File # Begin Source File