This commit is contained in:
Charles 2001-04-25 20:04:25 +00:00
parent c501e386a0
commit 51249170a7
4 changed files with 55 additions and 33 deletions

View file

@ -779,38 +779,40 @@ void CNpcEnemy::reinit()
void CNpcEnemy::shutdown() void CNpcEnemy::shutdown()
{ {
if ( !m_isShuttingDown ) if (m_spriteBank) m_spriteBank->dump(); delete m_spriteBank;
// remove waypoints
m_npcPath.removeAllWaypoints();
// remove position history
CNpcPositionHistory *currentPosition;
CNpcPositionHistory *oldPosition;
currentPosition = m_positionHistory;
while( currentPosition )
{ {
m_isShuttingDown = true; oldPosition = currentPosition;
currentPosition = currentPosition->next;
if (m_spriteBank) m_spriteBank->dump(); delete m_spriteBank; delete oldPosition;
// remove waypoints
m_npcPath.removeAllWaypoints();
// remove position history
CNpcPositionHistory *currentPosition;
CNpcPositionHistory *oldPosition;
currentPosition = m_positionHistory;
while( currentPosition )
{
oldPosition = currentPosition;
currentPosition = currentPosition->next;
delete oldPosition;
}
m_positionHistory = NULL;
if (m_actorGfx) delete m_actorGfx;
deleteAllChild();
CEnemyThing::shutdown();
} }
m_positionHistory = NULL;
if (m_actorGfx) delete m_actorGfx;
deleteAllChild();
CEnemyThing::shutdown();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::setToShutdown()
{
m_isShuttingDown = true;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1283,7 +1285,7 @@ void CNpcEnemy::processShot()
} }
else else
{ {
shutdown(); setToShutdown();
} }
} }
@ -1479,7 +1481,7 @@ void CNpcEnemy::caughtWithNet()
} }
else else
{ {
shutdown(); setToShutdown();
} }
} }

View file

@ -182,6 +182,8 @@ public:
virtual int canCollide(); virtual int canCollide();
void setToShutdown();
u8 isSetToShutdown() {return( m_isShuttingDown );}
protected: protected:
class CLayerCollision *m_layerCollision; class CLayerCollision *m_layerCollision;

View file

@ -17,6 +17,14 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFishHookPlatform::postInit()
{
m_isMoving = false;
m_isShuttingDown = false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFishHookPlatform::processLifetime( int _frames ) void CNpcFishHookPlatform::processLifetime( int _frames )
{ {
if ( m_contact ) if ( m_contact )
@ -27,6 +35,13 @@ void CNpcFishHookPlatform::processLifetime( int _frames )
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFishHookPlatform::setToShutdown()
{
m_isShuttingDown = true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFishHookPlatform::processMovement( int _frames ) void CNpcFishHookPlatform::processMovement( int _frames )
{ {
if ( m_isMoving ) if ( m_isMoving )

View file

@ -21,12 +21,15 @@
class CNpcFishHookPlatform : public CNpcPlatform class CNpcFishHookPlatform : public CNpcPlatform
{ {
public: public:
virtual void postInit() {m_isMoving = false;} virtual void postInit();
void setToShutdown();
u8 isSetToShutdown() {return( m_isShuttingDown );}
protected: protected:
virtual void processLifetime( int _frames ); virtual void processLifetime( int _frames );
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );
bool m_isMoving; u8 m_isMoving;
u8 m_isShuttingDown;
}; };
#endif #endif