renamed fixActorDirection to setActorDirection; fixed a bug causing wrong actor directions
svn-id: r4260
This commit is contained in:
parent
dc0fef7cc9
commit
8dbcdc661f
5 changed files with 13 additions and 12 deletions
15
actor.cpp
15
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;
|
uint mask;
|
||||||
int i;
|
int i;
|
||||||
|
@ -433,7 +433,9 @@ void Scumm::fixActorDirection(Actor * a, int direction)
|
||||||
if (a->facing == direction)
|
if (a->facing == direction)
|
||||||
return;
|
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)
|
if (a->costume == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -740,12 +742,11 @@ void Scumm::startWalkAnim(Actor * a, int cmd, int angle)
|
||||||
} else {
|
} else {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 1: /* start walk */
|
case 1: /* start walk */
|
||||||
//a->facing = angle;
|
setActorDirection(a, angle);
|
||||||
fixActorDirection(a, angle);
|
|
||||||
startAnimActor(a, a->walkFrame);
|
startAnimActor(a, a->walkFrame);
|
||||||
break;
|
break;
|
||||||
case 2: /* change dir only */
|
case 2: /* change dir only */
|
||||||
fixActorDirection(a, angle);
|
setActorDirection(a, angle);
|
||||||
break;
|
break;
|
||||||
case 3: /* stop walk */
|
case 3: /* stop walk */
|
||||||
turnToDirection(a, angle);
|
turnToDirection(a, angle);
|
||||||
|
@ -775,7 +776,7 @@ void Scumm::walkActor(Actor * a)
|
||||||
if (a->moving & 4) {
|
if (a->moving & 4) {
|
||||||
j = updateActorDirection(a);
|
j = updateActorDirection(a);
|
||||||
if (a->facing != j)
|
if (a->facing != j)
|
||||||
fixActorDirection(a, j);
|
setActorDirection(a, j);
|
||||||
else
|
else
|
||||||
a->moving = 0;
|
a->moving = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -1361,7 +1362,7 @@ void Scumm::walkActorOld(Actor * a)
|
||||||
if (a->moving & 4) {
|
if (a->moving & 4) {
|
||||||
new_dir = updateActorDirection(a);
|
new_dir = updateActorDirection(a);
|
||||||
if (a->facing != new_dir) {
|
if (a->facing != new_dir) {
|
||||||
fixActorDirection(a, new_dir);
|
setActorDirection(a, new_dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a->moving = 0;
|
a->moving = 0;
|
||||||
|
|
|
@ -910,7 +910,7 @@ void Scumm::animateActor(int act, int anim)
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
a->moving &= ~4;
|
a->moving &= ~4;
|
||||||
fixActorDirection(a, dir);
|
setActorDirection(a, dir);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
turnToDirection(a, dir);
|
turnToDirection(a, dir);
|
||||||
|
@ -936,7 +936,7 @@ void Scumm::animateActor(int act, int anim)
|
||||||
break;
|
break;
|
||||||
case 0x3E:
|
case 0x3E:
|
||||||
a->moving &= ~4;
|
a->moving &= ~4;
|
||||||
fixActorDirection(a, oldDirToNewDir(dir));
|
setActorDirection(a, oldDirToNewDir(dir));
|
||||||
break;
|
break;
|
||||||
case 0x3D:
|
case 0x3D:
|
||||||
turnToDirection(a, oldDirToNewDir(dir));
|
turnToDirection(a, oldDirToNewDir(dir));
|
||||||
|
|
|
@ -2040,7 +2040,7 @@ void Scumm::o6_actorSet()
|
||||||
break;
|
break;
|
||||||
case 230: /* set direction */
|
case 230: /* set direction */
|
||||||
a->moving &= ~4;
|
a->moving &= ~4;
|
||||||
fixActorDirection(a, pop());
|
setActorDirection(a, pop());
|
||||||
break;
|
break;
|
||||||
case 231: /* turn to direction */
|
case 231: /* turn to direction */
|
||||||
turnToDirection(a, pop());
|
turnToDirection(a, pop());
|
||||||
|
|
2
scumm.h
2
scumm.h
|
@ -1066,7 +1066,7 @@ public:
|
||||||
void startAnimActorEx(Actor *a, int frame, int direction);
|
void startAnimActorEx(Actor *a, int frame, int direction);
|
||||||
int getProgrDirChange(Actor *a, int mode);
|
int getProgrDirChange(Actor *a, int mode);
|
||||||
void initActorCostumeData(Actor *a);
|
void initActorCostumeData(Actor *a);
|
||||||
void fixActorDirection(Actor *a, int direction);
|
void setActorDirection(Actor *a, int direction);
|
||||||
|
|
||||||
int getActorXYPos(Actor *a);
|
int getActorXYPos(Actor *a);
|
||||||
void adjustActorPos(Actor *a);
|
void adjustActorPos(Actor *a);
|
||||||
|
|
|
@ -476,7 +476,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr)
|
||||||
_currentRoom);
|
_currentRoom);
|
||||||
getObjectXYPos(objectNr);
|
getObjectXYPos(objectNr);
|
||||||
putActor(a, _xPos, _yPos, _currentRoom);
|
putActor(a, _xPos, _yPos, _currentRoom);
|
||||||
fixActorDirection(a, _dir + 180);
|
setActorDirection(a, _dir + 180);
|
||||||
a->moving = 0;
|
a->moving = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue