aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2009-11-30 19:34:45 +0000
committerMartin Kiewitz2009-11-30 19:34:45 +0000
commitdf422c0894e7d7cfc0520ae91b1a1acfb582d3a1 (patch)
tree429a72981bb379a643781e7800940af8351cdc7c /engines
parente557075e9059278e7d7dc8354c2d32e12e333463 (diff)
downloadscummvm-rg350-df422c0894e7d7cfc0520ae91b1a1acfb582d3a1.tar.gz
scummvm-rg350-df422c0894e7d7cfc0520ae91b1a1acfb582d3a1.tar.bz2
scummvm-rg350-df422c0894e7d7cfc0520ae91b1a1acfb582d3a1.zip
SCI: Fix kSetCursor (Sci1.1) to behave like Sierra Sci (fixes cursor hiding/showing in kq6)
svn-id: r46224
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kgraphics.cpp19
-rw-r--r--engines/sci/gui/gui.cpp7
-rw-r--r--engines/sci/gui/gui_cursor.cpp8
-rw-r--r--engines/sci/gui/gui_cursor.h3
4 files changed, 28 insertions, 9 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 3f045bba4d..61b8d6b886 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -110,11 +110,20 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
switch (argc) {
case 1:
- if (argv[0].isNull())
+ switch (argv[0].toSint16()) {
+ case 0:
s->_gui->hideCursor();
- else
+ break;
+ case -1:
+ // TODO: Special case at least in kq6, check disassembly
+ break;
+ case -2:
+ // TODO: Special case at least in kq6, check disassembly
+ break;
+ default:
s->_gui->showCursor();
- break;
+ break;
+ }
case 2:
pos.y = argv[1].toSint16();
pos.x = argv[0].toSint16();
@@ -986,8 +995,6 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
if (argc == 1)
return NULL_REG;
- s->_gui->hideCursor();
-
// The Windows and DOS versions use different video format as well
// as a different argument set.
if (argv[0].toUint16() == 0) {
@@ -1021,8 +1028,6 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
delete seqDecoder;
}
- s->_gui->showCursor();
-
return s->r_acc;
}
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index aa621496e9..2cc361f348 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -583,12 +583,15 @@ uint16 SciGui::onControl(byte screenMask, Common::Rect rect) {
void SciGui::animateShowPic() {
GuiPort *picPort = _windowMgr->_picWind;
Common::Rect picRect = picPort->rect;
+ bool previousCursorState = _cursor->isVisible();
- _cursor->hide();
+ if (previousCursorState)
+ _cursor->hide();
// Adjust picRect to become relative to screen
picRect.translate(picPort->left, picPort->top);
_transitions->doit(picRect);
- _cursor->show();
+ if (previousCursorState)
+ _cursor->show();
}
void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
diff --git a/engines/sci/gui/gui_cursor.cpp b/engines/sci/gui/gui_cursor.cpp
index b6b25628b6..cf6256640f 100644
--- a/engines/sci/gui/gui_cursor.cpp
+++ b/engines/sci/gui/gui_cursor.cpp
@@ -43,6 +43,8 @@ SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciG
// center mouse cursor
setPosition(Common::Point(_screen->_displayWidth / 2, _screen->_displayHeight / 2));
setMoveZone(Common::Rect(0, 0, _screen->_displayWidth, _screen->_displayHeight));
+
+ _isVisible = true;
}
SciGuiCursor::~SciGuiCursor() {
@@ -51,10 +53,16 @@ SciGuiCursor::~SciGuiCursor() {
void SciGuiCursor::show() {
CursorMan.showMouse(true);
+ _isVisible = true;
}
void SciGuiCursor::hide() {
CursorMan.showMouse(false);
+ _isVisible = false;
+}
+
+bool SciGuiCursor::isVisible() {
+ return _isVisible;
}
void SciGuiCursor::purgeCache() {
diff --git a/engines/sci/gui/gui_cursor.h b/engines/sci/gui/gui_cursor.h
index 3cb9a3e537..293c508bdb 100644
--- a/engines/sci/gui/gui_cursor.h
+++ b/engines/sci/gui/gui_cursor.h
@@ -49,6 +49,7 @@ public:
void show();
void hide();
+ bool isVisible();
void setShape(GuiResourceId resourceId);
void setView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot);
void setPosition(Common::Point pos);
@@ -74,6 +75,8 @@ private:
Common::Rect _moveZone; // Rectangle in which the pointer can move
CursorCache _cachedCursors;
+
+ bool _isVisible;
};
} // End of namespace Sci