mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Fix cast animation for Genie and heroes
This commit is contained in:
@@ -1123,10 +1123,13 @@ bool HeroCastAnimation::init()
|
|||||||
|
|
||||||
void HeroCastAnimation::initializeProjectile()
|
void HeroCastAnimation::initializeProjectile()
|
||||||
{
|
{
|
||||||
//spell has no projectile to play, ignore this step
|
// spell has no projectile to play, ignore this step
|
||||||
if (spell->animationInfo.projectile.empty())
|
if (spell->animationInfo.projectile.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// targeted spells should have well, target
|
||||||
|
assert(tile.isValid());
|
||||||
|
|
||||||
Point srccoord = hero->pos.center();
|
Point srccoord = hero->pos.center();
|
||||||
Point destcoord = owner.stacksController->getStackPositionAtHex(tile, target); //position attacked by projectile
|
Point destcoord = owner.stacksController->getStackPositionAtHex(tile, target); //position attacked by projectile
|
||||||
|
|
||||||
|
|||||||
@@ -492,7 +492,11 @@ void BattleInterface::spellCast(const BattleSpellCast * sc)
|
|||||||
|
|
||||||
if (!castSoundPath.empty())
|
if (!castSoundPath.empty())
|
||||||
{
|
{
|
||||||
executeOnAnimationCondition(EAnimationEvents::BEFORE_HIT, true, [=]() {
|
auto group = spell->animationInfo.projectile.empty() ?
|
||||||
|
EAnimationEvents::HIT:
|
||||||
|
EAnimationEvents::BEFORE_HIT;//FIXME: should be on projectile spawning
|
||||||
|
|
||||||
|
executeOnAnimationCondition(group, true, [=]() {
|
||||||
CCS->soundh->playSound(castSoundPath);
|
CCS->soundh->playSound(castSoundPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -510,7 +514,6 @@ void BattleInterface::spellCast(const BattleSpellCast * sc)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (targetedTile.isValid())
|
|
||||||
{
|
{
|
||||||
auto hero = sc->side ? defendingHero : attackingHero;
|
auto hero = sc->side ? defendingHero : attackingHero;
|
||||||
assert(hero);
|
assert(hero);
|
||||||
|
|||||||
Reference in New Issue
Block a user