mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
SHERLOCK: Rework the "song" debugger command
Instead of taking a room number (which didn't work in Rose Tattoo), it now takes a song name. To see which songs are available, use the "songs" command. Note that this is still only works for Serrated Scalpel, since I haven't implemented getting a list of available songs for Rose Tattoo. I need to study the resource manager a bit first...
This commit is contained in:
parent
7f4268dc3d
commit
e734bb5078
@ -29,6 +29,7 @@
|
||||
#include "audio/mixer.h"
|
||||
#include "audio/decoders/aiff.h"
|
||||
#include "audio/decoders/wave.h"
|
||||
#include "common/str-array.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
@ -45,8 +46,9 @@ Debugger::Debugger(SherlockEngine *vm) : GUI::Debugger(), _vm(vm) {
|
||||
registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
|
||||
registerCmd("scene", WRAP_METHOD(Debugger, cmdScene));
|
||||
registerCmd("song", WRAP_METHOD(Debugger, cmdSong));
|
||||
registerCmd("songs", WRAP_METHOD(Debugger, cmdListSongs));
|
||||
registerCmd("dumpfile", WRAP_METHOD(Debugger, cmdDumpFile));
|
||||
registerCmd("locations", WRAP_METHOD(Debugger, cmdLocations));
|
||||
registerCmd("locations", WRAP_METHOD(Debugger, cmdLocations));
|
||||
}
|
||||
|
||||
void Debugger::postEnter() {
|
||||
@ -87,15 +89,29 @@ bool Debugger::cmdScene(int argc, const char **argv) {
|
||||
|
||||
bool Debugger::cmdSong(int argc, const char **argv) {
|
||||
if (argc != 2) {
|
||||
debugPrintf("Format: song <room>\n");
|
||||
debugPrintf("Format: song <name>\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!_vm->_music->loadSong(strToInt(argv[1]))) {
|
||||
debugPrintf("Invalid song number.\n");
|
||||
return true;
|
||||
Common::StringArray songs;
|
||||
_vm->_music->getSongNames(songs);
|
||||
|
||||
for (uint i = 0; i < songs.size(); i++) {
|
||||
if (songs[i].equalsIgnoreCase(argv[1])) {
|
||||
_vm->_music->loadSong(songs[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
debugPrintf("Invalid song. Use the 'songs' command to see which ones are available.\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Debugger::cmdListSongs(int argc, const char **argv) {
|
||||
Common::StringArray songs;
|
||||
_vm->_music->getSongNames(songs);
|
||||
debugPrintColumns(songs);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Debugger::cmdDumpFile(int argc, const char **argv) {
|
||||
|
@ -49,6 +49,11 @@ private:
|
||||
*/
|
||||
bool cmdSong(int argc, const char **argv);
|
||||
|
||||
/**
|
||||
* Lists all available songs
|
||||
*/
|
||||
bool cmdListSongs(int argc, const char **argv);
|
||||
|
||||
/**
|
||||
* Dumps a file to disk
|
||||
*/
|
||||
|
@ -20,6 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/algorithm.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/mutex.h"
|
||||
#include "sherlock/sherlock.h"
|
||||
@ -579,4 +580,14 @@ void Music::setMusicVolume(int volume) {
|
||||
_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
|
||||
}
|
||||
|
||||
void Music::getSongNames(Common::StringArray &songs) {
|
||||
songs.clear();
|
||||
if (IS_SERRATED_SCALPEL) {
|
||||
for (int i = 0; i < ARRAYSIZE(SONG_NAMES); i++) {
|
||||
songs.push_back(SONG_NAMES[i]);
|
||||
}
|
||||
}
|
||||
Common::sort(songs.begin(), songs.end());
|
||||
}
|
||||
|
||||
} // End of namespace Sherlock
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "audio/audiostream.h"
|
||||
#include "audio/mixer.h"
|
||||
#include "common/mutex.h"
|
||||
#include "common/str-array.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
@ -121,9 +122,13 @@ public:
|
||||
* Sets the volume of the MIDI music with a value ranging from 0 to 127
|
||||
*/
|
||||
void setMusicVolume(int volume);
|
||||
|
||||
/**
|
||||
* Gets the names of all the songs in the game. Used by the debugger.
|
||||
*/
|
||||
void getSongNames(Common::StringArray &songs);
|
||||
};
|
||||
|
||||
} // End of namespace Sherlock
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user