diff --git a/Graphics/characters/Gary/AnimList.Txt b/Graphics/characters/Gary/AnimList.Txt index 0850318a9..207ac897d 100644 --- a/Graphics/characters/Gary/AnimList.Txt +++ b/Graphics/characters/Gary/AnimList.Txt @@ -1 +1,2 @@ -idle \ No newline at end of file +idle +slither \ No newline at end of file diff --git a/source/friend/fgary.cpp b/source/friend/fgary.cpp index 37a16e7b4..f843f65b3 100644 --- a/source/friend/fgary.cpp +++ b/source/friend/fgary.cpp @@ -31,6 +31,10 @@ #include "system\vid.h" #endif +#ifndef __ANIM_GARY_HEADER__ +#include +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -47,7 +51,38 @@ void CNpcGaryFriend::postInit() void CNpcGaryFriend::think( int _frames ) { - CNpcFriend::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_started ) + { + m_animNo = ANIM_GARY_SLITHER; + } + else + { + m_animNo = m_data[m_type].idleAnim; + } + + m_animPlaying = true; + m_frame = 0; + } if ( m_fallDeath ) { @@ -259,3 +294,29 @@ const CRECT *CNpcGaryFriend::getThinkBBox() return &objThinkBox; } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcGaryFriend::start() +{ + if ( !m_started ) + { + m_started = true; + m_animNo = ANIM_GARY_SLITHER; + m_animPlaying = true; + m_frame = 0; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcGaryFriend::stop() +{ + if ( m_started ) + { + m_started = false; + m_animNo = m_data[m_type].idleAnim; + m_animPlaying = true; + m_frame = 0; + } +} diff --git a/source/friend/fgary.h b/source/friend/fgary.h index 7a7d9e009..c23dbe68b 100644 --- a/source/friend/fgary.h +++ b/source/friend/fgary.h @@ -26,8 +26,8 @@ public: virtual void setupWaypoints( sThingActor *ThisActor ); virtual CRECT const *getThinkBBox(); DVECTOR const &getTriggerPos() {return( m_triggerPos );} - void start() {m_started = true;} - void stop() {m_started = false;} + void start(); + void stop(); void startLeft(); void startRight(); virtual void render();