From 7c33350c08cbf1e53951e85ce9a82de90fd61100 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 4 Jun 2001 21:16:15 +0000 Subject: [PATCH] --- source/platform/pbubble.cpp | 69 +++++++++++++++++++++++++++++++++++-- source/platform/pbubble.h | 5 +++ 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/source/platform/pbubble.cpp b/source/platform/pbubble.cpp index 447873936..ea25d3146 100644 --- a/source/platform/pbubble.cpp +++ b/source/platform/pbubble.cpp @@ -15,11 +15,55 @@ #include "platform\pbubble.h" #endif +#ifndef __GAME_GAME_H__ +#include "game\game.h" +#endif + +#ifndef __SPR_SPRITES_H__ +#include +#endif + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcBubblePlatform::postInit() +{ + CNpcPlatform::postInit(); + + m_pop = false; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +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 + { + m_modelGfx->Render(renderPos); + } + } + } +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void CNpcBubblePlatform::processMovement( int _frames ) { - if ( !isSetToShutdown() ) + if ( !isSetToShutdown() && !m_pop ) { Pos.vy -= m_speed * _frames; @@ -31,14 +75,16 @@ void CNpcBubblePlatform::processMovement( int _frames ) if ( Pos.vy < minY ) { - setToShutdown(); + m_lifetime = GameState::getOneSecondInFrames() >> 2; + m_pop = true; } } else { if ( Pos.vy < 0 ) { - setToShutdown(); + m_lifetime = GameState::getOneSecondInFrames() >> 2; + m_pop = true; } } } @@ -46,6 +92,23 @@ void CNpcBubblePlatform::processMovement( int _frames ) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void CNpcBubblePlatform::processLifetime( int _frames ) +{ + if ( m_pop ) + { + if ( m_lifetime <= 0 ) + { + setToShutdown(); + } + else + { + m_lifetime = 0; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + const CRECT *CNpcBubblePlatform::getThinkBBox() { CRECT objThinkBox = getCollisionArea(); diff --git a/source/platform/pbubble.h b/source/platform/pbubble.h index 1416c7e8d..309bba8d0 100644 --- a/source/platform/pbubble.h +++ b/source/platform/pbubble.h @@ -21,9 +21,14 @@ class CNpcBubblePlatform : public CNpcPlatform { public: + virtual void render(); + virtual void postInit(); virtual CRECT const *getThinkBBox(); protected: + virtual void processLifetime( int _frames ); virtual void processMovement( int _frames ); + + u8 m_pop; }; #endif \ No newline at end of file