Ticket #8380: speech.patch

File speech.patch, 6.8 KB (added by SF/pnaulls, 19 years ago)

Speech patch

  • queen/journal.cpp

    RCS file: /cvsroot/scummvm/scummvm/queen/journal.cpp,v
    retrieving revision 1.44
    diff -u -r1.44 journal.cpp
     
    247247                }
    248248                drawConfigPanel();
    249249        } else if (zoneNum == ZN_VOICE_TOGGLE) {
    250                 if (_vm->resource()->isCD())
    251                         _vm->sound()->toggleSpeech();
    252                 else
    253                         _vm->sound()->speechToggle(false);
     250                _vm->sound()->toggleSpeech();
    254251                drawConfigPanel();
    255252        } else if (zoneNum == ZN_TEXT_TOGGLE) {
    256253                _vm->subtitles(!_vm->subtitles());
  • queen/logic.cpp

    RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
    retrieving revision 1.215
    diff -u -r1.215 logic.cpp
     
    12321232                // update screen scrolling
    12331233                _vm->display()->horizontalScroll(mx);
    12341234
    1235                 // update bobs position / frame
     1235                // update Bob's position / frame
    12361236                joe->x = piton->x = 3 * mx / 4 + 200;
    12371237                joe->frameNum = mx / 36 + 45;
    12381238
  • queen/queen.cpp

    RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
    retrieving revision 1.111
    diff -u -r1.111 queen.cpp
     
    110110        ConfMan.registerDefault("music_mute", false);
    111111        ConfMan.registerDefault("sfx_mute", false);
    112112        ConfMan.registerDefault("talkspeed", Logic::DEFAULT_TALK_SPEED);
    113         ConfMan.registerDefault("speech_mute", !_resource->isCD());
     113        ConfMan.registerDefault("speech_mute", false);
    114114        ConfMan.registerDefault("subtitles", true);
    115115}
    116116
     
    133133        _sound->musicToggle(!ConfMan.getBool("music_mute"));
    134134        _sound->sfxToggle(!ConfMan.getBool("sfx_mute"));
    135135        _talkSpeed = ConfMan.getInt("talkspeed");
    136         _sound->speechToggle(_resource->isCD() ? !ConfMan.getBool("speech_mute"): false);
     136        _sound->speechToggle(!ConfMan.getBool("speech_mute"));
    137137        _subtitles = ConfMan.getBool("subtitles");
    138138        checkOptionSettings();
    139139}
  • queen/sound.cpp

    RCS file: /cvsroot/scummvm/scummvm/queen/sound.cpp,v
    retrieving revision 1.47
    diff -u -r1.47 sound.cpp
     
    103103#endif
    104104                strcat(name, ".SB");
    105105                waitFinished(isSpeech);
    106                 sfxPlay(name, isSpeech);
     106                if (_vm->resource()->fileExists(name)) {
     107                        _lastSampleExists = true;
     108                        sfxPlay(name, isSpeech);
     109                } else {
     110                        _lastSampleExists = false;
     111                }
    107112        }
    108113}
    109114
     
    120125        }
    121126        strcat(name, ".SB");
    122127        waitFinished(isSpeech);
    123         sfxPlay(name, isSpeech);
     128        if (_vm->resource()->fileExists(name)) {
     129                _lastSampleExists = true;
     130                sfxPlay(name, isSpeech);
     131        } else {
     132                _lastSampleExists = false;
     133        }
    124134}
    125135
    126136void Sound::playSong(int16 songNum) {
     
    191201
    192202#ifdef USE_MAD
    193203void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
    194         if (_vm->resource()->fileExists(name)) {
    195                 uint32 size;
    196                 File *f = _vm->resource()->giveCompressedSound(name, &size);
    197                 _mixer->playInputStream(isSpeech ? &_speechHandle : &_sfxHandle, makeMP3Stream(f, size), false);
    198         }
     204        uint32 size;
     205        File *f = _vm->resource()->giveCompressedSound(name, &size);
     206        _mixer->playInputStream(isSpeech ? &_speechHandle : &_sfxHandle, makeMP3Stream(f, size), false);
    199207}
    200208#endif
    201209
    202210#ifdef USE_VORBIS
    203211void OGGSound::sfxPlay(const char *name, bool isSpeech) {
    204         if (_vm->resource()->fileExists(name)) {
    205                 uint32 size;
    206                 File *f = _vm->resource()->giveCompressedSound(name, &size);           
    207                 _mixer->playInputStream(isSpeech ? &_speechHandle : &_sfxHandle, makeVorbisStream(f, size), false);
    208         }
     212        uint32 size;
     213        File *f = _vm->resource()->giveCompressedSound(name, &size);
     214        _mixer->playInputStream(isSpeech ? &_speechHandle : &_sfxHandle, makeVorbisStream(f, size), false);
    209215}
    210216#endif
    211217
    212218#ifdef USE_FLAC
    213219void FLACSound::sfxPlay(const char *name, bool isSpeech) {
    214         if (_vm->resource()->fileExists(name)) {
    215                 uint32 size;
    216                 File *f = _vm->resource()->giveCompressedSound(name, &size);           
    217                 _mixer->playInputStream(isSpeech ? &_speechHandle : &_sfxHandle, makeFlacStream(f, size), false);
    218         }
     220        uint32 size;
     221        File *f = _vm->resource()->giveCompressedSound(name, &size);
     222        _mixer->playInputStream(isSpeech ? &_speechHandle : &_sfxHandle, makeFlacStream(f, size), false);
    219223}
    220224#endif
    221225
  • queen/sound.h

    RCS file: /cvsroot/scummvm/scummvm/queen/sound.h,v
    retrieving revision 1.24
    diff -u -r1.24 sound.h
     
    5353public:
    5454        Sound(SoundMixer *mixer, QueenEngine *vm);
    5555        virtual ~Sound();
    56         virtual void sfxPlay(const char *name, bool isSpeech) = 0;
    5756        static Sound *giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression);
    5857        void playSfx(uint16 sfx, bool isSpeech);
    5958        void playSfx(const char *base, bool isSpeech);
     
    7675
    7776        bool isSpeechActive() const     { return _speechHandle.isActive(); }
    7877        bool isSfxActive() const        { return _sfxHandle.isActive(); }
    79        
     78        bool lastSampleExists() const   { return _lastSampleExists; }       
     79
    8080        int16 lastOverride() const      { return _lastOverride; }
    8181
    8282        void saveState(byte *&ptr);
     
    107107        bool _sfxToggle;
    108108        bool _speechToggle;
    109109        bool _musicToggle;
     110        bool _lastSampleExists;
    110111       
    111112        int16 _lastOverride;
    112113        PlayingSoundHandle _sfxHandle;
    113114        PlayingSoundHandle _speechHandle;
     115
     116private:
     117        virtual void sfxPlay(const char *name, bool isSpeech) = 0;
    114118};
    115119
    116120class SilentSound : public Sound {
  • queen/talk.cpp

    RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
    retrieving revision 1.112
    diff -u -r1.112 talk.cpp
     
    757757                                break;
    758758                        }
    759759                       
    760                         if (_vm->sound()->speechOn()) {
     760                        if (_vm->sound()->speechOn() && _vm->sound()->lastSampleExists()) {
    761761                                // sfx is finished, stop the speak animation
    762762                                if (!_vm->sound()->isSpeechActive()) {
    763763                                        break;
     
    772772                }
    773773        }
    774774
    775         // Make sure that Person closes their mouths
     775        // Make sure that Person closes their mouth
    776776        if (!isJoe && parameters->ff > 0)
    777777                _vm->bankMan()->overpack(parameters->ff, startFrame, bankNum);
    778778}
     
    834834        if (!isJoe) {
    835835                if (SPEAK_AMAL_ON == command) {
    836836                        // It's the oracle!
    837                         // Dont turn AMAL animation off, and dont manually anim person
     837                        // Don't turn AMAL animation off, and don't manually anim person
    838838                        command = SPEAK_ORACLE;
    839839                        oracle = true;
    840840                        uint16 frameNum = _vm->graphics()->personFrames(bobNum);