1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fixes 1892 - properly handle animation of dying clones

This commit is contained in:
Ivan Savenko 2014-09-23 16:02:30 +03:00
parent bfd3aab78d
commit a5c3ed080f
2 changed files with 30 additions and 13 deletions

View File

@ -150,7 +150,9 @@ CDefenceAnimation::CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInt
: CBattleStackAnimation(_owner, _attackedInfo.defender),
attacker(_attackedInfo.attacker), rangedAttack(_attackedInfo.indirectAttack),
killed(_attackedInfo.killed)
{}
{
logAnim->debugStream() << "Created defence anim for " << _attackedInfo.defender->getName();
}
bool CDefenceAnimation::init()
{
@ -364,7 +366,9 @@ bool CMeleeAttackAnimation::init()
CMeleeAttackAnimation::CMeleeAttackAnimation(CBattleInterface * _owner, const CStack * attacker, BattleHex _dest, const CStack * _attacked)
: CAttackAnimation(_owner, attacker, _dest, _attacked)
{}
{
logAnim->debugStream() << "Created melee attack anim for " << attacker->getName();
}
void CMeleeAttackAnimation::endAnim()
{
@ -521,11 +525,14 @@ CMovementAnimation::CMovementAnimation(CBattleInterface *_owner, const CStack *_
progress(0.0),
nextHex(destTiles.front())
{
logAnim->debugStream() << "Created movement anim for " << stack->getName();
}
CMovementEndAnimation::CMovementEndAnimation(CBattleInterface * _owner, const CStack * _stack, BattleHex destTile)
: CBattleStackAnimation(_owner, _stack), destinationTile(destTile)
{}
{
logAnim->debugStream() << "Created movement end anim for " << stack->getName();
}
bool CMovementEndAnimation::init()
{
@ -562,7 +569,9 @@ void CMovementEndAnimation::endAnim()
CMovementStartAnimation::CMovementStartAnimation(CBattleInterface * _owner, const CStack * _stack)
: CBattleStackAnimation(_owner, _stack)
{}
{
logAnim->debugStream() << "Created movement start anim for " << stack->getName();
}
bool CMovementStartAnimation::init()
{
@ -592,7 +601,9 @@ void CMovementStartAnimation::endAnim()
CReverseAnimation::CReverseAnimation(CBattleInterface * _owner, const CStack * stack, BattleHex dest, bool _priority)
: CBattleStackAnimation(_owner, stack), hex(dest), priority(_priority)
{}
{
logAnim->debugStream() << "Created reverse anim for " << stack->getName();
}
bool CReverseAnimation::init()
{
@ -654,7 +665,9 @@ void CReverseAnimation::setupSecondPart()
CShootingAnimation::CShootingAnimation(CBattleInterface * _owner, const CStack * attacker, BattleHex _dest, const CStack * _attacked, bool _catapult, int _catapultDmg)
: CAttackAnimation(_owner, attacker, _dest, _attacked), catapultDamage(_catapultDmg)
{}
{
logAnim->debugStream() << "Created shooting anim for " << stack->getName();
}
bool CShootingAnimation::init()
{

View File

@ -1036,8 +1036,9 @@ void CBattleInterface::stacksAreAttacked(std::vector<StackAttackedInfo> attacked
{
for (auto & attackedInfo : attackedInfos)
{
if (!attackedInfo.cloneKilled) //FIXME: play dead animation for cloned creature before it vanishes
//if (!attackedInfo.cloneKilled) //FIXME: play dead animation for cloned creature before it vanishes
addNewAnim(new CDefenceAnimation(attackedInfo, this));
if (attackedInfo.rebirth)
{
displayEffect(50, attackedInfo.defender->position); //TODO: play reverse death animation
@ -1052,12 +1053,6 @@ void CBattleInterface::stacksAreAttacked(std::vector<StackAttackedInfo> attacked
killed += attackedInfo.amountKilled;
damage += attackedInfo.dmg;
}
if (attackedInfos.front().cloneKilled) //FIXME: cloned stack is already removed
return;
if (targets > 1)
printConsoleAttacked(attackedInfos.front().defender, damage, killed, attackedInfos.front().attacker, true); //creatures perish
else
printConsoleAttacked(attackedInfos.front().defender, damage, killed, attackedInfos.front().attacker, false);
for(auto & attackedInfo : attackedInfos)
{
@ -1066,6 +1061,15 @@ void CBattleInterface::stacksAreAttacked(std::vector<StackAttackedInfo> attacked
if (attackedInfo.cloneKilled)
stackRemoved(attackedInfo.defender->ID);
}
/* if (attackedInfos.front().cloneKilled) //FIXME: cloned stack is already removed
return;*/
if (targets > 1)
printConsoleAttacked(attackedInfos.front().defender, damage, killed, attackedInfos.front().attacker, true); //creatures perish
else
printConsoleAttacked(attackedInfos.front().defender, damage, killed, attackedInfos.front().attacker, false);
}
void CBattleInterface::stackAttacking( const CStack * attacker, BattleHex dest, const CStack * attacked, bool shooting )