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

Fix for missing Death Blow sound

This commit is contained in:
Ivan Savenko 2022-12-25 20:11:22 +02:00
parent 063b8732ff
commit 7e3cd7db51
4 changed files with 18 additions and 33 deletions

View File

@ -40,16 +40,16 @@ BattleEffectsController::BattleEffectsController(BattleInterface & owner):
void BattleEffectsController::displayEffect(EBattleEffect effect, const BattleHex & destTile)
{
displayEffect(effect, soundBase::invalid, destTile);
displayEffect(effect, "", destTile);
}
void BattleEffectsController::displayEffect(EBattleEffect effect, uint32_t soundID, const BattleHex & destTile)
void BattleEffectsController::displayEffect(EBattleEffect effect, std::string soundFile, const BattleHex & destTile)
{
size_t effectID = static_cast<size_t>(effect);
std::string customAnim = graphics->battleACToDef[effectID][0];
owner.stacksController->addNewAnim(new PointEffectAnimation(owner, soundBase::stringsList()[soundID], customAnim, destTile));
owner.stacksController->addNewAnim(new PointEffectAnimation(owner, soundFile, customAnim, destTile));
}
void BattleEffectsController::battleTriggerEffect(const BattleTriggerEffect & bte)
@ -66,22 +66,22 @@ void BattleEffectsController::battleTriggerEffect(const BattleTriggerEffect & bt
switch(bte.effect)
{
case Bonus::HP_REGENERATION:
displayEffect(EBattleEffect::REGENERATION, soundBase::REGENER, stack->getPosition());
displayEffect(EBattleEffect::REGENERATION, "REGENER", stack->getPosition());
break;
case Bonus::MANA_DRAIN:
displayEffect(EBattleEffect::MANA_DRAIN, soundBase::MANADRAI, stack->getPosition());
displayEffect(EBattleEffect::MANA_DRAIN, "MANADRAI", stack->getPosition());
break;
case Bonus::POISON:
displayEffect(EBattleEffect::POISON, soundBase::POISON, stack->getPosition());
displayEffect(EBattleEffect::POISON, "POISON", stack->getPosition());
break;
case Bonus::FEAR:
displayEffect(EBattleEffect::FEAR, soundBase::FEAR, stack->getPosition());
displayEffect(EBattleEffect::FEAR, "FEAR", stack->getPosition());
break;
case Bonus::MORALE:
{
std::string hlp = CGI->generaltexth->allTexts[33];
boost::algorithm::replace_first(hlp,"%s",(stack->getName()));
displayEffect(EBattleEffect::GOOD_MORALE, soundBase::GOODMRLE, stack->getPosition());
displayEffect(EBattleEffect::GOOD_MORALE, "GOODMRLE", stack->getPosition());
owner.appendBattleLog(hlp);
break;
}
@ -104,7 +104,7 @@ void BattleEffectsController::startAction(const BattleAction* action)
break;
case EActionType::BAD_MORALE:
owner.appendBattleLog(stack->formatGeneralMessage(-34));
displayEffect(EBattleEffect::BAD_MORALE, soundBase::BADMRLE, stack->getPosition());
displayEffect(EBattleEffect::BAD_MORALE, "BADMRLE", stack->getPosition());
break;
}
@ -113,7 +113,7 @@ void BattleEffectsController::startAction(const BattleAction* action)
switch(action->actionType)
{
case EActionType::STACK_HEAL:
displayEffect(EBattleEffect::REGENERATION, soundBase::REGENER, actionTarget.at(0).hexValue);
displayEffect(EBattleEffect::REGENERATION, "REGENER", actionTarget.at(0).hexValue);
break;
}

View File

@ -56,7 +56,7 @@ public:
//displays custom effect on the battlefield
void displayEffect(EBattleEffect effect, const BattleHex & destTile);
void displayEffect(EBattleEffect effect, uint32_t soundID, const BattleHex & destTile);
void displayEffect(EBattleEffect effect, std::string soundFile, const BattleHex & destTile);
void battleTriggerEffect(const BattleTriggerEffect & bte);

View File

@ -225,7 +225,7 @@ void BattleStacksController::stackAdded(const CStack * stack, bool instant)
{
addNewAnim(new ColorTransformAnimation(owner, stack, "summonFadeIn", nullptr));
if (stack->isClone())
addNewAnim(new ColorTransformAnimation(owner, stack, "cloning", SpellID(SpellID::CLONE).toSpell()));
addNewAnim(new ColorTransformAnimation(owner, stack, "cloning", nullptr));
});
}
}
@ -437,7 +437,7 @@ void BattleStacksController::stacksAreAttacked(std::vector<StackAttackedInfo> at
addNewAnim(new HittedAnimation(owner, attackedInfo.defender));
if (attackedInfo.fireShield)
owner.effectsController->displayEffect(EBattleEffect::FIRE_SHIELD, soundBase::FIRESHIE, attackedInfo.attacker->getPosition());
owner.effectsController->displayEffect(EBattleEffect::FIRE_SHIELD, "FIRESHIE", attackedInfo.attacker->getPosition());
if (attackedInfo.spellEffect != SpellID::NONE)
owner.displaySpellEffect(attackedInfo.spellEffect.toSpell(), attackedInfo.defender->getPosition());
@ -449,7 +449,7 @@ void BattleStacksController::stacksAreAttacked(std::vector<StackAttackedInfo> at
if (attackedInfo.rebirth)
{
owner.executeOnAnimationCondition(EAnimationEvents::AFTER_HIT, true, [=](){
owner.effectsController->displayEffect(EBattleEffect::RESURRECT, soundBase::RESURECT, attackedInfo.defender->getPosition());
owner.effectsController->displayEffect(EBattleEffect::RESURRECT, "RESURECT", attackedInfo.defender->getPosition());
addNewAnim(new ResurrectionAnimation(owner, attackedInfo.defender));
});
}
@ -552,7 +552,7 @@ void BattleStacksController::stackAttacking( const StackAttackInfo & info )
{
owner.executeOnAnimationCondition(EAnimationEvents::BEFORE_HIT, true, [=]() {
owner.appendBattleLog(info.attacker->formatGeneralMessage(-45));
owner.effectsController->displayEffect(EBattleEffect::GOOD_LUCK, soundBase::GOODLUCK, attacker->getPosition());
owner.effectsController->displayEffect(EBattleEffect::GOOD_LUCK, "GOODLUCK", attacker->getPosition());
});
}
@ -560,7 +560,7 @@ void BattleStacksController::stackAttacking( const StackAttackInfo & info )
{
owner.executeOnAnimationCondition(EAnimationEvents::BEFORE_HIT, true, [=]() {
owner.appendBattleLog(info.attacker->formatGeneralMessage(-44));
owner.effectsController->displayEffect(EBattleEffect::BAD_LUCK, soundBase::BADLUCK, attacker->getPosition());
owner.effectsController->displayEffect(EBattleEffect::BAD_LUCK, "BADLUCK", attacker->getPosition());
});
}
@ -568,7 +568,7 @@ void BattleStacksController::stackAttacking( const StackAttackInfo & info )
{
owner.executeOnAnimationCondition(EAnimationEvents::BEFORE_HIT, true, [=]() {
owner.appendBattleLog(info.attacker->formatGeneralMessage(365));
owner.effectsController->displayEffect(EBattleEffect::DEATH_BLOW, soundBase::deathBlow, defender->getPosition());
owner.effectsController->displayEffect(EBattleEffect::DEATH_BLOW, "DEATHBLO", defender->getPosition());
});
for(auto elem : info.secondaryDefender)
@ -603,7 +603,7 @@ void BattleStacksController::stackAttacking( const StackAttackInfo & info )
{
owner.executeOnAnimationCondition(EAnimationEvents::AFTER_HIT, true, [=]()
{
owner.effectsController->displayEffect(EBattleEffect::DRAIN_LIFE, soundBase::DRAINLIF, attacker->getPosition());
owner.effectsController->displayEffect(EBattleEffect::DRAIN_LIFE, "DRAINLIF", attacker->getPosition());
});
}

View File

@ -1044,21 +1044,6 @@ public:
VCMI_SOUND_LIST
sound_after_last
};
#undef VCMI_SOUND_NAME
#define VCMI_SOUND_NAME(sequence) sounds.push_back("" #sequence "");
static std::vector<std::string> & stringsList()
{
static std::vector<std::string> sounds;
if(!sounds.size())
{
sounds.push_back("invalid");
sounds.push_back("sound_todo");
VCMI_SOUND_LIST
sounds.push_back("sound_after_last");
}
return sounds;
}
#undef VCMI_SOUND_FILE
#undef VCMI_SOUND_NAME
};