1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00
vcmi/client/BattleInterface/CMovementStartAnimation.cpp

52 lines
1.0 KiB
C++
Raw Normal View History

2011-12-13 21:35:28 +00:00
#include "StdInc.h"
#include "CMovementStartAnimation.h"
#include "../CMusicHandler.h"
#include "CBattleInterface.h"
#include "../CGameInfo.h"
#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)
{
}