diff options
| author | Johannes Schickel | 2009-05-17 22:41:09 +0000 | 
|---|---|---|
| committer | Johannes Schickel | 2009-05-17 22:41:09 +0000 | 
| commit | 28b5f1d2903b92f678332b3259f14e99a045baef (patch) | |
| tree | 6bc37fb20a717c6f989190ef51443845aa4844a3 | |
| parent | 9fec7402e54ab30a6bb1232f02346d7fdf44257b (diff) | |
| download | scummvm-rg350-28b5f1d2903b92f678332b3259f14e99a045baef.tar.gz scummvm-rg350-28b5f1d2903b92f678332b3259f14e99a045baef.tar.bz2 scummvm-rg350-28b5f1d2903b92f678332b3259f14e99a045baef.zip | |
LoL:
- Cleanup
- Implement support to load save from command line / launcher
svn-id: r40662
| -rw-r--r-- | engines/kyra/lol.cpp | 102 | ||||
| -rw-r--r-- | engines/kyra/lol.h | 3 | ||||
| -rw-r--r-- | engines/kyra/sequences_lol.cpp | 94 | 
3 files changed, 113 insertions, 86 deletions
| diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 2834e179f4..c56357ea1f 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -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::init() {  }  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 @@ Common::Error LoLEngine::go() {  	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; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 8a1a63ab56..703e4a6c3d 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -309,7 +309,8 @@ private:  	int _floatingMouseArrowControl; -	// intro +	// intro + character selection +	int processPrologue();  	void setupPrologueData(bool load);  	void showIntro(); diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index 33d1a30f87..463bb45bba 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -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 @@ void LoLEngine::setupPrologueData(bool load) {  		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 @@ void LoLEngine::setupPrologueData(bool load) {  		_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 @@ int LoLEngine::selectionCharInfo(int character) {  	default:  		break; -	}; +	}  	_screen->loadBitmap(filename, 9, 9, 0);  	_screen->copyRegion(0, 122, 0, 122, 320, 78, 4, 0, Screen::CR_NO_P_CHECK); | 
