aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2012-01-28 23:05:05 +0100
committerSven Hesse2012-01-28 23:29:47 +0100
commitcaeae1a7d66843823a31bb99e081da0165a18a22 (patch)
treee54ba03ebb07c1f9a1e5134adbb8efc2dd258a7e
parent1eb7c7507bce6bbad0eb8eb2badd6492320a5908 (diff)
downloadscummvm-rg350-caeae1a7d66843823a31bb99e081da0165a18a22.tar.gz
scummvm-rg350-caeae1a7d66843823a31bb99e081da0165a18a22.tar.bz2
scummvm-rg350-caeae1a7d66843823a31bb99e081da0165a18a22.zip
GOB: Pick the pearl at the right frame of the animation
And make the pearl picking a bit less...picky.
-rw-r--r--engines/gob/minigames/geisha/diving.cpp34
-rw-r--r--engines/gob/minigames/geisha/diving.h1
2 files changed, 23 insertions, 12 deletions
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index a635415b9c..3f7d6fc4b3 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -92,8 +92,7 @@ const Diving::PlantLevel Diving::kPlantLevels[] = {
Diving::Diving(GobEngine *vm) : _vm(vm), _background(0),
_objects(0), _gui(0), _okoAnim(0), _lungs(0), _heart(0),
- _blackPearl(0), _airMeter(0), _healthMeter(0),
- _whitePearlCount(0), _blackPearlCount(0) {
+ _blackPearl(0), _airMeter(0), _healthMeter(0) {
_blackPearl = new Surface(11, 8, 1);
@@ -307,6 +306,9 @@ void Diving::init() {
_airCycle = 0;
_hurtGracePeriod = 0;
+
+ _whitePearlCount = 0;
+ _blackPearlCount = 0;
}
void Diving::deinit() {
@@ -467,6 +469,7 @@ void Diving::enterPearl(int16 x) {
_pearl.pearl->setVisible(true);
_pearl.pearl->setPause(false);
+ _pearl.picked = false;
}
void Diving::updateAirMeter() {
@@ -610,6 +613,21 @@ void Diving::updatePearl() {
if (!_oko->isMoving())
return;
+ // Picking the pearl
+ if (_pearl.picked && (_oko->getState() == Oko::kStatePick) && (_oko->getFrame() == 8)) {
+ // 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();
+
+ return;
+ }
+
// Move the pearl
int16 x, y, width, height;
_pearl.pearl->getPosition(x, y);
@@ -635,18 +653,10 @@ void Diving::getPearl() {
_pearl.pearl->getFramePosition(x, y);
_pearl.pearl->getFrameSize(width, height);
- if ((x > 175) || ((x + width) < 168))
+ if ((x > 190) || ((x + width) < 140))
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();
+ _pearl.picked = true;
}
void Diving::foundBlackPearl() {
diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h
index 5db1b8199a..65ae06ec3e 100644
--- a/engines/gob/minigames/geisha/diving.h
+++ b/engines/gob/minigames/geisha/diving.h
@@ -101,6 +101,7 @@ private:
struct ManagedPearl {
ANIObject *pearl;
+ bool picked;
bool black;
};