aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-07 12:47:53 +0000
committerMartin Kiewitz2009-10-07 12:47:53 +0000
commit77b549a0ad9e3a66f9a571e049c26a74231c2ce4 (patch)
treef9be159bc9aac4a8ffc8fdbbf5d630ac6f63ff61 /engines
parent23b39f5c459c9387012e63cde931c9b929b387cb (diff)
downloadscummvm-rg350-77b549a0ad9e3a66f9a571e049c26a74231c2ce4.tar.gz
scummvm-rg350-77b549a0ad9e3a66f9a571e049c26a74231c2ce4.tar.bz2
scummvm-rg350-77b549a0ad9e3a66f9a571e049c26a74231c2ce4.zip
SCI: SciGuiCursor class added, cleanup, OSystem removed from SciGui constructor
svn-id: r44730
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/game.cpp3
-rw-r--r--engines/sci/engine/kgraphics.cpp23
-rw-r--r--engines/sci/engine/savegame.cpp1
-rw-r--r--engines/sci/gui/gui.cpp31
-rw-r--r--engines/sci/gui/gui.h14
-rw-r--r--engines/sci/gui/gui_cursor.cpp53
-rw-r--r--engines/sci/gui/gui_cursor.h52
-rw-r--r--engines/sci/gui/gui_picture.cpp188
-rw-r--r--engines/sci/gui32/gui32.cpp39
-rw-r--r--engines/sci/gui32/gui32.h9
-rw-r--r--engines/sci/sci.cpp6
11 files changed, 360 insertions, 59 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index d87135503b..43fe120db5 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -279,7 +279,8 @@ int _reset_graphics_input(EngineState *s) {
s->titlebar_port->_bgcolor.priority = 11; // Standard priority for the titlebar port
#endif
- s->gui->moveCursor(160, 150);
+ Common::Point mousePos(160, 150);
+ s->gui->moveCursor(mousePos);
return 0;
}
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index dde4cfe536..57b884ee09 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -268,7 +268,7 @@ PaletteEntry get_pic_color(EngineState *s, int color) {
}
static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) {
-
+ Common::Point pos;
int16 cursor = argv[0].toSint16();
@@ -278,13 +278,16 @@ static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) {
gfxop_set_pointer_cursor(s->gfx_state, cursor);
// Set pointer position, if requested
- if (argc >= 4)
- s->gui->moveCursor(argv[2].toSint16() + s->port->_bounds.x, argv[3].toSint16() + s->port->_bounds.y);
-
+ if (argc >= 4) {
+ pos.y = argv[3].toSint16();
+ pos.x = argv[2].toSint16();
+ s->gui->setCursorPos(pos);
+ }
return s->r_acc;
}
static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
+ Common::Point pos;
Common::Point *hotspot = NULL;
switch (argc) {
@@ -292,7 +295,9 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
CursorMan.showMouse(argv[0].toSint16() != 0);
break;
case 2:
- s->gui->moveCursor(argv[0].toUint16() + s->port->_bounds.x, argv[1].toUint16() + s->port->_bounds.y);
+ pos.y = argv[1].toSint16();
+ pos.x = argv[0].toSint16();
+ s->gui->setCursorPos(pos);
break;
case 4: {
int16 top = argv[0].toSint16();
@@ -337,8 +342,12 @@ reg_t kSetCursor(EngineState *s, int argc, reg_t *argv) {
}
reg_t kMoveCursor(EngineState *s, int argc, reg_t *argv) {
- if (argc == 2)
- s->gui->moveCursor(argv[0].toSint16(), argv[1].toSint16());
+ Common::Point pos;
+ if (argc == 2) {
+ pos.y = argv[1].toSint16();
+ pos.x = argv[0].toSint16();
+ s->gui->moveCursor(pos);
+ }
return s->r_acc;
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 89809408c7..2e54b00d77 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -798,7 +798,6 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
retval->_msgState = s->_msgState;
retval->gui = s->gui;
- retval->gui->resetEngineState(retval);
return retval;
}
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 3ca7794b0c..36e24a10fc 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -33,6 +33,7 @@
#include "sci/gui/gui.h"
#include "sci/gui/gui_screen.h"
#include "sci/gui/gui_palette.h"
+#include "sci/gui/gui_cursor.h"
#include "sci/gui/gui_gfx.h"
#include "sci/gui/gui_windowmgr.h"
#include "sci/gui/gui_view.h"
@@ -41,8 +42,8 @@
namespace Sci {
-SciGui::SciGui(OSystem *system, EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette)
- : _system(system), _s(state), _screen(screen), _palette(palette) {
+SciGui::SciGui(EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor)
+ : _s(state), _screen(screen), _palette(palette), _cursor(cursor) {
_gfx = new SciGuiGfx(_s, _screen, _palette);
_windowMgr = new SciGuiWindowMgr(_s, _gfx);
@@ -460,24 +461,28 @@ void SciGui::setNowSeen(reg_t objectReference) {
_gfx->SetNowSeen(objectReference);
}
-void SciGui::moveCursor(int16 x, int16 y, int16 scaleFactor) {
- Common::Point newPos;
+void SciGui::setCursorPos(Common::Point pos) {
+ // FIXME: try to find out if we need to adjust position somehow, currently just forwarding to moveCursor()
+ moveCursor(pos);
+}
+
+void SciGui::moveCursor(Common::Point pos) {
+ pos.y += _windowMgr->_picWind->rect.top;
+ pos.x += _windowMgr->_picWind->rect.left;
- x += _windowMgr->_picWind->rect.left;
- y += _windowMgr->_picWind->rect.top;
- newPos.x = CLIP<int16>(x, _windowMgr->_picWind->rect.left, _windowMgr->_picWind->rect.right - 1);
- newPos.y = CLIP<int16>(y, _windowMgr->_picWind->rect.top, _windowMgr->_picWind->rect.bottom - 1);
+ pos.y = CLIP<int16>(pos.y, _windowMgr->_picWind->rect.top, _windowMgr->_picWind->rect.bottom - 1);
+ pos.x = CLIP<int16>(pos.x, _windowMgr->_picWind->rect.left, _windowMgr->_picWind->rect.right - 1);
- if (x > _screen->_width || y > _screen->_height) {
- debug("[GFX] Attempt to place pointer at invalid coordinates (%d, %d)\n", x, y);
+ if (pos.x > _screen->_width || pos.y > _screen->_height) {
+ warning("attempt to place cursor at invalid coordinates (%d, %d)", pos.y, pos.x);
return; // Not fatal
}
- g_system->warpMouse(x * scaleFactor, y * scaleFactor);
-
+ _cursor->setPosition(pos);
// Trigger event reading to make sure the mouse coordinates will
// actually have changed the next time we read them.
- gfxop_get_event(_s->gfx_state, SCI_EVT_PEEK);
+ //gfxop_get_event(_s->gfx_state, SCI_EVT_PEEK);
+ // FIXME!
}
} // End of namespace Sci
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index e84b199d16..4997d0ff03 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -32,18 +32,16 @@ namespace Sci {
class SciGuiScreen;
class SciGuiPalette;
+class SciGuiCursor;
class SciGuiGfx;
class SciGuiresources;
class SciGuiWindowMgr;
class SciGui {
public:
- SciGui(OSystem *system, EngineState *s, SciGuiScreen *screen, SciGuiPalette *palette);
+ SciGui(EngineState *s, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor);
SciGui();
virtual ~SciGui();
- // FIXME: Don't store EngineState
- virtual void resetEngineState(EngineState *s) { _s = s; }
-
virtual void init(bool usesOldGfxFunctions);
virtual void wait(int16 ticks);
@@ -86,16 +84,14 @@ 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 void moveCursor(int16 x, int16 y, int16 scaleFactor = 1);
- void moveCursor(Common::Point p, int16 scaleFactor = 1) { moveCursor(p.x, p.y, scaleFactor); }
-
- SciGuiPalette *getPalette() { return _palette; }
+ virtual void setCursorPos(Common::Point pos);
+ virtual void moveCursor(Common::Point pos);
private:
- OSystem *_system;
EngineState *_s;
SciGuiScreen *_screen;
SciGuiPalette *_palette;
+ SciGuiCursor *_cursor;
SciGuiGfx *_gfx;
SciGuiresources *_resources;
SciGuiWindowMgr *_windowMgr;
diff --git a/engines/sci/gui/gui_cursor.cpp b/engines/sci/gui/gui_cursor.cpp
new file mode 100644
index 0000000000..c77c85968a
--- /dev/null
+++ b/engines/sci/gui/gui_cursor.cpp
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/timer.h"
+#include "common/util.h"
+
+#include "sci/sci.h"
+#include "sci/engine/state.h"
+#include "sci/tools.h"
+#include "sci/gui/gui_palette.h"
+#include "sci/gui/gui_view.h"
+#include "sci/gui/gui_cursor.h"
+
+namespace Sci {
+
+SciGuiCursor::SciGuiCursor(EngineState *state, SciGuiPalette *palette)
+ : _s(state), _palette(palette) {
+ init();
+}
+
+SciGuiCursor::~SciGuiCursor() {
+}
+
+void SciGuiCursor::init() {
+}
+
+void SciGuiCursor::setPosition(Common::Point pos) {
+ g_system->warpMouse(pos.x, pos.y);
+}
+
+} // End of namespace Sci
diff --git a/engines/sci/gui/gui_cursor.h b/engines/sci/gui/gui_cursor.h
new file mode 100644
index 0000000000..bf2dad04e8
--- /dev/null
+++ b/engines/sci/gui/gui_cursor.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SCI_GUI_CURSOR_H
+#define SCI_GUI_CURSOR_H
+
+#include "sci/gui/gui.h"
+
+namespace Sci {
+
+class SciGuiView;
+class SciGuiPalette;
+class SciGuiCursor {
+public:
+ SciGuiCursor(EngineState *state, SciGuiPalette *palette);
+ ~SciGuiCursor();
+
+ void setPosition(Common::Point pos);
+
+private:
+ void init();
+
+ EngineState *_s;
+ SciGuiScreen *_screen;
+ SciGuiPalette *_palette;
+};
+
+} // End of namespace Sci
+
+#endif
diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp
index 0678fdfb83..7fd46a20c9 100644
--- a/engines/sci/gui/gui_picture.cpp
+++ b/engines/sci/gui/gui_picture.cpp
@@ -556,4 +556,192 @@ void SciGuiPicture::vectorGetPatternTexture(byte *data, int &curPos, int16 patte
}
}
+#if 0
+void SciGuiGfx::Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control) {
+
+void SciGuiPicture::vectorFloodFillRecursive(byte *data, int &curPos, int16 &x, int16 &y) {
+
+void FILL_FUNCTION_RECURSIVE(gfxr_pic_t *pic, int old_xl, int old_xr, int y, int dy, byte *bounds,
+ int legalcolor, int legalmask, int color, int priority, int drawenable, int sci_titlebar_size) {
+ int linewidth = pic->mode->scaleFactor * 320;
+ int miny = pic->mode->scaleFactor * sci_titlebar_size;
+ int maxy = pic->mode->scaleFactor * 200;
+ int xl, xr;
+ int oldytotal = y * linewidth;
+
+ do {
+ int ytotal = oldytotal + (linewidth * dy);
+ int xcont;
+ int state;
+
+ y += dy;
+
+ if (y < miny || y >= maxy) {
+ error("ABRT on failed initial assertion!");
+ return;
+ }
+# define proj_xl_bound 0
+# define proj_xr_bound 319
+
+ // Now we have the projected limits, get the real ones:
+
+ xl = (old_xl > proj_xl_bound) ? old_xl : proj_xl_bound;
+ if (!IS_BOUNDARY(xl, y + 1, bounds[ytotal + xl])) { // go left as far as possible
+ while (xl > proj_xl_bound && (!IS_BOUNDARY(xl - 1, y + 1, bounds[ytotal + xl - 1])))
+ --xl;
+ } else // go right until the fillable area starts
+ while (xl < proj_xr_bound && (IS_BOUNDARY(xl, y + 1, bounds[ytotal + xl])))
+ ++xl;
+
+
+ if ((xl > proj_xr_bound)
+ || (xl > old_xr)) {
+ error("ABRT because xl > xr_bound");
+ return;
+ }
+
+ xr = (xl > old_xl) ? xl : old_xl;
+ while (xr < proj_xr_bound && (!IS_BOUNDARY(xr + 1, y + 1, bounds[ytotal + xr + 1])))
+ ++xr;
+
+ PRINT_DEBUG1("%d> -> ", xr);
+
+ if (IS_BOUNDARY(xl, y + 1, bounds[ytotal + xl])) {
+ error("ABRT because xl illegal");
+ return;
+ }
+
+ if (drawenable & GFX_MASK_VISUAL)
+ memset(pic->visual_map->index_data + ytotal + xl, color, xr - xl + 1);
+
+ if (drawenable & GFX_MASK_PRIORITY)
+ memset(pic->priority_map->index_data + ytotal + xl, priority, xr - xl + 1);
+
+
+ // Check whether we need to recurse on branches in the same direction
+ state = 0;
+ xcont = xr + 1;
+ while (xcont <= old_xr) {
+ if (IS_BOUNDARY(xcont, y + 1, bounds[ytotal + xcont]))
+ state = xcont;
+ else if (state) { // recurse
+ vectorFloodFillRecursive(pic, state, xcont, y - dy, dy, bounds, legalcolor,
+ legalmask, color, priority, drawenable, sci_titlebar_size);
+ state = 0;
+ }
+ ++xcont;
+ }
+
+ // Check whether we need to recurse on backward branches:
+ // left
+ if (xl < old_xl - 1) {
+ state = 0;
+ for (xcont = old_xl - 1; xcont >= xl; xcont--) {
+ if (IS_BOUNDARY(xcont, y, bounds[oldytotal + xcont]))
+ state = xcont;
+ else if (state) { // recurse
+ vectorFloodFillRecursive(pic, xcont, state, y, -dy, bounds,
+ legalcolor, legalmask, color, priority, drawenable,
+ sci_titlebar_size);
+ state = 0;
+ }
+ }
+ }
+
+ // right
+ if (xr > old_xr + 1) {
+ state = 0;
+ for (xcont = old_xr + 1; xcont <= xr; xcont++) {
+ if (IS_BOUNDARY(xcont, y, bounds[oldytotal + xcont]))
+ state = xcont;
+ else if (state) { // recurse
+ vectorFloodFillRecursive(pic, state, xcont, y, -dy, bounds,
+ legalcolor, legalmask, color, priority, drawenable,
+ sci_titlebar_size);
+ state = 0;
+ }
+ }
+ }
+
+ oldytotal = ytotal;
+ old_xl = xl;
+ old_xr = xr;
+
+ } while (1);
+}
+
+void SciGuiPicture::vectorFloodFillRecursive(gfxr_pic_t *pic, int x_320, int y_200, int color, int priority, int control, int drawenable,
+ int sci_titlebar_size) {
+ int linewidth = pic->mode->scaleFactor * 320;
+ int x, y;
+ int xl, xr;
+ int ytotal;
+ int bitmask;
+ byte *bounds = NULL;
+ int legalcolor, legalmask;
+ int original_drawenable = drawenable; // Backup, since we need the unmodified value
+ // for filling the aux and control map
+
+ // Restrict drawenable not to restrict itself to zero
+ if (pic->control_map->index_data[y_200 * 320 + x_320] != 0)
+ drawenable &= ~GFX_MASK_CONTROL;
+
+ if (color == 0xff)
+ drawenable &= ~GFX_MASK_VISUAL;
+
+ if (priority == 0) {
+ drawenable &= ~GFX_MASK_PRIORITY;
+ original_drawenable &= ~GFX_MASK_PRIORITY;
+ }
+
+ AUXBUF_FILL(pic, x_320, y_200, original_drawenable, (drawenable & GFX_MASK_CONTROL) ? control : 0,
+ sci_titlebar_size);
+
+ x = x_320;
+ y = y_200;
+
+ ytotal = y * linewidth;
+
+ if (!drawenable)
+ return;
+
+ if (drawenable & GFX_MASK_VISUAL) {
+ bounds = pic->visual_map->index_data;
+ legalmask = 0x0ff0;
+ legalcolor = 0xff;
+ } else if (drawenable & GFX_MASK_PRIORITY) {
+ bounds = pic->priority_map->index_data;
+ legalcolor = 0;
+ legalmask = 0x0f0f;
+ } else {
+ legalcolor = 0;
+ legalmask = 0x0f0f;
+ }
+
+ if (!bounds || IS_BOUNDARY(x, y, bounds[ytotal + x]))
+ return;
+
+ if (bounds) {
+ xl = x;
+ while (xl > proj_xl_bound && (!IS_BOUNDARY(xl - 1, y, bounds[ytotal + xl -1])))
+ --xl;
+
+ while (x < proj_xr_bound && (!IS_BOUNDARY(x + 1, y, bounds[ytotal + x + 1])))
+ ++x;
+ xr = x;
+
+ if (drawenable & GFX_MASK_VISUAL)
+ memset(pic->visual_map->index_data + ytotal + xl, color, xr - xl + 1);
+
+ if (drawenable & GFX_MASK_PRIORITY)
+ memset(pic->priority_map->index_data + ytotal + xl, priority, xr - xl + 1);
+
+ vectorFloodFillRecursive(pic, xl, xr, y, -1, bounds, legalcolor, legalmask, color, priority, drawenable,
+ sci_titlebar_size);
+ vectorFloodFillRecursive(pic, xl, xr, y, + 1, bounds, legalcolor, legalmask, color, priority, drawenable,
+ sci_titlebar_size);
+ }
+}
+#endif
+
} // End of namespace Sci
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp
index 9463d19c9a..2248a58455 100644
--- a/engines/sci/gui32/gui32.cpp
+++ b/engines/sci/gui32/gui32.cpp
@@ -64,8 +64,8 @@
namespace Sci {
-SciGui32::SciGui32(OSystem *system, EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette)
- : _system(system), s(state) {
+SciGui32::SciGui32( EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor)
+ : s(state) {
}
SciGui32::~SciGui32() {
@@ -2002,31 +2002,30 @@ void SciGui32::setNowSeen(reg_t objectReference) {
_k_set_now_seen(objectReference);
}
+void SciGui32::setCursorPos(Common::Point pos) {
+ pos.y += s->port->_bounds.y;
+ pos.x += s->port->_bounds.x;
+ moveCursor(pos);
+}
-void SciGui32::moveCursor(int16 x, int16 y, int16 scaleFactor) {
- Common::Point newPos;
-
- // newPos = s->gfx_state->pointer_pos;
-
- newPos.x = x + s->port->zone.x;
- newPos.y = y + s->port->zone.y;
+void SciGui32::moveCursor(Common::Point pos) {
+ pos.y += s->port->zone.y;
+ pos.x += s->port->zone.x;
- if (newPos.x > s->port->zone.x + s->port->zone.width)
- newPos.x = s->port->zone.x + s->port->zone.width;
- if (newPos.y > s->port->zone.y + s->port->zone.height)
- newPos.y = s->port->zone.y + s->port->zone.height;
+ if (pos.x > s->port->zone.x + s->port->zone.width)
+ pos.x = s->port->zone.x + s->port->zone.width;
+ if (pos.y > s->port->zone.y + s->port->zone.height)
+ pos.y = s->port->zone.y + s->port->zone.height;
- if (newPos.x < 0)
- newPos.x = 0;
- if (newPos.y < 0)
- newPos.y = 0;
+ if (pos.x < 0) pos.x = 0;
+ if (pos.y < 0) pos.y = 0;
- if (x > 320 || y > 200) {
- debug("[GFX] Attempt to place pointer at invalid coordinates (%d, %d)\n", x, y);
+ if (pos.x > 320 || pos.y > 200) {
+ debug("[GFX] Attempt to place pointer at invalid coordinates (%d, %d)\n", pos.x, pos.y);
return; // Not fatal
}
- g_system->warpMouse(x * scaleFactor, y * scaleFactor);
+ g_system->warpMouse(pos.x, pos.y);
// Trigger event reading to make sure the mouse coordinates will
// actually have changed the next time we read them.
diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h
index 16f48c7c54..5af02a26f7 100644
--- a/engines/sci/gui32/gui32.h
+++ b/engines/sci/gui32/gui32.h
@@ -32,12 +32,9 @@ namespace Sci {
class SciGui32 : public SciGui {
public:
- SciGui32(OSystem *system, EngineState *s, SciGuiScreen *screen, SciGuiPalette *palette);
+ SciGui32(EngineState *s, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor);
~SciGui32();
- // FIXME: Don't store EngineState
- virtual void resetEngineState(EngineState *newState) { s = newState; }
-
void init(bool oldGfxFunctions);
void wait(int16 ticks);
@@ -80,10 +77,10 @@ public:
void addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
void setNowSeen(reg_t objectReference);
- void moveCursor(int16 x, int16 y, int16 scaleFactor = 1);
+ void setCursorPos(Common::Point pos);
+ void moveCursor(Common::Point pos);
private:
- OSystem *_system;
EngineState *s;
bool _usesOldGfxFunctions;
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 800e72b051..e8d4d49a23 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -38,6 +38,7 @@
#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
#include "sci/gui32/gui32.h"
#include "sci/gui/gui_palette.h"
+#include "sci/gui/gui_cursor.h"
#include "sci/gfx/gfx_resource.h"
#include "sci/gfx/gfx_tools.h"
@@ -158,10 +159,11 @@ Common::Error SciEngine::run() {
SciGuiScreen *screen = new SciGuiScreen(_system);
SciGuiPalette *palette = new SciGuiPalette(_gamestate, screen);
+ SciGuiCursor *cursor = new SciGuiCursor(_gamestate, palette);
// Gui change
- //_gamestate->gui = new SciGui(_system, _gamestate, screen, palette); // new
- _gamestate->gui = new SciGui32(_system, _gamestate, screen, palette); // old
+ //_gamestate->gui = new SciGui(_gamestate, screen, palette, cursor); // new
+ _gamestate->gui = new SciGui32(_gamestate, screen, palette, cursor); // old
// Assign default values to the config manager, in case settings are missing
ConfMan.registerDefault("dither_mode", "0");