aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorRobert Crossfield2012-01-27 22:05:10 +1100
committerTobias Gunkel2012-02-11 08:29:32 +0100
commit1e8d0664ac704160c3353d998a3b9978245128bd (patch)
tree412167543d0e315532166bbaabe99bdf295302f3 /engines/scumm
parentddd65dfc22333eefccf3a875fcd33c4597426089 (diff)
downloadscummvm-rg350-1e8d0664ac704160c3353d998a3b9978245128bd.tar.gz
scummvm-rg350-1e8d0664ac704160c3353d998a3b9978245128bd.tar.bz2
scummvm-rg350-1e8d0664ac704160c3353d998a3b9978245128bd.zip
SCUMM: Fix Tentacle issue, and possibly some other animation issues
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/actor.cpp52
-rw-r--r--engines/scumm/costume.cpp29
-rw-r--r--engines/scumm/costume.h3
-rw-r--r--engines/scumm/script_v0.cpp1
4 files changed, 46 insertions, 39 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 19cd0ae2eb..c22fc8a438 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -396,9 +396,14 @@ void Actor::startWalkActor(int destX, int destY, int dir) {
}
if (_vm->_game.version <= 2) {
+
abr = adjustXYToBeInBox(abr.x, abr.y);
if (_pos.x == abr.x && _pos.y == abr.y && (dir == -1 || _facing == dir))
return;
+
+ if( _vm->_game.version == 0 )
+ ((ActorC64*) this)->animateActor( newDirToOldDir( _facing ) );
+
} else {
if (_ignoreBoxes) {
abr.box = kInvalidBox;
@@ -554,17 +559,12 @@ void Actor_v2::walkActor() {
if (_facing != new_dir) {
- if( _vm->_game.version != 0 )
- setDirection(new_dir);
+ setDirection(new_dir);
} else {
_moving = 0;
}
- if( _vm->_game.version == 0 )
- if( _moving == 0 )
- setDirection( new_dir );
-
return;
}
@@ -909,7 +909,7 @@ void ActorC64::setDirection(int direction) {
_animFrameRepeat = -1;
animateActor(res);
- if(_moving)
+ if(_moving & MF_TURN)
animateCostume();
}
@@ -936,13 +936,12 @@ void Actor::turnToDirection(int newdir) {
} else {
_moving &= ~MF_TURN;
if (newdir != _facing) {
+
_moving |= MF_TURN;
_targetFacing = newdir;
}
}
- if (_vm->_game.version == 0)
- setDirection( newdir );
}
@@ -1004,8 +1003,10 @@ void Actor::putActor(int dstX, int dstY, int newRoom) {
showActor();
}
- if( _vm->_game.version == 0 && _costume != 0x13 )
- turnToDirection( oldDirToNewDir(2));
+ if( _vm->_game.version == 0 ) {
+ _moving = 0;
+ setDirection( oldDirToNewDir(2));
+ }
}
static bool inBoxQuickReject(const BoxCoords &box, int x, int y, int threshold) {
@@ -1874,7 +1875,7 @@ void ActorC64::startAnimActor(int f) {
if( f == _standFrame )
setDirection( _facing );
else
- animateActor( newDirToOldDir(_facing) );
+ animateActor( newDirToOldDir(_targetFacing) );
}
void Actor::animateActor(int anim) {
@@ -1950,24 +1951,16 @@ void ActorC64::limbFrameCheck() {
_limbFrameRepeat[_limb_current] = _limbFrameRepeatNew[_limb_current];
- _cost.active[_limb_current] = _cost.frame[_limb_current];
+ _vm->_costumeLoader->loadCostume(_costume);
+
+ // 0x25C3
+ _cost.active[_limb_current] = ((C64CostumeLoader*)_vm->_costumeLoader)->getFrame( this );
_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;
- }
speakCheck();
@@ -2780,6 +2773,17 @@ void ScummEngine_v71he::queueAuxEntry(int actorNum, int subIndex) {
void ActorC64::animateActor(int anim) {
int dir = -1;
+ // 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;
+ }
+
switch( anim ) {
case 0x00:
case 0x04:
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index cfb1e8690f..0ae0aca147 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -1184,20 +1184,17 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
if (limb >= 8)
return 0;
- if (a->_cost.curpos[limb] == 0xFFFF || A->_cost.active[limb] == 0xFFFF )
- return 0;
-
if (limb == 0) {
_draw_top = 200;
_draw_bottom = 0;
}
-
- 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)
+
+ if( a->_cost.curpos[limb] == 0xFFFF )
return 0;
+ _loaded.loadCostume( a->_costume );
+ byte frame = _loaded._frameOffsets[ a->_cost.curpos[limb] + a->_cost.active[limb] ];
+
byte ptrLow = _loaded._baseptr[frame];
byte ptrHigh = ptrLow + _loaded._dataOffsets[4];
int frameOffset = (_loaded._baseptr[ptrHigh] << 8) + _loaded._baseptr[ptrLow + 2]; // 0x23EF / 0x2400
@@ -1337,19 +1334,23 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
}
}
+byte C64CostumeLoader::getFrame( ActorC64 *A ) {
+
+ loadCostume(A->_costume);
+
+ return _frameOffsets[ _frameOffsets[A->_limb_current] + A->_cost.start[ A->_limb_current ] ];
+}
+
byte C64CostumeLoader::increaseAnims(Actor *a) {
ActorC64 *A = (ActorC64 *)a;
- if( _frameOffsets == 0 || (a->_cost.active[A->_limb_current] == 0xFFFF) )
- return 0;
-
uint16 limbPrevious = a->_cost.curpos[A->_limb_current]++;
+ loadCostume(a->_costume);
+
// increase each frame pos
// 0x2543
- 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]];
+ byte frame = _frameOffsets[ a->_cost.curpos[A->_limb_current] + a->_cost.active[A->_limb_current] ];
if ( frame == 0xFF ) {
// 0x2545
diff --git a/engines/scumm/costume.h b/engines/scumm/costume.h
index 50e3f1e1b2..38e21d586f 100644
--- a/engines/scumm/costume.h
+++ b/engines/scumm/costume.h
@@ -73,11 +73,12 @@ public:
void loadCostume(int id);
void costumeDecodeData(Actor *a, int frame, uint usemask);
byte increaseAnims(Actor *a);
+
+ byte getFrame( ActorC64 *A );
int _maxHeight;
protected:
- int dirToDirStop(int oldDir);
};
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index 054d861db4..cf2b7d9a8f 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -698,6 +698,7 @@ void ScummEngine_v0::o_animateActor() {
}
a->animateActor(anim);
+ a->animateCostume();
}
void ScummEngine_v0::o_getActorMoving() {