From b92f8f08567f328a9781f0cf467469ca61d9c5ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 27 Jan 2019 20:19:37 -0800 Subject: GLK: FROTZ: Make window transparent for V6 games to not obscure upper area --- engines/glk/events.cpp | 4 ++-- engines/glk/frotz/screen.cpp | 3 ++- engines/glk/frotz/windows.cpp | 1 + engines/glk/screen.cpp | 6 ++++-- engines/glk/screen.h | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/glk/events.cpp b/engines/glk/events.cpp index 6589b512f8..4897b1898f 100644 --- a/engines/glk/events.cpp +++ b/engines/glk/events.cpp @@ -68,7 +68,7 @@ void Events::initializeCursors() { const Graphics::PixelFormat format = g_system->getScreenFormat(); const int WHITE = format.RGBToColor(0xff, 0xff, 0xff); const int BLACK = 0; - const int TRANSPARENT = format.RGBToColor(0x80, 0x80, 0x80); + const int TRANSPARENT = format.RGBToColor(TRANSPARENT_RGB, TRANSPARENT_RGB, TRANSPARENT_RGB); // Setup arrow cursor Surface &arr = _cursors[CURSOR_ARROW]; @@ -384,7 +384,7 @@ void Events::setCursor(CursorId cursorId) { CursorMan.showMouse(true); const Surface &s = _cursors[cursorId]; - const int TRANSPARENT = s.format.RGBToColor(0x80, 0x80, 0x80); + const int TRANSPARENT = s.format.RGBToColor(TRANSPARENT_RGB, TRANSPARENT_RGB, TRANSPARENT_RGB); CursorMan.replaceCursor(s.getPixels(), s.w, s.h, s._hotspot.x, s._hotspot.y, TRANSPARENT, true, &s.format); } diff --git a/engines/glk/frotz/screen.cpp b/engines/glk/frotz/screen.cpp index f2b85a9a41..05090769f9 100644 --- a/engines/glk/frotz/screen.cpp +++ b/engines/glk/frotz/screen.cpp @@ -66,7 +66,8 @@ void FrotzScreen::loadVersion6Fonts(Common::Archive *archive) { pi._lineSeparation = 0; g_vm->_defaultForeground = 0; - g_vm->_defaultBackground = 0xffffff; + g_vm->_defaultBackground = TRANSPARENT_RGB | (TRANSPARENT_RGB << 8) | (TRANSPARENT_RGB << 16); + g_conf->_tMarginX = 3; _fonts.resize(8); diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp index 0c7237cbd0..8e0435e842 100644 --- a/engines/glk/frotz/windows.cpp +++ b/engines/glk/frotz/windows.cpp @@ -54,6 +54,7 @@ void Windows::setup(bool isVersion6) { winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextBuffer, 0); _upper = g_vm->glk_window_open(g_vm->glk_window_get_root(), winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextGrid, 0); + } else { _lower = g_vm->glk_window_open(0, 0, 0, wintype_TextBuffer, 0); _upper = g_vm->glk_window_open(_lower, winmethod_Above | winmethod_Fixed, 0, wintype_TextGrid, 0); diff --git a/engines/glk/screen.cpp b/engines/glk/screen.cpp index 8322e9c246..465adab082 100644 --- a/engines/glk/screen.cpp +++ b/engines/glk/screen.cpp @@ -65,8 +65,10 @@ void Screen::fill(const byte *rgb) { } void Screen::fillRect(const Rect &box, const byte *rgb) { - uint color = format.RGBToColor(rgb[0], rgb[1], rgb[2]); - Graphics::Screen::fillRect(box, color); + if (rgb[0] != TRANSPARENT_RGB || rgb[1] != TRANSPARENT_RGB || rgb[2] != TRANSPARENT_RGB) { + uint color = format.RGBToColor(rgb[0], rgb[1], rgb[2]); + Graphics::Screen::fillRect(box, color); + } } bool Screen::loadFonts() { diff --git a/engines/glk/screen.h b/engines/glk/screen.h index d4f3874d71..85c99ea75d 100644 --- a/engines/glk/screen.h +++ b/engines/glk/screen.h @@ -33,6 +33,7 @@ namespace Glk { #define FONTS_TOTAL 8 +#define TRANSPARENT_RGB 0x7f enum CaretShape { SMALL_DOT = 0, FAT_DOT = 1, THIN_LINE = 2, FAT_LINE = 3, BLOCK = 4 -- cgit v1.2.3