1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-21 22:33:43 +02:00
vcmi/client/BattleInterface/CMovementEndAnimation.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.1 KiB
C++

#include "StdInc.h"
#include "CMovementEndAnimation.h"
#include "CCreatureAnimation.h"
#include "../CMusicHandler.h"
#include "../CGameInfo.h"
#include "../../lib/BattleState.h"
#include "../CCursorHandler.h"
bool CMovementEndAnimation::init()
{
if( !isEarliest(true) )
return false;
if(!stack || myAnim()->framesInGroup(CCreatureAnim::MOVE_END) == 0 ||
myAnim()->getType() == CCreatureAnim::DEATH)
{
endAnim();
return false;
}
CCS->soundh->playSound(battle_sound(stack->getCreature(), endMoving));
myAnim()->setType(CCreatureAnim::MOVE_END);
return true;
}
void CMovementEndAnimation::nextFrame()
{
if(myAnim()->onLastFrameInGroup())
{
endAnim();
}
}
void CMovementEndAnimation::endAnim()
{
CBattleAnimation::endAnim();
if(myAnim()->getType() != CCreatureAnim::DEATH)
myAnim()->setType(CCreatureAnim::HOLDING); //resetting to default
CCS->curh->show();
delete this;
}
CMovementEndAnimation::CMovementEndAnimation(CBattleInterface * _owner, const CStack * _stack, SBattleHex destTile)
: CBattleStackAnimation(_owner, _stack), destinationTile(destTile)
{
}