aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/op_cmd.cpp
diff options
context:
space:
mode:
authorJussi Pitkanen2011-06-25 12:06:28 +0300
committerEugene Sandulenko2011-08-13 23:27:24 +0100
commitaf691e46c4ccbe0457d2a7d5a4386d9287518740 (patch)
tree1f78d48f29b1ec5a2cd08341d13db27df4b2b583 /engines/agi/op_cmd.cpp
parent1dbe5bfccfb3d10b31ea9b5ac567165c650b3f98 (diff)
downloadscummvm-rg350-af691e46c4ccbe0457d2a7d5a4386d9287518740.tar.gz
scummvm-rg350-af691e46c4ccbe0457d2a7d5a4386d9287518740.tar.bz2
scummvm-rg350-af691e46c4ccbe0457d2a7d5a4386d9287518740.zip
AGI: Updates to V1 instruction table, plus an outcommented experiment
The experiment tries to implement the program control of the V1 interpreter. Maybe it is better to add another method for doing that once the workings of it are more clear.
Diffstat (limited to 'engines/agi/op_cmd.cpp')
-rw-r--r--engines/agi/op_cmd.cpp57
1 files changed, 55 insertions, 2 deletions
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index bd189eeac5..673cac450b 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1420,9 +1420,11 @@ void cmdSetString(AgiGame *state, uint8 *p) {
}
void cmdDisplay(AgiGame *state, uint8 *p) {
+ // V1 has 4 args
+ int t = (getVersion() >= 0x2000 ? p2 : p3);
int len = 40;
- char *s = state->_vm->wordWrapString(state->_curLogic->texts[p2 - 1], &len);
+ char *s = state->_vm->wordWrapString(state->_curLogic->texts[t - 1], &len);
state->_vm->printText(s, p1, 0, p0, 40, state->colorFg, state->colorBg);
@@ -1581,6 +1583,34 @@ void cmdSetSpeed(AgiGame *state, uint8 *p) {
(void)p;
}
+void cmdSetItemView(AgiGame *state, uint8 *p) {
+ // V1 command
+ (void)state;
+ (void)p;
+}
+
+void cmdCallV1(AgiGame *state, uint8 *p) {
+ state->_vm->agiLoadResource(rLOGIC, p0);
+ state->logic_list[++state->max_logics];
+ _v[13] = 1;
+}
+
+void cmdNewRoomV1(AgiGame *state, uint8 *p) {
+ warning("cmdNewRoomV1()");
+ state->_vm->agiLoadResource(rLOGIC, p0);
+ state->max_logics = 1;
+ state->logic_list[1] = p0;
+ _v[13] = 1;
+}
+
+void cmdNewRoomVV1(AgiGame *state, uint8 *p) {
+ warning("cmdNewRoomVV1()");
+ state->_vm->agiLoadResource(rLOGIC, _v[p0]);
+ state->max_logics = 1;
+ state->logic_list[1] = _v[p0];
+ _v[13] = 1;
+}
+
void cmdUnknown(AgiGame *state, uint8 *p) {
warning("Skipping unknown opcode %2X", *(code + ip - 1));
}
@@ -1595,6 +1625,10 @@ int AgiEngine::runLogic(int n) {
uint8 p[CMD_BSIZE] = { 0 };
int num = 0;
ScriptPos sp;
+ //int logic_index = 0;
+
+ state->logic_list[0] = 0;
+ state->max_logics = 0;
debugC(2, kDebugLevelScripts, "=================");
debugC(2, kDebugLevelScripts, "runLogic(%d)", n);
@@ -1659,6 +1693,18 @@ int AgiEngine::runLogic(int n) {
debugC(2, kDebugLevelScripts, "%sreturn() // Logic %d", st, n);
debugC(2, kDebugLevelScripts, "=================");
+// if (getVersion() < 0x2000) {
+// if (logic_index < state->max_logics) {
+// n = state->logic_list[++logic_index];
+// state->_curLogic = &state->logics[n];
+// state->lognum = n;
+// ip = 2;
+// warning("running logic %d\n", n);
+// break;
+// }
+// _v[13]=0;
+// }
+
_game.execStack.pop_back();
return 1;
default:
@@ -1672,6 +1718,14 @@ int AgiEngine::runLogic(int n) {
ip += num;
}
+// if ((op == 0x0B || op == 0x3F || op == 0x40) && logic_index < state->max_logics) {
+// n = state->logic_list[++logic_index];
+// state->_curLogic = &state->logics[n];
+// state->lognum = n;
+// ip = 2;
+// warning("running logic %d\n", n);
+// }
+
if (_game.exitAllLogics)
break;
}
@@ -1685,7 +1739,6 @@ void AgiEngine::executeAgiCommand(uint8 op, uint8 *p) {
debugC(2, kDebugLevelScripts, "%s(%d %d %d)", logicNamesCmd[op].name, p[0], p[1], p[2]);
_agiCommands[op](&_game, p);
-// (this->*_agiCommands[op])(p);
}
} // End of namespace Agi