[Scummvm-cvs-logs] scummvm master -> 030509c8eb4544885dabf67b85f83d3b296230de
DrMcCoy
drmccoy at drmccoy.de
Sat Jun 2 23:14:39 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:
3eeb3d7416 GOB: Correctly name the Penetration script variables
585ceb566f GOB: Add animation handling frame to Penetration
030509c8eb GOB: Draw the shield and health meters in Penetration
Commit: 3eeb3d74163f2682bc27968df5e5e389174cdc1e
https://github.com/scummvm/scummvm/commit/3eeb3d74163f2682bc27968df5e5e389174cdc1e
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-02T14:14:12-07:00
Commit Message:
GOB: Correctly name the Penetration script variables
Changed paths:
engines/gob/inter_geisha.cpp
engines/gob/minigames/geisha/penetration.cpp
engines/gob/minigames/geisha/penetration.h
diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp
index 7f21ceb..99f834d 100644
--- a/engines/gob/inter_geisha.cpp
+++ b/engines/gob/inter_geisha.cpp
@@ -272,12 +272,12 @@ void Inter_Geisha::oGeisha_writeData(OpFuncParams ¶ms) {
}
void Inter_Geisha::oGeisha_gamePenetration(OpGobParams ¶ms) {
- uint16 var1 = _vm->_game->_script->readUint16();
- uint16 var2 = _vm->_game->_script->readUint16();
- uint16 var3 = _vm->_game->_script->readUint16();
- uint16 resultVar = _vm->_game->_script->readUint16();
+ uint16 hasAccessPass = _vm->_game->_script->readUint16();
+ uint16 hasMaxEnergy = _vm->_game->_script->readUint16();
+ uint16 testMode = _vm->_game->_script->readUint16();
+ uint16 resultVar = _vm->_game->_script->readUint16();
- bool result = _penetration->play(var1, var2, var3);
+ bool result = _penetration->play(hasAccessPass, hasMaxEnergy, testMode);
WRITE_VAR_UINT32(resultVar, result ? 1 : 0);
}
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 121a45b..153f2a6 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -62,7 +62,7 @@ Penetration::~Penetration() {
delete _background;
}
-bool Penetration::play(uint16 var1, uint16 var2, uint16 var3) {
+bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
init();
initScreen();
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index c346a7b..3f9aac7 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -39,7 +39,7 @@ public:
Penetration(GobEngine *vm);
~Penetration();
- bool play(uint16 var1, uint16 var2, uint16 var3);
+ bool play(bool hasAccessPass, bool hasMaxEnergy, bool testMode);
private:
GobEngine *_vm;
Commit: 585ceb566f27880ae7ea426efc70192b03a26d8d
https://github.com/scummvm/scummvm/commit/585ceb566f27880ae7ea426efc70192b03a26d8d
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-02T14:14:12-07:00
Commit Message:
GOB: Add animation handling frame to Penetration
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 153f2a6..1bdc574 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -25,7 +25,9 @@
#include "gob/draw.h"
#include "gob/video.h"
#include "gob/decfile.h"
+#include "gob/cmpfile.h"
#include "gob/anifile.h"
+#include "gob/aniobject.h"
#include "gob/minigames/geisha/penetration.h"
@@ -52,7 +54,7 @@ static const byte kPalette[48] = {
0x15, 0x3F, 0x15
};
-Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _objects(0) {
+Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _sprites(0), _objects(0) {
_background = new Surface(320, 200, 1);
}
@@ -68,11 +70,28 @@ bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
_vm->_draw->blitInvalidated();
_vm->_video->retrace();
- while (!_vm->_util->keyPressed() && !_vm->shouldQuit())
- _vm->_util->longDelay(1);
+
+ while (!_vm->shouldQuit()) {
+ updateAnims();
+
+ // Draw and wait for the end of the frame
+ _vm->_draw->blitInvalidated();
+ _vm->_util->waitEndFrame();
+
+ // Handle input
+ _vm->_util->processInput();
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ int16 key = checkInput(mouseX, mouseY, mouseButtons);
+ // Aborting the game
+ if (key == kKeyEscape)
+ break;
+ }
deinit();
- return true;
+ return false;
}
void Penetration::init() {
@@ -80,13 +99,18 @@ void Penetration::init() {
_vm->_video->drawPackedSprite("hyprmef2.cmp", *_background);
+ _sprites = new CMPFile(_vm, "tcifplai.cmp", 320, 200);
_objects = new ANIFile(_vm, "tcite.ani", 320);
}
void Penetration::deinit() {
+ _anims.clear();
+
delete _objects;
+ delete _sprites;
_objects = 0;
+ _sprites = 0;
}
void Penetration::initScreen() {
@@ -101,6 +125,34 @@ void Penetration::initScreen() {
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
}
+int16 Penetration::checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) {
+ _vm->_util->getMouseState(&mouseX, &mouseY, &mouseButtons);
+
+ return _vm->_util->checkKey();
+}
+
+void Penetration::updateAnims() {
+ int16 left, top, right, bottom;
+
+ // Clear the previous animation frames
+ for (Common::List<ANIObject *>::iterator a = _anims.reverse_begin();
+ a != _anims.end(); --a) {
+
+ (*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ }
+
+ // Draw the current animation frames
+ for (Common::List<ANIObject *>::iterator a = _anims.begin();
+ a != _anims.end(); ++a) {
+
+ (*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ (*a)->advance();
+ }
+}
+
} // End of namespace Geisha
} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index 3f9aac7..9bf8750 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -24,11 +24,13 @@
#define GOB_MINIGAMES_GEISHA_PENETRATION_H
#include "common/system.h"
+#include "common/list.h"
namespace Gob {
class GobEngine;
class Surface;
+class CMPFile;
class ANIFile;
namespace Geisha {
@@ -45,13 +47,20 @@ private:
GobEngine *_vm;
Surface *_background;
+ CMPFile *_sprites;
ANIFile *_objects;
+ Common::List<ANIObject *> _anims;
+
void init();
void deinit();
void initScreen();
+
+ void updateAnims();
+
+ int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
};
} // End of namespace Geisha
Commit: 030509c8eb4544885dabf67b85f83d3b296230de
https://github.com/scummvm/scummvm/commit/030509c8eb4544885dabf67b85f83d3b296230de
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-02T14:14:12-07:00
Commit Message:
GOB: Draw the shield and health meters in Penetration
Changed paths:
engines/gob/minigames/geisha/meter.cpp
engines/gob/minigames/geisha/meter.h
engines/gob/minigames/geisha/penetration.cpp
engines/gob/minigames/geisha/penetration.h
diff --git a/engines/gob/minigames/geisha/meter.cpp b/engines/gob/minigames/geisha/meter.cpp
index e3b9bd1..9dcc717 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 a9bdb14..d3e82cb 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 1bdc574..8b5de27 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 9bf8750..6c32d28 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();
More information about the Scummvm-git-logs
mailing list