diff options
author | Max Horn | 2009-02-17 18:16:48 +0000 |
---|---|---|
committer | Max Horn | 2009-02-17 18:16:48 +0000 |
commit | f245cf55b842ed81294e42f87369684630a22572 (patch) | |
tree | ed8e0ba1bcc17993944e2266b52add408a6c62a0 | |
parent | cd8f4c5ae247b8acf823a662928958496c30690f (diff) | |
download | scummvm-rg350-f245cf55b842ed81294e42f87369684630a22572.tar.gz scummvm-rg350-f245cf55b842ed81294e42f87369684630a22572.tar.bz2 scummvm-rg350-f245cf55b842ed81294e42f87369684630a22572.zip |
SCI: Merged main_ into SciEngine::go()
svn-id: r38433
-rw-r--r-- | engines/sci/sci.cpp | 127 |
1 files changed, 61 insertions, 66 deletions
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 3e4c8ffd8a..74eb37f5dc 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -208,8 +208,60 @@ detect_versions(sci_version_t *version, int *res_version) { sciprintf("Using resource version %d\n", *res_version); } -int -main_() { +SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) + : Engine(syst) { + // Put your engine in a sane state, but do nothing big yet; + // in particular, do not load data from files; rather, if you + // need to do such things, do them from init(). + + // However this is the place to specify all default directories + //File::addDefaultDirectory(_gameDataPath + "sound/"); + //printf("%s\n", _gameDataPath.c_str()); + + // Set up the engine specific debug levels + //Common::addSpecialDebugLevel(SCI_DEBUG_RESOURCES, "resources", "Debug the resources loading"); + + printf("SciEngine::SciEngine\n"); +} + +SciEngine::~SciEngine() { + // Dispose your resources here + printf("SciEngine::~SciEngine\n"); + + // Remove all of our debug levels here + //Common::clearAllSpecialDebugLevels(); +} + +Common::Error SciEngine::init() { + initGraphics(320, 200, false); + + //GUIErrorMessage("lalalal asfa w4 haha hreh au u<w"); + + // Create debugger console. It requires GFX to be initialized + //_console = new Console(this); + //_console = new Console(); + + // Additional setup. + printf("SciEngine::init\n"); + return Common::kNoError; +} + +Common::Error SciEngine::go() { + // Your main even loop should be (invoked from) here. + + /* bool end = false; + Common::EventManager *em = _system->getEventManager(); + while (!end) { + Common::Event ev; + if (em->pollEvent(ev)) { + if (ev.type == Common::EVENT_KEYDOWN) { + end = true; + } + } + _system->delayMillis(10); + } */ + + // FIXME/TODO: Move some of the stuff below to init() resource_mgr_t *resmgr; init_console(); /* So we can get any output */ @@ -232,7 +284,7 @@ main_() { if (!resmgr) { printf("No resources found in '%s'.\nAborting...\n", resource_dir); - exit(1); + return Common::kNoGameDataFoundError; } script_adjust_opcode_formats(resmgr->sci_version); @@ -251,12 +303,13 @@ main_() { gamestate->gfx_state = NULL; if (init_gamestate(gamestate, version)) - return 1; + return Common::kUnknownError; if (game_init(gamestate)) { /* Initialize */ fprintf(stderr, "Game initialization failed: Aborting...\n"); - return 1; + // TODO: Add an "init failed" error? + return Common::kUnknownError; } /* Set the savegame dir */ @@ -301,17 +354,17 @@ main_() { if (gfxop_init_default(&gfx_state, &gfx_options, resmgr)) { fprintf(stderr, "Graphics initialization failed. Aborting...\n"); - return 1; + return Common::kUnknownError; } if (game_init_graphics(gamestate)) { /* Init interpreter graphics */ fprintf(stderr, "Game initialization failed: Error in GFX subsystem. Aborting...\n"); - return 1; + return Common::kUnknownError; } if (game_init_sound(gamestate, 0)) { fprintf(stderr, "Game initialization failed: Error in sound subsystem. Aborting...\n"); - return 1; + return Common::kUnknownError; } printf("Emulating SCI version %d.%03d.%03d\n", @@ -333,64 +386,6 @@ main_() { gfxop_exit(&gfx_state); - return 0; -} - -SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) - : Engine(syst) { - // Put your engine in a sane state, but do nothing big yet; - // in particular, do not load data from files; rather, if you - // need to do such things, do them from init(). - - // However this is the place to specify all default directories - //File::addDefaultDirectory(_gameDataPath + "sound/"); - //printf("%s\n", _gameDataPath.c_str()); - - // Set up the engine specific debug levels - //Common::addSpecialDebugLevel(SCI_DEBUG_RESOURCES, "resources", "Debug the resources loading"); - - printf("SciEngine::SciEngine\n"); -} - -SciEngine::~SciEngine() { - // Dispose your resources here - printf("SciEngine::~SciEngine\n"); - - // Remove all of our debug levels here - //Common::clearAllSpecialDebugLevels(); -} - -Common::Error SciEngine::init() { - initGraphics(320, 200, false); - - //GUIErrorMessage("lalalal asfa w4 haha hreh au u<w"); - - // Create debugger console. It requires GFX to be initialized - //_console = new Console(this); - //_console = new Console(); - - // Additional setup. - printf("SciEngine::init\n"); - return Common::kNoError; -} - -Common::Error SciEngine::go() { - // Your main even loop should be (invoked from) here. - - /* bool end = false; - Common::EventManager *em = _system->getEventManager(); - while (!end) { - Common::Event ev; - if (em->pollEvent(ev)) { - if (ev.type == Common::EVENT_KEYDOWN) { - end = true; - } - } - _system->delayMillis(10); - } */ - - main_(); - return Common::kNoError; } |