diff options
| author | James Brown | 2003-01-16 17:37:34 +0000 |
|---|---|---|
| committer | James Brown | 2003-01-16 17:37:34 +0000 |
| commit | 4e07c1bb91d2fc2a2ab7156b5a252591d3ac1848 (patch) | |
| tree | 9377fc2d8931c6afc7ef024305ae040db20a9e87 | |
| parent | d5a266f2ca7ca39b31286d8f34eae26a2919ba8e (diff) | |
| download | scummvm-rg350-4e07c1bb91d2fc2a2ab7156b5a252591d3ac1848.tar.gz scummvm-rg350-4e07c1bb91d2fc2a2ab7156b5a252591d3ac1848.tar.bz2 scummvm-rg350-4e07c1bb91d2fc2a2ab7156b5a252591d3ac1848.zip | |
Patch 668634: Actor iteration fix
svn-id: r6484
| -rw-r--r-- | scumm/actor.cpp | 12 | ||||
| -rw-r--r-- | scumm/gfx.cpp | 3 | ||||
| -rw-r--r-- | scumm/script_v6.cpp | 2 | ||||
| -rw-r--r-- | scumm/scumm.h | 1 | ||||
| -rw-r--r-- | scumm/scummvm.cpp | 6 |
5 files changed, 13 insertions, 11 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 478156bb8f..5c37f12285 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -1103,7 +1103,7 @@ void Scumm::setActorRedrawFlags(bool fg, bool bg) int i, j; if (_fullRedraw) { - for (j = 0; j < NUM_ACTORS; j++) { + for (j = 1; j < NUM_ACTORS; j++) { Actor *a = derefActor(j); if (fg) a->needRedraw = true; @@ -1114,7 +1114,7 @@ void Scumm::setActorRedrawFlags(bool fg, bool bg) for (i = 0; i < gdi._numStrips; i++) { int strip = _screenStartStrip + i; if (testGfxAnyUsageBits(strip)) { - for (j = 0; j < NUM_ACTORS; j++) { + for (j = 1; j < NUM_ACTORS; j++) { if (testGfxUsageBit(strip, j) && testGfxOtherUsageBits(strip, j)) { Actor *a = derefActor(j); if (fg) @@ -1543,18 +1543,18 @@ void Scumm::resetActorBgs() for (i = 0; i < gdi._numStrips; i++) { int strip = _screenStartStrip + i; - a = getFirstActor(); - for (j = 0; j < NUM_ACTORS; j++) { + for (j = 1; j < NUM_ACTORS; j++) { + a = derefActor(j); if (testGfxUsageBit(strip, j) && a->top != 0xFF && a->needBgReset) { clearGfxUsageBit(strip, j); if ((a->bottom - a->top) >= 0) gdi.resetBackground(a->top, a->bottom, i); } - a++; } } - for (i = 1, a = getFirstActor(); ++a, i < NUM_ACTORS; i++) { + for (i = 1; i < NUM_ACTORS; i++) { + a = derefActor(j); a->needBgReset = false; } } diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 9355c2581b..6c7a897b46 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -1820,7 +1820,8 @@ void Scumm::setCameraFollows(Actor *a) if (t - _screenStartStrip < camera._leftTrigger || t - _screenStartStrip > camera._rightTrigger) setCameraAt(a->x, 0); - for (i = 1, a = getFirstActor(); ++a, i < NUM_ACTORS; i++) { + for (i = 1; i < NUM_ACTORS; i++) { + a = derefActor(i); if (a->isInCurrentRoom()) a->needRedraw = true; } diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 6369f06bcb..fb2727d340 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -2657,7 +2657,7 @@ void Scumm_v6::o6_kernelSetFunctions() case 6: _fullRedraw = 1; redrawBGAreas(); - for (i = 0; i < NUM_ACTORS; i++) + for (i = 1; i < NUM_ACTORS; i++) derefActor(i)->needRedraw = true; processActors(); fadeIn(args[1]); diff --git a/scumm/scumm.h b/scumm/scumm.h index 501dc1e51d..7442aefb11 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -630,7 +630,6 @@ public: /* Should be in Actor class */ Actor *derefActor(int id); Actor *derefActorSafe(int id, const char *errmsg); - Actor *getFirstActor() { return _actors; } void showActors(); uint32 *_classData; diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index e3c8b33a72..1c4019fa06 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -233,7 +233,8 @@ void Scumm::scummInit() // Allocate and Initialize actors _actors = new Actor[NUM_ACTORS]; - for (i = 1, a = getFirstActor(); ++a, i < NUM_ACTORS; i++) { + for (i = 1; i < NUM_ACTORS; i++) { + a = derefActor(i); a->number = i; a->initActorClass(this); a->initActor(1); @@ -620,7 +621,8 @@ void Scumm::startScene(int room, Actor * a, int objectNr) clearEnqueue(); stopCycle(0); - for (i = 1, at = getFirstActor(); ++at, i < NUM_ACTORS; i++) { + for (i = 1; i < NUM_ACTORS; i++) { + at = derefActor(i); at->hideActor(); } |
