diff options
author | Travis Howell | 2007-11-06 12:22:52 +0000 |
---|---|---|
committer | Travis Howell | 2007-11-06 12:22:52 +0000 |
commit | 443dff5285f0654be4a6f843b8262bd07bb95036 (patch) | |
tree | 4cf62d53140b7e6d756c05ee09a625865ce70580 /engines/scumm/he | |
parent | 3598192859797d8b7cc33a22af21f04bd45af01a (diff) | |
download | scummvm-rg350-443dff5285f0654be4a6f843b8262bd07bb95036.tar.gz scummvm-rg350-443dff5285f0654be4a6f843b8262bd07bb95036.tar.bz2 scummvm-rg350-443dff5285f0654be4a6f843b8262bd07bb95036.zip |
Add support for original load/save system in HE games.
svn-id: r29434
Diffstat (limited to 'engines/scumm/he')
-rw-r--r-- | engines/scumm/he/script_v60he.cpp | 30 | ||||
-rw-r--r-- | engines/scumm/he/script_v72he.cpp | 31 |
2 files changed, 41 insertions, 20 deletions
diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 2909a44223..6119e9e920 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -568,11 +568,19 @@ void ScummEngine_v60he::o60_roomOps() { copyPalColor(a, b); break; case 221: - int len; + byte buffer[100]; + int len, r; + + convertMessageToString(_scriptPointer, buffer, sizeof(buffer)); len = resStrLen(_scriptPointer); _scriptPointer += len + 1; + + r = convertFilePath(buffer); + memcpy(_saveLoadFileName, buffer + r, sizeof(buffer) - r); + debug(1, "o60_roomOps: case 221: filename %s", _saveLoadFileName); + _saveLoadFlag = pop(); - _saveLoadSlot = 1; + _saveLoadSlot = 255; _saveTemporaryState = true; break; case 234: // HE 7.2 @@ -982,7 +990,6 @@ void ScummEngine_v60he::o60_openFile() { const char *filename; convertMessageToString(_scriptPointer, buffer, sizeof(buffer)); - len = resStrLen(_scriptPointer); _scriptPointer += len + 1; @@ -1042,34 +1049,35 @@ void ScummEngine_v60he::o60_deleteFile() { const char *filename; convertMessageToString(_scriptPointer, buffer, sizeof(buffer)); - len = resStrLen(_scriptPointer); _scriptPointer += len + 1; filename = (char *)buffer + convertFilePath(buffer); + debug(1, "o60_deleteFile stub (\"%s\")", filename); + + _saveFileMan->removeSavefile(filename); } void ScummEngine_v60he::o60_rename() { int len; byte buffer1[100], buffer2[100]; - const char *filename1, *filename2; + const char *newFilename, *oldFilename; convertMessageToString(_scriptPointer, buffer1, sizeof(buffer1)); - len = resStrLen(_scriptPointer); _scriptPointer += len + 1; - filename1 = (char *)buffer1 + convertFilePath(buffer1); - convertMessageToString(_scriptPointer, buffer2, sizeof(buffer2)); - len = resStrLen(_scriptPointer); _scriptPointer += len + 1; - filename2 = (char *)buffer2 + convertFilePath(buffer2); + oldFilename = (char *)buffer1 + convertFilePath(buffer1); + newFilename = (char *)buffer2 + convertFilePath(buffer2); + + debug(1, "o60_rename stub (\"%s\" to \"%s\")", newFilename, oldFilename); - debug(1, "o60_rename stub (\"%s\" to \"%s\")", filename1, filename2); + _saveFileMan->renameSavefile(oldFilename, newFilename); } int ScummEngine_v60he::readFileToArray(int slot, int32 size) { diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index df70fb7b0d..e5ffa12a37 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -978,7 +978,6 @@ void ScummEngine_v72he::o72_getNumFreeArrays() { void ScummEngine_v72he::o72_roomOps() { int a, b, c, d, e; - byte filename[100]; byte subOp = fetchScriptByte(); @@ -1051,11 +1050,17 @@ void ScummEngine_v72he::o72_roomOps() { break; case 221: - copyScriptString(filename, sizeof(filename)); - debug(1, "o72_roomOps: case 221: filename %s", filename); + byte buffer[256]; + int r; + + copyScriptString((byte *)buffer, sizeof(buffer)); + + r = convertFilePath(buffer); + memcpy(_saveLoadFileName, buffer + r, sizeof(buffer) - r); + debug(1, "o72_roomOps: case 221: filename %s", _saveLoadFileName); _saveLoadFlag = pop(); - _saveLoadSlot = 1; + _saveLoadSlot = 255; _saveTemporaryState = true; break; @@ -1871,18 +1876,26 @@ void ScummEngine_v72he::o72_findAllObjects() { } void ScummEngine_v72he::o72_deleteFile() { - byte filename[256]; + byte buffer[256]; - copyScriptString(filename, sizeof(filename)); + copyScriptString(buffer, sizeof(buffer)); + const char *filename = (char *)buffer + convertFilePath(buffer); debug(1, "stub o72_deleteFile(%s)", filename); + + _saveFileMan->removeSavefile(filename); } void ScummEngine_v72he::o72_rename() { - byte oldFilename[100],newFilename[100]; + byte buffer1[100],buffer2[100]; + + copyScriptString(buffer1, sizeof(buffer1)); + copyScriptString(buffer2, sizeof(buffer2)); + + const char *newFilename = (char *)buffer1 + convertFilePath(buffer1); + const char *oldFilename = (char *)buffer2 + convertFilePath(buffer2); - copyScriptString(newFilename, sizeof(newFilename)); - copyScriptString(oldFilename, sizeof(oldFilename)); + _saveFileMan->renameSavefile(oldFilename, newFilename); debug(1, "stub o72_rename(%s to %s)", oldFilename, newFilename); } |