From 210a9e3364b918da316b30563d13bd155e3d39ae Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 23 Apr 2001 19:18:06 +0000 Subject: [PATCH] --- source/platform/pretract.cpp | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 source/platform/pretract.cpp diff --git a/source/platform/pretract.cpp b/source/platform/pretract.cpp new file mode 100644 index 000000000..ad7038b61 --- /dev/null +++ b/source/platform/pretract.cpp @@ -0,0 +1,63 @@ +/*========================================================================= + + pretract.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLATFORM_PRETRACT_H__ +#include "platform\pretract.h" +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcRetractingPlatform::postInit() +{ + m_timer = NPC_PLATFORM_TIMER_RETRACT; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcRetractingPlatform::processTimer( int _frames ) +{ + switch( m_timerType ) + { + case NPC_PLATFORM_TIMER_RETRACT: + { + if ( m_timer > 0 ) + { + m_timer -= _frames; + } + else + { + m_timer = 4 * GameState::getOneSecondInFrames(); + m_timerType = NPC_PLATFORM_TIMER_EXTEND; + m_detectCollision = false; + } + + break; + } + + case NPC_PLATFORM_TIMER_EXTEND: + { + if ( m_timer > 0 ) + { + m_timer -= _frames; + } + else + { + m_timer = 4 * GameState::getOneSecondInFrames(); + m_timerType = NPC_PLATFORM_TIMER_RETRACT; + m_detectCollision = true; + } + + break; + } + } +} \ No newline at end of file