aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/cheater.cpp34
-rw-r--r--engines/gob/cheater.h62
-rw-r--r--engines/gob/cheater_geisha.cpp66
-rw-r--r--engines/gob/console.cpp19
-rw-r--r--engines/gob/console.h8
-rw-r--r--engines/gob/gob.cpp4
-rw-r--r--engines/gob/gob.h3
-rw-r--r--engines/gob/inter.h4
-rw-r--r--engines/gob/inter_geisha.cpp9
-rw-r--r--engines/gob/inter_v1.cpp14
-rw-r--r--engines/gob/minigames/geisha/diving.cpp13
-rw-r--r--engines/gob/minigames/geisha/diving.h4
-rw-r--r--engines/gob/module.mk2
13 files changed, 223 insertions, 19 deletions
diff --git a/engines/gob/cheater.cpp b/engines/gob/cheater.cpp
new file mode 100644
index 0000000000..5c1f555389
--- /dev/null
+++ b/engines/gob/cheater.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "gob/gob.h"
+#include "gob/cheater.h"
+
+namespace Gob {
+
+Cheater::Cheater(GobEngine *vm) : _vm(vm) {
+}
+
+Cheater::~Cheater() {
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/cheater.h b/engines/gob/cheater.h
new file mode 100644
index 0000000000..334a5e88eb
--- /dev/null
+++ b/engines/gob/cheater.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GOB_CHEATER_H
+#define GOB_CHEATER_H
+
+namespace GUI {
+ class Debugger;
+}
+
+namespace Gob {
+
+namespace Geisha {
+ class Diving;
+}
+
+class GobEngine;
+
+class Cheater {
+public:
+ Cheater(GobEngine *vm);
+ virtual ~Cheater();
+
+ virtual bool cheat(GUI::Debugger &console) = 0;
+
+protected:
+ GobEngine *_vm;
+};
+
+class Cheater_Geisha : public Cheater {
+public:
+ Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving);
+ ~Cheater_Geisha();
+
+ bool cheat(GUI::Debugger &console);
+
+private:
+ Geisha::Diving *_diving;
+};
+
+} // End of namespace Gob
+
+#endif // GOB_CHEATER_H
diff --git a/engines/gob/cheater_geisha.cpp b/engines/gob/cheater_geisha.cpp
new file mode 100644
index 0000000000..3d8c56707d
--- /dev/null
+++ b/engines/gob/cheater_geisha.cpp
@@ -0,0 +1,66 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "gui/debugger.h"
+
+#include "gob/gob.h"
+#include "gob/cheater.h"
+#include "gob/inter.h"
+
+#include "gob/minigames/geisha/diving.h"
+
+namespace Gob {
+
+Cheater_Geisha::Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving) :
+ Cheater(vm), _diving(diving) {
+
+}
+
+Cheater_Geisha::~Cheater_Geisha() {
+}
+
+bool Cheater_Geisha::cheat(GUI::Debugger &console) {
+ // A cheat to get around the Diving minigame
+ if (_diving->isPlaying()) {
+ _diving->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);
+ uint32 digit2 = READ_VARO_UINT32(0x76C);
+ uint32 digit3 = READ_VARO_UINT32(0x770);
+ uint32 digit4 = READ_VARO_UINT32(0x774);
+ uint32 digit5 = READ_VARO_UINT32(0x778);
+
+ if (digit1 && digit2 && digit3 && digit4 && digit5)
+ console.DebugPrintf("Mastermind solution: %d %d %d %d %d\n",
+ digit1, digit2, digit3, digit4, digit5);
+
+ return true;
+ }
+
+ return true;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/console.cpp b/engines/gob/console.cpp
index e7296fb81b..76ccb70dca 100644
--- a/engines/gob/console.cpp
+++ b/engines/gob/console.cpp
@@ -24,22 +24,32 @@
#include "gob/gob.h"
#include "gob/inter.h"
#include "gob/dataio.h"
+#include "gob/cheater.h"
namespace Gob {
-GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm) {
+GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm), _cheater(0) {
DCmd_Register("varSize", WRAP_METHOD(GobConsole, cmd_varSize));
DCmd_Register("dumpVars", WRAP_METHOD(GobConsole, cmd_dumpVars));
DCmd_Register("var8", WRAP_METHOD(GobConsole, cmd_var8));
DCmd_Register("var16", WRAP_METHOD(GobConsole, cmd_var16));
DCmd_Register("var32", WRAP_METHOD(GobConsole, cmd_var32));
DCmd_Register("varString", WRAP_METHOD(GobConsole, cmd_varString));
+ DCmd_Register("cheat", WRAP_METHOD(GobConsole, cmd_cheat));
DCmd_Register("listArchives", WRAP_METHOD(GobConsole, cmd_listArchives));
}
GobConsole::~GobConsole() {
}
+void GobConsole::registerCheater(Cheater *cheater) {
+ _cheater = cheater;
+}
+
+void GobConsole::unregisterCheater() {
+ _cheater = 0;
+}
+
bool GobConsole::cmd_varSize(int argc, const char **argv) {
DebugPrintf("Size of the variable space: %d bytes\n", _vm->_inter->_variables->getSize());
return true;
@@ -155,6 +165,13 @@ bool GobConsole::cmd_varString(int argc, const char **argv) {
return true;
}
+bool GobConsole::cmd_cheat(int argc, const char **argv) {
+ if (_cheater)
+ return _cheater->cheat(*this);
+
+ return true;
+}
+
bool GobConsole::cmd_listArchives(int argc, const char **argv) {
Common::Array<ArchiveInfo> info;
diff --git a/engines/gob/console.h b/engines/gob/console.h
index b9c3f5ed70..5b6f0255dd 100644
--- a/engines/gob/console.h
+++ b/engines/gob/console.h
@@ -28,15 +28,21 @@
namespace Gob {
class GobEngine;
+class Cheater;
class GobConsole : public GUI::Debugger {
public:
GobConsole(GobEngine *vm);
virtual ~GobConsole(void);
+ void registerCheater(Cheater *cheater);
+ void unregisterCheater();
+
private:
GobEngine *_vm;
+ Cheater *_cheater;
+
bool cmd_varSize(int argc, const char **argv);
bool cmd_dumpVars(int argc, const char **argv);
bool cmd_var8(int argc, const char **argv);
@@ -44,6 +50,8 @@ private:
bool cmd_var32(int argc, const char **argv);
bool cmd_varString(int argc, const char **argv);
+ bool cmd_cheat(int argc, const char **argv);
+
bool cmd_listArchives(int argc, const char **argv);
};
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 51a117b7ec..4e7aa467b5 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -147,9 +147,9 @@ GobEngine::GobEngine(OSystem *syst) : Engine(syst), _rnd("gob") {
}
GobEngine::~GobEngine() {
- delete _console;
-
deinitGameParts();
+
+ delete _console;
}
const char *GobEngine::getLangDesc(int16 language) const {
diff --git a/engines/gob/gob.h b/engines/gob/gob.h
index 74c882e021..ea2323807a 100644
--- a/engines/gob/gob.h
+++ b/engines/gob/gob.h
@@ -160,7 +160,6 @@ private:
GameType _gameType;
int32 _features;
Common::Platform _platform;
- GobConsole *_console;
uint32 _pauseStart;
@@ -194,6 +193,8 @@ public:
bool _copyProtection;
bool _noMusic;
+ GobConsole *_console;
+
Global *_global;
Util *_util;
DataIO *_dataIO;
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 6fd4dc2187..c79b6e2260 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -33,6 +33,8 @@
namespace Gob {
+class Cheater_Geisha;
+
namespace Geisha {
class Diving;
class Penetration;
@@ -371,6 +373,8 @@ protected:
private:
Geisha::Diving *_diving;
Geisha::Penetration *_penetration;
+
+ Cheater_Geisha *_cheater;
};
class Inter_v2 : public Inter_v1 {
diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp
index 1f2a7fab7f..7f21ceb91d 100644
--- a/engines/gob/inter_geisha.cpp
+++ b/engines/gob/inter_geisha.cpp
@@ -34,6 +34,7 @@
#include "gob/game.h"
#include "gob/draw.h"
#include "gob/video.h"
+#include "gob/cheater.h"
#include "gob/save/saveload.h"
#include "gob/sound/sound.h"
#include "gob/sound/sounddesc.h"
@@ -53,9 +54,17 @@ 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);
+
+ _vm->_console->registerCheater(_cheater);
}
Inter_Geisha::~Inter_Geisha() {
+ _vm->_console->unregisterCheater();
+
+ delete _cheater;
+
delete _penetration;
delete _diving;
}
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 2d3f2ad731..9aa190a456 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -658,20 +658,6 @@ void Inter_v1::o1_callSub(OpFuncParams &params) {
return;
}
- // A cheat to get around the stupid mastermind puzzle in Geisha,
- // while we're still testing it
- if ((_vm->getGameType() == kGameTypeGeisha) && (offset == 12934) &&
- _vm->isCurrentTot("hard.tot") && _vm->_inter->_variables) {
-
- uint32 digit1 = READ_VARO_UINT32(0x768);
- uint32 digit2 = READ_VARO_UINT32(0x76C);
- uint32 digit3 = READ_VARO_UINT32(0x770);
- uint32 digit4 = READ_VARO_UINT32(0x774);
- uint32 digit5 = READ_VARO_UINT32(0x778);
-
- warning("Mastermind solution: %d %d %d %d %d", digit1, digit2, digit3, digit4, digit5);
- }
-
// Skipping the copy protection screen in Gobliiins
if (!_vm->_copyProtection && (_vm->getGameType() == kGameTypeGob1) && (offset == 3905) &&
_vm->isCurrentTot(_vm->_startTot)) {
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 3f7d6fc4b3..e097c1d523 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -92,7 +92,7 @@ const Diving::PlantLevel Diving::kPlantLevels[] = {
Diving::Diving(GobEngine *vm) : _vm(vm), _background(0),
_objects(0), _gui(0), _okoAnim(0), _lungs(0), _heart(0),
- _blackPearl(0), _airMeter(0), _healthMeter(0) {
+ _blackPearl(0), _airMeter(0), _healthMeter(0), _isPlaying(false) {
_blackPearl = new Surface(11, 8, 1);
@@ -127,6 +127,7 @@ Diving::~Diving() {
bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
_hasPearlLocation = hasPearlLocation;
+ _isPlaying = true;
// Fade to black
_vm->_palAnim->fade(0, 0, 0);
@@ -194,10 +195,20 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
deinit();
+ _isPlaying = false;
+
// The game succeeded when we got 2 black pearls
return _blackPearlCount >= 2;
}
+bool Diving::isPlaying() const {
+ return _isPlaying;
+}
+
+void Diving::cheatWin() {
+ _blackPearlCount = 2;
+}
+
void Diving::init() {
// Load sounds
_vm->_sound->sampleLoad(&_soundShoot , SOUND_SND, "tirgim.snd");
diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h
index 65ae06ec3e..089d60b260 100644
--- a/engines/gob/minigames/geisha/diving.h
+++ b/engines/gob/minigames/geisha/diving.h
@@ -51,6 +51,9 @@ public:
bool play(uint16 playerCount, bool hasPearlLocation);
+ bool isPlaying() const;
+ void cheatWin();
+
private:
static const uint kEvilFishCount = 3;
static const uint kDecorFishCount = 3;
@@ -148,6 +151,7 @@ private:
SoundDesc _soundBlackPearl;
bool _hasPearlLocation;
+ bool _isPlaying;
void init();
diff --git a/engines/gob/module.mk b/engines/gob/module.mk
index 09098f0ca9..1c83b4ae40 100644
--- a/engines/gob/module.mk
+++ b/engines/gob/module.mk
@@ -3,6 +3,8 @@ MODULE := engines/gob
MODULE_OBJS := \
anifile.o \
aniobject.o \
+ cheater.o \
+ cheater_geisha.o \
console.o \
dataio.o \
databases.o \