aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2012-06-28 17:45:02 +0200
committerSven Hesse2012-07-30 01:44:42 +0200
commit27782700a5631a25129b12779abb540a906f6a96 (patch)
tree9c3fc6374dcc626a8696d29cde3973489b973d61 /engines
parent38fe3c3cd9e656b3e3f2b35011895d6703a1a896 (diff)
downloadscummvm-rg350-27782700a5631a25129b12779abb540a906f6a96.tar.gz
scummvm-rg350-27782700a5631a25129b12779abb540a906f6a96.tar.bz2
scummvm-rg350-27782700a5631a25129b12779abb540a906f6a96.zip
GOB: Add some PreGob and Once Upon A Time cursor functions
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/draw.cpp4
-rw-r--r--engines/gob/draw_v2.cpp5
-rw-r--r--engines/gob/pregob/onceupon/onceupon.cpp1
-rw-r--r--engines/gob/pregob/onceupon/onceupon.h2
-rw-r--r--engines/gob/pregob/pregob.cpp47
-rw-r--r--engines/gob/pregob/pregob.h14
-rw-r--r--engines/gob/video.cpp2
7 files changed, 72 insertions, 3 deletions
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 3932987e0a..8c6919416d 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -271,7 +271,9 @@ void Draw::blitInvalidated() {
return;
}
- _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1);
+ if (_cursorSprites)
+ _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1);
+
if (_applyPal) {
clearPalette();
forceBlit();
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index ac43c7b86a..f5475278c4 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -74,13 +74,16 @@ void Draw_v2::closeScreen() {
}
void Draw_v2::blitCursor() {
- if (_cursorIndex == -1)
+ if (!_cursorSprites || (_cursorIndex == -1))
return;
_showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1);
}
void Draw_v2::animateCursor(int16 cursor) {
+ if (!_cursorSprites)
+ return;
+
int16 cursorIndex = cursor;
int16 newX = 0, newY = 0;
uint16 hotspotX, hotspotY;
diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp
index 35127cbfb3..7f7dffa7ec 100644
--- a/engines/gob/pregob/onceupon/onceupon.cpp
+++ b/engines/gob/pregob/onceupon/onceupon.cpp
@@ -23,6 +23,7 @@
#include "gob/gob.h"
#include "gob/util.h"
#include "gob/dataio.h"
+#include "gob/surface.h"
#include "gob/draw.h"
#include "gob/video.h"
diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h
index 816d4dc051..c1c4d6fa0d 100644
--- a/engines/gob/pregob/onceupon/onceupon.h
+++ b/engines/gob/pregob/onceupon/onceupon.h
@@ -29,6 +29,8 @@
namespace Gob {
+class Surface;
+
namespace OnceUpon {
class OnceUpon : public PreGob {
diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp
index aea290214c..18aac50352 100644
--- a/engines/gob/pregob/pregob.cpp
+++ b/engines/gob/pregob/pregob.cpp
@@ -20,9 +20,12 @@
*
*/
+#include "graphics/cursorman.h"
+
#include "gob/gob.h"
#include "gob/global.h"
#include "gob/util.h"
+#include "gob/surface.h"
#include "gob/palanim.h"
#include "gob/draw.h"
#include "gob/video.h"
@@ -90,4 +93,48 @@ void PreGob::setPalette(const byte *palette, uint16 size) {
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
}
+void PreGob::addCursor() {
+ CursorMan.pushCursor(0, 0, 0, 0, 0, 0);
+}
+
+void PreGob::removeCursor() {
+ CursorMan.popCursor();
+}
+
+void PreGob::setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY) {
+ CursorMan.replaceCursor(sprite.getData(), sprite.getWidth(), sprite.getHeight(), hotspotX, hotspotY, 0);
+}
+
+void PreGob::setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom,
+ int16 hotspotX, int16 hotspotY) {
+
+ const int width = right - left + 1;
+ const int height = bottom - top + 1;
+
+ if ((width <= 0) || (height <= 0))
+ return;
+
+ Surface cursor(width, height, 1);
+
+ cursor.blit(sprite, left, top, right, bottom, 0, 0);
+
+ setCursor(cursor, hotspotX, hotspotX);
+}
+
+void PreGob::showCursor() {
+ CursorMan.showMouse(true);
+
+ _vm->_draw->_showCursor = 4;
+}
+
+void PreGob::hideCursor() {
+ CursorMan.showMouse(false);
+
+ _vm->_draw->_showCursor = 0;
+}
+
+bool PreGob::isCursorVisible() const {
+ return CursorMan.isVisible();
+}
+
} // End of namespace Gob
diff --git a/engines/gob/pregob/pregob.h b/engines/gob/pregob/pregob.h
index 6418d6fd8a..e0f7ca907d 100644
--- a/engines/gob/pregob/pregob.h
+++ b/engines/gob/pregob/pregob.h
@@ -26,6 +26,7 @@
namespace Gob {
class GobEngine;
+class Surface;
class PreGob {
public:
@@ -49,6 +50,19 @@ protected:
*/
void setPalette(const byte *palette, uint16 size); ///< Change the palette
+ void addCursor();
+ void removeCursor();
+
+ void setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY);
+ void setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom,
+ int16 hotspotX, int16 hotspotY);
+
+ void showCursor();
+ void hideCursor();
+
+ bool isCursorVisible() const;
+
+
GobEngine *_vm;
private:
diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp
index 8bcf14e040..62bb210a8e 100644
--- a/engines/gob/video.cpp
+++ b/engines/gob/video.cpp
@@ -242,7 +242,7 @@ void Video::setSize(bool defaultTo1XScaler) {
void Video::retrace(bool mouse) {
if (mouse)
- CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
+ CursorMan.showMouse((_vm->_draw->_showCursor & 6) != 0);
if (_vm->_global->_primarySurfDesc) {
int screenX = _screenDeltaX;