From 6ce3e2187b6a2395b96b9f9a55c5c40d6b887333 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 8 Feb 2013 07:29:40 +0100 Subject: HOPKINS: Improve private/public scope in SoundManager and ScriptManager --- engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/script.h | 6 +-- engines/hopkins/sound.cpp | 12 ++++-- engines/hopkins/sound.h | 91 ++++++++++++++++++++++----------------------- 4 files changed, 58 insertions(+), 55 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index f899ee3e61..d40d5de060 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2171,7 +2171,7 @@ void HopkinsEngine::playEnding() { _objectsManager.stopBobAnimation(7); if (_globals._saveData->_data[svField135] == 1) { _soundManager._specialSoundNum = 200; - _soundManager.skipRefreshFl = true; + _soundManager._skipRefreshFl = true; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("BERM.ANM", 100, 24, 300); _graphicsManager.FIN_VISU(); @@ -2208,7 +2208,7 @@ void HopkinsEngine::playEnding() { _globals._disableInventFl = false; } else { _soundManager._specialSoundNum = 200; - _soundManager.skipRefreshFl = true; + _soundManager._skipRefreshFl = true; _animationManager.playAnim2("BERM.ANM", 100, 24, 300); _objectsManager.stopBobAnimation(7); _objectsManager.setBobAnimation(8); diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index f37baffdac..40b9612627 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -33,16 +33,16 @@ namespace Hopkins { class ScriptManager { private: HopkinsEngine *_vm; + int checkOpcode(const byte *dataP); public: bool TRAVAILOBJET; -public: + ScriptManager(); void setParent(HopkinsEngine *vm); int handleOpcode(byte *dataP); - int checkOpcode(const byte *dataP); - int handleGoto(const byte *dataP); int handleIf(const byte *dataP, int a2); + int handleGoto(const byte *dataP); }; } // End of namespace Hopkins diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 7b59f1ee62..e30e670b27 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -198,7 +198,7 @@ SoundManager::SoundManager() { _voiceOffFl = true; _textOffFl = false; _soundFl = false; - skipRefreshFl = false; + _skipRefreshFl = false; _currentSoundIndex = 0; _oldSoundNumber = 0; _modPlayingFl = false; @@ -457,6 +457,9 @@ void SoundManager::checkSounds() { checkVoiceActivity(); } +/** + * Checks voices to see if they're finished + */ void SoundManager::checkVoiceActivity() { // Check the status of each voice. bool hasActiveVoice = false; @@ -588,7 +591,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { // Loop for playing voice breakFlag = 0; do { - if (_specialSoundNum != 4 && !skipRefreshFl) + if (_specialSoundNum != 4 && !_skipRefreshFl) _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton()) break; @@ -609,7 +612,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); } _vm->_eventsManager._escKeyFl = false; - skipRefreshFl = false; + _skipRefreshFl = false; return true; } @@ -876,6 +879,9 @@ void SoundManager::updateScummVMSoundSettings() { ConfMan.flushToDisk(); } +/** + * Creates an audio stream based on a passed raw stream + */ Audio::RewindableAudioStream *SoundManager::makeSoundStream(Common::SeekableReadStream *stream) { if (_vm->getPlatform() == Common::kPlatformWindows) return Audio::makeAPCStream(stream, DisposeAfterUse::YES); diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 081046d335..70c05a83fc 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -65,79 +65,76 @@ class SoundManager { private: HopkinsEngine *_vm; + Audio::SoundHandle _musicHandle; + int _currentSoundIndex; + bool _modPlayingFl; + int _oldSoundNumber; + + VoiceItem _voice[VOICE_COUNT]; + SwavItem Swav[SWAV_COUNT]; + SoundItem _sound[SOUND_COUNT]; + MusicItem _music; + + void playMod(const Common::String &file); + void loadMusic(const Common::String &file); + void playMusic(); + void stopMusic(); + void delMusic(); bool checkVoiceStatus(int voiceIndex); void stopVoice(int voiceIndex); - void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); void playVoice(); + void delWav(int wavIndex); + void checkVoiceActivity(); + Common::String setExtension(const Common::String &str, const Common::String &ext); + Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); + + void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); bool DEL_SAMPLE_SDL(int wavIndex); bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample); - void delWav(int wavIndex); void PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex); - /** - * Checks voices to see if they're finished - */ - void checkVoiceActivity(); - - /** - * Creates an audio stream based on a passed raw stream - */ - Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); public: - Audio::SoundHandle _musicHandle; - int _specialSoundNum; - int _soundVolume; - int _voiceVolume; - int _musicVolume; - bool _soundOffFl; bool _musicOffFl; + bool _soundOffFl; bool _voiceOffFl; bool _textOffFl; bool _soundFl; - bool skipRefreshFl; - int _currentSoundIndex; - bool _modPlayingFl; - int _oldSoundNumber; - - VoiceItem _voice[VOICE_COUNT]; - SwavItem Swav[SWAV_COUNT]; - SoundItem _sound[SOUND_COUNT]; - MusicItem _music; + bool _skipRefreshFl; + int _musicVolume; + int _soundVolume; + int _voiceVolume; + int _specialSoundNum; public: SoundManager(); ~SoundManager(); void setParent(HopkinsEngine *vm); - void checkSoundEnd(); void loadAnimSound(); void playAnimSound(int soundNumber); - void loadWav(const Common::String &file, int wavIndex); - void playWav(int wavIndex); - void WSOUND(int soundNumber); - void WSOUND_OFF(); - void playMod(const Common::String &file); - void loadMusic(const Common::String &file); - void playMusic(); - void stopMusic(); - void delMusic(); + void loadSample(int wavIndex, const Common::String &file); + void playSample(int wavIndex, int voiceMode); - bool mixVoice(int voiceId, int voiceMode); - void DEL_SAMPLE(int soundIndex); + void checkSoundEnd(); + void checkSounds(); void playSound(const Common::String &file); - void PLAY_SOUND2(const Common::String &file2); + void updateScummVMSoundSettings(); + void syncSoundSettings(); + bool mixVoice(int voiceId, int voiceMode); + + void MODSetMusicVolume(int volume); void MODSetSampleVolume(); void MODSetVoiceVolume(); - void MODSetMusicVolume(int volume); - void loadSample(int wavIndex, const Common::String &file); - void playSample(int wavIndex, int voiceMode); - void PLAY_SAMPLE2(int idx); - void syncSoundSettings(); - void updateScummVMSoundSettings(); - void checkSounds(); - Common::String setExtension(const Common::String &str, const Common::String &ext); + void loadWav(const Common::String &file, int wavIndex); + void playWav(int wavIndex); + + void DEL_SAMPLE(int soundIndex); + void WSOUND(int soundNumber); + void WSOUND_OFF(); + void PLAY_SOUND2(const Common::String &file2); + void PLAY_SAMPLE2(int idx); }; } // End of namespace Hopkins -- cgit v1.2.3