[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.106,2.107 script_v2.cpp,2.189,2.190 script_v5.cpp,1.164,1.165

Jonathan Gray khalek at users.sourceforge.net
Sun Aug 31 08:40:07 CEST 2003


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

Modified Files:
	intern.h script_v2.cpp script_v5.cpp 
Log Message:
cleanup and make script_v2 use o5_saveLoadGame

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.106
retrieving revision 2.107
diff -u -d -r2.106 -r2.107
--- intern.h	31 Aug 2003 14:58:55 -0000	2.106
+++ intern.h	31 Aug 2003 15:39:26 -0000	2.107
@@ -134,6 +134,7 @@
 	void o5_quitPauseRestart();
 	void o5_resourceRoutines();
 	void o5_roomOps();
+	void o5_saveLoadGame();
 	void o5_saveLoadVars();
 	void o5_saveRestoreVerbs();
 	void o5_setCameraAt();
@@ -273,7 +274,6 @@
 	void o2_resourceRoutines();
 	void o2_restart();
 	void o2_roomOps();
-	void o2_saveLoadGame();
 	void o2_getActorElevation();
 	void o2_setActorElevation();
 	void o2_setBitVar();

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.189
retrieving revision 2.190
diff -u -d -r2.189 -r2.190
--- script_v2.cpp	29 Aug 2003 06:46:12 -0000	2.189
+++ script_v2.cpp	31 Aug 2003 15:39:27 -0000	2.190
@@ -75,7 +75,7 @@
 		/* 20 */
 		OPCODE(o5_stopMusic),
 		OPCODE(o2_putActor),
-		OPCODE(o2_saveLoadGame),
+		OPCODE(o5_saveLoadGame),
 		OPCODE(o2_getActorY),
 		/* 24 */
 		OPCODE(o2_loadRoomWithEgo),
@@ -235,7 +235,7 @@
 		/* A0 */
 		OPCODE(o5_stopObjectCode),
 		OPCODE(o2_putActor),
-		OPCODE(o2_saveLoadGame),
+		OPCODE(o5_saveLoadGame),
 		OPCODE(o2_getActorY),
 		/* A4 */
 		OPCODE(o2_loadRoomWithEgo),
@@ -1157,14 +1157,6 @@
 	int x = getVarOrDirectByte(0x80) * 8;
 	int y = getVarOrDirectByte(0x40) * 2;
 	setResult(findObject(x, y));
-}
-
-void Scumm_v2::o2_saveLoadGame() {
-	getResultPos();
-	byte a = getVarOrDirectByte(0x80);
-
-	warning("TODO: o2_saveLoadGame(%d)", a);
-	setResult(0);
 }
 
 void Scumm_v2::o2_getActorX() {

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- script_v5.cpp	31 Aug 2003 14:58:56 -0000	1.164
+++ script_v5.cpp	31 Aug 2003 15:39:27 -0000	1.165
@@ -1083,50 +1083,55 @@
 	setResult(getObjY(a));
 }
 
-void Scumm_v5::o5_getAnimCounter() {
+void Scumm_v5::o5_saveLoadGame() {
 	getResultPos();
-	// Loom uses this opcode in its load/save screen.
-	//if (_gameId == GID_LOOM) {
-	if (_version <= 3) {
-		byte a = getVarOrDirectByte(0x80);
-		byte slot = a & 0x1F;
-		byte result = 0;
+	byte a = getVarOrDirectByte(0x80);
+	byte slot = a & 0x1F;
+	byte result = 0;
 		
-		switch(a & 0xE0) {
-			case 0x00: // num slots available
-				result = 100;
-				break;
-			case 0x20: // dos drive?
+	switch(a & 0xE0) {
+		case 0x00: // num slots available
+			result = 100;
+			break;
+		case 0x20: // dos drive?
+			result = 0;
+			break;
+		case 0x40: // load 
+			if (loadState(slot, _saveLoadCompatible))
+				result = 3; // sucess
+			else
+				result = 5; // failed to load
+			break;
+		case 0x80: // save
+			if (saveState(slot, _saveLoadCompatible))
 				result = 0;
-				break;
-			case 0x40: // load 
-				if (loadState(slot, _saveLoadCompatible))
-					result = 3; // sucess
-				else
-					result = 5; // failed to load
-				break;
-			case 0x80: // save
-				if (saveState(slot, _saveLoadCompatible))
-					result = 0;
-				else
-					result = 2;
-			case 0xC0: // test if save exists
-				bool avail_saves[100];
-				SaveFileManager *mgr = _system->get_savefile_manager();
-				listSavegames(avail_saves, ARRAYSIZE(avail_saves), mgr);
-				delete mgr;
-				if (avail_saves[slot])
-					result = 6; // save file exists
-				else
-					result = 7; // save file does not exist
-				break;
-		}
-		setResult(result);
-	} else {
-		int act = getVarOrDirectByte(0x80);
-		Actor *a = derefActor(act, "o5_getAnimCounter");
-		setResult(a->cost.animCounter);
+			else
+				result = 2;
+		case 0xC0: // test if save exists
+			bool avail_saves[100];
+			SaveFileManager *mgr = _system->get_savefile_manager();
+			listSavegames(avail_saves, ARRAYSIZE(avail_saves), mgr);
+			delete mgr;
+			if (avail_saves[slot])
+				result = 6; // save file exists
+			else
+				result = 7; // save file does not exist
+			break;
 	}
+	setResult(result);
+}
+		
+void Scumm_v5::o5_getAnimCounter() {
+	if (_version == 3) {
+		o5_saveLoadGame();
+		return;
+	}
+		
+	getResultPos();
+
+	int act = getVarOrDirectByte(0x80);
+	Actor *a = derefActor(act, "o5_getAnimCounter");
+	setResult(a->cost.animCounter);
 }
 
 void Scumm_v5::o5_getClosestObjActor() {





More information about the Scummvm-git-logs mailing list