This commit is contained in:
parent
5b785068c2
commit
fa5105d783
96 changed files with 550 additions and 406 deletions
|
@ -32,7 +32,7 @@ void CNpcGaryFriend::think( int _frames )
|
|||
|
||||
// check vertical collision
|
||||
|
||||
groundHeight = m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
|
||||
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
|
||||
|
||||
if ( groundHeight <= 0 )
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ void CNpcGaryFriend::think( int _frames )
|
|||
|
||||
// check horizontal collision
|
||||
|
||||
if ( m_layerCollision->getHeightFromGround( Pos.vx + ( multiplier * _frames ), Pos.vy ) < -maxHeight )
|
||||
if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + ( multiplier * _frames ), Pos.vy ) < -maxHeight )
|
||||
{
|
||||
// reverse direction
|
||||
|
||||
|
@ -65,7 +65,7 @@ void CNpcGaryFriend::think( int _frames )
|
|||
|
||||
Pos.vy += groundHeight;
|
||||
|
||||
if ( m_layerCollision->getHeightFromGround( Pos.vx + ( multiplier * _frames ), Pos.vy ) < -maxHeight )
|
||||
if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + ( multiplier * _frames ), Pos.vy ) < -maxHeight )
|
||||
{
|
||||
// reverse direction
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#endif
|
||||
|
||||
|
||||
#include "game/game.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcPlanktonFriend::init()
|
||||
|
@ -43,17 +45,12 @@ void CNpcPlanktonFriend::init()
|
|||
CNpcThing::init();
|
||||
|
||||
m_extension = EXTEND_RIGHT;
|
||||
|
||||
m_spriteBank=new ("enemy sprites") SpriteBank();
|
||||
m_spriteBank->load(SPRITES_SPRITES_SPR);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcPlanktonFriend::shutdown()
|
||||
{
|
||||
m_spriteBank->dump(); delete m_spriteBank;
|
||||
|
||||
CNpcThing::shutdown();
|
||||
}
|
||||
|
||||
|
@ -68,8 +65,8 @@ void CNpcPlanktonFriend::render()
|
|||
DVECTOR origRenderPos;
|
||||
DVECTOR offset = CLevel::getCameraPos();
|
||||
int frame = FRM_PLANKTON_STATIC00;
|
||||
int spriteWidth = m_spriteBank->getFrameWidth( frame );
|
||||
int spriteHeight = m_spriteBank->getFrameHeight( frame );
|
||||
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( frame );
|
||||
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( frame );
|
||||
|
||||
renderPos.vx = Pos.vx - offset.vx - ( spriteWidth >> 1 );
|
||||
renderPos.vy = Pos.vy - offset.vy - ( spriteHeight >> 1 );
|
||||
|
@ -84,7 +81,7 @@ void CNpcPlanktonFriend::render()
|
|||
{
|
||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
||||
{
|
||||
m_spriteBank->printFT4(frame,renderPos.vx,renderPos.vy,0,0,10);
|
||||
CGameScene::getSpriteBank()->printFT4(frame,renderPos.vx,renderPos.vy,0,0,10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ public:
|
|||
virtual void shutdown();
|
||||
protected:
|
||||
virtual void startConderversation();
|
||||
SpriteBank *m_spriteBank;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -67,9 +67,11 @@ CNpcFriend *CNpcFriend::Create(sThingActor *ThisActor)
|
|||
{
|
||||
CNpcFriend *friendNpc;
|
||||
|
||||
NPC_FRIEND_UNIT_TYPE friendType = CNpcFriend::getTypeFromMapEdit( ThisActor->Type );
|
||||
NPC_FRIEND_UNIT_TYPE Type = CNpcFriend::getTypeFromMapEdit( ThisActor->Type );
|
||||
|
||||
switch( friendType )
|
||||
friendNpc = (CNpcFriend*)CThingManager::GetThing(CThing::TYPE_NPC,Type);
|
||||
if (!friendNpc)
|
||||
switch( Type )
|
||||
{
|
||||
case CNpcFriend::NPC_FRIEND_BARNACLE_BOY:
|
||||
{
|
||||
|
@ -121,7 +123,7 @@ CNpcFriend *CNpcFriend::Create(sThingActor *ThisActor)
|
|||
|
||||
default:
|
||||
{
|
||||
printf("UNKNOWN %i\n",friendType);
|
||||
SYSTEM_DBGMSG("UNKNOWN %i\n",Type);
|
||||
friendNpc = NULL;
|
||||
ASSERT(0);
|
||||
break;
|
||||
|
@ -130,7 +132,8 @@ CNpcFriend *CNpcFriend::Create(sThingActor *ThisActor)
|
|||
|
||||
ASSERT( friendNpc );
|
||||
|
||||
friendNpc->setType( friendType );
|
||||
friendNpc->setType( Type );
|
||||
friendNpc->setThingSubType(Type);
|
||||
|
||||
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
|
||||
|
||||
|
@ -191,8 +194,6 @@ void CNpcFriend::postInit()
|
|||
|
||||
void CNpcFriend::shutdown()
|
||||
{
|
||||
//m_spriteBank->dump(); delete m_spriteBank;
|
||||
|
||||
delete m_actorGfx;
|
||||
CNpcThing::shutdown();
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ public:
|
|||
NPC_FRIEND_PLANKTON,
|
||||
NPC_FRIEND_UNIT_TYPE_MAX,
|
||||
};
|
||||
enum
|
||||
{ // For Dynamic ThingCache
|
||||
MAX_SUBTYPE =NPC_FRIEND_UNIT_TYPE_MAX,
|
||||
};
|
||||
|
||||
virtual void init();
|
||||
void init( DVECTOR initPos );
|
||||
|
@ -44,15 +48,13 @@ public:
|
|||
virtual void shutdown();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;}
|
||||
|
||||
|
||||
void setType( NPC_FRIEND_UNIT_TYPE newType ) {m_type = newType;}
|
||||
|
||||
static CNpcFriend *Create(sThingActor *ThisActor);
|
||||
static NPC_FRIEND_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||
|
||||
protected:
|
||||
class CLayerCollision *m_layerCollision;
|
||||
|
||||
protected:
|
||||
typedef struct NPC_FRIEND_DATA_TYPE
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue