[Scummvm-cvs-logs] CVS: scummvm/scumm script_v2.cpp,2.130,2.131 script_v5.cpp,1.110,1.111 script_v6.cpp,1.148,1.149 script_v8.cpp,2.175,2.176 scumm.h,1.234,1.235 scummvm.cpp,2.200,2.201

Max Horn fingolfin at users.sourceforge.net
Sun Jun 1 19:26:07 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv21627

Modified Files:
	script_v2.cpp script_v5.cpp script_v6.cpp script_v8.cpp 
	scumm.h scummvm.cpp 
Log Message:
cleaned up the restart/pause/shutdown situation a bit; added comment that explains how restart might be implemented

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.130
retrieving revision 2.131
diff -u -d -r2.130 -r2.131
--- script_v2.cpp	31 May 2003 12:17:57 -0000	2.130
+++ script_v2.cpp	2 Jun 2003 02:25:22 -0000	2.131
@@ -708,7 +708,7 @@
 }
 
 void Scumm_v2::o2_restart() {
-	warning("o2_restart NYI");
+	restart();
 }
 
 void Scumm_v2::o2_drawObject() {

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- script_v5.cpp	2 Jun 2003 01:45:03 -0000	1.110
+++ script_v5.cpp	2 Jun 2003 02:25:23 -0000	1.111
@@ -1478,13 +1478,19 @@
 }
 
 void Scumm_v5::o5_quitPauseRestart() {
-	switch (fetchScriptByte()) {
-	case 1:
-		pauseGame(false);
+	byte subOp = fetchScriptByte();
+	switch (subOp) {
+	case 1:		// Restart
+		restart();
 		break;
-	case 3:
-		shutDown(0);
+	case 2:		// Pause
+		pauseGame();
+		break;
+	case 3:		// Quit
+		shutDown();
 		break;
+	default:
+		error("o5_quitPauseRestart invalid case %d\n", subOp);
 	}
 }
 

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -d -r1.148 -r1.149
--- script_v6.cpp	1 Jun 2003 18:20:38 -0000	1.148
+++ script_v6.cpp	2 Jun 2003 02:25:23 -0000	1.149
@@ -2140,15 +2140,19 @@
 }
 
 void Scumm_v6::o6_quitPauseRestart() {
-	switch (fetchScriptByte()) {
-	case 158:
-		pauseGame(false);
+	byte subOp = fetchScriptByte();
+	switch (subOp) {
+	case 158:		// Restart
+		restart();
 		break;
-	case 160:
-		shutDown(0);
+	case 159:		// Pause
+		pauseGame();
+		break;
+	case 160:		// Quit
+		shutDown();
 		break;
 	default:
-		error("o6_quitPauseRestart: invalid case");
+		error("o6_quitPauseRestart invalid case %d\n", subOp);
 	}
 }
 

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.175
retrieving revision 2.176
diff -u -d -r2.175 -r2.176
--- script_v8.cpp	31 May 2003 21:42:33 -0000	2.175
+++ script_v8.cpp	2 Jun 2003 02:25:23 -0000	2.176
@@ -1312,17 +1312,16 @@
 }
 
 void Scumm_v8::o8_system() {
-	// TODO
 	byte subOp = fetchScriptByte();
 	switch (subOp) {
 	case 0x28:		// SO_SYSTEM_RESTART Restart game
-//		pauseGame(false);
-//		break;
+		restart();
+		break;
 	case 0x29:		// SO_SYSTEM_QUIT Quit game
-//		shutDown(0);
-//		break;
+		shutDown();
+		break;
 	default:
-		error("o8_system: default case 0x%x", subOp);
+		error("o8_system: invalid case 0x%x", subOp);
 	}
 }
 

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.234
retrieving revision 1.235
diff -u -d -r1.234 -r1.235
--- scumm.h	1 Jun 2003 14:30:26 -0000	1.234
+++ scumm.h	2 Jun 2003 02:25:23 -0000	1.235
@@ -345,8 +345,9 @@
 	bool _videoFinished;
 	bool _smushPlay;
 	
-	void pauseGame(bool user);
-	void shutDown(int i);
+	void pauseGame();
+	void restart();
+	void shutDown();
 	void setOptions(void);
 
 #ifdef __PALM_OS__

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.200
retrieving revision 2.201
diff -u -d -r2.200 -r2.201
--- scummvm.cpp	1 Jun 2003 16:42:29 -0000	2.200
+++ scummvm.cpp	2 Jun 2003 02:25:24 -0000	2.201
@@ -1676,7 +1676,7 @@
 	return a;
 }
 
-void Scumm::pauseGame(bool user) {
+void Scumm::pauseGame() {
 	pauseDialog();
 }
 
@@ -1745,9 +1745,31 @@
 	return result;
 }
 
-void Scumm::shutDown(int i) {
-	/* TODO: implement this */
-	warning("shutDown: not implemented");
+void Scumm::shutDown() {
+	// FIXME: This is ugly
+	_system->quit();
+}
+
+void Scumm::restart() {
+	// TODO: implement restart
+	// To implement this, there are two approaches (at least):
+	// 1) Manually cleanup all vars, etc. and run the bootscript again
+	// 2) Use the savegame system
+	// For 2, we could modify the savegame system to allow us to "save" to a memory
+	// block. We then do that at the start of the game, just before invoking the 
+	// bootscript (or maybe just after launching it, whatever). Then to restart
+	// we simply load the state. Easy, hu? :-)
+	//
+	// For 1), we first have to clean up / restructure the current init code. Right now
+	// we have the code which inits the state spread over at least these functions:
+	// The constructor, launch, scummInit, readIndexFile
+	// Problem is, the init code is not very logically distributed over those.
+	// We should first clean this up... Code that sets up fixed state (e.g. gdi._vm = this)
+	// can be moved to either the constructor or maybe scummInit. Code that 
+	// might be useful for restart should be moved to a seperate function.
+	// Finally, all the init code in launch should go - launch should only contain
+	// a few function calls and not much else, iMHO.
+	error("Restart not implemented");
 }
 
 void Scumm::processKbd() {
@@ -1789,14 +1811,13 @@
 
 	if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY)) {
 		warning("Restart not implemented");
-//		pauseGame(true);
+		//restart();
 		return;
 	}
 
 	if ((VAR_PAUSE_KEY != 0xFF && _lastKeyHit == VAR(VAR_PAUSE_KEY)) ||
 		(VAR_PAUSE_KEY == 0xFF && _lastKeyHit == ' ')) {
-		pauseGame(true);
-		/* pause */
+		pauseGame();
 		return;
 	}
 
@@ -2331,8 +2352,9 @@
 	_sound->setupSound();
 
 	// If requested, load a save game instead of running the boot script
-	if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveLoadCompatible))
+	if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveLoadCompatible)) {
 		runScript(1, 0, 0, &_bootParam);
+	}
 }
 
 void Scumm::go() {





More information about the Scummvm-git-logs mailing list