Skip to content

Commit

Permalink
TRECISION: Fix thumbnail when using ScummVM menu to save (bug #13834)
Browse files Browse the repository at this point in the history
When saving from the game's control panel, we use the thumbnail that was
created before the control panel opened. But when using the ScummVM
menu, we need to generate the thumbnail as usual. Otherwise, there may
not be any thumbnail at all, causing the save to fail.
  • Loading branch information
Torbjörn Andersson committed Dec 1, 2023
1 parent 49ae002 commit 4995aa1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions engines/trecision/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3988,7 +3988,9 @@ void LogicManager::handleClickControlPanel(uint16 curObj) {
if (_vm->_oldRoom == kRoomControlPanel)
break;
_vm->_curRoom = _vm->_obj[o00EXIT]._goRoom;
_vm->_controlPanelSave = true;
_vm->dataSave();
_vm->_controlPanelSave = false;
_vm->showInventoryName(NO_OBJECTS, false);
_vm->showIconName();
_vm->changeRoom(_vm->_obj[o00EXIT]._goRoom);
Expand Down
8 changes: 7 additions & 1 deletion engines/trecision/metaengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ void TrecisionMetaEngine::getSavegameThumbnail(Graphics::Surface &thumb) {
// We are referencing g_engine here, but this should be safe, as this
// method is only used while the engine is running.
// TODO: Is there a better way to do this?
thumb.copyFrom(((Trecision::TrecisionEngine *)g_engine)->_thumbnail);

Trecision::TrecisionEngine *engine = (Trecision::TrecisionEngine *)g_engine;

if (engine->_controlPanelSave)
thumb.copyFrom(engine->_thumbnail);
else
MetaEngine::getSavegameThumbnail(thumb);
}

SaveStateDescriptor TrecisionMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Expand Down
1 change: 1 addition & 0 deletions engines/trecision/trecision.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class TrecisionEngine : public Engine {
const ADGameDescription *_gameDescription;

Graphics::Surface _thumbnail;
bool _controlPanelSave = false;

uint16 _curRoom;
uint16 _oldRoom;
Expand Down

0 comments on commit 4995aa1

Please sign in to comment.