diff options
author | Nipun Garg | 2019-07-11 00:52:29 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:16 +0200 |
commit | 40765c4e9bab19906ce9e9581ccafb7528703e69 (patch) | |
tree | 031ce5f5e4cc4593c5e1d9e22b979a80c53218ed /engines | |
parent | 4c20c8be129a2e720341802783109dec6a07c944 (diff) | |
download | scummvm-rg350-40765c4e9bab19906ce9e9581ccafb7528703e69.tar.gz scummvm-rg350-40765c4e9bab19906ce9e9581ccafb7528703e69.tar.bz2 scummvm-rg350-40765c4e9bab19906ce9e9581ccafb7528703e69.zip |
HDB: Add Save struct and _saveHeader
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/hdb.h | 17 | ||||
-rw-r--r-- | engines/hdb/saveload.cpp | 9 |
2 files changed, 25 insertions, 1 deletions
diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index c6ea5182d1..361ad09f10 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -114,6 +114,18 @@ enum Flag { kFlagPlummet = 0x8000000 }; +struct Save { + char saveID[12]; + int fileSlot; + char mapName[32]; + uint32 seconds; + + Save() : fileSlot(0), seconds(0) { + saveID[0] = 0; + mapName[0] = 0; + } +}; + class HDBGame : public Engine { public: HDBGame(OSystem *syst, const ADGameDescription *gameDesc); @@ -217,6 +229,10 @@ public: return _timeSlice - _prevTimeSlice; } + const Common::String *getTargetName() { + return &_targetName; + } + char *lastMapName() { return _lastMapname; } char *currentMapName() { return _currentMapname; } char *getInMapName() { return _inMapName; } @@ -245,6 +261,7 @@ public: return _cheating; } + Save _saveHeader; bool _gameShutdown; Graphics::PixelFormat _format; diff --git a/engines/hdb/saveload.cpp b/engines/hdb/saveload.cpp index 1bf9ce3be1..6bd212b140 100644 --- a/engines/hdb/saveload.cpp +++ b/engines/hdb/saveload.cpp @@ -38,6 +38,11 @@ Common::Error HDBGame::saveGameState(int slot, const Common::String &desc) { Graphics::saveThumbnail(*out); + memset(&_saveHeader, 0, sizeof(Save)); + strcpy(_saveHeader.saveID, saveFileName.c_str()); + _saveHeader.seconds = _timeSeconds + (_timePlayed / 1000); + strcpy(_saveHeader.mapName, _inMapName); + // Actual Save Data saveGame(out); _lua->save(out, _targetName.c_str(), slot); @@ -91,7 +96,7 @@ void HDBGame::saveGame(Common::OutSaveFile *out) { debug(1, "HDBGame::saveGame: start at %u", out->pos()); // Save Map Name and Time - out->writeUint32LE(_timeSeconds + (_timePlayed / 1000)); + out->writeUint32LE(_saveHeader.seconds); out->write(_inMapName, 32); debug(1, "HDBGame::saveGame: map at %u", out->pos()); @@ -130,6 +135,8 @@ void HDBGame::loadGame(Common::InSaveFile *in) { in->read(_inMapName, 32); g_hdb->_sound->stopMusic(); + _saveHeader.seconds = _timeSeconds; + strcpy(_saveHeader.mapName, _inMapName); // Load Map Object Data debug(1, "HDBGame::loadGame: map at %u", in->pos()); |