aboutsummaryrefslogtreecommitdiff
path: root/scumm/script_v5.cpp
diff options
context:
space:
mode:
authorMax Horn2003-05-23 00:52:31 +0000
committerMax Horn2003-05-23 00:52:31 +0000
commit4fc70168b44a5703b56302fd62cf09d3e668ba7b (patch)
tree53ea465879a6ce7955c8c732662331605cc2d28e /scumm/script_v5.cpp
parentedf5946c408efebda37d37b4814822fb9578b141 (diff)
downloadscummvm-rg350-4fc70168b44a5703b56302fd62cf09d3e668ba7b.tar.gz
scummvm-rg350-4fc70168b44a5703b56302fd62cf09d3e668ba7b.tar.bz2
scummvm-rg350-4fc70168b44a5703b56302fd62cf09d3e668ba7b.zip
o5_walkActorToActor cleanup, and fixed for V2
svn-id: r7841
Diffstat (limited to 'scumm/script_v5.cpp')
-rw-r--r--scumm/script_v5.cpp52
1 files changed, 22 insertions, 30 deletions
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 757f073adc..8d04919a61 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -2353,54 +2353,46 @@ void Scumm_v5::o5_walkActorTo() {
}
void Scumm_v5::o5_walkActorToActor() {
- int b, x, y;
+ int x;
Actor *a, *a2;
- int nr;
- int nr2 = getVarOrDirectByte(0x80);
- a = derefActorSafe(nr2, "o5_walkActorToActor");
- assert(a);
-
- if (!a->isInCurrentRoom()) {
- getVarOrDirectByte(0x40);
- fetchScriptByte();
- return;
- }
+ int nr = getVarOrDirectByte(0x80);
+ int nr2 = getVarOrDirectByte(0x40);
+ int dist = fetchScriptByte();
- nr = getVarOrDirectByte(0x40);
if (nr == 106 && _gameId == GID_INDY4) {
warning("Bypassing Indy4 bug");
- fetchScriptByte();
return;
}
- // warning("walk actor %d to actor %d", nr, nr2);
- a2 = derefActorSafe(nr, "o5_walkActorToActor(2)");
- assert(a2);
- if (!a2->isInCurrentRoom()) {
- fetchScriptByte();
+ a = derefActorSafe(nr, "o5_walkActorToActor");
+ assert(a);
+ if (!a->isInCurrentRoom())
return;
- }
- b = fetchScriptByte(); /* distance from actor */
- if (b == 0xFF) {
- b = a2->scalex * a->width / 0xFF;
- b = b + b / 2;
+
+ a2 = derefActorSafe(nr2, "o5_walkActorToActor(2)");
+ assert(a2);
+ if (!a2->isInCurrentRoom())
+ return;
+
+ if (_features & GF_AFTER_V2)
+ dist *= 8;
+ else if (dist == 0xFF) {
+ dist = a2->scalex * a->width / 0xFF;
+ dist += dist / 2;
}
x = a2->x;
- y = a2->y;
if (x < a->x)
- x += b;
+ x += dist;
else
- x -= b;
-
- a->startWalkActor(x, y, -1);
+ x -= dist;
+
+ a->startWalkActor(x, a2->y, -1);
}
void Scumm_v5::o5_walkActorToObject() {
int obj;
Actor *a;
- // warning("walk object to object");
-
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_walkActorToObject");
obj = getVarOrDirectWord(0x40);
if (whereIsObject(obj) != WIO_NOT_FOUND) {