Implement roomOp 234

svn-id: r14913
This commit is contained in:
Eugene Sandulenko 2004-09-05 22:57:09 +00:00
parent 2c80f1c4d6
commit d21525d7fe
3 changed files with 30 additions and 1 deletions

View file

@ -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;