From e4a1193d22142be750e20ab0a32f03f8c11cf950 Mon Sep 17 00:00:00 2001 From: Jussi Pitkanen Date: Fri, 17 Jun 2011 16:07:43 +0300 Subject: AGI: Add last undefined V1 test command that tests if a bit of var is set Also fix skipInstruction() for V1. --- engines/agi/op_test.cpp | 6 +++++- engines/agi/opcodes.cpp | 4 ++-- engines/agi/opcodes.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index 70d0cc0483..a99a4eafc4 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -155,6 +155,10 @@ void condSaid3(AgiGame *state, uint8 *p) { state->testResult = true; } +void condBit(AgiGame *state, uint8 *p) { + state->testResult = (getvar(p[1]) >> p[0]) & 1; +} + void condCompareStrings(AgiGame *state, uint8 *p) { debugC(7, kDebugLevelScripts, "comparing [%s], [%s]", state->strings[p[0]], state->strings[p[1]]); state->testResult = state->_vm->testCompareStrings(p[0], p[1]); @@ -446,7 +450,7 @@ void AgiEngine::skipInstruction(byte op) { AgiGame *state = &_game; if (op >= 0xFC) return; - if (op == 0x0E) // said + if (op == 0x0E && state->_vm->getVersion() >= 0x2000) // said ip += *(code + ip) * 2 + 1; else ip += logicNamesTest[op].argumentsLength(); diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp index b2bccd8a3c..ba7f587d11 100644 --- a/engines/agi/opcodes.cpp +++ b/engines/agi/opcodes.cpp @@ -36,7 +36,7 @@ AgiInstruction insV1Test[] = { { "lessv", "vv", &condLessV }, // 04 { "greatern", "vn", &condGreater }, // 05 { "greaterv", "vv", &condGreaterV }, // 06 - { "isset", "v", &condIsSetV1 }, // 07 + { "isset", "v", &condIsSetV1 }, // 07 { "has", "n", &condHas }, // 08 { "said", "nnnn", &condSaid2 }, // 09 { "posn", "nnnnn", &condPosn }, // 0A @@ -45,7 +45,7 @@ AgiInstruction insV1Test[] = { { "said", "nnnnnn", &condSaid3 }, // 0D { "have.key", "", &condHaveKey }, // 0E { "said", "nn", &condSaid1 }, // 0F - { "bit", "nv", &condUnknown }, // 10 + { "bit", "nv", &condBit }, // 10 }; AgiInstruction insV1[] = { diff --git a/engines/agi/opcodes.h b/engines/agi/opcodes.h index 742b0d5fe9..f45a52b611 100644 --- a/engines/agi/opcodes.h +++ b/engines/agi/opcodes.h @@ -249,6 +249,7 @@ void condIsSetV1(AgiGame *state, uint8 *p); void condSaid1(AgiGame *state, uint8 *p); void condSaid2(AgiGame *state, uint8 *p); void condSaid3(AgiGame *state, uint8 *p); +void condBit(AgiGame *state, uint8 *p); } // End of namespace Agi -- cgit v1.2.3