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

dreammaster paulfgilbert at gmail.com
Wed Mar 6 03:52:07 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:
b8966ff1ad GLK: FROTZ: Moving updating colors and current window into Window class


Commit: b8966ff1ad4fe95cdb7be33e94d18d757031f03a
    https://github.com/scummvm/scummvm/commit/b8966ff1ad4fe95cdb7be33e94d18d757031f03a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-03-05T18:50:01-08:00

Commit Message:
GLK: FROTZ: Moving updating colors and current window into Window class

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


diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index beebb54..992df74 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -191,15 +191,9 @@ void Processor::screen_word(const zchar *s) {
 }
 
 void Processor::erase_screen(zword win) {
-	int curr_fg = _wp[1][TRUE_FG_COLOR];
-	int curr_bg = _wp[1][TRUE_BG_COLOR];
-
 	if ((short)win == -1) {
 		if (_wp._upper) {
-			glk_set_window(_wp._upper);
-#ifdef GARGLK
-			garglk_set_zcolors(curr_fg, curr_bg);
-#endif /* GARGLK */
+			_wp._upper.updateColors();
 			_wp._upper.clear();
 		}
 
@@ -211,13 +205,12 @@ void Processor::erase_screen(zword win) {
 
 void Processor::erase_window(zword win) {
 	if (h_version == V6 && win != _wp._cwin && h_interpreter_number != INTERP_AMIGA)
-		garglk_set_zcolors(_wp[win][TRUE_FG_COLOR], _wp[win][TRUE_BG_COLOR]);
-
-	if (_wp[win])
-		glk_window_clear(_wp[win]);
+		_wp[win].updateColors();
 
+	_wp[win].clear();
+		
 	if (h_version == V6 && win != _wp._cwin && h_interpreter_number != INTERP_AMIGA)
-		garglk_set_zcolors(_wp[_wp._cwin][TRUE_FG_COLOR], _wp[_wp._cwin][TRUE_BG_COLOR]);
+		_wp[_wp._cwin].updateColors();
 }
 
 void Processor::z_buffer_mode() {
@@ -309,9 +302,7 @@ void Processor::z_set_true_colour() {
 	if (!(zback < 0))
 		zback = zRGB(zargs[1]);
 
-#ifdef GARGLK
-	garglk_set_zcolors(zfore, zback);
-#endif /* GARGLK */
+	_wp[_wp._cwin].updateColors(zfore, zback);
 }
 
 void Processor::z_set_colour() {
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index e94a345..38e5dd9 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -165,6 +165,17 @@ void Window::clear() {
 		g_vm->glk_window_clear(_win);
 }
 
+void Window::updateColors() {
+	if (_win)
+		_win->_stream->setZColors(_properties[TRUE_FG_COLOR], _properties[TRUE_BG_COLOR]);
+}
+
+void Window::updateColors(uint fore, uint back) {
+	_properties[TRUE_FG_COLOR] = fore;
+	_properties[TRUE_BG_COLOR] = back;
+	updateColors();
+}
+
 const uint &Window::getProperty(WindowProperty propType) {
 	if (_win)
 		update();
@@ -177,8 +188,7 @@ void Window::setProperty(WindowProperty propType, uint value) {
 	case TRUE_FG_COLOR:
 	case TRUE_BG_COLOR:
 		_properties[propType] = value;
-		if (_win && _win->_stream)
-			_win->_stream->setZColors(_properties[TRUE_FG_COLOR], _properties[TRUE_BG_COLOR]);
+		updateColors();
 		break;
 
 	default:
diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h
index dce980b..9d9af2a 100644
--- a/engines/glk/frotz/windows.h
+++ b/engines/glk/frotz/windows.h
@@ -119,6 +119,11 @@ public:
 	}
 
 	/**
+	 * Equality operator
+	 */
+	inline bool operator==(const Window &rhs) { return this == &rhs; }
+
+	/**
 	 * Cast operator for testing if the window has a proper Glk window attached to it
 	 */
 	operator bool() const { return _win != nullptr; }
@@ -147,6 +152,16 @@ public:
 	 * Clear the window
 	 */
 	void clear();
+
+	/**
+	 * Update colors for the window
+	 */
+	void updateColors();
+
+	/**
+	 * Update colors for the window
+	 */
+	void updateColors(uint fore, uint back);
 };
 
 /**
@@ -187,9 +202,16 @@ public:
 	void setWindow(int win);
 
 	/**
+	 * Get the current window
+	 */
+	Window &currWin() {
+		return _windows[_cwin];
+	}
+
+	/**
 	 * Get the current window pointer
 	 */
-	winid_t currWin() const {
+	winid_t glkWin() const {
 		assert(_windows[_cwin]._win);
 		return _windows[_cwin]._win;
 	}





More information about the Scummvm-git-logs mailing list