diff options
-rw-r--r-- | engines/sci/gui/gui.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 78 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.h | 2 | ||||
-rw-r--r-- | engines/sci/gui/gui_view.h | 1 |
4 files changed, 77 insertions, 8 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index befad94231..f006f0032b 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -377,7 +377,7 @@ int16 SciGui::onControl(byte screenMask, Common::Rect rect) { } void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { - bool old_picNotValid = _screen->_picNotValid; + byte old_picNotValid = _screen->_picNotValid; if (listReference.isNull()) { _gfx->AnimateDisposeLastCast(); @@ -398,7 +398,7 @@ void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); _gfx->AnimateDisposeLastCast(); - _gfx->AnimateFill(); + _gfx->AnimateFill(list, old_picNotValid); // _gfx->AnimateSort(); if (old_picNotValid) { diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 80f5a3807f..f76f60e74e 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -1068,7 +1068,15 @@ void SciGuiGfx::AnimateDisposeLastCast() { } enum { - SCI_ANIMATE_SIGNAL_FROZEN = 0x0100 + SCI_ANIMATE_MASK_STOPUPDATE = 0x0001, + SCI_ANIMATE_MASK_VIEWUPDATED = 0x0002, + SCI_ANIMATE_MASK_NOUPDATE = 0x0004, + SCI_ANIMATE_MASK_HIDDEN = 0x0008, + SCI_ANIMATE_MASK_FIXEDPRIORITY = 0x0010, + SCI_ANIMATE_MASK_ALWAYSUPDATE = 0x0020, + SCI_ANIMATE_MASK_FORCEUPDATE = 0x0040, + SCI_ANIMATE_MASK_REMOVEVIEW = 0x0080, + SCI_ANIMATE_MASK_FROZEN = 0x0100 }; void SciGuiGfx::AnimateInvoke(List *list, int argc, reg_t *argv) { @@ -1076,12 +1084,13 @@ void SciGuiGfx::AnimateInvoke(List *list, int argc, reg_t *argv) { reg_t curAddress = list->first; Node *curNode = _s->_segMan->lookupNode(curAddress); reg_t curObject; - uint16 signal; + uint16 mask; while (curNode) { curObject = curNode->value; - signal = GET_SEL32V(curObject, signal); - if (!(signal & SCI_ANIMATE_SIGNAL_FROZEN)) { + mask = GET_SEL32V(curObject, signal); + if (!(mask & SCI_ANIMATE_MASK_FROZEN)) { + // Call .doit method of that object invoke_selector(_s, curObject, _s->_kernel->_selectorCache.doit, kContinueOnInvalidSelector, argv, argc, __FILE__, __LINE__, 0); // Lookup node again, since the nodetable it was in may have been reallocated curNode = _s->_segMan->lookupNode(curAddress); @@ -1091,7 +1100,66 @@ void SciGuiGfx::AnimateInvoke(List *list, int argc, reg_t *argv) { } } -void SciGuiGfx::AnimateFill() { +void SciGuiGfx::AnimateFill(List *list, byte &old_picNotValid) { + SegManager *segMan = _s->_segMan; + reg_t curAddress = list->first; + Node *curNode = _s->_segMan->lookupNode(curAddress); + reg_t curObject; + SciGuiView *view = NULL; + GuiResourceId viewId; + GuiViewLoopNo loopNo; + GuiViewCelNo celNo; + int16 x, y, priority; + uint16 mask; + + while (curNode) { + curObject = curNode->value; + + // Get cel data... + viewId = GET_SEL32V(curObject, view); + loopNo = GET_SEL32V(curObject, loop); + celNo = GET_SEL32V(curObject, cel); + x = GET_SEL32V(curObject, x); + y = GET_SEL32V(curObject, y); + priority = GET_SEL32V(curObject, priority); + mask = GET_SEL32V(curObject, signal); + + // Get the corresponding view + view = new SciGuiView(_s->resMan, _screen, _palette, viewId); + + // adjust loop and cel, if any of those is invalid + if (loopNo >= view->getLoopCount()) { + loopNo = 0; + PUT_SEL32V(curObject, loop, loopNo); + } + if (celNo >= view->getCelCount(loopNo)) { + celNo = 0; + PUT_SEL32V(curObject, cel, celNo); + } + + // FIXME: this code doesnt seem to do anything useful?!?! + // rect = (Common::Rect *)&cobj[_objOfs[8]]; + // res->getCelRect(curLoop, curCel, x, y, z, rect); + if (!(mask & SCI_ANIMATE_MASK_FIXEDPRIORITY)) + PUT_SEL32V(curObject, priority, 0); // CoordPri(y) FIXME + + if (mask & SCI_ANIMATE_MASK_NOUPDATE) { + if (mask & (SCI_ANIMATE_MASK_FORCEUPDATE | SCI_ANIMATE_MASK_VIEWUPDATED) + || (mask & SCI_ANIMATE_MASK_HIDDEN && !(mask & SCI_ANIMATE_MASK_REMOVEVIEW)) + || (!(mask & SCI_ANIMATE_MASK_HIDDEN) && mask & SCI_ANIMATE_MASK_REMOVEVIEW) + || (mask & SCI_ANIMATE_MASK_ALWAYSUPDATE)) + old_picNotValid++; + mask &= 0xFFFF ^ SCI_ANIMATE_MASK_STOPUPDATE; + } else { + if (mask & SCI_ANIMATE_MASK_STOPUPDATE || mask & SCI_ANIMATE_MASK_ALWAYSUPDATE) + old_picNotValid++; + mask &= 0xFFFF ^ SCI_ANIMATE_MASK_FORCEUPDATE; + } + PUT_SEL32V(curObject, signal, mask); + + curAddress = curNode->succ; + curNode = _s->_segMan->lookupNode(curAddress); + } } Common::List<GuiAnimateList> *SciGuiGfx::AnimateMakeSortedList(List *list) { diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index ca00f329ba..2c355f13ad 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -106,7 +106,7 @@ public: int16 onControl(uint16 screenMask, Common::Rect rect); void AnimateDisposeLastCast(); void AnimateInvoke(List *list, int argc, reg_t *argv); - void AnimateFill(); + void AnimateFill(List *list, byte &oldPicNotValid); Common::List<GuiAnimateList> *AnimateMakeSortedList(List *list); void AnimateUpdate(); void AnimateDrawCels(); diff --git a/engines/sci/gui/gui_view.h b/engines/sci/gui/gui_view.h index 2d0e4f723d..df6b0e75e0 100644 --- a/engines/sci/gui/gui_view.h +++ b/engines/sci/gui/gui_view.h @@ -59,6 +59,7 @@ public: byte *getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo); void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 paletteNo); uint16 getLoopCount() const { return _loopCount; } + uint16 getCelCount(GuiViewLoopNo loopNo) { return _loop[loopNo].celCount; } GuiPalette *getPalette(); private: |