1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00
vcmi/client/BattleInterface/CMovementStartAnimation.cpp
beegee1 2f5d6f2684 * CHexField renamed to CBattleHex
* CHexFieldControl renamed to CClickableHex
* CCreatureAnimation.cpp/.h moved to BattleInterface/CCreatureAnimation.cpp/.h
* Removed unused project files
* Added VCMI_client filters file for VS 2010
* Gathered common parts of StdInc.h in Global.h
* Boost.Spirit has been included in PCH for ERM project
* StopWatch renamed to CStopWatch
* GuiBase.cpp split up in UIFramework/...
2011-12-17 18:59:59 +00:00

52 lines
1.0 KiB
C++

#include "StdInc.h"
#include "CMovementStartAnimation.h"
#include "../CMusicHandler.h"
#include "CBattleInterface.h"
#include "../CGameInfo.h"
#include "CCreatureAnimation.h"
#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)
{
}