aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2012-06-11 06:11:53 +0200
committerSven Hesse2012-06-11 06:20:34 +0200
commitfe44939eba096bad083254b1c5152ef070ac4dc8 (patch)
treeab0d015edcf4234f6ffe6903dce14699178fc938 /engines/gob
parent385bd7c6a045b1a4c7b64ebef4471805020bdadd (diff)
downloadscummvm-rg350-fe44939eba096bad083254b1c5152ef070ac4dc8.tar.gz
scummvm-rg350-fe44939eba096bad083254b1c5152ef070ac4dc8.tar.bz2
scummvm-rg350-fe44939eba096bad083254b1c5152ef070ac4dc8.zip
GOB: Play the music on the title screen of Gob1 EGA
The EGA version of Gobliiins comes with an MDY track. While the original doesn't play it, we thought it might be a nice idea to play it nevertheless.
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/detection_tables.h4
-rw-r--r--engines/gob/inter_v1.cpp34
-rw-r--r--engines/gob/sound/adlib.h6
-rw-r--r--engines/gob/sound/sound.cpp53
-rw-r--r--engines/gob/sound/sound.h4
5 files changed, 79 insertions, 22 deletions
diff --git a/engines/gob/detection_tables.h b/engines/gob/detection_tables.h
index 7aa58b9b97..77b54a19cd 100644
--- a/engines/gob/detection_tables.h
+++ b/engines/gob/detection_tables.h
@@ -34,7 +34,7 @@ static const GOBGameDescription gameDescriptions[] = {
GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
- kFeaturesEGA,
+ kFeaturesEGA | kFeaturesAdLib,
0, 0, 0
},
{
@@ -48,7 +48,7 @@ static const GOBGameDescription gameDescriptions[] = {
GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
- kFeaturesEGA,
+ kFeaturesEGA | kFeaturesAdLib,
0, 0, 0
},
{ // Supplied by Theruler76 in bug report #1201233
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 4aa54f720b..6fc472a0ac 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -286,10 +286,40 @@ void Inter_v1::o1_loadMult() {
}
void Inter_v1::o1_playMult() {
- int16 checkEscape;
+ // NOTE: The EGA version of Gobliiins has an MDY tune.
+ // While the original doesn't play it, we do.
+ bool isGob1EGAIntro = _vm->getGameType() == kGameTypeGob1 &&
+ _vm->isEGA() &&
+ _vm->_game->_script->pos() == 1010 &&
+ _vm->isCurrentTot("intro.tot") &&
+ VAR(57) != 0xFFFFFFFF &&
+ _vm->_dataIO->hasFile("goblins.mdy") &&
+ _vm->_dataIO->hasFile("goblins.tbr");
+
+ int16 checkEscape = _vm->_game->_script->readInt16();
+
+ if (isGob1EGAIntro) {
+ _vm->_sound->adlibLoadTBR("goblins.tbr");
+ _vm->_sound->adlibLoadMDY("goblins.mdy");
+ _vm->_sound->adlibSetRepeating(-1);
+
+ _vm->_sound->adlibPlay();
+ }
- checkEscape = _vm->_game->_script->readInt16();
_vm->_mult->playMult(VAR(57), -1, checkEscape, 0);
+
+ if (isGob1EGAIntro) {
+
+ // User didn't escape the intro mult, wait for an escape here
+ if (VAR(57) != 0xFFFFFFFF) {
+ while (_vm->_util->getKey() != kKeyEscape) {
+ _vm->_util->processInput();
+ _vm->_util->longDelay(1);
+ }
+ }
+
+ _vm->_sound->adlibUnload();
+ }
}
void Inter_v1::o1_freeMultKeys() {
diff --git a/engines/gob/sound/adlib.h b/engines/gob/sound/adlib.h
index df1b77fd4d..17ab950752 100644
--- a/engines/gob/sound/adlib.h
+++ b/engines/gob/sound/adlib.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef GOB_SOUND_NEWADLIB_H
-#define GOB_SOUND_NEWADLIB_H
+#ifndef GOB_SOUND_ADLIB_H
+#define GOB_SOUND_ADLIB_H
#include "common/mutex.h"
@@ -303,4 +303,4 @@ private:
} // End of namespace Gob
-#endif // GOB_SOUND_NEWADLIB_H
+#endif // GOB_SOUND_ADLIB_H
diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp
index f14e9b150a..9f72d1a98f 100644
--- a/engines/gob/sound/sound.cpp
+++ b/engines/gob/sound/sound.cpp
@@ -51,6 +51,8 @@ Sound::Sound(GobEngine *vm) : _vm(vm) {
_hasAdLib = (!_vm->_noMusic && _vm->hasAdLib());
+ _hasAdLibBg = _hasAdLib;
+
if (!_vm->_noMusic && (_vm->getPlatform() == Common::kPlatformAmiga)) {
_infogrames = new Infogrames(*_vm->_mixer);
_protracker = new Protracker(*_vm->_mixer);
@@ -274,8 +276,7 @@ bool Sound::adlibLoadMDY(const char *fileName) {
if (!_hasAdLib)
return false;
- if (!_mdyPlayer)
- _mdyPlayer = new MUSPlayer(*_vm->_mixer);
+ createMDYPlayer();
debugC(1, kDebugSound, "AdLib: Loading MDY data (\"%s\")", fileName);
@@ -296,8 +297,7 @@ bool Sound::adlibLoadTBR(const char *fileName) {
if (!_hasAdLib)
return false;
- if (!_mdyPlayer)
- _mdyPlayer = new MUSPlayer(*_vm->_mixer);
+ createMDYPlayer();
Common::SeekableReadStream *stream = _vm->_dataIO->getFile(fileName);
if (!stream) {
@@ -318,8 +318,7 @@ void Sound::adlibPlayTrack(const char *trackname) {
if (!_hasAdLib)
return;
- if (!_adlPlayer)
- _adlPlayer = new ADLPlayer(*_vm->_mixer);
+ createADLPlayer();
if (_adlPlayer->isPlaying())
return;
@@ -329,11 +328,10 @@ void Sound::adlibPlayTrack(const char *trackname) {
}
void Sound::adlibPlayBgMusic() {
- if (!_hasAdLib)
+ if (!_hasAdLib || _hasAdLibBg)
return;
- if (!_adlPlayer)
- _adlPlayer = new ADLPlayer(*_vm->_mixer);
+ createADLPlayer();
static const char *const tracksMac[] = {
// "musmac1.adl", // This track seems to be missing instruments...
@@ -352,13 +350,18 @@ void Sound::adlibPlayBgMusic() {
"musmac5.mid"
};
- if (_vm->getPlatform() == Common::kPlatformWindows) {
- int track = _vm->_util->getRandom(ARRAYSIZE(tracksWin));
- adlibPlayTrack(tracksWin[track]);
- } else {
- int track = _vm->_util->getRandom(ARRAYSIZE(tracksMac));
- adlibPlayTrack(tracksMac[track]);
+ const char *track = 0;
+ if (_vm->getPlatform() == Common::kPlatformWindows)
+ track = tracksWin[ARRAYSIZE(tracksWin)];
+ else
+ track = tracksMac[_vm->_util->getRandom(ARRAYSIZE(tracksMac))];
+
+ if (!track || !_vm->_dataIO->hasFile(track)) {
+ _hasAdLibBg = false;
+ return;
}
+
+ adlibPlayTrack(track);
}
void Sound::adlibPlay() {
@@ -722,4 +725,24 @@ void Sound::bgUnshade() {
_bgatmos->unshade();
}
+void Sound::createMDYPlayer() {
+ if (_mdyPlayer)
+ return;
+
+ delete _adlPlayer;
+ _adlPlayer = 0;
+
+ _mdyPlayer = new MUSPlayer(*_vm->_mixer);
+}
+
+void Sound::createADLPlayer() {
+ if (_adlPlayer)
+ return;
+
+ delete _mdyPlayer;
+ _mdyPlayer= 0;
+
+ _adlPlayer = new ADLPlayer(*_vm->_mixer);
+}
+
} // End of namespace Gob
diff --git a/engines/gob/sound/sound.h b/engines/gob/sound/sound.h
index ea7d639ffe..064a249253 100644
--- a/engines/gob/sound/sound.h
+++ b/engines/gob/sound/sound.h
@@ -142,6 +142,7 @@ private:
GobEngine *_vm;
bool _hasAdLib;
+ bool _hasAdLibBg;
SoundDesc _sounds[kSoundsCount];
@@ -162,6 +163,9 @@ private:
// Audio CD
CDROM *_cdrom;
+
+ void createMDYPlayer();
+ void createADLPlayer();
};
} // End of namespace Gob