From 5d80fda3a4116ddb29b20b52b1a7273c436714f7 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Dec 2011 12:39:06 +0100 Subject: DREAMWEB: Add Dreambase::loadSpeech method --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/sound.cpp | 15 +++++++++++---- engines/dreamweb/stubs.cpp | 23 ++--------------------- engines/dreamweb/stubs.h | 3 +++ 4 files changed, 17 insertions(+), 25 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index ad6748d021..2d5669fa8f 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -99,6 +99,7 @@ public: void showNames(); // from sound.cpp + bool loadSpeech(byte type1, int idx1, byte type2, int idx2); void volumeAdjust(); void cancelCh0(); void cancelCh1(); diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp index f1837f313a..0fef99ef43 100644 --- a/engines/dreamweb/sound.cpp +++ b/engines/dreamweb/sound.cpp @@ -31,14 +31,21 @@ namespace DreamGen { void DreamGenContext::loadSpeech() { + loadSpeech((uint8)dl, (uint8)dh, (uint8)cl, (uint16)ax); +} + +bool DreamBase::loadSpeech(byte type1, int idx1, byte type2, int idx2) { cancelCh1(); - data.byte(kSpeechloaded) = 0; - Common::String name = Common::String::format("%c%02d%c%04d.RAW", (uint8)dl, (uint8)dh, (uint8)cl, (uint16)ax); + + Common::String name = Common::String::format("%c%02d%c%04d.RAW", type1, idx1, type2, idx2); //debug("name = %s", name.c_str()); - if (engine->loadSpeech(name)) - data.byte(kSpeechloaded) = 1; + bool result = engine->loadSpeech(name); + + data.byte(kSpeechloaded) = result; + return result; } + void DreamBase::volumeAdjust() { if (data.byte(kVolumedirection) == 0) return; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index d74477c003..7e871bd42a 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -888,23 +888,9 @@ void DreamGenContext::useTimedText() { void DreamGenContext::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { #if 1 // if cd if (voiceIndex != 0) { - push(ax); - push(bx); - push(cx); - push(dx); - dl = 'T'; - dh = voiceIndex; - cl = 'T'; - ah = 0; - al = textIndex; - loadSpeech(); - if (data.byte(kSpeechloaded) == 1) { + if (loadSpeech('T', voiceIndex, 'T', textIndex)) { playChannel1(50+12); } - dx = pop(); - cx = pop(); - bx = pop(); - ax = pop(); // FIXME: This fallthrough does not properly support subtitles+speech // mode. The parameters to setuptimedtemp() are sometimes different @@ -4239,12 +4225,7 @@ void DreamGenContext::monkSpeaking() { hangOn(300); for (int i = 40; i <= 48; i++) { - dl = 'T'; - dh = 83; - cl = 'T'; - ah = 0; - al = i; - loadSpeech(); + loadSpeech('T', 83, 'T', i); playChannel1(50 + 12); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 950da21574..c73034ce5e 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -528,6 +528,9 @@ void selectLocation(); void showGroup(); void loadSpeech(); + bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { + return DreamBase::loadSpeech(type1, idx1, type2, idx2); + } void getTime(); void set16ColPalette(); void examineInventory(); -- cgit v1.2.3