aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/frotz/processor_screen.cpp22
-rw-r--r--engines/glk/frotz/windows.cpp4
-rw-r--r--engines/glk/frotz/windows.h10
-rw-r--r--engines/glk/glk_types.h8
-rw-r--r--engines/glk/streams.cpp2
-rw-r--r--engines/glk/window_pair.cpp5
-rw-r--r--engines/glk/windows.cpp10
-rw-r--r--engines/glk/windows.h6
8 files changed, 35 insertions, 32 deletions
diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index 29650451d6..41932f53f8 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 cbc0682de7..71f6fb98ea 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 001fb50cf0..3ee2fe6d93 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 4a29b15abf..ca99b59091 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 f05cc55f88..ca1b8d8edb 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 60d17957d0..8de16a0566 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 74cf2751ef..5683b039cf 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 acb727e39e..bdd9674e43 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