diff options
Diffstat (limited to 'engines/adl')
-rw-r--r-- | engines/adl/adl.cpp | 24 | ||||
-rw-r--r-- | engines/adl/adl.h | 5 | ||||
-rw-r--r-- | engines/adl/hires1.cpp | 30 | ||||
-rw-r--r-- | engines/adl/hires1.h | 10 | ||||
-rw-r--r-- | engines/adl/hires2.cpp | 2 | ||||
-rw-r--r-- | engines/adl/hires2.h | 2 |
6 files changed, 37 insertions, 36 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index 90606f761d..ce6ca03f0e 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -110,15 +110,6 @@ void AdlEngine::openFile(Common::File &file, const Common::String &name) const { error("Error opening '%s'", name.c_str()); } -void AdlEngine::printMessage(uint idx, bool wait) { - Common::String msg = _messages[idx - 1]; - wordWrap(msg); - _display->printString(msg); - - if (wait) - delay(14 * 166018 / 1000); -} - void AdlEngine::delay(uint32 ms) const { uint32 start = g_system->getMillis(); @@ -746,21 +737,6 @@ bool AdlEngine::canSaveGameStateCurrently() { return false; } -void AdlEngine::wordWrap(Common::String &str) const { - uint end = 39; - - while (1) { - if (str.size() <= end) - return; - - while (str[end] != APPLECHAR(' ')) - --end; - - str.setChar(APPLECHAR('\r'), end); - end += 40; - } -} - byte AdlEngine::convertKey(uint16 ascii) const { ascii = toupper(ascii); diff --git a/engines/adl/adl.h b/engines/adl/adl.h index d21bd7b7a3..9121de4424 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -192,7 +192,7 @@ protected: Common::String readStringAt(Common::SeekableReadStream &stream, uint offset, byte until = 0) const; void openFile(Common::File &file, const Common::String &name) const; - virtual void printMessage(uint idx, bool wait = true); + virtual void printMessage(uint idx) = 0; void delay(uint32 ms) const; Common::String inputString(byte prompt = 0) const; @@ -318,9 +318,6 @@ private: bool canLoadGameStateCurrently(); bool canSaveGameStateCurrently(); - // Text output - void wordWrap(Common::String &str) const; - // Text input byte convertKey(uint16 ascii) const; Common::String getLine() const; diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp index 8590e8416e..804b122959 100644 --- a/engines/adl/hires1.cpp +++ b/engines/adl/hires1.cpp @@ -268,7 +268,11 @@ void HiRes1Engine::drawPic(byte pic, Common::Point pos) const { _graphics->drawPic(*_pictures[pic].data->createReadStream(), pos, 0x7f); } -void HiRes1Engine::printMessage(uint idx, bool wait) { +void HiRes1Engine::printMessage(uint idx) { + Common::String msg = _messages[idx - 1]; + wordWrap(msg); + _display->printString(msg); + // Messages with hardcoded overrides don't delay after printing. // It's unclear if this is a bug or not. In some cases the result // is that these strings will scroll past the four-line text window @@ -281,10 +285,11 @@ void HiRes1Engine::printMessage(uint idx, bool wait) { case IDI_HR1_MSG_DONT_HAVE_IT: case IDI_HR1_MSG_DONT_UNDERSTAND: case IDI_HR1_MSG_GETTING_DARK: - wait = false; + return; } - AdlEngine::printMessage(idx, wait); + if (_messageDelay) + delay(14 * 166018 / 1000); } void HiRes1Engine::drawItem(const Item &item, const Common::Point &pos) const { @@ -302,7 +307,24 @@ void HiRes1Engine::showRoom() { } _display->updateHiResScreen(); - printMessage(_roomDesc[_state.room - 1], false); + _messageDelay = false; + printMessage(_roomDesc[_state.room - 1]); + _messageDelay = true; +} + +void HiRes1Engine::wordWrap(Common::String &str) const { + uint end = 39; + + while (1) { + if (str.size() <= end) + return; + + while (str[end] != APPLECHAR(' ')) + --end; + + str.setChar(APPLECHAR('\r'), end); + end += 40; + } } Engine *HiRes1Engine_create(OSystem *syst, const AdlGameDescription *gd) { diff --git a/engines/adl/hires1.h b/engines/adl/hires1.h index cb1730ab6a..458b2f0018 100644 --- a/engines/adl/hires1.h +++ b/engines/adl/hires1.h @@ -91,7 +91,10 @@ namespace Adl { class HiRes1Engine : public AdlEngine { public: - HiRes1Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine(syst, gd), _files(nullptr) { } + HiRes1Engine(OSystem *syst, const AdlGameDescription *gd) : + AdlEngine(syst, gd), + _files(nullptr), + _messageDelay(true) { } ~HiRes1Engine() { delete _files; } private: @@ -101,14 +104,17 @@ private: void initState(); void restartGame(); void drawPic(byte pic, Common::Point pos = Common::Point()) const; - void printMessage(uint idx, bool wait = true); + void printMessage(uint idx); void drawItem(const Item &item, const Common::Point &pos) const; void showRoom(); + void wordWrap(Common::String &str) const; + Files *_files; Common::File _exe; Common::Array<DataBlockPtr> _corners; Common::Array<byte> _roomDesc; + bool _messageDelay; }; } // End of namespace Adl diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp index 3543c92ba4..dffbd81b67 100644 --- a/engines/adl/hires2.cpp +++ b/engines/adl/hires2.cpp @@ -239,7 +239,7 @@ void HiRes2Engine::showRoom() { _linesPrinted = 0; } -void HiRes2Engine::printMessage(uint idx, bool wait) { +void HiRes2Engine::printMessage(uint idx) { printString(_messages[idx - 1]); } diff --git a/engines/adl/hires2.h b/engines/adl/hires2.h index 0281a7993d..35d5e1e078 100644 --- a/engines/adl/hires2.h +++ b/engines/adl/hires2.h @@ -63,7 +63,7 @@ private: void drawPic(byte pic, Common::Point pos) const; void drawItem(const Item &item, const Common::Point &pos) const; void showRoom(); - void printMessage(uint idx, bool wait); + void printMessage(uint idx); void loadRoom(byte roomNr); DataBlockPtr readDataBlockPtr(Common::ReadStream &f) const; |