Ticket #9080: walksound.patch

File walksound.patch, 2.6 KB (added by SF/tobigun, 15 years ago)
  • engines/scumm/actor.cpp

     
    11641164
    11651165        stopActorMoving();
    11661166        _cost.soundCounter = 0;
     1167        _cost.soundPos = 0;
    11671168
    11681169        if (_walkbox != kInvalidBox) {
    11691170                byte flags = _vm->getBoxFlags(_walkbox);
     
    12231224        }
    12241225        _visible = false;
    12251226        _cost.soundCounter = 0;
     1227        _cost.soundPos = 0;
    12261228        _needRedraw = false;
    12271229        _needBgReset = true;
    12281230}
     
    12691271        }
    12701272}
    12711273
     1274// bits 0..5: sound, bit 6: ???
     1275static const byte v0ActorSounds[24] = {
     1276        0x06, // Syd
     1277        0x06, // Razor
     1278        0x06, // Dave
     1279        0x06, // Michael
     1280        0x06, // Bernard
     1281        0x06, // Wendy
     1282        0x00, // Jeff
     1283        0x46, // ???
     1284        0x06, // Dr Fred
     1285        0x06, // Nurse Edna
     1286        0x06, // Weird Ed
     1287        0x06, // Dead Cousin Ted
     1288        0xFF, // Purple Tentacle
     1289        0xFF, // Green Tentacle
     1290        0x06, // Meteor
     1291        0xC0, // Plant
     1292        0x06, // ???
     1293        0x06, // ???
     1294        0x00, // ???
     1295        0xC0, // ???
     1296        0xC0, // ???
     1297        0x00, // ???
     1298        0x06, // Sandy
     1299        0x06, // ???
     1300};
     1301
    12721302/* Used in Scumm v5 only. Play sounds associated with actors */
    12731303void ScummEngine::playActorSounds() {
    1274         int i;
     1304        int i, j;
     1305        int sound;
    12751306
    12761307        for (i = 1; i < _numActors; i++) {
    12771308                if (_actors[i]->_cost.soundCounter && _actors[i]->isInCurrentRoom() && _actors[i]->_sound) {
    12781309                        _currentScript = 0xFF;
    1279                         _sound->addSoundToQueue(_actors[i]->_sound[0]);
    1280                         for (i = 1; i < _numActors; i++) {
    1281                                 _actors[i]->_cost.soundCounter = 0;
     1310                        if (_game.version == 0) {
     1311                                sound = v0ActorSounds[i - 1] & 0x3F;
     1312                        } else {
     1313                                sound = _actors[i]->_sound[0];
    12821314                        }
     1315                        _sound->addSoundToQueue(sound);
     1316                        for (j = 1; j < _numActors; j++) {
     1317                                _actors[j]->_cost.soundCounter = 0;
     1318                        }
    12831319                        return;
    12841320                }
    12851321        }
  • engines/scumm/actor.h

     
    5555        byte active[16];
    5656        uint16 animCounter;
    5757        byte soundCounter;
     58        byte soundPos;
    5859        uint16 stopped;
    5960        uint16 curpos[16];
    6061        uint16 start[16];
  • engines/scumm/costume.cpp

     
    12991299                frameUpdate(A, cmd);
    13001300        }
    13011301
     1302        if (A->_moving  && _vm->_currentRoom != 1 && _vm->_currentRoom != 44) {
     1303                if (a->_cost.soundPos == 0)
     1304                        a->_cost.soundCounter++;
     1305                a->_cost.soundPos = (a->_cost.soundPos + 1) % 3;
     1306        }
     1307
    13021308        // increase each frame pos
    13031309        for (int limb = 0; limb < 8; ++limb) {
    13041310                if (a->_cost.curpos[limb] < a->_cost.end[limb])