aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/op_test.cpp
diff options
context:
space:
mode:
authorJussi Pitkanen2011-06-16 18:58:14 +0300
committerEugene Sandulenko2011-08-13 23:27:10 +0100
commit9bc25749d6433b3c7c843406d04ad49b1bd1fd77 (patch)
tree7fbff0c4a33748d775da4dc55b27836b2b13cb96 /engines/agi/op_test.cpp
parentd02251fa4df9dc9e575a8f7e6705f5ef8384a2fd (diff)
downloadscummvm-rg350-9bc25749d6433b3c7c843406d04ad49b1bd1fd77.tar.gz
scummvm-rg350-9bc25749d6433b3c7c843406d04ad49b1bd1fd77.tar.bz2
scummvm-rg350-9bc25749d6433b3c7c843406d04ad49b1bd1fd77.zip
AGI: Implement V1 SAID test commands
Yes, V1 has three versions of SAID, for one, two and three arguments. Also add a few corrections to V1 instruction tables.
Diffstat (limited to 'engines/agi/op_test.cpp')
-rw-r--r--engines/agi/op_test.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp
index 7ccd30e42a..ee4f99b428 100644
--- a/engines/agi/op_test.cpp
+++ b/engines/agi/op_test.cpp
@@ -23,6 +23,7 @@
#include "agi/agi.h"
#include "agi/opcodes.h"
+#include "common/endian.h"
namespace Agi {
@@ -83,6 +84,10 @@ void cond_issetv(AgiGame *state, uint8 *p) {
state->ec = testIsSet(getvar(p[1]));
}
+void cond_isset_v1(AgiGame *state, uint8 *p) {
+ state->ec = getvar(p[0]) > 0;
+}
+
void cond_has(AgiGame *state, uint8 *p) {
state->ec = testHas(p[0]);
}
@@ -108,6 +113,48 @@ void cond_said(AgiGame *state, uint8 *p) {
state->ec = ec;
}
+void cond_said1(AgiGame *state, uint8 *p) {
+ state->ec = false;
+
+ if (!getflag(fEnteredCli))
+ return;
+
+ int id0 = READ_LE_UINT16(p);
+
+ if ((id0 == 1 || id0 == state->egoWords[0].id))
+ state->ec = true;
+}
+
+void cond_said2(AgiGame *state, uint8 *p) {
+ state->ec = false;
+
+ if (!getflag(fEnteredCli))
+ return;
+
+ int id0 = READ_LE_UINT16(p);
+ int id1 = READ_LE_UINT16(p + 2);
+
+ if ((id0 == 1 || id0 == state->egoWords[0].id) &&
+ (id1 == 1 || id1 == state->egoWords[1].id))
+ state->ec = true;
+}
+
+void cond_said3(AgiGame *state, uint8 *p) {
+ state->ec = false;
+
+ if (!getflag(fEnteredCli))
+ return;
+
+ int id0 = READ_LE_UINT16(p);
+ int id1 = READ_LE_UINT16(p + 2);
+ int id2 = READ_LE_UINT16(p + 4);
+
+ if ((id0 == 1 || id0 == state->egoWords[0].id) &&
+ (id1 == 1 || id1 == state->egoWords[1].id) &&
+ (id2 == 1 || id2 == state->egoWords[2].id))
+ state->ec = true;
+}
+
void cond_compare_strings(AgiGame *state, uint8 *p) {
debugC(7, kDebugLevelScripts, "comparing [%s], [%s]", state->strings[p[0]], state->strings[p[1]]);
state->ec = state->_vm->testCompareStrings(p[0], p[1]);