diff options
author | Max Horn | 2003-01-16 18:07:52 +0000 |
---|---|---|
committer | Max Horn | 2003-01-16 18:07:52 +0000 |
commit | 2eff7e22423562f407a0978917d713463da83848 (patch) | |
tree | ad24f5618a766811c5d140ad124a7bb0f2a1cf7c | |
parent | 4e07c1bb91d2fc2a2ab7156b5a252591d3ac1848 (diff) | |
download | scummvm-rg350-2eff7e22423562f407a0978917d713463da83848.tar.gz scummvm-rg350-2eff7e22423562f407a0978917d713463da83848.tar.bz2 scummvm-rg350-2eff7e22423562f407a0978917d713463da83848.zip |
fix off by one bug in gfxUsageBits code; fixed small glitch the actor iteration cleanup
svn-id: r6485
-rw-r--r-- | scumm/actor.cpp | 4 | ||||
-rw-r--r-- | scumm/saveload.cpp | 3 | ||||
-rw-r--r-- | scumm/usage_bits.cpp | 16 |
3 files changed, 16 insertions, 7 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 5c37f12285..d04dfc495b 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -1117,6 +1117,7 @@ void Scumm::setActorRedrawFlags(bool fg, bool bg) for (j = 1; j < NUM_ACTORS; j++) { if (testGfxUsageBit(strip, j) && testGfxOtherUsageBits(strip, j)) { Actor *a = derefActor(j); + assert(a->number == j); if (fg) a->needRedraw = true; if (bg) @@ -1136,6 +1137,7 @@ int Scumm::getActorFromPos(int x, int y) return 0; for (i = 1; i < NUM_ACTORS; i++) { Actor *a = derefActor(i); + assert(a->number == i); if (testGfxUsageBit(x >> 3, i) && !getClass(i, 32) && y >= a->top && y <= a->bottom) { return i; } @@ -1554,7 +1556,7 @@ void Scumm::resetActorBgs() } for (i = 1; i < NUM_ACTORS; i++) { - a = derefActor(j); + a = derefActor(i); a->needBgReset = false; } } diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 67230f64b7..db9a7dc2d4 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -580,8 +580,7 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion) if (!s->isSaving() && savegameVersion < VER_V13) { // Since roughly v13 of the save games, the objs storage has changed a bit for (i = _numObjectsInRoom; i < _numLocalObjects; i++) { - if (_objs[i].fl_object_index == 0) - _objs[i].obj_nr = 0; + _objs[i].obj_nr = 0; } } diff --git a/scumm/usage_bits.cpp b/scumm/usage_bits.cpp index 47bd80593a..450b8cae84 100644 --- a/scumm/usage_bits.cpp +++ b/scumm/usage_bits.cpp @@ -39,17 +39,23 @@ void Scumm::upgradeGfxUsageBits() void Scumm::setGfxUsageBit(int strip, int bit) { - gfxUsageBits[3 * strip + bit / 32] |= (1 << ((bit - 1) % 32)); + assert(1 <= bit && bit <= 96); + bit--; + gfxUsageBits[3 * strip + bit / 32] |= (1 << (bit % 32)); } void Scumm::clearGfxUsageBit(int strip, int bit) { - gfxUsageBits[3 * strip + bit / 32] &= ~(1 << ((bit - 1) % 32)); + assert(1 <= bit && bit <= 96); + bit--; + gfxUsageBits[3 * strip + bit / 32] &= ~(1 << (bit % 32)); } bool Scumm::testGfxUsageBit(int strip, int bit) { - return (gfxUsageBits[3 * strip + bit / 32] & (1 << ((bit - 1) % 32))) != 0; + assert(1 <= bit && bit <= 96); + bit--; + return (gfxUsageBits[3 * strip + bit / 32] & (1 << (bit % 32))) != 0; } bool Scumm::testGfxAnyUsageBits(int strip) @@ -71,7 +77,9 @@ bool Scumm::testGfxOtherUsageBits(int strip, int bit) uint32 bitmask[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; int i; - bitmask[bit / 32] &= ~(1 << ((bit - 1) % 32)); + assert(1 <= bit && bit <= 96); + bit--; + bitmask[bit / 32] &= ~(1 << (bit % 32)); for (i = 0; i < 3; i++) if (gfxUsageBits[3 * strip + i] & bitmask[i]) |