AGI: Add last undefined V1 test command that tests if a bit of var is set

Also fix skipInstruction() for V1.
This commit is contained in:
Jussi Pitkanen 2011-06-17 16:07:43 +03:00 committed by Eugene Sandulenko
parent 2289ba88b6
commit e4a1193d22
3 changed files with 8 additions and 3 deletions

View file

@ -155,6 +155,10 @@ void condSaid3(AgiGame *state, uint8 *p) {
state->testResult = true; state->testResult = true;
} }
void condBit(AgiGame *state, uint8 *p) {
state->testResult = (getvar(p[1]) >> p[0]) & 1;
}
void condCompareStrings(AgiGame *state, uint8 *p) { void condCompareStrings(AgiGame *state, uint8 *p) {
debugC(7, kDebugLevelScripts, "comparing [%s], [%s]", state->strings[p[0]], state->strings[p[1]]); debugC(7, kDebugLevelScripts, "comparing [%s], [%s]", state->strings[p[0]], state->strings[p[1]]);
state->testResult = state->_vm->testCompareStrings(p[0], p[1]); state->testResult = state->_vm->testCompareStrings(p[0], p[1]);
@ -446,7 +450,7 @@ void AgiEngine::skipInstruction(byte op) {
AgiGame *state = &_game; AgiGame *state = &_game;
if (op >= 0xFC) if (op >= 0xFC)
return; return;
if (op == 0x0E) // said if (op == 0x0E && state->_vm->getVersion() >= 0x2000) // said
ip += *(code + ip) * 2 + 1; ip += *(code + ip) * 2 + 1;
else else
ip += logicNamesTest[op].argumentsLength(); ip += logicNamesTest[op].argumentsLength();

View file

@ -36,7 +36,7 @@ AgiInstruction insV1Test[] = {
{ "lessv", "vv", &condLessV }, // 04 { "lessv", "vv", &condLessV }, // 04
{ "greatern", "vn", &condGreater }, // 05 { "greatern", "vn", &condGreater }, // 05
{ "greaterv", "vv", &condGreaterV }, // 06 { "greaterv", "vv", &condGreaterV }, // 06
{ "isset", "v", &condIsSetV1 }, // 07 { "isset", "v", &condIsSetV1 }, // 07
{ "has", "n", &condHas }, // 08 { "has", "n", &condHas }, // 08
{ "said", "nnnn", &condSaid2 }, // 09 { "said", "nnnn", &condSaid2 }, // 09
{ "posn", "nnnnn", &condPosn }, // 0A { "posn", "nnnnn", &condPosn }, // 0A
@ -45,7 +45,7 @@ AgiInstruction insV1Test[] = {
{ "said", "nnnnnn", &condSaid3 }, // 0D { "said", "nnnnnn", &condSaid3 }, // 0D
{ "have.key", "", &condHaveKey }, // 0E { "have.key", "", &condHaveKey }, // 0E
{ "said", "nn", &condSaid1 }, // 0F { "said", "nn", &condSaid1 }, // 0F
{ "bit", "nv", &condUnknown }, // 10 { "bit", "nv", &condBit }, // 10
}; };
AgiInstruction insV1[] = { AgiInstruction insV1[] = {

View file

@ -249,6 +249,7 @@ void condIsSetV1(AgiGame *state, uint8 *p);
void condSaid1(AgiGame *state, uint8 *p); void condSaid1(AgiGame *state, uint8 *p);
void condSaid2(AgiGame *state, uint8 *p); void condSaid2(AgiGame *state, uint8 *p);
void condSaid3(AgiGame *state, uint8 *p); void condSaid3(AgiGame *state, uint8 *p);
void condBit(AgiGame *state, uint8 *p);
} // End of namespace Agi } // End of namespace Agi