[Scummvm-git-logs] scummvm master -> 8fcf009668c6975fbe8e7eac2e676f9aa1f87421

dreammaster paulfgilbert at gmail.com
Sun Feb 17 23:33:06 CET 2019


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:
8fcf009668 GLK: FROTZ: More properly fix transparency handling of header


Commit: 8fcf009668c6975fbe8e7eac2e676f9aa1f87421
    https://github.com/scummvm/scummvm/commit/8fcf009668c6975fbe8e7eac2e676f9aa1f87421
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-02-17T14:32:56-08:00

Commit Message:
GLK: FROTZ: More properly fix transparency handling of header

Changed paths:
    engines/glk/frotz/processor_screen.cpp
    engines/glk/frotz/windows.cpp
    engines/glk/frotz/windows.h
    engines/glk/glk_types.h
    engines/glk/streams.cpp
    engines/glk/window_pair.cpp
    engines/glk/windows.cpp
    engines/glk/windows.h


diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index 2965045..41932f5 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -296,18 +296,20 @@ void Processor::z_set_true_colour() {
 }
 
 void Processor::z_set_colour() {
-	int fg = zargs[0];
-	int bg = zargs[1];
+	int fg = (short)zargs[0];
+	int bg = (short)zargs[1];
 	zword win = (h_version == V6) ? winarg2() : 0;
 
+	if (win == 1 && h_version == V6)
+		bg = zcolor_Transparent;
+
 	flush_buffer();
 
-	if ((short)fg == -1)
+	if (fg == -1)
 		// Get color at cursor
 		fg = os_peek_color();
-	if ((short)bg == -1)
-		// Get color at cursor
-		bg = os_peek_color();
+	if (bg == -1)
+		bg = zcolor_Transparent;
 
 	if (fg == 0)
 		// keep current colour
@@ -320,9 +322,9 @@ void Processor::z_set_colour() {
 	if (bg == 1)
 		bg = h_default_background;
 
-	if (fg < zcolor_NUMCOLORS)
+	if (fg >= 0 && fg < zcolor_NUMCOLORS)
 		fg = zcolors[fg];
-	if (bg < zcolor_NUMCOLORS)
+	if (bg >= 0 && bg < zcolor_NUMCOLORS)
 		bg = zcolors[bg];
 
 	if (h_version == V6 && h_interpreter_number == INTERP_AMIGA) {
@@ -333,9 +335,9 @@ void Processor::z_set_colour() {
 				int fg2 = _wp[i][TRUE_FG_COLOR];
 
 				if (bg2 < 16)
-					bg2 = (bg2 == _wp[0][TRUE_BG_COLOR]) ? fg : bg;
+					bg2 = (bg2 == (int)_wp[0][TRUE_BG_COLOR]) ? fg : bg;
 				if (fg2 < 16)
-					fg2 = (fg2 == _wp[0][TRUE_FG_COLOR]) ? fg : bg;
+					fg2 = (fg2 == (int)_wp[0][TRUE_FG_COLOR]) ? fg : bg;
 
 				_wp[i][TRUE_FG_COLOR] = fg2;
 				_wp[i][TRUE_BG_COLOR] = bg2;
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index cbc0682..71f6fb9 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -118,14 +118,14 @@ void Window::setPosition(const Point &newPos) {
 		_win->setPosition(Point((newPos.x - 1) * g_conf->_monoInfo._cellW, (newPos.y - 1) * g_conf->_monoInfo._cellH));
 }
 
-const zword &Window::getProperty(WindowProperty propType) {
+const uint &Window::getProperty(WindowProperty propType) {
 	if (_win)
 		update();
 
 	return _properties[propType];
 }
 
-void Window::setProperty(WindowProperty propType, zword value) {
+void Window::setProperty(WindowProperty propType, uint value) {
 	switch (propType) {
 	case TRUE_FG_COLOR:
 	case TRUE_BG_COLOR:
diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h
index 001fb50..3ee2fe6 100644
--- a/engines/glk/frotz/windows.h
+++ b/engines/glk/frotz/windows.h
@@ -63,14 +63,14 @@ class Window {
 		/**
 		 * Get
 		 */
-		operator zword() const {
+		operator uint() const {
 			return _owner->getProperty(_prop);
 		}
 
 		/**
 		 * Set
 		 */
-		PropertyAccessor &operator=(zword val) {
+		PropertyAccessor &operator=(uint val) {
 			_owner->setProperty(_prop, val);
 			return *this;
 		}
@@ -78,17 +78,17 @@ class Window {
 private:
 	Windows *_windows;
 	winid_t _win;
-	zword _properties[TRUE_BG_COLOR + 1];
+	uint _properties[TRUE_BG_COLOR + 1];
 private:
 	/**
 	 * Get a property value
 	 */
-	const zword &getProperty(WindowProperty propType);
+	const uint &getProperty(WindowProperty propType);
 
 	/**
 	 * Set a property value
 	 */
-	void setProperty(WindowProperty propType, zword value);
+	void setProperty(WindowProperty propType, uint value);
 
 	/**
 	 * Called when trying to reposition or resize windows. Does special handling for the lower window
diff --git a/engines/glk/glk_types.h b/engines/glk/glk_types.h
index 4a29b15..ca99b59 100644
--- a/engines/glk/glk_types.h
+++ b/engines/glk/glk_types.h
@@ -200,10 +200,10 @@ enum giDisp {
 };
 
 enum zcolor {
-	zcolor_Transparent = (uint)-4,
-	zcolor_Cursor      = (uint)-3,
-	zcolor_Current     = (uint)-2,
-	zcolor_Default     = (uint)-1
+	zcolor_Transparent = 0x7FFFFFFCU,
+	zcolor_Cursor      = 0x7FFFFFFDU,
+	zcolor_Current     = 0x7FFFFFFEU,
+	zcolor_Default     = 0x7FFFFFFFU
 };
 
 #ifdef GLK_MODULE_IMAGE
diff --git a/engines/glk/streams.cpp b/engines/glk/streams.cpp
index f05cc55..ca1b8d8 100644
--- a/engines/glk/streams.cpp
+++ b/engines/glk/streams.cpp
@@ -262,7 +262,7 @@ void WindowStream::setZColors(uint fg, uint bg) {
 		}
 	}
 
-	if (bg != zcolor_Transparent && bg != zcolor_Cursor) {
+	if (/*bg != zcolor_Transparent &&*/ bg != zcolor_Cursor) {
 		if (bg == zcolor_Default) {
 			_window->_attr.bgset = 0;
 			_window->_attr.bgcolor = 0;
diff --git a/engines/glk/window_pair.cpp b/engines/glk/window_pair.cpp
index 60d1795..8de16a0 100644
--- a/engines/glk/window_pair.cpp
+++ b/engines/glk/window_pair.cpp
@@ -139,6 +139,11 @@ void PairWindow::rearrange(const Rect &box) {
 }
 
 void PairWindow::redraw() {
+	// When the windows can be in arbitrary positions, some of them may be transparent, so we always
+	// need to force a full screen redraw in such cases
+	if (_dir == winmethod_Arbitrary)
+		Windows::_forceRedraw = true;
+
 	Window::redraw();
 
 	for (int ctr = 0, idx = (_backward ? (int)_children.size() - 1 : 0); ctr < (int)_children.size();
diff --git a/engines/glk/windows.cpp b/engines/glk/windows.cpp
index 74cf275..5683b03 100644
--- a/engines/glk/windows.cpp
+++ b/engines/glk/windows.cpp
@@ -602,13 +602,9 @@ void Window::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) {
 
 void Window::redraw() {
 	if (Windows::_forceRedraw) {
-		PairWindow *parent = dynamic_cast<PairWindow *>(_parent);
-
-		if (!parent || parent->_dir != winmethod_Arbitrary) {
-			uint color = Windows::_overrideBgSet ? g_conf->_windowColor : _bgColor;
-			int y0 = _yAdj ? _bbox.top - _yAdj : _bbox.top;
-			g_vm->_screen->fillRect(Rect(_bbox.left, y0, _bbox.right, _bbox.bottom), color);
-		}
+		uint color = Windows::_overrideBgSet ? g_conf->_windowColor : _bgColor;
+		int y0 = _yAdj ? _bbox.top - _yAdj : _bbox.top;
+		g_vm->_screen->fillRect(Rect(_bbox.left, y0, _bbox.right, _bbox.bottom), color);
 	}
 }
 
diff --git a/engines/glk/windows.h b/engines/glk/windows.h
index acb727e..bdd9674 100644
--- a/engines/glk/windows.h
+++ b/engines/glk/windows.h
@@ -321,9 +321,9 @@ struct Attributes {
 	unsigned reverse : 1;
 	unsigned         : 1;
 	unsigned style   : 4;
-	unsigned fgcolor : 24;
-	unsigned bgcolor : 24;
-	unsigned hyper   : 32;
+	uint fgcolor;
+	uint bgcolor;
+	uint hyper;
 
 	/**
 	 * Constructor





More information about the Scummvm-git-logs mailing list