aboutsummaryrefslogtreecommitdiff
path: root/engines/toltecs/toltecs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/toltecs/toltecs.cpp')
-rw-r--r--engines/toltecs/toltecs.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index 7e3a294087..7414ab0e58 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -307,6 +307,15 @@ void ToltecsEngine::drawScreen() {
if (_screen->_guiRefresh && _guiHeight > 0 && _cameraHeight > 0) {
// Update the GUI when needed and it's visible
+ if (_cameraHeight + _guiHeight > 400)
+ // HACK: Sanity check - happens when smoking the peace pipe in the
+ // Indian village.
+ // FIXME: why does this happen? Fix the actual cause.
+ warning("Scene height (%d) and GUI height (%d) exceed the screen "
+ "height, cutting off the screen", _cameraHeight, _guiHeight);
+ _cameraHeight = 400 - _guiHeight;
+ }
+
_system->copyRectToScreen((const byte *)_screen->_frontScreen + _cameraHeight * 640,
640, 0, _cameraHeight, 640, _guiHeight);
_screen->_guiRefresh = false;