diff options
-rw-r--r-- | engines/dm/dm.cpp | 5 | ||||
-rw-r--r-- | engines/dm/dm.h | 2 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 13 | ||||
-rw-r--r-- | engines/dm/loadsave.cpp | 5 |
4 files changed, 22 insertions, 3 deletions
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 655fb09c4f..08bfb5869d 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -59,6 +59,7 @@ #include <graphics/cursorman.h> #include <advancedDetector.h> #include "sounds.h" +#include <graphics/surface.h> namespace DM { void warning(bool repeat, const char* s, ...) { @@ -202,6 +203,8 @@ DMEngine::DMEngine(OSystem *syst, const ADGameDescription *desc) : Engine(syst), _g562_entranceDoorAnimSteps[i] = nullptr; _g564_interfaceCredits = nullptr; debug("DMEngine::DMEngine"); + + _saveThumbnail = nullptr; } DMEngine::~DMEngine() { @@ -225,7 +228,7 @@ DMEngine::~DMEngine() { delete _dialog; delete _sound; - + delete _saveThumbnail; delete[] _savedScreenForOpenEntranceDoors; // clear debug channels diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 1187db803c..d72bc63219 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -35,6 +35,7 @@ #include "engines/savestate.h" #include "console.h" +#include <common/memstream.h> struct ADGameDescription; @@ -265,6 +266,7 @@ public: DialogMan *_dialog; SoundMan *_sound; + Common::MemoryWriteStreamDynamic *_saveThumbnail; bool _engineShouldQuit; diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 638fba2bf0..d19f47c7b4 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -25,6 +25,9 @@ * maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/) */ +#include <graphics/surface.h> +#include "graphics/thumbnail.h" + #include "inventory.h" #include "dungeonman.h" #include "eventman.h" @@ -53,7 +56,7 @@ void InventoryMan::initConstants() { "ARTISAN", "ADEPT", "EXPERT", "` MASTER", "a MASTER","b MASTER", "c MASTER", "d MASTER", "e MASTER", "ARCHMASTER"}; static const char* G0428_apc_SkillLevelNames_DE_DEU[15] = {"ANFAENGER", "NEULING", "LEHRLING", "ARBEITER", "GESELLE", "HANDWERKR", "FACHMANN", "EXPERTE", "` MEISTER", "a MEISTER", "b MEISTER", "c MEISTER", "d MEISTER", "e MEISTER", "ERZMEISTR"}; - static const char* G0428_apc_SkillLevelNames_FR_FRA[15] = { "NEOPHYTE", "NOVICE", "APPRENTI", "COMPAGNON", "ARTISAN", "PATRON", + static const char* G0428_apc_SkillLevelNames_FR_FRA[15] = {"NEOPHYTE", "NOVICE", "APPRENTI", "COMPAGNON", "ARTISAN", "PATRON", "ADEPTE", "EXPERT", "MAITRE '", "MAITRE a", "MAITRE b", "MAITRE c", "MAITRE d", "MAITRE e", "SUR-MAITRE"}; const char **g428_byLanguage; switch (_vm->getGameLanguage()) { // localized @@ -80,6 +83,14 @@ InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) { } void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { + if (championIndex == kM1_ChampionNone) { + delete _vm->_saveThumbnail; + _vm->_saveThumbnail = nullptr; + } else if (!_vm->_saveThumbnail) { + _vm->_saveThumbnail = new Common::MemoryWriteStreamDynamic(); + Graphics::saveThumbnail(*_vm->_saveThumbnail); + } + uint16 L1102_ui_Multiple; #define AL1102_ui_InventoryChampionOrdinal L1102_ui_Multiple #define AL1102_ui_SlotIndex L1102_ui_Multiple diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp index 3b4cd8070d..3bef55fcc9 100644 --- a/engines/dm/loadsave.cpp +++ b/engines/dm/loadsave.cpp @@ -359,7 +359,10 @@ void DMEngine::writeSaveGameHeader(Common::OutSaveFile* out, const Common::Strin out->writeByte(0); // Save the game thumbnail - Graphics::saveThumbnail(*out); + if (_saveThumbnail) { + out->write(_saveThumbnail->getData(), _saveThumbnail->size()); + } else + Graphics::saveThumbnail(*out); // Creation date/time TimeDate curTime; |