aboutsummaryrefslogtreecommitdiff
path: root/engines/adl/hires1.cpp
diff options
context:
space:
mode:
authorWalter van Niftrik2016-03-26 14:11:18 +0100
committerWalter van Niftrik2016-06-06 20:35:49 +0200
commitc9824921b4a5b2fa91751b03c24db91acbaac8c5 (patch)
tree4be08b37b839d3490de3764e01b1b174e87456ec /engines/adl/hires1.cpp
parent865bd06845e47897e50b79206cf54439dfef3f04 (diff)
downloadscummvm-rg350-c9824921b4a5b2fa91751b03c24db91acbaac8c5.tar.gz
scummvm-rg350-c9824921b4a5b2fa91751b03c24db91acbaac8c5.tar.bz2
scummvm-rg350-c9824921b4a5b2fa91751b03c24db91acbaac8c5.zip
ADL: Move message delay code into hires1 class
Diffstat (limited to 'engines/adl/hires1.cpp')
-rw-r--r--engines/adl/hires1.cpp30
1 files changed, 26 insertions, 4 deletions
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) {