aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-09 07:50:37 +0000
committerMartin Kiewitz2009-10-09 07:50:37 +0000
commit3072d54589f223572ce3d147920190bb13e57252 (patch)
tree28aaa8346ea9ff509f31fc374b14c3ea916ac434
parent0c457be0fbc7935f264d8df55b034e33bda6f09f (diff)
downloadscummvm-rg350-3072d54589f223572ce3d147920190bb13e57252.tar.gz
scummvm-rg350-3072d54589f223572ce3d147920190bb13e57252.tar.bz2
scummvm-rg350-3072d54589f223572ce3d147920190bb13e57252.zip
SCI/newgui: Implemented kAddToPic (almost complete, but z-sorting and some extra code missing)
svn-id: r44807
-rw-r--r--engines/sci/gui/gui.cpp7
-rw-r--r--engines/sci/gui/gui_gfx.cpp47
-rw-r--r--engines/sci/gui/gui_gfx.h2
3 files changed, 53 insertions, 3 deletions
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<int16>(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;