1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Implement configurable object sounds: ambient, visit and removal

* If there more than one sound for visit or removal random is played
* At moment only the first ambient sound will be used
This commit is contained in:
Arseniy Shestakov
2017-09-13 03:35:58 +03:00
committed by DJWarmonger
parent e9bfbb70c1
commit f15cadc87b
22 changed files with 347 additions and 91 deletions

View File

@ -37,7 +37,7 @@ CQuest::CQuest()
}
///helpers
static void showInfoDialog(const PlayerColor playerID, const ui32 txtID, const ui16 soundID)
static void showInfoDialog(const PlayerColor playerID, const ui32 txtID, const ui16 soundID = 0)
{
InfoWindow iw;
iw.soundID = soundID;
@ -46,7 +46,7 @@ static void showInfoDialog(const PlayerColor playerID, const ui32 txtID, const u
IObjectInterface::cb->sendAndApply(&iw);
}
static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16 soundID)
static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16 soundID = 0)
{
const PlayerColor playerID = h->getOwner();
showInfoDialog(playerID,txtID,soundID);
@ -685,7 +685,6 @@ void CGSeerHut::onHeroVisit(const CGHeroInstance * h) const
{
BlockingDialog bd (true, false);
bd.player = h->getOwner();
bd.soundID = soundBase::QUEST;
getCompletionText (bd.text, bd.components, isCustom, h);
@ -1085,7 +1084,7 @@ void CGKeymasterTent::onHeroVisit( const CGHeroInstance * h ) const
}
else
txt_id=20;
showInfoDialog(h,txt_id,soundBase::CAVEHEAD);
showInfoDialog(h, txt_id);
}
void CGBorderGuard::initObj(CRandomGenerator & rand)
@ -1116,13 +1115,12 @@ void CGBorderGuard::onHeroVisit(const CGHeroInstance * h) const
{
BlockingDialog bd (true, false);
bd.player = h->getOwner();
bd.soundID = soundBase::QUEST;
bd.text.addTxt (MetaString::ADVOB_TXT, 17);
cb->showBlockingDialog (&bd);
}
else
{
showInfoDialog(h,18,soundBase::CAVEHEAD);
showInfoDialog(h, 18);
AddQuest aq;
aq.quest = QuestInfo (quest, this, visitablePos());