From 8c555200d94470e554fb08324490dfb733952368 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Mon, 3 Oct 2016 16:02:59 -0500 Subject: SCI32: Change storage type of int16 arrays to hold reg_ts instead Memory references and integers in SSCI are both 16-bit numbers, so game scripts frequently (incorrectly) use an IntArray instead of an IDArray for holding references. Since references in ScummVM are 32-bit reg_ts, IntArray entries must be large enough to hold reg_ts in order to be compatible with game scripts that store references in integer arrays. The alternative solution is to find and patch all incorrect use of IntArray across all games. This is possible, but a bit risky from a save game stability perspective, since incorrect IntArray usage is sometimes not apparent until well after the array is instantiated (like GK1's global interview array). This change invalidates existing SCI32 save games. --- engines/sci/engine/savegame.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'engines/sci/engine/savegame.cpp') diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index f01e2a677e..2e4da46b70 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -685,20 +685,16 @@ void SciArray::saveLoadWithSerializer(Common::Serializer &s) { } switch (_type) { - case kArrayTypeByte: - case kArrayTypeString: - s.syncBytes((byte *)_data, savedSize); - break; case kArrayTypeInt16: - for (int i = 0; i < savedSize; ++i) { - s.syncAsUint16LE(((int16 *)_data)[i]); - } - break; case kArrayTypeID: for (int i = 0; i < savedSize; ++i) { syncWithSerializer(s, ((reg_t *)_data)[i]); } break; + case kArrayTypeByte: + case kArrayTypeString: + s.syncBytes((byte *)_data, savedSize); + break; default: error("Attempt to sync invalid SciArray type %d", _type); } -- cgit v1.2.3