diff options
-rw-r--r-- | engines/mads/msurface.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 2adb3e5b81..e8d391ff89 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -497,12 +497,14 @@ MSurface *MSurface::flipHorizontal() const { /*------------------------------------------------------------------------*/ int DepthSurface::getDepth(const Common::Point &pt) { - if (_vm->_game->_scene._sceneInfo->_depthStyle == 2) { int bits = (3 - (pt.x % 4)) * 2; byte v = *getBasePtr(pt.x >> 2, pt.y); return v >> bits; } else { + if (pt.x < 0 || pt.y < 0 || pt.x >= this->w || pt.y >= this->h) + return 8; + return *getBasePtr(pt.x, pt.y) & 0xF; } } |