aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-01-06 16:12:01 -0800
committerPaul Gilbert2019-01-06 16:12:01 -0800
commit0793196a52a83970bb9bb4ac36f3068739afa543 (patch)
tree766b3e443d621fd5f327fda2e0f1182cd2ef8931
parent9b7866442b477fe9376896fbf167622514700320 (diff)
downloadscummvm-rg350-0793196a52a83970bb9bb4ac36f3068739afa543.tar.gz
scummvm-rg350-0793196a52a83970bb9bb4ac36f3068739afa543.tar.bz2
scummvm-rg350-0793196a52a83970bb9bb4ac36f3068739afa543.zip
GLK: FROTZ: Fix text display for v6 games
-rw-r--r--engines/glk/window_text_buffer.cpp4
-rw-r--r--engines/glk/window_text_grid.cpp4
-rw-r--r--engines/glk/windows.h2
3 files changed, 6 insertions, 4 deletions
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);
}
/**