diff options
-rw-r--r-- | scumm/object.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp index 600c176ed1..ea6c32e27b 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -763,13 +763,22 @@ void Scumm::clearOwnerOf(int obj) void Scumm::removeObjectFromRoom(int obj) { - int i, j; + int i, j, strip; for (i = 1; i < _numLocalObjects; i++) { if (_objs[i].obj_nr == (uint16)obj) { if (_objs[i].width != 0) { - for (j = 0; j < _objs[i].width; j++) - setGfxUsageBit((_objs[i].x_pos >> 3) + j, USAGE_BIT_DIRTY); + for (j = 0; j < _objs[i].width; j++) { + strip = (_objs[i].x_pos >> 3) + j; + + // Clip value + if (strip < _screenStartStrip) + continue; + if (strip > _screenEndStrip) + break; + + setGfxUsageBit(strip, USAGE_BIT_DIRTY); + } } _BgNeedsRedraw = true; return; |