diff options
author | David Eriksson | 2003-10-28 14:19:11 +0000 |
---|---|---|
committer | David Eriksson | 2003-10-28 14:19:11 +0000 |
commit | 1ab811c4ec3bdbc97d56fa648ea66954bff3f467 (patch) | |
tree | c0d4e67c117c9da8064393283f7f0c208b5b7690 /queen/display.cpp | |
parent | 7418c47b48925b095f7ff9daae9962f92f297cc7 (diff) | |
download | scummvm-rg350-1ab811c4ec3bdbc97d56fa648ea66954bff3f467.tar.gz scummvm-rg350-1ab811c4ec3bdbc97d56fa648ea66954bff3f467.tar.bz2 scummvm-rg350-1ab811c4ec3bdbc97d56fa648ea66954bff3f467.zip |
Safer use of dynalum.
svn-id: r10991
Diffstat (limited to 'queen/display.cpp')
-rw-r--r-- | queen/display.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/queen/display.cpp b/queen/display.cpp index be4f7a346b..29730132fd 100644 --- a/queen/display.cpp +++ b/queen/display.cpp @@ -146,11 +146,15 @@ void Display::dynalumInit(Resource *resource, const char *roomName, uint16 roomN // FIXME: are these tests really needed ? if (roomNum < 90 || ((roomNum > 94) && (roomNum < 114))) { char filename[20]; + sprintf(filename, "%s.msk", roomName); - if (resource->exists(filename)) + _dynalum.haveMsk = resource->exists(filename); + if (_dynalum.haveMsk) resource->loadFile(filename, 0, (uint8*)_dynalum.msk); + sprintf(filename, "%s.lum", roomName); - if (resource->exists(filename)) + _dynalum.haveLum = resource->exists(filename); + if (_dynalum.haveLum) resource->loadFile(filename, 0, (uint8*)_dynalum.lum); } } @@ -158,13 +162,23 @@ void Display::dynalumInit(Resource *resource, const char *roomName, uint16 roomN void Display::dynalumUpdate(int x, int y) { + if (!_dynalum.haveMsk) + return; + if (x >= _bdWidth) { x = _bdWidth; } if (y >= ROOM_ZONE_HEIGHT - 1) { y = ROOM_ZONE_HEIGHT - 1; } - uint8 colMask = _dynalum.msk[(y / 4) * 160 + (x / 4)]; + + unsigned offset = (y / 4) * 160 + (x / 4); + if (offset >= sizeof(_dynalum.msk)) { + debug(0, "Graphics::dynalumUpdate(%d, %d) - invalid offset: %08x", x, y, offset); + return; + } + + uint8 colMask = _dynalum.msk[offset]; debug(9, "Graphics::dynalumUpdate(%d, %d) - colMask = %d", x, y, colMask); if (colMask != _dynalum.prevColMask) { |