Ticket #1289: simon_voice_hack.diff

File simon_voice_hack.diff, 1.7 KB (added by eriktorbjorn, 20 years ago)

Patch against an October 30 CVS snapshot

  • scummvm/simon/simon.cpp

    diff -ur --exclude=CVS ScummVM/scummvm/simon/simon.cpp ScummVM+hack/scummvm/simon/simon.cpp
    old new  
    47464746
    47474747        _rnd.getRandomNumber(2);
    47484748
     4749        _sound->pollVoice();
     4750
    47494751        do {
    47504752                while (!_in_callback && cur >= _last_vga_tick + vga_period) {
    47514753                        _last_vga_tick += vga_period;
  • scummvm/simon/sound.cpp

    diff -ur --exclude=CVS ScummVM/scummvm/simon/sound.cpp ScummVM+hack/scummvm/simon/sound.cpp
    old new  
    399399        _voice = new RawSound(_mixer, file, 0, SOUND_BIG_ENDIAN);
    400400}
    401401
     402#define VOICE_QUEUE_ENTRIES 10
     403
     404static int pendingVoices = 0;
     405static uint voiceQueue[VOICE_QUEUE_ENTRIES];
     406
    402407void SimonSound::playVoice(uint sound) {
     408        if (pendingVoices >= VOICE_QUEUE_ENTRIES) {
     409                warning("Voice queue overflow");
     410                return;
     411        }
     412
     413        voiceQueue[pendingVoices++] = sound;
     414}
     415
     416void SimonSound::pollVoice() {
     417        if (_voice_handle || pendingVoices == 0)
     418                return;
     419
     420        uint sound = voiceQueue[0];
     421        pendingVoices--;
     422
     423        for (int i = 0; i < pendingVoices; i++)
     424                voiceQueue[i] = voiceQueue[i + 1];
     425
    403426        if (_game == GAME_SIMON2MAC && _filenums) {
    404427                stopAll();
    405428
  • scummvm/simon/sound.h

    diff -ur --exclude=CVS ScummVM/scummvm/simon/sound.h ScummVM+hack/scummvm/simon/sound.h
    old new  
    6363        void readVoiceFile(const char *filename, const Common::String &gameDataPath);
    6464
    6565        void playVoice(uint sound);
     66        void pollVoice();
    6667        void playEffects(uint sound);
    6768        void playAmbient(uint sound);
    6869