diff options
author | Nipun Garg | 2019-07-06 20:29:47 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:14 +0200 |
commit | c819a79c9b265893196e9c06dac6155235275e7e (patch) | |
tree | 697823568c8d66e9d8eda95e9380bb49aee6df00 /engines | |
parent | 6559b7181900e8b174d92ff9b32759495c566bfb (diff) | |
download | scummvm-rg350-c819a79c9b265893196e9c06dac6155235275e7e.tar.gz scummvm-rg350-c819a79c9b265893196e9c06dac6155235275e7e.tar.bz2 scummvm-rg350-c819a79c9b265893196e9c06dac6155235275e7e.zip |
HDB: Add Window save() and loadSaveFile()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/window.cpp | 70 | ||||
-rw-r--r-- | engines/hdb/window.h | 2 |
2 files changed, 72 insertions, 0 deletions
diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp index 7637ffca24..b1154263a5 100644 --- a/engines/hdb/window.cpp +++ b/engines/hdb/window.cpp @@ -89,6 +89,76 @@ bool Window::init() { return true; } +void Window::save(Common::OutSaveFile *out) { + + int i; + + // Save out the various window and game state info + + // clear out gfx ptrs in _pzInfo struct before writing... + memcpy(&_tempPzInfo, &_pzInfo, sizeof(_pzInfo)); + for (i = 0; i < 10; i++) { + _tempPzInfo.gfxNumber[i] = NULL; + if (i < 2) + _tempPzInfo.gfxFace[i] = NULL; + } + _tempPzInfo.gfxPanic = _tempPzInfo.gfxZone = NULL; + + out->write(&_tempPzInfo, sizeof(_pzInfo)); + out->write(&_dialogInfo, sizeof(_dialogInfo)); + out->writeSint32LE(_dialogDelay); + out->write(&_dialogChoiceInfo, sizeof(_dialogChoiceInfo)); + out->write(&_msgInfo, sizeof(_msgInfo)); + out->write(&_msgQueueStr, sizeof(char) * 128 * kMaxMsgQueue); + out->write(&_msgQueueWait, sizeof(int) * kMaxMsgQueue); + out->writeSint32LE(_numMsgQueue); + out->write(&_invWinInfo, sizeof(_invWinInfo)); + out->write(&_dlvsInfo, sizeof(_dlvsInfo)); + debug(9, "STUB: Save Try Again data"); + + out->writeUint32LE(_textOutList.size()); + for (i = 0; (uint)i < _textOutList.size(); i++) { + out->write(_textOutList[i], sizeof(TOut)); + } + + out->write(&_infobarDimmed, sizeof(_infobarDimmed)); + +} + +void Window::loadSaveFile(Common::InSaveFile *in) { + + int i; + + // Clear out everything + restartSystem(); + + // Load out various Window and Game State Info + in->read(&_pzInfo, sizeof(_pzInfo)); + in->read(&_dialogInfo, sizeof(_dialogInfo)); + _dialogDelay = in->readSint32LE(); + if (_dialogDelay) + _dialogDelay = g_system->getMillis() + 1000; + + in->read(&_dialogChoiceInfo, sizeof(_dialogChoiceInfo)); + _dialogChoiceInfo.timeout = g_system->getMillis() + 1000; + + in->read(&_msgInfo, sizeof(_msgInfo)); + in->read(&_msgQueueStr, sizeof(char) * 128 * kMaxMsgQueue); + in->read(&_msgQueueWait, sizeof(int) * kMaxMsgQueue); + _numMsgQueue = in->readSint32LE(); + in->read(&_invWinInfo, sizeof(_invWinInfo)); + in->read(&_dlvsInfo, sizeof(_dlvsInfo)); + debug(9, "STUB: Load Try Again data"); + + _textOutList.resize(in->readUint32LE()); + for (i = 0; (uint)i < _textOutList.size(); i++) { + in->read(_textOutList[i], sizeof(TOut)); + _textOutList[i]->timer = g_system->getMillis() + 1000; + } + + in->read(&_infobarDimmed, sizeof(_infobarDimmed)); +} + void Window::restartSystem() { _numMsgQueue = 0; _msgInfo.active = false; diff --git a/engines/hdb/window.h b/engines/hdb/window.h index 1615dea271..be7bbfc99c 100644 --- a/engines/hdb/window.h +++ b/engines/hdb/window.h @@ -178,6 +178,8 @@ class Window { public: bool init(); + void save(Common::OutSaveFile *out); + void loadSaveFile(Common::InSaveFile *in); void restartSystem(); void setInfobarDark(int value); |