SCUMM: Re-arrange some things to make it closer to the original

This commit is contained in:
segrax 2012-01-21 17:50:55 +11:00 committed by Tobias Gunkel
parent e331421eae
commit a999aa39ba
4 changed files with 42 additions and 35 deletions

View file

@ -319,6 +319,9 @@ int Actor::actorWalkStep() {
int distX, distY;
int nextFacing;
if( _vm->_game.version == 0 )
((ActorC64*) this)->_byte_FD0A = -1;
_needRedraw = true;
nextFacing = updateActorDirection(true);
@ -857,18 +860,6 @@ void Actor::setDirection(int direction) {
if (_costume == 0)
return;
// V0 MM
if (_vm->_game.version == 0) {
if (_moving)
_vm->_costumeLoader->costumeDecodeData(this, _walkFrame, 0);
else
_vm->_costumeLoader->costumeDecodeData(this, _standFrame, 0);
_needRedraw = true;
return;
}
// Update the costume for the new direction (and mark the actor for redraw)
aMask = 0x8000;
for (i = 0; i < 16; i++, aMask >>= 1) {
@ -881,6 +872,27 @@ void Actor::setDirection(int direction) {
_needRedraw = true;
}
void ActorC64::setDirection(int direction) {
// Normalize the angle
_facing = normalizeAngle(direction);
// 0x2C17
// _byte_FDE8 = -1;
// If there is no costume set for this actor, we are finished
if (_costume == 0)
return;
if (_moving)
_vm->_costumeLoader->costumeDecodeData(this, _walkFrame, 0);
else {
_vm->_costumeLoader->costumeDecodeData(this, _standFrame, 0);
}
_needRedraw = true;
}
void Actor::faceToObject(int obj) {
int x2, y2, dir;
@ -898,10 +910,6 @@ void Actor::turnToDirection(int newdir) {
if (newdir == -1 || _ignoreTurns)
return;
// 0x2C17
if( _vm->_game.version == 0 )
((ActorC64*) this)->_byte_FD0A = -1;
if (_vm->_game.version <= 6) {
_moving = MF_TURN;
_targetFacing = newdir;
@ -2673,10 +2681,11 @@ void ActorC64::animateActor(int anim) {
return;
}*/
this->setDirection( dir );
this->_byte_FD0A = this->_byte_FDE8;
this->setDirection( dir );
} else {
if( anim > 4 ) {

View file

@ -202,7 +202,7 @@ public:
void adjustActorPos();
virtual AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY);
void setDirection(int direction);
virtual void setDirection(int direction);
void faceToObject(int obj);
void turnToDirection(int newdir);
virtual void walkActor();
@ -379,6 +379,7 @@ public:
}
virtual void animateActor(int anim);
virtual void setDirection(int direction);
// Used by the save/load system:
virtual void saveLoadWithSerializer(Serializer *ser);

View file

@ -1305,6 +1305,7 @@ void C64CostumeLoader::frameUpdate(ActorC64 *a, int cmd ) {
if (limbFrames == 0xFF)
continue;
// 0x2679
a->_byte_FCE2[limb] = a->_byte_FD0A;
// Has limb frames ptr changed since last update?
@ -1407,13 +1408,8 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
// Different command for stand frame
if (frame == a->_standFrame)
{
command = dirToDirStop(dir);
//0x2BEB
A->_byte_FDE8 = -1;
}
// Update the limb frames
frameUpdate(A, command);

View file

@ -672,19 +672,20 @@ void ScummEngine_v0::o_animateActor() {
a->_byte_FDE8 = unk;
switch( anim ) {
case 0xFE:
// 0x6993
a->_speaking = 0x80; // Enabled, but not switching
return;
case 0xFD:
// 0x69A3
a->_speaking = 0x00;
return;
case 0xFE:
// 0x6993
a->_speaking = 0x80; // Enabled, but not switching
return;
case 0xFF:
a->stopActorMoving();
return;
case 0xFD:
// 0x69A3
a->_speaking = 0x00;
return;
case 0xFF:
a->stopActorMoving();
return;
}
a->animateActor(anim);