Add caption to saved games for Elvira 1/2 and Waxworks.
svn-id: r26850
This commit is contained in:
parent
a91f7e025c
commit
27b56c23f6
3 changed files with 25 additions and 12 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue