From c37577a950f7337889d5c705c9bc67d434ed3670 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 7 Jun 2012 04:29:10 +0200 Subject: GOB: Hook up the Penetration minigame in the cheater --- engines/gob/cheater.h | 6 ++++-- engines/gob/cheater_geisha.cpp | 11 +++++++++-- engines/gob/inter_geisha.cpp | 2 +- engines/gob/minigames/geisha/penetration.cpp | 18 +++++++++++++++++- engines/gob/minigames/geisha/penetration.h | 5 +++++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/engines/gob/cheater.h b/engines/gob/cheater.h index 334a5e88eb..bf6c1372fb 100644 --- a/engines/gob/cheater.h +++ b/engines/gob/cheater.h @@ -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 diff --git a/engines/gob/cheater_geisha.cpp b/engines/gob/cheater_geisha.cpp index 3d8c56707d..567333c12f 100644 --- a/engines/gob/cheater_geisha.cpp +++ b/engines/gob/cheater_geisha.cpp @@ -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); diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp index 99f834d4d7..75204a3f55 100644 --- a/engines/gob/inter_geisha.cpp +++ b/engines/gob/inter_geisha.cpp @@ -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); } diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp index e260d3cae2..9791757984 100644 --- a/engines/gob/minigames/geisha/penetration.cpp +++ b/engines/gob/minigames/geisha/penetration.cpp @@ -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: diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h index 0f36453017..0336ef8dcb 100644 --- a/engines/gob/minigames/geisha/penetration.h +++ b/engines/gob/minigames/geisha/penetration.h @@ -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(); -- cgit v1.2.3