aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/minigames
diff options
context:
space:
mode:
authorSven Hesse2012-01-28 18:03:00 +0100
committerSven Hesse2012-01-28 18:03:00 +0100
commit60306c40ac8ec733fb7ec45ea61f91de245ab02e (patch)
treec11fbf714bb8da2e96cc29940764383614b1f8fa /engines/gob/minigames
parent7650fca0405f62e62bdf81cb9f2acd8e7f14ca69 (diff)
downloadscummvm-rg350-60306c40ac8ec733fb7ec45ea61f91de245ab02e.tar.gz
scummvm-rg350-60306c40ac8ec733fb7ec45ea61f91de245ab02e.tar.bz2
scummvm-rg350-60306c40ac8ec733fb7ec45ea61f91de245ab02e.zip
GOB: If there's no air left, Oko dies
Diffstat (limited to 'engines/gob/minigames')
-rw-r--r--engines/gob/minigames/geisha/diving.cpp3
-rw-r--r--engines/gob/minigames/geisha/oko.cpp28
-rw-r--r--engines/gob/minigames/geisha/oko.h6
3 files changed, 30 insertions, 7 deletions
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index bd87be8e7f..0a43f96be9 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -410,6 +410,9 @@ void Diving::updateAirMeter() {
if (_airCycle == 0)
_airMeter->decrease();
+
+ if (_airMeter->getValue() == 0)
+ _oko->die();
}
void Diving::updateEvilFish() {
diff --git a/engines/gob/minigames/geisha/oko.cpp b/engines/gob/minigames/geisha/oko.cpp
index 23f460fdba..c9d4d1f43f 100644
--- a/engines/gob/minigames/geisha/oko.cpp
+++ b/engines/gob/minigames/geisha/oko.cpp
@@ -29,12 +29,15 @@ namespace Gob {
namespace Geisha {
enum kOkoAnimation {
- kOkoAnimationEnter = 0,
- kOkoAnimationSwim = 1,
- kOkoAnimationSink = 8,
- kOkoAnimationRaise = 7,
- kOkoAnimationBreathe = 2,
- kOkoAnimationPick = 3
+ kOkoAnimationEnter = 0,
+ kOkoAnimationSwim = 1,
+ kOkoAnimationSink = 8,
+ kOkoAnimationRaise = 7,
+ kOkoAnimationBreathe = 2,
+ kOkoAnimationPick = 3,
+ kOkoAnimationDie0 = 17,
+ kOkoAnimationDie1 = 18,
+ kOkoAnimationDie2 = 19
};
static const int16 kOkoPositionX = 110;
@@ -56,6 +59,11 @@ Oko::~Oko() {
void Oko::advance() {
bool wasLastFrame = lastFrame();
+ if ((_state == kStateDead) && wasLastFrame) {
+ setPause(true);
+ return;
+ }
+
ANIObject::advance();
switch (_state) {
@@ -127,6 +135,14 @@ void Oko::raise() {
_level--;
}
+void Oko::die() {
+ if (_state != kStateSwim)
+ return;
+
+ setAnimation(kOkoAnimationDie0 + _level);
+ _state = kStateDead;
+}
+
Oko::State Oko::getState() const {
return _state;
}
diff --git a/engines/gob/minigames/geisha/oko.h b/engines/gob/minigames/geisha/oko.h
index 37824936e3..d5d18c16b3 100644
--- a/engines/gob/minigames/geisha/oko.h
+++ b/engines/gob/minigames/geisha/oko.h
@@ -41,7 +41,8 @@ public:
kStateSink,
kStateRaise,
kStateBreathe,
- kStatePick
+ kStatePick,
+ kStateDead
};
Oko(const ANIFile &ani, Sound &sound, SoundDesc &breathe);
@@ -55,6 +56,9 @@ public:
/** Oko should raise a level. */
void raise();
+ /** Oko should die. */
+ void die();
+
State getState() const;
bool isBreathing() const;