PseudoComposition

In order to familiarize myself with file interfaces and general saving/loading practices in ScummVM, I have been working on implementing standard saving/loading for the Composer engine, beginning by generating a list of what needs to be saved, and some pseudocode for how to reinitialize the objects from the stored data.

My notes on this follow:

save:
ComposerEngine:

save to savefile:

  • RandomSource* _rnd,
  • uint32 _currentTime,
  • uint32 _lastTime,
  • bool _needsUpdate,
  • List<Sprite> _sprites,
  • String _bookGroup,
  • List<Library> _Libraries,
  • Array<PendingPageChange> _pendingPageChanges,
  • Array<uint16> _stack,
  • Array<uint16> _vars,
  • List<Oldscript *> _oldScripts,
  • Array<QueuedScript> _queuedScripts,
  • bool _mouseEnabled,
  • bool _mouseVisible,
  • uint16 _mouseSpriteId

RandomSource: uint32 getSeed()
List<T>: uint32 size(), T *ConstIterator begin() .. end()
Sprite: uint16 _id
Library: uint16 _id
Array<T>: uint32 size(), T *ConstIterator begin() .. end()
PendingPageChange: uint16 _pageId, bool _remove
OldScript: uint16 _id, uint32 _currDelay
QueuedScript: uint32 _baseTime, uint32 _duration, uint32 _count, uint16 _scriptId

load:
ComposerEngine:
filename = (find book.ini), _bookIni.loadFromFile(filename)

load from savefile:

  • RandomSource* _rnd,
  • uint32 _currentTime,
  • uint32 _lastTime,
  • bool _needsUpdate,
  • List<Sprite> _sprites,
  • String _bookGroup,
  • List<Library> _Libraries,
  • Array<PendingPageChange> _pendingPageChanges,
  • Array<uint16> _stack,
  • Array<uint16> _vars,
  • List<Oldscript *> _oldScripts,
  • Array<QueuedScript> _queuedScripts,
  • bool _mouseEnabled,
  • bool _mouseVisible,
  • uint16 _mouseSpriteId

RandomSource: setSeed(uint32)
List<T>: uint32 num, for (i = 0 .. num) (T, push_back(T))
Sprite: uint16 _id, initSprite(Sprite)
Library: uint16 _id, LoadLibrary(_id)
Array<T>: uint32 num, for (i = 0 .. num) (T, push_back(T))
PendingPageChange: uint16 _pageId, bool _remove, if (!_remove) LoadLibrary(_pageId)
OldScript: uint16 id, uint32 _currDelay, OldScript(id,getResource(ID_SCRP, id))
QueuedScript: uint32 _baseTime, uint32 _duration, uint32 _count, uint16 _scriptId