SAGA2: Implement UIState save/loading
This commit is contained in:
parent
d2f96b708a
commit
7f359b450f
3 changed files with 34 additions and 3 deletions
|
@ -2577,6 +2577,10 @@ APPFUNC(cmdManaInd) {
|
||||||
struct UIStateArchive {
|
struct UIStateArchive {
|
||||||
bool indivControlsFlag;
|
bool indivControlsFlag;
|
||||||
uint16 indivBrother;
|
uint16 indivBrother;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kUIStateArchiveSize = 3
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isIndivMode(void) {
|
bool isIndivMode(void) {
|
||||||
|
@ -2602,6 +2606,19 @@ void saveUIState(SaveFileConstructor &saveGame) {
|
||||||
sizeof(archive));
|
sizeof(archive));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void saveUIState(Common::OutSaveFile *out) {
|
||||||
|
debugC(2, kDebugSaveload, "Saving UIState");
|
||||||
|
|
||||||
|
out->write("UIST", 4);
|
||||||
|
out->writeUint32LE(UIStateArchive::kUIStateArchiveSize);
|
||||||
|
|
||||||
|
out->writeByte(indivControlsFlag);
|
||||||
|
out->writeUint16LE(indivBrother);
|
||||||
|
|
||||||
|
debugC(3, kDebugSaveload, "... indivControlsFlag = %d", indivControlsFlag);
|
||||||
|
debugC(3, kDebugSaveload, "... indivBrother = %d", indivBrother);
|
||||||
|
}
|
||||||
|
|
||||||
void loadUIState(SaveFileReader &saveGame) {
|
void loadUIState(SaveFileReader &saveGame) {
|
||||||
UIStateArchive archive;
|
UIStateArchive archive;
|
||||||
|
|
||||||
|
@ -2613,6 +2630,18 @@ void loadUIState(SaveFileReader &saveGame) {
|
||||||
updateAllUserControls();
|
updateAllUserControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loadUIState(Common::InSaveFile *in) {
|
||||||
|
debugC(2, kDebugSaveload, "Saving UIState");
|
||||||
|
|
||||||
|
indivControlsFlag = in->readByte();
|
||||||
|
indivBrother = in->readUint16LE();
|
||||||
|
|
||||||
|
debugC(3, kDebugSaveload, "... indivControlsFlag = %d", indivControlsFlag);
|
||||||
|
debugC(3, kDebugSaveload, "... indivBrother = %d", indivBrother);
|
||||||
|
|
||||||
|
updateAllUserControls();
|
||||||
|
}
|
||||||
|
|
||||||
void cleanupUIState(void) {
|
void cleanupUIState(void) {
|
||||||
if (StatusLine != nullptr)
|
if (StatusLine != nullptr)
|
||||||
StatusLine->clear();
|
StatusLine->clear();
|
||||||
|
|
|
@ -90,7 +90,9 @@ void updateIndicators(void);
|
||||||
|
|
||||||
void initUIState(void);
|
void initUIState(void);
|
||||||
void saveUIState(SaveFileConstructor &saveGame);
|
void saveUIState(SaveFileConstructor &saveGame);
|
||||||
|
void saveUIState(Common::OutSaveFile *out);
|
||||||
void loadUIState(SaveFileReader &saveGame);
|
void loadUIState(SaveFileReader &saveGame);
|
||||||
|
void loadUIState(Common::InSaveFile *in);
|
||||||
void cleanupUIState(void);
|
void cleanupUIState(void);
|
||||||
|
|
||||||
// Varargs function to write to the status line.
|
// Varargs function to write to the status line.
|
||||||
|
|
|
@ -170,9 +170,9 @@ Common::Error saveGameState(int16 saveNo, char *saveName) {
|
||||||
saveTileModeState(out);
|
saveTileModeState(out);
|
||||||
saveSpellState(out);
|
saveSpellState(out);
|
||||||
saveAutoMap(out);
|
saveAutoMap(out);
|
||||||
|
saveUIState(out);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
saveUIState(saveGame);
|
|
||||||
savePaletteState(saveGame);
|
savePaletteState(saveGame);
|
||||||
saveContainerNodes(saveGame);
|
saveContainerNodes(saveGame);
|
||||||
#endif
|
#endif
|
||||||
|
@ -403,15 +403,15 @@ void loadSavedGameState(int16 saveNo) {
|
||||||
} else
|
} else
|
||||||
error("Auto map loaded prematurely");
|
error("Auto map loaded prematurely");
|
||||||
break;
|
break;
|
||||||
#if 0
|
|
||||||
|
|
||||||
case MKTAG('U', 'I', 'S', 'T'):
|
case MKTAG('U', 'I', 'S', 'T'):
|
||||||
if (loadFlags & loadPlayerActorsFlag) {
|
if (loadFlags & loadPlayerActorsFlag) {
|
||||||
loadUIState(saveGame);
|
loadUIState(in);
|
||||||
loadFlags |= loadUIStateFlag;
|
loadFlags |= loadUIStateFlag;
|
||||||
} else
|
} else
|
||||||
error("UI state loaded prematurely");
|
error("UI state loaded prematurely");
|
||||||
break;
|
break;
|
||||||
|
#if 0
|
||||||
|
|
||||||
case MKTAG('P', 'A', 'L', 'E'):
|
case MKTAG('P', 'A', 'L', 'E'):
|
||||||
loadPaletteState(saveGame);
|
loadPaletteState(saveGame);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue