[Scummvm-cvs-logs] SF.net SVN: scummvm: [24787] scummvm/trunk/engines/cine

sev at users.sourceforge.net sev at users.sourceforge.net
Sat Nov 25 10:28:00 CET 2006


Revision: 24787
          http://svn.sourceforge.net/scummvm/?rev=24787&view=rev
Author:   sev
Date:     2006-11-25 01:28:00 -0800 (Sat, 25 Nov 2006)

Log Message:
-----------
Support loading saves from command line.

Modified Paths:
--------------
    scummvm/trunk/engines/cine/cine.cpp
    scummvm/trunk/engines/cine/cine.h
    scummvm/trunk/engines/cine/main_loop.cpp
    scummvm/trunk/engines/cine/various.cpp

Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp	2006-11-25 00:31:51 UTC (rev 24786)
+++ scummvm/trunk/engines/cine/cine.cpp	2006-11-25 09:28:00 UTC (rev 24787)
@@ -52,8 +52,6 @@
 
 CineEngine *g_cine;
 
-static void initialize();
-
 CineEngine::CineEngine(OSystem *syst) : Engine(syst) {
 	Common::addSpecialDebugLevel(kCineDebugScript, "Script", "Script debug level");
 
@@ -115,7 +113,7 @@
 }
 
 
-static void initialize() {
+void CineEngine::initialize() {
 	uint16 i;
 
 	setupOpcodes();
@@ -194,10 +192,23 @@
 
 	freePrcLinkedList();
 
-	loadPrc(BOOT_PRC_NAME);
-	strcpy(currentPrcName, BOOT_PRC_NAME);
+	_preLoad = false;
+	if (ConfMan.hasKey("save_slot")) {
+		char saveNameBuffer[256];
 
-	setMouseCursor(MOUSE_CURSOR_NORMAL);
+		sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), ConfMan.getInt("save_slot"));
+
+		bool res = makeLoad(saveNameBuffer);
+
+		if (res)
+			_preLoad = true;
+	}
+	
+	if (!_preLoad) {
+		loadPrc(BOOT_PRC_NAME);
+		strcpy(currentPrcName, BOOT_PRC_NAME);
+		setMouseCursor(MOUSE_CURSOR_NORMAL);
+	}
 }
 
 } // End of namespace Cine

Modified: scummvm/trunk/engines/cine/cine.h
===================================================================
--- scummvm/trunk/engines/cine/cine.h	2006-11-25 00:31:51 UTC (rev 24786)
+++ scummvm/trunk/engines/cine/cine.h	2006-11-25 09:28:00 UTC (rev 24787)
@@ -88,6 +88,13 @@
 	void makeSystemMenu(void);
 
 	const CINEGameDescription *_gameDescription;
+
+private:
+	void initialize(void);
+	bool makeLoad(char *saveName);
+	void mainLoop(int bootScriptIdx);
+
+	bool _preLoad;
 };
 
 extern CineEngine *g_cine;

Modified: scummvm/trunk/engines/cine/main_loop.cpp
===================================================================
--- scummvm/trunk/engines/cine/main_loop.cpp	2006-11-25 00:31:51 UTC (rev 24786)
+++ scummvm/trunk/engines/cine/main_loop.cpp	2006-11-25 09:28:00 UTC (rev 24787)
@@ -178,66 +178,69 @@
 	return k;
 }
 
-void mainLoop(int bootScriptIdx) {
+void CineEngine::mainLoop(int bootScriptIdx) {
 	uint16 var_6;
 	uint16 quitFlag;
 	uint16 i;
 	byte di;
 	uint16 mouseButton;
 
-	freeAnimDataTable();
-	resetMessageHead();
-	resetSeqList();
-	resetglobalScriptsHead();
-	resetObjectScriptHead();
-	resetBgIncrustList();
+	quitFlag = 0;
 
-	setTextWindow(0, 0, 20, 200);
+	if (_preLoad == false) {
+		freeAnimDataTable();
+		resetMessageHead();
+		resetSeqList();
+		resetglobalScriptsHead();
+		resetObjectScriptHead();
+		resetBgIncrustList();
 
-	errorVar = 0;
+		setTextWindow(0, 0, 20, 200);
 
-	addScriptToList0(bootScriptIdx);
+		errorVar = 0;
 
-	menuVar = 0;
+		addScriptToList0(bootScriptIdx);
 
-	gfxFuncGen1(page0c, page0, page0c, page0, -1);
+		menuVar = 0;
 
-	ptrGfxFunc13();
+		gfxFuncGen1(page0c, page0, page0c, page0, -1);
 
-	gfxFuncGen2();
+		ptrGfxFunc13();
 
-	quitFlag = 0;
-	inMenu = false;
-	allowPlayerInput = 0;
-	checkForPendingDataLoadSwitch = 0;
+		gfxFuncGen2();
 
-	fadeRequired = 0;
-	isDrawCommandEnabled = 0;
-	waitForPlayerClick = 0;
-	menuCommandLen = 0;
+		inMenu = false;
+		allowPlayerInput = 0;
+		checkForPendingDataLoadSwitch = 0;
 
-	playerCommand = -1;
-	strcpy(commandBuffer, "");
+		fadeRequired = 0;
+		isDrawCommandEnabled = 0;
+		waitForPlayerClick = 0;
+		menuCommandLen = 0;
 
-	globalVars[0x1F2] = 0;
-	globalVars[0x1F4] = 0;
+		playerCommand = -1;
+		strcpy(commandBuffer, "");
 
-	for (i = 0; i < 16; i++) {
-		c_palette[i] = 0;
-	}
+		globalVars[0x1F2] = 0;
+		globalVars[0x1F4] = 0;
 
-	var17 = 1;
+		for (i = 0; i < 16; i++) {
+			c_palette[i] = 0;
+		}
 
-	strcpy(newPrcName, "");
-	strcpy(newRelName, "");
-	strcpy(newObjectName, "");
-	strcpy(newMsgName, "");
-	strcpy(currentBgName[0], "");
-	strcpy(currentCtName, "");
-	strcpy(currentPartName, "");
+		var17 = 1;
 
-	g_sfxPlayer->stop();
+		strcpy(newPrcName, "");
+		strcpy(newRelName, "");
+		strcpy(newObjectName, "");
+		strcpy(newMsgName, "");
+		strcpy(currentBgName[0], "");
+		strcpy(currentCtName, "");
+		strcpy(currentPartName, "");
 
+		g_sfxPlayer->stop();
+	}
+
 	do {
 		mainLoopSub3();
 		di = executePlayerInput();

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2006-11-25 00:31:51 UTC (rev 24786)
+++ scummvm/trunk/engines/cine/various.cpp	2006-11-25 09:28:00 UTC (rev 24787)
@@ -438,7 +438,7 @@
 	}
 }
 
-int16 makeLoad(char *saveName) {
+bool CineEngine::makeLoad(char *saveName) {
 	int16 i;
 	int16 size;
 	Common::InSaveFile *fHandle;
@@ -450,7 +450,7 @@
 		waitPlayerInput();
 		// restoreScreen();
 		checkDataDisk(-1);
-		return -1;
+		return false;
 	}
 
 	g_sfxPlayer->stop();
@@ -683,7 +683,7 @@
 		}*/
 	}
 
-	return 0;
+	return true;
 }
 
 void makeSave(char *saveFileName) {


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