PARALLACTION: remove code duplication in NS sound code.

svn-id: r55146
This commit is contained in:
Nicola Mettifogo 2011-01-07 15:17:07 +00:00
parent 868717b444
commit 75d7ee9bd6
2 changed files with 8 additions and 3 deletions

View File

@ -136,7 +136,9 @@ class DosSoundMan_ns : public SoundMan_ns {
int _musicData1;
bool isLocationSilent(const char *locationName);
bool locationHasOwnSoftMusic(const char *locationName);
public:
DosSoundMan_ns(Parallaction_ns *vm, MidiDriver *midiDriver);
~DosSoundMan_ns();

View File

@ -284,13 +284,16 @@ void DosSoundMan_ns::pause(bool p) {
_midiPlayer->pause(p);
}
bool DosSoundMan_ns::locationHasOwnSoftMusic(const char *locationName) {
return !scumm_stricmp(locationName, "night") || !scumm_stricmp(locationName, "intsushi");
}
void DosSoundMan_ns::playCharacterMusic(const char *character) {
if (character == NULL) {
return;
}
if (!scumm_stricmp(_vm->_location._name, "night") ||
!scumm_stricmp(_vm->_location._name, "intsushi")) {
if (locationHasOwnSoftMusic(_vm->_location._name)) {
return;
}
@ -319,7 +322,7 @@ void DosSoundMan_ns::playLocationMusic(const char *location) {
debugC(2, kDebugExec, "changeLocation: started character specific music");
}
if (!scumm_stricmp(location, "night") || !scumm_stricmp(location, "intsushi")) {
if (locationHasOwnSoftMusic(location)) {
setMusicFile("soft");
playMusic();