From 5f71650520b81ec5f83191a8726ddfe577e72184 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Wed, 28 Oct 2009 19:19:35 +0000 Subject: SCI/newgui: BaseSetter moved to SciGui svn-id: r45480 --- engines/sci/engine/kgraphics.cpp | 29 ++--------------------------- engines/sci/gui/gui.cpp | 29 +++++++++++++++++++++++++++++ engines/sci/gui/gui.h | 1 + 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(); -- cgit v1.2.3