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

waltervn walter at vanniftrik-it.nl
Mon Jan 30 22:10:04 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:
f6214df664 ADL: Clear screen with white in v2+


Commit: f6214df664ac4c0d750b59b7f0cca9cf747894d1
    https://github.com/scummvm/scummvm/commit/f6214df664ac4c0d750b59b7f0cca9cf747894d1
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2017-01-30T21:56:11+01:00

Commit Message:
ADL: Clear screen with white in v2+

This fixes hires5, region 14, room 29

Changed paths:
    engines/adl/adl.cpp
    engines/adl/adl.h
    engines/adl/adl_v2.cpp
    engines/adl/console.cpp
    engines/adl/graphics.cpp
    engines/adl/graphics.h
    engines/adl/hires1.cpp
    engines/adl/hires6.cpp


diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 3deeca1..bc67ec3 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -446,11 +446,6 @@ void AdlEngine::loadDroppedItemOffsets(Common::ReadStream &stream, byte count) {
 	}
 }
 
-void AdlEngine::clearScreen() const {
-	_display->setMode(DISPLAY_MODE_MIXED);
-	_display->clear(0x00);
-}
-
 void AdlEngine::drawPic(byte pic, Common::Point pos) const {
 	if (_roomData.pictures.contains(pic))
 		_graphics->drawPic(*_roomData.pictures[pic]->createReadStream(), pos);
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 3f26636..3630cd6 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -309,7 +309,6 @@ protected:
 	int o1_setRoomPic(ScriptEnv &e);
 
 	// Graphics
-	void clearScreen() const;
 	void drawPic(byte pic, Common::Point pos = Common::Point()) const;
 
 	// Sound
diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp
index e78366f..9653e2e 100644
--- a/engines/adl/adl_v2.cpp
+++ b/engines/adl/adl_v2.cpp
@@ -255,7 +255,7 @@ void AdlEngine_v2::showRoom() {
 
 	if (_state.room != _roomOnScreen) {
 		loadRoom(_state.room);
-		clearScreen();
+		_graphics->clearScreen();
 
 		if (!_state.isDark)
 			redrawPic = true;
diff --git a/engines/adl/console.cpp b/engines/adl/console.cpp
index 7305ec8..ad3277f 100644
--- a/engines/adl/console.cpp
+++ b/engines/adl/console.cpp
@@ -24,6 +24,7 @@
 
 #include "adl/console.h"
 #include "adl/display.h"
+#include "adl/graphics.h"
 #include "adl/adl.h"
 
 namespace Adl {
@@ -173,7 +174,7 @@ bool Console::Cmd_DumpScripts(int argc, const char **argv) {
 }
 
 void Console::prepareGame() {
-	_engine->clearScreen();
+	_engine->_graphics->clearScreen();
 	_engine->loadRoom(_engine->_state.room);
 	_engine->showRoom();
 	_engine->_display->updateTextScreen();
diff --git a/engines/adl/graphics.cpp b/engines/adl/graphics.cpp
index 47ef574..e1b7600 100644
--- a/engines/adl/graphics.cpp
+++ b/engines/adl/graphics.cpp
@@ -29,6 +29,11 @@
 
 namespace Adl {
 
+void GraphicsMan::clearScreen() const {
+	_display.setMode(DISPLAY_MODE_MIXED);
+	_display.clear(getClearColor());
+}
+
 // Draws a four-connected line
 void GraphicsMan::drawLine(const Common::Point &p1, const Common::Point &p2, byte color) const {
 	int16 deltaX = p2.x - p1.x;
@@ -209,11 +214,6 @@ static const byte fillPatterns[NUM_PATTERNS][PATTERN_LEN] = {
 		p.y += _offset.y; \
 	} while (0)
 
-void Graphics_v2::clear() {
-	_display.clear(0xff);
-	_color = 0;
-}
-
 void Graphics_v2::drawCorners(Common::SeekableReadStream &pic, bool yFirst) {
 	Common::Point p;
 
@@ -367,6 +367,10 @@ void Graphics_v2::fill(Common::SeekableReadStream &pic) {
 }
 
 void Graphics_v2::drawPic(Common::SeekableReadStream &pic, const Common::Point &pos) {
+	// NOTE: The original engine only resets the color for overlays. As a result, room
+	// pictures that draw without setting a color or clearing the screen, will use the
+	// last color set by the previous picture. We assume this is unintentional and do
+	// not copy this behavior.
 	_color = 0;
 	_offset = pos;
 
@@ -393,7 +397,8 @@ void Graphics_v2::drawPic(Common::SeekableReadStream &pic, const Common::Point &
 			fill(pic);
 			break;
 		case 0xe5:
-			clear();
+			clearScreen();
+			_color = 0x00;
 			break;
 		case 0xf0:
 			_color = 0x00;
diff --git a/engines/adl/graphics.h b/engines/adl/graphics.h
index af34e80..f05045a 100644
--- a/engines/adl/graphics.h
+++ b/engines/adl/graphics.h
@@ -23,9 +23,10 @@
 #ifndef ADL_PICTURE_H
 #define ADL_PICTURE_H
 
+#include "common/rect.h"
+
 namespace Common {
 class SeekableReadStream;
-struct Point;
 }
 
 namespace Adl {
@@ -36,12 +37,16 @@ class GraphicsMan {
 public:
 	virtual ~GraphicsMan() { }
 	virtual void drawPic(Common::SeekableReadStream &pic, const Common::Point &pos) = 0;
+	void clearScreen() const;
 
 protected:
 	GraphicsMan(Display &display) : _display(display) { }
 	void drawLine(const Common::Point &p1, const Common::Point &p2, byte color) const;
 
 	Display &_display;
+
+private:
+	virtual byte getClearColor() const = 0;
 };
 
 // Used in hires1
@@ -53,6 +58,7 @@ public:
 
 private:
 	void drawCornerPixel(Common::Point &p, byte color, byte bits, byte quadrant) const;
+	byte getClearColor() const { return 0x00; }
 };
 
 // Used in hires0 and hires2-hires4
@@ -66,13 +72,13 @@ protected:
 	void fillRow(Common::Point p, const byte pattern, const bool stopBit = false);
 
 private:
-	void clear();
 	void drawCorners(Common::SeekableReadStream &pic, bool yFirst);
 	void drawRelativeLines(Common::SeekableReadStream &pic);
 	void drawAbsoluteLines(Common::SeekableReadStream &pic);
 	virtual void fillRowLeft(Common::Point p, const byte pattern, const bool stopBit);
 	virtual void fillAt(Common::Point p, const byte pattern);
 	void fill(Common::SeekableReadStream &pic);
+	byte getClearColor() const { return 0xff; }
 
 	byte _color;
 	Common::Point _offset;
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index e811b74..239792d 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -429,7 +429,7 @@ void HiRes1Engine::loadRoom(byte roomNr) {
 
 void HiRes1Engine::showRoom() {
 	_state.curPicture = getCurRoom().curPicture;
-	clearScreen();
+	_graphics->clearScreen();
 	loadRoom(_state.room);
 
 	if (!_state.isDark) {
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index c07493f..77b0cb6 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -335,7 +335,7 @@ void HiRes6Engine::showRoom() {
 		if (getVar(26) < 0x80 && getCurRoom().isFirstTime)
 			setVar(26, 0);
 
-		clearScreen();
+		_graphics->clearScreen();
 
 		if (!_state.isDark)
 			redrawPic = true;





More information about the Scummvm-git-logs mailing list