diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/console.cpp | 47 | ||||
-rw-r--r-- | engines/sci/console.h | 1 | ||||
-rw-r--r-- | engines/sci/engine/scriptconsole.cpp | 15 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 17 | ||||
-rw-r--r-- | engines/sci/sci.h | 4 |
5 files changed, 58 insertions, 26 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index aabac90668..aad4480539 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -27,6 +27,7 @@ #include "sci/sci.h" #include "sci/console.h" +#include "sci/include/sciresource.h" #include "sci/include/versions.h" namespace Sci { @@ -35,6 +36,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { _vm = vm; DCmd_Register("version", WRAP_METHOD(Console, cmdGetVersion)); + DCmd_Register("man", WRAP_METHOD(Console, cmdMan)); } Console::~Console() { @@ -42,8 +44,51 @@ Console::~Console() { bool Console::cmdGetVersion(int argc, const char **argv) { int ver = _vm->getVersion(); - DebugPrintf("SCI version: %d.%03d.%03d\n", SCI_VERSION_MAJOR(ver), SCI_VERSION_MINOR(ver), SCI_VERSION_PATCHLEVEL(ver)); + DebugPrintf("Resource file version: %s\n", sci_version_types[_vm->getResMgr()->sci_version]); + + DebugPrintf("Emulated interpreter version: %d.%03d.%03d\n", + SCI_VERSION_MAJOR(ver), SCI_VERSION_MINOR(ver), SCI_VERSION_PATCHLEVEL(ver)); + + return true; +} + +bool Console::cmdMan(int argc, const char **argv) { +#if 0 + int section = 0; + unsigned int i; + char *name = cmd_params[0].str; + char *c = strchr(name, '.'); + cmd_mm_entry_t *entry = 0; + + if (c) { + *c = 0; + section = atoi(c + 1); + } + + if (section < 0 || section >= CMD_MM_ENTRIES) { + DebugPrintf("Invalid section %d\n", section); + return true; + } + + DebugPrintf("section:%d\n", section); + if (section) + entry = cmd_mm_find(name, section - 1); + else + for (i = 0; i < CMD_MM_ENTRIES && !section; i++) { + if ((entry = cmd_mm_find(name, i))) + section = i + 1; + } + + if (!entry) { + DebugPrintf("No manual entry\n"); + return true; + } + + DebugPrintf("-- %s: %s.%d\n", cmd_mm[section - 1].name, name, section); + cmd_mm[section - 1].print(entry, 1); + +#endif return true; } diff --git a/engines/sci/console.h b/engines/sci/console.h index b08bc838d3..4c527acf4b 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -41,6 +41,7 @@ public: private: bool cmdGetVersion(int argc, const char **argv); + bool cmdMan(int argc, const char **argv); private: SciEngine *_vm; diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index 9384d73467..c352f2ae9d 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -37,7 +37,6 @@ EngineState *con_gamestate = NULL; // console commands -static int c_version(EngineState *s); // displays the package and version number static int c_list(EngineState *s); // lists various types of things static int c_man(EngineState *s); // 'manual page' static int c_set(EngineState *s); // sets an int variable @@ -171,7 +170,6 @@ void con_init() { atexit(_cmd_exit); // Hook up some commands - con_hook_command(&c_version, "version", "", "Displays the version number"); con_hook_command(&c_list, "list", "s*", "Lists various things (try 'list')"); con_hook_command(&c_man, "man", "s", "Gives a short description of something"); con_hook_command(&c_print, "print", "s", "Prints an int variable"); @@ -690,19 +688,6 @@ static int get_resource_number(char *resid) { return res; } -static int c_version(EngineState * s) { - if (NULL == s) { - sciprintf("console.c: c_version: NULL passed for parameter s\n"); - return -1; - } - - sciprintf("Resource file version: %s\n", sci_version_types[s->resmgr->sci_version]); - sciprintf("Emulated interpreter version: %d.%03d.%03d\n", SCI_VERSION_MAJOR(s->version), - SCI_VERSION_MINOR(s->version), SCI_VERSION_PATCHLEVEL(s->version)); - - return 0; -} - static int c_list_words(EngineState *s) { word_t **words; int words_nr; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 3a27389e85..eb85452864 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -200,7 +200,6 @@ Common::Error SciEngine::go() { } */ // FIXME/TODO: Move some of the stuff below to init() - ResourceManager *resmgr; init_console(); /* So we can get any output */ @@ -217,25 +216,25 @@ Common::Error SciEngine::go() { char resource_dir[MAXPATHLEN+1] = ""; getcwd(resource_dir, MAXPATHLEN); // Store resource directory - resmgr = new ResourceManager(res_version, 256 * 1024); + _resmgr = new ResourceManager(res_version, 256 * 1024); - if (!resmgr) { + if (!_resmgr) { printf("No resources found in '%s'.\nAborting...\n", resource_dir); return Common::kNoGameDataFoundError; } - script_adjust_opcode_formats(resmgr->sci_version); + script_adjust_opcode_formats(_resmgr->sci_version); #if 0 printf("Mapping instruments to General Midi\n"); - map_MIDI_instruments(resmgr); + map_MIDI_instruments(_resmgr); #endif EngineState* gamestate = (EngineState *) sci_malloc(sizeof(EngineState)); memset(gamestate, 0, sizeof(EngineState)); - gamestate->resmgr = resmgr; + gamestate->resmgr = _resmgr; gamestate->gfx_state = NULL; if (init_gamestate(gamestate, version)) @@ -262,7 +261,7 @@ Common::Error SciEngine::go() { gfx_state_t gfx_state; gfx_state.driver = &gfx_driver_scummvm; - gfx_state.version = resmgr->sci_version; + gfx_state.version = _resmgr->sci_version; gamestate->gfx_state = &gfx_state; // Default config: @@ -288,7 +287,7 @@ Common::Error SciEngine::go() { } // Default config ends - if (gfxop_init_default(&gfx_state, &gfx_options, resmgr)) { + if (gfxop_init_default(&gfx_state, &gfx_options, _resmgr)) { fprintf(stderr, "Graphics initialization failed. Aborting...\n"); return Common::kUnknownError; } @@ -316,7 +315,7 @@ Common::Error SciEngine::go() { free(gamestate->work_dir); free(gamestate); - delete resmgr; + delete _resmgr; close_console_file(); diff --git a/engines/sci/sci.h b/engines/sci/sci.h index ec3c51ca0f..168bce8875 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -30,6 +30,7 @@ #include "engines/advancedDetector.h" #include "sci/console.h" +#include "sci/include/sciresource.h" namespace Sci { @@ -84,12 +85,13 @@ public: Common::Language getLanguage() const; Common::Platform getPlatform() const; uint32 getFlags() const; - + ResourceManager *getResMgr() { return _resmgr; } Common::String getSavegameName(int nr) const; private: const SciGameDescription *_gameDescription; Console *_console; + ResourceManager *_resmgr; }; } // End of namespace Sci |