aboutsummaryrefslogtreecommitdiff
path: root/engines/tony/tony.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tony/tony.cpp')
-rw-r--r--engines/tony/tony.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index 2857bb93f8..c51f449aa1 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -82,6 +82,9 @@ TonyEngine::TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc) : Eng
_bQuitNow = false;
_bTimeFreezed = false;
_nTimeFreezed = 0;
+ _vdbCodec = FPCODEC_UNKNOWN;
+
+ memset(_funcList, 0, sizeof(_funcList));
}
TonyEngine::~TonyEngine() {
@@ -323,10 +326,10 @@ void TonyEngine::playMusic(int nChannel, const Common::String &fname, int nFX, b
_stream[GLOBALS._nextChannel]->unloadFile();
if (!getIsDemo()) {
- if (!_stream[GLOBALS._nextChannel]->loadFile(fname, FPCODEC_ADPCM, nSync))
+ if (!_stream[GLOBALS._nextChannel]->loadFile(fname, nSync))
error("failed to open music file '%s'", fname.c_str());
} else {
- _stream[GLOBALS._nextChannel]->loadFile(fname, FPCODEC_ADPCM, nSync);
+ _stream[GLOBALS._nextChannel]->loadFile(fname, nSync);
}
_stream[GLOBALS._nextChannel]->setLoop(bLoop);
@@ -335,10 +338,10 @@ void TonyEngine::playMusic(int nChannel, const Common::String &fname, int nFX, b
GLOBALS._flipflop = 1 - GLOBALS._flipflop;
} else {
if (!getIsDemo()) {
- if (!_stream[nChannel]->loadFile(fname, FPCODEC_ADPCM, nSync))
+ if (!_stream[nChannel]->loadFile(fname, nSync))
error("failed to open music file '%s'", fname.c_str());
} else {
- _stream[nChannel]->loadFile(fname, FPCODEC_ADPCM, nSync);
+ _stream[nChannel]->loadFile(fname, nSync);
}
_stream[nChannel]->setLoop(bLoop);
@@ -356,10 +359,10 @@ void TonyEngine::doNextMusic(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
if (!g_vm->getIsDemo()) {
- if (!streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, FPCODEC_ADPCM, GLOBALS._nextSync))
+ if (!streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, GLOBALS._nextSync))
error("failed to open next music file '%s'", GLOBALS._nextMusic.c_str());
} else {
- streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, FPCODEC_ADPCM, GLOBALS._nextSync);
+ streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, GLOBALS._nextSync);
}
streams[GLOBALS._nextChannel]->setLoop(GLOBALS._nextLoop);
@@ -433,7 +436,7 @@ void TonyEngine::preloadSFX(int nChannel, const char *fn) {
_theSound.createSfx(&_sfx[nChannel]);
- _sfx[nChannel]->loadFile(fn, FPCODEC_ADPCM);
+ _sfx[nChannel]->loadFile(fn);
}
FPSfx *TonyEngine::createSFX(Common::SeekableReadStream *stream) {
@@ -453,7 +456,7 @@ void TonyEngine::preloadUtilSFX(int nChannel, const char *fn) {
_theSound.createSfx(&_utilSfx[nChannel]);
- _utilSfx[nChannel]->loadFile(fn, FPCODEC_ADPCM);
+ _utilSfx[nChannel]->loadFile(fn);
_utilSfx[nChannel]->setVolume(63);
}
@@ -573,18 +576,26 @@ void TonyEngine::loadState(CORO_PARAM, int n) {
}
bool TonyEngine::openVoiceDatabase() {
- char id[4];
- uint32 numfiles;
-
// Open the voices database
if (!_vdbFP.open("voices.vdb"))
- return false;
+ if (!_vdbFP.open("voices.mdb"))
+ if (!_vdbFP.open("voices.odb"))
+ if (!_vdbFP.open("voices.fdb"))
+ return false;
_vdbFP.seek(-8, SEEK_END);
- numfiles = _vdbFP.readUint32LE();
- _vdbFP.read(id, 4);
-
- if (id[0] != 'V' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+ uint32 numfiles = _vdbFP.readUint32LE();
+ int32 id = _vdbFP.readUint32BE();
+
+ if (id == MKTAG('V', 'D', 'B', '1'))
+ _vdbCodec = FPCODEC_ADPCM;
+ else if (id == MKTAG('M', 'D', 'B', '1'))
+ _vdbCodec = FPCODEC_MP3;
+ else if (id == MKTAG('O', 'D', 'B', '1'))
+ _vdbCodec = FPCODEC_OGG;
+ else if (id == MKTAG('F', 'D', 'B', '1'))
+ _vdbCodec = FPCODEC_FLAC;
+ else {
_vdbFP.close();
return false;
}