aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2007-05-16 08:27:15 +0000
committerTravis Howell2007-05-16 08:27:15 +0000
commit27b56c23f6a6b374cde4a06bfd4f60c4a6a78d1f (patch)
tree3419fce5e3dabe7d4cf467ce6d8850f513f553c3 /engines
parenta91f7e025c6e047b6b3a639231b37357cd9677c9 (diff)
downloadscummvm-rg350-27b56c23f6a6b374cde4a06bfd4f60c4a6a78d1f.tar.gz
scummvm-rg350-27b56c23f6a6b374cde4a06bfd4f60c4a6a78d1f.tar.bz2
scummvm-rg350-27b56c23f6a6b374cde4a06bfd4f60c4a6a78d1f.zip
Add caption to saved games for Elvira 1/2 and Waxworks.
svn-id: r26850
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.h10
-rw-r--r--engines/agos/saveload.cpp19
-rw-r--r--engines/agos/script_e1.cpp8
3 files changed, 25 insertions, 12 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index d865719e39..162bc6d11d 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -1165,11 +1165,8 @@ protected:
Item *getNextItemPtrStrange();
- bool loadGame_e1(const char *filename, bool restartMode = false);
- bool saveGame_e1(const char *filename);
-
- bool loadGame(const char *filename, bool restartMode = false);
- bool saveGame(uint slot, const char *caption);
+ virtual bool loadGame(const char *filename, bool restartMode = false);
+ virtual bool saveGame(uint slot, const char *caption);
void openTextWindow();
void tidyIconArray(uint i);
@@ -1283,6 +1280,9 @@ protected:
};
const OpcodeEntryElvira1 *_opcodesElvira1;
+
+ virtual bool loadGame(const char *filename, bool restartMode = false);
+ virtual bool saveGame(uint slot, const char *caption);
};
class AGOSEngine_Elvira2 : public AGOSEngine_Elvira1 {
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 5ec62ac01a..f63cca3e92 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -557,7 +557,8 @@ void writeItemID(Common::WriteStream *f, uint16 val) {
f->writeUint32BE(val - 1);
}
-bool AGOSEngine::loadGame_e1(const char *filename, bool restartMode) {
+bool AGOSEngine_Elvira1::loadGame(const char *filename, bool restartMode) {
+ char ident[100];
Common::SeekableReadStream *f = NULL;
uint num, item_index, i;
@@ -577,6 +578,10 @@ bool AGOSEngine::loadGame_e1(const char *filename, bool restartMode) {
return false;
}
+ if (!restartMode) {
+ f->read(ident, 8);
+ }
+
num = f->readUint32BE();
if (f->readUint32BE() != 0xFFFFFFFF || num != _itemArrayInited - 1) {
@@ -649,7 +654,7 @@ bool AGOSEngine::loadGame_e1(const char *filename, bool restartMode) {
return true;
}
-bool AGOSEngine::saveGame_e1(const char *filename) {
+bool AGOSEngine_Elvira1::saveGame(uint slot, const char *caption) {
Common::OutSaveFile *f;
uint item_index, num_item, i;
TimeEvent *te;
@@ -658,13 +663,15 @@ bool AGOSEngine::saveGame_e1(const char *filename) {
_lockWord |= 0x100;
- f = _saveFileMan->openForSaving(filename);
+ f = _saveFileMan->openForSaving(genSaveName(slot));
if (f == NULL) {
- warning("saveGame: Failed to save %s", filename);
+ warning("saveGame: Failed to save slot %d", slot);
_lockWord &= ~0x100;
return false;
}
+ f->write(caption, 8);
+
f->writeUint32BE(_itemArrayInited - 1);
f->writeUint32BE(0xFFFFFFFF);
f->writeUint32BE(0);
@@ -753,6 +760,8 @@ bool AGOSEngine::loadGame(const char *filename, bool restartMode) {
f->read(ident, 100);
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
f->read(ident, 18);
+ } else if (!restartMode) {
+ f->read(ident, 8);
}
num = f->readUint32BE();
@@ -894,6 +903,8 @@ bool AGOSEngine::saveGame(uint slot, const char *caption) {
curTime = time(NULL);
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
f->write(caption, 18);
+ } else {
+ f->write(caption, 8);
}
f->writeUint32BE(_itemArrayInited - 1);
diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp
index 72ca9c3ce3..684518abcf 100644
--- a/engines/agos/script_e1.cpp
+++ b/engines/agos/script_e1.cpp
@@ -695,7 +695,9 @@ void AGOSEngine_Elvira1::oe1_saveGame() {
uint16 stringId = getNextStringID();
debug(0, "oe1_saveGame: stub (%s)", getStringPtrByID(stringId));
- saveGame_e1((const char *)getStringPtrByID(stringId));
+
+ // TODO: Add support for selecting slot
+ saveGame(1, (const char *)getStringPtrByID(stringId));
}
void AGOSEngine_Elvira1::oe1_loadGame() {
@@ -704,9 +706,9 @@ void AGOSEngine_Elvira1::oe1_loadGame() {
debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
if (!scumm_stricmp(getFileName(GAME_RESTFILE), (const char *)getStringPtrByID(stringId))) {
- loadGame_e1(getFileName(GAME_RESTFILE), true);
+ loadGame(getFileName(GAME_RESTFILE), true);
} else {
- loadGame_e1((const char *)getStringPtrByID(stringId));
+ loadGame((const char *)getStringPtrByID(stringId));
}
}