diff options
author | Sven Hesse | 2007-07-26 01:01:00 +0000 |
---|---|---|
committer | Sven Hesse | 2007-07-26 01:01:00 +0000 |
commit | 459868da77de9cb6a4f1820fd7274b2bb38ecc52 (patch) | |
tree | 98d77555df533d3308a462c9abb0b41f1b6cc2f4 | |
parent | 88f265d5847d178e389e6d173e4eeb008495b16b (diff) | |
download | scummvm-rg350-459868da77de9cb6a4f1820fd7274b2bb38ecc52.tar.gz scummvm-rg350-459868da77de9cb6a4f1820fd7274b2bb38ecc52.tar.bz2 scummvm-rg350-459868da77de9cb6a4f1820fd7274b2bb38ecc52.zip |
sub0x18 is o2_addCollision().
It already existed in Gob2 (alongside with sub0x19 - o2_freeCollision()), but wasn't used there.
Hotspots and menus work now (in a way)
svn-id: r28207
-rw-r--r-- | engines/gob/game.h | 3 | ||||
-rw-r--r-- | engines/gob/inter.h | 4 | ||||
-rw-r--r-- | engines/gob/inter_v2.cpp | 69 | ||||
-rw-r--r-- | engines/gob/inter_v3.cpp | 4 | ||||
-rw-r--r-- | engines/gob/inter_v4.cpp | 19 |
5 files changed, 75 insertions, 24 deletions
diff --git a/engines/gob/game.h b/engines/gob/game.h index 0cef993b40..2b684a179f 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -152,6 +152,8 @@ public: void totSub(int8 flags, const char *newTotFile); void switchTotSub(int16 index, int16 skipPlay); + void freeCollision(int16 id); + virtual void playTot(int16 skipPlay) = 0; virtual void clearCollisions(void) = 0; @@ -221,7 +223,6 @@ protected: void loadImFile(void); void setCollisions(void); - void freeCollision(int16 id); void collSub(uint16 offset); void collAreaSub(int16 index, int8 enter); int16 openLocTextFile(char *locTextFile, int language); diff --git a/engines/gob/inter.h b/engines/gob/inter.h index 59a1ba3ccc..65d810412a 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -379,6 +379,8 @@ protected: bool o2_evaluateStore(OpFuncParams ¶ms); bool o2_printText(OpFuncParams ¶ms); bool o2_animPalInit(OpFuncParams ¶ms); + bool o2_addCollision(OpFuncParams ¶ms); + bool o2_freeCollision(OpFuncParams ¶ms); bool o2_goblinFunc(OpFuncParams ¶ms); bool o2_createSprite(OpFuncParams ¶ms); bool o2_stopSound(OpFuncParams ¶ms); @@ -514,8 +516,6 @@ protected: virtual const char *getOpcodeDrawDesc(byte i); virtual const char *getOpcodeFuncDesc(byte i, byte j); virtual const char *getOpcodeGoblinDesc(int i); - - bool o4_stub0x18(OpFuncParams ¶ms); }; } // End of namespace Gob diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 9fe5904ff7..c78aa9e017 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -485,8 +485,8 @@ void Inter_v2::setupOpcodes() { OPCODE(o1_capturePop), OPCODE(o2_animPalInit), /* 18 */ - {NULL, ""}, - {NULL, ""}, + OPCODE(o2_addCollision), + OPCODE(o2_freeCollision), {NULL, ""}, {NULL, ""}, /* 1C */ @@ -1733,6 +1733,71 @@ bool Inter_v2::o2_animPalInit(OpFuncParams ¶ms) { return false; } +bool Inter_v2::o2_addCollision(OpFuncParams ¶ms) { + int16 id; + int16 left, top, width, height; + int16 flags; + int16 key; + int16 funcSub; + + id = _vm->_parse->parseValExpr(); + funcSub = _vm->_global->_inter_execPtr - _vm->_game->_totFileData; + left = _vm->_parse->parseValExpr(); + top = _vm->_parse->parseValExpr(); + width = _vm->_parse->parseValExpr(); + height = _vm->_parse->parseValExpr(); + flags = _vm->_parse->parseValExpr(); + key = load16(); + + if (key == 0) + key = ABS(id) + 41960; + + _vm->_draw->adjustCoords(0, &left, &top); + _vm->_draw->adjustCoords(2, &width, &height); + + if (left < 0) { + width += left; + left = 0; + } + + if (top < 0) { + height += top; + top = 0; + } + + int16 index; + if (id < 0) + index = _vm->_game->addNewCollision(0xD000 - id, left & 0xFFFC, top & 0xFFFC, + left + width + 3, top + height + 3, flags, key, 0, 0); + else + index = _vm->_game->addNewCollision(0xE000 + id, left, top, + left + width - 1, top + height - 1, flags, key, 0, 0); + + _vm->_game->_collisionAreas[index].funcSub = funcSub; + + return false; +} + +bool Inter_v2::o2_freeCollision(OpFuncParams ¶ms) { + int16 id; + + id = _vm->_parse->parseValExpr(); + if (id == -2) { + for (int i = 0; i < 150; i++) { + if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xD000) + _vm->_game->_collisionAreas[i].left = 0xFFFF; + } + } else if (id == -1) { + for (int i = 0; i < 150; i++) { + if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xE000) + _vm->_game->_collisionAreas[i].left = 0xFFFF; + } + } else + _vm->_game->freeCollision(0xE000 + id); + + return false; +} + bool Inter_v2::o2_goblinFunc(OpFuncParams ¶ms) { OpGobParams gobParams; int16 cmd; diff --git a/engines/gob/inter_v3.cpp b/engines/gob/inter_v3.cpp index ef0a7d6477..18601b9ed7 100644 --- a/engines/gob/inter_v3.cpp +++ b/engines/gob/inter_v3.cpp @@ -473,8 +473,8 @@ void Inter_v3::setupOpcodes() { OPCODE(o1_capturePop), OPCODE(o2_animPalInit), /* 18 */ - {NULL, ""}, - {NULL, ""}, + OPCODE(o2_addCollision), + OPCODE(o2_freeCollision), OPCODE(o3_getTotTextItemPart), {NULL, ""}, /* 1C */ diff --git a/engines/gob/inter_v4.cpp b/engines/gob/inter_v4.cpp index 02b6927f3b..776fc1df10 100644 --- a/engines/gob/inter_v4.cpp +++ b/engines/gob/inter_v4.cpp @@ -473,8 +473,8 @@ void Inter_v4::setupOpcodes() { OPCODE(o1_capturePop), OPCODE(o2_animPalInit), /* 18 */ - OPCODE(o4_stub0x18), - {NULL, ""}, + OPCODE(o2_addCollision), + OPCODE(o2_freeCollision), OPCODE(o3_getTotTextItemPart), {NULL, ""}, /* 1C */ @@ -712,19 +712,4 @@ const char *Inter_v4::getOpcodeGoblinDesc(int i) { return ""; } -bool Inter_v4::o4_stub0x18(OpFuncParams ¶ms) { - int16 val1 = _vm->_parse->parseValExpr(); - int16 val2 = _vm->_parse->parseValExpr(); - int16 val3 = _vm->_parse->parseValExpr(); - int16 val4 = _vm->_parse->parseValExpr(); - int16 val5 = _vm->_parse->parseValExpr(); - int16 val6 = _vm->_parse->parseValExpr(); - int16 val7 = load16(); - - warning("Stub! Woodruff Func 0x18: %d, %d, %d, %d, %d, %d, %d", - val1, val2, val3, val4, val5, val6, val7); - - return false; -} - } // End of namespace Gob |