diff options
author | Alyssa Milburn | 2011-08-24 10:56:43 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-08-24 10:58:06 +0200 |
commit | 5efba92b8e58242fcad2c2eb0c0cf1a7e09579b0 (patch) | |
tree | 848fd4ca8e2c67ff506d733de93c74a307ba49f1 /engines/hugo | |
parent | 8755ebc0aa9526966bfa5001e0ce811df91166e5 (diff) | |
download | scummvm-rg350-5efba92b8e58242fcad2c2eb0c0cf1a7e09579b0.tar.gz scummvm-rg350-5efba92b8e58242fcad2c2eb0c0cf1a7e09579b0.tar.bz2 scummvm-rg350-5efba92b8e58242fcad2c2eb0c0cf1a7e09579b0.zip |
HUGO: Coding style fixes.
Diffstat (limited to 'engines/hugo')
-rw-r--r-- | engines/hugo/intro.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/schedule.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/sound.cpp | 88 | ||||
-rw-r--r-- | engines/hugo/sound.h | 12 |
4 files changed, 51 insertions, 53 deletions
diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp index c66c0ef624..72f718fe8e 100644 --- a/engines/hugo/intro.cpp +++ b/engines/hugo/intro.cpp @@ -317,7 +317,7 @@ void intro_v3d::introInit() { _vm->_file->readBackground(22); // display screen MAP_3d _vm->_screen->displayBackground(); introTicks = 0; - _vm->_sound->DOSSongPtr = _vm->_sound->DOSIntroSong; + _vm->_sound->_DOSSongPtr = _vm->_sound->_DOSIntroSong; } /** diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index d1b4aa6a9c..dc20ca117d 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -1416,7 +1416,7 @@ event_t *Scheduler::doAction(event_t *curEvent) { break; case OLD_SONG: // Replaces ACT26 for DOS games. - _vm->_sound->DOSSongPtr = _vm->_text->getTextData(action->a49.songIndex); + _vm->_sound->_DOSSongPtr = _vm->_text->getTextData(action->a49.songIndex); break; default: error("An error has occurred: %s", "doAction"); diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index fe34e6ff2d..79ec066b7f 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -123,11 +123,11 @@ SoundHandler::SoundHandler(HugoEngine *vm) : _vm(vm) { _speakerStream = new Audio::PCSpeaker(_vm->_mixer->getOutputRate()); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); - DOSSongPtr = 0; - curPriority = 0; - pcspkrTimer = 0; - pcspkrOctave = 3; - pcspkrNoteDuration = 2; + _DOSSongPtr = 0; + _curPriority = 0; + _pcspkrTimer = 0; + _pcspkrOctave = 3; + _pcspkrNoteDuration = 2; } SoundHandler::~SoundHandler() { @@ -207,7 +207,7 @@ void SoundHandler::playSound(int16 sound, const byte priority) { return; syncVolume(); - curPriority = priority; + _curPriority = priority; // Get sound data if ((sound_p = _vm->_file->getSound(sound, &size)) == 0) @@ -272,61 +272,58 @@ void SoundHandler::pcspkr_player() { _vm->getTimerManager()->removeTimerProc(&loopPlayer); _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this, "hugoSoundLoop"); - uint16 count; // Value to set timer chip to for note - bool cmd_note; - if (!_vm->_config.soundFl || !_vm->_mixer->isReady()) return; // Poo! User doesn't want sound! - if (!DOSSongPtr) + if (!_DOSSongPtr) return; - if (!*DOSSongPtr) // Song has finished + if (!*_DOSSongPtr) // Song has finished return; - if (!--pcspkrTimer) { // timer zero, stop note + if (!--_pcspkrTimer) { // timer zero, stop note _speakerStream->stop(); return; - } else if (pcspkrTimer >= 0) { // Note still going + } else if (_pcspkrTimer >= 0) { // Note still going return; } // Time to play next note + bool cmdNote = true; do { - cmd_note = true; - switch (*DOSSongPtr) { + switch (*_DOSSongPtr) { case 'O': // Switch to new octave 1..7 - DOSSongPtr++; - pcspkrOctave = *DOSSongPtr - '0'; - if ((pcspkrOctave < 0) || (pcspkrOctave > 7)) + _DOSSongPtr++; + _pcspkrOctave = *_DOSSongPtr - '0'; + if ((_pcspkrOctave < 0) || (_pcspkrOctave > 7)) error("pcspkr_player() - Bad octave"); - DOSSongPtr++; + _DOSSongPtr++; break; case 'L': // Switch to new duration (in ticks) - DOSSongPtr++; - pcspkrNoteDuration = *DOSSongPtr - '0'; - if (pcspkrNoteDuration < 0) + _DOSSongPtr++; + _pcspkrNoteDuration = *_DOSSongPtr - '0'; + if (_pcspkrNoteDuration < 0) error("pcspkr_player() - Bad duration"); - pcspkrNoteDuration--; - DOSSongPtr++; + _pcspkrNoteDuration--; + _DOSSongPtr++; break; case '<': case '^': // Move up an octave - pcspkrOctave++; - DOSSongPtr++; + _pcspkrOctave++; + _DOSSongPtr++; break; case '>': case 'v': // Move down an octave - pcspkrOctave--; - DOSSongPtr++; + _pcspkrOctave--; + _DOSSongPtr++; break; default: - cmd_note = false; + cmdNote = false; break; } - } while (cmd_note); + } while (cmdNote); - switch (*DOSSongPtr) { + switch (*_DOSSongPtr) { case 'A': // The notes. case 'B': case 'C': @@ -334,29 +331,30 @@ void SoundHandler::pcspkr_player() { case 'E': case 'F': case 'G': - count = pcspkrNotes[*DOSSongPtr - 'A']; - switch (DOSSongPtr[1]) { // Check for sharp or flat (#, -) + uint16 count; // Value to set timer chip to for note + count = pcspkrNotes[*_DOSSongPtr - 'A']; + switch (_DOSSongPtr[1]) { // Check for sharp or flat (#, -) case '#': - count = pcspkrSharps[*DOSSongPtr++ - 'A']; + count = pcspkrSharps[*_DOSSongPtr++ - 'A']; break; case 'b': - count = pcspkrFlats[*DOSSongPtr++ - 'A']; + count = pcspkrFlats[*_DOSSongPtr++ - 'A']; break; default: break; } - if (pcspkrOctave > 3) // Adjust for octave - count /= (1 << (pcspkrOctave - 3)); - else if (pcspkrOctave < 3) - count *= (1 << (3 - pcspkrOctave)); - _speakerStream->play(Audio::PCSpeaker::kWaveFormSaw, kHugoCNT / count, (int32) ((1 + pcspkrNoteDuration) * _vm->_normalTPS) * 8); - pcspkrTimer = pcspkrNoteDuration; - DOSSongPtr++; + if (_pcspkrOctave > 3) // Adjust for octave + count /= (1 << (_pcspkrOctave - 3)); + else if (_pcspkrOctave < 3) + count *= (1 << (3 - _pcspkrOctave)); + _speakerStream->play(Audio::PCSpeaker::kWaveFormSaw, kHugoCNT / count, (int32) ((1 + _pcspkrNoteDuration) * _vm->_normalTPS) * 8); + _pcspkrTimer = _pcspkrNoteDuration; + _DOSSongPtr++; break; case '.': // A rest note _speakerStream->stop(); - pcspkrTimer = pcspkrNoteDuration; - DOSSongPtr++; + _pcspkrTimer = _pcspkrNoteDuration; + _DOSSongPtr++; break; default: warning("pcspkr_player() - Unhandled note"); @@ -367,7 +365,7 @@ void SoundHandler::loadIntroSong(Common::ReadStream &in) { for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { uint16 numBuf = in.readUint16BE(); if (varnt == _vm->_gameVariant) - DOSIntroSong = _vm->_text->getTextData(numBuf); + _DOSIntroSong = _vm->_text->getTextData(numBuf); } } diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h index 33dba9f2a8..1e504fbdea 100644 --- a/engines/hugo/sound.h +++ b/engines/hugo/sound.h @@ -60,12 +60,12 @@ public: static const int kHugoCNT = 1190000; - int8 pcspkrTimer; // Timer (ticks) for note being played - int8 pcspkrOctave; // Current octave 1..7 - int8 pcspkrNoteDuration; // Current length of note (ticks) + int8 _pcspkrTimer; // Timer (ticks) for note being played + int8 _pcspkrOctave; // Current octave 1..7 + int8 _pcspkrNoteDuration; // Current length of note (ticks) - const char *DOSSongPtr; - const char *DOSIntroSong; + const char *_DOSSongPtr; + const char *_DOSIntroSong; void toggleMusic(); void toggleSound(); @@ -80,7 +80,7 @@ public: void loadIntroSong(Common::ReadStream &in); void initPcspkrPlayer(); protected: - byte curPriority; // Priority of currently playing sound + byte _curPriority; // Priority of currently playing sound private: HugoEngine *_vm; |