From 6a94ade948a4c71e7165f950c6cbe702ce69282c Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 20 Apr 2001 16:13:23 +0000 Subject: [PATCH] --- source/enemy/npc.cpp | 15 +++++++++------ source/enemy/npc.h | 1 + source/enemy/nsjfish.cpp | 2 +- source/enemy/nsjfish.h | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 6809c7a75..0d143536f 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -830,6 +830,13 @@ void CNpcEnemy::shutdown() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +int CNpcEnemy::getFrameCount() +{ + return( m_actorGfx->getFrameCount( m_animNo ) ); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcEnemy::think(int _frames) { CEnemyThing::think(_frames); @@ -843,13 +850,9 @@ void CNpcEnemy::think(int _frames) if ( m_animPlaying ) { s32 frameCount; -// BODGE!!!!!!!!!!!!!!! - if (m_actorGfx) - frameCount= m_actorGfx->getFrameCount(m_animNo); - else - frameCount= 6; -// BODGE END!!!!!!!!!!! + frameCount = getFrameCount(); + s32 frameShift = ( _frames << 8 ) >> 1; if ( ( frameCount << 8 ) - m_frame > frameShift ) //( _frames >> 1 ) ) diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 3f2a806cf..abe6f699d 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -176,6 +176,7 @@ public: void hasBeenAttacked(); bool canBeCaughtByNet(); void caughtWithNet(); + virtual int getFrameCount(); static CNpcEnemy *Create(sThingActor *ThisActor); diff --git a/source/enemy/nsjfish.cpp b/source/enemy/nsjfish.cpp index 6754cf2a5..da4d4277c 100644 --- a/source/enemy/nsjfish.cpp +++ b/source/enemy/nsjfish.cpp @@ -223,7 +223,7 @@ void CNpcSmallJellyfishEnemy::processMovementModifier( int _frames, s32 distX, s dataPoint /= GameState::getOneSecondInFrames(); } - m_frame = ( ( m_movementTimer * ( m_actorGfx->getFrameCount(m_animNo) - 1 ) << 8 ) ) / GameState::getOneSecondInFrames(); + m_frame = ( ( m_movementTimer * ( getFrameCount() - 1 ) << 8 ) ) / GameState::getOneSecondInFrames(); s32 resistance; s32 absVelocity = abs( m_velocity ); diff --git a/source/enemy/nsjfish.h b/source/enemy/nsjfish.h index b7597428c..3a7d64ac1 100644 --- a/source/enemy/nsjfish.h +++ b/source/enemy/nsjfish.h @@ -22,6 +22,7 @@ class CNpcSmallJellyfishEnemy : public CNpcEnemy { public: void render(); + virtual int getFrameCount() {return( 6 );} protected: virtual bool processSensor(); virtual void processClose( int _frames );