aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2007-07-28 07:52:24 +0000
committerTravis Howell2007-07-28 07:52:24 +0000
commitbb2796c57a5bd6cfb417340e6cfda141eee9342e (patch)
tree4492df3bc4a51286f9409fdd06acf8dfd73c1730 /engines
parent3d434b12335fd70659d5a99dd1dfe83b2145323f (diff)
downloadscummvm-rg350-bb2796c57a5bd6cfb417340e6cfda141eee9342e.tar.gz
scummvm-rg350-bb2796c57a5bd6cfb417340e6cfda141eee9342e.tar.bz2
scummvm-rg350-bb2796c57a5bd6cfb417340e6cfda141eee9342e.zip
Add support for multi-tune Protracker modules used in the Amiga version of Waxworks.
svn-id: r28256
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.cpp2
-rw-r--r--engines/agos/res_snd.cpp55
-rw-r--r--engines/parallaction/disk.h8
-rw-r--r--engines/parallaction/disk_br.cpp2
-rw-r--r--engines/parallaction/disk_ns.cpp4
-rw-r--r--engines/parallaction/sound.cpp2
6 files changed, 60 insertions, 13 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index ba429b510c..76e4378982 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -820,7 +820,7 @@ void AGOSEngine_Waxworks::setupGame() {
_numTextBoxes = 10;
_numVars = 255;
- _numMusic = 9;
+ _numMusic = 26;
AGOSEngine::setupGame();
}
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index 779ed67e58..beea0de473 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -139,9 +139,56 @@ void AGOSEngine::loadMusic(uint16 music) {
_nextMusicToPlay = -1;
}
+struct ModuleOffs {
+ uint8 tune;
+ uint8 fileNum;
+ uint32 offs;
+};
+
+static const ModuleOffs amigaWaxworksOffs[20] = {
+ // Pyramid
+ {2, 2, 0, },
+ {3, 2, 50980},
+ {4, 2, 56160},
+ {5, 2, 62364},
+ {6, 2, 73688},
+
+ // Zombie
+ {8, 8, 0},
+ {11, 8, 51156},
+ {12, 8, 56336},
+ {13, 8, 65612},
+ {14, 8, 68744},
+
+ // Mine
+ {9, 9, 0},
+ {15, 9, 47244},
+ {16, 9, 52424},
+ {17, 9, 59652},
+ {18, 9, 62784},
+
+ // Jack
+ {10, 10, 0},
+ {19, 10, 42054},
+ {20, 10, 47234},
+ {21, 10, 49342},
+ {22, 10, 51450},
+};
+
void AGOSEngine::playModule(uint16 music) {
char filename[15];
File f;
+ uint32 offs = 0;
+
+ if (getPlatform() == Common::kPlatformAmiga && getGameType() == GType_WW) {
+ // Multiple tunes are stored in music files for main locations
+ for (uint i = 0; i < 20; i++) {
+ if (amigaWaxworksOffs[i].tune == music) {
+ music = amigaWaxworksOffs[i].fileNum;
+ offs = amigaWaxworksOffs[i].offs;
+ }
+ }
+ }
if (getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO)
sprintf(filename, "elvira2");
@@ -159,21 +206,21 @@ void AGOSEngine::playModule(uint16 music) {
if (!(getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) &&
getFeatures() & GF_CRUNCHED) {
- uint srcSize = f.size();
+ uint32 srcSize = f.size();
byte *srcBuf = (byte *)malloc(srcSize);
if (f.read(srcBuf, srcSize) != srcSize)
error("playModule: Read failed");
- uint dstSize = READ_BE_UINT32(srcBuf + srcSize - 4);
+ uint32 dstSize = READ_BE_UINT32(srcBuf + srcSize - 4);
byte *dstBuf = (byte *)malloc(dstSize);
decrunchFile(srcBuf, dstBuf, srcSize);
free(srcBuf);
Common::MemoryReadStream stream(dstBuf, dstSize);
- audioStream = Audio::makeProtrackerStream(&stream, _mixer->getOutputRate());
+ audioStream = Audio::makeProtrackerStream(&stream, offs);
free(dstBuf);
} else {
- audioStream = Audio::makeProtrackerStream(&f, _mixer->getOutputRate());
+ audioStream = Audio::makeProtrackerStream(&f);
}
_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_modHandle, audioStream);
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h
index d910201f27..ae572b1122 100644
--- a/engines/parallaction/disk.h
+++ b/engines/parallaction/disk.h
@@ -62,7 +62,7 @@ public:
virtual void loadSlide(const char *filename) = 0;
virtual void loadScenery(const char* background, const char* mask) = 0;
virtual Table* loadTable(const char* name) = 0;
- virtual Common::ReadStream* loadMusic(const char* name) = 0;
+ virtual Common::SeekableReadStream* loadMusic(const char* name) = 0;
virtual Common::ReadStream* loadSound(const char* name) = 0;
};
@@ -154,7 +154,7 @@ public:
void loadSlide(const char *filename);
void loadScenery(const char* background, const char* mask);
Table* loadTable(const char* name);
- Common::ReadStream* loadMusic(const char* name);
+ Common::SeekableReadStream* loadMusic(const char* name);
Common::ReadStream* loadSound(const char* name);
};
@@ -188,7 +188,7 @@ public:
void loadSlide(const char *filename);
void loadScenery(const char* background, const char* mask);
Table* loadTable(const char* name);
- Common::ReadStream* loadMusic(const char* name);
+ Common::SeekableReadStream* loadMusic(const char* name);
Common::ReadStream* loadSound(const char* name);
};
@@ -222,7 +222,7 @@ public:
void loadSlide(const char *filename);
void loadScenery(const char* background, const char* mask);
Table* loadTable(const char* name);
- Common::ReadStream* loadMusic(const char* name);
+ Common::SeekableReadStream* loadMusic(const char* name);
Common::ReadStream* loadSound(const char* name);
};
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index 07d9954f23..452b74be51 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -119,7 +119,7 @@ Table* DosDisk_br::loadTable(const char* name) {
return 0;
}
-Common::ReadStream* DosDisk_br::loadMusic(const char* name) {
+Common::SeekableReadStream* DosDisk_br::loadMusic(const char* name) {
debugC(5, kDebugDisk, "DosDisk_br::loadMusic");
return 0;
}
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index bf9b0277cb..e500cd519b 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -674,7 +674,7 @@ Table* DosDisk_ns::loadTable(const char* name) {
return t;
}
-Common::ReadStream* DosDisk_ns::loadMusic(const char* name) {
+Common::SeekableReadStream* DosDisk_ns::loadMusic(const char* name) {
char path[PATH_LEN];
sprintf(path, "%s.mid", name);
@@ -1427,7 +1427,7 @@ Font* AmigaDisk_ns::loadFont(const char* name) {
}
-Common::ReadStream* AmigaDisk_ns::loadMusic(const char* name) {
+Common::SeekableReadStream* AmigaDisk_ns::loadMusic(const char* name) {
return openArchivedFile(name);
}
diff --git a/engines/parallaction/sound.cpp b/engines/parallaction/sound.cpp
index 9976ec13a8..1026aa5f6a 100644
--- a/engines/parallaction/sound.cpp
+++ b/engines/parallaction/sound.cpp
@@ -379,7 +379,7 @@ void AmigaSoundMan::playMusic() {
debugC(1, kDebugAudio, "AmigaSoundMan::playMusic()");
- Common::ReadStream *stream = _vm->_disk->loadMusic(_musicFile);
+ Common::SeekableReadStream *stream = _vm->_disk->loadMusic(_musicFile);
_musicStream = Audio::makeProtrackerStream(stream);
delete stream;