From ecb1979245fb6695a68286a59f5eaf2c3677b579 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 8 Dec 2014 01:25:27 +0200 Subject: ZVISION: Implement more advanced engine features Save game thumbnails and save game creation date have now been implemented --- engines/zvision/detection.cpp | 36 +++++++++++----------- .../zvision/scripting/controls/save_control.cpp | 2 ++ 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'engines/zvision') diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index a60ef6040d..ebf5bdcfdd 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -183,10 +183,10 @@ bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { return (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave); - //(f == kSavesSupportMetaInfo) || - //(f == kSavesSupportThumbnail) || - //(f == kSavesSupportCreationDate) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate); //(f == kSavesSupportPlayTime); } @@ -293,41 +293,41 @@ void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { } SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - /* - Common::String filename = ZVision::ZVision::getSavegameFilename(target, slot); + Common::String filename = Common::String::format("%s.%03u", target, slot); Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); if (in) { - ZVision::ZVision::SaveHeader header; - ZVision::ZVision::kReadSaveHeaderError error; + ZVision::SaveGameHeader header; - error = ZVision::ZVision::readSaveHeader(in, true, header); + // We only use readSaveGameHeader() here, which doesn't need an engine callback + ZVision::SaveManager *zvisionSaveMan = new ZVision::SaveManager(NULL); + bool successfulRead = zvisionSaveMan->readSaveGameHeader(in, header); + delete zvisionSaveMan; delete in; - if (error == ZVision::ZVision::kRSHENoError) { - SaveStateDescriptor desc(slot, header.description); + if (successfulRead) { + SaveStateDescriptor desc(slot, header.saveName); desc.setThumbnail(header.thumbnail); if (header.version > 0) { - int day = (header.saveDate >> 24) & 0xFF; - int month = (header.saveDate >> 16) & 0xFF; - int year = header.saveDate & 0xFFFF; + int day = header.saveDay; + int month = header.saveMonth; + int year = header.saveYear; desc.setSaveDate(year, month, day); - int hour = (header.saveTime >> 16) & 0xFF; - int minutes = (header.saveTime >> 8) & 0xFF; + int hour = header.saveHour; + int minutes = header.saveMinutes; desc.setSaveTime(hour, minutes); - desc.setPlayTime(header.playTime * 1000); + //desc.setPlayTime(header.playTime * 1000); } return desc; } } - */ return SaveStateDescriptor(); } diff --git a/engines/zvision/scripting/controls/save_control.cpp b/engines/zvision/scripting/controls/save_control.cpp index ad01257e6b..d773b5fc6f 100644 --- a/engines/zvision/scripting/controls/save_control.cpp +++ b/engines/zvision/scripting/controls/save_control.cpp @@ -101,6 +101,8 @@ bool SaveControl::process(uint32 deltaTimeInMillis) { toSave = false; if (toSave) { + // FIXME: At this point, the screen shows the save control, so the save game thumbnails will always + // show the save control _engine->getSaveManager()->saveGameBuffered(iter->saveId, inp->getText()); _engine->delayedMessage(_engine->getStringManager()->getTextLine(StringManager::ZVISION_STR_SAVED), 2000); _engine->getScriptManager()->changeLocation(_engine->getScriptManager()->getLastMenuLocation()); -- cgit v1.2.3