diff options
author | Willem Jan Palenstijn | 2012-02-12 23:45:37 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2012-02-12 23:57:09 +0100 |
commit | 3fc8b7227b05203a9c60a91c4db361da9181fba5 (patch) | |
tree | dfc4c7ccdf7b46a2f5f32c2e38dd548b2b22865f | |
parent | 3abb3ad757848d2899308b52bf642211c201d154 (diff) | |
download | scummvm-rg350-3fc8b7227b05203a9c60a91c4db361da9181fba5.tar.gz scummvm-rg350-3fc8b7227b05203a9c60a91c4db361da9181fba5.tar.bz2 scummvm-rg350-3fc8b7227b05203a9c60a91c4db361da9181fba5.zip |
DREAMWEB: Fix missing subtitle lines in speech+subtitle mode
This is done by adding a (very ugly) way to force the previous timed-temp
line off screen, so the next one can be shown.
-rw-r--r-- | engines/dreamweb/dreamweb.cpp | 3 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.h | 6 | ||||
-rw-r--r-- | engines/dreamweb/structs.h | 12 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 89 |
4 files changed, 75 insertions, 35 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index 79c5e0d7be..0a5deb4657 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -190,9 +190,6 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam _monAdX = 0; _monAdY = 0; _timeCount = 0; - _countToTimed = 0; - _timedY = 0; - _timedX = 0; _needToDumpTimed = 0; _loadingOrSave = 0; _saveLoadPage = 0; diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 8eeb006844..38016e5897 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -186,7 +186,6 @@ private: uint8 _channel0, _channel1; protected: - const char *_timedString; GameVars _vars; // saved variables // from backdrop.cpp @@ -416,10 +415,9 @@ public: uint16 _monAdX; uint16 _monAdY; uint16 _timeCount; - uint16 _countToTimed; - uint8 _timedY; - uint8 _timedX; uint8 _needToDumpTimed; + TimedTemp _previousTimedTemp; + TimedTemp _timedTemp; uint8 _loadingOrSave; uint8 _saveLoadPage; uint8 _currentSlot; diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index ddc027120d..cedf2b6d76 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -418,6 +418,18 @@ struct GameVars { uint8 _shakeCounter; }; +struct TimedTemp { + TimedTemp() : _timeCount(0), _string(0) { } + + uint8 _x; + uint8 _y; + + uint16 _timeCount; + uint16 _countToTimed; + + const char *_string; +}; + } // End of namespace DreamWeb #endif diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 5f05f290ad..d93add6b42 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -864,16 +864,16 @@ void DreamWebEngine::dumpTextLine() { void DreamWebEngine::getUnderTimed() { if (_foreignRelease) - multiGet(_underTimedText, _timedX, _timedY - 3, 240, kUnderTimedTextSizeY_f); + multiGet(_underTimedText, _timedTemp._x, _timedTemp._y - 3, 240, kUnderTimedTextSizeY_f); else - multiGet(_underTimedText, _timedX, _timedY, 240, kUnderTimedTextSizeY); + multiGet(_underTimedText, _timedTemp._x, _timedTemp._y, 240, kUnderTimedTextSizeY); } void DreamWebEngine::putUnderTimed() { if (_foreignRelease) - multiPut(_underTimedText, _timedX, _timedY - 3, 240, kUnderTimedTextSizeY_f); + multiPut(_underTimedText, _timedTemp._x, _timedTemp._y - 3, 240, kUnderTimedTextSizeY_f); else - multiPut(_underTimedText, _timedX, _timedY, 240, kUnderTimedTextSizeY); + multiPut(_underTimedText, _timedTemp._x, _timedTemp._y, 240, kUnderTimedTextSizeY); } void DreamWebEngine::triggerMessage(uint16 index) { @@ -903,6 +903,23 @@ void DreamWebEngine::processTrigger() { } void DreamWebEngine::useTimedText() { + if (_previousTimedTemp._string) { + // TODO: It might be nice to make subtitles wait for the speech + // to finish (_channel1Playing) when we're in speech+subtitles mode, + // instead of waiting the pre-specified amount of time. + + + // Ugly... (Maybe make this an argument to putUnderTimed()?) + TimedTemp t = _timedTemp; + _timedTemp = _previousTimedTemp; + + // Force-reset the previous string to make room for the next one + putUnderTimed(); + + _timedTemp = t; + return; + } + if (_timeCount == 0) return; --_timeCount; @@ -912,49 +929,65 @@ void DreamWebEngine::useTimedText() { return; } - if (_timeCount == _countToTimed) + if (_timeCount == _timedTemp._countToTimed) getUnderTimed(); - else if (_timeCount > _countToTimed) + else if (_timeCount > _timedTemp._countToTimed) return; - const uint8 *string = (const uint8 *)_timedString; - printDirect(string, _timedX, _timedY, 237, true); + const uint8 *string = (const uint8 *)_timedTemp._string; + printDirect(string, _timedTemp._x, _timedTemp._y, 237, true); _needToDumpTimed = 1; } void DreamWebEngine::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { + if (hasSpeech() && voiceIndex != 0) { if (loadSpeech('T', voiceIndex, 'T', textIndex)) { playChannel1(50+12); } - // FIXME: This fallthrough does not properly support subtitles+speech - // mode. The parameters to setuptimedtemp() are sometimes different - // for speech and for subtitles. See e.g., madmantext() if (_speechLoaded && !_subtitles) return; + + if (_timeCount != 0) { + // store previous TimedTemp for deletion + _previousTimedTemp = _timedTemp; + _timeCount = 0; + } } if (_timeCount != 0) return; - _timedY = y; - _timedX = x; - _countToTimed = countToTimed; - _timeCount = timeCount + countToTimed; - _timedString = _textFile1.getString(textIndex); - debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, _timedString); + + _timedTemp._y = y; + _timedTemp._x = x; + _timedTemp._countToTimed = countToTimed; + _timeCount = _timedTemp._timeCount = timeCount + countToTimed; + _timedTemp._string = _textFile1.getString(textIndex); + debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, _timedTemp._string); } void DreamWebEngine::dumpTimedText() { - const uint16 kUndertimedysize = 30; - if (_needToDumpTimed != 1) + const TimedTemp *tt; + if (_previousTimedTemp._string) { + assert(!_needToDumpTimed); + + tt = &_previousTimedTemp; + _previousTimedTemp._string = 0; + _previousTimedTemp._timeCount = 0; + } else if (_needToDumpTimed != 1) { return; - uint8 y = _timedY; + } else { + tt = &_timedTemp; + _needToDumpTimed = 0; + } + + const uint16 kUndertimedysize = 30; + uint8 y = tt->_y; if (_foreignRelease) y -= 3; - multiDump(_timedX, y, 240, kUndertimedysize); - _needToDumpTimed = 0; + multiDump(tt->_x, y, 240, kUndertimedysize); } void DreamWebEngine::getTime() { @@ -2822,12 +2855,12 @@ void DreamWebEngine::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 if (_timeCount != 0) return; // can't setup - _timedY = y; - _timedX = x; - _countToTimed = countToTimed; - _timeCount = timeCount + countToTimed; - _timedString = _puzzleText.getString(textIndex); - debug(1, "setupTimedUse: %d => '%s'", textIndex, _timedString); + _timedTemp._y = y; + _timedTemp._x = x; + _timedTemp._countToTimed = countToTimed; + _timeCount = _timedTemp._timeCount = timeCount + countToTimed; + _timedTemp._string = _puzzleText.getString(textIndex); + debug(1, "setupTimedUse: %d => '%s'", textIndex, _timedTemp._string); } void DreamWebEngine::entryTexts() { |