aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/scumm/actor.cpp259
-rw-r--r--engines/scumm/actor.h43
-rw-r--r--engines/scumm/costume.cpp234
-rw-r--r--engines/scumm/costume.h2
-rw-r--r--engines/scumm/script_v0.cpp10
5 files changed, 285 insertions, 263 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 3a4f72181b..2d0e498f48 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -42,6 +42,14 @@ namespace Scumm {
byte Actor::kInvalidBox = 0;
+static const byte v0ActorTalkArray[0x19] = {
+ 0x00, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x00, 0x46, 0x06,
+ 0x06, 0x06, 0x06, 0xFF, 0xFF,
+ 0x06, 0xC0, 0x06, 0x06, 0x00,
+ 0xC0, 0xC0, 0x00, 0x06, 0x06
+};
+
Actor::Actor(ScummEngine *scumm, int id) :
_vm(scumm), _number(id) {
assert(_vm != 0);
@@ -226,11 +234,6 @@ void Actor::stopActorMoving() {
if (_walkScript)
_vm->stopScript(_walkScript);
- // V0 Games will walk on the spot if the actor is stopped mid-walk
- // So we must set the stand still frame
- if (_vm->_game.version == 0)
- startWalkAnim(3, -1);
-
_moving = 0;
}
@@ -320,11 +323,12 @@ int Actor::actorWalkStep() {
int nextFacing;
if( _vm->_game.version == 0 )
- ((ActorC64*) this)->_byte_FD0A = -1;
+ ((ActorC64*) this)->_AnimFrameRepeat = -1;
_needRedraw = true;
- nextFacing = updateActorDirection(true);
+ nextFacing = updateActorDirection(true);;
+
if (!(_moving & MF_IN_LEG) || _facing != nextFacing) {
if (_walkFrame != _frame || _facing != nextFacing) {
startWalkAnim(1, nextFacing);
@@ -364,6 +368,7 @@ int Actor::actorWalkStep() {
_moving &= ~MF_IN_LEG;
return 0;
}
+
return 1;
}
@@ -415,6 +420,9 @@ void Actor::startWalkActor(int destX, int destY, int dir) {
}
}
+ if( _vm->_game.version == 0 )
+ ((ActorC64*) this)->animateActor(dir);
+
_walkdata.dest.x = abr.x;
_walkdata.dest.y = abr.y;
_walkdata.destbox = abr.box;
@@ -545,17 +553,18 @@ void Actor_v2::walkActor() {
if (_moving & MF_TURN) {
new_dir = updateActorDirection(false);
- // FIXME: is this correct?
+
if (_facing != new_dir) {
- // Actor never stops walking when an object has been selected without this
- if (_vm->_game.version ==0)
- _moving = 0;
-
- setDirection(new_dir);
+ if( _vm->_game.version != 0 )
+ setDirection(new_dir);
- } else
+ } else {
_moving = 0;
+ }
+
+ if( _vm->_game.version == 0 )
+ ((ActorC64*)this)->setCmdFromDirection( newDirToOldDir(new_dir) );
return;
}
@@ -564,6 +573,8 @@ void Actor_v2::walkActor() {
if (_moving & MF_IN_LEG) {
actorWalkStep();
+ if( _vm->_game.version == 0 )
+ ((ActorC64*) this)->animateActor( newDirToOldDir( _facing ) );
} else {
if (_moving & MF_LAST_LEG) {
_moving = 0;
@@ -850,7 +861,7 @@ void Actor::setDirection(int direction) {
direction = 90;
// Do nothing if actor is already facing in the given direction
- if (_vm->_game.version != 0 && _facing == direction)
+ if (_facing == direction)
return;
// Normalize the angle
@@ -872,25 +883,45 @@ void Actor::setDirection(int direction) {
_needRedraw = true;
}
-void ActorC64::setDirection(int direction) {
+void ActorC64::setDirection(int cmd) {
// Normalize the angle
- _facing = normalizeAngle(direction);
-
- // 0x2C17
- // _byte_FDE8 = -1;
+ _facing = normalizeAngle( cmd );
// 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);
- }
+// based on 0x2BCA, doesn't match disassembly because 'oldDir' variable
+// is not the same value as stored in the original interpreter
+int ActorC64::setCmdFromDirection(int direction) {
+ int res = 0;
- _needRedraw = true;
+ switch (direction) {
+ case 0:
+ res = 4; // Left
+ break;
+
+ case 1:
+ res = 5; // Right
+ break;
+
+ case 2:
+ res = 6; // Face Away
+ break;
+
+ default:
+ res = 7; // Face Camera
+ break;
+ }
+
+
+ _AnimFrameRepeat = -1;
+ animateActor(res);
+ animateCostume();
+
+ return res;
}
void Actor::faceToObject(int obj) {
@@ -961,10 +992,12 @@ void Actor::putActor(int dstX, int dstY, int newRoom) {
if (_visible) {
if (isInCurrentRoom()) {
+
if (_moving) {
stopActorMoving();
startAnimActor(_standFrame);
}
+
adjustActorPos();
} else {
#ifdef ENABLE_HE
@@ -1228,6 +1261,8 @@ void Actor::adjustActorPos() {
if (flags & 7) {
turnToDirection(_facing);
}
+ if (_vm->_game.version == 0)
+ ((ActorC64*)this)->setCmdFromDirection( newDirToOldDir(_facing) );
}
}
@@ -1300,12 +1335,21 @@ void Actor::showActor() {
_vm->ensureResourceLoaded(rtCostume, _costume);
if (_vm->_game.version == 0) {
+ ActorC64 *a = ((ActorC64*) this);
+
+ a->_costCommand = a->_costCommandNew = 0xFF;
+
+ for( int i = 0; i < 8; ++i ) {
+ a->_limbFrameRepeatNew[i] = 0;
+
+ }
// 0x39DF
- ((ActorC64*) this)->_byte_FDE8 = 1;
+ a->_AnimFrameRepeat = 1;
_cost.reset();
- startAnimActor(_standFrame);
+ a->setCmdFromDirection( newDirToOldDir(_facing) );
+
} else if (_vm->_game.version <= 2) {
_cost.reset();
startAnimActor(_standFrame);
@@ -1817,6 +1861,27 @@ void Actor::startAnimActor(int f) {
}
}
+void ActorC64::startAnimActor(int f) {
+ if (f == _talkStartFrame) {
+ if (v0ActorTalkArray[_number] & 0x40)
+ return;
+
+ _speaking = 1;
+ return;
+ }
+
+ if (f == _talkStopFrame) {
+
+ _speaking = 0;
+ return;
+ }
+
+ if( f == _standFrame )
+ setCmdFromDirection( newDirToOldDir(_facing) );
+ else
+ animateActor( newDirToOldDir(_facing) );
+}
+
void Actor::animateActor(int anim) {
int cmd, dir;
@@ -1878,6 +1943,65 @@ void Actor::animateCostume() {
}
}
+void ActorC64::limbFrameCheck() {
+ if (_cost.frame[_limb_current] == 0xFFFF )
+ return;
+
+ if (_cost.start[_limb_current] == _cost.frame[_limb_current] )
+ return;
+
+ // 0x25A4
+ _cost.start[_limb_current] = _cost.frame[_limb_current];
+
+ _limbFrameRepeat[_limb_current] = _limbFrameRepeatNew[_limb_current];
+
+ _cost.active[_limb_current] = _cost.frame[_limb_current];
+ _cost.curpos[_limb_current] = 0;
+
+ _needRedraw = true;
+}
+
+void ActorC64::animateCostume() {
+
+ // Sound
+ if (_moving && _vm->_currentRoom != 1 && _vm->_currentRoom != 44) {
+ if (_cost.soundPos == 0)
+ _cost.soundCounter++;
+
+ // Is this the correct location?
+ // 0x073C
+ if (v0ActorTalkArray[_number] & 0x3F)
+ _cost.soundPos = (_cost.soundPos + 1) % 3;
+ }
+
+ _vm->_costumeLoader->loadCostume(_costume);
+
+ speakCheck();
+
+ for( _limb_current = 0; _limb_current < 8; ++_limb_current ) {
+ limbFrameCheck();
+
+ if (_vm->_costumeLoader->increaseAnims(this))
+ _needRedraw = true;
+ }
+}
+
+void ActorC64::speakCheck() {
+
+ if (v0ActorTalkArray[_number] & 0x80)
+ return;
+
+ int cmd = newDirToOldDir( _facing );
+
+ if (_speaking & 0x80)
+ cmd += 0x0C;
+ else
+ cmd += 0x10;
+
+ _AnimFrameRepeat = -1;
+ animateActor( cmd );
+}
+
#ifdef ENABLE_SCUMM_7_8
void Actor::animateLimb(int limb, int f) {
// This methods is very similiar to animateCostume().
@@ -2661,42 +2785,43 @@ void ScummEngine_v71he::queueAuxEntry(int actorNum, int subIndex) {
#endif
void ActorC64::animateActor(int anim) {
- int dir = oldDirToNewDir(anim % 4);
-
- if( this->isInCurrentRoom() ) {
-
- // this->_costCommandNew = anim;
-
- // 0x273A
- /*switch( anim ) {
- case 4:
- dir = 1;
- break;
- case 5:
- dir = 0;
- break;
- case 6:
- dir = 0x80;
- break;
- case 7:
- dir = 0x81;
- break;
-
- default:
- return;
- }*/
-
-
- this->_byte_FD0A = this->_byte_FDE8;
-
- this->setDirection( dir );
-
- } else {
-
- if( anim > 4 ) {
- if( anim <= 7 )
- this->setDirection( dir );
- }
+ int dir = -1;
+
+ switch( anim ) {
+ case 0x04:
+ dir = 0;
+ break;
+
+ case 0x05:
+ dir = 1;
+ break;
+
+ case 0x06:
+ dir = 2;
+ break;
+
+ case 0x07:
+ dir = 3;
+ break;
+
+ default:
+ break;
+ }
+
+ if( isInCurrentRoom() ) {
+
+ _costCommandNew = anim;
+ _vm->_costumeLoader->costumeDecodeData(this, 0, 0);
+
+ if( dir == -1 )
+ return;
+
+ setDirection( oldDirToNewDir(dir) );
+
+ } else {
+
+ if( anim > 4 && anim <= 7 )
+ setDirection( oldDirToNewDir(dir) );
}
}
@@ -2708,10 +2833,8 @@ void ActorC64::saveLoadWithSerializer(Serializer *ser) {
MKLINE(ActorC64, _costFrame, sleByte, VER(84)),
MKLINE(ActorC64, _miscflags, sleByte, VER(84)),
MKLINE(ActorC64, _speaking, sleByte, VER(84)),
- MKLINE(ActorC64, _speakingPrev, sleByte, VER(84)),
- MKLINE(ActorC64, _byte_FD0A, sleByte, VER(89)),
- MKLINE(ActorC64, _byte_FDE8, sleByte, VER(89)),
- MKARRAY(ActorC64, _byte_FCE2[0], sleInt8, 8, VER(89)),
+ MKLINE(ActorC64, _AnimFrameRepeat, sleByte, VER(89)),
+ MKARRAY(ActorC64, _limbFrameRepeatNew[0], sleInt8, 8, VER(89)),
MKEND()
};
diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h
index 7e8faa54cc..35ff657fa7 100644
--- a/engines/scumm/actor.h
+++ b/engines/scumm/actor.h
@@ -208,7 +208,7 @@ public:
virtual void walkActor();
void drawActorCostume(bool hitTestMode = false);
virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
- void animateCostume();
+ virtual void animateCostume();
virtual void setActorCostume(int c);
void animateLimb(int limb, int f);
@@ -222,7 +222,7 @@ protected:
void startWalkAnim(int cmd, int angle);
public:
void runActorTalkScript(int f);
- void startAnimActor(int frame);
+ virtual void startAnimActor(int frame);
void remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold);
void remapActorPaletteColor(int slot, int color);
@@ -348,38 +348,47 @@ enum ActorC64MiscFlags {
class ActorC64 : public Actor_v2 {
public:
- byte _costCommand, _costFrame;
+ byte _costCommandNew, _costCommand, _costFrame;
byte _miscflags;
- byte _speaking, _speakingPrev;
+ byte _speaking;
- int8 _byte_FDE8;
- int8 _byte_FD0A;
- int8 _byte_FCE2[8];
-
+ int8 _AnimFrameRepeat;
+ int8 _limbFrameRepeatNew[8], _limbFrameRepeat[8];
+
+ byte _limb_current;
+ bool _limb_flipped[8];
public:
ActorC64(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {
- _costCommand = 0;
+ _costCommand = 0xFF;
_costFrame = 0;
_speaking = 0;
- _speakingPrev = 0;
- _byte_FD0A = 0;
- _byte_FDE8 = 0;
-
- // Reset the limb counter?
- for( int i = 0; i < sizeof( _byte_FCE2 ); ++i )
- _byte_FCE2[i] = 0;
-
+ _AnimFrameRepeat = 0;
+ _costCommandNew = 0;
+
+ for( int i = 0; i < 8; ++i ) {
+ _limbFrameRepeatNew[i] = 0;
+ _limbFrameRepeat[i] = 0;
+ _limb_flipped[i] = false;
+ }
}
virtual void initActor(int mode) {
Actor_v2::initActor(mode);
if (mode == -1) {
_miscflags = 0;
}
+
}
virtual void animateActor(int anim);
+ virtual void animateCostume();
+
+ void limbFrameCheck();
+
+ void speakCheck();
virtual void setDirection(int direction);
+ int setCmdFromDirection(int direction);
+ void startAnimActor(int f);
// Used by the save/load system:
virtual void saveLoadWithSerializer(Serializer *ser);
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index 965cee79a8..c7285ead56 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -72,14 +72,6 @@ static const int v1MMNESLookup[25] = {
0x17, 0x00, 0x01, 0x05, 0x16
};
-static const byte v0ActorTalkArray[0x19] = {
- 0x00, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x00, 0x46, 0x06,
- 0x06, 0x06, 0x06, 0xFF, 0xFF,
- 0x06, 0xC0, 0x06, 0x06, 0x00,
- 0xC0, 0xC0, 0x00, 0x06, 0x06
-};
-
byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
int i, skip = 0;
byte drawFlag = 1;
@@ -1187,10 +1179,12 @@ static const byte actorColorsMMC64[25] = {
}
byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
+ ActorC64* A = (ActorC64*) a;
+
if (limb >= 8)
return 0;
- if (a->_cost.start[limb] == 0xFFFF)
+ if (a->_cost.curpos[limb] == 0xFFFF || A->_cost.active[limb] == 0xFFFF )
return 0;
if (limb == 0) {
@@ -1198,8 +1192,8 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
_draw_bottom = 0;
}
- bool flipped = (a->_cost.start[limb] & 0x80) != 0;
- byte frameStart = _loaded._frameOffsets[a->_cost.frame[limb]];
+ byte frameB = _loaded._frameOffsets[limb] + a->_cost.active[limb];
+ byte frameStart = _loaded._frameOffsets[ frameB ];
byte frame = _loaded._frameOffsets[frameStart + a->_cost.curpos[limb]];
if (frame == 0xFF)
return 0;
@@ -1231,7 +1225,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
if (!width || !height)
return 0;
- int xpos = _actorX + (flipped ? -1 : +1) * (offsetX * 8 - a->_width / 2);
+ int xpos = _actorX + (A->_limb_flipped[ limb ] ? -1 : +1) * (offsetX * 8 - a->_width / 2);
// +1 as we appear to be 1 pixel away from the original interpreter
int ypos = _actorY - offsetY + 1;
@@ -1241,13 +1235,13 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
byte color = data[y * width + x];
byte pcolor;
- int destX = xpos + (flipped ? -(x + 1) : x) * 8;
+ int destX = xpos + (A->_limb_flipped[ limb ] ? -(x + 1) : x) * 8;
int destY = ypos + y;
if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) {
byte *dst = (byte *)_out.pixels + destY * _out.pitch + destX;
byte *mask = _vm->getMaskBuffer(0, destY, _zbuf);
- if (flipped) {
+ if (A->_limb_flipped[ limb ]) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
} else {
LINE(6, 0); LINE(4, 2); LINE(2, 4); LINE(0, 6);
@@ -1258,7 +1252,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
_draw_top = MIN(_draw_top, ypos);
_draw_bottom = MAX(_draw_bottom, ypos + height);
- if (flipped)
+ if (A->_limb_flipped[ limb ])
_vm->markRectAsDirty(kMainVirtScreen, xpos - (width * 8), xpos, ypos, ypos + height, _actorID);
else
_vm->markRectAsDirty(kMainVirtScreen, xpos, xpos + (width * 8), ypos, ypos + height, _actorID);
@@ -1291,195 +1285,93 @@ void C64CostumeLoader::loadCostume(int id) {
_maxHeight = 0;
}
-void C64CostumeLoader::frameUpdate(ActorC64 *a, int cmd ) {
- byte limbFrames = 0;
-
- // Each costume-command has 8 limbs (0x2622)
- cmd <<= 3;
-
- for (int limb = 0, pos = 0; limb < 8; ++limb, pos = 0) {
- // get the frame number for the beginning of the costume command
- limbFrames = ((_animCmds + cmd)[limb]);
-
- // Dont change if frame is invalid
- if (limbFrames == 0xFF)
- continue;
-
- // 0x2679
- a->_byte_FCE2[limb] = a->_byte_FD0A;
-
- // Has limb frames ptr changed since last update?
- if (a->_cost.start[limb] == limbFrames)
- continue;
-
- // Set new limb command addresses
- a->_cost.start[limb] = limbFrames;
- a->_cost.frame[limb] = _frameOffsets[limb] + (limbFrames & 0x7f); // limb animation-frames ptr
-
- // Get first entry of a limbs' frames
- byte frameStart = _frameOffsets[ a->_cost.frame[limb]];
-
- // Loop each frame in this limb until we reach the end marker
- while (pos != 0xFF) { // This is just so we dont overflow
- byte frame = _frameOffsets[frameStart + pos];
-
- // Each animation-frame until we find end
- if (frame == 0xFF)
- break;
-
- byte ptrLow = _baseptr[frame];
- byte ptrHigh = ptrLow + _dataOffsets[4];
- int frameOffset = (_baseptr[ptrHigh] << 8) + _baseptr[ptrLow + 2]; // 0x23EF / 0x2400
-
- const byte *data = _baseptr + frameOffset;
-
- if (data[3] > _maxHeight)
- _maxHeight = data[3] + 1;
-
- ++pos;
- }
-
- // Set ending position of limb frames
- a->_cost.end[limb] = pos;
- a->_cost.curpos[limb] = 0;
- }
-}
-
-// based on 0x2BCA, doesn't match disassembly because 'oldDir' variable
-// is not the same value as stored in the original interpreter
-int C64CostumeLoader::dirToDirStop(int oldDir) {
- int res = 0;
-
- switch (oldDir) {
- case 0:
- res = 4; // Left
- break;
-
- case 1:
- res = 5; // Right
- break;
-
- case 2:
- res = 6; // Face Camera
- break;
+void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
+ ActorC64 *A = (ActorC64 *)a;
- default:
- res = 7; // Face Away
- break;
- }
-
- return res;
-}
+ loadCostume(a->_costume);
-void C64CostumeLoader::actorSpeak(ActorC64 *a, int &cmd) {
- if (v0ActorTalkArray[a->_number] & 0x80)
+ if( A->_costCommandNew == 0xFF || (A->_costCommand == A->_costCommandNew) )
return;
- if ((a->_speaking & 0x80))
- cmd += 0x0C;
- else
- cmd += 0x10;
-
- a->_byte_FDE8 = -1;
-}
+ A->_costCommand = A->_costCommandNew;
-void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
- ActorC64 *A = (ActorC64 *)a;
- int dir = newDirToOldDir(a->getFacing());
- int command = dir;
+ int cmd = A->_costCommand;
+ byte limbFrameNumber = 0;
- loadCostume(a->_costume);
+ // Each costume-command has 8 limbs (0x2622)
+ cmd <<= 3;
- // Enable/Disable speaking flag
- if (frame == a->_talkStartFrame) {
+ for (int limb = 0; limb < 8; ++limb) {
- if (v0ActorTalkArray[a->_number] & 0x40)
- return;
+ // get the frame number for the beginning of the costume command
+ limbFrameNumber = ((_animCmds + cmd)[limb]);
- A->_speaking = 1;
- return;
- }
+ if( limbFrameNumber & 0x80 ) {
- if (frame == a->_talkStopFrame) {
+ // 0x263D
+ if( limbFrameNumber == 0xFF )
+ continue;
- A->_speaking = 0;
- return;
- }
+ // 0x2643
+ a->_cost.frame[limb] = (limbFrameNumber & 0x7f); // limb animation-frames ptr
+ if( A->_limb_flipped[limb] != true )
+ a->_cost.start[limb] = 0xFFFF;
- // Different command for stand frame
- if (frame == a->_standFrame)
- command = dirToDirStop(dir);
+ A->_limb_flipped[limb] = true;
- // Update the limb frames
- frameUpdate(A, command);
+ } else {
+ //0x2660
+ a->_cost.frame[limb] = limbFrameNumber;
- // Keep current command/frame mode
- A->_costCommand = dir;
- A->_costFrame = frame;
+ if( A->_limb_flipped[limb] != false )
+ a->_cost.start[limb] = 0xFFFF;
- // Update 'speaking' frames?
- if (A->_speaking) {
- command = dir; // Incase standing frame was set as cmd
- actorSpeak(A, command);
+ A->_limb_flipped[limb] = false;
+ }
- // Update the limb speak frames
- frameUpdate(A, command);
+ // 0x2679
+ A->_limbFrameRepeatNew[limb] = A->_AnimFrameRepeat;
}
}
byte C64CostumeLoader::increaseAnims(Actor *a) {
ActorC64 *A = (ActorC64 *)a;
+
+ if( _frameOffsets == 0 )
+ return 0;
- // check if the actor speak flag has changed since last frame increase
- if (A->_speaking != A->_speakingPrev) {
- int cmd = A->_costCommand;
- A->_speakingPrev = A->_speaking;
-
- actorSpeak(A, cmd);
-
- // Update the limb frames
- frameUpdate(A, cmd);
- }
-
- if (A->_moving && _vm->_currentRoom != 1 && _vm->_currentRoom != 44) {
- if (a->_cost.soundPos == 0)
- a->_cost.soundCounter++;
-
- // Is this the correct location?
- // 0x073C
- if (v0ActorTalkArray[a->_number] & 0x3F)
- a->_cost.soundPos = (a->_cost.soundPos + 1) % 3;
- }
+ uint16 limbPrevious = a->_cost.curpos[A->_limb_current]++;
// increase each frame pos
// 0x2543
- for (int limb = 0; limb < 8; ++limb) {
-
- if (++a->_cost.curpos[limb] >= a->_cost.end[limb]) {
+ byte frameB = _frameOffsets[A->_limb_current] + a->_cost.active[A->_limb_current];
+ byte frameStart = _frameOffsets[ frameB ];
+ byte frame = _frameOffsets[frameStart + a->_cost.curpos[A->_limb_current]];
- // 0x2541
- if( A->_byte_FCE2[limb] == 0 ) {
+ if ( frame == 0xFF ) {
+ // 0x2545
+ if( A->_limbFrameRepeat[A->_limb_current] == 0 ) {
- // 0x2556
- --a->_cost.curpos[limb];
+ // 0x2556
+ --A->_cost.curpos[A->_limb_current];
- //A->_costCommandNew = 0xFF;
- //A->_costCommand = 0xFF;
+ A->_costCommandNew = 0xFF;
+ A->_costCommand = 0xFF;
- // 0x2568
- //A->_limbCommandNew[limb] = 0xFF;
- //A->_limbCommand[limb] = 0xFF;
+ // 0x2568
+ A->_cost.frame[A->_limb_current] = 0xFFFF;
+ A->_cost.start[A->_limb_current] = 0xFFFF;
- } else {
- if( A->_byte_FCE2[limb] != -1 )
- --A->_byte_FCE2[limb];
+ } else {
+ if( A->_limbFrameRepeat[A->_limb_current] != -1 )
+ --A->_limbFrameRepeat[A->_limb_current];
- a->_cost.curpos[limb] = 0;
- }
+ a->_cost.curpos[A->_limb_current] = 0;
}
+ }
-
- }
+ if( limbPrevious == a->_cost.curpos[A->_limb_current] )
+ return 0;
return 1;
}
diff --git a/engines/scumm/costume.h b/engines/scumm/costume.h
index 3acf2a1f6c..50e3f1e1b2 100644
--- a/engines/scumm/costume.h
+++ b/engines/scumm/costume.h
@@ -77,9 +77,7 @@ public:
int _maxHeight;
protected:
- void actorSpeak(ActorC64 *a, int &cmd);
int dirToDirStop(int oldDir);
- void frameUpdate(ActorC64 *A, int cmd);
};
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index 4081123e13..0bdefd660b 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -27,6 +27,7 @@
#include "scumm/resource.h"
#include "scumm/scumm_v0.h"
#include "scumm/verbs.h"
+#include "scumm/util.h"
namespace Scumm {
@@ -601,8 +602,7 @@ void ScummEngine_v0::o_loadRoomWithEgo() {
x = r.x;
y = r.y;
a->putActor(x, y, _currentRoom);
- a->setDirection(dir + 180);
-
+
camera._dest.x = camera._cur.x = a->getPos().x;
setCameraAt(a->getPos().x, a->getPos().y);
setCameraFollows(a);
@@ -674,13 +674,13 @@ void ScummEngine_v0::o_lights() {
void ScummEngine_v0::o_animateActor() {
int act = getVarOrDirectByte(PARAM_1);
int anim = getVarOrDirectByte(PARAM_2);
- int8 unk = (int8) fetchScriptByte();
+ int8 animFrameRepeat = (int8) fetchScriptByte();
- debug(0,"o_animateActor: unk %d", unk);
+ debug(0,"o_animateActor: animFrameRepeat %d", animFrameRepeat);
ActorC64 *a = (ActorC64*) derefActor(act, "o_animateActor");
- a->_byte_FDE8 = unk;
+ a->_AnimFrameRepeat = animFrameRepeat;
switch( anim ) {