From c2b26a45907040bdbd717e05b52d18d293db7f75 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 11 May 2002 14:55:03 +0000 Subject: once more changed the face direction calculation; allows to remove MI2 bridge hack in script_v1.cpp svn-id: r4277 --- actor.cpp | 29 ++++++++++++++++++++--------- script_v1.cpp | 8 -------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/actor.cpp b/actor.cpp index d0fab97f60..522e97a461 100644 --- a/actor.cpp +++ b/actor.cpp @@ -175,7 +175,8 @@ int Scumm::remapDirection(Actor * a, int dir) { int specdir; byte flags; - byte dirflag; + bool flipX; + bool flipY; if (!a->ignoreBoxes) { specdir = _extraBoxFlags[a->walkbox]; @@ -189,24 +190,32 @@ int Scumm::remapDirection(Actor * a, int dir) flags = getBoxFlags(a->walkbox); - dirflag = ((a->walkdata.XYFactor > 0) ? 1 : 0) | - ((a->walkdata.YXFactor > 0) ? 2 : 0); + flipX = (a->walkdata.XYFactor > 0); + flipY = (a->walkdata.YXFactor > 0); - if ((flags & 8) || getClass(a->number, 0x1E)) { + // Check for X-Flip + if ((flags & 0x08) || getClass(a->number, 0x1E)) { dir = 360 - dir; - dirflag ^= 1; + flipX = !flipX; } + // Check for Y-Flip if ((flags & 0x10) || getClass(a->number, 0x1D)) { dir = 180 - dir; - dirflag ^= 2; + flipY = !flipY; } switch (flags & 7) { case 1: - return (dirflag & 1) ? 90 : 270; + if (a->moving&~MF_TURN) // Actor is walking + return flipX ? 90 : 270; + else // Actor is standing/turning + return (dir == 90) ? 90 : 270; case 2: - return (dirflag & 2) ? 180 : 0; + if (a->moving&~MF_TURN) // Actor is walking + return flipY ? 180 : 0; + else // Actor is standing/turning + return (dir == 0) ? 0 : 180; case 3: return 270; case 4: @@ -253,7 +262,9 @@ int Scumm::updateActorDirection(Actor * a) } else from = to; - return fromSimpleDir(dirType, from & (num - 1)); + dir = fromSimpleDir(dirType, from & (num - 1)); + + return dir; } void Scumm::setActorBox(Actor * a, int box) diff --git a/script_v1.cpp b/script_v1.cpp index fdb2d3106c..90e26b8117 100644 --- a/script_v1.cpp +++ b/script_v1.cpp @@ -980,14 +980,6 @@ void Scumm::o5_cutscene() void Scumm::o5_endCutscene() { - // FIXME MI2: wrong direction/levitation of G. on the bridge - if ((_gameId == GID_MONKEY2) && (_currentRoom == 7) && - (vm.slot[_currentScript].number == 203)) { - Actor *a = derefActor(1); - if (a->x == 571) - a->facing = 90; - } - endCutscene(); } -- cgit v1.2.3