From d8e99c15aa5dde5612a99a4795572f5fcdfa71be Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 1 May 2001 18:30:55 +0000 Subject: [PATCH] --- source/friend/fsquid.cpp | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 source/friend/fsquid.cpp diff --git a/source/friend/fsquid.cpp b/source/friend/fsquid.cpp new file mode 100644 index 000000000..9e26dc376 --- /dev/null +++ b/source/friend/fsquid.cpp @@ -0,0 +1,63 @@ +/*========================================================================= + + fsquid.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + +#ifndef __FRIEND_FSQUID_H__ +#include "friend\fsquid.h" +#endif + +#ifndef __UTILS_HEADER__ +#include "utils\utils.h" +#endif + +#ifndef __ANIM_SQUIDWARD_HEADER__ +#include +#endif + + +void CNpcSquidwardFriend::think( int _frames ) +{ + CNpcThing::think(_frames); + + if ( m_animPlaying ) + { + s32 frameCount; + + frameCount = m_actorGfx->getFrameCount( m_animNo ); + + s32 frameShift = ( _frames << 8 ) >> 1; + + if ( ( frameCount << 8 ) - m_frame > frameShift ) + { + m_frame += frameShift; + } + else + { + m_frame = ( frameCount - 1 ) << 8; + m_animPlaying = false; + } + } + else + { + if ( m_animNo != m_data[m_type].idleAnim ) + { + m_animNo = m_data[m_type].idleAnim; + } + else + { + m_animNo = getRnd() % NUM_ANIM_SQUIDWARD; + } + + m_animPlaying = true; + m_frame = 0; + } +} \ No newline at end of file