[Scummvm-cvs-logs] SF.net SVN: scummvm:[38433] scummvm/trunk/engines/sci/sci.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Feb 17 19:16:48 CET 2009


Revision: 38433
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38433&view=rev
Author:   fingolfin
Date:     2009-02-17 18:16:48 +0000 (Tue, 17 Feb 2009)

Log Message:
-----------
SCI: Merged main_ into SciEngine::go()

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-02-17 18:16:41 UTC (rev 38432)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-02-17 18:16:48 UTC (rev 38433)
@@ -208,8 +208,60 @@
 		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 @@
 	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 @@
 	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 @@
 
 	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,65 +386,7 @@
 
 	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;
-}
-
 //} // End of namespace Sci


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list