From defd1e708417fe4a164cd6fd394bd096f1d96283 Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Wed, 15 Jan 2003 14:14:00 +0000
Subject: increased variable size from 16 to 32 bits

svn-id: r6469
---
 scumm/saveload.cpp | 16 +++++++++-------
 scumm/saveload.h   |  5 +++--
 2 files changed, 12 insertions(+), 9 deletions(-)

(limited to 'scumm')

diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index 77e4d46c9c..dd8bb49ecc 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -357,11 +357,11 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion)
 		MKLINE(Scumm, _currentScript, sleByte, VER_V8),
 		MKARRAY(Scumm, _localScriptList[0], sleUint32, NUM_LOCALSCRIPT, VER_V8),
 
-		// vm.localvar grew from 25 to 40 entries
-		// FIXME: ComI stores 32-bit variables.. so.. er.. shouldn't this be a sleInt32 if we
-		//  don't want games to hidiously behave oddly?
+		// vm.localvar grew from 25 to 40 entries and then from
+		// 16 to 32 bit variables.
 		MKARRAY_OLD(Scumm, vm.localvar[0][0], sleUint16, 25 * 17, VER_V8, VER_V8),
-		MKARRAY(Scumm, vm.localvar[0][0], sleUint16, NUM_SCRIPT_SLOT * 17, VER_V9),
+		MKARRAY_OLD(Scumm, vm.localvar[0][0], sleUint16, NUM_SCRIPT_SLOT * 17, VER_V9, VER_V14),
+		MKARRAY(Scumm, vm.localvar[0][0], sleUint16, NUM_SCRIPT_SLOT * 17, VER_V15),
 
 		MKARRAY(Scumm, _resourceMapper[0], sleByte, 128, VER_V8),
 		MKARRAY(Scumm, _charsetColorMap[0], sleByte, 16, VER_V8),
@@ -625,9 +625,11 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion)
 	var120Backup = _vars[120];
 	var98Backup = _vars[98];
 
-	// FIXME: ComI stores 32-bit variables.. so.. er.. shouldn't this be a sleInt32 if we
-	//  don't want games to hidiously behave oddly?
-	s->saveLoadArrayOf(_vars, _numVariables, sizeof(_vars[0]), sleInt16);
+	// The variables grew from 16 to 32 bit.
+	if (savegameVersion < VER_V15)
+		s->saveLoadArrayOf(_vars, _numVariables, sizeof(_vars[0]), sleInt16);
+	else
+		s->saveLoadArrayOf(_vars, _numVariables, sizeof(_vars[0]), sleInt32);
 
 	if (_gameId == GID_TENTACLE)	// Maybe misplaced, but that's the main idea
 		_vars[120] = var120Backup;
diff --git a/scumm/saveload.h b/scumm/saveload.h
index b511a0c6d8..93e7d62893 100644
--- a/scumm/saveload.h
+++ b/scumm/saveload.h
@@ -33,10 +33,11 @@ enum {
 	VER_V11,
 	VER_V12,
 	VER_V13,
-	VER_V14
+	VER_V14,
+	VER_V15
 };
 
-#define CURRENT_VER VER_V14
+#define CURRENT_VER VER_V15
 
 
 // To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
-- 
cgit v1.2.3