aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins/sound.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2013-01-07 13:49:41 +0200
committerFilippos Karapetis2013-01-07 13:49:41 +0200
commitcdad3b605d3b112a16e91ab312b1dd93f5bc8f03 (patch)
treef0b86f4634b9b3451819b73a5997287d6637aaf8 /engines/hopkins/sound.cpp
parent30eeb9163d43ab3c0cd78dbc9f2b249b58699a0d (diff)
downloadscummvm-rg350-cdad3b605d3b112a16e91ab312b1dd93f5bc8f03.tar.gz
scummvm-rg350-cdad3b605d3b112a16e91ab312b1dd93f5bc8f03.tar.bz2
scummvm-rg350-cdad3b605d3b112a16e91ab312b1dd93f5bc8f03.zip
HOPKINS: Simplify SoundManager::WSOUND()
Diffstat (limited to 'engines/hopkins/sound.cpp')
-rw-r--r--engines/hopkins/sound.cpp159
1 files changed, 29 insertions, 130 deletions
diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp
index 1925bac1b3..a35fae5285 100644
--- a/engines/hopkins/sound.cpp
+++ b/engines/hopkins/sound.cpp
@@ -318,6 +318,16 @@ void SoundManager::playAnim_SOUND(int soundNumber) {
}
}
+static const char *modSounds[] = {
+ "appart", "ville", "Rock", "police", "deep"
+ "purgat", "riviere", "SUSPENS", "labo", "cadavre",
+ "cabane", "purgat2", "foret", "ile", "ile2",
+ "hopkins", "peur", "URAVOLGA", "BASE", "cadavre2",
+ "usine", "chien", "coeur", "stand", "ocean",
+ "base3", "gloop", "cant", "feel", "lost",
+ "tobac"
+};
+
void SoundManager::WSOUND(int soundNumber) {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) {
if (soundNumber > 27)
@@ -328,135 +338,7 @@ void SoundManager::WSOUND(int soundNumber) {
if (MOD_FLAG)
WSOUND_OFF();
- switch (soundNumber) {
- case 1:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("appart");
- else
- PLAY_MOD("appar");
- break;
- case 2:
- PLAY_MOD("ville");
- break;
- case 3:
- PLAY_MOD("Rock");
- break;
- case 4:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("police");
- else
- PLAY_MOD("polic");
- break;
- case 5:
- PLAY_MOD("deep");
- break;
- case 6:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("purgat");
- else
- PLAY_MOD("purga");
- break;
- case 7:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("riviere");
- else
- PLAY_MOD("rivie");
- break;
- case 8:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("SUSPENS");
- else
- PLAY_MOD("SUSPE");
- break;
- case 9:
- PLAY_MOD("labo");
- break;
- case 10:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("cadavre");
- else
- PLAY_MOD("cadav");
- break;
- case 11:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("cabane");
- else
- PLAY_MOD("caban");
- break;
- case 12:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("purgat2");
- else
- PLAY_MOD("purg2");
- break;
- case 13:
- PLAY_MOD("foret");
- break;
- case 14:
- PLAY_MOD("ile");
- break;
- case 15:
- PLAY_MOD("ile2");
- break;
- case 16:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("hopkins");
- else
- PLAY_MOD("hopki");
- break;
- case 17:
- PLAY_MOD("peur");
- break;
- case 18:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("URAVOLGA");
- else
- PLAY_MOD("peur");
- break;
- case 19:
- PLAY_MOD("BASE");
- break;
- case 20:
- if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
- PLAY_MOD("cadavre2");
- else
- PLAY_MOD("cada2");
- break;
- case 21:
- PLAY_MOD("usine");
- break;
- case 22:
- PLAY_MOD("chien");
- break;
- case 23:
- PLAY_MOD("coeur");
- break;
- case 24:
- PLAY_MOD("stand");
- break;
- case 25:
- PLAY_MOD("ocean");
- break;
- case 26:
- PLAY_MOD("base3");
- break;
- case 27:
- PLAY_MOD("gloop");
- break;
- case 28:
- PLAY_MOD("cant");
- break;
- case 29:
- PLAY_MOD("feel");
- break;
- case 30:
- PLAY_MOD("lost");
- break;
- case 31:
- PLAY_MOD("tobac");
- break;
- }
-
+ PLAY_MOD(modSounds[soundNumber - 1]);
old_music = soundNumber;
}
}
@@ -481,7 +363,24 @@ void SoundManager::WSOUND_OFF() {
void SoundManager::PLAY_MOD(const Common::String &file) {
if (_musicOffFl)
return;
- _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, file);
+ Common::String modFile = file;
+
+ // HACK
+ if (modFile == "URAVOLGA" && (_vm->getPlatform() == Common::kPlatformWindows || _vm->getPlatform() == Common::kPlatformLinux))
+ modFile = "peur";
+
+ // The Windows/Linux version chops off the music file names to 5 characters
+ if (modFile.size() > 5 && (_vm->getPlatform() == Common::kPlatformWindows || _vm->getPlatform() == Common::kPlatformLinux)) {
+ if (!modFile.hasSuffix("2")) {
+ while (modFile.size() > 5)
+ modFile.deleteLastChar();
+ } else {
+ while (modFile.size() > 4)
+ modFile.deleteLastChar();
+ modFile += "2";
+ }
+ }
+ _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, modFile);
if (MOD_FLAG) {
stopMusic();
delMusic();