mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-15 22:16:37 +02:00
* 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/...
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
#include "StdInc.h"
|
|
#include "CAttackAnimation.h"
|
|
|
|
#include "../CMusicHandler.h"
|
|
#include "../CGameInfo.h"
|
|
#include "CBattleInterface.h"
|
|
#include "CCreatureAnimation.h"
|
|
#include "../../lib/BattleState.h"
|
|
#include "../CPlayerInterface.h"
|
|
#include "../../CCallback.h"
|
|
|
|
void CAttackAnimation::nextFrame()
|
|
{
|
|
if(myAnim()->getType() != group)
|
|
myAnim()->setType(group);
|
|
|
|
if(myAnim()->onFirstFrameInGroup())
|
|
{
|
|
if(shooting)
|
|
CCS->soundh->playSound(battle_sound(attackingStack->getCreature(), shoot));
|
|
else
|
|
CCS->soundh->playSound(battle_sound(attackingStack->getCreature(), attack));
|
|
}
|
|
else if(myAnim()->onLastFrameInGroup())
|
|
{
|
|
myAnim()->setType(CCreatureAnim::HOLDING);
|
|
endAnim();
|
|
return; //execution of endAnim deletes this !!!
|
|
}
|
|
}
|
|
|
|
bool CAttackAnimation::checkInitialConditions()
|
|
{
|
|
return isEarliest(false);
|
|
}
|
|
|
|
CAttackAnimation::CAttackAnimation(CBattleInterface *_owner, const CStack *attacker, SBattleHex _dest, const CStack *defender)
|
|
: CBattleStackAnimation(_owner, attacker), dest(_dest), attackedStack(defender), attackingStack(attacker)
|
|
{
|
|
|
|
assert(attackingStack && "attackingStack is NULL in CBattleAttack::CBattleAttack !\n");
|
|
if(attackingStack->getCreature()->idNumber != 145) //catapult is allowed to attack not-creature
|
|
{
|
|
assert(attackedStack && "attackedStack is NULL in CBattleAttack::CBattleAttack !\n");
|
|
}
|
|
else //catapult can attack walls only
|
|
{
|
|
assert(owner->curInt->cb->battleGetWallUnderHex(_dest) >= 0);
|
|
}
|
|
attackingStackPosBeforeReturn = attackingStack->position;
|
|
} |