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
This commit is contained in:
parent
88f265d584
commit
459868da77
5 changed files with 75 additions and 24 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue