From 3072d54589f223572ce3d147920190bb13e57252 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 9 Oct 2009 07:50:37 +0000 Subject: SCI/newgui: Implemented kAddToPic (almost complete, but z-sorting and some extra code missing) svn-id: r44807 --- engines/sci/gui/gui.cpp | 7 ++++--- engines/sci/gui/gui_gfx.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++ engines/sci/gui/gui_gfx.h | 2 ++ 3 files changed, 53 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 84af16c9f5..de1de225bf 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -431,7 +431,7 @@ void SciGui::addToPicList(reg_t listReference, int argc, reg_t *argv) { if (!list) error("kAddToPic called with non-list as parameter"); - sortedList = _gfx->AnimateMakeSortedList(list); +// sortedList = _gfx->AnimateMakeSortedList(list); // uint16 szList = list.getSize(); // HEAPHANDLE*arrObj = new HEAPHANDLE[szList]; @@ -449,9 +449,10 @@ void SciGui::addToPicList(reg_t listReference, int argc, reg_t *argv) { // } // animSort(arrObj, arrY, szList); - _screen->_picNotValid = 2; // FIXME: _picNotValid is a boolean! + _gfx->AddToPicDrawCels(list); - delete sortedList; + _screen->_picNotValid = 2; +// delete sortedList; } void SciGui::addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 056bbecdc8..2891eacf73 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -1415,6 +1415,53 @@ void SciGuiGfx::AnimateRestoreAndDelete(List *list, int argc, reg_t *argv) { } } +void SciGuiGfx::AddToPicDrawCels(List *list) { + 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, z, priority; + uint16 paletteNo; + Common::Rect celRect; + + 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); + z = GET_SEL32V(curObject, z); + priority = GET_SEL32V(curObject, priority); + if (priority == -1) + priority = 0; //CoordPri(y); + paletteNo = GET_SEL32V(curObject, palette); + + // Get the corresponding view + view = new SciGuiView(_s->resMan, _screen, _palette, viewId); + + // Create rect according to coordinates and given cel + view->getCelRect(loopNo, celNo, x, y, z, &celRect); + + // draw corresponding cel + drawCel(viewId, loopNo, celNo, celRect.left, celRect.top, z, paletteNo); +// FIXME find out what 17 is and implement this as well +// if ((obj.getProperty(17) & 0x4000) == 0) { +// rect.top = CLIP(PriCoord(prio) - 1, rect.top, rect.bottom - 1); +// _gfx->RFillRect(rect, 4, 0, 0, 0xF); +// } + + curAddress = curNode->succ; + curNode = _s->_segMan->lookupNode(curAddress); + } +} + void SciGuiGfx::SetNowSeen(reg_t objectReference) { SegManager *segMan = _s->_segMan; SciGuiView *view = NULL; diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index 8b89741b2a..461a9a895c 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -107,6 +107,8 @@ public: void AnimateUpdate(List *list); void AnimateDrawCels(List *list); void AnimateRestoreAndDelete(List *list, int argc, reg_t *argv); + void AddToPicDrawCels(List *list); + void SetNowSeen(reg_t objectReference); GuiPort *_menuPort; -- cgit v1.2.3