aboutsummaryrefslogtreecommitdiff
path: root/engines/cine/various.cpp
diff options
context:
space:
mode:
authorKari Salminen2008-07-29 10:13:53 +0000
committerKari Salminen2008-07-29 10:13:53 +0000
commit0365c45b8c613eb9a84e656b5a4f0eb2be33e5e0 (patch)
tree2f1ab246c274bc4070ca744f185bb90c2e81c3f9 /engines/cine/various.cpp
parent884b753c7362b25356f427f4f15abe90bf411032 (diff)
downloadscummvm-rg350-0365c45b8c613eb9a84e656b5a4f0eb2be33e5e0.tar.gz
scummvm-rg350-0365c45b8c613eb9a84e656b5a4f0eb2be33e5e0.tar.bz2
scummvm-rg350-0365c45b8c613eb9a84e656b5a4f0eb2be33e5e0.zip
Rearranged parts of the Operation Stealth savegame loading routine.
- Emulating the Future Wars savegame loading routine and hoping for the best. - Fixes an array out of bounds access when loading the global scripts. Now the loading crashes in the mainloop in processSeqList! But at least we got a bit farther this time. More fixing to come... svn-id: r33404
Diffstat (limited to 'engines/cine/various.cpp')
-rw-r--r--engines/cine/various.cpp67
1 files changed, 43 insertions, 24 deletions
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index ab181743db..9a9393cc92 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -751,6 +751,45 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) {
in.read(currentCtName, 13);
+ // Moved the loading of current procedure, relation,
+ // backgrounds and Ct here because if they were at the
+ // end of this function then the global scripts loading
+ // made an array out of bounds access. In the original
+ // game's disassembly these aren't here but at the end.
+ // The difference is probably in how we handle loading
+ // the global scripts and some other things (i.e. the
+ // loading routines aren't exactly the same and subtle
+ // semantic differences result in having to do things
+ // in a different order).
+ {
+ // Not sure if this is needed with Operation Stealth...
+ checkDataDisk(currentDisk);
+
+ if (strlen(currentPrcName)) {
+ loadPrc(currentPrcName);
+ }
+
+ if (strlen(currentRelName)) {
+ loadRel(currentRelName);
+ }
+
+ // Load first background (Uses loadBg)
+ if (strlen(bgNames[0])) {
+ loadBg(bgNames[0]);
+ }
+
+ // Add backgrounds 1-7 (Uses addBackground)
+ for (int i = 1; i < 8; i++) {
+ if (strlen(bgNames[i])) {
+ addBackground(bgNames[i], i);
+ }
+ }
+
+ if (strlen(currentCtName)) {
+ loadCtOS(currentCtName);
+ }
+ }
+
loadObjectTable(in);
renderer->restorePalette(in);
globalVars.load(in, NUM_MAX_VAR);
@@ -810,34 +849,14 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) {
loadOverlayList(in);
loadBgIncrustFromSave(in);
- if (strlen(currentPrcName)) {
- loadPrc(currentPrcName);
- }
-
- if (strlen(currentRelName)) {
- loadRel(currentRelName);
- }
-
+ // Left this here instead of moving it earlier in this function with
+ // the other current value loadings (e.g. loading of current procedure,
+ // current backgrounds etc). Mostly emulating the way we've handled
+ // Future Wars savegames and hoping that things work out.
if (strlen(currentMsgName)) {
loadMsg(currentMsgName);
}
- // Load first background (Uses loadBg)
- if (strlen(bgNames[0])) {
- loadBg(bgNames[0]);
- }
-
- // Add backgrounds 1-7 (Uses addBackground)
- for (int i = 1; i < 8; i++) {
- if (strlen(bgNames[i])) {
- addBackground(bgNames[i], i);
- }
- }
-
- if (strlen(currentCtName)) {
- loadCtOS(currentCtName);
- }
-
// TODO: Add current music loading and playing here
// TODO: Palette handling?