SBSPSS/source/friend/fplnkton.cpp

103 lines
2.5 KiB
C++
Raw Normal View History

2001-05-03 14:53:03 +02:00
/*=========================================================================
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
2001-05-03 15:11:45 +02:00
#ifndef __GAME_CONVO_H__
#include "game\convo.h"
#endif
2001-05-03 14:53:03 +02:00
2001-05-25 20:43:47 +02:00
#include "game/game.h"
2001-05-03 14:53:03 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlanktonFriend::init()
{
CNpcThing::init();
m_extension = EXTEND_RIGHT;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlanktonFriend::shutdown()
{
CNpcThing::shutdown();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlanktonFriend::render()
{
CNpcThing::render();
// Render
DVECTOR renderPos;
DVECTOR origRenderPos;
2001-07-23 21:26:37 +02:00
DVECTOR const &offset = CLevel::getCameraPos();
2001-05-03 14:53:03 +02:00
int frame = FRM_PLANKTON_STATIC00;
2001-05-25 20:43:47 +02:00
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( frame );
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( frame );
2001-05-03 14:53:03 +02:00
renderPos.vx = Pos.vx - offset.vx - ( spriteWidth >> 1 );
renderPos.vy = Pos.vy - offset.vy - ( spriteHeight >> 1 );
2001-07-23 21:26:37 +02:00
CRECT const &collisionRect = getCollisionArea();
2001-05-05 16:58:49 +02:00
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
2001-05-03 14:53:03 +02:00
{
2001-05-05 16:58:49 +02:00
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
2001-05-03 14:53:03 +02:00
{
2001-05-25 20:43:47 +02:00
CGameScene::getSpriteBank()->printFT4(frame,renderPos.vx,renderPos.vy,0,0,10);
2001-05-03 14:53:03 +02:00
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlanktonFriend::think( int _frames )
{
2001-05-03 15:11:45 +02:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlanktonFriend::startConderversation()
{
if( !CConversation::isActive() )
{
CConversation::trigger( SCRIPTS_CH3L1_01_DAT );
}
2001-05-03 14:53:03 +02:00
}