[Scummvm-git-logs] scummvm master -> 66f316b567cd1480ba618800fec3e96538a8eb51

dreammaster paulfgilbert at gmail.com
Fri Aug 9 05:21:43 CEST 2019


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

Summary:
b2f6280e34 GLK: Add methods for sending windows to the front/back of draw order
832418b837 GLK: FROTZ: Ordering of text and graphics windows based on usage
c68d17e9ac TSAGE: R2R: Add Spanish translation detection entry flagged as pirated
66f316b567 GLK: FROTZ: Fix drawing graphics in Zork Zero vs Arthur


Commit: b2f6280e348aa595ee505c512e499f839b08e593
    https://github.com/scummvm/scummvm/commit/b2f6280e348aa595ee505c512e499f839b08e593
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-08T20:10:33-07:00

Commit Message:
GLK: Add methods for sending windows to the front/back of draw order

Changed paths:
    engines/glk/utils.h
    engines/glk/windows.cpp
    engines/glk/windows.h


diff --git a/engines/glk/utils.h b/engines/glk/utils.h
index 0da981a..636a129 100644
--- a/engines/glk/utils.h
+++ b/engines/glk/utils.h
@@ -67,6 +67,15 @@ public:
 
 		return -1;
 	}
+
+	/**
+	 * Remove an item from an array by value
+	 */
+	void remove(T val) {
+		int index = indexOf(val);
+		if (index != -1)
+			Common::Array<T>::remove_at(index);
+	}
 };
 
 /**
diff --git a/engines/glk/windows.cpp b/engines/glk/windows.cpp
index 7b6833f..32f2868 100644
--- a/engines/glk/windows.cpp
+++ b/engines/glk/windows.cpp
@@ -735,6 +735,24 @@ void Window::getSize(uint *width, uint *height) const {
 		*height = 0;
 }
 
+void Window::bringToFront() {
+	PairWindow *pairWin = dynamic_cast<PairWindow *>(_parent);
+	
+	if (pairWin && pairWin->_dir == winmethod_Arbitrary && pairWin->_children.back() != this) {
+		pairWin->_children.remove(this);
+		pairWin->_children.push_back(this);
+	}
+}
+
+void Window::sendToBack() {
+	PairWindow *pairWin = dynamic_cast<PairWindow *>(_parent);
+
+	if (pairWin && pairWin->_dir == winmethod_Arbitrary && pairWin->_children.front() != this) {
+		pairWin->_children.remove(this);
+		pairWin->_children.insert_at(0, this);
+	}
+}
+
 /*--------------------------------------------------------------------------*/
 
 BlankWindow::BlankWindow(Windows *windows, uint rock) : Window(windows, rock) {
diff --git a/engines/glk/windows.h b/engines/glk/windows.h
index f3edbb2..8d71303 100644
--- a/engines/glk/windows.h
+++ b/engines/glk/windows.h
@@ -581,6 +581,16 @@ public:
 	 * Returns a pointer to the styles for the window
 	 */
 	virtual const WindowStyle *getStyles() const;
+
+	/**
+	 * In arbitrary window positioning mode, brings a window to the front of all other windows
+	 */
+	void bringToFront();
+
+	/**
+	 * In arbitrary window positioning mode, sends a window to the back of all other windows
+	 */
+	void sendToBack();
 };
 typedef Window *winid_t;
 


Commit: 832418b83752c7cf6593824762ef819f92425b0a
    https://github.com/scummvm/scummvm/commit/832418b83752c7cf6593824762ef819f92425b0a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-08T20:10:33-07:00

Commit Message:
GLK: FROTZ: Ordering of text and graphics windows based on usage

The ScummGlk backend already had a new 'arbitrary' mode allowing
for windows to be placed at any position, and on top of each other.
This expands on this by ensuring that the background window, which
is used for drawing graphics on, appears behind text that gets
written. Yet can still appear on top of the text (hiding it)
when title screen graphics are being shown

Changed paths:
    engines/glk/frotz/glk_interface.cpp
    engines/glk/frotz/processor_screen.cpp
    engines/glk/frotz/processor_windows.cpp
    engines/glk/frotz/windows.cpp
    engines/glk/frotz/windows.h
    engines/glk/windows.cpp


diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index 6f50654..1e51933 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -541,14 +541,14 @@ void GlkInterface::showBeyondZorkTitle() {
 }
 
 void GlkInterface::os_draw_picture(int picture, const Common::Point &pos) {
-	assert(pos.x != 0 && pos.y != 0);
-	if (_wp._cwin == 0 && _wp._lower) {
-		// Picture embedded within the lower text area
-		_wp._lower.imageDraw(picture, imagealign_MarginLeft, 0);
-	} else {
+	if (pos.x && pos.y) {
+		_wp._background->bringToFront();
 		glk_image_draw(_wp._background, picture,
 			(pos.x - 1) * g_conf->_monoInfo._cellW,
 			(pos.y - 1) * g_conf->_monoInfo._cellH);
+	} else {
+		// Picture embedded within the lower text area
+		_wp.currWin().imageDraw(picture, imagealign_MarginLeft, 0);
 	}
 }
 
diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index 78c884d..0d6023e 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -106,6 +106,9 @@ void Processor::screen_char(zchar c) {
 	Window &w = _wp.currWin();
 	w.ensureTextWindow();
 
+	if (h_version == V6)
+		_wp.showTextWindows();
+
 	if (gos_linepending && (w == gos_linewin)) {
 		gos_cancel_pending_line();
 		if (_wp.currWin() == _wp._upper) {
diff --git a/engines/glk/frotz/processor_windows.cpp b/engines/glk/frotz/processor_windows.cpp
index 2ebc960..517296c 100644
--- a/engines/glk/frotz/processor_windows.cpp
+++ b/engines/glk/frotz/processor_windows.cpp
@@ -49,19 +49,15 @@ void Processor::z_draw_picture() {
 	flush_buffer();
 
 	Window &win = _wp[_wp._cwin];
-	if (!x || !y) {
-
-		// use cursor column if x-coordinate is 0
-		if (!x)
-			x = win[X_CURSOR];
-		// use cursor line if y-coordinate is 0
-		if (!y)
-			y = win[Y_CURSOR];
+	if (_wp._cwin == 0) {
+		// Embedded picture within the text area
+		x = y = 0;
+	} else {
+		assert(x && y);
+		x += win[X_POS] - 1;
+		y += win[Y_POS] - 1;
 	}
 
-	x += win[X_POS] - 1;
-	y += win[Y_POS] - 1;
-
 	/* The following is necessary to make Amiga and Macintosh story
 	 * files work with MCGA graphics files.  Some screen-filling
 	 *  pictures of the original Amiga release like the borders of
@@ -81,6 +77,7 @@ void Processor::z_draw_picture() {
 			if (_storyId == ARTHUR && pic == 54)
 				delta = h_screen_width / 160;
 
+			assert(x && y);
 			os_draw_picture(mapper[i].pic1, Point(x + delta, y + height1));
 			os_draw_picture(mapper[i].pic2, Point(x + width1 - width2 - delta, y + height1));
 		}
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index 7e647ea..677b213 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -23,8 +23,9 @@
 #include "glk/frotz/windows.h"
 #include "glk/frotz/frotz.h"
 #include "glk/window_pair.h"
-#include "glk/window_text_grid.h"
+#include "glk/window_graphics.h"
 #include "glk/window_text_buffer.h"
+#include "glk/window_text_grid.h"
 #include "glk/conf.h"
 
 namespace Glk {
@@ -85,6 +86,21 @@ void Windows::setWindow(int win) {
 		g_vm->glk_set_window(_windows[_cwin]._win);
 }
 
+void Windows::showTextWindows() {
+	// For v6, drawing graphics brings them to the front (such for title screens). So check for it
+	const PairWindow *pairWin = dynamic_cast<const PairWindow *>(g_vm->glk_window_get_root());
+	if (g_vm->h_version == V6 && pairWin && dynamic_cast<GraphicsWindow *>(pairWin->_children.back())) {
+		// Yep, it's at the forefront. So since we're now drawing text, ensure all text windows are in front of it
+		for (uint idx = 0; idx < size(); ++idx) {
+			if (_windows[idx]) {
+				winid_t win = _windows[idx];
+				if (dynamic_cast<TextWindow *>(win))
+					win->bringToFront();
+			}
+		}
+	}
+}
+
 /*--------------------------------------------------------------------------*/
 
 Window::Window() : _windows(nullptr), _win(nullptr), _quotes(0), _dashes(0), _spaces(0), _index(-1),
@@ -126,15 +142,17 @@ Window &Window::operator=(winid_t win) {
 
 void Window::ensureTextWindow() {
 	if (_win) {
-		// There's a window present, so make sure it's a text grid or text buffer window
-		if (dynamic_cast<TextBufferWindow *>(_win) || dynamic_cast<TextGridWindow *>(_win))
-			return;
-
-		g_vm->glk_window_close(_win);
-		_win = nullptr;
+		// There's a window present, so make sure it's textual
+		if (!dynamic_cast<TextWindow *>(_win)) {
+			g_vm->glk_window_close(_win);
+			_win = nullptr;
+			createGlkWindow();
+		}
+	} else {
+		createGlkWindow();
 	}
 
-	createGlkWindow();
+	_windows->showTextWindows();
 }
 
 void Window::setSize(const Point &newSize) {
@@ -307,6 +325,9 @@ void Window::setReverseVideo(bool reverse) {
 }
 
 void Window::createGlkWindow() {
+	if (g_vm->h_version == V6)
+		_windows->showTextWindows();
+
 	// Create a new window	
 	if (_index == 1) {
 		// Text grid window
@@ -356,19 +377,13 @@ void Window::checkRepositionLower() {
 	}
 }
 
-bool Window::imageDraw(uint image, int val1, int val2) {
-	if (!_win)
-		_win = g_vm->glk_window_open(g_vm->glk_window_get_root(),
-			winmethod_Arbitrary | winmethod_Fixed, 0, wintype_Graphics, 0);
-
-	return g_vm->glk_image_draw(_win, image, val1, val2);
+bool Window::imageDraw(uint image, ImageAlign align, int val) {
+	ensureTextWindow();
+	return g_vm->glk_image_draw(_win, image, align, val);
 }
 
 bool Window::imageDrawScaled(uint image, int val1, int val2, uint width, uint height) {
-	if (!_win)
-		_win = g_vm->glk_window_open(g_vm->glk_window_get_root(),
-			winmethod_Arbitrary | winmethod_Fixed, 0, wintype_Graphics, 0);
-
+	ensureTextWindow();
 	return g_vm->glk_image_draw_scaled(_win, image, val1, val2, width, height);
 }
 
diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h
index 785fb10..d55c928 100644
--- a/engines/glk/frotz/windows.h
+++ b/engines/glk/frotz/windows.h
@@ -206,7 +206,7 @@ public:
 	/**
 	 * Draw an image
 	 */
-	bool imageDraw(uint image, int val1, int val2);
+	bool imageDraw(uint image, ImageAlign align, int val);
 
 	/**
 	 * Draw a scaled image
@@ -265,6 +265,11 @@ public:
 		assert(_windows[_cwin]._win);
 		return _windows[_cwin]._win;
 	}
+
+	/**
+	 * Places any text windows in front of the background in V6 games
+	 */
+	void showTextWindows();
 };
 
 } // End of namespace Frotz
diff --git a/engines/glk/windows.cpp b/engines/glk/windows.cpp
index 32f2868..c1ed50a 100644
--- a/engines/glk/windows.cpp
+++ b/engines/glk/windows.cpp
@@ -741,6 +741,7 @@ void Window::bringToFront() {
 	if (pairWin && pairWin->_dir == winmethod_Arbitrary && pairWin->_children.back() != this) {
 		pairWin->_children.remove(this);
 		pairWin->_children.push_back(this);
+		Windows::_forceRedraw = true;
 	}
 }
 
@@ -750,6 +751,7 @@ void Window::sendToBack() {
 	if (pairWin && pairWin->_dir == winmethod_Arbitrary && pairWin->_children.front() != this) {
 		pairWin->_children.remove(this);
 		pairWin->_children.insert_at(0, this);
+		Windows::_forceRedraw = true;
 	}
 }
 


Commit: c68d17e9ac93e9d7b2ffbc7e4682df55df19574d
    https://github.com/scummvm/scummvm/commit/c68d17e9ac93e9d7b2ffbc7e4682df55df19574d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-08T20:19:25-07:00

Commit Message:
TSAGE: R2R: Add Spanish translation detection entry flagged as pirated

I decided it was worthwhile to have an entry for it, but flagged as
pirated, so we don't accidentally add it in as supported later on.

Changed paths:
    engines/tsage/detection_tables.h


diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h
index f331ecd..ff3cbf1 100644
--- a/engines/tsage/detection_tables.h
+++ b/engines/tsage/detection_tables.h
@@ -185,6 +185,23 @@ static const tSageGameDescription gameDescriptions[] = {
 		GType_Ringworld2,
 		GF_CD | GF_ALT_REGIONS | GF_DEMO
 	},
+
+	// Return to Ringworld. Spanish fan translation. They provide the entire game for download,
+	// so it's being treated as pirated, and not supported
+	{
+		{
+			"ringworld2",
+			"CD",
+			AD_ENTRY1s("r2rw.rlb", "05f9af7b0153a0c5727022dc0122d02b", 47678672),
+			Common::ES_ESP,
+			Common::kPlatformDOS,
+			ADGF_CD | ADGF_PIRATED,
+			GUIO0()
+		},
+		GType_Ringworld2,
+		GF_CD | GF_ALT_REGIONS
+	},
+
 #ifdef TSAGE_SHERLOCK_ENABLED
 	// The Lost Files of Sherlock Holmes - The Case of the Serrated Scalpel (Logo)
 	{


Commit: 66f316b567cd1480ba618800fec3e96538a8eb51
    https://github.com/scummvm/scummvm/commit/66f316b567cd1480ba618800fec3e96538a8eb51
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-08T20:19:53-07:00

Commit Message:
GLK: FROTZ: Fix drawing graphics in Zork Zero vs Arthur

In Zork Zero, grahpics drawn to window 0 (the text buffer)
are always treated as being interleaved with the text.
Whereas in Arthur, the title screens are drawn to window 0,
so have to be drawn to the background

Changed paths:
    engines/glk/frotz/processor_windows.cpp


diff --git a/engines/glk/frotz/processor_windows.cpp b/engines/glk/frotz/processor_windows.cpp
index 517296c..3508bca 100644
--- a/engines/glk/frotz/processor_windows.cpp
+++ b/engines/glk/frotz/processor_windows.cpp
@@ -49,8 +49,9 @@ void Processor::z_draw_picture() {
 	flush_buffer();
 
 	Window &win = _wp[_wp._cwin];
-	if (_wp._cwin == 0) {
-		// Embedded picture within the text area
+	if (_storyId == ZORK_ZERO && _wp._cwin == 0) {
+		// WORKAROUND: Zork Zero has pictures for graphics embedded in the text with specific
+		// co-prdinates. We need to reset it to 0,0 to flag it should be drawn at the cursor
 		x = y = 0;
 	} else {
 		assert(x && y);





More information about the Scummvm-git-logs mailing list