diff options
-rw-r--r-- | engines/gob/draw.cpp | 4 | ||||
-rw-r--r-- | engines/gob/draw_v2.cpp | 5 | ||||
-rw-r--r-- | engines/gob/pregob/onceupon/onceupon.cpp | 1 | ||||
-rw-r--r-- | engines/gob/pregob/onceupon/onceupon.h | 2 | ||||
-rw-r--r-- | engines/gob/pregob/pregob.cpp | 47 | ||||
-rw-r--r-- | engines/gob/pregob/pregob.h | 14 | ||||
-rw-r--r-- | engines/gob/video.cpp | 2 |
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; |