diff options
author | Max Horn | 2003-06-30 23:18:20 +0000 |
---|---|---|
committer | Max Horn | 2003-06-30 23:18:20 +0000 |
commit | 095b68d74f91ebf72f8835aa21cc47ce281576a3 (patch) | |
tree | 1dbaf707dc42e3777aa337ed554bdc18aaafa402 /scumm | |
parent | 67a1aa89dbba487243c276c352768bb0aec3ae5a (diff) | |
download | scummvm-rg350-095b68d74f91ebf72f8835aa21cc47ce281576a3.tar.gz scummvm-rg350-095b68d74f91ebf72f8835aa21cc47ce281576a3.tar.bz2 scummvm-rg350-095b68d74f91ebf72f8835aa21cc47ce281576a3.zip |
partially implemented the Audio CD query opcode in Zak256 (see bug #762589); cleanup
svn-id: r8680
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/script_v5.cpp | 35 | ||||
-rw-r--r-- | scumm/sound.cpp | 20 | ||||
-rw-r--r-- | scumm/sound.h | 8 |
3 files changed, 45 insertions, 18 deletions
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 24fb2c86be..6ef79b5d4c 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -2015,15 +2015,38 @@ void Scumm_v5::o5_setVarRange() { } void Scumm_v5::o5_startMusic() { - int snd; if (_gameId == GID_ZAK256) { + // In Zak256, this seems to be some kind of Audio CD status query function. + // See also bug #762589 (thanks to Hibernatus for providing the information). getResultPos(); - snd = getVarOrDirectByte(0x80); - warning("unknown: o5_startMusic(%d)", snd); + int b = getVarOrDirectByte(0x80); + int result = 0; + switch (b) { + case 0: + result = _sound->pollCD() != 0; + break; + case 0xFC: + // TODO: Unpause (resume) audio track. We'll have to extend Sound and OSystem for this. + break; + case 0xFD: + // TODO: Pause audio track. We'll have to extend Sound and OSystem for this. + break; + case 0xFE: + result = _sound->getCurrentCDSound(); + break; + case 0xFF: + // Unknown, but apparently never used. + break; + default: + // TODO: return track length in seconds. We'll have to extend Sound and OSystem for this. + // To check scummvm returns the right track length you + // can look at the global script #9 (0x888A in 49.LFL). + break; + } + warning("unknown: o5_startMusic(%d)", b); setResult(0); } else { - snd = getVarOrDirectByte(0x80); - _sound->addSoundToQueue(snd); + _sound->addSoundToQueue(getVarOrDirectByte(0x80)); } } @@ -2522,7 +2545,7 @@ void Scumm_v5::decodeParseString() { _sound->stopCD(); } else { // Loom specified the offset from the start of the CD; - // thus we have to subtract the lenght of the first track + // thus we have to subtract the length of the first track // (22500 frames) plus the 2 second = 150 frame leadin. // I.e. in total 22650 frames. offset = (int)(offset * 7.5 - 22650); diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 825b26cb89..28b95c776f 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -93,7 +93,7 @@ Sound::Sound(Scumm *parent) { _musicDisk = 0; _talkChannel = -1; _current_cache = 0; - _current_cd_sound = 0; + _currentCDSound = 0; _sfxFile = 0; @@ -200,7 +200,7 @@ void Sound::playSound(int soundID) { _scumm->VAR(_scumm->VAR_MUSIC_TIMER) = 0; playCDTrack(track, loops == 0xff ? -1 : loops, start, 0); - _current_cd_sound = soundID; + _currentCDSound = soundID; return; } // Support for SFX in Monkey Island 1, Mac version @@ -379,12 +379,12 @@ void Sound::playSound(int soundID) { int start = (ptr[2] * 60 + ptr[3]) * 75 + ptr[4]; int end = (ptr[5] * 60 + ptr[6]) * 75 + ptr[7]; - if (soundID == _current_cd_sound) + if (soundID == _currentCDSound) if (pollCD() == 1) return; playCDTrack(track, loops == 0xff ? -1 : loops, start, end); - _current_cd_sound = soundID; + _currentCDSound = soundID; return; } @@ -601,7 +601,7 @@ bool Sound::isMouthSyncOff(uint pos) { int Sound::isSoundRunning(int sound) const { int i; - if (sound == _current_cd_sound) + if (sound == _currentCDSound) return pollCD(); if (_scumm->_features & GF_HUMONGOUS) { @@ -645,7 +645,7 @@ int Sound::isSoundRunning(int sound) const { bool Sound::isSoundActive(int sound) const { int i; - if (sound == _current_cd_sound) + if (sound == _currentCDSound) return pollCD() != 0; i = _soundQue2Pos; @@ -692,8 +692,8 @@ bool Sound::isSoundInQueue(int sound) const { void Sound::stopSound(int a) { int i; - if (a != 0 && a == _current_cd_sound) { - _current_cd_sound = 0; + if (a != 0 && a == _currentCDSound) { + _currentCDSound = 0; stopCD(); } @@ -711,8 +711,8 @@ void Sound::stopSound(int a) { } void Sound::stopAllSounds() { - if (_current_cd_sound != 0) { - _current_cd_sound = 0; + if (_currentCDSound != 0) { + _currentCDSound = 0; stopCD(); } diff --git a/scumm/sound.h b/scumm/sound.h index d2d32f7412..fc9f6ab942 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -82,7 +82,7 @@ protected: /* used for mp3 CD music */ - int _current_cd_sound; + int _currentCDSound; int _cached_tracks[CACHE_TRACKS]; int _dig_cd_index; @@ -102,8 +102,11 @@ public: int _talkChannel; /* Mixer channel actor is talking on */ bool _soundsPaused; - int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx; byte _sfxMode; + + // FIXME: Should add API to get/set volumes (and automatically + // update iMuse/iMuseDigi/Player_v2/SoundMIxer, too + int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx; Bundle *_bundle; // FIXME: should be protected but is used by Scumm::askForDisk @@ -143,6 +146,7 @@ public: void stopCD(); int pollCD() const; void updateCD(); + int getCurrentCDSound() const { return _currentCDSound; } protected: void clearSoundQue(); |