diff options
-rw-r--r-- | engines/sci/gui/gui.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 23 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.h | 2 |
3 files changed, 23 insertions, 4 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 16cfff765c..7c1f278296 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -414,7 +414,7 @@ void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { //_gfx->AnimateUpdateScreen(); _screen->copyToScreen(); - _gfx->AnimateRestoreAndDelete(); + _gfx->AnimateRestoreAndDelete(list, argc, argv); _gfx->SetPort(oldPort); } diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 1259814329..dbc7c9f0f0 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -1076,7 +1076,8 @@ enum { SCI_ANIMATE_MASK_ALWAYSUPDATE = 0x0020, SCI_ANIMATE_MASK_FORCEUPDATE = 0x0040, SCI_ANIMATE_MASK_REMOVEVIEW = 0x0080, - SCI_ANIMATE_MASK_FROZEN = 0x0100 + SCI_ANIMATE_MASK_FROZEN = 0x0100, + SCI_ANIMATE_MASK_DISPOSEME = 0x8000 }; void SciGuiGfx::AnimateInvoke(List *list, int argc, reg_t *argv) { @@ -1259,7 +1260,25 @@ void SciGuiGfx::AnimateDrawCels(List *list) { } } -void SciGuiGfx::AnimateRestoreAndDelete() { +void SciGuiGfx::AnimateRestoreAndDelete(List *list, int argc, reg_t *argv) { + SegManager *segMan = _s->_segMan; + reg_t curAddress = list->first; + Node *curNode = _s->_segMan->lookupNode(curAddress); + reg_t curObject; + uint16 mask; + + while (curNode) { + curObject = curNode->value; + mask = GET_SEL32V(curObject, signal); + if (mask & SCI_ANIMATE_MASK_DISPOSEME) { + // Call .delete_ method of that object + invoke_selector(_s, curObject, _s->_kernel->_selectorCache.delete_, kContinueOnInvalidSelector, argv, argc, __FILE__, __LINE__, 0); + // Lookup node again, since the nodetable it was in may have been reallocated + curNode = _s->_segMan->lookupNode(curAddress); + } + curAddress = curNode->succ; + curNode = _s->_segMan->lookupNode(curAddress); + } } void SciGuiGfx::SetNowSeen(reg_t objectReference) { diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index a2e9895293..96c408788e 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -110,7 +110,7 @@ public: Common::List<GuiAnimateList> *AnimateMakeSortedList(List *list); void AnimateUpdate(); void AnimateDrawCels(List *list); - void AnimateRestoreAndDelete(); + void AnimateRestoreAndDelete(List *list, int argc, reg_t *argv); void SetNowSeen(reg_t objectReference); GuiPort *_menuPort; |