[Scummvm-cvs-logs] scummvm master -> 95e467d82cb36ee0d98624dd2cdd6d79b544c50c
DrMcCoy
drmccoy at drmccoy.de
Sun Jun 3 01:30:01 CEST 2012
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
43abb525d4 GOB: Draw the map in a separate surface
8dcb93f2ce GOB: Draw the Penetration map and do basic movement
95e467d82c GOB: Display the Penetration submarine
Commit: 43abb525d4004cb0816c8ea506b0b963d784ccf3
https://github.com/scummvm/scummvm/commit/43abb525d4004cb0816c8ea506b0b963d784ccf3
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-02T16:29:44-07:00
Commit Message:
GOB: Draw the map in a separate surface
Still hidden for now.
Changed paths:
engines/gob/minigames/geisha/penetration.cpp
engines/gob/minigames/geisha/penetration.h
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 8b5de27..77edebc 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -55,18 +55,137 @@ static const byte kPalette[48] = {
0x15, 0x3F, 0x15
};
+static const int kColorShield = 11;
+static const int kColorHealth = 15;
+static const int kColorBlack = 10;
+static const int kColorFloor = 13;
+
+static const int kMapTileWidth = 24;
+static const int kMapTileHeight = 24;
+
+static const int kPlayAreaX = 120;
+static const int kPlayAreaY = 7;
+static const int kPlayAreaWidth = 192;
+static const int kPlayAreaHeight = 113;
+
+static const int kPlayAreaBorderWidth = kPlayAreaWidth / 2;
+static const int kPlayAreaBorderHeight = kPlayAreaHeight / 2;
+
+const byte Penetration::kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight] = {
+ {
+ { // Real mode, floor 0
+ 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0,
+ 50, 50, 0, 0, 52, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50,
+ 50, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50,
+ 50, 0, 0, 50, 0, 0, 52, 53, 0, 0, 0, 0, 0, 0, 50, 0, 50,
+ 50, 0, 50, 0, 0, 50, 50, 50, 50, 0, 54, 55, 0, 0, 50, 0, 50,
+ 50, 0, 50, 49, 0, 50, 0, 52, 53, 0, 50, 50, 50, 0, 0, 0, 50,
+ 50, 57, 0, 50, 0, 0, 0, 50, 50, 50, 0, 0, 56, 50, 54, 55, 50,
+ 50, 50, 0, 0, 50, 50, 50, 0, 0, 0, 0, 50, 0, 0, 50, 0, 50,
+ 50, 51, 50, 0, 54, 55, 0, 0, 50, 50, 50, 50, 52, 53, 50, 0, 50,
+ 50, 0, 50, 0, 0, 0, 0, 0, 54, 55, 0, 0, 0, 50, 0, 0, 50,
+ 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 50,
+ 50, 50, 0, 52, 53, 0, 0, 0, 0, 0, 0, 52, 53, 0, 0, 50, 50,
+ 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0
+ },
+ { // Real mode, floor 1
+ 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0,
+ 50, 0, 52, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50,
+ 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50,
+ 50, 0, 50, 51, 52, 53, 0, 0, 52, 53, 0, 0, 0, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 50, 0, 50, 0, 50, 0, 50, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 52, 53, 0, 0, 0, 0, 0, 52, 53, 0, 52, 53, 50,
+ 50, 57, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50,
+ 50, 0, 50, 52, 53, 0, 0, 52, 53, 0, 0, 0, 0, 0, 54, 55, 50,
+ 50, 0, 50, 0, 50, 0, 50, 50, 0, 50, 50, 0, 50, 0, 50, 50, 50,
+ 50, 0, 50, 49, 0, 0, 52, 53, 0, 52, 53, 0, 0, 0, 50, 56, 50,
+ 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50,
+ 50, 0, 0, 0, 0, 0, 0, 0, 54, 55, 0, 0, 0, 0, 0, 0, 50,
+ 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0
+ },
+ { // Real mode, floor 2
+ 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0,
+ 50, 52, 53, 0, 0, 0, 0, 50, 50, 50, 0, 0, 0, 0, 52, 53, 50,
+ 50, 0, 50, 50, 50, 0, 0, 0, 50, 0, 0, 0, 50, 50, 50, 0, 50,
+ 50, 0, 50, 52, 53, 50, 50, 52, 53, 0, 50, 50, 54, 55, 50, 0, 50,
+ 50, 0, 50, 0, 0, 0, 0, 50, 0, 50, 0, 0, 0, 0, 50, 0, 50,
+ 50, 0, 0, 0, 50, 0, 0, 0, 50, 0, 0, 0, 50, 0, 52, 53, 50,
+ 0, 50, 0, 50, 50, 50, 0, 57, 50, 51, 0, 50, 50, 50, 0, 50, 0,
+ 50, 0, 0, 0, 50, 0, 0, 0, 50, 0, 52, 53, 50, 0, 0, 0, 50,
+ 50, 0, 50, 0, 0, 0, 0, 50, 56, 50, 0, 0, 0, 0, 50, 0, 50,
+ 50, 0, 50, 54, 55, 50, 50, 0, 0, 0, 50, 50, 54, 55, 50, 0, 50,
+ 50, 0, 50, 50, 50, 0, 0, 0, 50, 0, 0, 0, 50, 50, 50, 0, 50,
+ 50, 52, 53, 0, 0, 0, 0, 50, 50, 50, 0, 0, 0, 0, 52, 53, 50,
+ 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0
+ }
+ },
+ {
+ { // Test mode, floor 0
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 56, 0, 50, 0, 0, 52, 53, 0, 0, 0, 0, 52, 53, 0, 51, 50,
+ 50, 0, 0, 50, 0, 0, 0, 50, 0, 54, 55, 50, 0, 50, 50, 50, 50,
+ 50, 52, 53, 50, 50, 0, 0, 50, 50, 50, 50, 50, 0, 50, 0, 0, 50,
+ 50, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 50, 49, 50, 0, 0, 50,
+ 50, 0, 54, 55, 0, 50, 50, 54, 55, 0, 50, 50, 50, 0, 0, 0, 50,
+ 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 53, 0, 0, 54, 55, 50,
+ 50, 0, 50, 0, 50, 0, 0, 50, 0, 0, 0, 50, 0, 0, 0, 0, 50,
+ 50, 0, 50, 0, 50, 54, 55, 50, 0, 50, 50, 50, 0, 50, 0, 0, 50,
+ 50, 50, 50, 50, 50, 0, 0, 50, 0, 0, 0, 0, 0, 50, 54, 55, 50,
+ 50, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 0, 0, 0, 50,
+ 50, 57, 0, 52, 53, 0, 0, 0, 0, 54, 55, 0, 0, 0, 0, 56, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50
+ },
+ { // Test mode, floor 1
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 52, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50,
+ 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 54, 55, 0, 50,
+ 50, 0, 50, 52, 53, 0, 0, 50, 0, 0, 54, 55, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 0, 52, 53, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 50, 50, 50, 50, 49, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 0, 50, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 51, 0, 0, 52, 53, 50, 0, 50, 0, 50,
+ 50, 57, 50, 0, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 0, 50,
+ 50, 50, 50, 0, 50, 56, 0, 0, 0, 54, 55, 0, 0, 0, 50, 0, 50,
+ 50, 56, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50,
+ 50, 50, 50, 50, 0, 0, 0, 0, 52, 53, 0, 0, 0, 0, 0, 0, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50
+ },
+ { // Test mode, floor 2
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 57, 50, 54, 55, 0, 50, 54, 55, 0, 50, 0, 52, 53, 50, 51, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 0, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 52, 53, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50, 0, 50,
+ 50, 0, 0, 0, 50, 0, 50, 0, 50, 0, 0, 0, 50, 0, 50, 0, 50,
+ 50, 0, 0, 0, 50, 52, 53, 0, 50, 52, 53, 56, 50, 0, 54, 55, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50
+ }
+ }
+};
+
+
Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _sprites(0), _objects(0),
_shieldMeter(0), _healthMeter(0) {
_background = new Surface(320, 200, 1);
- _shieldMeter = new Meter(11, 119, 92, 3, 11, 10, 1020, Meter::kFillToRight);
- _healthMeter = new Meter(11, 137, 92, 3, 15, 10, 1020, Meter::kFillToRight);
+ _shieldMeter = new Meter(11, 119, 92, 3, kColorShield, kColorBlack, 1020, Meter::kFillToRight);
+ _healthMeter = new Meter(11, 137, 92, 3, kColorHealth, kColorBlack, 1020, Meter::kFillToRight);
+
+ _map = new Surface(kMapWidth * kMapTileWidth + kPlayAreaWidth ,
+ kMapHeight * kMapTileHeight + kPlayAreaHeight, 1);
}
Penetration::~Penetration() {
deinit();
+ delete _map;
+
delete _shieldMeter;
delete _healthMeter;
@@ -115,14 +234,6 @@ void Penetration::init() {
_sprites = new CMPFile(_vm, "tcifplai.cmp", 320, 200);
_objects = new ANIFile(_vm, "tcite.ani", 320);
- // Draw the shield meter
- _sprites->draw(*_background, 0, 0, 95, 6, 9, 117, 0); // Meter frame
- _sprites->draw(*_background, 271, 176, 282, 183, 9, 108, 0); // Shield
-
- // Draw the health meter
- _sprites->draw(*_background, 0, 0, 95, 6, 9, 135, 0); // Meter frame
- _sprites->draw(*_background, 283, 176, 292, 184, 9, 126, 0); // Heart
-
// The shield starts down
_shieldMeter->setValue(0);
@@ -131,6 +242,10 @@ void Penetration::init() {
_healthMeter->setMaxValue();
else
_healthMeter->setValue(_healthMeter->getMaxValue() / 3);
+
+ _floor = 0;
+
+ createMap();
}
void Penetration::deinit() {
@@ -143,6 +258,99 @@ void Penetration::deinit() {
_sprites = 0;
}
+void Penetration::createMap() {
+ if (_floor >= kFloorCount)
+ error("Geisha: Invalid floor %d in minigame penetration", _floor);
+
+ // Copy the correct map
+ memcpy(_mapTiles, kMaps[_testMode ? 1 : 0][_floor], kMapWidth * kMapHeight);
+
+ _map->fill(kColorBlack);
+
+ // Draw the map tiles
+ for (int y = 0; y < kMapHeight; y++) {
+ for (int x = 0; x < kMapWidth; x++) {
+ byte *mapTile = _mapTiles + (y * kMapWidth + x);
+
+ const int posX = kPlayAreaBorderWidth + x * kMapTileWidth;
+ const int posY = kPlayAreaBorderHeight + y * kMapTileHeight;
+
+ switch (*mapTile) {
+ case 0: // Floor
+ _sprites->draw(*_map, 30, posX, posY);
+ break;
+
+ case 49: // Emergency exit (needs access pass)
+
+ if (_hasAccessPass) {
+ // Draw an exit. Now works like a regular exit
+ _sprites->draw(*_map, 29, posX, posY);
+ *mapTile = 51;
+ } else
+ // Draw a wall
+ _sprites->draw(*_map, 31, posX, posY);
+
+ break;
+
+ case 50: // Wall
+ _sprites->draw(*_map, 31, posX, posY);
+ break;
+
+ case 51: // Regular exit
+
+ if (!_testMode) {
+ // When we're not in test mode, the last exit only works with an access pass
+
+ if (_floor == 2) {
+ if (!_hasAccessPass) {
+ // It's now a wall
+ _sprites->draw(*_map, 31, posX, posY);
+ *mapTile = 50;
+ } else
+ _sprites->draw(*_map, 29, posX, posY);
+
+ } else
+ _sprites->draw(*_map, 29, posX, posY);
+
+ } else
+ // Always works in test mode
+ _sprites->draw(*_map, 29, posX, posY);
+
+ break;
+
+ case 52: // Left side of biting mouth
+ _sprites->draw(*_map, 32, posX, posY);
+ break;
+
+ case 53: // Right side of biting mouth
+ *mapTile = 0; // Works like a floor
+ break;
+
+ case 54: // Left side of kissing mouth
+ _sprites->draw(*_map, 33, posX, posY);
+ break;
+
+ case 55: // Right side of kissing mouth
+ *mapTile = 0; // Works like a floor
+ break;
+
+ case 56: // Shield lying on the floor
+ _sprites->draw(*_map, 30, posX , posY ); // Floor
+ _sprites->draw(*_map, 25, posX + 4, posY + 8); // Shield
+
+ _map->fillRect(posX + 4, posY + 8, posX + 7, posY + 18, kColorFloor); // Area left to shield
+ _map->fillRect(posX + 17, posY + 8, posX + 20, posY + 18, kColorFloor); // Area right to shield
+ break;
+
+ case 57: // Start position
+ _sprites->draw(*_map, 30, posX, posY);
+ *mapTile = 0;
+ break;
+ }
+ }
+ }
+}
+
void Penetration::initScreen() {
_vm->_util->setFrameRate(15);
@@ -151,6 +359,14 @@ void Penetration::initScreen() {
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+ // Draw the shield meter
+ _sprites->draw(*_background, 0, 0, 95, 6, 9, 117, 0); // Meter frame
+ _sprites->draw(*_background, 271, 176, 282, 183, 9, 108, 0); // Shield
+
+ // Draw the health meter
+ _sprites->draw(*_background, 0, 0, 95, 6, 9, 135, 0); // Meter frame
+ _sprites->draw(*_background, 283, 176, 292, 184, 9, 126, 0); // Heart
+
_vm->_draw->_backSurface->blit(*_background);
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
}
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index 6c32d28..897b109 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -46,6 +46,14 @@ public:
bool play(bool hasAccessPass, bool hasMaxEnergy, bool testMode);
private:
+ static const int kModeCount = 2;
+ static const int kFloorCount = 3;
+
+ static const int kMapWidth = 17;
+ static const int kMapHeight = 13;
+
+ static const byte kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight];
+
GobEngine *_vm;
bool _hasAccessPass;
@@ -61,9 +69,16 @@ private:
Meter *_shieldMeter;
Meter *_healthMeter;
+ uint8 _floor;
+
+ Surface *_map;
+ byte _mapTiles[kMapWidth * kMapHeight];
+
void init();
void deinit();
+ void createMap();
+
void initScreen();
void updateAnims();
Commit: 8dcb93f2ce04df49dea38f56bc97aef900a05122
https://github.com/scummvm/scummvm/commit/8dcb93f2ce04df49dea38f56bc97aef900a05122
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-02T16:29:44-07:00
Commit Message:
GOB: Draw the Penetration map and do basic movement
Changed paths:
engines/gob/minigames/geisha/penetration.cpp
engines/gob/minigames/geisha/penetration.h
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 77edebc..41346a8 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -170,7 +170,8 @@ const byte Penetration::kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight] =
Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _sprites(0), _objects(0),
- _shieldMeter(0), _healthMeter(0) {
+ _shieldMeter(0), _healthMeter(0), _floor(0), _mapUpdate(false), _mapX(0), _mapY(0),
+ _subTileX(0), _subTileY(0) {
_background = new Surface(320, 200, 1);
@@ -220,6 +221,9 @@ bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
// Aborting the game
if (key == kKeyEscape)
break;
+
+ // Handle the sub movement
+ handleSub(key);
}
deinit();
@@ -345,10 +349,18 @@ void Penetration::createMap() {
case 57: // Start position
_sprites->draw(*_map, 30, posX, posY);
*mapTile = 0;
+
+ _subTileX = x;
+ _subTileY = y;
+
+ _mapX = _subTileX * kMapTileWidth;
+ _mapY = _subTileY * kMapTileHeight;
break;
}
}
}
+
+ _mapUpdate = true;
}
void Penetration::initScreen() {
@@ -377,6 +389,27 @@ int16 Penetration::checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseB
return _vm->_util->checkKey();
}
+void Penetration::handleSub(int16 key) {
+ if (key == kKeyLeft)
+ moveSub(-5, 0);
+ else if (key == kKeyRight)
+ moveSub( 5, 0);
+ else if (key == kKeyUp)
+ moveSub( 0, -5);
+ else if (key == kKeyDown)
+ moveSub( 0, 5);
+}
+
+void Penetration::moveSub(int x, int y) {
+ _mapX = CLIP<int16>(_mapX + x, 0, kMapWidth * kMapTileWidth);
+ _mapY = CLIP<int16>(_mapY + y, 0, kMapHeight * kMapTileHeight);
+
+ _subTileX = _mapX / kMapTileWidth;
+ _subTileY = _mapY / kMapTileHeight;
+
+ _mapUpdate = true;
+}
+
void Penetration::updateAnims() {
int16 left, top, right, bottom;
@@ -388,6 +421,15 @@ void Penetration::updateAnims() {
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
}
+ if (_mapUpdate) {
+ _vm->_draw->_backSurface->blit(*_map, _mapX, _mapY,
+ _mapX + kPlayAreaWidth - 1, _mapY + kPlayAreaHeight - 1, kPlayAreaX, kPlayAreaY);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, kPlayAreaX, kPlayAreaY,
+ kPlayAreaX + kPlayAreaWidth - 1, kPlayAreaY + kPlayAreaHeight - 1);
+ }
+
+ _mapUpdate = false;
+
// Draw the current animation frames
for (Common::List<ANIObject *>::iterator a = _anims.begin();
a != _anims.end(); ++a) {
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index 897b109..72201d2 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -74,6 +74,13 @@ private:
Surface *_map;
byte _mapTiles[kMapWidth * kMapHeight];
+ bool _mapUpdate;
+ uint16 _mapX;
+ uint16 _mapY;
+
+ uint8 _subTileX;
+ uint8 _subTileY;
+
void init();
void deinit();
@@ -84,6 +91,9 @@ private:
void updateAnims();
int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
+
+ void handleSub(int16 key);
+ void moveSub(int x, int y);
};
} // End of namespace Geisha
Commit: 95e467d82cb36ee0d98624dd2cdd6d79b544c50c
https://github.com/scummvm/scummvm/commit/95e467d82cb36ee0d98624dd2cdd6d79b544c50c
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-02T16:29:44-07:00
Commit Message:
GOB: Display the Penetration submarine
Changed paths:
engines/gob/minigames/geisha/penetration.cpp
engines/gob/minigames/geisha/penetration.h
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 41346a8..377835c 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 72201d2..28a2889 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
More information about the Scummvm-git-logs
mailing list