1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

Sound patch from Ubuntux #3

(vcmi_sounds_sets.diff)
This commit is contained in:
Michał W. Urbańczyk 2009-04-22 18:50:22 +00:00
parent ade4b46edd
commit ff131a3b2f
3 changed files with 18 additions and 1 deletions

View File

@ -2403,6 +2403,9 @@ void CPlayerInterface::battleAttack(BattleAttack *ba)
void CPlayerInterface::showComp(SComponent comp)
{
boost::unique_lock<boost::recursive_mutex> un(*pim);
CGI->mush->playSoundFromSet(CGI->mush->pickup_sounds);
adventureInt->infoBar.showComp(&comp,4000);
}

View File

@ -37,6 +37,10 @@ void CMusicHandler::initMusics()
#undef VCMI_SOUND_NAME
#undef VCMI_SOUND_FILE
// Vectors for helper(s)
pickup_sounds += soundBase::pickup01, soundBase::pickup02, soundBase::pickup03,
soundBase::pickup04, soundBase::pickup05, soundBase::pickup06, soundBase::pickup07;
//AITheme0 = Mix_LoadMUS(DATA_DIR "MP3" PATHSEPARATOR "AITheme0.mp3");
//AITheme1 = Mix_LoadMUS(DATA_DIR "MP3" PATHSEPARATOR "AITHEME1.mp3");
//AITheme2 = Mix_LoadMUS(DATA_DIR "MP3" PATHSEPARATOR "AITHEME2.mp3");
@ -80,7 +84,7 @@ void CMusicHandler::initMusics()
//winBattle = Mix_LoadMUS(DATA_DIR "MP3" PATHSEPARATOR "Win Battle.mp3");
//winScenario = Mix_LoadMUS(DATA_DIR "MP3" PATHSEPARATOR "Win Scenario.mp3");
// Map sounds
// Load sounds
sndh = new CSndHandler(std::string(DATA_DIR "Data" PATHSEPARATOR "Heroes3.snd"));
}
@ -137,3 +141,9 @@ int CMusicHandler::playSound(soundBase::soundNames soundID)
return channel;
}
// Helper. Randomly select a sound from an array and play it
int CMusicHandler::playSoundFromSet(std::vector<soundBase::soundNames> &sound_vec)
{
return playSound(sound_vec[rand() % sound_vec.size()]);
}

View File

@ -42,6 +42,10 @@ public:
// Sounds
int playSound(soundBase::soundNames soundID); // plays sound wavs from Heroes3.snd
int playSoundFromSet(std::vector<soundBase::soundNames> &sound_vec);
// Sets
std::vector<soundBase::soundNames> pickup_sounds;
};
#endif // __CMUSICHANDLER_H__