1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fixed sound effect when hero disappears

This commit is contained in:
rhn 2014-07-30 19:49:19 +02:00
parent e9534603c2
commit a491c11305
2 changed files with 14 additions and 5 deletions

View File

@ -1516,13 +1516,20 @@ void CPlayerInterface::centerView (int3 pos, int focusTime)
void CPlayerInterface::objectRemoved( const CGObjectInstance *obj )
{
EVENT_HANDLER_CALLED_BY_CLIENT;
std::string handlerName = VLC->objtypeh->getObjectHandlerName(obj->ID);
if (handlerName == "pickable") {
waitWhileDialog();
CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds);
} else if ((handlerName == "monster") || (handlerName == "hero")) {
waitWhileDialog();
CCS->soundh->playSound(soundBase::KillFade);
}
if(obj->ID == Obj::HERO && obj->tempOwner == playerID)
{
const CGHeroInstance *h = static_cast<const CGHeroInstance*>(obj);
heroKilled(h);
} else if (VLC->objtypeh->getObjectHandlerName(obj->ID) == "pickable") {
waitWhileDialog();
CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds);
}
}

View File

@ -3,6 +3,9 @@
// Use some magic to keep the list of files and their code name in sync.
#define VCMI_SOUND_LIST \
/* Sounds for map actions */ \
VCMI_SOUND_NAME(KillFade) VCMI_SOUND_FILE(KILLFADE.wav) /* hero or monster disappears */ \
/* Other sounds (TODO: separate out the sounds for units, spells and the rest */ \
VCMI_SOUND_NAME(AAGLAttack) VCMI_SOUND_FILE(AAGLATTK.wav) \
VCMI_SOUND_NAME(AAGLDefend) VCMI_SOUND_FILE(AAGLDFND.wav) \
VCMI_SOUND_NAME(AAGLKill) VCMI_SOUND_FILE(AAGLKILL.wav) \
@ -515,7 +518,6 @@ VCMI_SOUND_NAME(ITRGKill) VCMI_SOUND_FILE(ITRGKILL.wav) \
VCMI_SOUND_NAME(ITRGMove) VCMI_SOUND_FILE(ITRGMOVE.wav) \
VCMI_SOUND_NAME(ITRGWNCE) VCMI_SOUND_FILE(ITRGWNCE.wav) \
VCMI_SOUND_NAME(KEEPShot) VCMI_SOUND_FILE(KEEPSHOT.wav) \
VCMI_SOUND_NAME(KillFADE) VCMI_SOUND_FILE(KILLFADE.wav) \
VCMI_SOUND_NAME(LANDKill) VCMI_SOUND_FILE(LANDKILL.wav) \
VCMI_SOUND_NAME(LANDMINE) VCMI_SOUND_FILE(LANDMINE.wav) \
VCMI_SOUND_NAME(LCRSAttack) VCMI_SOUND_FILE(LCRSATTK.wav) \
@ -1033,4 +1035,4 @@ public:
};
#undef VCMI_SOUND_NAME
#undef VCMI_SOUND_FILE
};
};