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 {
|
||||
bool indivControlsFlag;
|
||||
uint16 indivBrother;
|
||||
|
||||
enum {
|
||||
kUIStateArchiveSize = 3
|
||||
};
|
||||
};
|
||||
|
||||
bool isIndivMode(void) {
|
||||
|
@ -2602,6 +2606,19 @@ void saveUIState(SaveFileConstructor &saveGame) {
|
|||
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) {
|
||||
UIStateArchive archive;
|
||||
|
||||
|
@ -2613,6 +2630,18 @@ void loadUIState(SaveFileReader &saveGame) {
|
|||
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) {
|
||||
if (StatusLine != nullptr)
|
||||
StatusLine->clear();
|
||||
|
|
|
@ -90,7 +90,9 @@ void updateIndicators(void);
|
|||
|
||||
void initUIState(void);
|
||||
void saveUIState(SaveFileConstructor &saveGame);
|
||||
void saveUIState(Common::OutSaveFile *out);
|
||||
void loadUIState(SaveFileReader &saveGame);
|
||||
void loadUIState(Common::InSaveFile *in);
|
||||
void cleanupUIState(void);
|
||||
|
||||
// Varargs function to write to the status line.
|
||||
|
|
|
@ -170,9 +170,9 @@ Common::Error saveGameState(int16 saveNo, char *saveName) {
|
|||
saveTileModeState(out);
|
||||
saveSpellState(out);
|
||||
saveAutoMap(out);
|
||||
saveUIState(out);
|
||||
|
||||
#if 0
|
||||
saveUIState(saveGame);
|
||||
savePaletteState(saveGame);
|
||||
saveContainerNodes(saveGame);
|
||||
#endif
|
||||
|
@ -403,15 +403,15 @@ void loadSavedGameState(int16 saveNo) {
|
|||
} else
|
||||
error("Auto map loaded prematurely");
|
||||
break;
|
||||
#if 0
|
||||
|
||||
case MKTAG('U', 'I', 'S', 'T'):
|
||||
if (loadFlags & loadPlayerActorsFlag) {
|
||||
loadUIState(saveGame);
|
||||
loadUIState(in);
|
||||
loadFlags |= loadUIStateFlag;
|
||||
} else
|
||||
error("UI state loaded prematurely");
|
||||
break;
|
||||
#if 0
|
||||
|
||||
case MKTAG('P', 'A', 'L', 'E'):
|
||||
loadPaletteState(saveGame);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue