GOB: Hook up the Penetration minigame in the cheater

This commit is contained in:
Sven Hesse 2012-06-07 04:29:10 +02:00
parent 3d537e763c
commit c37577a950
5 changed files with 36 additions and 6 deletions

View file

@ -31,6 +31,7 @@ namespace Gob {
namespace Geisha {
class Diving;
class Penetration;
}
class GobEngine;
@ -48,13 +49,14 @@ protected:
class Cheater_Geisha : public Cheater {
public:
Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving);
Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving, Geisha::Penetration *penetration);
~Cheater_Geisha();
bool cheat(GUI::Debugger &console);
private:
Geisha::Diving *_diving;
Geisha::Diving *_diving;
Geisha::Penetration *_penetration;
};
} // End of namespace Gob

View file

@ -27,11 +27,12 @@
#include "gob/inter.h"
#include "gob/minigames/geisha/diving.h"
#include "gob/minigames/geisha/penetration.h"
namespace Gob {
Cheater_Geisha::Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving) :
Cheater(vm), _diving(diving) {
Cheater_Geisha::Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving, Geisha::Penetration *penetration) :
Cheater(vm), _diving(diving), _penetration(penetration) {
}
@ -45,6 +46,12 @@ bool Cheater_Geisha::cheat(GUI::Debugger &console) {
return false;
}
// A cheat to get around the Penetration minigame
if (_penetration->isPlaying()) {
_penetration->cheatWin();
return false;
}
// A cheat to get around the mastermind puzzle
if (_vm->isCurrentTot("hard.tot") && _vm->_inter->_variables) {
uint32 digit1 = READ_VARO_UINT32(0x768);

View file

@ -55,7 +55,7 @@ Inter_Geisha::Inter_Geisha(GobEngine *vm) : Inter_v1(vm),
_diving = new Geisha::Diving(vm);
_penetration = new Geisha::Penetration(vm);
_cheater = new Cheater_Geisha(vm, _diving);
_cheater = new Cheater_Geisha(vm, _diving, _penetration);
_vm->_console->registerCheater(_cheater);
}

View file

@ -377,7 +377,7 @@ Penetration::ManagedSub::~ManagedSub() {
Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _sprites(0), _objects(0), _sub(0),
_shieldMeter(0), _healthMeter(0), _floor(0) {
_shieldMeter(0), _healthMeter(0), _floor(0), _isPlaying(false) {
_background = new Surface(320, 200, 1);
@ -404,6 +404,8 @@ bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
_hasMaxEnergy = hasMaxEnergy;
_testMode = testMode;
_isPlaying = true;
init();
initScreen();
@ -432,9 +434,19 @@ bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
deinit();
drawEndText();
_isPlaying = false;
return hasWon();
}
bool Penetration::isPlaying() const {
return _isPlaying;
}
void Penetration::cheatWin() {
_floor = 3;
}
void Penetration::init() {
// Load sounds
_vm->_sound->sampleLoad(&_soundShield, SOUND_SND, "boucl.snd");
@ -748,6 +760,10 @@ void Penetration::checkInput() {
_keys[kKeyRight] = true;
else if (event.kbd.keycode == Common::KEYCODE_SPACE)
_keys[kKeySpace] = true;
else if (event.kbd.keycode == Common::KEYCODE_d) {
_vm->getDebugger()->attach();
_vm->getDebugger()->onFrame();
}
break;
case Common::EVENT_KEYUP:

View file

@ -50,6 +50,9 @@ public:
bool play(bool hasAccessPass, bool hasMaxEnergy, bool testMode);
bool isPlaying() const;
void cheatWin();
private:
static const int kModeCount = 2;
static const int kFloorCount = 3;
@ -141,6 +144,8 @@ private:
SoundDesc _soundShoot;
SoundDesc _soundExit;
bool _isPlaying;
void init();
void deinit();