From 55e65cee8099d91ae4797f7772cb5e459089892a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 5 Apr 2011 13:43:54 +0200 Subject: SCUMM: Cleanup --- engines/scumm/script.cpp | 22 ++++++++-------------- engines/scumm/sound.cpp | 9 ++++----- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index c481fb8a4e..c6c1f5f58f 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -261,8 +261,7 @@ void ScummEngine::stopScript(int script) { /* Stop an object script 'script'*/ void ScummEngine::stopObjectScript(int script) { ScriptSlot *ss; - NestedScript *nest; - int i, num; + int i; if (script == 0) return; @@ -282,19 +281,14 @@ void ScummEngine::stopObjectScript(int script) { } } - nest = vm.nest; - num = vm.numNestedScripts; - - while (num > 0) { - if (nest->number == script && - (nest->where == WIO_ROOM || nest->where == WIO_INVENTORY || nest->where == WIO_FLOBJECT)) { - nukeArrays(nest->slot); - nest->number = 0xFF; - nest->slot = 0xFF; - nest->where = 0xFF; + for (i = 0; i < vm.numNestedScripts; ++i) { + if (vm.nest[i].number == script && + (vm.nest[i].where == WIO_ROOM || vm.nest[i].where == WIO_INVENTORY || vm.nest[i].where == WIO_FLOBJECT)) { + nukeArrays(vm.nest[i].slot); + vm.nest[i].number = 0xFF; + vm.nest[i].slot = 0xFF; + vm.nest[i].where = 0xFF; } - nest++; - num--; } } diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index cff1618c18..0051319151 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -195,8 +195,7 @@ void Sound::playSound(int soundID) { return; } - debugC(DEBUG_SOUND, "playSound #%d (room %d)", soundID, - _vm->getResourceRoomNr(rtSound, soundID)); + debugC(DEBUG_SOUND, "playSound #%d", soundID); ptr = _vm->getResourceAddress(rtSound, soundID); @@ -1223,7 +1222,7 @@ int ScummEngine::readSoundResource(int idx) { if (!dmuFile.open(buffer)) { error("Can't open music file %s", buffer); - _res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET; + _res->roomoffs[rtSound][idx] = RES_INVALID_OFFSET; return 0; } dmuFile.seek(4, SEEK_SET); @@ -1247,7 +1246,7 @@ int ScummEngine::readSoundResource(int idx) { } error("Unrecognized base tag 0x%08x in sound %d", basetag, idx); } - _res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET; + _res->roomoffs[rtSound][idx] = RES_INVALID_OFFSET; return 0; } @@ -2122,7 +2121,7 @@ int ScummEngine::readSoundResourceSmallHeader(int idx) { _fileHandle->read(_res->createResource(rtSound, idx, ro_size - 4), ro_size - 4); return 1; } - _res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET; + _res->roomoffs[rtSound][idx] = RES_INVALID_OFFSET; return 0; } -- cgit v1.2.3