diff options
author | Paul Gilbert | 2016-09-16 20:05:12 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-09-16 20:05:12 -0400 |
commit | eb09d8eda2d1e443b966e9ae7713999bb50762e8 (patch) | |
tree | 06908c1e7bff6229bef18af9e3844409e35c97d5 | |
parent | d5f290dbc7946ec0f2872f0cd8d6d3a63c9f2162 (diff) | |
download | scummvm-rg350-eb09d8eda2d1e443b966e9ae7713999bb50762e8.tar.gz scummvm-rg350-eb09d8eda2d1e443b966e9ae7713999bb50762e8.tar.bz2 scummvm-rg350-eb09d8eda2d1e443b966e9ae7713999bb50762e8.zip |
XEEN: Further cleanup of unneeded music code
-rw-r--r-- | engines/xeen/music.cpp | 28 | ||||
-rw-r--r-- | engines/xeen/music.h | 12 | ||||
-rw-r--r-- | engines/xeen/sound.cpp | 8 | ||||
-rw-r--r-- | engines/xeen/sound.h | 6 | ||||
-rw-r--r-- | engines/xeen/town.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/darkside_cutscenes.cpp | 3 |
6 files changed, 27 insertions, 32 deletions
diff --git a/engines/xeen/music.cpp b/engines/xeen/music.cpp index 0e061e9232..4a3caa911c 100644 --- a/engines/xeen/music.cpp +++ b/engines/xeen/music.cpp @@ -37,6 +37,11 @@ MusicDriver::MusicDriver() : _fieldF(false), _musicPlaying(false), _fxPlaying(fa _channels.resize(CHANNEL_COUNT); } +MusicDriver::~MusicDriver() { + _musicPlaying = _fxPlaying = false; + _musCountdownTimer = _fxCountdownTimer = 0; +} + void MusicDriver::execute() { bool isFX = false; const byte *srcP = nullptr; @@ -90,7 +95,7 @@ bool MusicDriver::musCallSubroutine(const byte *&srcP, byte param) { bool MusicDriver::musSetCountdown(const byte *&srcP, byte param) { // Set the countdown timer if (!param) - param = *++srcP; + param = *srcP++; _musCountdownTimer = param; _musDataPtr = srcP; @@ -154,7 +159,7 @@ bool MusicDriver::fxCallSubroutine(const byte *&srcP, byte param) { bool MusicDriver::fxSetCountdown(const byte *&srcP, byte param) { // Set the countdown timer if (!param) - param = *++srcP; + param = *srcP++; _fxCountdownTimer = param; _musDataPtr = srcP; @@ -196,7 +201,10 @@ void MusicDriver::playSong(const byte *data) { } int MusicDriver::songCommand(uint commandId, byte volume) { - if (RESTART_MUSIC == 1) { + if (commandId == STOP_SONG) { + _musicPlaying = false; + } else if (commandId == RESTART_SONG) { + _musicPlaying = true; _musDataPtr = nullptr; _musSubroutines.clear(); } @@ -273,12 +281,12 @@ void AdlibMusicDriver::playSong(const byte *data) { int AdlibMusicDriver::songCommand(uint commandId, byte volume) { Common::StackLock slock(_driverMutex); + MusicDriver::songCommand(commandId, volume); - if (commandId == STOP_MUSIC) { - _musicPlaying = false; + if (commandId == STOP_SONG) { _field180 = 0; resetFrequencies(); - } else if (commandId == RESTART_MUSIC) { + } else if (commandId == RESTART_SONG) { _field180 = 0; _musicPlaying = true; } else if (commandId < 0x100) { @@ -597,6 +605,7 @@ Music::Music() : _musicDriver(nullptr), _songData(nullptr) { } Music::~Music() { + stopSong(); delete _musicDriver; delete[] _effectsData; delete[] _songData; @@ -632,7 +641,7 @@ void Music::playFX(uint effectId) { int Music::songCommand(uint commandId, byte volume) { int result = _musicDriver->songCommand(commandId, volume); - if (commandId == STOP_MUSIC) { + if (commandId == STOP_SONG) { delete[] _songData; _songData = nullptr; } @@ -641,8 +650,7 @@ int Music::songCommand(uint commandId, byte volume) { } void Music::playSong(Common::SeekableReadStream &stream) { - if (_songData) - stopMusic(); + stopSong(); byte *songData = new byte[stream.size()]; stream.seek(0); @@ -652,7 +660,7 @@ void Music::playSong(Common::SeekableReadStream &stream) { _musicDriver->playSong(_songData); } -void Music::playSong(const Common::String &name) { +void Music::playSong(const Common::String &name, int param) { File f(name); playSong(f); } diff --git a/engines/xeen/music.h b/engines/xeen/music.h index 5b23cc1965..9e9945de05 100644 --- a/engines/xeen/music.h +++ b/engines/xeen/music.h @@ -39,7 +39,7 @@ namespace OPL { namespace Xeen { enum MusicCommand { - STOP_MUSIC = 0, RESTART_MUSIC = 1, SET_VOLUME = 0x100, + STOP_SONG = 0, RESTART_SONG = 1, SET_VOLUME = 0x100, GET_STATUS = 0xFFE0 }; @@ -148,7 +148,7 @@ public: /** * Destructor */ - virtual ~MusicDriver() {} + virtual ~MusicDriver(); /** * Starts an special effect playing @@ -326,12 +326,12 @@ public: /** * Stops any currently playing music */ - void stopMusic() { songCommand(STOP_MUSIC); } + void stopSong() { songCommand(STOP_SONG); } /** - * Restart the music + * Restart a previously playing song (which must still be loaded) */ - void restartMusic() { songCommand(RESTART_MUSIC); } + void restartSong() { songCommand(RESTART_SONG); } /** * Sets the music volume @@ -346,7 +346,7 @@ public: /** * Plays a song */ - void playSong(const Common::String &name); + void playSong(const Common::String &name, int param = 0); /** * Plays a song diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp index f3d3a3e75b..d6bbc4c487 100644 --- a/engines/xeen/sound.cpp +++ b/engines/xeen/sound.cpp @@ -54,14 +54,6 @@ void Sound::proc2(Common::SeekableReadStream &f) { // TODO } -void Sound::startMusic(int v1) { - // TODO -} - -void Sound::stopMusic(int id) { - // TODO -} - void Sound::playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle, Audio::Mixer::SoundType soundType) { Audio::SeekableAudioStream *stream = Audio::makeVOCStream(s, 0); diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index aba38c81b2..b7ad94893b 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -63,12 +63,6 @@ public: void proc2(Common::SeekableReadStream &f); - void loadMusic(const Common::String &name, int v2) {} - - void startMusic(int v1); - - void stopMusic(int id); - /** * Play a given sound */ diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index 7cba3853f2..ba4b48131b 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -203,7 +203,7 @@ int Town::townAction(int actionId) { break; } - sound.loadMusic(TOWN_ACTION_MUSIC[actionId], 223); + sound.playSong(TOWN_ACTION_MUSIC[actionId], 223); _townSprites.resize(TOWN_ACTION_FILES[isDarkCc][actionId]); for (uint idx = 0; idx < _townSprites.size(); ++idx) { diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp index 6a6eec20d3..e3bd2c6f66 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp +++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp @@ -67,6 +67,7 @@ bool DarkSideCutscenes::showDarkSideTitle() { events.updateGameCounter(); events.wait(1000, true); + sound.stopSong(); delete[] data; /* // Initial loop for dragon roaring @@ -236,7 +237,7 @@ bool DarkSideCutscenes::showDarkSideIntro() { screen.draw(); if (idx == 2) - sound.stopMusic(48); + sound.setMusicVolume(48); if (events.wait(2, true)) return false; } |