diff options
author | Filippos Karapetis | 2011-12-28 18:53:45 +0200 |
---|---|---|
committer | Filippos Karapetis | 2011-12-28 18:54:17 +0200 |
commit | eaed1b725a7720e5ca72d9c3d380c218c9e5ac6d (patch) | |
tree | c1db9f9255cb37825a27c52090cf252eee495568 | |
parent | 63da2ac271723a33839414827a2f01ef6185490e (diff) | |
download | scummvm-rg350-eaed1b725a7720e5ca72d9c3d380c218c9e5ac6d.tar.gz scummvm-rg350-eaed1b725a7720e5ca72d9c3d380c218c9e5ac6d.tar.bz2 scummvm-rg350-eaed1b725a7720e5ca72d9c3d380c218c9e5ac6d.zip |
DREAMWEB: Replaced most isCD calls with calls checking for speech
This is quite useful for devices with limited storage, where the user
can use the CD version without its speech files
-rw-r--r-- | engines/dreamweb/dreamweb.cpp | 8 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.h | 4 | ||||
-rw-r--r-- | engines/dreamweb/people.cpp | 14 | ||||
-rw-r--r-- | engines/dreamweb/saveload.cpp | 8 | ||||
-rw-r--r-- | engines/dreamweb/sprite.cpp | 24 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 14 | ||||
-rw-r--r-- | engines/dreamweb/talk.cpp | 16 | ||||
-rw-r--r-- | engines/dreamweb/titles.cpp | 6 |
8 files changed, 48 insertions, 46 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index e91f5cbd41..661981c377 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -369,6 +369,7 @@ Common::Error DreamWebEngine::run() { _console = new DreamWebConsole(this); ConfMan.registerDefault("dreamweb_originalsaveload", "false"); + _hasSpeech = Common::File::exists("speech/r01c0000.raw"); _timer->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync"); dreamweb(); @@ -568,4 +569,11 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const { } } +bool DreamWebEngine::isCD() { + return _gameDescription->desc.flags & ADGF_CD; +} + +bool DreamWebEngine::hasSpeech() { + return isCD() && _hasSpeech; +} } // End of namespace DreamWeb diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 4b84992d92..2de29491e5 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -136,6 +136,8 @@ public: void processEvents(); void blit(const uint8 *src, int pitch, int x, int y, int w, int h); void cls(); + bool isCD(); + bool hasSpeech(); void getPalette(uint8 *data, uint start, uint count); void setPalette(const uint8 *data, uint start, uint count); @@ -299,6 +301,7 @@ public: bool _foreignRelease; bool _wonGame; + bool _hasSpeech; // sound related uint8 _roomsSample; @@ -768,7 +771,6 @@ public: // from stubs.cpp void setupInitialVars(); - bool isCD(); void crosshair(); void delTextLine(); void showBlink(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 40084a28c4..6745a34453 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -123,7 +123,7 @@ static const ReelRoutine g_initialReelRoutines[] = { void DreamWebEngine::setupInitialReelRoutines() { for (unsigned int i = 0; i < kNumReelRoutines + 1; ++i) { _reelRoutines[i] = g_initialReelRoutines[i]; - if (_reelRoutines[i].period == 55 && isCD() && getLanguage() == Common::DE_DEU) + if (_reelRoutines[i].period == 55 && hasSpeech() && getLanguage() == Common::DE_DEU) _reelRoutines[i].period = 65; } } @@ -145,7 +145,7 @@ void DreamWebEngine::updatePeople() { void DreamWebEngine::madmanText() { byte origCount; - if (isCD()) { + if (hasSpeech()) { if (_speechCount >= 63) return; if (_channel1Playing != 255) @@ -188,12 +188,12 @@ void DreamWebEngine::madman(ReelRoutine &routine) { ++_vars._combatCount; madmanText(); newReelPointer = 53; - if (_vars._combatCount >= (isCD() ? 64 : 62)) { - if (_vars._combatCount == (isCD() ? 70 : 68)) + if (_vars._combatCount >= (hasSpeech() ? 64 : 62)) { + if (_vars._combatCount == (hasSpeech() ? 70 : 68)) newReelPointer = 310; else { if (_vars._lastWeapon == 8) { - _vars._combatCount = isCD() ? 72 : 70; + _vars._combatCount = hasSpeech() ? 72 : 70; _vars._lastWeapon = (uint8)-1; _vars._madmanFlag = 1; newReelPointer = 67; @@ -211,9 +211,9 @@ void DreamWebEngine::madman(ReelRoutine &routine) { void DreamWebEngine::madMode() { _vars._watchingTime = 2; _pointerMode = 0; - if (_vars._combatCount < (isCD() ? 65 : 63)) + if (_vars._combatCount < (hasSpeech() ? 65 : 63)) return; - if (_vars._combatCount >= (isCD() ? 70 : 68)) + if (_vars._combatCount >= (hasSpeech() ? 70 : 68)) return; _pointerMode = 2; } diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 9b16d14e7b..415f1a80ef 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -840,9 +840,11 @@ void DreamWebEngine::showSlots() { void DreamWebEngine::showOpBox() { showFrame(_tempGraphics, kOpsx, kOpsy, 0, 0); - // CHECKME: There seem to be versions of dreamweb in which this call - // should be removed. It displays a red dot on the ops dialogs if left in. - showFrame(_tempGraphics, kOpsx, kOpsy + 55, 4, 0); + // This call displays half of the ops dialog in the CD version. It's not + // in the floppy version, and if it's called, a stray red dot is shown in + // the game dialogs. + if (isCD()) + showFrame(_tempGraphics, kOpsx, kOpsy + 55, 4, 0); } void DreamWebEngine::showLoadOps() { diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index e662fa6ec3..07f391addc 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -670,7 +670,7 @@ void DreamWebEngine::intro1Text() { if (_introCount != 2 && _introCount != 4 && _introCount != 6) return; - if (isCD() && _channel1Playing != 255) { + if (hasSpeech() && _channel1Playing != 255) { _introCount--; } else { if (_introCount == 2) @@ -692,12 +692,12 @@ void DreamWebEngine::intro2Text(uint16 nextReelPointer) { void DreamWebEngine::intro3Text(uint16 nextReelPointer) { if (nextReelPointer == 107) setupTimedTemp(45, 82, 36, 56, 100, 1); - else if (nextReelPointer == (isCD() ? 108 : 109)) + else if (nextReelPointer == (hasSpeech() ? 108 : 109)) setupTimedTemp(46, 82, 36, 56, 100, 1); } void DreamWebEngine::monks2text() { - bool isGermanCD = isCD() && getLanguage() == Common::DE_DEU; + bool isGermanCD = hasSpeech() && getLanguage() == Common::DE_DEU; if (_introCount == 1) setupTimedTemp(8, 82, 36, 160, 120, 1); @@ -706,14 +706,14 @@ void DreamWebEngine::monks2text() { else if (_introCount == (isGermanCD ? 9 : 7)) setupTimedTemp(10, 82, 36, 160, 120, 1); else if (_introCount == 10 && !isGermanCD) { - if (isCD()) + if (hasSpeech()) _introCount = 12; setupTimedTemp(11, 82, 0, 105, 120, 1); } else if (_introCount == 13 && isGermanCD) { _introCount = 14; setupTimedTemp(11, 82, 0, 105, 120, 1); } else if (_introCount == 13 && !isGermanCD) { - if (isCD()) + if (hasSpeech()) _introCount = 17; else setupTimedTemp(12, 82, 0, 120, 120, 1); @@ -725,7 +725,7 @@ void DreamWebEngine::monks2text() { setupTimedTemp(15, 82, 36, 160, 120, 1); else if (_introCount == (isGermanCD ? 27 : 25)) setupTimedTemp(16, 82, 36, 160, 120, 1); - else if (_introCount == (isCD() ? 27 : 28) && !isGermanCD) + else if (_introCount == (hasSpeech() ? 27 : 28) && !isGermanCD) setupTimedTemp(17, 82, 36, 160, 120, 1); else if (_introCount == 30 && isGermanCD) setupTimedTemp(17, 82, 36, 160, 120, 1); @@ -736,14 +736,14 @@ void DreamWebEngine::monks2text() { void DreamWebEngine::textForEnd() { if (_introCount == 20) setupTimedTemp(0, 83, 34, 20, 60, 1); - else if (_introCount == (isCD() ? 50 : 65)) + else if (_introCount == (hasSpeech() ? 50 : 65)) setupTimedTemp(1, 83, 34, 20, 60, 1); - else if (_introCount == (isCD() ? 85 : 110)) + else if (_introCount == (hasSpeech() ? 85 : 110)) setupTimedTemp(2, 83, 34, 20, 60, 1); } void DreamWebEngine::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { - if (isCD() && _channel1Playing != 255) + if (hasSpeech() && _channel1Playing != 255) _introCount--; else setupTimedTemp(textIndex, voiceIndex, x, y, countToTimed, timeCount); @@ -758,7 +758,7 @@ void DreamWebEngine::textForMonk() { textForMonkHelper(21, 82, 48, 154, 120, 1); else if (_introCount == 13) textForMonkHelper(22, 82, 68, 38, 120, 1); - else if (_introCount == (isCD() ? 15 : 17)) + else if (_introCount == (hasSpeech() ? 15 : 17)) textForMonkHelper(23, 82, 68, 154, 120, 1); else if (_introCount == 21) textForMonkHelper(24, 82, 68, 38, 120, 1); @@ -774,11 +774,11 @@ void DreamWebEngine::textForMonk() { textForMonkHelper(29, 82, 68, 38, 120, 1); else if (_introCount == 45) textForMonkHelper(30, 82, 68, 154, 120, 1); - else if (_introCount == (isCD() ? 52 : 49)) + else if (_introCount == (hasSpeech() ? 52 : 49)) textForMonkHelper(31, 82, 68, 154, 220, 1); else if (_introCount == 53) { fadeScreenDowns(); - if (isCD()) { + if (hasSpeech()) { _volumeTo = 7; _volumeDirection = 1; } diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index cf1eb4575e..d91eb242ff 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -935,8 +935,7 @@ void DreamWebEngine::useTimedText() { } void DreamWebEngine::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { -#if 1 // if cd - TODO: replace with a proper CD check - if (voiceIndex != 0) { + if (hasSpeech() && voiceIndex != 0) { if (loadSpeech('T', voiceIndex, 'T', textIndex)) { playChannel1(50+12); } @@ -947,7 +946,6 @@ void DreamWebEngine::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, if (_speechLoaded && !_subtitles) return; } -#endif if (_timeCount != 0) return; @@ -1661,14 +1659,6 @@ bool DreamWebEngine::isItDescribed(const ObjPos *pos) { return string[0] != 0; } -bool DreamWebEngine::isCD() { - // The original sources has two codepaths depending if the game is 'if cd' or not - // This is a hack to guess which version to use with the assumption that if we have a cd version - // we managed to load the speech. At least it is isolated in this function and can be changed. - // Maybe detect the version during game id? - return (_speechLoaded); -} - void DreamWebEngine::showIcon() { if (_realLocation < 50) { showPanel(); @@ -2532,7 +2522,7 @@ void DreamWebEngine::atmospheres() { if (_realLocation == 2 && _mapX == 22 && _mapY == 10) _volume = 5; // "louisvol" - if (isCD() && _realLocation == 14) { + if (hasSpeech() && _realLocation == 14) { if (_mapX == 33) { _volume = 0; // "ismad2" return; diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 56826e70bb..2899e81d00 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -98,15 +98,15 @@ void DreamWebEngine::startTalk() { y = 80; printDirect(&str, 66, &y, 241, true); -#if 1 // if cd - TODO: replace with a proper CD check - _speechLoaded = false; - loadSpeech('R', _realLocation, 'C', 64*(_character & 0x7F)); - if (_speechLoaded) { - _volumeDirection = 1; - _volumeTo = 6; - playChannel1(50 + 12); + if (hasSpeech()) { + _speechLoaded = false; + loadSpeech('R', _realLocation, 'C', 64*(_character & 0x7F)); + if (_speechLoaded) { + _volumeDirection = 1; + _volumeTo = 6; + playChannel1(50 + 12); + } } -#endif } const uint8 *DreamWebEngine::getPersonText(uint8 index, uint8 talkPos) { diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index c57684c3a8..8b56ffc57e 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -44,12 +44,12 @@ void DreamWebEngine::monkSpeaking() { workToScreen(); _volume = 7; _volumeDirection = -1; - _volumeTo = isCD() ? 5 : 0; + _volumeTo = hasSpeech() ? 5 : 0; playChannel0(12, 255); fadeScreenUps(); hangOn(300); - if (isCD()) { + if (hasSpeech()) { for (int i = 40; i <= 48; i++) { loadSpeech('T', 83, 'T', i); @@ -141,7 +141,7 @@ void DreamWebEngine::intro() { loadIntroRoom(); _volume = 7; _volumeDirection = -1; - _volumeTo = isCD() ? 4 : 0; + _volumeTo = hasSpeech() ? 4 : 0; playChannel0(12, 255); fadeScreenUps(); runIntroSeq(); |