From caeae1a7d66843823a31bb99e081da0165a18a22 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 28 Jan 2012 23:05:05 +0100 Subject: GOB: Pick the pearl at the right frame of the animation And make the pearl picking a bit less...picky. --- engines/gob/minigames/geisha/diving.cpp | 34 +++++++++++++++++++++------------ engines/gob/minigames/geisha/diving.h | 1 + 2 files changed, 23 insertions(+), 12 deletions(-) (limited to 'engines/gob') 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; }; -- cgit v1.2.3