diff options
author | Torbjörn Andersson | 2004-12-03 19:15:44 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-12-03 19:15:44 +0000 |
commit | c64c7eb4d4edd087031603df446abf271f616480 (patch) | |
tree | dcd747faca1c7f8d8fc0a9ba42a1bf1d076e83a7 /saga/saga.cpp | |
parent | 2cfdcb5a59dec0e66e81dc91be142224156de473 (diff) | |
download | scummvm-rg350-c64c7eb4d4edd087031603df446abf271f616480.tar.gz scummvm-rg350-c64c7eb4d4edd087031603df446abf271f616480.tar.bz2 scummvm-rg350-c64c7eb4d4edd087031603df446abf271f616480.zip |
First pass at migrating from the old Reinherit console to the ScummVM
console.
Some things are likely to have broken. For instance, I believe the old
console was could be visible during gameplay, while ScummVM's is modal. So
any place where we output something to the console during gameplay should
probably be removed.
Some things I've stubbed out. Basically any code that registers a variable.
Most of the debugging commands are untested.
Syntax may have changed because of different command-line parsing. (I never
actually used the old console, so I don't know for sure. :-)
Actually, I'm not that interested in reproducing the old console commands
faithfully. What we should do now is to make the immediately useful console
stuff work. Anything that remains unimplemented should probably be removed.
svn-id: r15976
Diffstat (limited to 'saga/saga.cpp')
-rw-r--r-- | saga/saga.cpp | 47 |
1 files changed, 8 insertions, 39 deletions
diff --git a/saga/saga.cpp b/saga/saga.cpp index be8e405e0d..3e04e64a76 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -38,7 +38,6 @@ #include "saga/actor.h" #include "saga/animation.h" #include "saga/console.h" -#include "saga/cvar_mod.h" #include "saga/events.h" #include "saga/font.h" #include "saga/game_mod.h" @@ -89,14 +88,13 @@ namespace Saga { #define MAX_TIME_DELTA 100 -static void CF_quitfunc(int argc, char *argv[], void *refCon); -static void CF_testfunc(int argc, char *argv[], void *refCon); - SagaEngine *_vm = NULL; SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst) : Engine(syst) { + _console = NULL; + // The Linux version of Inherit the Earth puts all data files in an // 'itedata' sub-directory, except for voices.rsc File::addDefaultDirectory(_gameDataPath + "itedata/"); @@ -129,16 +127,6 @@ int SagaEngine::init(GameDetector &detector) { _soundEnabled = 1; _musicEnabled = 1; - _console = new Console(this); - - CVAR_RegisterFunc(CF_testfunc, "testfunc", "foo [ optional foo ]", CVAR_NONE, 0, -1, this); - - CVAR_Register_I(&_soundEnabled, "sound", NULL, CVAR_CFG, 0, 1); - - CVAR_Register_I(&_musicEnabled, "music", NULL, CVAR_CFG, 0, 1); - - CVAR_RegisterFunc(CF_quitfunc, "quit", NULL, CVAR_NONE, 0, 0, this); - // Add some default directories // Win32 demo & full game File::addDefaultDirectory("graphics"); @@ -186,6 +174,9 @@ int SagaEngine::init(GameDetector &detector) { GAME_GetDisplayInfo(&disp_info); _gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h, detector); + // Graphics driver should be initialized before console + _console = new Console(this); + // Graphics should be initialized before music int midiDriver = MidiDriver::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE); bool native_mt32 = (ConfMan.getBool("native_mt32") || (midiDriver == MD_MT32)); @@ -221,15 +212,6 @@ int SagaEngine::init(GameDetector &detector) { debug(0, "Sound disabled."); } - // Register engine modules - _console->reg(); // Register console cvars first - GAME_Register(); - _scene->reg(); - _actor->reg(); - _script->reg(); - _render->reg(); - _anim->reg(); - return 0; } @@ -246,6 +228,9 @@ int SagaEngine::go() { uint32 currentTicks; for (;;) { + if (_console->isAttached()) + _console->onFrame(); + if (_render->getFlags() & RF_RENDERPAUSE) { // Freeze time while paused _previousTicks = _system->getMillis(); @@ -280,7 +265,6 @@ void SagaEngine::shutdown() { delete _sprite; delete _font; delete _console; - CVAR_Shutdown(); delete _events; delete _palanim; @@ -297,19 +281,4 @@ void SagaEngine::shutdown() { _system->quit(); } -static void CF_quitfunc(int argc, char *argv[], void *refCon) { - ((SagaEngine *)refCon)->shutdown(); - exit(0); -} - -static void CF_testfunc(int argc, char *argv[], void *refCon) { - int i; - - _vm->_console->print("Test function invoked: Got %d arguments.", argc); - - for (i = 0; i < argc; i++) { - _vm->_console->print("Arg %d: %s", i, argv[i]); - } -} - } // End of namespace Saga |