[Scummvm-cvs-logs] SF.net SVN: scummvm:[40662] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon May 18 00:41:09 CEST 2009


Revision: 40662
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40662&view=rev
Author:   lordhoto
Date:     2009-05-17 22:41:09 +0000 (Sun, 17 May 2009)

Log Message:
-----------
LoL:
- Cleanup
- Implement support to load save from command line / launcher

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/lol.h
    scummvm/trunk/engines/kyra/sequences_lol.cpp

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-05-17 22:26:14 UTC (rev 40661)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-05-17 22:41:09 UTC (rev 40662)
@@ -38,7 +38,6 @@
 
 #include "common/config-manager.h"
 #include "common/endian.h"
-#include "base/version.h"
 
 namespace Kyra {
 
@@ -534,75 +533,26 @@
 }
 
 Common::Error LoLEngine::go() {
-	setupPrologueData(true);
+	int action = -1;
 
-	if (!saveFileLoadable(0) || _flags.isDemo)
-		showIntro();
-
-	if (_flags.isDemo)
-		return Common::kNoError;
-
-	preInit();
-
-	int processSelection = -1;
-	while (!shouldQuit() && processSelection == -1) {
-		_screen->loadBitmap("TITLE.CPS", 2, 2, _screen->getPalette(0));
-		_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
-
-		_screen->setFont(Screen::FID_6_FNT);
-		// Original version: (260|193) "V CD1.02 D"
-		const int width = _screen->getTextWidth(gScummVMVersion);
-		_screen->fprintString("SVM %s", 300 - width, 193, 0x67, 0x00, 0x04, gScummVMVersion);
-		_screen->setFont(Screen::FID_9_FNT);
-
-		_screen->fadePalette(_screen->getPalette(0), 0x1E);
-		_screen->updateScreen();
-
-		_eventList.clear();
-		int selection = mainMenu();
-		_screen->hideMouse();
-
-		// Unlike the original, we add a nice fade to black
-		memset(_screen->getPalette(0), 0, 768);
-		_screen->fadePalette(_screen->getPalette(0), 0x54);
-
-		switch (selection) {
-		case 0:		// New game
-			processSelection = 0;
-			break;
-
-		case 1:		// Show intro
-			showIntro();
-			break;
-
-		case 2:		// "Lore of the Lands" (only CD version)
-			break;
-
-		case 3:		// Load game
-			// For now fall through
-			//processSelection = 3;
-			//break;
-
-		case 4:		// Quit game
-		default:
-			quitGame();
-			updateInput();
-			break;
-		}
+	if (_gameToLoad == -1) {
+		action = processPrologue();
+		if (action == -1)
+			return Common::kNoError;
 	}
 
-	if (processSelection == -1)
-		return Common::kNoError;
+	if (!_flags.isDemo && !_res->loadFileList("FILEDATA.FDT"))
+		error("Couldn't load file list: 'FILEDATA.FDT'");
 
-	if (processSelection == 0) {
-		_sound->loadSoundFile(0);
-		_sound->playTrack(6);
-		chooseCharacter();
-		_sound->playTrack(1);
-		_screen->fadeToBlack();
-	}
+	if (_gameToLoad != -1)
+		preInit();
 
-	setupPrologueData(false);
+	// We have three sound.dat files, one for the intro, one for the
+	// end sequence and one for ingame, each contained in a different
+	// PAK file. Therefore a new call to loadSoundFile() is required
+	// whenever the PAK file configuration changes.
+	if (_flags.platform == Common::kPlatformPC98)
+		_sound->loadSoundFile("sound.dat");
 
 	_sound->setSoundList(&_soundData[kMusicIngame]);
 	if (_flags.platform != Common::kPlatformPC)
@@ -614,19 +564,23 @@
 	if (shouldQuit())
 		return Common::kNoError;
 
-	if (processSelection == 0 || processSelection == 3)
-		startup();
+	startup();
 
-	if (processSelection == 0)
+	if (action == 0) {
 		startupNew();
-
-	if (!shouldQuit() && (processSelection == 0 || processSelection == 3)) {
-		_screen->_fadeFlag = 3;
-		_sceneUpdateRequired = true;
-		enableSysTimer(1);
-		runLoop();
+	} else if (_gameToLoad != -1) {
+		if (loadGameState(_gameToLoad) != Common::kNoError)
+			error("Couldn't load game slot %d on startup", _gameToLoad);
+		_gameToLoad = -1;
+	} else if (action == 3) {
+		// XXX
 	}
 
+	_screen->_fadeFlag = 3;
+	_sceneUpdateRequired = true;
+	enableSysTimer(1);
+	runLoop();
+
 	delete _tim;
 	_tim = 0;
 

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-05-17 22:26:14 UTC (rev 40661)
+++ scummvm/trunk/engines/kyra/lol.h	2009-05-17 22:41:09 UTC (rev 40662)
@@ -309,7 +309,8 @@
 
 	int _floatingMouseArrowControl;
 
-	// intro
+	// intro + character selection
+	int processPrologue();
 	void setupPrologueData(bool load);
 
 	void showIntro();

Modified: scummvm/trunk/engines/kyra/sequences_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-05-17 22:26:14 UTC (rev 40661)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-05-17 22:41:09 UTC (rev 40662)
@@ -29,10 +29,85 @@
 #include "kyra/screen_lol.h"
 #include "kyra/resource.h"
 
+#include "base/version.h"
+
 namespace Kyra {
 
 #pragma mark - Intro
 
+int LoLEngine::processPrologue() {
+	debugC(9, kDebugLevelMain, "LoLEngine::processPrologue()");
+
+	setupPrologueData(true);
+
+	if (!saveFileLoadable(0) || _flags.isDemo)
+		showIntro();
+
+	if (_flags.isDemo)
+		return -1;
+
+	preInit();
+
+	int processSelection = -1;
+	while (!shouldQuit() && processSelection == -1) {
+		_screen->loadBitmap("TITLE.CPS", 2, 2, _screen->getPalette(0));
+		_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
+
+		_screen->setFont(Screen::FID_6_FNT);
+		// Original version: (260|193) "V CD1.02 D"
+		const int width = _screen->getTextWidth(gScummVMVersion);
+		_screen->fprintString("SVM %s", 300 - width, 193, 0x67, 0x00, 0x04, gScummVMVersion);
+		_screen->setFont(Screen::FID_9_FNT);
+
+		_screen->fadePalette(_screen->getPalette(0), 0x1E);
+		_screen->updateScreen();
+
+		_eventList.clear();
+		int selection = mainMenu();
+		_screen->hideMouse();
+
+		// Unlike the original, we add a nice fade to black
+		memset(_screen->getPalette(0), 0, 768);
+		_screen->fadePalette(_screen->getPalette(0), 0x54);
+
+		switch (selection) {
+		case 0:		// New game
+			processSelection = 0;
+			break;
+
+		case 1:		// Show intro
+			showIntro();
+			break;
+
+		case 2:		// "Lore of the Lands" (only CD version)
+			break;
+
+		case 3:		// Load game
+			// For now fall through
+			//processSelection = 3;
+			//break;
+
+		case 4:		// Quit game
+		default:
+			quitGame();
+			updateInput();
+			break;
+		}
+	}
+
+	if (processSelection == 0 || processSelection == 3) {
+		_sound->loadSoundFile(0);
+		_sound->playTrack(6);
+		chooseCharacter();
+		_sound->playTrack(1);
+		_screen->fadeToBlack();
+	}
+
+	setupPrologueData(false);
+
+	return processSelection;
+}
+
 void LoLEngine::setupPrologueData(bool load) {
 	debugC(9, kDebugLevelMain, "LoLEngine::setupPrologueData(%d)", load);
 
@@ -90,12 +165,16 @@
 		memset(_screen->getPalette(1), 0, 768);
 
 		_sound->setSoundList(&_soundData[kMusicIntro]);
+	
+		// We have three sound.dat files, one for the intro, one for the
+		// end sequence and one for ingame, each contained in a different
+		// PAK file. Therefore a new call to loadSoundFile() is required
+		// whenever the PAK file configuration changes.
+		if (_flags.platform == Common::kPlatformPC98)
+			_sound->loadSoundFile("sound.dat");
 	} else {
 		delete _chargenWSA; _chargenWSA = 0;
 		
-		if (!_flags.isDemo && !_res->loadFileList("FILEDATA.FDT"))
-			error("Couldn't load file list: 'FILEDATA.FDT'");
-
 		uint8 *pal = _screen->getPalette(0);
 		memset(pal, 0, 768);
 		_screen->setScreenPalette(pal);
@@ -106,13 +185,6 @@
 		_eventList.clear();
 		_sound->setSoundList(0);
 	}
-
-	// We have three sound.dat files, one for the intro, one for the
-	// end sequence and one for ingame, each contained in a different
-	// PAK file. Therefore a new call to loadSoundFile() is required
-	// whenever the PAK file configuration changes.
-	if (_flags.platform == Common::kPlatformPC98)
-		_sound->loadSoundFile("sound.dat");
 }
 
 void LoLEngine::showIntro() {
@@ -463,7 +535,7 @@
 
 	default:
 		break;
-	};
+	}
 
 	_screen->loadBitmap(filename, 9, 9, 0);
 	_screen->copyRegion(0, 122, 0, 122, 320, 78, 4, 0, Screen::CR_NO_P_CHECK);


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