aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-28 19:19:35 +0000
committerMartin Kiewitz2009-10-28 19:19:35 +0000
commit5f71650520b81ec5f83191a8726ddfe577e72184 (patch)
tree3dc0e6e9ed1bdd94386e2a7a0b3d86cc7d9fca95 /engines
parent88e56f87eb351f2a2ed7df6ada8f7d81e99f02ec (diff)
downloadscummvm-rg350-5f71650520b81ec5f83191a8726ddfe577e72184.tar.gz
scummvm-rg350-5f71650520b81ec5f83191a8726ddfe577e72184.tar.bz2
scummvm-rg350-5f71650520b81ec5f83191a8726ddfe577e72184.zip
SCI/newgui: BaseSetter moved to SciGui
svn-id: r45480
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kgraphics.cpp29
-rw-r--r--engines/sci/gui/gui.cpp29
-rw-r--r--engines/sci/gui/gui.h1
3 files changed, 32 insertions, 27 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 684fc44858..cba042f472 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -482,35 +482,10 @@ reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) {
reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) {
reg_t object = argv[0];
- if (lookup_selector(s->_segMan, object, s->_kernel->_selectorCache.brLeft, NULL, NULL) == kSelectorVariable) {
- int x = (int16)GET_SEL32V(s->_segMan, object, x);
- int y = (int16)GET_SEL32V(s->_segMan, object, y);
- int z = (s->_kernel->_selectorCache.z > -1) ? (int16)GET_SEL32V(s->_segMan, object, z) : 0;
- int ystep = (int16)GET_SEL32V(s->_segMan, object, yStep);
- int view = GET_SEL32V(s->_segMan, object, view);
- int loop = GET_SEL32V(s->_segMan, object, loop);
- int cel = GET_SEL32V(s->_segMan, object, cel);
-
- SciGuiView *tmpView = new SciGuiView(s->resMan, NULL, NULL, view);
- sciViewCelInfo *celInfo = tmpView->getCelInfo(loop, cel);
- int left = x + celInfo->displaceX - (celInfo->width >> 1);
- int right = left + celInfo->width;
- int bottom = y + celInfo->displaceY - z + 1;
- int top = bottom - ystep;
-
- debugC(2, kDebugLevelBaseSetter, "(%d,%d)+/-(%d,%d), (%d x %d) -> (%d, %d) to (%d, %d)\n",
- x, y, celInfo->displaceX, celInfo->displaceY, celInfo->width, celInfo->height, left, top, bottom, right);
-
- delete tmpView;
-
- PUT_SEL32V(s->_segMan, object, brLeft, left);
- PUT_SEL32V(s->_segMan, object, brRight, right);
- PUT_SEL32V(s->_segMan, object, brTop, top);
- PUT_SEL32V(s->_segMan, object, brBottom, bottom);
- }
+ s->_gui->baseSetter(object);
return s->r_acc;
-} // kBaseSetter
+}
reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv) {
s->_gui->setNowSeen(argv[0]);
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 321ff074c7..fd5df6c365 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -637,6 +637,35 @@ bool SciGui::isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::P
return result;
}
+void SciGui::baseSetter(reg_t object) {
+ if (lookup_selector(_s->_segMan, object, _s->_kernel->_selectorCache.brLeft, NULL, NULL) == kSelectorVariable) {
+ int16 x = GET_SEL32V(_s->_segMan, object, x);
+ int16 y = GET_SEL32V(_s->_segMan, object, y);
+ int16 z = (_s->_kernel->_selectorCache.z > -1) ? GET_SEL32V(_s->_segMan, object, z) : 0;
+ int16 yStep = GET_SEL32V(_s->_segMan, object, yStep);
+ GuiResourceId viewId = GET_SEL32V(_s->_segMan, object, view);
+ int16 loopNo = GET_SEL32V(_s->_segMan, object, loop);
+ int16 celNo = GET_SEL32V(_s->_segMan, object, cel);
+
+ SciGuiView *tmpView = new SciGuiView(_s->resMan, NULL, NULL, viewId);
+ sciViewCelInfo *celInfo = tmpView->getCelInfo(loopNo, celNo);
+ int16 left = x + celInfo->displaceX - (celInfo->width >> 1);
+ int16 right = left + celInfo->width;
+ int16 bottom = y + celInfo->displaceY - z + 1;
+ int16 top = bottom - yStep;
+
+ debugC(2, kDebugLevelBaseSetter, "(%d,%d)+/-(%d,%d), (%d x %d) -> (%d, %d) to (%d, %d)\n",
+ x, y, celInfo->displaceX, celInfo->displaceY, celInfo->width, celInfo->height, left, top, bottom, right);
+
+ delete tmpView;
+
+ PUT_SEL32V(_s->_segMan, object, brLeft, left);
+ PUT_SEL32V(_s->_segMan, object, brRight, right);
+ PUT_SEL32V(_s->_segMan, object, brTop, top);
+ PUT_SEL32V(_s->_segMan, object, brBottom, bottom);
+ }
+}
+
void SciGui::hideCursor() {
_cursor->hide();
}
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index b39cb59bf9..2ed9a253c8 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -117,6 +117,7 @@ public:
virtual void setNowSeen(reg_t objectReference);
virtual bool canBeHere(reg_t curObject, reg_t listReference);
virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
+ virtual void baseSetter(reg_t object);
virtual void hideCursor();
virtual void showCursor();