From ac3593c63143e7bea9dfab6b237a812186c9dcee Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 4 Sep 2011 19:34:38 +0200 Subject: GOB: Init "Diving" cursor --- engines/gob/draw.cpp | 3 +++ engines/gob/draw.h | 3 +++ engines/gob/draw_v1.cpp | 3 +++ engines/gob/draw_v2.cpp | 3 +++ engines/gob/minigames/geisha/diving.cpp | 23 +++++++++++++++++++++++ engines/gob/minigames/geisha/diving.h | 1 + 6 files changed, 36 insertions(+) (limited to 'engines') diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index 580696523f..4b659f51de 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -107,6 +107,9 @@ Draw::Draw(GobEngine *vm) : _vm(vm) { _cursorHotspotXVar = -1; _cursorHotspotYVar = -1; + _cursorHotspotX = -1; + _cursorHotspotY = -1; + _cursorAnim = 0; for (int i = 0; i < 40; i++) { _cursorAnimLow[i] = 0; diff --git a/engines/gob/draw.h b/engines/gob/draw.h index 57faefa314..393822c33a 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -133,6 +133,9 @@ public: int32 _cursorHotspotXVar; int32 _cursorHotspotYVar; + int32 _cursorHotspotX; + int32 _cursorHotspotY; + SurfacePtr _cursorSprites; SurfacePtr _cursorSpritesBack; SurfacePtr _scummvmCursor; diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 064c74958a..8cb88b522c 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -112,6 +112,9 @@ void Draw_v1::animateCursor(int16 cursor) { if (_cursorHotspotXVar != -1) { newX -= hotspotX = (uint16) VAR(_cursorIndex + _cursorHotspotXVar); newY -= hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar); + } else if (_cursorHotspotX != -1) { + newX -= hotspotX = _cursorHotspotX; + newY -= hotspotY = _cursorHotspotY; } _scummvmCursor->clear(); diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 151ed42526..6e64d6fd06 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -138,6 +138,9 @@ void Draw_v2::animateCursor(int16 cursor) { if (_cursorHotspotXVar != -1) { newX -= hotspotX = (uint16) VAR(_cursorIndex + _cursorHotspotXVar); newY -= hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar); + } else if (_cursorHotspotX != -1) { + newX -= hotspotX = _cursorHotspotX; + newY -= hotspotY = _cursorHotspotY; } _scummvmCursor->clear(); diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp index c3a8a30328..f0eae3219c 100644 --- a/engines/gob/minigames/geisha/diving.cpp +++ b/engines/gob/minigames/geisha/diving.cpp @@ -52,6 +52,7 @@ Diving::~Diving() { bool Diving::play(uint16 playerCount, bool hasPearlLocation) { init(); initScreen(); + initCursor(); _vm->_draw->blitInvalidated(); _vm->_video->retrace(); @@ -88,6 +89,8 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) { (*o)->advance(); } + _vm->_draw->animateCursor(1); + _vm->_draw->blitInvalidated(); _vm->_util->waitEndFrame(); @@ -135,6 +138,9 @@ void Diving::init() { } void Diving::deinit() { + _vm->_draw->_cursorHotspotX = -1; + _vm->_draw->_cursorHotspotY = -1; + delete _heart; delete _lungs; delete _water; @@ -169,6 +175,23 @@ void Diving::initScreen() { _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199); } +void Diving::initCursor() { + const int index = _vm->_draw->_cursorIndex; + + const int16 left = index * _vm->_draw->_cursorWidth; + const int16 top = 0; + const int16 right = left + _vm->_draw->_cursorWidth - 1; + const int16 bottom = _vm->_draw->_cursorHeight - 1; + + _vm->_draw->_cursorSprites->fillRect(left, top, right, bottom, 0); + + _objects->draw(*_vm->_draw->_cursorSprites, 31, 0, left, top); + _vm->_draw->_cursorAnimLow[index] = 0; + + _vm->_draw->_cursorHotspotX = 8; + _vm->_draw->_cursorHotspotY = 8; +} + void Diving::foundBlackPearl() { _blackPearlCount++; diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h index 9975b0f53f..023ac919a7 100644 --- a/engines/gob/minigames/geisha/diving.h +++ b/engines/gob/minigames/geisha/diving.h @@ -64,6 +64,7 @@ private: void deinit(); void initScreen(); + void initCursor(); void foundBlackPearl(); void foundWhitePearl(); -- cgit v1.2.3