Skip to content

Commit

Permalink
HOPKINS: Improve private/public scope in SoundManager and ScriptManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Feb 8, 2013
1 parent 3de056d commit 6ce3e21
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 55 deletions.
4 changes: 2 additions & 2 deletions engines/hopkins/hopkins.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions engines/hopkins/script.h
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions engines/hopkins/sound.cpp
Expand Up @@ -198,7 +198,7 @@ SoundManager::SoundManager() {
_voiceOffFl = true;
_textOffFl = false;
_soundFl = false;
skipRefreshFl = false;
_skipRefreshFl = false;
_currentSoundIndex = 0;
_oldSoundNumber = 0;
_modPlayingFl = false;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down
91 changes: 44 additions & 47 deletions engines/hopkins/sound.h
Expand Up @@ -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
Expand Down

0 comments on commit 6ce3e21

Please sign in to comment.