aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tsage/core.cpp3
-rw-r--r--engines/tsage/graphics.cpp37
-rw-r--r--engines/tsage/graphics.h1
-rw-r--r--engines/tsage/ringworld_scenes1.cpp60
-rw-r--r--engines/tsage/ringworld_scenes1.h4
-rw-r--r--engines/tsage/saveload.h2
6 files changed, 90 insertions, 17 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index ae337765a2..5ed1ce316c 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2564,6 +2564,9 @@ void SceneText::synchronize(Serializer &s) {
s.syncAsSint16LE(_color2);
s.syncAsSint16LE(_color3);
SYNC_ENUM(_textMode, TextAlign);
+
+ if (s.getVersion() >= 5)
+ _textSurface.synchronize(s);
}
/*--------------------------------------------------------------------------*/
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
*
diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h
index 1427be6031..e09e1093a3 100644
--- a/engines/tsage/graphics.h
+++ b/engines/tsage/graphics.h
@@ -91,6 +91,7 @@ public:
void setScreenSurface();
Graphics::Surface lockSurface();
void unlockSurface();
+ void synchronize(Serializer &s);
void create(int width, int height);
void setBounds(const Rect &bounds) { _bounds = bounds; }
const Rect &getBounds() const { return _bounds; }
diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp
index 82f0153d8f..6960788db3 100644
--- a/engines/tsage/ringworld_scenes1.cpp
+++ b/engines/tsage/ringworld_scenes1.cpp
@@ -3102,6 +3102,18 @@ void Scene6100::Action7::signal() {
/*--------------------------------------------------------------------------*/
+void Scene6100::Object::synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
+
+ // Save the double fields of the FloatSet
+ s.syncBytes((byte *)&_floats._float1, sizeof(double));
+ s.syncBytes((byte *)&_floats._float2, sizeof(double));
+ s.syncBytes((byte *)&_floats._float3, sizeof(double));
+ s.syncBytes((byte *)&_floats._float4, sizeof(double));
+}
+
+/*--------------------------------------------------------------------------*/
+
void Scene6100::ProbeMover::dispatch() {
Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
@@ -3123,14 +3135,43 @@ void Scene6100::Item1::doAction(int action) {
/*--------------------------------------------------------------------------*/
+Scene6100::Scene6100(): Scene() {
+ _objList[0] = &_sunflower1;
+ _objList[1] = &_sunflower2;
+ _objList[2] = &_sunflower3;
+ _objList[3] = &_rocks;
+
+ _speed = 30;
+ _fadePercent = 100;
+ _rocksCheck = false;
+ _hitCount = 0;
+ _turnAmount = 0;
+ _angle = 0;
+ _msgActive = false;
+
+ _globals->_sceneHandler._delayTicks = 8;
+
+ _globals->_player.disableControl();
+ _globals->_events.setCursor(CURSOR_WALK);
+}
+
+void Scene6100::synchronize(Serializer &s) {
+ Scene::synchronize(s);
+
+ s.syncAsSint16LE(_speed);
+ s.syncAsSint16LE(_fadePercent);
+ s.syncAsByte(_rocksCheck);
+ s.syncAsByte(_msgActive);
+ s.syncAsSint16LE(_hitCount);
+ s.syncAsSint16LE(_turnAmount);
+ s.syncAsSint16LE(_angle);
+}
+
void Scene6100::postInit(SceneObjectList *OwnerList) {
loadScene(6100);
Scene::postInit();
setZoomPercents(62, 2, 200, 425);
- _globals->_sceneHandler._delayTicks = 8;
- _globals->_player.disableControl();
- _globals->_events.setCursor(CURSOR_WALK);
_stripManager.addSpeaker(&_speakerQR);
_stripManager.addSpeaker(&_speakerSL);
@@ -3178,11 +3219,6 @@ void Scene6100::postInit(SceneObjectList *OwnerList) {
_probe._floats._float3 = 0.0;
_probe.hide();
- _objList[0] = &_sunflower1;
- _objList[1] = &_sunflower2;
- _objList[2] = &_sunflower3;
- _objList[3] = &_rocks;
-
int baseVal = 2000;
for (int idx = 0; idx < 3; ++idx) {
_objList[idx]->_floats._float1 = _globals->_randomSource.getRandomNumber(999);
@@ -3201,14 +3237,6 @@ void Scene6100::postInit(SceneObjectList *OwnerList) {
_objList[idx]->changeZoom(-1);
}
- _speed = 30;
- _fadePercent = 100;
- _rocksCheck = false;
- _hitCount = 0;
- _turnAmount = 0;
- _angle = 0;
- _msgActive = false;
-
setAction(&_action5);
_globals->_scenePalette.addRotation(96, 143, -1);
diff --git a/engines/tsage/ringworld_scenes1.h b/engines/tsage/ringworld_scenes1.h
index 554b261f2c..abd765473c 100644
--- a/engines/tsage/ringworld_scenes1.h
+++ b/engines/tsage/ringworld_scenes1.h
@@ -483,6 +483,8 @@ class Scene6100 : public Scene {
class Object : public SceneObject {
public:
FloatSet _floats;
+
+ virtual void synchronize(Serializer &s);
};
class ProbeMover : public NpcMover {
public:
@@ -519,6 +521,8 @@ public:
Object *_objList[4];
bool _msgActive;
+ Scene6100();
+ virtual void synchronize(Serializer &s);
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void remove();
virtual void process(Event &event);
diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h
index a905df2f98..c1c2851f28 100644
--- a/engines/tsage/saveload.h
+++ b/engines/tsage/saveload.h
@@ -33,7 +33,7 @@ namespace tSage {
typedef void (*SaveNotifierFn)(bool postFlag);
-#define TSAGE_SAVEGAME_VERSION 4
+#define TSAGE_SAVEGAME_VERSION 5
class SavedObject;