diff options
author | lolbot-iichan | 2019-05-21 00:00:07 +0300 |
---|---|---|
committer | Filippos Karapetis | 2020-01-11 18:05:39 +0200 |
commit | e68e82cd8cf309a3b8fc353d2695f45e165311ef (patch) | |
tree | 3b92afb14eba22f325e5c13d25859c4d62e0254b /engines/wintermute/base/base_game.cpp | |
parent | 4bd18fd25e0dffe40bb9e2aa9e59d3b41ac17529 (diff) | |
download | scummvm-rg350-e68e82cd8cf309a3b8fc353d2695f45e165311ef.tar.gz scummvm-rg350-e68e82cd8cf309a3b8fc353d2695f45e165311ef.tar.bz2 scummvm-rg350-e68e82cd8cf309a3b8fc353d2695f45e165311ef.zip |
WINTERMUTE: Add FoxTail saveslot timestamp getter
FoxTail requires Game.GetSaveSlotDescriptionTimestamp for getting
information about saved games.
Engine 1.2.362 and below returns object with Description and Timestamp
fields.
Engine 1.2.527 and above returns array[2] with Description and Timestamp
as items.
Diffstat (limited to 'engines/wintermute/base/base_game.cpp')
-rw-r--r-- | engines/wintermute/base/base_game.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index e389b6795a..58195e6faa 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -1368,6 +1368,49 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack return STATUS_OK; } +#ifdef ENABLE_FOXTAIL + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] GetSaveSlotDescriptionTimestamp + // Return struct with "Description" and "Timestamp" fields in 1.2.362- + // Return array with "Description" and "Timestamp" items in 1.2.527+ + // Timestamps should be comparable types + // Used to sort saved games by timestamps at save.script & load.script + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "GetSaveSlotDescriptionTimestamp") == 0) { + stack->correctParams(1); + int slot = stack->pop()->getInt(); + + TimeDate time; + SaveLoad::getSaveSlotTimestamp(slot, &time); + stack->pushInt(time.tm_sec); + stack->pushInt(time.tm_min); + stack->pushInt(time.tm_hour); + stack->pushInt(time.tm_mday); + stack->pushInt(time.tm_mon + 1); + stack->pushInt(time.tm_year + 1900); + stack->pushInt(6); + BaseScriptable *date = makeSXDate(_gameRef, stack); + stack->pushNative(date, false); + + Common::String desc = SaveLoad::getSaveSlotDescription(slot); + stack->pushString(desc.c_str()); + + BaseScriptable *obj; + if (BaseEngine::instance().isFoxTail(FOXTAIL_1_2_527, FOXTAIL_LATEST_VERSION)) { + stack->pushInt(2); + obj = makeSXArray(_gameRef, stack); + } else { + stack->pushInt(0); + obj = makeSXObject(_gameRef, stack); + obj->scSetProperty("Description", stack->pop()); + obj->scSetProperty("Timestamp", stack->pop()); + } + stack->pushNative(obj, false); + + return STATUS_OK; + } +#endif + ////////////////////////////////////////////////////////////////////////// // EmptySaveSlot ////////////////////////////////////////////////////////////////////////// |