aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorsegrax2012-01-15 23:23:11 +1100
committerTobias Gunkel2012-02-11 08:28:41 +0100
commitb999fe9e265277dbd8e736edec1478013c86feba (patch)
tree00718cdabf3d2f6e80427bfa39510f81b2e202e4 /engines
parent621017ce65f3c5b346c3b17bd4e6700af13215c6 (diff)
downloadscummvm-rg350-b999fe9e265277dbd8e736edec1478013c86feba.tar.gz
scummvm-rg350-b999fe9e265277dbd8e736edec1478013c86feba.tar.bz2
scummvm-rg350-b999fe9e265277dbd8e736edec1478013c86feba.zip
SCUMM: Add in support in v0 for the unknown variable to o_animateActor
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/actor.cpp57
-rw-r--r--engines/scumm/actor.h15
-rw-r--r--engines/scumm/costume.cpp70
-rw-r--r--engines/scumm/script_v0.cpp2
4 files changed, 124 insertions, 20 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 70e051edfd..bccf4ef746 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -859,10 +859,16 @@ void Actor::setDirection(int direction) {
// V0 MM
if (_vm->_game.version == 0) {
- if (_moving)
- _vm->_costumeLoader->costumeDecodeData(this, _walkFrame, 0);
- else
- _vm->_costumeLoader->costumeDecodeData(this, _standFrame, 0);
+
+ if (_moving)
+ _vm->_costumeLoader->costumeDecodeData(this, _walkFrame, 0);
+ else
+ _vm->_costumeLoader->costumeDecodeData(this, _standFrame, 0);
+
+ // 0x2C17
+
+ ((ActorC64*) this)->_byte_FD0A = 0xFF;
+
_needRedraw = true;
return;
}
@@ -896,6 +902,9 @@ void Actor::turnToDirection(int newdir) {
if (newdir == -1 || _ignoreTurns)
return;
+ if( _vm->_game.version == 0 )
+ ((ActorC64*) this)->_byte_FD0A = -1;
+
if (_vm->_game.version <= 6) {
_moving = MF_TURN;
_targetFacing = newdir;
@@ -1794,7 +1803,6 @@ void Actor::animateActor(int anim) {
dir = anim % 1000;
} else {
-
cmd = anim / 4;
dir = oldDirToNewDir(anim % 4);
@@ -2626,6 +2634,45 @@ void ScummEngine_v71he::queueAuxEntry(int actorNum, int subIndex) {
}
#endif
+void ActorC64::animateActor(int anim) {
+ Actor::animateActor(anim);
+ return;
+ int dir = oldDirToNewDir(anim % 4);
+
+ if( this->isInCurrentRoom() ) {
+
+ this->_costCommandNew = anim;
+ this->_byte_FD0A = this->_byte_FDE8;
+
+ // 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->setDirection( dir );
+
+ } else {
+
+ if( anim > 4 ) {
+ if( anim <= 7 )
+ this->setDirection( dir );
+ }
+ }
+}
void ActorC64::saveLoadWithSerializer(Serializer *ser) {
Actor::saveLoadWithSerializer(ser);
diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h
index d8e3692619..1feb1afaa5 100644
--- a/engines/scumm/actor.h
+++ b/engines/scumm/actor.h
@@ -348,16 +348,29 @@ enum ActorC64MiscFlags {
class ActorC64 : public Actor_v2 {
public:
+ byte _costCommandNew;
byte _costCommand, _costFrame;
byte _miscflags;
byte _speaking, _speakingPrev;
+ byte _byte_FDE8;
+ int8 _byte_FD0A;
+ byte _byte_FCE2[8];
+
+
public:
ActorC64(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {
_costCommand = 0;
_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;
+
}
virtual void initActor(int mode) {
Actor_v2::initActor(mode);
@@ -366,6 +379,8 @@ public:
}
}
+ virtual void animateActor(int anim);
+
// Used by the save/load system:
virtual void saveLoadWithSerializer(Serializer *ser);
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index eb3cc3262c..0c091c38bf 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -1298,12 +1298,14 @@ void C64CostumeLoader::frameUpdate(ActorC64 *a, int cmd ) {
cmd <<= 3;
for (int limb = 0, pos = 0; limb < 8; ++limb, pos = 0) {
- // get a limb frames ptr from the costume command
+ // get the frame number for the beginning of the costume command
limbFrames = ((_animCmds + cmd)[limb]);
- // Dont change limb if entry is invalid
+ // Dont change if frame is invalid
if (limbFrames == 0xFF)
- continue;
+ continue;
+
+ a->_byte_FCE2[limb] = a->_byte_FD0A;
// Has limb frames ptr changed since last update?
if (a->_cost.start[limb] == limbFrames)
@@ -1337,7 +1339,7 @@ void C64CostumeLoader::frameUpdate(ActorC64 *a, int cmd ) {
}
// Set ending position of limb frames
- a->_cost.end[limb] = pos - 1;
+ a->_cost.end[limb] = pos;
a->_cost.curpos[limb] = 0;
}
}
@@ -1345,18 +1347,27 @@ void C64CostumeLoader::frameUpdate(ActorC64 *a, int cmd ) {
// 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:
- return 4; // Left
+ res = 4; // Left
+ break;
+
case 1:
- return 5; // Right
+ res = 5; // Right
+ break;
+
case 2:
- return 6; // Face Camera
- case 3:
- return 7; // Face Away
+ res = 6; // Face Camera
+ break;
+
+ default:
+ res = 7; // Face Away
+ break;
}
- // shouldnt' be reached
- return 4;
+
+ return res;
}
void C64CostumeLoader::actorSpeak(ActorC64 *a, int &cmd) {
@@ -1378,21 +1389,28 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
// Enable/Disable speaking flag
if (frame == a->_talkStartFrame) {
+
if (v0ActorTalkArray[a->_number] & 0x40)
return;
A->_speaking = 1;
return;
}
+
if (frame == a->_talkStopFrame) {
+
A->_speaking = 0;
return;
}
// Different command for stand frame
if (frame == a->_standFrame)
+ {
command = dirToDirStop(dir);
+ A->_byte_FDE8 = 0xFF;
+ }
+
// Update the limb frames
frameUpdate(A, command);
@@ -1435,11 +1453,33 @@ byte C64CostumeLoader::increaseAnims(Actor *a) {
}
// increase each frame pos
+ // 0x2543
for (int limb = 0; limb < 8; ++limb) {
- if (a->_cost.curpos[limb] < a->_cost.end[limb])
- a->_cost.curpos[limb]++;
- else
- a->_cost.curpos[limb] = 0;
+
+ if (++a->_cost.curpos[limb] >= a->_cost.end[limb]) {
+
+ // 0x2541
+ if( A->_byte_FCE2[limb] == 0 ) {
+
+ // 0x2556
+ --a->_cost.curpos[limb];
+
+ A->_costCommandNew = 0xFF;
+ //A->_costCommand = 0xFF;
+
+ // 0x2568
+ //A->_limbCommandNew[limb] = 0xFF;
+ //A->_limbCommand[limb] = 0xFF;
+
+ } else {
+ if( A->_byte_FCE2[limb] != 0xFF )
+ --A->_byte_FCE2[limb];
+
+ a->_cost.curpos[limb] = 0;
+ }
+ }
+
+
}
return 1;
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index cd2e8969bb..e3d74fcd90 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -663,6 +663,8 @@ void ScummEngine_v0::o_animateActor() {
ActorC64 *a = (ActorC64*) derefActor(act, "o_animateActor");
+ a->_byte_FDE8 = unk;
+
// 0x6993
if (anim == 0xFE) {
a->_speaking = 0x80; // Enabled, but not switching