aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-13 16:22:07 +0000
committerFilippos Karapetis2009-10-13 16:22:07 +0000
commit5aa141539786c4f905addfd0c05f6e00dfd3afd7 (patch)
treeee34240f79b851cf67ece18fab3efd69c383c0a8 /engines
parent7cefc4cc989ba7606e6473db9a56c14e30326c24 (diff)
downloadscummvm-rg350-5aa141539786c4f905addfd0c05f6e00dfd3afd7.tar.gz
scummvm-rg350-5aa141539786c4f905addfd0c05f6e00dfd3afd7.tar.bz2
scummvm-rg350-5aa141539786c4f905addfd0c05f6e00dfd3afd7.zip
Merged the cursor manipulation code - cursor views are still not done
svn-id: r45028
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/console.cpp3
-rw-r--r--engines/sci/gfx/operations.cpp17
-rw-r--r--engines/sci/gfx/operations.h8
-rw-r--r--engines/sci/gui/gui.h4
-rw-r--r--engines/sci/gui32/gui32.cpp11
-rw-r--r--engines/sci/sci.cpp1
6 files changed, 11 insertions, 33 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index eceac555de..1dfd70b403 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -42,6 +42,7 @@
#include "sci/sfx/sci_midi.h"
#include "sci/vocabulary.h"
#include "sci/gui/gui.h"
+#include "sci/gui/gui_cursor.h"
#include "common/savefile.h"
@@ -1196,7 +1197,7 @@ bool Console::cmdVisualState(int argc, const char **argv) {
}
bool Console::cmdFlushPorts(int argc, const char **argv) {
- gfxop_set_pointer_cursor(_vm->_gamestate->gfx_state, GFXOP_NO_POINTER);
+ _vm->_gamestate->_cursor->setShape(GFXOP_NO_POINTER);
DebugPrintf("Flushing dynamically allocated ports (for memory profiling)...\n");
delete _vm->_gamestate->visual;
_vm->_gamestate->gfx_state->gfxResMan->freeAllResources();
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 8401b6e2b2..a07188bca6 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -967,23 +967,6 @@ void gfxop_sleep(GfxState *state, uint32 msecs) {
}
}
-void gfxop_set_pointer_cursor(GfxState *state, int nr) {
- if (nr == GFXOP_NO_POINTER) {
- state->driver->setPointer(NULL, NULL);
- return;
- }
-
- gfx_pixmap_t *new_pointer = state->gfxResMan->getCursor(nr);
-
- if (!new_pointer) {
- warning("[GFX] Attempt to set invalid pointer #%d\n", nr);
- return;
- }
-
- Common::Point p = Common::Point(new_pointer->xoffset, new_pointer->yoffset);
- state->driver->setPointer(new_pointer, &p);
-}
-
void gfxop_set_pointer_view(GfxState *state, int nr, int loop, int cel, Common::Point *hotspot) {
// FIXME: For now, don't palettize pointers
gfx_pixmap_t *new_pointer = state->gfxResMan->getView(nr, &loop, &cel, 0)->loops[loop].cels[cel];
diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h
index d079174672..ea2078f49a 100644
--- a/engines/sci/gfx/operations.h
+++ b/engines/sci/gfx/operations.h
@@ -364,14 +364,6 @@ void gfxop_free_color(GfxState *state, gfx_color_t *color);
void gfxop_sleep(GfxState *state, uint32 msecs);
/**
- * Sets the mouse pointer to a cursor resource.
- *
- * @param[in] state The affected state
- * @param[in] nr Number of the cursor resource to use
- */
-void gfxop_set_pointer_cursor(GfxState *state, int nr);
-
-/**
* Sets the mouse pointer to a view resource.
*
* Use gfxop_set_pointer_cursor(state, GFXOP_NO_POINTER) to disable the pointer.
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index d045450316..f81bd00675 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -114,13 +114,15 @@ public:
// FIXME: Don't store EngineState
virtual void resetEngineState(EngineState *s);
+protected:
+ SciGuiCursor *_cursor;
+
private:
virtual void initPriorityBands();
EngineState *_s;
SciGuiScreen *_screen;
SciGuiPalette *_palette;
- SciGuiCursor *_cursor;
SciGuiGfx *_gfx;
SciGuiresources *_resources;
SciGuiWindowMgr *_windowMgr;
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp
index 84a67365bb..f147c89dff 100644
--- a/engines/sci/gui32/gui32.cpp
+++ b/engines/sci/gui32/gui32.cpp
@@ -37,6 +37,7 @@
#include "sci/gfx/gfx_widgets.h"
#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
#include "sci/gui32/gui32.h"
+#include "sci/gui/gui_cursor.h"
// This is the real width of a text with a specified width of 0
#define MAX_TEXT_WIDTH_MAGIC_VALUE 192
@@ -67,6 +68,7 @@ namespace Sci {
SciGui32::SciGui32( EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor)
: s(state) {
+ _cursor = cursor;
}
SciGui32::~SciGui32() {
@@ -2444,18 +2446,15 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
}
void SciGui32::hideCursor() {
- CursorMan.showMouse(false);
+ _cursor->hide();
}
void SciGui32::showCursor() {
- CursorMan.showMouse(true);
+ _cursor->show();
}
void SciGui32::setCursorShape(GuiResourceId cursorId) {
- if (cursorId == -1)
- gfxop_set_pointer_cursor(s->gfx_state, GFXOP_NO_POINTER);
- else
- gfxop_set_pointer_cursor(s->gfx_state, cursorId);
+ _cursor->setShape(cursorId);
}
void SciGui32::setCursorPos(Common::Point pos) {
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 55823fa9b4..a9f56f692e 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -197,6 +197,7 @@ Common::Error SciEngine::run() {
script_free_engine(_gamestate); // Uninitialize game state
script_free_breakpoints(_gamestate);
+ delete cursor;
delete palette;
delete screen;
delete _gamestate;