diff options
author | Sven Hesse | 2012-06-03 01:29:09 +0200 |
---|---|---|
committer | Sven Hesse | 2012-06-03 01:29:44 +0200 |
commit | 95e467d82cb36ee0d98624dd2cdd6d79b544c50c (patch) | |
tree | f3b6c7c1318e14929799481c1277de306aad9fef /engines/gob/minigames/geisha | |
parent | 8dcb93f2ce04df49dea38f56bc97aef900a05122 (diff) | |
download | scummvm-rg350-95e467d82cb36ee0d98624dd2cdd6d79b544c50c.tar.gz scummvm-rg350-95e467d82cb36ee0d98624dd2cdd6d79b544c50c.tar.bz2 scummvm-rg350-95e467d82cb36ee0d98624dd2cdd6d79b544c50c.zip |
GOB: Display the Penetration submarine
Diffstat (limited to 'engines/gob/minigames/geisha')
-rw-r--r-- | engines/gob/minigames/geisha/penetration.cpp | 49 | ||||
-rw-r--r-- | engines/gob/minigames/geisha/penetration.h | 4 |
2 files changed, 46 insertions, 7 deletions
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp index 41346a896f..377835c45f 100644 --- a/engines/gob/minigames/geisha/penetration.cpp +++ b/engines/gob/minigames/geisha/penetration.cpp @@ -60,6 +60,30 @@ static const int kColorHealth = 15; static const int kColorBlack = 10; static const int kColorFloor = 13; +enum Animation { + kAnimationDriveS = 4, + kAnimationDriveE = 5, + kAnimationDriveN = 6, + kAnimationDriveW = 7, + kAnimationDriveSE = 8, + kAnimationDriveNE = 9, + kAnimationDriveSW = 10, + kAnimationDriveNW = 11, + kAnimationShootS = 12, + kAnimationShootN = 13, + kAnimationShootW = 14, + kAnimationShootE = 15, + kAnimationShootNE = 16, + kAnimationShootSE = 17, + kAnimationShootSW = 18, + kAnimationShootNW = 19, + kAnimationExplodeN = 28, + kAnimationExplodeS = 29, + kAnimationExplodeW = 30, + kAnimationExplodeE = 31, + kAnimationExit = 32 +}; + static const int kMapTileWidth = 24; static const int kMapTileHeight = 24; @@ -169,7 +193,7 @@ const byte Penetration::kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight] = }; -Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _sprites(0), _objects(0), +Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _sprites(0), _objects(0), _sub(0), _shieldMeter(0), _healthMeter(0), _floor(0), _mapUpdate(false), _mapX(0), _mapY(0), _subTileX(0), _subTileY(0) { @@ -250,11 +274,21 @@ void Penetration::init() { _floor = 0; createMap(); + + _sub = new ANIObject(*_objects); + + _sub->setAnimation(kAnimationDriveN); + _sub->setPosition(kPlayAreaX + kPlayAreaBorderWidth, kPlayAreaY + kPlayAreaBorderHeight); + _sub->setVisible(true); + + _anims.push_back(_sub); } void Penetration::deinit() { _anims.clear(); + delete _sub; + delete _objects; delete _sprites; @@ -391,16 +425,16 @@ int16 Penetration::checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseB void Penetration::handleSub(int16 key) { if (key == kKeyLeft) - moveSub(-5, 0); + moveSub(-5, 0, kAnimationDriveW); else if (key == kKeyRight) - moveSub( 5, 0); + moveSub( 5, 0, kAnimationDriveE); else if (key == kKeyUp) - moveSub( 0, -5); + moveSub( 0, -5, kAnimationDriveN); else if (key == kKeyDown) - moveSub( 0, 5); + moveSub( 0, 5, kAnimationDriveS); } -void Penetration::moveSub(int x, int y) { +void Penetration::moveSub(int x, int y, uint16 animation) { _mapX = CLIP<int16>(_mapX + x, 0, kMapWidth * kMapTileWidth); _mapY = CLIP<int16>(_mapY + y, 0, kMapHeight * kMapTileHeight); @@ -408,6 +442,9 @@ void Penetration::moveSub(int x, int y) { _subTileY = _mapY / kMapTileHeight; _mapUpdate = true; + + if (_sub->getAnimation() != animation) + _sub->setAnimation(animation); } void Penetration::updateAnims() { diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h index 72201d21d8..28a288928b 100644 --- a/engines/gob/minigames/geisha/penetration.h +++ b/engines/gob/minigames/geisha/penetration.h @@ -64,6 +64,8 @@ private: CMPFile *_sprites; ANIFile *_objects; + ANIObject *_sub; + Common::List<ANIObject *> _anims; Meter *_shieldMeter; @@ -93,7 +95,7 @@ private: int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons); void handleSub(int16 key); - void moveSub(int x, int y); + void moveSub(int x, int y, uint16 animation); }; } // End of namespace Geisha |