aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2012-01-28 17:46:04 +0100
committerSven Hesse2012-01-28 17:46:38 +0100
commit7650fca0405f62e62bdf81cb9f2acd8e7f14ca69 (patch)
tree2f991030d6450d63072d86d63a2193a92ac2297f
parent9dd703532706c049b14b4bc1e239c9cd08366f2a (diff)
downloadscummvm-rg350-7650fca0405f62e62bdf81cb9f2acd8e7f14ca69.tar.gz
scummvm-rg350-7650fca0405f62e62bdf81cb9f2acd8e7f14ca69.tar.bz2
scummvm-rg350-7650fca0405f62e62bdf81cb9f2acd8e7f14ca69.zip
GOB: Air gets used up and is refilled by breathing
-rw-r--r--engines/gob/minigames/geisha/diving.cpp19
-rw-r--r--engines/gob/minigames/geisha/diving.h3
-rw-r--r--engines/gob/minigames/geisha/oko.cpp4
-rw-r--r--engines/gob/minigames/geisha/oko.h2
4 files changed, 25 insertions, 3 deletions
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 59ebe7f7b1..bd87be8e7f 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -39,6 +39,9 @@ namespace Gob {
namespace Geisha {
+static const uint8 kAirDecreaseRate = 15;
+
+
const uint16 Diving::kEvilFishTypes[kEvilFishTypeCount][5] = {
{ 0, 14, 8, 9, 3}, // Shark
{15, 1, 12, 13, 3}, // Moray
@@ -105,6 +108,7 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
while (!_vm->shouldQuit()) {
checkShots();
+ updateAirMeter();
updateEvilFish();
updateDecorFish();
updatePlants();
@@ -245,6 +249,8 @@ void Diving::init() {
_airMeter->setValue(38);
_healthMeter->setValue(38);
+
+ _airCycle = 0;
}
void Diving::deinit() {
@@ -393,6 +399,19 @@ void Diving::enterPearl(int16 x) {
_pearl.pearl->setPause(false);
}
+void Diving::updateAirMeter() {
+ if (_oko->isBreathing()) {
+ _airCycle = 0;
+ _airMeter->increase();
+ return;
+ }
+
+ _airCycle = (_airCycle + 1) % kAirDecreaseRate;
+
+ if (_airCycle == 0)
+ _airMeter->decrease();
+}
+
void Diving::updateEvilFish() {
for (uint i = 0; i < kEvilFishCount; i++) {
ManagedEvilFish &fish = _evilFish[i];
diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h
index 50a5d49a8c..2915e85a93 100644
--- a/engines/gob/minigames/geisha/diving.h
+++ b/engines/gob/minigames/geisha/diving.h
@@ -136,6 +136,8 @@ private:
Meter *_airMeter;
Meter *_healthMeter;
+ uint8 _airCycle;
+
uint8 _currentShot;
SoundDesc _soundShoot;
@@ -161,6 +163,7 @@ private:
void foundBlackPearl();
void foundWhitePearl();
+ void updateAirMeter();
void updateEvilFish();
void updateDecorFish();
void updatePlants();
diff --git a/engines/gob/minigames/geisha/oko.cpp b/engines/gob/minigames/geisha/oko.cpp
index 5da1947acf..23f460fdba 100644
--- a/engines/gob/minigames/geisha/oko.cpp
+++ b/engines/gob/minigames/geisha/oko.cpp
@@ -131,8 +131,8 @@ Oko::State Oko::getState() const {
return _state;
}
-bool Oko::isAtBottom() const {
- return _level >= (kLevelCount - 1);
+bool Oko::isBreathing() const {
+ return (_state == kStateBreathe) && ((getFrame() >= 9) && (getFrame() <= 30));
}
} // End of namespace Geisha
diff --git a/engines/gob/minigames/geisha/oko.h b/engines/gob/minigames/geisha/oko.h
index 0dee53ce45..37824936e3 100644
--- a/engines/gob/minigames/geisha/oko.h
+++ b/engines/gob/minigames/geisha/oko.h
@@ -57,7 +57,7 @@ public:
State getState() const;
- bool isAtBottom() const;
+ bool isBreathing() const;
private:
Sound *_sound;