diff options
author | Gregory Montoir | 2004-12-02 21:24:27 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-12-02 21:24:27 +0000 |
commit | 891970cd767760cbb682319d3215786d4a651c08 (patch) | |
tree | 8adaca7e1b4a6774079c191b2cb36feaea743a06 | |
parent | 39de0960ff0ecfd6b71a4add447600e565c08d44 (diff) | |
download | scummvm-rg350-891970cd767760cbb682319d3215786d4a651c08.tar.gz scummvm-rg350-891970cd767760cbb682319d3215786d4a651c08.tar.bz2 scummvm-rg350-891970cd767760cbb682319d3215786d4a651c08.zip |
enabled autosave
svn-id: r15970
-rw-r--r-- | queen/logic.cpp | 1 | ||||
-rw-r--r-- | queen/queen.cpp | 11 | ||||
-rw-r--r-- | queen/queen.h | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/queen/logic.cpp b/queen/logic.cpp index d5756584c0..bceb872755 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -69,7 +69,6 @@ Logic::Logic(QueenEngine *vm) _puzzleAttemptCount = 0; _journal = new Journal(vm); _scene = 0; - memset(_gameState, 0, sizeof(_gameState)); initialise(); } diff --git a/queen/queen.cpp b/queen/queen.cpp index a2780ce7dc..97c5e5b8b2 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -182,6 +182,10 @@ void QueenEngine::update(bool checkPlayerInput) { _input->quickLoadReset(); loadGameState(0); } + if (_system->getMillis() - _lastSaveTime > AUTOSAVE_INTERVAL) { + saveGameState(AUTOSAVE_SLOT, "Autosave"); + _lastSaveTime = _system->getMillis(); + } if (checkPlayerInput) { _command->updatePlayer(); } @@ -265,7 +269,11 @@ SaveFile *QueenEngine::readGameStateHeader(uint16 slot, GameStateHeader *gsh) { } void QueenEngine::makeGameStateName(uint16 slot, char *buf) { - sprintf(buf, "queen.s%02d", slot); + if (slot == AUTOSAVE_SLOT) { + strcpy(buf, "queen.asd"); + } else { + sprintf(buf, "queen.s%02d", slot); + } } void QueenEngine::findGameStateDescriptions(char descriptions[100][32]) { @@ -293,6 +301,7 @@ int QueenEngine::go() { if (ConfMan.hasKey("save_slot") && !(_resource->isDemo() || _resource->isInterview())) { loadGameState(ConfMan.getInt("save_slot")); } + _lastSaveTime = _system->getMillis(); _quit = false; while (!_quit) { // queen.c lines 4080-4104 diff --git a/queen/queen.h b/queen/queen.h index 6ef5d463c6..5c8739d384 100644 --- a/queen/queen.h +++ b/queen/queen.h @@ -116,7 +116,9 @@ public: enum { SAVESTATE_CUR_VER = 1, - SAVESTATE_MAX = 100 + SAVESTATE_MAX = 100, + AUTOSAVE_INTERVAL = 5 * 60 * 1000, + AUTOSAVE_SLOT = 0xFF }; protected: @@ -130,6 +132,7 @@ protected: int _talkSpeed; bool _subtitles; bool _quit; + uint32 _lastSaveTime; BamScene *_bam; BankManager *_bankMan; |