diff options
Diffstat (limited to 'engines/gob/minigames/geisha')
-rw-r--r-- | engines/gob/minigames/geisha/diving.cpp | 35 | ||||
-rw-r--r-- | engines/gob/minigames/geisha/diving.h | 2 | ||||
-rw-r--r-- | engines/gob/minigames/geisha/oko.cpp | 4 | ||||
-rw-r--r-- | engines/gob/minigames/geisha/oko.h | 2 |
4 files changed, 41 insertions, 2 deletions
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp index e08902ac95..d59d3430ad 100644 --- a/engines/gob/minigames/geisha/diving.cpp +++ b/engines/gob/minigames/geisha/diving.cpp @@ -120,9 +120,12 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) { if (mouseButtons == kMouseButtonsLeft) shoot(mouseX, mouseY); - if (key == kKeyDown) + if (key == kKeyDown) { + if (_oko->isAtBottom()) + getPearl(); + _oko->sink(); - else if (key == kKeyUp) + } else if (key == kKeyUp) _oko->raise(); if ((_whitePearlCount >= 20) || (_blackPearlCount >= 2)) @@ -510,6 +513,30 @@ void Diving::updatePearl() { } } +void Diving::getPearl() { + if (!_pearl.pearl->isVisible()) + return; + + // Make sure the pearl is within Oko's grasp + + int16 x, y, width, height; + _pearl.pearl->getFramePosition(x, y); + _pearl.pearl->getFrameSize(width, height); + + if ((x > 175) || ((x + width) < 168)) + return; + + // Remove the pearl + _pearl.pearl->setVisible(false); + _pearl.pearl->setPause(true); + + // Add the pearl to our found pearls repository + if (_pearl.black) + foundBlackPearl(); + else + foundWhitePearl(); +} + void Diving::foundBlackPearl() { _blackPearlCount++; @@ -520,6 +547,8 @@ void Diving::foundBlackPearl() { _vm->_draw->_backSurface->blit(*_blackPearl, 0, 0, 10, 7, 160, 179, 0); _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 179, 160, 186); } + + _vm->_sound->blasterPlay(&_soundBlackPearl, 1, 0); } void Diving::foundWhitePearl() { @@ -531,6 +560,8 @@ void Diving::foundWhitePearl() { _background->drawLayer(*_vm->_draw->_backSurface, 0, 2, x, 177, 0); _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, x, 177, x + 3, 180); + + _vm->_sound->blasterPlay(&_soundWhitePearl, 1, 0); } void Diving::updateAnims() { diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h index eeee4df07c..b00252ca0a 100644 --- a/engines/gob/minigames/geisha/diving.h +++ b/engines/gob/minigames/geisha/diving.h @@ -152,6 +152,8 @@ private: void enterPlant(ManagedPlant &plant, int16 prevPlantX); void enterPearl(int16 x); + void getPearl(); + void foundBlackPearl(); void foundWhitePearl(); diff --git a/engines/gob/minigames/geisha/oko.cpp b/engines/gob/minigames/geisha/oko.cpp index f8536eab3f..e4cf32f5b2 100644 --- a/engines/gob/minigames/geisha/oko.cpp +++ b/engines/gob/minigames/geisha/oko.cpp @@ -118,6 +118,10 @@ Oko::State Oko::getState() const { return _state; } +bool Oko::isAtBottom() const { + return _level >= (kLevelCount - 1); +} + } // End of namespace Geisha } // End of namespace Gob diff --git a/engines/gob/minigames/geisha/oko.h b/engines/gob/minigames/geisha/oko.h index e44d273a73..892f0b81fa 100644 --- a/engines/gob/minigames/geisha/oko.h +++ b/engines/gob/minigames/geisha/oko.h @@ -56,6 +56,8 @@ public: State getState() const; + bool isAtBottom() const; + private: Sound *_sound; SoundDesc *_breathe; |