mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
TRECISION: Fix restoring games from the ScummVM menu - bug #12902
This commit is contained in:
parent
0b6b48b23d
commit
afdc5d70f7
@ -259,7 +259,8 @@ bool TrecisionEngine::dataLoad() {
|
||||
eventLoop();
|
||||
_mouseLeftBtn = _mouseRightBtn = false;
|
||||
|
||||
performLoad(saveSlot - 1, skipLoad);
|
||||
if (!skipLoad)
|
||||
loadGameState(saveSlot);
|
||||
|
||||
return !skipLoad;
|
||||
}
|
||||
@ -292,8 +293,8 @@ bool TrecisionEngine::dataLoad() {
|
||||
loadSaveSlots(saveNames);
|
||||
|
||||
bool skipLoad = false;
|
||||
int8 CurPos = -1;
|
||||
int8 OldPos = -1;
|
||||
int8 curPos = -1;
|
||||
int8 oldPos = -1;
|
||||
|
||||
for (;;) {
|
||||
checkSystem();
|
||||
@ -303,14 +304,14 @@ bool TrecisionEngine::dataLoad() {
|
||||
_mousePos.y < (FIRSTLINE + ICONDY) &&
|
||||
_mousePos.x >= ICONMARGSX &&
|
||||
(_mousePos.x < (MAXX - ICONMARGDX))) {
|
||||
OldPos = CurPos;
|
||||
CurPos = (_mousePos.x - ICONMARGSX) / ICONDX;
|
||||
oldPos = curPos;
|
||||
curPos = (_mousePos.x - ICONMARGSX) / ICONDX;
|
||||
|
||||
if (OldPos != CurPos) {
|
||||
if (oldPos != curPos) {
|
||||
_graphicsMgr->clearScreenBufferSaveSlotDescriptions();
|
||||
|
||||
uint16 posX = ICONMARGSX + ((CurPos) * (ICONDX)) + ICONDX / 2;
|
||||
uint16 lenText = textLength(saveNames[CurPos]);
|
||||
uint16 posX = ICONMARGSX + ((curPos) * (ICONDX)) + ICONDX / 2;
|
||||
uint16 lenText = textLength(saveNames[curPos]);
|
||||
if (posX - (lenText / 2) < 2)
|
||||
posX = 2;
|
||||
else
|
||||
@ -322,24 +323,24 @@ bool TrecisionEngine::dataLoad() {
|
||||
Common::Rect(posX, FIRSTLINE + ICONDY + 10, lenText + posX, CARHEI + (FIRSTLINE + ICONDY + 10)),
|
||||
Common::Rect(0, 0, lenText, CARHEI),
|
||||
MOUSECOL,
|
||||
saveNames[CurPos].c_str());
|
||||
saveNames[curPos].c_str());
|
||||
drawText.draw(this);
|
||||
|
||||
_graphicsMgr->copyToScreen(0, FIRSTLINE + ICONDY + 10, MAXX, CARHEI);
|
||||
}
|
||||
|
||||
if (_mouseLeftBtn && (_inventory[CurPos] != EMPTYSLOT)) {
|
||||
if (_mouseLeftBtn && (_inventory[curPos] != EMPTYSLOT)) {
|
||||
_mouseLeftBtn = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (OldPos != -1) {
|
||||
if (oldPos != -1) {
|
||||
_graphicsMgr->clearScreenBufferSaveSlotDescriptions();
|
||||
_graphicsMgr->copyToScreen(0, FIRSTLINE + ICONDY + 10, MAXX, CARHEI);
|
||||
}
|
||||
|
||||
OldPos = -1;
|
||||
CurPos = -1;
|
||||
oldPos = -1;
|
||||
curPos = -1;
|
||||
|
||||
if (_mouseLeftBtn || _mouseRightBtn) {
|
||||
_mouseLeftBtn = _mouseRightBtn = false;
|
||||
@ -350,9 +351,23 @@ bool TrecisionEngine::dataLoad() {
|
||||
}
|
||||
}
|
||||
|
||||
performLoad(CurPos, skipLoad);
|
||||
if (!skipLoad) {
|
||||
loadGameState(curPos + 1);
|
||||
} else {
|
||||
_actor->actorStop();
|
||||
_pathFind->nextStep();
|
||||
checkSystem();
|
||||
|
||||
_graphicsMgr->clearScreenBufferInventory();
|
||||
_graphicsMgr->copyToScreen(0, FIRSTLINE, MAXX, TOP);
|
||||
|
||||
_graphicsMgr->clearScreenBufferTop();
|
||||
_graphicsMgr->copyToScreen(0, 0, MAXX, TOP);
|
||||
|
||||
if (_flagScriptActive) {
|
||||
_graphicsMgr->hideCursor();
|
||||
}
|
||||
|
||||
if (skipLoad) {
|
||||
// Restore the inventory
|
||||
_inventory = savedInventory;
|
||||
_curInventory = 0;
|
||||
@ -367,6 +382,30 @@ Common::Error TrecisionEngine::loadGameStream(Common::SeekableReadStream *stream
|
||||
Common::Serializer ser(stream, nullptr);
|
||||
ser.setVersion(version);
|
||||
syncGameStream(ser);
|
||||
|
||||
_graphicsMgr->clearScreenBufferInventory();
|
||||
|
||||
_flagNoPaintScreen = true;
|
||||
_curStack = 0;
|
||||
_flagScriptActive = false;
|
||||
|
||||
_oldRoom = _curRoom;
|
||||
changeRoom(_curRoom);
|
||||
|
||||
_actor->actorStop();
|
||||
_pathFind->nextStep();
|
||||
checkSystem();
|
||||
|
||||
_graphicsMgr->clearScreenBufferInventory();
|
||||
_graphicsMgr->copyToScreen(0, FIRSTLINE, MAXX, TOP);
|
||||
|
||||
_graphicsMgr->clearScreenBufferTop();
|
||||
_graphicsMgr->copyToScreen(0, 0, MAXX, TOP);
|
||||
|
||||
if (_flagScriptActive) {
|
||||
_graphicsMgr->hideCursor();
|
||||
}
|
||||
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
@ -425,33 +464,4 @@ bool TrecisionEngine::syncGameStream(Common::Serializer &ser) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TrecisionEngine::performLoad(int slot, bool skipLoad) {
|
||||
if (!skipLoad) {
|
||||
_graphicsMgr->clearScreenBufferInventory();
|
||||
|
||||
loadGameState(slot + 1);
|
||||
|
||||
_flagNoPaintScreen = true;
|
||||
_curStack = 0;
|
||||
_flagScriptActive = false;
|
||||
|
||||
_oldRoom = _curRoom;
|
||||
changeRoom(_curRoom);
|
||||
}
|
||||
|
||||
_actor->actorStop();
|
||||
_pathFind->nextStep();
|
||||
checkSystem();
|
||||
|
||||
_graphicsMgr->clearScreenBufferInventory();
|
||||
_graphicsMgr->copyToScreen(0, FIRSTLINE, MAXX, TOP);
|
||||
|
||||
_graphicsMgr->clearScreenBufferTop();
|
||||
_graphicsMgr->copyToScreen(0, 0, MAXX, TOP);
|
||||
|
||||
if (_flagScriptActive) {
|
||||
_graphicsMgr->hideCursor();
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
||||
|
@ -293,8 +293,8 @@ void TrecisionEngine::initMain() {
|
||||
// Check if a saved game is to be loaded from the launcher
|
||||
if (ConfMan.hasKey("save_slot"))
|
||||
loadGameState(ConfMan.getInt("save_slot"));
|
||||
|
||||
changeRoom(_curRoom);
|
||||
else
|
||||
changeRoom(_curRoom);
|
||||
}
|
||||
|
||||
void TrecisionEngine::checkSystem() {
|
||||
|
@ -141,7 +141,6 @@ class TrecisionEngine : public Engine {
|
||||
static bool isBetween(int a, int x, int b);
|
||||
|
||||
// Others
|
||||
void performLoad(int slot, bool skipLoad);
|
||||
bool canPlayerInteract();
|
||||
|
||||
// Objects
|
||||
|
Loading…
Reference in New Issue
Block a user