From 0793196a52a83970bb9bb4ac36f3068739afa543 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Jan 2019 16:12:01 -0800 Subject: GLK: FROTZ: Fix text display for v6 games --- engines/glk/window_text_buffer.cpp | 4 ++-- engines/glk/window_text_grid.cpp | 4 ++-- engines/glk/windows.h | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/glk/window_text_buffer.cpp b/engines/glk/window_text_buffer.cpp index c33dbae10c..ce4dd7c22e 100644 --- a/engines/glk/window_text_buffer.cpp +++ b/engines/glk/window_text_buffer.cpp @@ -75,8 +75,8 @@ void TextBufferWindow::rearrange(const Rect &box) { int newwid, newhgt; int rnd; - newwid = (box.width() - g_conf->_tMarginX * 2 - g_conf->_scrollWidth) / _font._cellW; - newhgt = (box.height() - g_conf->_tMarginY * 2) / _font._cellH; + newwid = MAX((box.width() - g_conf->_tMarginX * 2 - g_conf->_scrollWidth) / _font._cellW, 0); + newhgt = MAX((box.height() - g_conf->_tMarginY * 2) / _font._cellH, 0); // align text with bottom rnd = newhgt * _font._cellH + g_conf->_tMarginY * 2; diff --git a/engines/glk/window_text_grid.cpp b/engines/glk/window_text_grid.cpp index ee3921d9c6..c32139019b 100644 --- a/engines/glk/window_text_grid.cpp +++ b/engines/glk/window_text_grid.cpp @@ -57,8 +57,8 @@ void TextGridWindow::rearrange(const Rect &box) { Window::rearrange(box); int newwid, newhgt; - newwid = box.width() / _font._cellW; - newhgt = box.height() / _font._cellH; + newwid = MAX(box.width() / _font._cellW, 0); + newhgt = MAX(box.height() / _font._cellH, 0); if (newwid == _width && newhgt == _height) return; diff --git a/engines/glk/windows.h b/engines/glk/windows.h index dab521901e..c905556f9e 100644 --- a/engines/glk/windows.h +++ b/engines/glk/windows.h @@ -432,6 +432,7 @@ public: virtual void setSize(const Point &newSize) { _bbox.setWidth(newSize.x); _bbox.setHeight(newSize.y); + rearrange(_bbox); } /** @@ -439,6 +440,7 @@ public: */ virtual void setPosition(const Point &newPos) { _bbox.moveTo(newPos); + rearrange(_bbox); } /** -- cgit v1.2.3