2001-04-23 18:54:49 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
pbubble.cpp
|
|
|
|
|
|
|
|
Author: CRB
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
#ifndef __PLATFORM_PBUBBLE_H__
|
|
|
|
#include "platform\pbubble.h"
|
|
|
|
#endif
|
|
|
|
|
2001-06-04 23:16:15 +02:00
|
|
|
#ifndef __GAME_GAME_H__
|
|
|
|
#include "game\game.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __SPR_SPRITES_H__
|
|
|
|
#include <sprites.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcBubblePlatform::postInit()
|
|
|
|
{
|
|
|
|
CNpcPlatform::postInit();
|
|
|
|
|
|
|
|
m_pop = false;
|
2001-06-19 22:07:57 +02:00
|
|
|
|
|
|
|
s32 minX, maxX, minY, maxY;
|
|
|
|
|
|
|
|
m_npcPath.getPathXExtents( &minX, &maxX );
|
|
|
|
m_npcPath.getPathYExtents( &minY, &maxY );
|
|
|
|
|
|
|
|
m_thinkArea.x1 = minX;
|
|
|
|
m_thinkArea.x2 = maxX;
|
|
|
|
m_thinkArea.y1 = minY;
|
|
|
|
m_thinkArea.y2 = maxY;
|
2001-06-04 23:16:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcBubblePlatform::render()
|
|
|
|
{
|
|
|
|
if ( m_isActive || m_pop )
|
|
|
|
{
|
|
|
|
CPlatformThing::render();
|
|
|
|
|
|
|
|
// Render
|
|
|
|
if (canRender())
|
|
|
|
{
|
|
|
|
DVECTOR &renderPos=getRenderPos();
|
|
|
|
|
|
|
|
if ( m_pop )
|
|
|
|
{
|
|
|
|
POLY_FT4 *SprFrame = CGameScene::getSpriteBank()->printRotatedScaledSprite( FRM__BALLOONBURST, renderPos.vx, renderPos.vy - 16, 4096 << 1, 4096 << 1, 0, 10 );
|
|
|
|
setRGB0( SprFrame, 128, 128, 255 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-06-28 21:43:45 +02:00
|
|
|
// Evil hard coded Offsets
|
|
|
|
POLY_FT4 *SprFrame = CGameScene::getSpriteBank()->printFT4( FRM__BUBBLE_1, renderPos.vx-16, renderPos.vy-32, 0, 0, 10 );
|
|
|
|
setRGB0( SprFrame, 128, 128, 255 );
|
|
|
|
// m_modelGfx->Render(renderPos);
|
2001-06-04 23:16:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-23 18:54:49 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcBubblePlatform::processMovement( int _frames )
|
|
|
|
{
|
2001-06-04 23:16:15 +02:00
|
|
|
if ( !isSetToShutdown() && !m_pop )
|
2001-05-05 01:12:26 +02:00
|
|
|
{
|
2001-05-22 22:39:46 +02:00
|
|
|
Pos.vy -= m_speed * _frames;
|
|
|
|
|
2001-05-30 22:24:02 +02:00
|
|
|
if ( m_npcPath.getWaypointCount() )
|
2001-05-22 22:39:46 +02:00
|
|
|
{
|
|
|
|
s32 minY, maxY;
|
|
|
|
|
|
|
|
m_npcPath.getPathYExtents( &minY, &maxY );
|
|
|
|
|
|
|
|
if ( Pos.vy < minY )
|
|
|
|
{
|
2001-06-04 23:16:15 +02:00
|
|
|
m_lifetime = GameState::getOneSecondInFrames() >> 2;
|
|
|
|
m_pop = true;
|
2001-05-22 22:39:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( Pos.vy < 0 )
|
|
|
|
{
|
2001-06-04 23:16:15 +02:00
|
|
|
m_lifetime = GameState::getOneSecondInFrames() >> 2;
|
|
|
|
m_pop = true;
|
2001-05-22 22:39:46 +02:00
|
|
|
}
|
|
|
|
}
|
2001-06-19 22:21:26 +02:00
|
|
|
|
|
|
|
DVECTOR offset = CLevel::getCameraPos();
|
|
|
|
|
|
|
|
s32 yPos = Pos.vy - offset.vy;
|
|
|
|
|
|
|
|
if ( yPos < 0 )
|
|
|
|
{
|
|
|
|
setToShutdown();
|
|
|
|
}
|
2001-05-05 01:12:26 +02:00
|
|
|
}
|
2001-05-22 21:59:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-06-04 23:16:15 +02:00
|
|
|
void CNpcBubblePlatform::processLifetime( int _frames )
|
|
|
|
{
|
|
|
|
if ( m_pop )
|
|
|
|
{
|
|
|
|
if ( m_lifetime <= 0 )
|
|
|
|
{
|
|
|
|
setToShutdown();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_lifetime = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|