From ee42d06a437e5c0b9d96cee65c33e4f88c258dee Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 24 Mar 2009 23:30:48 +0000 Subject: Patch from bug #2710315: INDY3/FOA: bug in patch for series IQ with ScummVM GUI svn-id: r39677 --- engines/scumm/script_v5.cpp | 16 ++++++++++------ engines/scumm/scumm.cpp | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index a8cd1336e3..e6af16af86 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -1017,9 +1017,13 @@ void ScummEngine_v5::loadVars() { */ void ScummEngine_v5::updateIQPoints() { int seriesIQ; - int episodeIQStringSize; + // IQString[0..72] corresponds to each puzzle's IQ. + // IQString[73] indicates that the IQ-file was loaded successfully and is always 0 when + // the IQ is calculated, hence it will be ignored here. + const int NUM_PUZZLES = 73; + byte seriesIQString[NUM_PUZZLES]; byte *episodeIQString; - byte seriesIQString[73]; + int episodeIQStringSize; // load string with IQ points given per puzzle in any savegame // IMPORTANT: the resource string STRINGID_IQ_SERIES is only valid while @@ -1032,14 +1036,14 @@ void ScummEngine_v5::updateIQPoints() { if (!episodeIQString) return; episodeIQStringSize = getResourceSize(rtString, STRINGID_IQ_EPISODE); - if (episodeIQStringSize < 73) + if (episodeIQStringSize < NUM_PUZZLES) return; // merge episode and series IQ strings and calculate series IQ seriesIQ = 0; - // iterate over puzzles (each of the first 73 bytes corresponds to a puzzle's IQ) - for (int i = 0; i < 73 ; ++i) { - char puzzleIQ = seriesIQString[i]; + // iterate over puzzles + for (int i = 0; i < NUM_PUZZLES ; ++i) { + byte puzzleIQ = seriesIQString[i]; // if puzzle is solved copy points to episode string if (puzzleIQ > 0) episodeIQString[i] = puzzleIQ; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 441150bc9c..1443f2e6df 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -2083,7 +2083,8 @@ void ScummEngine::scummLoop_handleSaveLoad() { } void ScummEngine_v5::scummLoop_handleSaveLoad() { - byte saveLoad = (_saveLoadFlag != 0); + // copy saveLoadFlag as handleSaveLoad() resets it + byte saveLoad = _saveLoadFlag; ScummEngine::scummLoop_handleSaveLoad(); -- cgit v1.2.3