diff options
author | Alexander Tkachev | 2016-08-05 14:44:31 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-05 14:44:31 +0600 |
commit | 18a3f5c12592aadca684d256170f465a3d53ecd8 (patch) | |
tree | 202107e4627a63b0f22217de1c337665df3fb5fd /engines/wage/gui-console.cpp | |
parent | 8fcc919b565bb944a3ff87540715fefc8761cf89 (diff) | |
download | scummvm-rg350-18a3f5c12592aadca684d256170f465a3d53ecd8.tar.gz scummvm-rg350-18a3f5c12592aadca684d256170f465a3d53ecd8.tar.bz2 scummvm-rg350-18a3f5c12592aadca684d256170f465a3d53ecd8.zip |
WAGE: Fix crash in Brownie's Dream
I guess it would crash everywhere else as well, if console window would
be placed the same way. The problem is that console window goes off
screen a little in that game, but copyRectToScreen arguments are not
adjusted to stay within screen area.
This commit adds some checks and adjusts these arguments.
Diffstat (limited to 'engines/wage/gui-console.cpp')
-rw-r--r-- | engines/wage/gui-console.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp index 2b364d3657..2476a8c7fb 100644 --- a/engines/wage/gui-console.cpp +++ b/engines/wage/gui-console.cpp @@ -306,7 +306,20 @@ void Gui::drawInput() { font->drawString(&_screen, _out[_inputTextLineNum], x, y, _screen.w, kColorBlack); - g_system->copyRectToScreen(_screen.getBasePtr(x, y), _screen.pitch, x, y, _consoleWindow->getInnerDimensions().width(), font->getFontHeight()); + int w = _consoleWindow->getInnerDimensions().width(); + int h = font->getFontHeight(); + if (x < 0) { + w += x; + x = 0; + } + if (y < 0) { + h += y; + y = 0; + } + if (x + w > _screen.w) w = _screen.w - x; + if (y + h > _screen.h) h = _screen.h - y; + if (w != 0 && h != 0) + g_system->copyRectToScreen(_screen.getBasePtr(x, y), _screen.pitch, x, y, w, h); } _cursorX = font->getStringWidth(_out[_inputTextLineNum]) + kConHPadding; |