This commit is contained in:
parent
b894c60eca
commit
70705e38e3
2 changed files with 129 additions and 0 deletions
99
source/platform/pgbubble.cpp
Normal file
99
source/platform/pgbubble.cpp
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
pgbubble.cpp
|
||||||
|
|
||||||
|
Author: CRB
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_PGBUBBLE_H__
|
||||||
|
#include "platform\pgbubble.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GAME_GAME_H__
|
||||||
|
#include "game\game.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __SPR_SPRITES_H__
|
||||||
|
#include <sprites.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcGeyserBubblePlatform::postInit()
|
||||||
|
{
|
||||||
|
CNpcBubblePlatform::postInit();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcGeyserBubblePlatform::processMovement( int _frames )
|
||||||
|
{
|
||||||
|
if ( !isSetToShutdown() && !m_pop )
|
||||||
|
{
|
||||||
|
Pos.vy -= m_speed * _frames;
|
||||||
|
|
||||||
|
if ( m_npcPath.getWaypointCount() )
|
||||||
|
{
|
||||||
|
s32 minY, maxY;
|
||||||
|
|
||||||
|
m_npcPath.getPathYExtents( &minY, &maxY );
|
||||||
|
|
||||||
|
if ( Pos.vy < minY )
|
||||||
|
{
|
||||||
|
m_lifetime = GameState::getOneSecondInFrames() >> 2;
|
||||||
|
m_pop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( Pos.vy < 0 )
|
||||||
|
{
|
||||||
|
m_lifetime = GameState::getOneSecondInFrames() >> 2;
|
||||||
|
m_pop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DVECTOR offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
if ( yPos < 0 )
|
||||||
|
{
|
||||||
|
setToShutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcGeyserBubblePlatform::processLifetime( int _frames )
|
||||||
|
{
|
||||||
|
if ( m_pop )
|
||||||
|
{
|
||||||
|
if ( m_lifetime <= 0 )
|
||||||
|
{
|
||||||
|
setToShutdown();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_lifetime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
source/platform/pgbubble.h
Normal file
30
source/platform/pgbubble.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
pgbubble.h
|
||||||
|
|
||||||
|
Author: CRB
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_PGBUBBLE_H__
|
||||||
|
#define __PLATFORM_PGBUBBLE_H__
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_PBUBBLE_H__
|
||||||
|
#include "platform\pbubble.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class CNpcGeyserBubblePlatform : public CNpcBubblePlatform
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void postInit();
|
||||||
|
protected:
|
||||||
|
virtual void processMovement( int _frames );
|
||||||
|
virtual void processLifetime( int _frames );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Reference in a new issue