[Scummvm-cvs-logs] SF.net SVN: scummvm:[42593] scummvm/trunk/engines/agos

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jul 18 17:15:26 CEST 2009


Revision: 42593
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42593&view=rev
Author:   fingolfin
Date:     2009-07-18 15:15:26 +0000 (Sat, 18 Jul 2009)

Log Message:
-----------
AGOS: Removed second setjmp in PN code (untested!)

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/pn.cpp
    scummvm/trunk/engines/agos/saveload.cpp
    scummvm/trunk/engines/agos/script_pn.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2009-07-18 15:12:54 UTC (rev 42592)
+++ scummvm/trunk/engines/agos/agos.h	2009-07-18 15:15:26 UTC (rev 42593)
@@ -1470,8 +1470,8 @@
 	virtual void windowPutChar(WindowBlock *window, byte c, byte b = 0);
 
 	bool badload(int8 errorNum);
-	int loadfl(char *name);
-	int savfl(char *name);
+	int loadFile(char *name);
+	int saveFile(char *name);
 	void getFilename();
 	void sysftodb();
 	void dbtosysf();

Modified: scummvm/trunk/engines/agos/pn.cpp
===================================================================
--- scummvm/trunk/engines/agos/pn.cpp	2009-07-18 15:12:54 UTC (rev 42592)
+++ scummvm/trunk/engines/agos/pn.cpp	2009-07-18 15:15:26 UTC (rev 42593)
@@ -251,29 +251,33 @@
 }
 
 void AGOSEngine_PN::processor() {
-	int q;
-
 	setqptrs();
-	q = setjmp(_loadfail);
 
-	_variableArray[6] = 0;
+	_tagOfActiveDoline = 0;
+	int q = 0;
+	do {
+		assert(_tagOfActiveDoline == 0);
+		_dolineReturnVal = 0;
 
-	if (getPlatform() == Common::kPlatformAtariST) {
-		_variableArray[21] = 2;
-	} else if (getPlatform() == Common::kPlatformAmiga) {
-		_variableArray[21] = 0;
-	} else {
-		_variableArray[21] = 1;
-	}
+		_variableArray[6] = 0;
 
-	_variableArray[16] = _quickshort[6];
-	_variableArray[17] = _quickshort[7];
-	_variableArray[19] = getptr(55L);
+		if (getPlatform() == Common::kPlatformAtariST) {
+			_variableArray[21] = 2;
+		} else if (getPlatform() == Common::kPlatformAmiga) {
+			_variableArray[21] = 0;
+		} else {
+			_variableArray[21] = 1;
+		}
 
-	// q indicates the process to run and is 0 the first time,
-	// but 1 later on (i.e., when we are "called" from badload()).
-	setposition(q, 0);
-	doline(0);
+		_variableArray[16] = _quickshort[6];
+		_variableArray[17] = _quickshort[7];
+		_variableArray[19] = getptr(55L);
+
+		// q indicates the process to run and is 0 the first time,
+		// but 1 later on (i.e., when we are "called" from badload()).
+		setposition(0, 0);
+		q = doline(0);
+	} while (q);
 }
 
 void AGOSEngine_PN::setqptrs() {

Modified: scummvm/trunk/engines/agos/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agos/saveload.cpp	2009-07-18 15:12:54 UTC (rev 42592)
+++ scummvm/trunk/engines/agos/saveload.cpp	2009-07-18 15:15:26 UTC (rev 42593)
@@ -23,8 +23,6 @@
  *
  */
 
-
-
 #include "common/savefile.h"
 #include "common/system.h"
 
@@ -1553,15 +1551,19 @@
 #ifdef ENABLE_PN
 // Personal Nightmare specific
 bool AGOSEngine_PN::badload(int8 errorNum) {
+printf("badload(%d)\n", errorNum);
 	if (errorNum == -2)
 		return 0;
-	/* Load error recovery routine */
+	// Load error recovery routine
+
+	// Clear any stack
 	while (_stackbase != NULL) {
-		/* Clear any stack */
 		dumpstack();
 	}
-	/* Restart from process 1 */
-	longjmp(_loadfail, 1);
+
+	// Restart from process 1
+	_tagOfActiveDoline = 1;
+	_dolineReturnVal = 2;
 	return 1;
 }
 
@@ -1582,7 +1584,7 @@
 	}
 }
 
-int AGOSEngine_PN::loadfl(char *name) {
+int AGOSEngine_PN::loadFile(char *name) {
 	Common::InSaveFile *f;
 	haltAnimation();
 
@@ -1615,7 +1617,7 @@
 	return 0;
 }
 
-int AGOSEngine_PN::savfl(char *name) {
+int AGOSEngine_PN::saveFile(char *name) {
 	Common::OutSaveFile *f;
 	sysftodb();
 	haltAnimation();

Modified: scummvm/trunk/engines/agos/script_pn.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_pn.cpp	2009-07-18 15:12:54 UTC (rev 42592)
+++ scummvm/trunk/engines/agos/script_pn.cpp	2009-07-18 15:15:26 UTC (rev 42593)
@@ -397,7 +397,7 @@
 	if (slot == -1) {
 		setScriptReturn(false);
 	} else {
-		a = loadfl(bf);
+		a = loadFile(bf);
 		if (a)
 			setScriptReturn(badload(a));
 		else
@@ -434,7 +434,7 @@
 			break;
 	}
 
-	a = savfl(bf);
+	a = saveFile(bf);
 	setScriptReturn(a);
 }
 
@@ -918,7 +918,7 @@
 				if (x > 0) {
 					dumpstack();
 					// Restore the active jmpbuf to its previous value,
-					// then return the longjmp value (will be 2-1=1 or 1-1=0).
+					// then return _dolineReturnVal-1 (will be 2-1=1 or 1-1=0).
 					_tagOfActiveDoline = myTag - 1;
 					return (x - 1);
 				}


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