aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-05-10 13:45:32 +0000
committerMax Horn2002-05-10 13:45:32 +0000
commit8dbcdc661f574fe85412f4081574a1ed075410fc (patch)
treee4c384fa155c032b95883d8e1990adc086b6e472
parentdc0fef7cc961a7811a18f064905bf4650b0cf5bf (diff)
downloadscummvm-rg350-8dbcdc661f574fe85412f4081574a1ed075410fc.tar.gz
scummvm-rg350-8dbcdc661f574fe85412f4081574a1ed075410fc.tar.bz2
scummvm-rg350-8dbcdc661f574fe85412f4081574a1ed075410fc.zip
renamed fixActorDirection to setActorDirection; fixed a bug causing wrong actor directions
svn-id: r4260
-rw-r--r--actor.cpp15
-rw-r--r--script.cpp4
-rw-r--r--script_v2.cpp2
-rw-r--r--scumm.h2
-rw-r--r--scummvm.cpp2
5 files changed, 13 insertions, 12 deletions
diff --git a/actor.cpp b/actor.cpp
index 896104acfb..f4e3981511 100644
--- a/actor.cpp
+++ b/actor.cpp
@@ -424,7 +424,7 @@ void Scumm::startAnimActor(Actor * a, int frame)
}
}
-void Scumm::fixActorDirection(Actor * a, int direction)
+void Scumm::setActorDirection(Actor * a, int direction)
{
uint mask;
int i;
@@ -433,7 +433,9 @@ void Scumm::fixActorDirection(Actor * a, int direction)
if (a->facing == direction)
return;
- a->facing = direction;
+ // Make sure the direction is between 0 and 359 degree.
+ // We add 360 to be able to cope with negative directions.
+ a->facing = (direction+360) % 360;
if (a->costume == 0)
return;
@@ -740,12 +742,11 @@ void Scumm::startWalkAnim(Actor * a, int cmd, int angle)
} else {
switch (cmd) {
case 1: /* start walk */
- //a->facing = angle;
- fixActorDirection(a, angle);
+ setActorDirection(a, angle);
startAnimActor(a, a->walkFrame);
break;
case 2: /* change dir only */
- fixActorDirection(a, angle);
+ setActorDirection(a, angle);
break;
case 3: /* stop walk */
turnToDirection(a, angle);
@@ -775,7 +776,7 @@ void Scumm::walkActor(Actor * a)
if (a->moving & 4) {
j = updateActorDirection(a);
if (a->facing != j)
- fixActorDirection(a, j);
+ setActorDirection(a, j);
else
a->moving = 0;
return;
@@ -1361,7 +1362,7 @@ void Scumm::walkActorOld(Actor * a)
if (a->moving & 4) {
new_dir = updateActorDirection(a);
if (a->facing != new_dir) {
- fixActorDirection(a, new_dir);
+ setActorDirection(a, new_dir);
return;
}
a->moving = 0;
diff --git a/script.cpp b/script.cpp
index f7d7f297f4..c52c47db7b 100644
--- a/script.cpp
+++ b/script.cpp
@@ -910,7 +910,7 @@ void Scumm::animateActor(int act, int anim)
break;
case 3:
a->moving &= ~4;
- fixActorDirection(a, dir);
+ setActorDirection(a, dir);
break;
case 4:
turnToDirection(a, dir);
@@ -936,7 +936,7 @@ void Scumm::animateActor(int act, int anim)
break;
case 0x3E:
a->moving &= ~4;
- fixActorDirection(a, oldDirToNewDir(dir));
+ setActorDirection(a, oldDirToNewDir(dir));
break;
case 0x3D:
turnToDirection(a, oldDirToNewDir(dir));
diff --git a/script_v2.cpp b/script_v2.cpp
index 95aa114360..863aa99320 100644
--- a/script_v2.cpp
+++ b/script_v2.cpp
@@ -2040,7 +2040,7 @@ void Scumm::o6_actorSet()
break;
case 230: /* set direction */
a->moving &= ~4;
- fixActorDirection(a, pop());
+ setActorDirection(a, pop());
break;
case 231: /* turn to direction */
turnToDirection(a, pop());
diff --git a/scumm.h b/scumm.h
index cf96b79487..55fbcc0e5e 100644
--- a/scumm.h
+++ b/scumm.h
@@ -1066,7 +1066,7 @@ public:
void startAnimActorEx(Actor *a, int frame, int direction);
int getProgrDirChange(Actor *a, int mode);
void initActorCostumeData(Actor *a);
- void fixActorDirection(Actor *a, int direction);
+ void setActorDirection(Actor *a, int direction);
int getActorXYPos(Actor *a);
void adjustActorPos(Actor *a);
diff --git a/scummvm.cpp b/scummvm.cpp
index 79226584f1..930165fbf8 100644
--- a/scummvm.cpp
+++ b/scummvm.cpp
@@ -476,7 +476,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr)
_currentRoom);
getObjectXYPos(objectNr);
putActor(a, _xPos, _yPos, _currentRoom);
- fixActorDirection(a, _dir + 180);
+ setActorDirection(a, _dir + 180);
a->moving = 0;
}