aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/adl/adl.cpp9
-rw-r--r--engines/adl/adl.h1
-rw-r--r--engines/adl/adl_v2.cpp7
-rw-r--r--engines/adl/adl_v2.h3
-rw-r--r--engines/adl/adl_v5.cpp19
5 files changed, 28 insertions, 11 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 34e398de91..58d5fa9e67 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -55,6 +55,7 @@ AdlEngine::AdlEngine(OSystem *syst, const AdlGameDescription *gd) :
_dumpFile(nullptr),
_display(nullptr),
_graphics(nullptr),
+ _textMode(false),
_isRestarting(false),
_isRestoring(false),
_isQuitting(false),
@@ -911,10 +912,6 @@ byte AdlEngine::convertKey(uint16 ascii) const {
}
Common::String AdlEngine::getLine() {
- // Original engine uses a global here, which isn't reset between
- // calls and may not match actual mode
- bool textMode = false;
-
while (1) {
Common::String line = inputString(APPLECHAR('?'));
@@ -922,8 +919,8 @@ Common::String AdlEngine::getLine() {
return "";
if ((byte)line[0] == ('\r' | 0x80)) {
- textMode = !textMode;
- _display->setMode(textMode ? DISPLAY_MODE_TEXT : DISPLAY_MODE_MIXED);
+ _textMode = !_textMode;
+ _display->setMode(_textMode ? DISPLAY_MODE_TEXT : DISPLAY_MODE_MIXED);
continue;
}
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 75df3395d7..d71d40816e 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -348,6 +348,7 @@ protected:
Display *_display;
GraphicsMan *_graphics;
+ bool _textMode;
// Opcodes
typedef Common::Functor1<ScriptEnv &, int> Opcode;
diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp
index 9653e2e40b..272e7801e7 100644
--- a/engines/adl/adl_v2.cpp
+++ b/engines/adl/adl_v2.cpp
@@ -37,6 +37,7 @@ AdlEngine_v2::~AdlEngine_v2() {
AdlEngine_v2::AdlEngine_v2(OSystem *syst, const AdlGameDescription *gd) :
AdlEngine(syst, gd),
_linesPrinted(0),
+ _maxLines(4),
_disk(nullptr),
_itemRemoved(false),
_roomOnScreen(0),
@@ -151,9 +152,11 @@ void AdlEngine_v2::checkTextOverflow(char c) {
++_linesPrinted;
- if (_linesPrinted < 4)
- return;
+ if (_linesPrinted >= _maxLines)
+ handleTextOverflow();
+}
+void AdlEngine_v2::handleTextOverflow() {
_linesPrinted = 0;
_display->updateTextScreen();
bell();
diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h
index f0af9eba22..5447974a2e 100644
--- a/engines/adl/adl_v2.h
+++ b/engines/adl/adl_v2.h
@@ -62,6 +62,7 @@ protected:
int askForSlot(const Common::String &question);
void checkTextOverflow(char c);
+ void handleTextOverflow();
int o2_isFirstTime(ScriptEnv &e);
int o2_isRandomGT(ScriptEnv &e);
@@ -85,7 +86,7 @@ protected:
Common::String restoreInsert, restoreReplace;
} _strings_v2;
- uint _linesPrinted;
+ uint _linesPrinted, _maxLines;
DiskImage *_disk;
Common::Array<DataBlockPtr> _itemPics;
bool _itemRemoved;
diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp
index be0c31a64c..8ac5b4c793 100644
--- a/engines/adl/adl_v5.cpp
+++ b/engines/adl/adl_v5.cpp
@@ -154,13 +154,28 @@ int AdlEngine_v5::o5_setTextMode(ScriptEnv &e) {
// 2: 24-line mode
switch (e.arg(1)) {
+ case 1:
+ if (_linesPrinted != 0) {
+ _display->printChar(APPLECHAR(' '));
+ handleTextOverflow();
+ _display->moveCursorTo(Common::Point(0, 23));
+ _maxLines = 4;
+ }
+ return 1;
+ case 2:
+ _textMode = true;
+ _display->setMode(DISPLAY_MODE_TEXT);
+ _display->home();
+ _maxLines = 24;
+ _linesPrinted = 0;
+ return 1;
case 3:
// We re-use the restarting flag here, to simulate a long jump
_isRestarting = true;
return -1;
+ default:
+ error("Invalid text mode %d", e.arg(1));
}
-
- return 1;
}
int AdlEngine_v5::o5_setRegionRoom(ScriptEnv &e) {