2011-12-13 21:35:28 +00:00
|
|
|
#include "StdInc.h"
|
|
|
|
#include "CMovementStartAnimation.h"
|
|
|
|
|
|
|
|
#include "../CMusicHandler.h"
|
|
|
|
#include "CBattleInterface.h"
|
|
|
|
#include "../CGameInfo.h"
|
2011-12-17 18:59:59 +00:00
|
|
|
#include "CCreatureAnimation.h"
|
2011-12-13 21:35:28 +00:00
|
|
|
#include "../../lib/BattleState.h"
|
|
|
|
#include "../CPlayerInterface.h"
|
|
|
|
|
|
|
|
bool CMovementStartAnimation::init()
|
|
|
|
{
|
|
|
|
if( !isEarliest(false) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if(!stack || myAnim()->getType() == 5)
|
|
|
|
{
|
|
|
|
CMovementStartAnimation::endAnim();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
CCS->soundh->playSound(battle_sound(stack->getCreature(), startMoving));
|
|
|
|
myAnim()->setType(CCreatureAnim::MOVE_START);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMovementStartAnimation::nextFrame()
|
|
|
|
{
|
|
|
|
if(myAnim()->onLastFrameInGroup())
|
|
|
|
{
|
|
|
|
endAnim();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if((owner->animCount+1)%(4/owner->curInt->sysOpts.animSpeed)==0)
|
|
|
|
myAnim()->incrementFrame();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMovementStartAnimation::endAnim()
|
|
|
|
{
|
|
|
|
CBattleAnimation::endAnim();
|
|
|
|
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
CMovementStartAnimation::CMovementStartAnimation(CBattleInterface * _owner, const CStack * _stack)
|
|
|
|
: CBattleStackAnimation(_owner, _stack)
|
|
|
|
{
|
|
|
|
}
|