From c9811e279a6c5e88bb25ac7dbe4819f6386729ef Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 Aug 2019 22:08:35 -0700 Subject: GLK: FROTZ: Erase correct area when switching rooms in Arthur --- engines/glk/frotz/windows.cpp | 15 ++++++++++++++- engines/glk/frotz/windows.h | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'engines/glk/frotz') diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp index 6fe67363be..bb5f8042c5 100644 --- a/engines/glk/frotz/windows.cpp +++ b/engines/glk/frotz/windows.cpp @@ -238,7 +238,7 @@ void Window::clear() { g_vm->glk_window_clear(_win); if (_windows->_background) { - Rect r = _windows->_background->_bbox; + Rect r = getBounds(); _windows->_background->fillRect(g_conf->_windowColor, r); } } @@ -358,6 +358,19 @@ void Window::updateStyle() { setReverseVideo(false); } +Rect Window::getBounds() const { + if (_win) + return _win->_bbox; + + if (g_vm->h_version < V5) + return Rect((_properties[X_POS] - 1) * g_vm->h_font_width, (_properties[Y_POS] - 1) * g_vm->h_font_height, + (_properties[X_POS] - 1 + _properties[X_SIZE]) * g_vm->h_font_width, + (_properties[Y_POS] - 1 + _properties[Y_SIZE]) * g_vm->h_font_height); + + return Rect(_properties[X_POS] - 1, _properties[Y_POS] - 1, _properties[X_POS] - 1 + _properties[X_SIZE], + _properties[Y_POS] - 1 + _properties[Y_SIZE]); +} + void Window::setReverseVideo(bool reverse) { _win->_stream->setReverseVideo(reverse); } diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h index bd2cfd1c7f..6c8ce703ac 100644 --- a/engines/glk/frotz/windows.h +++ b/engines/glk/frotz/windows.h @@ -110,6 +110,11 @@ private: * Updates the current font/style */ void updateStyle(); + + /** + * Get the bounding area for the window + */ + Rect getBounds() const; public: int _currFont; int _prevFont; -- cgit v1.2.3