From 680f7c897af5dac091e1abc47f0500cccbd07a51 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 18 Jun 2010 15:40:18 +0000 Subject: Fixed a problem in kAnimate which occurred when a list was modified by a call (e.g. in KQ1 demo, PQ2) svn-id: r50022 --- engines/sci/engine/seg_manager.cpp | 8 +------- engines/sci/graphics/animate.cpp | 3 +++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index f19c03d5a8..5371238304 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -531,12 +531,6 @@ Node *SegManager::lookupNode(reg_t addr) { SegmentType type = getSegmentType(addr.segment); if (type != SEG_TYPE_NODES) { - if (g_sci->getGameId() == "kq1sci") { - // WORKAROUND: The demo of KQ1 is trying to use an invalid memory reference as a list node - warning("Attempt to use non-node %04x:%04x (type %d) as list node", PRINT_REG(addr), type); - return NULL; - } - error("Attempt to use non-node %04x:%04x (type %d) as list node", PRINT_REG(addr), type); return NULL; } @@ -544,7 +538,7 @@ Node *SegManager::lookupNode(reg_t addr) { NodeTable *nt = (NodeTable *)_heap[addr.segment]; if (!nt->isValidEntry(addr.offset)) { - error("Attempt to use invalid reference %04x:%04x as list node", PRINT_REG(addr)); + error("Attempt to use invalid or discarded reference %04x:%04x as list node", PRINT_REG(addr)); return NULL; } diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index 598724f2be..06054f3a19 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -606,6 +606,9 @@ void GfxAnimate::kernelAnimate(reg_t listReference, bool cycle, int argc, reg_t if (cycle) { if (!invoke(list, argc, argv)) return; + + // Look up the list again, as it may have been modified + list = _s->_segMan->lookupList(listReference); } Port *oldPort = _ports->setPort((Port *)_ports->_picWind); -- cgit v1.2.3