aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-11 07:21:59 +0000
committerMartin Kiewitz2009-10-11 07:21:59 +0000
commit22baa6464733fa075f9896f71bad0bea432c1fa4 (patch)
tree3b92952829b0b392429caaaee561d9c62c812b2e
parentf2db73e55d2e3eda8b7f746ae8483f4f474d121a (diff)
downloadscummvm-rg350-22baa6464733fa075f9896f71bad0bea432c1fa4.tar.gz
scummvm-rg350-22baa6464733fa075f9896f71bad0bea432c1fa4.tar.bz2
scummvm-rg350-22baa6464733fa075f9896f71bad0bea432c1fa4.zip
SCI/newgui: kAddToPic fully implemented
svn-id: r44892
-rw-r--r--engines/sci/gui/gui.cpp24
-rw-r--r--engines/sci/gui/gui_gfx.cpp57
-rw-r--r--engines/sci/gui/gui_gfx.h1
3 files changed, 31 insertions, 51 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index c25ab48f2f..e4c1191f51 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -462,33 +462,15 @@ void SciGui::addToPicList(reg_t listReference, int argc, reg_t *argv) {
if (!list)
error("kAddToPic called with non-list as parameter");
-// Common::List<GuiAnimateList> *sortedList;
-// sortedList = _gfx->AnimateMakeSortedList(list);
-
-// uint16 szList = list.getSize();
-// HEAPHANDLE*arrObj = new HEAPHANDLE[szList];
-// int16*arrY = new int16[szList];
-// HEAPHANDLE hnode = list.getFirst();
-// sciNode1*pnode;
-//
-// for (int i = 0; i < szList; i++) {
-// pnode = (sciNode1*)heap2Ptr(hnode);
-// obj.set(pnode->value);
-// arrY[i] = obj.getProperty(3);
-//arrZ[i] = obj.getProperty(
-// arrObj[i] = pnode->value;
-// hnode = pnode->next;
-// }
-// animSort(arrObj, arrY, szList);
-
+ _gfx->AnimateMakeSortedList(list);
_gfx->AddToPicDrawCels(list);
_screen->_picNotValid = 2;
-// delete sortedList;
}
void SciGui::addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
- // FIXME: port over from gregs engine
+ _gfx->SetPort((GuiPort *)_windowMgr->_picWind);
+ _gfx->AddToPicDrawView(viewId, loopNo, celNo, leftPos, topPos, priority, control);
}
void SciGui::setNowSeen(reg_t objectReference) {
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index 99bc486b85..0292860e59 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -1158,51 +1158,48 @@ void SciGuiGfx::AnimateRestoreAndDelete(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;
+ GuiAnimateEntry *listEntry;
SciGuiView *view = NULL;
- GuiResourceId viewId;
- GuiViewLoopNo loopNo;
- GuiViewCelNo celNo;
- int16 x, y, z, priority;
- uint16 paletteNo, signal;
- Common::Rect celRect;
+ GuiAnimateList::iterator listIterator;
+ GuiAnimateList::iterator listEnd = _animateList.end();
- while (curNode) {
- curObject = curNode->value;
+ listIterator = _animateList.begin();
+ while (listIterator != listEnd) {
+ listEntry = (GuiAnimateEntry *)*listIterator;
+ curObject = listEntry->object;
- // 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 = CoordinateToPriority(y);
- paletteNo = GET_SEL32V(curObject, palette);
- signal = GET_SEL32V(curObject, signal);
+ if (listEntry->priority == -1)
+ listEntry->priority = CoordinateToPriority(listEntry->y);
// Get the corresponding view
- view = new SciGuiView(_s->resMan, _screen, _palette, viewId);
+ view = new SciGuiView(_s->resMan, _screen, _palette, listEntry->viewId);
// Create rect according to coordinates and given cel
- view->getCelRect(loopNo, celNo, x, y, priority, &celRect);
+ view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->priority, &listEntry->celRect);
// draw corresponding cel
- drawCel(viewId, loopNo, celNo, celRect.left, celRect.top, priority, paletteNo);
- if ((signal & SCI_ANIMATE_SIGNAL_IGNOREACTOR) == 0) {
- celRect.top = CLIP<int16>(PriorityToCoordinate(priority) - 1, celRect.top, celRect.bottom - 1);
- FillRect(celRect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15);
+ drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect.left, listEntry->celRect.top, listEntry->priority, listEntry->paletteNo);
+ if ((listEntry->signal & SCI_ANIMATE_SIGNAL_IGNOREACTOR) == 0) {
+ listEntry->celRect.top = CLIP<int16>(PriorityToCoordinate(listEntry->priority) - 1, listEntry->celRect.top, listEntry->celRect.bottom - 1);
+ FillRect(listEntry->celRect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15);
}
- curAddress = curNode->succ;
- curNode = _s->_segMan->lookupNode(curAddress);
+ listIterator++;
}
}
+void SciGuiGfx::AddToPicDrawView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
+ SciGuiView *view = NULL;
+ Common::Rect celRect;
+
+ view = new SciGuiView(_s->resMan, _screen, _palette, viewId);
+
+ // Create rect according to coordinates and given cel
+ view->getCelRect(loopNo, celNo, leftPos, topPos, priority, &celRect);
+ drawCel(viewId, loopNo, celNo, celRect.left, celRect.top, priority, 0);
+}
+
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 16bfecf817..93b3da25b2 100644
--- a/engines/sci/gui/gui_gfx.h
+++ b/engines/sci/gui/gui_gfx.h
@@ -122,6 +122,7 @@ public:
void AnimateDrawCels();
void AnimateRestoreAndDelete(int argc, reg_t *argv);
void AddToPicDrawCels(List *list);
+ void AddToPicDrawView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
void SetNowSeen(reg_t objectReference);