diff options
author | Paul Gilbert | 2011-06-04 20:39:38 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-06-04 20:40:09 +1000 |
commit | dc6e60f5164446cfa6cfcdcea864cb2074671012 (patch) | |
tree | 6ff6665184a067d810132ef978ebe7abd5a5d117 /engines/tsage/graphics.cpp | |
parent | ce32745d9c26a0b97dce6a137a46ff2004c7be02 (diff) | |
download | scummvm-rg350-dc6e60f5164446cfa6cfcdcea864cb2074671012.tar.gz scummvm-rg350-dc6e60f5164446cfa6cfcdcea864cb2074671012.tar.bz2 scummvm-rg350-dc6e60f5164446cfa6cfcdcea864cb2074671012.zip |
TSAGE: Add support for saving in scene #6100
Diffstat (limited to 'engines/tsage/graphics.cpp')
-rw-r--r-- | engines/tsage/graphics.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index e51d88eb3e..25dc897ecd 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -304,6 +304,43 @@ void GfxSurface::unlockSurface() { } } +void GfxSurface::synchronize(Serializer &s) { + assert(!_lockSurfaceCtr); + assert(!_screenSurface); + + s.syncAsByte(_disableUpdates); + _bounds.synchronize(s); + s.syncAsSint16LE(_centroid.x); + s.syncAsSint16LE(_centroid.y); + s.syncAsSint16LE(_transColor); + + if (s.isSaving()) { + // Save contents of the surface + if (_customSurface) { + s.syncAsSint16LE(_customSurface->w); + s.syncAsSint16LE(_customSurface->h); + s.syncBytes((byte *)_customSurface->pixels, _customSurface->w * _customSurface->h); + } else { + int zero = 0; + s.syncAsSint16LE(zero); + s.syncAsSint16LE(zero); + } + } else { + int w, h; + s.syncAsSint16LE(w); + s.syncAsSint16LE(h); + + if ((w == 0) || (h == 0)) { + if (_customSurface) + delete _customSurface; + _customSurface = NULL; + } else { + create(w, h); + s.syncBytes((byte *)_customSurface->pixels, w * h); + } + } +} + /** * Fills a specified rectangle on the surface with the specified color * |