|
|
@@ -58,13 +58,13 @@ bool CBattleAnimation::isEarliest(bool perStackConcurrency)
|
|
|
{
|
|
|
int lowestMoveID = owner->animIDhelper + 5;
|
|
|
CBattleStackAnimation * thAnim = dynamic_cast<CBattleStackAnimation *>(this);
|
|
|
- CSpellEffectAnimation * thSen = dynamic_cast<CSpellEffectAnimation *>(this);
|
|
|
+ CEffectAnimation * thSen = dynamic_cast<CEffectAnimation *>(this);
|
|
|
|
|
|
for(auto & elem : owner->pendingAnims)
|
|
|
{
|
|
|
|
|
|
CBattleStackAnimation * stAnim = dynamic_cast<CBattleStackAnimation *>(elem.first);
|
|
|
- CSpellEffectAnimation * sen = dynamic_cast<CSpellEffectAnimation *>(elem.first);
|
|
|
+ CEffectAnimation * sen = dynamic_cast<CEffectAnimation *>(elem.first);
|
|
|
if(perStackConcurrency && stAnim && thAnim && stAnim->stack->ID != thAnim->stack->ID)
|
|
|
continue;
|
|
|
|
|
|
@@ -171,7 +171,7 @@ bool CDefenceAnimation::init()
|
|
|
if(attAnim && attAnim->stack->ID != stack->ID)
|
|
|
continue;
|
|
|
|
|
|
- CSpellEffectAnimation * sen = dynamic_cast<CSpellEffectAnimation *>(elem.first);
|
|
|
+ CEffectAnimation * sen = dynamic_cast<CEffectAnimation *>(elem.first);
|
|
|
if (sen)
|
|
|
continue;
|
|
|
|
|
|
@@ -243,7 +243,7 @@ CCreatureAnim::EAnimType CDefenceAnimation::getMyAnimType()
|
|
|
if(killed)
|
|
|
return CCreatureAnim::DEATH;
|
|
|
|
|
|
- if (vstd::contains(stack->state, EBattleStackState::DEFENDING_ANIM))
|
|
|
+ if(vstd::contains(stack->state, EBattleStackState::DEFENDING_ANIM))
|
|
|
return CCreatureAnim::DEFENCE;
|
|
|
|
|
|
return CCreatureAnim::HITTED;
|
|
|
@@ -270,10 +270,15 @@ void CDefenceAnimation::nextFrame()
|
|
|
|
|
|
void CDefenceAnimation::endAnim()
|
|
|
{
|
|
|
- if (killed)
|
|
|
+ if(killed)
|
|
|
+ {
|
|
|
myAnim->setType(CCreatureAnim::DEAD);
|
|
|
+ }
|
|
|
else
|
|
|
+ {
|
|
|
myAnim->setType(CCreatureAnim::HOLDING);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
CBattleAnimation::endAnim();
|
|
|
|
|
|
@@ -791,7 +796,7 @@ bool CShootingAnimation::init()
|
|
|
Point animPos(destPos.x - 126 + img->width() / 2,
|
|
|
destPos.y - 105 + img->height() / 2);
|
|
|
|
|
|
- owner->addNewAnim( new CSpellEffectAnimation(owner, catapultDamage ? "SGEXPL.DEF" : "CSGRCK.DEF", animPos.x, animPos.y));
|
|
|
+ owner->addNewAnim( new CEffectAnimation(owner, catapultDamage ? "SGEXPL.DEF" : "CSGRCK.DEF", animPos.x, animPos.y));
|
|
|
}
|
|
|
|
|
|
auto & angles = shooterInfo->animation.missleFrameAngles;
|
|
|
@@ -872,35 +877,40 @@ void CShootingAnimation::endAnim()
|
|
|
delete this;
|
|
|
}
|
|
|
|
|
|
-CSpellEffectAnimation::CSpellEffectAnimation(CBattleInterface * _owner, ui32 _effect, BattleHex _destTile, int _dx, int _dy, bool _Vflip, bool _alignToBottom)
|
|
|
- :CBattleAnimation(_owner), effect(_effect), destTile(_destTile), customAnim(""), x(-1), y(-1), dx(_dx), dy(_dy), Vflip(_Vflip), alignToBottom(_alignToBottom)
|
|
|
+CEffectAnimation::CEffectAnimation(CBattleInterface * _owner, std::string _customAnim, int _x, int _y, int _dx, int _dy, bool _Vflip, bool _alignToBottom)
|
|
|
+ : CBattleAnimation(_owner),
|
|
|
+ destTile(BattleHex::INVALID),
|
|
|
+ customAnim(_customAnim),
|
|
|
+ x(_x),
|
|
|
+ y(_y),
|
|
|
+ dx(_dx),
|
|
|
+ dy(_dy),
|
|
|
+ Vflip(_Vflip),
|
|
|
+ alignToBottom(_alignToBottom)
|
|
|
{
|
|
|
- logAnim->debug("Created spell anim for effect #%d", effect);
|
|
|
+ logAnim->debug("Created effect animation %s", customAnim);
|
|
|
}
|
|
|
|
|
|
-CSpellEffectAnimation::CSpellEffectAnimation(CBattleInterface * _owner, std::string _customAnim, int _x, int _y, int _dx, int _dy, bool _Vflip, bool _alignToBottom)
|
|
|
- :CBattleAnimation(_owner), effect(-1), destTile(BattleHex::INVALID), customAnim(_customAnim), x(_x), y(_y), dx(_dx), dy(_dy), Vflip(_Vflip), alignToBottom(_alignToBottom)
|
|
|
+CEffectAnimation::CEffectAnimation(CBattleInterface * _owner, std::string _customAnim, BattleHex _destTile, bool _Vflip, bool _alignToBottom)
|
|
|
+ : CBattleAnimation(_owner),
|
|
|
+ destTile(_destTile),
|
|
|
+ customAnim(_customAnim),
|
|
|
+ x(-1),
|
|
|
+ y(-1),
|
|
|
+ dx(0),
|
|
|
+ dy(0),
|
|
|
+ Vflip(_Vflip),
|
|
|
+ alignToBottom(_alignToBottom)
|
|
|
{
|
|
|
- logAnim->debug("Created spell anim for %s", customAnim);
|
|
|
-}
|
|
|
-
|
|
|
-CSpellEffectAnimation::CSpellEffectAnimation(CBattleInterface * _owner, std::string _customAnim, BattleHex _destTile, bool _Vflip, bool _alignToBottom)
|
|
|
- :CBattleAnimation(_owner), effect(-1), destTile(_destTile), customAnim(_customAnim), x(-1), y(-1), dx(0), dy(0), Vflip(_Vflip), alignToBottom(_alignToBottom)
|
|
|
-{
|
|
|
- logAnim->debug("Created spell anim for %s", customAnim);
|
|
|
+ logAnim->debug("Created effect animation %s", customAnim);
|
|
|
}
|
|
|
|
|
|
|
|
|
-bool CSpellEffectAnimation::init()
|
|
|
+bool CEffectAnimation::init()
|
|
|
{
|
|
|
if(!isEarliest(true))
|
|
|
return false;
|
|
|
|
|
|
- if(customAnim.empty() && effect != ui32(-1) && !graphics->battleACToDef[effect].empty())
|
|
|
- {
|
|
|
- customAnim = graphics->battleACToDef[effect][0];
|
|
|
- }
|
|
|
-
|
|
|
if(customAnim.empty())
|
|
|
{
|
|
|
endAnim();
|
|
|
@@ -990,7 +1000,7 @@ bool CSpellEffectAnimation::init()
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-void CSpellEffectAnimation::nextFrame()
|
|
|
+void CEffectAnimation::nextFrame()
|
|
|
{
|
|
|
//notice: there may be more than one effect in owner->battleEffects correcponding to this animation (ie. armageddon)
|
|
|
for(auto & elem : owner->battleEffects)
|
|
|
@@ -1013,7 +1023,7 @@ void CSpellEffectAnimation::nextFrame()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void CSpellEffectAnimation::endAnim()
|
|
|
+void CEffectAnimation::endAnim()
|
|
|
{
|
|
|
CBattleAnimation::endAnim();
|
|
|
|