renamed fixActorDirection to setActorDirection; fixed a bug causing wrong actor directions

svn-id: r4260
This commit is contained in:
Max Horn 2002-05-10 13:45:32 +00:00
parent dc0fef7cc9
commit 8dbcdc661f
5 changed files with 13 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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