Add patch #2853844 - MM C64: walksounds.

svn-id: r46146
This commit is contained in:
Travis Howell 2009-11-26 00:45:06 +00:00
parent ef5d0226c1
commit 34b781199c
3 changed files with 47 additions and 4 deletions

View file

@ -1164,6 +1164,7 @@ void Actor::adjustActorPos() {
stopActorMoving(); stopActorMoving();
_cost.soundCounter = 0; _cost.soundCounter = 0;
_cost.soundPos = 0;
if (_walkbox != kInvalidBox) { if (_walkbox != kInvalidBox) {
byte flags = _vm->getBoxFlags(_walkbox); byte flags = _vm->getBoxFlags(_walkbox);
@ -1223,6 +1224,7 @@ void Actor::hideActor() {
} }
_visible = false; _visible = false;
_cost.soundCounter = 0; _cost.soundCounter = 0;
_cost.soundPos = 0;
_needRedraw = false; _needRedraw = false;
_needBgReset = true; _needBgReset = true;
} }
@ -1269,16 +1271,50 @@ void ScummEngine::showActors() {
} }
} }
// bits 0..5: sound, bit 6: ???
static const byte v0ActorSounds[24] = {
0x06, // Syd
0x06, // Razor
0x06, // Dave
0x06, // Michael
0x06, // Bernard
0x06, // Wendy
0x00, // Jeff
0x46, // ???
0x06, // Dr Fred
0x06, // Nurse Edna
0x06, // Weird Ed
0x06, // Dead Cousin Ted
0xFF, // Purple Tentacle
0xFF, // Green Tentacle
0x06, // Meteor
0xC0, // Plant
0x06, // ???
0x06, // ???
0x00, // ???
0xC0, // ???
0xC0, // ???
0x00, // ???
0x06, // Sandy
0x06, // ???
};
/* Used in Scumm v5 only. Play sounds associated with actors */ /* Used in Scumm v5 only. Play sounds associated with actors */
void ScummEngine::playActorSounds() { void ScummEngine::playActorSounds() {
int i; int i, j;
int sound;
for (i = 1; i < _numActors; i++) { for (i = 1; i < _numActors; i++) {
if (_actors[i]->_cost.soundCounter && _actors[i]->isInCurrentRoom() && _actors[i]->_sound) { if (_actors[i]->_cost.soundCounter && _actors[i]->isInCurrentRoom() && _actors[i]->_sound) {
_currentScript = 0xFF; _currentScript = 0xFF;
_sound->addSoundToQueue(_actors[i]->_sound[0]); if (_game.version == 0) {
for (i = 1; i < _numActors; i++) { sound = v0ActorSounds[i - 1] & 0x3F;
_actors[i]->_cost.soundCounter = 0; } else {
sound = _actors[i]->_sound[0];
}
_sound->addSoundToQueue(sound);
for (j = 1; j < _numActors; j++) {
_actors[j]->_cost.soundCounter = 0;
} }
return; return;
} }

View file

@ -55,6 +55,7 @@ struct CostumeData {
byte active[16]; byte active[16];
uint16 animCounter; uint16 animCounter;
byte soundCounter; byte soundCounter;
byte soundPos;
uint16 stopped; uint16 stopped;
uint16 curpos[16]; uint16 curpos[16];
uint16 start[16]; uint16 start[16];

View file

@ -1423,6 +1423,12 @@ byte C64CostumeLoader::increaseAnims(Actor *a) {
frameUpdate(A, cmd); frameUpdate(A, cmd);
} }
if (A->_moving && _vm->_currentRoom != 1 && _vm->_currentRoom != 44) {
if (a->_cost.soundPos == 0)
a->_cost.soundCounter++;
a->_cost.soundPos = (a->_cost.soundPos + 1) % 3;
}
// increase each frame pos // increase each frame pos
for (int limb = 0; limb < 8; ++limb) { for (int limb = 0; limb < 8; ++limb) {
if (a->_cost.curpos[limb] < a->_cost.end[limb]) if (a->_cost.curpos[limb] < a->_cost.end[limb])