aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2012-06-02 23:12:25 +0200
committerSven Hesse2012-06-02 23:14:12 +0200
commit030509c8eb4544885dabf67b85f83d3b296230de (patch)
treea91eb037da7b64c4fbeae174dcfe07646d030456 /engines
parent585ceb566f27880ae7ea426efc70192b03a26d8d (diff)
downloadscummvm-rg350-030509c8eb4544885dabf67b85f83d3b296230de.tar.gz
scummvm-rg350-030509c8eb4544885dabf67b85f83d3b296230de.tar.bz2
scummvm-rg350-030509c8eb4544885dabf67b85f83d3b296230de.zip
GOB: Draw the shield and health meters in Penetration
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/minigames/geisha/meter.cpp4
-rw-r--r--engines/gob/minigames/geisha/meter.h2
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp39
-rw-r--r--engines/gob/minigames/geisha/penetration.h8
4 files changed, 52 insertions, 1 deletions
diff --git a/engines/gob/minigames/geisha/meter.cpp b/engines/gob/minigames/geisha/meter.cpp
index e3b9bd1ccf..9dcc717e48 100644
--- a/engines/gob/minigames/geisha/meter.cpp
+++ b/engines/gob/minigames/geisha/meter.cpp
@@ -42,6 +42,10 @@ Meter::~Meter() {
delete _surface;
}
+int32 Meter::getMaxValue() const {
+ return _maxValue;
+}
+
int32 Meter::getValue() const {
return _value;
}
diff --git a/engines/gob/minigames/geisha/meter.h b/engines/gob/minigames/geisha/meter.h
index a9bdb14d0f..d3e82cb32e 100644
--- a/engines/gob/minigames/geisha/meter.h
+++ b/engines/gob/minigames/geisha/meter.h
@@ -44,6 +44,8 @@ public:
Direction direction);
~Meter();
+ /** Return the max value the meter is measuring. */
+ int32 getMaxValue() const;
/** Return the current value the meter is measuring. */
int32 getValue() const;
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 1bdc574aa3..8b5de27ad2 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -30,6 +30,7 @@
#include "gob/aniobject.h"
#include "gob/minigames/geisha/penetration.h"
+#include "gob/minigames/geisha/meter.h"
namespace Gob {
@@ -54,17 +55,29 @@ static const byte kPalette[48] = {
0x15, 0x3F, 0x15
};
-Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _sprites(0), _objects(0) {
+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);
}
Penetration::~Penetration() {
deinit();
+ delete _shieldMeter;
+ delete _healthMeter;
+
delete _background;
}
bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
+ _hasAccessPass = hasAccessPass;
+ _hasMaxEnergy = hasMaxEnergy;
+ _testMode = testMode;
+
init();
initScreen();
@@ -101,6 +114,23 @@ 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);
+
+ // If we don't have the max energy tokens, the health starts at 1/3 strength
+ if (_hasMaxEnergy)
+ _healthMeter->setMaxValue();
+ else
+ _healthMeter->setValue(_healthMeter->getMaxValue() / 3);
}
void Penetration::deinit() {
@@ -151,6 +181,13 @@ void Penetration::updateAnims() {
(*a)->advance();
}
+
+ // Draw the meters
+ _shieldMeter->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ _healthMeter->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
}
} // End of namespace Geisha
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index 9bf87503f0..6c32d28942 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -35,6 +35,8 @@ class ANIFile;
namespace Geisha {
+class Meter;
+
/** Geisha's "Penetration" minigame. */
class Penetration {
public:
@@ -46,12 +48,18 @@ public:
private:
GobEngine *_vm;
+ bool _hasAccessPass;
+ bool _hasMaxEnergy;
+ bool _testMode;
+
Surface *_background;
CMPFile *_sprites;
ANIFile *_objects;
Common::List<ANIObject *> _anims;
+ Meter *_shieldMeter;
+ Meter *_healthMeter;
void init();
void deinit();