aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-11-04 12:19:05 +0000
committerFilippos Karapetis2009-11-04 12:19:05 +0000
commit12e3375f3b47e6e626d8457257fd2036ed835ab1 (patch)
treed750bc29a6db7bc4443e7d60e2c23509bf95119f
parenteffdfcd4b8c92475d41a15cefbfd711724280924 (diff)
downloadscummvm-rg350-12e3375f3b47e6e626d8457257fd2036ed835ab1.tar.gz
scummvm-rg350-12e3375f3b47e6e626d8457257fd2036ed835ab1.tar.bz2
scummvm-rg350-12e3375f3b47e6e626d8457257fd2036ed835ab1.zip
Removed the reference to SciGuiCursor from EngineState
svn-id: r45660
-rw-r--r--engines/sci/engine/kevent.cpp2
-rw-r--r--engines/sci/engine/kgraphics.cpp2
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/engine/state.cpp4
-rw-r--r--engines/sci/engine/state.h3
-rw-r--r--engines/sci/gui/gui.cpp8
-rw-r--r--engines/sci/gui/gui.h10
-rw-r--r--engines/sci/gui32/gui32.cpp22
-rw-r--r--engines/sci/gui32/gui32.h4
-rw-r--r--engines/sci/sci.cpp2
10 files changed, 24 insertions, 35 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index f7f01d9a6e..34fba22de1 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -43,7 +43,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
int oldx, oldy;
int modifier_mask = getSciVersion() <= SCI_VERSION_01 ? SCI_EVM_ALL : SCI_EVM_NO_FOOLOCK;
SegManager *segMan = s->_segMan;
- const Common::Point mousePos = s->_cursor->getPosition();
+ const Common::Point mousePos = s->_gui->getCursorPos();
// If there's a simkey pending, and the game wants a keyboard event, use the
// simkey instead of a normal event
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 24a0737aa8..f26e014b2d 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -128,7 +128,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
if ((right >= left) && (bottom >= top)) {
Common::Rect rect = Common::Rect(left, top, right, bottom);
- s->_cursor->setMoveZone(rect);
+ s->_gui->setCursorZone(rect);
} else {
warning("kSetCursor: Ignoring invalid mouse zone (%i, %i)-(%i, %i)", left, top, right, bottom);
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index fd8cb6e142..406c450107 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -737,7 +737,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
}
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
- retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_gui, s->_cursor, s->_audio);
+ retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_gui, s->_audio);
// Copy some old data
retval->gfx_state = s->gfx_state;
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 5925698e49..06cace2b99 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -32,8 +32,8 @@
namespace Sci {
-EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SciGui *gui, SciGuiCursor *cursor, AudioPlayer *audio)
-: resMan(res), _kernel(kernel), _voc(voc), _gui(gui), _cursor(cursor), _audio(audio), _dirseeker(this) {
+EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SciGui *gui, AudioPlayer *audio)
+: resMan(res), _kernel(kernel), _voc(voc), _gui(gui), _audio(audio), _dirseeker(this) {
gfx_state = 0;
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 9e517adf4b..21ccb2a07a 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -116,7 +116,7 @@ public:
struct EngineState : public Common::Serializable {
public:
- EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SciGui *gui, SciGuiCursor *cursor, AudioPlayer *audio);
+ EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SciGui *gui, AudioPlayer *audio);
virtual ~EngineState();
virtual void saveLoadWithSerializer(Common::Serializer &ser);
@@ -132,7 +132,6 @@ public:
/* Non-VM information */
SciGui *_gui; /* Currently active Gui */
- SciGuiCursor *_cursor; /* Cursor functions */
GfxState *gfx_state; /**< Graphics state and driver */
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index d565d20c49..baca9e5005 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -737,6 +737,10 @@ void SciGui::setCursorPos(Common::Point pos) {
moveCursor(pos);
}
+Common::Point SciGui::getCursorPos() {
+ return _cursor->getPosition();
+}
+
void SciGui::moveCursor(Common::Point pos) {
pos.y += _windowMgr->_picWind->rect.top;
pos.x += _windowMgr->_picWind->rect.left;
@@ -756,6 +760,10 @@ void SciGui::moveCursor(Common::Point pos) {
// FIXME!
}
+void SciGui::setCursorZone(Common::Rect zone) {
+ _cursor->setMoveZone(zone);
+}
+
int16 SciGui::getCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo) {
return _gfx->getView(viewId)->getCelInfo(loopNo, celNo)->width;
}
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index 878f676553..f1cef36a6f 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -126,12 +126,14 @@ public:
virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
virtual void baseSetter(reg_t object);
- virtual void hideCursor();
- virtual void showCursor();
- virtual void setCursorShape(GuiResourceId cursorId);
- virtual void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
+ void hideCursor();
+ void showCursor();
+ void setCursorShape(GuiResourceId cursorId);
+ void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
virtual void setCursorPos(Common::Point pos);
+ Common::Point getCursorPos();
virtual void moveCursor(Common::Point pos);
+ void setCursorZone(Common::Rect zone);
virtual int16 getCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo);
virtual int16 getCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo);
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp
index edb901054c..5692c9b119 100644
--- a/engines/sci/gui32/gui32.cpp
+++ b/engines/sci/gui32/gui32.cpp
@@ -934,7 +934,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
}
}
- Common::Point cursorPos = _s->_cursor->getPosition();
+ Common::Point cursorPos = _cursor->getPosition();
if ((type == SCI_EVT_MOUSE_PRESS) && (cursorPos.y < 10)) {
menu_mode = 1;
@@ -1027,7 +1027,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
case SCI_EVT_MOUSE_RELEASE:
{
- Common::Point curMousePos = _s->_cursor->getPosition();
+ Common::Point curMousePos = _cursor->getPosition();
menu_mode = (curMousePos.y < 10);
claimed = !menu_mode && !_s->_menubar->mapPointer(curMousePos, menu_nr, item_nr, portBounds);
mouse_down = 0;
@@ -1044,7 +1044,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
}
if (mouse_down)
- _s->_menubar->mapPointer(_s->_cursor->getPosition(), menu_nr, item_nr, portBounds);
+ _s->_menubar->mapPointer(_cursor->getPosition(), menu_nr, item_nr, portBounds);
if ((item_nr > -1 && old_item == -1) || (menu_nr != old_menu)) { /* Update menu */
@@ -2962,22 +2962,6 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
return retval;
}
-void SciGui32::hideCursor() {
- _cursor->hide();
-}
-
-void SciGui32::showCursor() {
- _cursor->show();
-}
-
-void SciGui32::setCursorShape(GuiResourceId cursorId) {
- _cursor->setShape(cursorId);
-}
-
-void SciGui32::setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot) {
- _cursor->setView(viewNum, loopNum, cellNum, hotspot);
-}
-
void SciGui32::setCursorPos(Common::Point pos) {
pos.y += _s->port->_bounds.y;
pos.x += _s->port->_bounds.x;
diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h
index d8a49542bb..dcdcf717af 100644
--- a/engines/sci/gui32/gui32.h
+++ b/engines/sci/gui32/gui32.h
@@ -102,10 +102,6 @@ public:
void setNowSeen(reg_t objectReference);
bool canBeHere(reg_t curObject, reg_t listReference);
- void hideCursor();
- void showCursor();
- void setCursorShape(GuiResourceId cursorId);
- void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
void setCursorPos(Common::Point pos);
void moveCursor(Common::Point pos);
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 9c6a67eaa0..cd611ed600 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -134,7 +134,7 @@ Common::Error SciEngine::run() {
_audio = new AudioPlayer(_resMan);
// We'll set the GUI below
- _gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, cursor, _audio);
+ _gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, _audio);
if (script_init_engine(_gamestate))
return Common::kUnknownError;