From 70705e38e38bcf698ff063d5f11da887923c97cb Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 3 Jul 2001 18:31:25 +0000 Subject: [PATCH] --- source/platform/pgbubble.cpp | 99 ++++++++++++++++++++++++++++++++++++ source/platform/pgbubble.h | 30 +++++++++++ 2 files changed, 129 insertions(+) create mode 100644 source/platform/pgbubble.cpp create mode 100644 source/platform/pgbubble.h diff --git a/source/platform/pgbubble.cpp b/source/platform/pgbubble.cpp new file mode 100644 index 000000000..3d1d3d6b2 --- /dev/null +++ b/source/platform/pgbubble.cpp @@ -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 +#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; + } + } +} diff --git a/source/platform/pgbubble.h b/source/platform/pgbubble.h new file mode 100644 index 000000000..399d6f66a --- /dev/null +++ b/source/platform/pgbubble.h @@ -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 \ No newline at end of file