aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2012-06-06 03:27:40 +0200
committerSven Hesse2012-06-06 03:33:35 +0200
commit04d0ec8d03d46f59f950929321fef43b52ea740a (patch)
tree6c766adc67d51efda7501adf354474057048c9e5
parent1782012f9f9ec368689fb2e232543a5aea3c1073 (diff)
downloadscummvm-rg350-04d0ec8d03d46f59f950929321fef43b52ea740a.tar.gz
scummvm-rg350-04d0ec8d03d46f59f950929321fef43b52ea740a.tar.bz2
scummvm-rg350-04d0ec8d03d46f59f950929321fef43b52ea740a.zip
GOB: Implement exiting floors
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp47
-rw-r--r--engines/gob/minigames/geisha/penetration.h4
-rw-r--r--engines/gob/minigames/geisha/submarine.cpp9
-rw-r--r--engines/gob/minigames/geisha/submarine.h3
4 files changed, 52 insertions, 11 deletions
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 22cb06fed8..856c063edf 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -263,6 +263,8 @@ bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
// Handle the sub movement
handleSub(key);
+
+ checkExited();
}
deinit();
@@ -276,6 +278,7 @@ void Penetration::init() {
_vm->_sound->sampleLoad(&_soundBite , SOUND_SND, "pervet.snd");
_vm->_sound->sampleLoad(&_soundKiss , SOUND_SND, "baise.snd");
_vm->_sound->sampleLoad(&_soundShoot , SOUND_SND, "tirgim.snd");
+ _vm->_sound->sampleLoad(&_soundExit , SOUND_SND, "trouve.snd");
_background->clear();
@@ -296,11 +299,6 @@ void Penetration::init() {
_floor = 0;
createMap();
-
- for (Common::List<ManagedMouth>::iterator m = _mouths.begin(); m != _mouths.end(); m++)
- _mapAnims.push_back(m->mouth);
-
- _anims.push_back(_sub->sub);
}
void Penetration::deinit() {
@@ -308,6 +306,7 @@ void Penetration::deinit() {
_soundBite.free();
_soundKiss.free();
_soundShoot.free();
+ _soundExit.free();
clearMap();
@@ -443,7 +442,12 @@ void Penetration::createMap() {
}
if (!_sub)
- error("Geisha: No starting position in floor %d (testmode: %d", _floor, _testMode);
+ error("Geisha: No starting position in floor %d (testmode: %d)", _floor, _testMode);
+
+ for (Common::List<ManagedMouth>::iterator m = _mouths.begin(); m != _mouths.end(); m++)
+ _mapAnims.push_back(m->mouth);
+
+ _anims.push_back(_sub->sub);
}
void Penetration::initScreen() {
@@ -525,6 +529,7 @@ void Penetration::subMove(int x, int y, Submarine::Direction direction) {
checkShields();
checkMouths();
+ checkExits();
}
void Penetration::subShoot() {
@@ -578,6 +583,23 @@ void Penetration::checkMouths() {
}
}
+void Penetration::checkExits() {
+ if (!_sub->sub->canMove())
+ return;
+
+ for (Common::List<Position>::iterator e = _exits.begin(); e != _exits.end(); ++e) {
+ if ((e->x == _sub->x) && (e->y == _sub->y)) {
+ _sub->mapX = e->x * kMapTileWidth;
+ _sub->mapY = e->y * kMapTileHeight;
+
+ _sub->sub->leave();
+
+ _vm->_sound->blasterPlay(&_soundExit, 1, 0);
+ break;
+ }
+ }
+}
+
void Penetration::healthGain(int amount) {
if (_shieldMeter->getValue() > 0)
_healthMeter->increase(_shieldMeter->increase(amount));
@@ -592,12 +614,23 @@ void Penetration::healthLose(int amount) {
_sub->sub->die();
}
+void Penetration::checkExited() {
+ if (_sub->sub->hasExited()) {
+ _floor++;
+
+ if (_floor >= kFloorCount)
+ return;
+
+ createMap();
+ }
+}
+
bool Penetration::isDead() const {
return _sub && _sub->sub->isDead();
}
bool Penetration::hasWon() const {
- return _floor > kFloorCount;
+ return _floor >= kFloorCount;
}
void Penetration::updateAnims() {
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index a5740382c6..f717e7219b 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -122,6 +122,7 @@ private:
SoundDesc _soundBite;
SoundDesc _soundKiss;
SoundDesc _soundShoot;
+ SoundDesc _soundExit;
void init();
@@ -142,12 +143,15 @@ private:
bool isWalkable(int16 x, int16 y) const;
+ void checkExits();
void checkShields();
void checkMouths();
void healthGain(int amount);
void healthLose(int amount);
+ void checkExited();
+
bool isDead() const;
bool hasWon() const;
};
diff --git a/engines/gob/minigames/geisha/submarine.cpp b/engines/gob/minigames/geisha/submarine.cpp
index 4a18c6e043..0f3f936ea6 100644
--- a/engines/gob/minigames/geisha/submarine.cpp
+++ b/engines/gob/minigames/geisha/submarine.cpp
@@ -109,12 +109,9 @@ void Submarine::advance() {
break;
case kStateExit:
- if (isPaused()) {
+ if (isPaused())
_state = kStateExited;
- setVisible(true);
- }
-
break;
case kStateDie:
@@ -135,6 +132,10 @@ bool Submarine::isDead() const {
return _state == kStateDead;
}
+bool Submarine::hasExited() const {
+ return _state == kStateExited;
+}
+
uint16 Submarine::directionToMove(Direction direction) const {
switch (direction) {
case kDirectionN:
diff --git a/engines/gob/minigames/geisha/submarine.h b/engines/gob/minigames/geisha/submarine.h
index e8ae72d996..d14e4e953b 100644
--- a/engines/gob/minigames/geisha/submarine.h
+++ b/engines/gob/minigames/geisha/submarine.h
@@ -67,6 +67,9 @@ public:
/** Is the submarine dead? */
bool isDead() const;
+ /** Has the submarine finished exiting the level? */
+ bool hasExited() const;
+
private:
enum State {
kStateNone = 0,