diff --git a/engines/agi/id.cpp b/engines/agi/id.cpp index 7286738be3d..eb1d570889c 100644 --- a/engines/agi/id.cpp +++ b/engines/agi/id.cpp @@ -114,6 +114,14 @@ int AgiEngine::setupV3Game(int ver, uint32 crc) { logicNamesCmd[0xad].numArgs = 1; } + // FIXME: Apply this fix to other games also that use 2 arguments for command 182. + // 'adj.ego.move.to.x.y' (i.e. command 182) takes 2 arguments for at least the + // Amiga Gold Rush! (v2.05 1989-03-09) using Amiga AGI 2.316. Amiga's Gold Rush + // has been set to use AGI 3.149 in ScummVM so that's why this initialization is + // here and not in setupV2Game. + if (getGameID() == GID_GOLDRUSH && getPlatform() == Common::kPlatformAmiga) + logicNamesCmd[182].numArgs = 2; + return ec; } diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index c4532941d6b..78054e84b4c 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -180,10 +180,18 @@ int AgiEngine::handleController(int key) { if (!(getFeatures() & GF_AGIMOUSE)) { /* Handle mouse button events */ if (key == BUTTON_LEFT) { - v->flags |= ADJ_EGO_XY; - v->parm1 = WIN_TO_PIC_X(g_mouse.x); - v->parm2 = WIN_TO_PIC_Y(g_mouse.y); - return true; + // FIXME: Implement adj.ego.move.to.x.y-command properly (With 2 arguments) and remove this hack. + // This is a hack for preventing mouse usage in the mines (Rooms 147-162) in Amiga Gold Rush as + // moving with mouse bugs in the mines because adj.ego.move.to.x.y isn't properly implemented yet. + if (getGameID() == GID_GOLDRUSH && getPlatform() == Common::kPlatformAmiga && _game.vars[0] >= 147 && _game.vars[0] <= 162) { + messageBox("Use yer arrow keys ta walk."); + return true; + } else { + v->flags |= ADJ_EGO_XY; + v->parm1 = WIN_TO_PIC_X(g_mouse.x); + v->parm2 = WIN_TO_PIC_Y(g_mouse.y); + return true; + } } } diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 9e2d48feb38..6f98a00af59 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -664,7 +664,20 @@ cmd(release_key) { } cmd(adj_ego_move_to_x_y) { - game.viewTable[0].flags |= ADJ_EGO_XY; + switch (logicNamesCmd[182].numArgs) { + case 2: + // TODO: Implement the 2 arguments using variant of 'adj.ego.move.to.x.y'. + // It's used at least in Amiga Gold Rush! (v2.05 1989-03-09, Amiga AGI 2.316) + // in logics 130 and 150 (Using arguments (0, 0), (0, 7), (0, 8), (9, 9), (-9, 9)). + // I may be wrong about the (-9, 9) argument pair though, it may just be (247, 9). + debugC(4, kDebugLevelScripts, "Unsupported command adj.ego.move.to.x.y(%d, %d)", + (int8) p0, (int8) p1); + break; + case 0: + default: + game.viewTable[0].flags |= ADJ_EGO_XY; + break; + } } cmd(parse) { diff --git a/engines/agi/op_dbg.cpp b/engines/agi/op_dbg.cpp index 0676f944e45..cd7442c81c4 100644 --- a/engines/agi/op_dbg.cpp +++ b/engines/agi/op_dbg.cpp @@ -269,6 +269,8 @@ struct AgiLogicnames logicNamesCmd[] = { _L("fence.mouse", 4, 0x00), /* B3 */ _L("mouse.posn", 2, 0x00), /* B4 */ _L("release.key", 0, 0x00), /* B5 */ + + /* 2 args for at least the Amiga Gold Rush! (v2.05 1989-03-09) using Amiga AGI 2.316. */ _L("adj.ego.move.to.xy", 0, 0x00), /* B6 */ _L(NULL, 0, 0x00) };