From e6a7360d06adff5db538a178b9d897bb0509627c Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 27 Jan 2004 17:13:43 +0000 Subject: Add help Add music option for Simon1 svn-id: r12636 --- simon/debugger.cpp | 43 +++++++++++++++++++++++++++++++++++++++---- simon/debugger.h | 2 ++ 2 files changed, 41 insertions(+), 4 deletions(-) (limited to 'simon') diff --git a/simon/debugger.cpp b/simon/debugger.cpp index 442db2e700..805ffa7af4 100644 --- a/simon/debugger.cpp +++ b/simon/debugger.cpp @@ -31,18 +31,20 @@ Debugger::Debugger(SimonEngine *vm) _vm = vm; DCmd_Register("exit", &Debugger::Cmd_Exit); + DCmd_Register("help", &Debugger::Cmd_Help); DCmd_Register("quit", &Debugger::Cmd_Exit); - DCmd_Register("playVoice", &Debugger::Cmd_PlayVoice); + DCmd_Register("voice", &Debugger::Cmd_PlayVoice); + DCmd_Register("music", &Debugger::Cmd_PlayMusic); } void Debugger::preEnter() { - _vm->midi.pause(1); + //_vm->midi.pause(1); } void Debugger::postEnter() { - _vm->midi.pause(0); + //_vm->midi.pause(0); } @@ -51,12 +53,45 @@ bool Debugger::Cmd_Exit(int argc, const char **argv) { return false; } +bool Debugger::Cmd_Help(int argc, const char **argv) { + // console normally has 39 line width + // wrap around nicely + int width = 0, size, i; + + DebugPrintf("Commands are:\n"); + for (i = 0 ; i < _dcmd_count ; i++) { + size = strlen(_dcmds[i].name) + 1; + + if ((width + size) >= 39) { + DebugPrintf("\n"); + width = size; + } else + width += size; + + DebugPrintf("%s ", _dcmds[i].name); + } + DebugPrintf("\n"); + return true; +} + +bool Debugger::Cmd_PlayMusic(int argc, const char **argv) { + uint music = atoi(argv[1]); + if (_vm->_game & GF_SIMON2) { + DebugPrintf("No support for Simon the Sorcerer 2\n"); + } else if (music > 0 && music < 35) { + _vm->loadMusic(music); + } else + DebugPrintf("Syntax: music \n"); + + return true; +} + bool Debugger::Cmd_PlayVoice(int argc, const char **argv) { if (argc > 1) { uint voice = atoi(argv[1]); _vm->_sound->playVoice(voice); } else - DebugPrintf("Syntax: playvoice \n"); + DebugPrintf("Syntax: voice \n"); return true; } diff --git a/simon/debugger.h b/simon/debugger.h index f1c82db1e4..301484c4d9 100644 --- a/simon/debugger.h +++ b/simon/debugger.h @@ -39,7 +39,9 @@ protected: virtual void postEnter(); bool Cmd_Exit(int argc, const char **argv); + bool Cmd_Help(int argc, const char **argv); bool Cmd_PlayVoice(int argc, const char **argv); + bool Cmd_PlayMusic(int argc, const char **argv); }; } // End of namespace Simon -- cgit v1.2.3