[Scummvm-git-logs] scummvm master -> d405e9e09b92d74bbf2e31af5af44395a99e09c0

waltervn walter at vanniftrik-it.nl
Fri Feb 17 21:17:14 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d405e9e09b ADL: Implement hires6 action opcode 0x0b


Commit: d405e9e09b92d74bbf2e31af5af44395a99e09c0
    https://github.com/scummvm/scummvm/commit/d405e9e09b92d74bbf2e31af5af44395a99e09c0
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2017-02-17T21:09:52+01:00

Commit Message:
ADL: Implement hires6 action opcode 0x0b

Changed paths:
    engines/adl/adl.cpp
    engines/adl/adl.h
    engines/adl/adl_v2.cpp
    engines/adl/adl_v2.h
    engines/adl/adl_v5.cpp


diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 34e398d..58d5fa9 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 75df339..d71d408 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 9653e2e..272e780 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 f0af9eb..5447974 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 be0c31a..8ac5b4c 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) {





More information about the Scummvm-git-logs mailing list