aboutsummaryrefslogtreecommitdiff
path: root/scumm/script_v6he.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2004-09-05 22:57:09 +0000
committerEugene Sandulenko2004-09-05 22:57:09 +0000
commitd21525d7fe93b9b6d15c442a1263149e89eb70bc (patch)
tree720eb3a1de4c8d6475da1c20f5b88b1aca8749a7 /scumm/script_v6he.cpp
parent2c80f1c4d66eaf5ba0c9537265755fab4112ca3b (diff)
downloadscummvm-rg350-d21525d7fe93b9b6d15c442a1263149e89eb70bc.tar.gz
scummvm-rg350-d21525d7fe93b9b6d15c442a1263149e89eb70bc.tar.bz2
scummvm-rg350-d21525d7fe93b9b6d15c442a1263149e89eb70bc.zip
Implement roomOp 234
svn-id: r14913
Diffstat (limited to 'scumm/script_v6he.cpp')
-rw-r--r--scumm/script_v6he.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp
index 1b53af05c1..5ff7d026f9 100644
--- a/scumm/script_v6he.cpp
+++ b/scumm/script_v6he.cpp
@@ -535,7 +535,7 @@ void ScummEngine_v6he::o6_roomOps() {
case 234: // HE 7.2
b = pop();
a = pop();
- warning("o6_roomOps: case %d (%d, %d)", op, b, a);
+ swapObjects(a, b);
break;
case 236: // HE 7.2
b = pop();
@@ -547,6 +547,32 @@ void ScummEngine_v6he::o6_roomOps() {
}
}
+void ScummEngine_v6he::swapObjects(int object1, int object2) {
+ int idx1 = -1, idx2 = -1;
+
+ if (_numObjectsInRoom >= 0) { // how could it be negative?
+ for (int i = 0; i < _numObjectsInRoom; i++) {
+ if (_objs[i].obj_nr == object1)
+ idx1 = i;
+
+ if (_objs[i].obj_nr == object2)
+ idx2 = i;
+ }
+ }
+
+ if (idx1 == -1 || idx2 == -1 || idx1 >= idx2)
+ return;
+
+ stopObjectScript(object1);
+ stopObjectScript(object2);
+
+ struct ObjectData tmpOd;
+
+ memcpy(&tmpOd, &_objs[idx1], sizeof(tmpOd));
+ memcpy(&_objs[idx1], &_objs[idx2], sizeof(tmpOd));
+ memcpy(&_objs[idx2], &tmpOd, sizeof(tmpOd));
+}
+
void ScummEngine_v6he::o6_actorOps() {
Actor *a;
int i, j, k;