aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/minigames/geisha/diving.cpp
diff options
context:
space:
mode:
authorSven Hesse2012-01-27 14:55:32 +0100
committerSven Hesse2012-01-27 14:55:32 +0100
commitcf45f49f72dba59c94ac4d2c0e1bcbebf1482b8f (patch)
tree795d49f54a35c96b1adbeb1036a8563c0e6faff6 /engines/gob/minigames/geisha/diving.cpp
parent841462721686488a41588410418f4e5ff46dac76 (diff)
downloadscummvm-rg350-cf45f49f72dba59c94ac4d2c0e1bcbebf1482b8f.tar.gz
scummvm-rg350-cf45f49f72dba59c94ac4d2c0e1bcbebf1482b8f.tar.bz2
scummvm-rg350-cf45f49f72dba59c94ac4d2c0e1bcbebf1482b8f.zip
GOB: Picking up pearls
Diffstat (limited to 'engines/gob/minigames/geisha/diving.cpp')
-rw-r--r--engines/gob/minigames/geisha/diving.cpp35
1 files changed, 33 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() {