This commit is contained in:
Daveo 2001-04-20 15:43:35 +00:00
parent b3375f03ae
commit 908b4f408b
6 changed files with 278 additions and 238 deletions

View File

@ -122,14 +122,12 @@ actors/FLYINGDUTCHMAN.SBK
actors/GHOST.SBK
actors/HERMITCRAB.SBK
actors/IRONDOGFISH.SBK
actors/JELLYFISH1.SBK
actors/LRGJELLYFISH.SBK
actors/PUFFAFISH.SBK
actors/SHARKMAN.SBK
actors/SKELETALFISH.SBK
actors/SPIDERCRAB.SBK
actors/SPIKEYANENOME.SBK
actors/SQUIDDART.SBK
actors/STOMPER.SBK

View File

@ -52,6 +52,69 @@
#include "projectl\projectl.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __ENEMY_NSJFISH_H__
#include "enemy\nsjfish.h"
#endif
#ifndef __ENEMY_NHCRAB_H__
#include "enemy\nhcrab.h"
#endif
#ifndef __ENEMY_NSCRAB_H__
#include "enemy\nscrab.h"
#endif
#ifndef __ENEMY_NGEN_H__
#include "enemy\ngen.h"
#endif
#ifndef __ENEMY_NANEMONE_H__
#include "enemy\nanemone.h"
#endif
#ifndef __ENEMY_NCLAM_H__
#include "enemy\nclam.h"
#endif
#ifndef __ENEMY_NOCTO_H__
#include "enemy\nocto.h"
#endif
#ifndef __ENEMY_NFFOLK_H__
#include "enemy\nffolk.h"
#endif
#ifndef __ENEMY_NBBLOB_H__
#include "enemy\nbblob.h"
#endif
#ifndef __ENEMY_NGPIRATE_H__
#include "enemy\ngpirate.h"
#endif
#ifndef __ENEMY_NPUFFA_H__
#include "enemy\npuffa.h"
#endif
#ifndef __ENEMY_NSHRKMAN_H__
#include "enemy\nshrkman.h"
#endif
#ifndef __ENEMY_NSKLFISH_H__
#include "enemy\nsklfish.h"
#endif
#ifndef __ENEMY_NEYEBALL_H__
#include "enemy\neyeball.h"
#endif
#ifndef __ENEMY_NFSKULL_H__
#include "enemy\nfskull.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Friend NPCs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -186,6 +249,7 @@ s32 CNpcEnemy::playerYDist;
s32 CNpcEnemy::playerXDistSqr;
s32 CNpcEnemy::playerYDistSqr;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::getTypeFromMapEdit( u16 newType )
@ -193,6 +257,135 @@ CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::getTypeFromMapEdit( u16 newType )
return( mapEditConvertTable[newType - NPC_ENEMY_MAPEDIT_OFFSET] );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CNpcEnemy *CNpcEnemy::Create(sThingActor *ThisActor)
{
CNpcEnemy *enemy;
CNpcEnemy::NPC_UNIT_TYPE enemyType = CNpcEnemy::getTypeFromMapEdit( ThisActor->Type );
switch( enemyType )
{
case CNpcEnemy::NPC_SMALL_JELLYFISH_1:
{
enemy = new ("small jellyfish") CNpcSmallJellyfishEnemy;
break;
}
case CNpcEnemy::NPC_HERMIT_CRAB:
{
enemy = new ("hermit crab") CNpcHermitCrabEnemy;
break;
}
case CNpcEnemy::NPC_SPIDER_CRAB:
{
enemy = new ("spider crab") CNpcSpiderCrabEnemy;
break;
}
case CNpcEnemy::NPC_SPIDER_CRAB_SPAWNER:
{
enemy = new ("spider crab spawner") CNpcEnemyGenerator;
break;
}
case CNpcEnemy::NPC_ANEMONE_1:
{
enemy = new ("anemone 1") CNpcAnemone1Enemy;
break;
}
case CNpcEnemy::NPC_ANEMONE_2:
{
enemy = new ("anemone 2") CNpcAnemone2Enemy;
break;
}
case CNpcEnemy::NPC_ANEMONE_3:
{
enemy = new ("anemone 3") CNpcAnemone3Enemy;
break;
}
case CNpcEnemy::NPC_CLAM_JUMP:
{
enemy = new ("jumping clam") CNpcJumpingClamEnemy;
break;
}
case CNpcEnemy::NPC_CLAM_STATIC:
{
enemy = new ("static clam") CNpcStaticClamEnemy;
break;
}
case CNpcEnemy::NPC_BABY_OCTOPUS:
{
enemy = new ("baby octopus") CNpcBabyOctopusEnemy;
break;
}
case CNpcEnemy::NPC_FISH_FOLK:
case CNpcEnemy::NPC_ZOMBIE_FISH_FOLK:
{
enemy = new ("fish folk") CNpcFishFolk;
break;
}
case CNpcEnemy::NPC_BALL_BLOB:
{
enemy = new ("ball blob") CNpcBallBlobEnemy;
break;
}
case CNpcEnemy::NPC_GHOST_PIRATE:
{
enemy = new ("ghost pirate") CNpcGhostPirateEnemy;
break;
}
case CNpcEnemy::NPC_PUFFA_FISH:
{
enemy = new ("puffa fish") CNpcPuffaFishEnemy;
break;
}
case CNpcEnemy::NPC_SHARK_MAN:
{
enemy = new ("shark man") CNpcSharkManEnemy;
break;
}
case CNpcEnemy::NPC_SKELETAL_FISH:
{
enemy = new ("skeletal fish") CNpcSkeletalFishEnemy;
break;
}
case CNpcEnemy::NPC_EYEBALL:
{
enemy = new ("eyeball") CNpcEyeballEnemy;
break;
}
case CNpcEnemy::NPC_FLAMING_SKULL:
{
enemy = new ("flaming skull") CNpcFlamingSkullEnemy;
break;
}
default:
{
enemy = new ("npc enemy") CNpcEnemy;
break;
}
}
ASSERT(enemy);
return(enemy);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::setTypeFromMapEdit( u16 newType )
@ -235,8 +428,18 @@ void CNpcEnemy::setHeading( s32 xPos, s32 yPos )
void CNpcEnemy::init()
{
CEnemyThing::init();
if (m_data[m_type].skelType)
{
m_actorGfx=CActorPool::GetActor((FileEquate)m_data[m_type].skelType);
m_spriteBank=0;
m_actorGfx=CActorPool::GetActor(m_data[m_type].skelType);
}
else
{
m_actorGfx=0;
m_spriteBank=new ("enemy sprites") SpriteBank();
m_spriteBank->load(SPRITES_SPRITES_SPR);
}
m_animPlaying = true;
m_animNo = m_data[m_type].initAnim;
@ -597,6 +800,7 @@ void CNpcEnemy::reinit()
void CNpcEnemy::shutdown()
{
if (m_spriteBank) m_spriteBank->dump(); delete m_spriteBank;
// remove waypoints
m_npcPath.removeAllWaypoints();
@ -618,7 +822,7 @@ void CNpcEnemy::shutdown()
m_positionHistory = NULL;
delete m_actorGfx;
if (m_actorGfx) delete m_actorGfx;
CEnemyThing::shutdown();
@ -628,7 +832,7 @@ void CNpcEnemy::shutdown()
void CNpcEnemy::think(int _frames)
{
CEnemyThing::think(_frames);
/* CEnemyThing::think(_frames);
if ( m_isActive )
{
@ -638,7 +842,14 @@ void CNpcEnemy::think(int _frames)
if ( m_animPlaying )
{
s32 frameCount = m_actorGfx->getFrameCount(m_animNo);
s32 frameCount;
// BODGE!!!!!!!!!!!!!!!
if (m_actorGfx)
frameCount= m_actorGfx->getFrameCount(m_animNo);
else
frameCount= 6;
// BODGE END!!!!!!!!!!!
s32 frameShift = ( _frames << 8 ) >> 1;
if ( ( frameCount << 8 ) - m_frame > frameShift ) //( _frames >> 1 ) )
@ -697,6 +908,7 @@ void CNpcEnemy::think(int _frames)
}
processTimer(_frames);
*/
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1385,7 +1597,10 @@ void CNpcEnemy::render()
{
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
if (m_actorGfx)
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
else
SprFrame = m_spriteBank->printFT4(m_frame>>8,renderPos.vx,renderPos.vy,m_reversed,0,10);
}
}
}

View File

@ -88,7 +88,7 @@ protected:
static NPC_FRIEND_DATA m_data[NPC_FRIEND_UNIT_TYPE_MAX];
//class SpriteBank *m_spriteBank;
// class SpriteBank *m_spriteBank;
enum
{
@ -177,6 +177,9 @@ public:
bool canBeCaughtByNet();
void caughtWithNet();
static CNpcEnemy *Create(sThingActor *ThisActor);
protected:
class CLayerCollision *m_layerCollision;
@ -361,7 +364,7 @@ protected:
typedef struct NPC_DATA_TYPE
{
FileEquate skelType;
int skelType;
// FileEquate animData;
u16 initAnim;
NPC_INIT_FUNC initFunc;
@ -493,6 +496,7 @@ protected:
s32 m_frame;
int m_animNo;
CActorGfx *m_actorGfx;
SpriteBank *m_spriteBank;
DVECTOR m_drawOffset;
POLY_FT4 *SprFrame;

View File

@ -11,6 +11,10 @@
===========================================================================*/
#ifndef __SPR_SPRITES_H__
#include <sprites.h>
#endif
#ifndef __ENEMY_NPC_H__
#include "enemy\npc.h"
#endif
@ -71,9 +75,9 @@
#include <ACTOR_IRONDOGFISH_ANIM.h>
#endif
#ifndef __ANIM_JELLYFISH1_HEADER__
#include <ACTOR_JELLYFISH1_ANIM.h>
#endif
//#ifndef __ANIM_JELLYFISH1_HEADER__
//#include <ACTOR_JELLYFISH1_ANIM.h>
//#endif
#ifndef __ANIM_PUFFAFISH_HEADER__
#include <ACTOR_PUFFAFISH_ANIM.h>
@ -91,9 +95,9 @@
#include <ACTOR_SPIDERCRAB_ANIM.h>
#endif
#ifndef __ANIM_SQUIDDART_HEADER__
#include <ACTOR_SQUIDDART_ANIM.h>
#endif
//#ifndef __ANIM_SQUIDDART_HEADER__
//#include <ACTOR_SQUIDDART_ANIM.h>
//#endif
#ifndef __ANIM_STOMPER_HEADER__
#include <ACTOR_STOMPER_ANIM.h>
@ -448,8 +452,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
},
{ // NPC_SMALL_JELLYFISH_1
ACTORS_JELLYFISH1_SBK,
ANIM_JELLYFISH1_IDLE,
0,//ACTORS_JELLYFISH1_SBK,
FRM_JELLYFISH1_SWIM1,
NPC_INIT_DEFAULT,
NPC_SENSOR_USER_CLOSE,
NPC_MOVEMENT_FIXED_PATH,
@ -461,10 +465,10 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
DETECT_ALL_COLLISION,
DAMAGE__SHOCK_ENEMY,
16,
ANIM_JELLYFISH1_SWIM,
FRM_JELLYFISH1_SWIM1,
NPC_SHOT_GENERIC,
0,
ANIM_JELLYFISH1_SWIM,
FRM_JELLYFISH1_SWIM1,
true,
true,
},
@ -624,8 +628,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
},
{ // NPC_SQUID_DART
ACTORS_SQUIDDART_SBK,
ANIM_SQUIDDART_SWIM,
0,//ACTORS_SQUIDDART_SBK,
FRM_SQUIDDART_SWIM0001,
NPC_INIT_DEFAULT,
NPC_SENSOR_NONE,
NPC_MOVEMENT_FIXED_PATH,
@ -637,7 +641,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
DETECT_ALL_COLLISION,
DAMAGE__HIT_ENEMY,
16,
ANIM_SQUIDDART_SWIM,
FRM_SQUIDDART_SWIM0001,
NPC_SHOT_GENERIC,
0,
0,

View File

@ -39,6 +39,7 @@ void CNpcSmallJellyfishEnemy::render()
{
setRGB0( SprFrame, 255, 128, 255 );
}
}
void CNpcSmallJellyfishEnemy::processClose( int _frames )

View File

@ -27,66 +27,6 @@
#include "enemy\npc.h"
#endif
#ifndef __ENEMY_NSJFISH_H__
#include "enemy\nsjfish.h"
#endif
#ifndef __ENEMY_NHCRAB_H__
#include "enemy\nhcrab.h"
#endif
#ifndef __ENEMY_NSCRAB_H__
#include "enemy\nscrab.h"
#endif
#ifndef __ENEMY_NGEN_H__
#include "enemy\ngen.h"
#endif
#ifndef __ENEMY_NANEMONE_H__
#include "enemy\nanemone.h"
#endif
#ifndef __ENEMY_NCLAM_H__
#include "enemy\nclam.h"
#endif
#ifndef __ENEMY_NOCTO_H__
#include "enemy\nocto.h"
#endif
#ifndef __ENEMY_NFFOLK_H__
#include "enemy\nffolk.h"
#endif
#ifndef __ENEMY_NBBLOB_H__
#include "enemy\nbblob.h"
#endif
#ifndef __ENEMY_NGPIRATE_H__
#include "enemy\ngpirate.h"
#endif
#ifndef __ENEMY_NPUFFA_H__
#include "enemy\npuffa.h"
#endif
#ifndef __ENEMY_NSHRKMAN_H__
#include "enemy\nshrkman.h"
#endif
#ifndef __ENEMY_NSKLFISH_H__
#include "enemy\nsklfish.h"
#endif
#ifndef __ENEMY_NEYEBALL_H__
#include "enemy\neyeball.h"
#endif
#ifndef __ENEMY_NFSKULL_H__
#include "enemy\nfskull.h"
#endif
#ifndef __ENEMY_NPLATFRM_H__
#include "enemy\nplatfrm.h"
#endif
@ -356,173 +296,51 @@ void CGameScene::initLevel()
{
for ( actorNum = 0 ; actorNum < Level.getActorCount() ; actorNum++ )
{
sThingActor *ThisActor=actorList[actorNum];
CActorPool::ACTOR_TYPE actorType = CActorPool::getActorType( actorList[actorNum]->Type );
switch ( actorType )
{
case CActorPool::ACTOR_ENEMY_NPC:
{
CNpcEnemy *enemy;
CNpcEnemy::NPC_UNIT_TYPE enemyType = CNpcEnemy::getTypeFromMapEdit( actorList[actorNum]->Type );
switch( enemyType )
{
case CNpcEnemy::NPC_SMALL_JELLYFISH_1:
CNpcEnemy *enemy;
enemy=CNpcEnemy::Create(ThisActor);
enemy->setTypeFromMapEdit( ThisActor->Type );
enemy->init();
enemy->setLayerCollision( Level.getCollisionLayer() );
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
u16 newXPos, newYPos;
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
enemy->setStartPos( newXPos, newYPos );
enemy->addWaypoint( newXPos, newYPos );
if ( ThisActor->PointCount > 1 )
{
enemy = new ("small jellyfish") CNpcSmallJellyfishEnemy;
break;
}
case CNpcEnemy::NPC_HERMIT_CRAB:
{
enemy = new ("hermit crab") CNpcHermitCrabEnemy;
break;
}
case CNpcEnemy::NPC_SPIDER_CRAB:
{
enemy = new ("spider crab") CNpcSpiderCrabEnemy;
break;
}
case CNpcEnemy::NPC_SPIDER_CRAB_SPAWNER:
{
enemy = new ("spider crab spawner") CNpcEnemyGenerator;
break;
}
case CNpcEnemy::NPC_ANEMONE_1:
{
enemy = new ("anemone 1") CNpcAnemone1Enemy;
break;
}
case CNpcEnemy::NPC_ANEMONE_2:
{
enemy = new ("anemone 2") CNpcAnemone2Enemy;
break;
}
case CNpcEnemy::NPC_ANEMONE_3:
{
enemy = new ("anemone 3") CNpcAnemone3Enemy;
break;
}
case CNpcEnemy::NPC_CLAM_JUMP:
{
enemy = new ("jumping clam") CNpcJumpingClamEnemy;
break;
}
case CNpcEnemy::NPC_CLAM_STATIC:
{
enemy = new ("static clam") CNpcStaticClamEnemy;
break;
}
case CNpcEnemy::NPC_BABY_OCTOPUS:
{
enemy = new ("baby octopus") CNpcBabyOctopusEnemy;
break;
}
case CNpcEnemy::NPC_FISH_FOLK:
case CNpcEnemy::NPC_ZOMBIE_FISH_FOLK:
{
enemy = new ("fish folk") CNpcFishFolk;
break;
}
case CNpcEnemy::NPC_BALL_BLOB:
{
enemy = new ("ball blob") CNpcBallBlobEnemy;
break;
}
case CNpcEnemy::NPC_GHOST_PIRATE:
{
enemy = new ("ghost pirate") CNpcGhostPirateEnemy;
break;
}
case CNpcEnemy::NPC_PUFFA_FISH:
{
enemy = new ("puffa fish") CNpcPuffaFishEnemy;
break;
}
case CNpcEnemy::NPC_SHARK_MAN:
{
enemy = new ("shark man") CNpcSharkManEnemy;
break;
}
case CNpcEnemy::NPC_SKELETAL_FISH:
{
enemy = new ("skeletal fish") CNpcSkeletalFishEnemy;
break;
}
case CNpcEnemy::NPC_EYEBALL:
{
enemy = new ("eyeball") CNpcEyeballEnemy;
break;
}
case CNpcEnemy::NPC_FLAMING_SKULL:
{
enemy = new ("flaming skull") CNpcFlamingSkullEnemy;
break;
}
default:
{
enemy = new ("npc enemy") CNpcEnemy;
break;
}
}
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 )
for (pointNum = 1 ; pointNum < ThisActor->PointCount ; pointNum++ )
{
enemy->setHeading( newXPos, newYPos );
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
enemy->addWaypoint( newXPos, newYPos );
if ( pointNum == 1 )
{
enemy->setHeading( newXPos, newYPos );
}
}
}
enemy->postInit();
}
enemy->postInit();
break;
}
default:
break;