aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Boutonné2009-08-13 09:59:44 +0000
committerArnaud Boutonné2009-08-13 09:59:44 +0000
commitfc74ec86466fe949dc89c1ba4d47e43a66083e15 (patch)
tree4280ce516a3e207e5322c37ffb0866e1bf6cecba
parent6bcc9a45fd63c35f4060fee81989d5cb1c0f833f (diff)
downloadscummvm-rg350-fc74ec86466fe949dc89c1ba4d47e43a66083e15.tar.gz
scummvm-rg350-fc74ec86466fe949dc89c1ba4d47e43a66083e15.tar.bz2
scummvm-rg350-fc74ec86466fe949dc89c1ba4d47e43a66083e15.zip
- Add a specific OPCODEFUNC checkData to avoid having a Playtoons workaround in working code
- Replace OPCODEDRAW 0x20,0x23 and 0x25 svn-id: r43345
-rw-r--r--dists/msvc8/gob.vcproj1
-rw-r--r--dists/msvc9/gob.vcproj1
-rw-r--r--engines/gob/gob.cpp8
-rw-r--r--engines/gob/inter.h15
-rw-r--r--engines/gob/inter_playtoons.cpp141
-rw-r--r--engines/gob/module.mk1
6 files changed, 163 insertions, 4 deletions
diff --git a/dists/msvc8/gob.vcproj b/dists/msvc8/gob.vcproj
index c691aae742..85f5e4bb86 100644
--- a/dists/msvc8/gob.vcproj
+++ b/dists/msvc8/gob.vcproj
@@ -103,6 +103,7 @@
<File RelativePath="..\..\engines\gob\inter.h" />
<File RelativePath="..\..\engines\gob\inter_bargon.cpp" />
<File RelativePath="..\..\engines\gob\inter_fascin.cpp" />
+ <File RelativePath="..\..\engines\gob\inter_playtoons.cpp" />
<File RelativePath="..\..\engines\gob\inter_v1.cpp" />
<File RelativePath="..\..\engines\gob\inter_v2.cpp" />
<File RelativePath="..\..\engines\gob\inter_v3.cpp" />
diff --git a/dists/msvc9/gob.vcproj b/dists/msvc9/gob.vcproj
index 984c153e35..70932ee04d 100644
--- a/dists/msvc9/gob.vcproj
+++ b/dists/msvc9/gob.vcproj
@@ -104,6 +104,7 @@
<File RelativePath="..\..\engines\gob\inter.h" />
<File RelativePath="..\..\engines\gob\inter_bargon.cpp" />
<File RelativePath="..\..\engines\gob\inter_fascin.cpp" />
+ <File RelativePath="..\..\engines\gob\inter_playtoons.cpp" />
<File RelativePath="..\..\engines\gob\inter_v1.cpp" />
<File RelativePath="..\..\engines\gob\inter_v2.cpp" />
<File RelativePath="..\..\engines\gob\inter_v3.cpp" />
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 082345e675..a348fbdb08 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -460,14 +460,14 @@ bool GobEngine::initGameParts() {
case kGameTypePlaytnCk:
case kGameTypeBambou:
_init = new Init_v2(this);
- _video = new Video_v2(this);
- _inter = new Inter_v6(this);
+ _video = new Video_v6(this);
+ _inter = new Inter_Playtoons(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
_map = new Map_v2(this);
- _goblin = new Goblin_v2(this);
+ _goblin = new Goblin_v4(this);
_scenery = new Scenery_v2(this);
- _saveLoad = new SaveLoad_Playtoons(this);
+ _saveLoad = new SaveLoad_Playtoons(this, _targetName.c_str());
break;
default:
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index a31860885f..a0c5ee9cca 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -547,6 +547,21 @@ protected:
void probe16bitMusic(char *fileName);
};
+class Inter_Playtoons : public Inter_v6 {
+public:
+ Inter_Playtoons(GobEngine *vm);
+ virtual ~Inter_Playtoons() {}
+
+protected:
+ virtual void setupOpcodesDraw();
+ virtual void setupOpcodesFunc();
+ virtual void setupOpcodesGob();
+
+ bool Inter_Playtoons::oPlaytoons_checkData(OpFuncParams &params);
+ void Inter_Playtoons::oPlaytoons_CD_20_23();
+ void Inter_Playtoons::oPlaytoons_CD_25();
+};
+
} // End of namespace Gob
#endif // GOB_INTER_H
diff --git a/engines/gob/inter_playtoons.cpp b/engines/gob/inter_playtoons.cpp
new file mode 100644
index 0000000000..285360c613
--- /dev/null
+++ b/engines/gob/inter_playtoons.cpp
@@ -0,0 +1,141 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/endian.h"
+
+#include "gob/gob.h"
+#include "gob/inter.h"
+#include "gob/global.h"
+#include "gob/util.h"
+#include "gob/dataio.h"
+#include "gob/draw.h"
+#include "gob/game.h"
+#include "gob/script.h"
+#include "gob/palanim.h"
+#include "gob/video.h"
+#include "gob/videoplayer.h"
+#include "gob/save/saveload.h"
+#include "gob/sound/sound.h"
+
+namespace Gob {
+
+#define OPCODEVER Inter_Playtoons
+#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
+#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
+#define OPCODEGOB(i, x) _opcodesGob[i]._OPCODEGOB(OPCODEVER, x)
+
+Inter_Playtoons::Inter_Playtoons(GobEngine *vm) : Inter_v6(vm) {
+}
+
+void Inter_Playtoons::setupOpcodesDraw() {
+ Inter_v6::setupOpcodesDraw();
+
+// In the code, the Draw codes 0x00 to 0x06 and 0x13 are replaced by an engrish
+// error message. As it's useless, they are simply cleared.
+ CLEAROPCODEDRAW(0x00);
+ CLEAROPCODEDRAW(0x01);
+ CLEAROPCODEDRAW(0x02);
+ CLEAROPCODEDRAW(0x03);
+ CLEAROPCODEDRAW(0x04);
+ CLEAROPCODEDRAW(0x05);
+ CLEAROPCODEDRAW(0x06);
+ CLEAROPCODEDRAW(0x13);
+
+ CLEAROPCODEDRAW(0x21);
+ CLEAROPCODEDRAW(0x22);
+ CLEAROPCODEDRAW(0x24);
+
+ OPCODEDRAW(0x20, oPlaytoons_CD_20_23);
+ OPCODEDRAW(0x23, oPlaytoons_CD_20_23);
+ OPCODEDRAW(0x25, oPlaytoons_CD_25);
+}
+
+void Inter_Playtoons::setupOpcodesFunc() {
+ Inter_v6::setupOpcodesFunc();
+
+ OPCODEFUNC(0x3F, oPlaytoons_checkData);
+}
+
+void Inter_Playtoons::setupOpcodesGob() {
+}
+
+bool Inter_Playtoons::oPlaytoons_checkData(OpFuncParams &params) {
+ int16 handle;
+ int16 varOff;
+ int32 size;
+ SaveLoad::SaveMode mode;
+
+ _vm->_game->_script->evalExpr(0);
+ varOff = _vm->_game->_script->readVarIndex();
+
+ size = -1;
+ handle = 1;
+
+ char *file = _vm->_game->_script->getResultStr();
+
+ // WORKAROUND: In Playtoons games, some files are read on CD (and only on CD).
+ // In this case, "@:\" is replaced by the CD drive letter.
+ // As the files are copied on the HDD, those characters are skipped.
+ if (strncmp(file, "@:\\", 3) == 0) {
+ debugC(2, kDebugFileIO, "File check: \"%s\" instead of \"%s\"", file + 3, file);
+ file += 3;
+ }
+
+ mode = _vm->_saveLoad->getSaveMode(file);
+ if (mode == SaveLoad::kSaveModeNone) {
+
+ if (_vm->_dataIO->existData(file))
+ size = _vm->_dataIO->getDataSize(file);
+ else
+ warning("File \"%s\" not found", file);
+
+ } else if (mode == SaveLoad::kSaveModeSave)
+ size = _vm->_saveLoad->getSize(file);
+ else if (mode == SaveLoad::kSaveModeExists)
+ size = 23;
+
+ if (size == -1)
+ handle = -1;
+
+ debugC(2, kDebugFileIO, "Requested size of file \"%s\": %d",
+ file, size);
+
+ WRITE_VAR_OFFSET(varOff, handle);
+ WRITE_VAR(16, (uint32) size);
+
+ return false;
+}
+
+void Inter_Playtoons::oPlaytoons_CD_20_23() {
+ _vm->_game->_script->evalExpr(0);
+}
+
+void Inter_Playtoons::oPlaytoons_CD_25() {
+ _vm->_game->_script->readVarIndex();
+ _vm->_game->_script->readVarIndex();
+}
+
+
+} // End of namespace Gob
diff --git a/engines/gob/module.mk b/engines/gob/module.mk
index 26cc4e5d27..5b26cb97d4 100644
--- a/engines/gob/module.mk
+++ b/engines/gob/module.mk
@@ -30,6 +30,7 @@ MODULE_OBJS := \
inter_v2.o \
inter_bargon.o \
inter_fascin.o \
+ inter_playtoons.o \
inter_v3.o \
inter_v4.o \
inter_v5.o \