aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kgraphics.cpp13
-rw-r--r--engines/sci/gui/gui.cpp11
-rw-r--r--engines/sci/gui/gui.h1
3 files changed, 14 insertions, 11 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 0a6dc60881..684fc44858 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -371,22 +371,13 @@ reg_t kCantBeHere(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, !canBeHere);
}
-// TODO: This should go into SciGui
reg_t kIsItSkip(EngineState *s, int argc, reg_t *argv) {
GuiResourceId viewId = argv[0].toSint16();
int16 loopNo = argv[1].toSint16();
int16 celNo = argv[2].toSint16();
- int16 y = argv[3].toUint16();
- int16 x = argv[4].toUint16();
-
- SciGuiView *tmpView = new SciGuiView(s->resMan, NULL, NULL, viewId);
- sciViewCelInfo *celInfo = tmpView->getCelInfo(loopNo, celNo);
- x = CLIP<int>(x, 0, celInfo->width - 1);
- y = CLIP<int>(y, 0, celInfo->height - 1);
- byte *celData = tmpView->getBitmap(loopNo, celNo);
- int result = (celData[y * celInfo->width + x] == celInfo->clearKey);
- delete tmpView;
+ Common::Point position(argv[4].toUint16(), argv[3].toUint16());
+ bool result = s->_gui->isItSkip(viewId, loopNo, celNo, position);
return make_reg(0, result);
}
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index ecd593982d..321ff074c7 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -626,6 +626,17 @@ bool SciGui::canBeHere(reg_t curObject, reg_t listReference) {
return result;
}
+bool SciGui::isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position) {
+ SciGuiView *tmpView = new SciGuiView(_s->resMan, NULL, NULL, viewId);
+ sciViewCelInfo *celInfo = tmpView->getCelInfo(loopNo, celNo);
+ position.x = CLIP<int>(position.x, 0, celInfo->width - 1);
+ position.y = CLIP<int>(position.y, 0, celInfo->height - 1);
+ byte *celData = tmpView->getBitmap(loopNo, celNo);
+ bool result = (celData[position.y * celInfo->width + position.x] == celInfo->clearKey);
+ delete tmpView;
+ return result;
+}
+
void SciGui::hideCursor() {
_cursor->hide();
}
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index 2fc129dd97..b39cb59bf9 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -116,6 +116,7 @@ public:
virtual void addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
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 hideCursor();
virtual void showCursor();