This commit is contained in:
Charles 2001-05-03 12:53:03 +00:00
parent e1d8373629
commit e6c46bcc9e
2 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,86 @@
/*=========================================================================
fplnkton.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
#ifndef __FRIEND_FPLNKTON_H__
#include "friend\fplnkton.h"
#endif
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
#ifndef __LEVEL_LEVEL_H__
#include "level\level.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
#ifndef __SPR_SPRITES_H__
#include <sprites.h>
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlanktonFriend::render()
{
CNpcThing::render();
// Render
DVECTOR renderPos;
DVECTOR origRenderPos;
DVECTOR offset = CLevel::getCameraPos();
int frame = FRM_PLANKTON_STATIC00;
int spriteWidth = m_spriteBank->getFrameWidth( frame );
int spriteHeight = m_spriteBank->getFrameHeight( frame );
renderPos.vx = Pos.vx - offset.vx - ( spriteWidth >> 1 );
renderPos.vy = Pos.vy - offset.vy - ( spriteHeight >> 1 );
if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() )
{
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{
m_spriteBank->printFT4(frame,renderPos.vx,renderPos.vy,0,0,10);
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlanktonFriend::think( int _frames )
{
}

32
source/friend/fplnkton.h Normal file
View File

@ -0,0 +1,32 @@
/*=========================================================================
fplnkton.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
#ifndef __FRIEND_FPLNKTON_H__
#define __FRIEND_FPLNKTON_H__
#ifndef __FRIEND_FRIEND_H__
#include "friend\friend.h"
#endif
class CNpcPlanktonFriend : public CNpcFriend
{
public:
virtual void init();
virtual void render();
virtual void think(int _frames);
virtual void shutdown();
protected:
SpriteBank *m_spriteBank;
};
#endif