aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorArnaud Boutonné2010-08-22 23:11:29 +0000
committerArnaud Boutonné2010-08-22 23:11:29 +0000
commitc8005dfb75d07ecc3db98562263c7b96feb19638 (patch)
tree4b92abadb44f1e5c326265dd62f811bb7b4755b0 /engines/gob
parent0348ca3e65292784126920eae38c9376aa113f8a (diff)
downloadscummvm-rg350-c8005dfb75d07ecc3db98562263c7b96feb19638.tar.gz
scummvm-rg350-c8005dfb75d07ecc3db98562263c7b96feb19638.tar.bz2
scummvm-rg350-c8005dfb75d07ecc3db98562263c7b96feb19638.zip
GOB - Fix 2 bugs in Fascination Hebrew, now playable.
Again, thanks SylvainTV for the debugging efforts svn-id: r52288
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/inter.h1
-rw-r--r--engines/gob/inter_fascin.cpp49
-rw-r--r--engines/gob/scenery.cpp23
3 files changed, 66 insertions, 7 deletions
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index c925d8cf72..b819c5e46a 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -432,6 +432,7 @@ protected:
void oFascin_playProtracker(OpGobParams &params);
+ bool oFascin_assign(OpFuncParams &params);
bool oFascin_copySprite(OpFuncParams &params);
bool oFascin_keyFunc(OpFuncParams &params);
diff --git a/engines/gob/inter_fascin.cpp b/engines/gob/inter_fascin.cpp
index 1758b4470d..8744ed5f89 100644
--- a/engines/gob/inter_fascin.cpp
+++ b/engines/gob/inter_fascin.cpp
@@ -33,6 +33,7 @@
#include "gob/dataio.h"
#include "gob/draw.h"
#include "gob/game.h"
+#include "gob/expression.h"
#include "gob/script.h"
#include "gob/palanim.h"
#include "gob/video.h"
@@ -87,7 +88,7 @@ void Inter_Fascination::setupOpcodesDraw() {
void Inter_Fascination::setupOpcodesFunc() {
Inter_v2::setupOpcodesFunc();
- OPCODEFUNC(0x09, o1_assign);
+ OPCODEFUNC(0x09, oFascin_assign);
OPCODEFUNC(0x32, oFascin_copySprite);
}
@@ -112,6 +113,52 @@ void Inter_Fascination::setupOpcodesGob() {
OPCODEGOB(1002, o2_stopProtracker);
}
+bool Inter_Fascination::oFascin_assign(OpFuncParams &params) {
+ byte destType = _vm->_game->_script->peekByte();
+ int16 dest = _vm->_game->_script->readVarIndex();
+
+ byte loopCount;
+ if (_vm->_game->_script->peekByte() == 99) {
+ _vm->_game->_script->skip(1);
+ loopCount = _vm->_game->_script->readByte();
+ } else
+ loopCount = 1;
+
+ for (int i = 0; i < loopCount; i++) {
+ int16 result;
+ int16 srcType = _vm->_game->_script->evalExpr(&result);
+
+ switch (destType) {
+ case TYPE_VAR_INT8: // 18
+ if (srcType != TYPE_IMM_INT16) { //20
+ char* str = _vm->_game->_script->getResultStr();
+ WRITE_VARO_STR(dest, str);
+ } else
+ WRITE_VARO_UINT8(dest + i, _vm->_game->_script->getResultInt());
+ break;
+
+ case TYPE_VAR_INT32_AS_INT16: // 24. Yes, it's really there
+ case TYPE_ARRAY_INT16: //27
+ WRITE_VARO_UINT16(dest + i * 2, _vm->_game->_script->getResultInt());
+ break;
+
+ case TYPE_VAR_INT32: // 23
+ case TYPE_ARRAY_INT32: // 26
+ WRITE_VAR_OFFSET(dest + i * 4, _vm->_game->_script->getResultInt()); // or *2 ?
+ break;
+
+ case TYPE_VAR_STR: // 25
+ case TYPE_ARRAY_STR: // 28
+ if (srcType == TYPE_IMM_INT16)
+ WRITE_VARO_UINT8(dest, result);
+ else
+ WRITE_VARO_STR(dest, _vm->_game->_script->getResultStr());
+ break;
+ }
+ }
+
+ return false;
+}
bool Inter_Fascination::oFascin_copySprite(OpFuncParams &params) {
_vm->_draw->_sourceSurface = _vm->_game->_script->readInt16();
diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp
index 75e242e6c5..a667d6615d 100644
--- a/engines/gob/scenery.cpp
+++ b/engines/gob/scenery.cpp
@@ -923,13 +923,24 @@ void Scenery::writeAnimLayerInfo(uint16 index, uint16 layer,
int16 varDX, int16 varDY, int16 varUnk0, int16 varFrames) {
assert(index < 10);
- assert(layer < _animations[index].layersCount);
- AnimLayer &animLayer = _animations[index].layers[layer];
- WRITE_VAR_OFFSET(varDX, animLayer.animDeltaX);
- WRITE_VAR_OFFSET(varDY, animLayer.animDeltaY);
- WRITE_VAR_OFFSET(varUnk0, animLayer.unknown0);
- WRITE_VAR_OFFSET(varFrames, animLayer.framesCount);
+// WORKAROUND - Fascination Hebrew is using scripts from the CD versions, but of course
+// no CD track, so the anim syncing failed, and the anims were suppressed. But they
+// didn't updated the scripts. Skipping the wrong anims is a solution.
+ if ((_vm->getGameType() == kGameTypeFascination) && (layer >= _animations[index].layersCount)) {
+ WRITE_VAR_OFFSET(varDX, 0);
+ WRITE_VAR_OFFSET(varDY, 0);
+ WRITE_VAR_OFFSET(varUnk0, 0);
+ WRITE_VAR_OFFSET(varFrames, 0);
+ } else {
+ assert(layer < _animations[index].layersCount);
+
+ AnimLayer &animLayer = _animations[index].layers[layer];
+ WRITE_VAR_OFFSET(varDX, animLayer.animDeltaX);
+ WRITE_VAR_OFFSET(varDY, animLayer.animDeltaY);
+ WRITE_VAR_OFFSET(varUnk0, animLayer.unknown0);
+ WRITE_VAR_OFFSET(varFrames, animLayer.framesCount);
+ }
}
int16 Scenery::getStaticLayersCount(uint16 index) {