aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/op_cmd.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2011-08-11 16:58:04 +0100
committerEugene Sandulenko2011-08-13 23:27:27 +0100
commit3fb50b815e78b9284497deb6ead60a6efff02453 (patch)
tree03f99691e629104772fb39fab5b6e4ada3b13924 /engines/agi/op_cmd.cpp
parentaf691e46c4ccbe0457d2a7d5a4386d9287518740 (diff)
downloadscummvm-rg350-3fb50b815e78b9284497deb6ead60a6efff02453.tar.gz
scummvm-rg350-3fb50b815e78b9284497deb6ead60a6efff02453.tar.bz2
scummvm-rg350-3fb50b815e78b9284497deb6ead60a6efff02453.zip
AGI: Further work on v1 opcode difference
Diffstat (limited to 'engines/agi/op_cmd.cpp')
-rw-r--r--engines/agi/op_cmd.cpp70
1 files changed, 62 insertions, 8 deletions
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 673cac450b..62606911dc 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -56,8 +56,13 @@ namespace Agi {
#define getflag(a) state->_vm->getflag(a)
void cmdIncrement(AgiGame *state, uint8 *p) {
- if (_v[p0] != 0xff)
- ++_v[p0];
+ if (getVersion() < 0x2000) {
+ if (_v[p0] < 0xf0)
+ ++_v[p0];
+ } else {
+ if (_v[p0] != 0xff)
+ ++_v[p0];
+ }
}
void cmdDecrement(AgiGame *state, uint8 *p) {
@@ -115,6 +120,10 @@ void cmdDivV(AgiGame *state, uint8 *p) {
_v[p0] /= _v[p1];
}
+void cmdRandomV1(AgiGame *state, uint8 *p) {
+ _v[p0] = state->_vm->_rnd->getRandomNumber(250);
+}
+
void cmdRandom(AgiGame *state, uint8 *p) {
_v[p2] = state->_vm->_rnd->getRandomNumber(p1 - p0) + p0;
}
@@ -399,6 +408,10 @@ void cmdGet(AgiGame *state, uint8 *p) {
state->_vm->objectSetLocation(p0, EGO_OWNED);
}
+void cmdGetV1(AgiGame *state, uint8 *p) {
+ state->_vm->objectSetLocation(p0, EGO_OWNED_V1);
+}
+
void cmdGetF(AgiGame *state, uint8 *p) {
state->_vm->objectSetLocation(_v[p0], EGO_OWNED);
}
@@ -732,6 +745,16 @@ void cmdCallF(AgiGame *state, uint8 *p) {
cmdCall(state, &_v[p0]);
}
+void cmdDrawPicV1(AgiGame *state, uint8 *p) {
+ debugC(6, kDebugLevelScripts, "=== draw pic V1 %d ===", _v[p0]);
+ state->_vm->_picture->decodePicture(_v[p0], true);
+
+ state->_vm->clearPrompt();
+
+ // Simulate slowww computer. Many effects rely on this
+ state->_vm->pause(kPausePicture);
+}
+
void cmdDrawPic(AgiGame *state, uint8 *p) {
debugC(6, kDebugLevelScripts, "=== draw pic %d ===", _v[p0]);
state->_vm->_sprites->eraseBoth();
@@ -811,11 +834,21 @@ void cmdShowPriScreen(AgiGame *state, uint8 *p) {
}
void cmdAnimateObj(AgiGame *state, uint8 *p) {
- if (vt.flags & ANIMATED)
- return;
+ if (getVersion() < 0x2000) {
+ if (vt.flags & DIDNT_MOVE)
+ return;
+ } else {
+ if (vt.flags & ANIMATED)
+ return;
+ }
debugC(4, kDebugLevelScripts, "animate vt entry #%d", p0);
vt.flags = ANIMATED | UPDATE | CYCLING;
+
+ if (getVersion() < 0x2000) {
+ vt.flags |= DIDNT_MOVE;
+ }
+
vt.motion = MOTION_NORMAL;
vt.cycle = CYCLE_NORMAL;
vt.direction = 0;
@@ -918,6 +951,11 @@ void cmdPosition(AgiGame *state, uint8 *p) {
state->_vm->clipViewCoordinates(&vt);
}
+void cmdPositionV1(AgiGame *state, uint8 *p) {
+ vt.xPos = p1;
+ vt.yPos = p2;
+}
+
void cmdPositionF(AgiGame *state, uint8 *p) {
vt.xPos = vt.xPos2 = _v[p1];
vt.yPos = vt.yPos2 = _v[p2];
@@ -929,6 +967,11 @@ void cmdPositionF(AgiGame *state, uint8 *p) {
state->_vm->clipViewCoordinates(&vt);
}
+void cmdPositionFV1(AgiGame *state, uint8 *p) {
+ vt.xPos = _v[p1];
+ vt.yPos = _v[p2];
+}
+
void cmdGetPosn(AgiGame *state, uint8 *p) {
state->vars[p1] = (unsigned char)vt.xPos;
state->vars[p2] = (unsigned char)vt.yPos;
@@ -1045,8 +1088,14 @@ void cmdFollowEgo(AgiGame *state, uint8 *p) {
vt.parm1 = p1 > vt.stepSize ? p1 : vt.stepSize;
vt.parm2 = p2;
vt.parm3 = 0xff;
- setflag(p2, false);
- vt.flags |= UPDATE;
+
+ if (getVersion() < 0x2000) {
+ _v[p2] = 0;
+ vt.flags |= UPDATE | ANIMATED;
+ } else {
+ setflag(p2, false);
+ vt.flags |= UPDATE;
+ }
}
void cmdMoveObj(AgiGame *state, uint8 *p) {
@@ -1061,8 +1110,13 @@ void cmdMoveObj(AgiGame *state, uint8 *p) {
if (p3 != 0)
vt.stepSize = p3;
- setflag(p4, false);
- vt.flags |= UPDATE;
+ if (getVersion() < 0x2000) {
+ _v[p4] = 0;
+ vt.flags |= UPDATE | ANIMATED;
+ } else {
+ setflag(p4, false);
+ vt.flags |= UPDATE;
+ }
if (p0 == 0)
state->playerControl = false;