From 108577f6df24d351b726bc4e597345cdb633cad5 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 30 May 2001 15:25:38 +0000 Subject: [PATCH] --- source/platform/pbob.cpp | 31 +++++++++++++++++++++++++++---- source/platform/pbob.h | 4 ++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/source/platform/pbob.cpp b/source/platform/pbob.cpp index c3689684d..0bdd33b14 100644 --- a/source/platform/pbob.cpp +++ b/source/platform/pbob.cpp @@ -19,6 +19,16 @@ #include "game\game.h" #endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcBobbingPlatform::postInit() +{ + CNpcPlatform::postInit(); + + m_vertPos = Pos.vy << 3; +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void CNpcBobbingPlatform::processMovement( int _frames ) @@ -36,7 +46,7 @@ void CNpcBobbingPlatform::processMovement( int _frames ) { m_velocity = 0; } - else if ( m_velocity < 4 ) + else if ( m_velocity < ( 2 << 2 ) ) { if ( height <= 0 ) { @@ -56,7 +66,7 @@ void CNpcBobbingPlatform::processMovement( int _frames ) { // otherwise drop velocity and ultimately reverse course - if ( m_velocity > -2 ) + if ( m_velocity > -( 2 << 2 ) ) { m_velocity--; } @@ -67,7 +77,20 @@ void CNpcBobbingPlatform::processMovement( int _frames ) { s32 moveY = m_velocity * _frames; - if ( Pos.vy + moveY < m_initPos.vy ) + m_vertPos += moveY; + + Pos.vy = m_vertPos >> 3; + + if ( Pos.vy < m_initPos.vy ) + { + Pos.vy = m_initPos.vy; + m_vertPos = Pos.vy << 3; + m_velocity = 0; + m_state = NPC_BOB_STOP; + moveY = 0; + } + + /*if ( Pos.vy + moveY < m_initPos.vy ) { Pos.vy = m_initPos.vy; m_velocity = 0; @@ -77,6 +100,6 @@ void CNpcBobbingPlatform::processMovement( int _frames ) else { Pos.vy += moveY; - } + }*/ } } \ No newline at end of file diff --git a/source/platform/pbob.h b/source/platform/pbob.h index 86aeaf70c..15c8f3477 100644 --- a/source/platform/pbob.h +++ b/source/platform/pbob.h @@ -20,6 +20,8 @@ class CNpcBobbingPlatform : public CNpcPlatform { +public: + virtual void postInit(); protected: virtual void processMovement( int _frames ); @@ -28,6 +30,8 @@ protected: NPC_BOB_STOP = 0, NPC_BOB_MOVE = 1, }; + + s32 m_vertPos; }; #endif \ No newline at end of file