aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/minigames
diff options
context:
space:
mode:
authorSven Hesse2012-06-03 03:40:04 +0200
committerSven Hesse2012-06-03 03:40:04 +0200
commit5a245bd4f2cbac8aee4efe7220533f41d6418312 (patch)
tree8075263ef76ca5d40c79afbd8d61e2dbbc25b3d3 /engines/gob/minigames
parent627e870629cdab1009d3279453d082a3c44acd03 (diff)
downloadscummvm-rg350-5a245bd4f2cbac8aee4efe7220533f41d6418312.tar.gz
scummvm-rg350-5a245bd4f2cbac8aee4efe7220533f41d6418312.tar.bz2
scummvm-rg350-5a245bd4f2cbac8aee4efe7220533f41d6418312.zip
GOB: Consume shields in Penetration
Diffstat (limited to 'engines/gob/minigames')
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp27
-rw-r--r--engines/gob/minigames/geisha/penetration.h12
2 files changed, 39 insertions, 0 deletions
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index c8fbe31249..e4e7798216 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -193,6 +193,10 @@ const byte Penetration::kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight] =
};
+Penetration::Position::Position(uint16 pX, uint16 pY) : x(pX), y(pY) {
+}
+
+
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) {
@@ -303,6 +307,8 @@ void Penetration::createMap() {
// Copy the correct map
memcpy(_mapTiles, kMaps[_testMode ? 1 : 0][_floor], kMapWidth * kMapHeight);
+ _shields.clear();
+
_map->fill(kColorBlack);
// Draw the map tiles
@@ -378,6 +384,8 @@ void Penetration::createMap() {
_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
+
+ _shields.push_back(Position(x, y));
break;
case 57: // Start position
@@ -473,6 +481,25 @@ void Penetration::moveSub(int x, int y, uint16 animation) {
if (_sub->getAnimation() != animation)
_sub->setAnimation(animation);
+
+ checkShields();
+}
+
+void Penetration::checkShields() {
+ for (Common::List<Position>::iterator pos = _shields.begin(); pos != _shields.end(); ++pos) {
+ if ((pos->x == _subTileX) && (pos->y == _subTileY)) {
+ // Charge shields
+ _shieldMeter->setMaxValue();
+
+ // Erase the shield from the map
+ const int mapX = kPlayAreaBorderWidth + pos->x * kMapTileWidth;
+ const int mapY = kPlayAreaBorderHeight + pos->y * kMapTileHeight;
+ _sprites->draw(*_map, 30, mapX, mapY);
+
+ _shields.erase(pos);
+ break;
+ }
+ }
}
void Penetration::updateAnims() {
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index 9109cb5c68..4d3455b638 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -54,6 +54,13 @@ private:
static const byte kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight];
+ struct Position {
+ uint16 x;
+ uint16 y;
+
+ Position(uint16 pX, uint16 pY);
+ };
+
GobEngine *_vm;
bool _hasAccessPass;
@@ -83,6 +90,9 @@ private:
uint8 _subTileX;
uint8 _subTileY;
+ Common::List<Position> _shields;
+
+
void init();
void deinit();
@@ -98,6 +108,8 @@ private:
void moveSub(int x, int y, uint16 animation);
bool isWalkable(byte tile) const;
+
+ void checkShields();
};
} // End of namespace Geisha