aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/minigames
diff options
context:
space:
mode:
authorSven Hesse2012-06-07 04:20:41 +0200
committerSven Hesse2012-06-07 04:21:29 +0200
commit3d537e763c85bb3f16825c8b47894335568278a0 (patch)
tree8990a0147a7cb25dfb2b7395896a498c332fc99e /engines/gob/minigames
parent95454ab52c3e8f251b08aa62b18f071374de85b9 (diff)
downloadscummvm-rg350-3d537e763c85bb3f16825c8b47894335568278a0.tar.gz
scummvm-rg350-3d537e763c85bb3f16825c8b47894335568278a0.tar.bz2
scummvm-rg350-3d537e763c85bb3f16825c8b47894335568278a0.zip
GOB: Handle Penetration shooting animations more cleverly
Still no bullets, though :P
Diffstat (limited to 'engines/gob/minigames')
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp2
-rw-r--r--engines/gob/minigames/geisha/submarine.cpp27
-rw-r--r--engines/gob/minigames/geisha/submarine.h5
3 files changed, 27 insertions, 7 deletions
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 72c53cb5c3..e260d3cae2 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -823,7 +823,7 @@ void Penetration::subMove(int x, int y, Submarine::Direction direction) {
}
void Penetration::subShoot() {
- if (!_sub->sub->canMove())
+ if (!_sub->sub->canMove() || _sub->sub->isShooting())
return;
_sub->sub->shoot();
diff --git a/engines/gob/minigames/geisha/submarine.cpp b/engines/gob/minigames/geisha/submarine.cpp
index c61f49f22b..9c12a56a85 100644
--- a/engines/gob/minigames/geisha/submarine.cpp
+++ b/engines/gob/minigames/geisha/submarine.cpp
@@ -51,7 +51,7 @@ enum Animation {
};
-Submarine::Submarine(const ANIFile &ani) : ANIObject(ani), _state(kStateNone) {
+Submarine::Submarine(const ANIFile &ani) : ANIObject(ani), _state(kStateMove) {
turn(kDirectionN);
}
@@ -63,13 +63,21 @@ void Submarine::turn(Direction to) {
if ((to == kDirectionNone) || ((_state == kStateMove) && (_direction == to)))
return;
- _state = kStateMove;
_direction = to;
- setAnimation(directionToMove(_direction));
- setMode(kModeContinuous);
+ move();
+}
+
+void Submarine::move() {
+ uint16 frame = getFrame();
+ uint16 anim = (_state == kStateShoot) ? directionToShoot(_direction) : directionToMove(_direction);
+
+ setAnimation(anim);
+ setFrame(frame);
setPause(false);
setVisible(true);
+
+ setMode((_state == kStateShoot) ? kModeOnce : kModeContinuous);
}
void Submarine::shoot() {
@@ -104,8 +112,11 @@ void Submarine::advance() {
switch (_state) {
case kStateShoot:
- if (isPaused())
- turn(_direction);
+ if (isPaused()) {
+ _state = kStateMove;
+
+ move();
+ }
break;
case kStateExit:
@@ -132,6 +143,10 @@ bool Submarine::isDead() const {
return _state == kStateDead;
}
+bool Submarine::isShooting() const {
+ return _state == kStateShoot;
+}
+
bool Submarine::hasExited() const {
return _state == kStateExited;
}
diff --git a/engines/gob/minigames/geisha/submarine.h b/engines/gob/minigames/geisha/submarine.h
index 2455ef95c1..8a6d679bdd 100644
--- a/engines/gob/minigames/geisha/submarine.h
+++ b/engines/gob/minigames/geisha/submarine.h
@@ -68,6 +68,9 @@ public:
/** Is the submarine dead? */
bool isDead() const;
+ /** Is the submarine shooting? */
+ bool isShooting() const;
+
/** Has the submarine finished exiting the level? */
bool hasExited() const;
@@ -91,6 +94,8 @@ private:
uint16 directionToShoot(Direction direction) const;
/** Map the directions to explode animation indices. */
uint16 directionToExplode(Direction direction) const;
+
+ void move();
};
} // End of namespace Geisha