[Scummvm-git-logs] scummvm master -> 9b8635ff80b2c41b2ecef0fdbaf7f3344e3b2654
sev-
sev at scummvm.org
Mon Jul 12 15:11:56 UTC 2021
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
eb7c7273db SAGA2: Remove old save/load methods
1d169ee4bf SAGA2: Remove savefile.*
24fa43f2ce SAGA2: Move SaveFileHeader to more appropriate place
9b8635ff80 SAGA2: Rename loadsave.* to saveload.*
Commit: eb7c7273dbc61365a648b34b6781280fd01567a8
https://github.com/scummvm/scummvm/commit/eb7c7273dbc61365a648b34b6781280fd01567a8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T17:11:37+02:00
Commit Message:
SAGA2: Remove old save/load methods
Changed paths:
engines/saga2/actor.cpp
engines/saga2/actor.h
engines/saga2/assign.cpp
engines/saga2/assign.h
engines/saga2/band.cpp
engines/saga2/band.h
engines/saga2/calender.cpp
engines/saga2/calender.h
engines/saga2/contain.cpp
engines/saga2/contain.h
engines/saga2/fta.h
engines/saga2/interp.cpp
engines/saga2/intrface.cpp
engines/saga2/intrface.h
engines/saga2/loadsave.cpp
engines/saga2/magic.h
engines/saga2/main.cpp
engines/saga2/mission.cpp
engines/saga2/mission.h
engines/saga2/motion.cpp
engines/saga2/motion.h
engines/saga2/objects.cpp
engines/saga2/objects.h
engines/saga2/palette.h
engines/saga2/player.cpp
engines/saga2/player.h
engines/saga2/script.h
engines/saga2/sensor.cpp
engines/saga2/sensor.h
engines/saga2/speech.cpp
engines/saga2/speech.h
engines/saga2/spellio.cpp
engines/saga2/spelshow.h
engines/saga2/target.cpp
engines/saga2/target.h
engines/saga2/task.cpp
engines/saga2/task.h
engines/saga2/tile.cpp
engines/saga2/tile.h
engines/saga2/tilemode.cpp
engines/saga2/tilemode.h
engines/saga2/timers.cpp
engines/saga2/timers.h
engines/saga2/vpal.cpp
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 7a47e694df..2813081954 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -1192,83 +1192,6 @@ Actor::Actor(const ResourceActor &res) : GameObject(res) {
evalActorEnchantments(this);
}
-//-----------------------------------------------------------------------
-// Reconstruct from archive buffer
-
-Actor::Actor(void **buf) : GameObject(buf) {
- void *bufferPtr = *buf;
- int i;
-
- // Fixup the prototype pointer to point to an actor prototype
- prototype = prototype != NULL
- ? (ProtoObj *)&actorProtos[prototype - objectProtos]
- : NULL;
-
- ActorArchive *a = (ActorArchive *)bufferPtr;
-
- // Read individual fields from buffer
- faction = a->faction;
- colorScheme = a->colorScheme;
- appearanceID = a->appearanceID;
- attitude = a->attitude;
- mood = a->mood;
- disposition = a->disposition;
- currentFacing = a->currentFacing;
- tetherLocU = a->tetherLocU;
- tetherLocV = a->tetherLocV;
- tetherDist = a->tetherDist;
- leftHandObject = a->leftHandObject;
- rightHandObject = a->rightHandObject;
- memcpy(&knowledge, &a->knowledge, sizeof(knowledge));
- schedule = a->schedule;
- *((uint32 *)conversationMemory) = *((uint32 *)a->conversationMemory);
- currentAnimation = a->currentAnimation;
- currentPose = a->currentPose;
- animationFlags = a->animationFlags;
- flags = a->flags;
- memcpy(&poseInfo, &a->poseInfo, sizeof(poseInfo));
- cycleCount = a->cycleCount;
- kludgeCount = a->kludgeCount;
- enchantmentFlags = a->enchantmentFlags;
- currentGoal = a->currentGoal;
- deactivationCounter = a->deactivationCounter;
- memcpy(&effectiveStats, &a->effectiveStats, sizeof(effectiveStats));
- actionCounter = a->actionCounter;
- effectiveResistance = a->effectiveResistance;
- effectiveImmunity = a->effectiveImmunity;
- recPointsPerUpdate = a->recPointsPerUpdate;
- currentRecoveryPoints = a->currentRecoveryPoints;
- leader = a->leaderID != Nothing
- ? (Actor *)GameObject::objectAddress(a->leaderID)
- : NULL;
- followers = a->followersID != NoBand
- ? getBandAddress(a->followersID)
- : NULL;
- _followersID = NoBand;
- for (i = 0; i < ARMOR_COUNT; i++)
- armorObjects[i] = a->armorObjects[i];
- currentTarget = a->currentTargetID != Nothing
- ? GameObject::objectAddress(a->currentTargetID)
- : NULL;
- for (i = 0; i < actorScriptVars; i++)
- scriptVar[i] = a->scriptVar[i];
-
- bufferPtr = &a[1];
-
- if (flags & hasAssignment) {
- bufferPtr = constructAssignment(this, bufferPtr);
- } else {
- _assignment = nullptr;
- }
-
- appearance = NULL;
- moveTask = NULL;
- curTask = NULL;
-
- // Return address of memory after actor archive
- *buf = bufferPtr;
-}
-
Actor::Actor(Common::InSaveFile *in) : GameObject(in) {
debugC(3, kDebugSaveload, "Loading actor %d", thisID());
@@ -1412,81 +1335,13 @@ int32 Actor::archiveSize(void) {
return size;
}
-//-----------------------------------------------------------------------
-// Archive this actor in a buffer
-
-void *Actor::archive(void *buf) {
- int i;
- ProtoObj *holdProto = prototype;
-
- // Modify the protoype temporarily so the GameObject::archive()
- // will store the index correctly
- if (prototype != NULL)
- prototype = &objectProtos[(ActorProto *)prototype - actorProtos];
-
- // Let the base class archive its data
- buf = GameObject::archive(buf);
-
- // Restore the prototype pointer
- prototype = holdProto;
-
- ActorArchive *a = (ActorArchive *)buf;
-
- // Store individual fields in buffer
- a->faction = faction;
- a->colorScheme = colorScheme;
- a->appearanceID = appearanceID;
- a->attitude = attitude;
- a->mood = mood;
- a->disposition = disposition;
- a->currentFacing = currentFacing;
- a->tetherLocU = tetherLocU;
- a->tetherLocV = tetherLocV;
- a->tetherDist = tetherDist;
- a->leftHandObject = leftHandObject;
- a->rightHandObject = rightHandObject;
- memcpy(&a->knowledge, &knowledge, sizeof(a->knowledge));
- a->schedule = schedule;
- *((uint32 *)a->conversationMemory) = *((uint32 *)conversationMemory);
- a->currentAnimation = currentAnimation;
- a->currentPose = currentPose;
- a->animationFlags = animationFlags;
- a->flags = flags;
- memcpy(&a->poseInfo, &poseInfo, sizeof(a->poseInfo));
- a->cycleCount = cycleCount;
- a->kludgeCount = kludgeCount;
- a->enchantmentFlags = enchantmentFlags;
- a->currentGoal = currentGoal;
- a->deactivationCounter = deactivationCounter;
- memcpy(&a->effectiveStats, &effectiveStats, sizeof(a->effectiveStats));
- a->actionCounter = actionCounter;
- a->effectiveResistance = effectiveResistance;
- a->effectiveImmunity = effectiveImmunity;
- a->recPointsPerUpdate = recPointsPerUpdate;
- a->currentRecoveryPoints = currentRecoveryPoints;
- a->leaderID = leader != NULL ? leader->thisID() : Nothing;
- a->followersID = followers != NULL ? getBandID(followers) : NoBand;
- for (i = 0; i < ARRAYSIZE(a->armorObjects); i++)
- a->armorObjects[i] = armorObjects[i];
- a->currentTargetID = currentTarget != NULL ? currentTarget->thisID() : Nothing;
- for (i = 0; i < actorScriptVars; i++)
- a->scriptVar[i] = scriptVar[i];
-
- buf = &a[1];
-
- if (flags & hasAssignment)
- buf = archiveAssignment(this, buf);
-
- return buf;
-}
-
void Actor::write(Common::OutSaveFile *out) {
ProtoObj *holdProto = prototype;
debugC(3, kDebugSaveload, "Saving actor %d", thisID());
warning("STUB: Actor::write: Pointer arithmetic");
- // Modify the protoype temporarily so the GameObject::archive()
+ // Modify the protoype temporarily so the GameObject::write()
// will store the index correctly
if (prototype != NULL)
prototype = &objectProtos[(ActorProto *)prototype - actorProtos];
@@ -3688,45 +3543,6 @@ void initActors(void) {
actorList[2].disposition = dispositionPlayer + 2;
}
-//-------------------------------------------------------------------
-// Save actor list to a save file
-
-void saveActors(SaveFileConstructor &saveGame) {
- int16 i;
- int32 archiveBufSize = 0;
- void *archiveBuffer;
- int16 *bufferPtr;
-
- // Accumulate size of archive buffer
-
- // Add size of actor count
- archiveBufSize += sizeof(int16);
-
- for (i = 0; i < kActorCount; i++)
- archiveBufSize += actorList[i].archiveSize();
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate actor archive buffer");
-
- bufferPtr = (int16 *)archiveBuffer;
-
- // Store the number of actors in the archive buffer
- *bufferPtr++ = kActorCount;
-
- // Store the actor data in the archive buffer
- for (i = 0; i < kActorCount; i++)
- bufferPtr = (int16 *)actorList[i].archive(bufferPtr);
-
- // Write the archive buffer to the save file
- saveGame.writeChunk(
- MakeID('A', 'C', 'T', 'R'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveActors(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving actors");
@@ -3750,40 +3566,6 @@ void saveActors(Common::OutSaveFile *out) {
actorList[i].write(out);
}
-//-------------------------------------------------------------------
-// Load the actor list from a save file
-
-void loadActors(SaveFileReader &saveGame) {
- int16 i;
- int32 archiveBufSize;
- void *archiveBuffer;
- void *bufferPtr;
-
- // Read in the actor count
- //saveGame.read(&actorCount, sizeof(kActorCount));
-
- // Allocate the actor array
- actorListSize = kActorCount * sizeof(Actor);
- actorList = new Actor[kActorCount]();
- if (actorList == NULL)
- error("Unable to load Actors");
-
- // Allocate memory for the archive buffer
- archiveBufSize = saveGame.bytesLeftInChunk();
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to load Actors");
-
- saveGame.read(archiveBuffer, archiveBufSize);
-
- for (i = 0, bufferPtr = archiveBuffer; i < kActorCount; i++)
- // Initilize actors with archive data
- new (&actorList[i]) Actor(&bufferPtr);
-
- // Deallocate the archive buffer
- free(archiveBuffer);
-}
-
void loadActors(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading actors");
@@ -3873,16 +3655,6 @@ void initFactionTallies(void) {
memset(&factionTable, 0, sizeof(factionTable));
}
-//-------------------------------------------------------------------
-// Save the faction tallies to a save file
-
-void saveFactionTallies(SaveFileConstructor &saveGame) {
- saveGame.writeChunk(
- MakeID('F', 'A', 'C', 'T'),
- &factionTable,
- sizeof(factionTable));
-}
-
void saveFactionTallies(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Faction Tallies");
@@ -3895,13 +3667,6 @@ void saveFactionTallies(Common::OutSaveFile *out) {
}
}
-//-------------------------------------------------------------------
-// Load the faction tallies from a save file
-
-void loadFactionTallies(SaveFileReader &saveGame) {
- saveGame.read(&factionTable, sizeof(factionTable));
-}
-
void loadFactionTallies(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading Faction Tallies");
diff --git a/engines/saga2/actor.h b/engines/saga2/actor.h
index 13d66908bf..6ef6f3bf52 100644
--- a/engines/saga2/actor.h
+++ b/engines/saga2/actor.h
@@ -728,9 +728,6 @@ public:
// Constructor - initial actor construction
Actor(const ResourceActor &res);
- // Reconstruct from archive buffer
- Actor(void **buf);
-
Actor(Common::InSaveFile *in);
// Destructor
@@ -739,9 +736,6 @@ public:
// Return the number of bytes needed to archive this actor
int32 archiveSize(void);
- // Archive this actor in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
static Actor *newActor(
@@ -1125,11 +1119,9 @@ int16 AddFactionTally(int faction, enum factionTallyTypes act, int amt);
void initFactionTallies(void);
// Save the faction tallies to a save file
-void saveFactionTallies(SaveFileConstructor &saveGame);
void saveFactionTallies(Common::OutSaveFile *out);
// Load the faction tallies from a save file
-void loadFactionTallies(SaveFileReader &saveGame);
void loadFactionTallies(Common::InSaveFile *in);
// Cleanup the faction tally table
diff --git a/engines/saga2/assign.cpp b/engines/saga2/assign.cpp
index 323dfff940..14e080a243 100644
--- a/engines/saga2/assign.cpp
+++ b/engines/saga2/assign.cpp
@@ -50,22 +50,6 @@ ActorAssignment::ActorAssignment(Actor *a, uint16 until) :
a->flags |= hasAssignment;
}
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-ActorAssignment::ActorAssignment(Actor *ac, void **buf) {
- uint16 *a = (uint16 *)*buf;
-
- startFrame = *a++;
- endFrame = *a++;
-
- *buf = a;
-
- _actor = ac;
- ac->_assignment = this;
- ac->flags |= hasAssignment;
-}
-
ActorAssignment::ActorAssignment(Actor *ac, Common::SeekableReadStream *stream) {
startFrame = stream->readUint16LE();
endFrame = stream->readUint16LE();
@@ -103,18 +87,6 @@ inline int32 ActorAssignment::archiveSize(void) const {
return sizeof(startFrame) + sizeof(endFrame);
}
-//----------------------------------------------------------------------
-// Save the data in this object to a buffer
-
-void *ActorAssignment::archive(void *buf) const {
- uint16 *a = (uint16 *)buf;
-
- *a++ = startFrame;
- *a++ = endFrame;
-
- return a;
-}
-
void ActorAssignment::write(Common::OutSaveFile *out) const {
out->writeUint16LE(startFrame);
out->writeUint16LE(endFrame);
@@ -206,30 +178,6 @@ PatrolRouteAssignment::PatrolRouteAssignment(
flags(0) {
}
-//----------------------------------------------------------------------
-// Restore the data for this object from a buffer
-
-PatrolRouteAssignment::PatrolRouteAssignment(Actor *a, void **buf) :
- ActorAssignment(a, buf) {
- void *bufferPtr = *buf;
-
- // Restore route number
- routeNo = *((int16 *)bufferPtr);
- // Restore the starting way point
- startingWayPoint = *((int16 *)bufferPtr + 1);
- // Restore the ending way point
- endingWayPoint = *((int16 *)bufferPtr + 2);
- bufferPtr = (int16 *)bufferPtr + 3;
-
- // Restore the route flags
- routeFlags = *((uint8 *)bufferPtr);
- // Restore the assignment flags
- flags = *((uint8 *)bufferPtr + 1);
- bufferPtr = (uint8 *)bufferPtr + 2;
-
- *buf = bufferPtr;
-}
-
PatrolRouteAssignment::PatrolRouteAssignment(Actor *a, Common::SeekableReadStream *stream) :
ActorAssignment(a, stream) {
debugC(4, kDebugSaveload, "... Loading PatrolRouteAssignment");
@@ -260,30 +208,6 @@ inline int32 PatrolRouteAssignment::archiveSize(void) const {
+ sizeof(flags);
}
-//----------------------------------------------------------------------
-// Save the data in this object to a buffer
-
-void *PatrolRouteAssignment::archive(void *buf) const {
- // Let the base class write its data to the buffer
- buf = ActorAssignment::archive(buf);
-
- // Store the route number
- *((int16 *)buf) = routeNo;
- // Store the starting way point
- *((int16 *)buf + 1) = startingWayPoint;
- // Store the ending way point
- *((int16 *)buf + 2) = endingWayPoint;
- buf = (int16 *)buf + 3;
-
- // Store the route flags
- *((uint8 *)buf) = routeFlags;
- // Store the assignment flags
- *((uint8 *)buf + 1) = flags;
- buf = (uint8 *)buf + 2;
-
- return buf;
-}
-
void PatrolRouteAssignment::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving PatrolRouteAssignment");
@@ -404,22 +328,6 @@ void HuntToBeNearLocationAssignment::initialize(
range = r;
}
-//----------------------------------------------------------------------
-// Constructor -- constructs from archive buffer
-
-HuntToBeNearLocationAssignment::HuntToBeNearLocationAssignment(Actor *a, void **buf) :
- ActorAssignment(a, buf) {
- void *bufferPtr = *buf;
-
- // Restore the target
- bufferPtr = constructTarget(targetMem, bufferPtr);
-
- // Restore the range
- range = *((uint16 *)bufferPtr);
-
- *buf = (uint16 *)bufferPtr + 1;
-}
-
HuntToBeNearLocationAssignment::HuntToBeNearLocationAssignment(Actor *a, Common::SeekableReadStream *stream) :
ActorAssignment(a, stream) {
debugC(4, kDebugSaveload, "... Loading HuntToBeNearLocationAssignment");
@@ -441,23 +349,6 @@ inline int32 HuntToBeNearLocationAssignment::archiveSize(void) const {
+ sizeof(range);
}
-//----------------------------------------------------------------------
-// Write the data from this assignment object to a buffer in order
-// to save it on disk
-
-void *HuntToBeNearLocationAssignment::archive(void *buf) const {
- // Let the base class archive its data
- buf = ActorAssignment::archive(buf);
-
- // Store the target
- buf = archiveTarget(getTarget(), buf);
-
- // Store the range
- *((uint16 *)buf) = range;
-
- return (uint16 *)buf + 1;
-}
-
void HuntToBeNearLocationAssignment::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving HuntToBeNearLocationAssignment");
@@ -537,27 +428,6 @@ void HuntToBeNearActorAssignment::initialize(
flags = trackFlag ? track : 0;
}
-//----------------------------------------------------------------------
-// Constructor -- constructs from archive buffer
-
-HuntToBeNearActorAssignment::HuntToBeNearActorAssignment(Actor *a, void **buf) :
- ActorAssignment(a, buf) {
- void *bufferPtr = *buf;
-
- // Restore the target
- bufferPtr = constructTarget(targetMem, bufferPtr);
-
- // Restore the range
- range = *((uint16 *)bufferPtr);
- bufferPtr = (uint16 *)bufferPtr + 1;
-
- // Restore the flags
- flags = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-}
-
HuntToBeNearActorAssignment::HuntToBeNearActorAssignment(Actor *a, Common::SeekableReadStream *stream) :
ActorAssignment(a, stream) {
debugC(4, kDebugSaveload, "... Loading HuntToBeNearActorAssignment");
@@ -582,28 +452,6 @@ inline int32 HuntToBeNearActorAssignment::archiveSize(void) const {
+ sizeof(flags);
}
-//----------------------------------------------------------------------
-// Write the data from this assignment object to a buffer in order
-// to save it on disk
-
-void *HuntToBeNearActorAssignment::archive(void *buf) const {
- // Let the base class archive its data
- buf = ActorAssignment::archive(buf);
-
- // Store the target
- buf = archiveTarget(getTarget(), buf);
-
- // Store the range
- *((uint16 *)buf) = range;
- buf = (uint16 *)buf + 1;
-
- // Store the flags
- *((uint8 *)buf) = flags;
- buf = (uint8 *)buf + 1;
-
- return buf;
-}
-
void HuntToBeNearActorAssignment::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving HuntToBeNearActorAssignment");
@@ -689,23 +537,6 @@ void HuntToKillAssignment::initialize(
| (specificActorFlag ? specificActor : 0);
}
-//----------------------------------------------------------------------
-// Constructor -- constructs from archive buffer
-
-HuntToKillAssignment::HuntToKillAssignment(Actor *a, void **buf) :
- ActorAssignment(a, buf) {
- void *bufferPtr = *buf;
-
- // Restore the target
- bufferPtr = constructTarget(targetMem, bufferPtr);
-
- // Restore the flags
- flags = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-}
-
//----------------------------------------------------------------------
// Return the number of bytes need to archive the data in this
// assignment
@@ -716,24 +547,6 @@ inline int32 HuntToKillAssignment::archiveSize(void) const {
+ sizeof(flags);
}
-//----------------------------------------------------------------------
-// Write the data from this assignment object to a buffer in order
-// to save it on disk
-
-void *HuntToKillAssignment::archive(void *buf) const {
- // Let the base class archive its data
- buf = ActorAssignment::archive(buf);
-
- // Store the target
- buf = archiveTarget(getTarget(), buf);
-
- // Store the flags
- *((uint8 *)buf) = flags;
- buf = (uint8 *)buf + 1;
-
- return buf;
-}
-
void HuntToKillAssignment::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving HuntToKillAssignment");
@@ -802,21 +615,6 @@ Task *HuntToKillAssignment::getTask(TaskStack *ts) {
TetheredAssignment member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- constructs from archive buffer
-
-TetheredAssignment::TetheredAssignment(Actor *ac, void **buf) : ActorAssignment(ac, buf) {
- int16 *a = (int16 *)*buf;
-
- // Read data from buffer
- minU = *a++;
- minV = *a++;
- maxU = *a++;
- maxV = *a++;
-
- *buf = a;
-}
-
TetheredAssignment::TetheredAssignment(Actor *ac, Common::SeekableReadStream *stream) : ActorAssignment(ac, stream) {
debugC(4, kDebugSaveload, "... Loading TetheredAssignment");
@@ -839,25 +637,6 @@ inline int32 TetheredAssignment::archiveSize(void) const {
+ sizeof(maxV);
}
-//----------------------------------------------------------------------
-// Write the data from this assignment object to a buffer in order
-// to save it on disk
-
-void *TetheredAssignment::archive(void *buf) const {
- // Let the base class archive its data
- buf = ActorAssignment::archive(buf);
-
- int16 *a = (int16 *)buf;
-
- // Copy data to buffer
- *a++ = minU;
- *a++ = minV;
- *a++ = maxU;
- *a++ = maxV;
-
- return a;
-}
-
void TetheredAssignment::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving TetheredAssignment");
@@ -912,22 +691,6 @@ AttendAssignment::AttendAssignment(Actor *a, uint16 until, GameObject *o) :
obj(o) {
}
-//----------------------------------------------------------------------
-// Constructor -- constructs from archive buffer
-
-AttendAssignment::AttendAssignment(Actor *a, void **buf) : ActorAssignment(a, buf) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
- ObjectID objID;
-
- // Get the object ID
- objID = *bufferPtr++;
-
- // Convert the object ID to an object pointer
- obj = objID != Nothing ? GameObject::objectAddress(objID) : NULL;
-
- *buf = bufferPtr;
-}
-
AttendAssignment::AttendAssignment(Actor *a, Common::SeekableReadStream *stream) : ActorAssignment(a, stream) {
debugC(4, kDebugSaveload, "... Loading AttendAssignment");
@@ -949,25 +712,6 @@ inline int32 AttendAssignment::archiveSize(void) const {
+ sizeof(ObjectID);
}
-//----------------------------------------------------------------------
-// Write the data from this assignment object to a buffer in order
-// to save it on disk
-
-void *AttendAssignment::archive(void *buf) const {
- // Let the base class write its data to the buffer
- buf = ActorAssignment::archive(buf);
-
- ObjectID objID;
-
- // Convert the object pointer to an object ID
- objID = obj != NULL ? obj->thisID() : Nothing;
-
- // Store the object ID
- *((ObjectID *)buf) = objID;
-
- return (ObjectID *)buf + 1;
-}
-
void AttendAssignment::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving AttendAssignment");
@@ -1002,41 +746,6 @@ Task *AttendAssignment::getTask(TaskStack *ts) {
Misc functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Reconstruct the ActorAssignment object from the archive buffer
-
-void *constructAssignment(Actor *a, void *buf) {
- // Get the type which is the first word in the archive buffer
- int16 type = *((int16 *)buf);
-
- buf = (int16 *)buf + 1;
-
- // Based upon the type, call the correct constructor
- switch (type) {
- case patrolRouteAssignment:
- new PatrolRouteAssignment(a, &buf);
- break;
-
- case huntToBeNearActorAssignment:
- new HuntToBeNearActorAssignment(a, &buf);
- break;
-
- case huntToBeNearLocationAssignment:
- new HuntToBeNearLocationAssignment(a, &buf);
- break;
-
- case tetheredWanderAssignment:
- new TetheredWanderAssignment(a, &buf);
- break;
-
- case attendAssignment:
- new AttendAssignment(a, &buf);
- break;
- }
-
- return buf;
-}
-
void readAssignment(Actor *a, Common::InSaveFile *in) {
// Get the type which is the first word in the archive buffer
int16 type = in->readSint16LE();
@@ -1075,24 +784,6 @@ int32 assignmentArchiveSize(Actor *a) {
return assign != NULL ? sizeof(int16) + assign->archiveSize() : 0;
}
-//----------------------------------------------------------------------
-// Write the specified actor's assignment to an archive buffer
-
-void *archiveAssignment(Actor *a, void *buf) {
- ActorAssignment *assign = a->getAssignment();
-
- if (assign != NULL) {
- // Store the type in the buffer and increment the pointer
- *((int16 *)buf) = assign->type();
- buf = (int16 *)buf + 1;
-
- // Have the assignment archive itself in the buffer
- buf = assign->archive(buf);
- }
-
- return buf;
-}
-
void writeAssignment(Actor *a, Common::OutSaveFile *out) {
ActorAssignment *assign = a->getAssignment();
diff --git a/engines/saga2/assign.h b/engines/saga2/assign.h
index ad8b737349..0ca254205f 100644
--- a/engines/saga2/assign.h
+++ b/engines/saga2/assign.h
@@ -64,9 +64,6 @@ public:
// Constructor
ActorAssignment(Actor *a, uint16 until);
- // Constructor -- reconstruct from archive buffer
- ActorAssignment(Actor *a, void **buf);
-
ActorAssignment(Actor *a, Common::SeekableReadStream *stream);
// Destructor
@@ -76,10 +73,6 @@ public:
// assignment
virtual int32 archiveSize(void) const;
- // Write the data from this assignment object to a buffer in order
- // to save it on disk
- virtual void *archive(void *buf) const;
-
virtual void write(Common::OutSaveFile *out) const;
// Construct a TaskStack for this assignment
@@ -135,19 +128,12 @@ public:
int16 start = -1,
int16 end = -1);
- // Constructor -- constructs from archive buffer
- PatrolRouteAssignment(Actor *a, void **buf);
-
PatrolRouteAssignment(Actor *a, Common::SeekableReadStream *stream);
// Return the number of bytes need to archive the data in this
// assignment
int32 archiveSize(void) const;
- // Write the data from this assignment object to a buffer in order
- // to save it on disk
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this assignment
@@ -210,19 +196,12 @@ public:
}
- // Constructor -- constructs from archive buffer
- HuntToBeNearLocationAssignment(Actor *a, void **buf);
-
HuntToBeNearLocationAssignment(Actor *a, Common::SeekableReadStream *stream);
// Return the number of bytes need to archive the data in this
// assignment
int32 archiveSize(void) const;
- // Write the data from this assignment object to a buffer in order
- // to save it on disk
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
int16 type(void) const;
@@ -296,19 +275,12 @@ public:
initialize(at, r, trackFlag);
}
- // Constructor -- reconstructs from archive buffer
- HuntToBeNearActorAssignment(Actor *a, void **buf);
-
HuntToBeNearActorAssignment(Actor *a, Common::SeekableReadStream *stream);
// Return the number of bytes need to archive the data in this
// assignment
int32 archiveSize(void) const;
- // Write the data from this assignment object to a buffer in order
- // to save it on disk
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
int16 type(void) const;
@@ -376,17 +348,10 @@ public:
initialize(at, trackFlag, false);
}
- // Constructor -- reconstructs from archive buffer
- HuntToKillAssignment(Actor *a, void **buf);
-
// Return the number of bytes need to archive the data in this
// assignment
int32 archiveSize(void) const;
- // Write the data from this assignment object to a buffer in order
- // to save it on disk
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Determine if assignment's time limit is up or if the actor is
@@ -427,18 +392,12 @@ public:
maxV(reg.max.v) {
}
- TetheredAssignment(Actor *a, void **buf);
-
TetheredAssignment(Actor *a, Common::SeekableReadStream *stream);
// Return the number of bytes need to archive the data in this
// assignment
int32 archiveSize(void) const;
- // Write the data from this assignment object to a buffer in order
- // to save it on disk
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
};
@@ -451,9 +410,6 @@ public:
// Constructor -- initial assignment construction
TetheredWanderAssignment(Actor *a, uint16 until, const TileRegion ®);
- // Constructor -- constructs from archive buffer
- TetheredWanderAssignment(Actor *a, void **buf) : TetheredAssignment(a, buf) {}
-
TetheredWanderAssignment(Actor *a, Common::SeekableReadStream *stream) : TetheredAssignment(a, stream) {}
// Return an integer representing the type of this assignment
@@ -475,19 +431,12 @@ public:
// Constructor -- initial assignment construction
AttendAssignment(Actor *a, uint16 until, GameObject *o);
- // Constructor -- constructs from archive buffer
- AttendAssignment(Actor *a, void **buf);
-
AttendAssignment(Actor *a, Common::SeekableReadStream *stream);
// Return the number of bytes need to archive the data in this
// assignment
int32 archiveSize(void) const;
- // Write the data from this assignment object to a buffer in order
- // to save it on disk
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this assignment
@@ -502,16 +451,10 @@ protected:
Prototypes
* ===================================================================== */
-// Reconstruct the ActorAssignment object from the archive buffer
-void *constructAssignment(Actor *a, void *buf);
-
// Return the number of bytes necessary to archive this actor's
// assignment in an archive buffer
int32 assignmentArchiveSize(Actor *a);
-// Write the specified actor's assignment to an archive buffer
-void *archiveAssignment(Actor *a, void *buf);
-
void writeAssignment(Actor *a, Common::OutSaveFile *out);
void readAssignment(Actor *a, Common::InSaveFile *in);
diff --git a/engines/saga2/band.cpp b/engines/saga2/band.cpp
index fbcc122da3..f76ff7a764 100644
--- a/engines/saga2/band.cpp
+++ b/engines/saga2/band.cpp
@@ -52,31 +52,6 @@ BandList::~BandList(void) {
delete _list[i];
}
-//----------------------------------------------------------------------
-// Reconstruct from an archive buffer
-
-void *BandList::restore(void *buf) {
- int16 i,
- bandCount;
-
- // Get the count of bands and increment the buffer pointer
- bandCount = *((int16 *)buf);
- buf = (int16 *)buf + 1;
-
- // Iterate through the archive data, reconstructing the Bands
- for (i = 0; i < bandCount; i++) {
- BandID id;
-
- // Retreive the Band's id number
- id = *((BandID *)buf);
- buf = (BandID *)buf + 1;
-
- _list[id] = new Band(&buf);
- }
-
- return buf;
-}
-
void BandList::read(Common::InSaveFile *in) {
int16 bandCount;
// Get the count of bands and increment the buffer pointer
@@ -107,35 +82,6 @@ int32 BandList::archiveSize(void) {
return size;
}
-//----------------------------------------------------------------------
-// Make an archive of the BandList in an archive buffer
-
-void *BandList::archive(void *buf) {
- int16 bandCount = 0;
-
- // Count the active bands
- for (int i = 0; i < kNumBands; i++)
- if (_list[i])
- bandCount++;
-
- // Store the band count in the archive buffer
- *((int16 *)buf) = bandCount;
- buf = (int16 *)buf + 1;
-
- // Iterate through the bands, archiving each
- for (int i = 0; i < kNumBands; i++) {
- if (_list[i]) {
- // Store the Band's id number
- *((BandID *)buf) = i;
- buf = (BandID *)buf + 1;
-
- buf = _list[i]->archive(buf);
- }
- }
-
- return buf;
-}
-
void BandList::write(Common::OutSaveFile *out) {
int16 bandCount = 0;
@@ -258,29 +204,6 @@ Band *getBandAddress(BandID id) {
void initBands(void) {
}
-//----------------------------------------------------------------------
-// Save the BandList to save file
-
-void saveBands(SaveFileConstructor &saveGame) {
- int32 archiveBufSize;
- void *archiveBuffer;
-
- archiveBufSize = g_vm->_bandList->archiveSize();
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate band archive buffer");
-
- g_vm->_bandList->archive(archiveBuffer);
-
- saveGame.writeChunk(
- MKTAG('B', 'A', 'N', 'D'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveBands(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Bands");
@@ -294,35 +217,6 @@ void saveBands(Common::OutSaveFile *out) {
g_vm->_bandList->write(out);
}
-//----------------------------------------------------------------------
-// Load the bandList from a save file
-
-void loadBands(SaveFileReader &saveGame) {
- // If there is no saved data, simply call the default constructor
- if (saveGame.getChunkSize() == 0) {
- g_vm->_bandList = new BandList;
- return;
- }
-
- void *archiveBuffer;
- void *bufferPtr;
-
- archiveBuffer = malloc(saveGame.getChunkSize());
- if (archiveBuffer == NULL)
- error("Unable to allocate task archive buffer");
-
- // Read the archived task data
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- // Reconstruct taskList from archived data
- g_vm->_bandList = new BandList;
- g_vm->_bandList->restore(bufferPtr);
-
- free(archiveBuffer);
-}
-
void loadBands(Common::InSaveFile *in, int32 chunkSize) {
debugC(2, kDebugSaveload, "Loading Bands");
@@ -372,35 +266,6 @@ Band::Band(Actor *l) : leader(l), memberCount(0) {
members[i] = nullptr;
}
-Band::Band(void **buf) {
- void *bufferPtr = *buf;
-
- // Restore the leader pointer
- assert(isActor(*((ObjectID *)bufferPtr)));
- leader = (Actor *)GameObject::objectAddress(*((ObjectID *)bufferPtr));
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Restore the member count
- assert(*((int16 *)bufferPtr) < ARRAYSIZE(members));
- memberCount = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- for (int i = 0; i < maxBandMembers; i++)
- members[i] = nullptr;
-
- // Restore the member pointers
- for (int i = 0; i < memberCount; i++) {
- assert(isActor(*((ObjectID *)bufferPtr)));
- members[i] = (Actor *)GameObject::objectAddress(
- *((ObjectID *)bufferPtr));
- bufferPtr = (ObjectID *)bufferPtr + 1;
- }
-
- *buf = bufferPtr;
-
- g_vm->_bandList->addBand(this);
-}
-
Band::Band(Common::InSaveFile *in) {
ObjectID leaderID = in->readUint16LE();
@@ -441,29 +306,6 @@ int32 Band::archiveSize(void) {
+ sizeof(ObjectID) * memberCount; // members' ID's
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *Band::archive(void *buf) {
- int16 i;
-
- // Store the leader's ID
- *((ObjectID *)buf) = leader->thisID();
- buf = (ObjectID *)buf + 1;
-
- // Store the member count
- *((int16 *)buf) = memberCount;
- buf = (int16 *)buf + 1;
-
- // Store the members' ID's
- for (i = 0; i < memberCount; i++) {
- *((ObjectID *)buf) = members[i]->thisID();
- buf = (ObjectID *)buf + 1;
- }
-
- return buf;
-}
-
void Band::write(Common::OutSaveFile *out) {
// Store the leader's ID
out->writeUint16LE(leader->thisID());
diff --git a/engines/saga2/band.h b/engines/saga2/band.h
index a4300491ca..fd3a3e4e77 100644
--- a/engines/saga2/band.h
+++ b/engines/saga2/band.h
@@ -51,11 +51,7 @@ Band *getBandAddress(BandID id);
// Initialize the band list
void initBands(void);
-// Save the active band structures in a save file
-void saveBands(SaveFileConstructor &saveGame);
void saveBands(Common::OutSaveFile *out);
-// Load the band structures from a save file
-void loadBands(SaveFileReader &saveGame);
void loadBands(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the band list
void cleanupBands(void);
@@ -80,18 +76,12 @@ public:
// Destructor
~BandList(void);
- // Reconstruct from an archive buffer
- void *restore(void *buf);
-
void read(Common::InSaveFile *in);
// Return the number of bytes necessary to archive this task list
// in a buffer
int32 archiveSize(void);
- // Create an archive of the task list in an archive buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Place a Band from the inactive list into the active
@@ -135,9 +125,6 @@ public:
Band();
Band(Actor *l);
- // Constructor -- reconstruct from archive buffer
- Band(void **buf);
-
Band(Common::InSaveFile *in);
~Band() { deleteBand(this); }
@@ -146,9 +133,6 @@ public:
// buffer
int32 archiveSize(void);
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
Actor *getLeader(void) {
diff --git a/engines/saga2/calender.cpp b/engines/saga2/calender.cpp
index c4df357be8..caa6c2394a 100644
--- a/engines/saga2/calender.cpp
+++ b/engines/saga2/calender.cpp
@@ -267,18 +267,6 @@ void initCalender(void) {
calender.frameInHour = 0;
}
-//-----------------------------------------------------------------------
-// Write the calender data to a save file
-
-void saveCalender(SaveFileConstructor &saveGame) {
- if (saveGame.newChunk(
- MKTAG('C', 'A', 'L', 'E'),
- sizeof(calenderPaused) + sizeof(calender))) {
- saveGame.write(&calenderPaused, sizeof(calenderPaused));
- saveGame.write(&calender, sizeof(calender));
- }
-}
-
void saveCalender(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving calender");
@@ -292,17 +280,6 @@ void saveCalender(Common::OutSaveFile *out) {
calender.write(out);
}
-//-----------------------------------------------------------------------
-// Read the calender data from a save file. Assume the save file is at
-// the correct chunk.
-
-void loadCalender(SaveFileReader &saveGame) {
- assert(saveGame.getChunkSize() == sizeof(calenderPaused) + sizeof(calender));
-
- saveGame.read(&calenderPaused, sizeof(calenderPaused));
- saveGame.read(&calender, sizeof(calender));
-}
-
void loadCalender(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading calender");
diff --git a/engines/saga2/calender.h b/engines/saga2/calender.h
index 3b83d4c40a..84d2338db4 100644
--- a/engines/saga2/calender.h
+++ b/engines/saga2/calender.h
@@ -29,9 +29,6 @@
namespace Saga2 {
-class SaveFileConstructor;
-class SaveFileReader;
-
/* ===================================================================== *
CalenderTime class
* ===================================================================== */
@@ -100,9 +97,7 @@ uint32 operator - (const CalenderTime &time1, const CalenderTime &time2);
void initCalender(void);
-void saveCalender(SaveFileConstructor &saveGame);
void saveCalender(Common::OutSaveFile *out);
-void loadCalender(SaveFileReader &saveGame);
void loadCalender(Common::InSaveFile *in);
bool isDayTime(void);
diff --git a/engines/saga2/contain.cpp b/engines/saga2/contain.cpp
index acccf595db..338e62b184 100644
--- a/engines/saga2/contain.cpp
+++ b/engines/saga2/contain.cpp
@@ -1434,40 +1434,6 @@ ContainerNode::~ContainerNode() {
g_vm->_containerList->remove(this);
}
-// Restore the state of this ContainerNode from archive buffer
-void *ContainerNode::restore(void *buf) {
- Archive *a = (Archive *)buf;
-
- // Restore fields
- object = a->object;
- type = a->type;
- owner = a->owner;
- position = a->position;
- mindType = a->mindType;
- window = NULL;
- action = 0;
-
- // If this container was shown, re-show it
- if (a->shown) markForShow();
-
- return &a[1];
-}
-
-// Store the state of this ContainerNode into archive buffer
-void *ContainerNode::archive(void *buf) {
- Archive *a = (Archive *)buf;
-
- // Store fields
- a->object = object;
- a->type = type;
- a->owner = owner;
- a->position = position;
- a->mindType = mindType;
- a->shown = window != NULL;
-
- return &a[1];
-}
-
void ContainerNode::read(Common::InSaveFile *in) {
// Restore fields
object = in->readUint16LE();
@@ -1821,57 +1787,6 @@ void initContainerNodes(void) {
#endif
}
-void saveContainerNodes(SaveFileConstructor &saveGame) {
- int16 numNodes = 0;
- void *archiveBuffer,
- *bufferPtr;
- int32 archiveBufSize;
-
- // Make sure there are no pending container view actions
- g_vm->_containerList->doDeferredActions();
-
- archiveBufSize = sizeof(numNodes);
-
- // Count the number of nodes to save
- for (Common::List<ContainerNode *>::iterator it = g_vm->_containerList->_list.begin(); it != g_vm->_containerList->_list.end(); ++it) {
- ContainerNode *n = *it;
-
- if (n->getType() != ContainerNode::readyType)
- numNodes++;
- }
-
- // Compute size of archive buffer
- archiveBufSize += numNodes * ContainerNode::archiveSize();
-
- // Allocate the archive buffer
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate ContainerNode archive buffer\n");
-
- bufferPtr = archiveBuffer;
-
- // Store the number of nodes to save
- *((int16 *)bufferPtr) = numNodes;
- bufferPtr = (int16 *)bufferPtr + 1;
-
- // Store the nodes
- for (Common::List<ContainerNode *>::iterator it = g_vm->_containerList->_list.begin(); it != g_vm->_containerList->_list.end(); ++it) {
- ContainerNode *n = *it;
-
- if (n->getType() != ContainerNode::readyType)
- bufferPtr = n->archive(bufferPtr);
- }
-
- // Write the archive data to the save file
- saveGame.writeChunk(
- MakeID('C', 'O', 'N', 'T'),
- archiveBuffer,
- archiveBufSize);
-
- // Free the archive buffer
- free(archiveBuffer);
-}
-
void saveContainerNodes(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Container Nodes");
@@ -1914,45 +1829,6 @@ void saveContainerNodes(Common::OutSaveFile *out) {
}
}
-void loadContainerNodes(SaveFileReader &saveGame) {
- ContainerNode *node;
- Common::List<ContainerNode *> tempList;
- int16 i,
- numNodes;
- void *archiveBuffer,
- *bufferPtr;
- int32 archiveBufSize;
-
- // Read in the number of container nodes to restore
- saveGame.read(&numNodes, sizeof(numNodes));
-
- // Allocate archive buffer
- archiveBufSize = saveGame.bytesLeftInChunk();
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate ContainerNode archive buffer\n");
-
- // Read in node data
- saveGame.read(archiveBuffer, archiveBufSize);
-
- bufferPtr = archiveBuffer;
-
- for (i = 0; i < numNodes; i++) {
- node = new ContainerNode;
-
- // Restore the state of the node
- bufferPtr = node->restore(bufferPtr);
-
- // Add it back to the container list
- g_vm->_containerList->add(node);
- }
-
- assert(tempList.empty());
-
- // Free the archive buffer
- free(archiveBuffer);
-}
-
void loadContainerNodes(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading Container Nodes");
diff --git a/engines/saga2/contain.h b/engines/saga2/contain.h
index 3920806163..f0a1519cbc 100644
--- a/engines/saga2/contain.h
+++ b/engines/saga2/contain.h
@@ -449,8 +449,6 @@ public:
static int32 archiveSize(void) {
return sizeof(Archive);
}
- void *restore(void *buf);
- void *archive(void *buf);
void read(Common::InSaveFile *in);
void write(Common::OutSaveFile *out);
@@ -544,9 +542,7 @@ void initContainers(void);
void cleanupContainers(void);
void initContainerNodes(void);
-void saveContainerNodes(SaveFileConstructor &saveGame);
void saveContainerNodes(Common::OutSaveFile *out);
-void loadContainerNodes(SaveFileReader &saveGame);
void loadContainerNodes(Common::InSaveFile *in);
void cleanupContainerNodes(void);
diff --git a/engines/saga2/fta.h b/engines/saga2/fta.h
index 6dc4632888..1f38a61fee 100644
--- a/engines/saga2/fta.h
+++ b/engines/saga2/fta.h
@@ -31,8 +31,6 @@
namespace Saga2 {
-class SaveFileConstructor;
-class SaveFileReader;
class hResContext;
class hResource;
@@ -123,12 +121,7 @@ extern GameMode IntroMode,
// Initialize the timer
void initTimer(void);
-// Save the timer to a save file
-void saveTimer(SaveFileConstructor &saveGame);
void saveTimer(Common::OutSaveFile *out);
-
-// Load the timer from a save file
-void loadTimer(SaveFileReader &saveGame);
void loadTimer(Common::InSaveFile *in);
// Cleanup the timer -- nothing to do
@@ -196,9 +189,7 @@ void cleanupPathFinder(void);
* ===================================================================== */
void initGlobals(void);
-void saveGlobals(SaveFileConstructor &saveGame);
void saveGlobals(Common::OutSaveFile *out);
-void loadGlobals(SaveFileReader &saveGame);
void loadGlobals(Common::InSaveFile *in);
inline void cleanupGlobals(void) {} // do nothing
diff --git a/engines/saga2/interp.cpp b/engines/saga2/interp.cpp
index 71a25ac9bd..c79b8b2151 100644
--- a/engines/saga2/interp.cpp
+++ b/engines/saga2/interp.cpp
@@ -1156,18 +1156,12 @@ public:
_list[i] = nullptr;
}
- // Reconstruct from archive buffer
- void *restore(void *buf);
-
void read(Common::InSaveFile *in);
// Return the number of bytes needed to archive this thread list
// in an archive buffer
int32 archiveSize(void);
- // Create an archive of this thread list in an archive buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Cleanup the active threads
@@ -1199,34 +1193,6 @@ public:
Thread *next(Thread *thread);
};
-//-------------------------------------------------------------------
-// Reconstruct from archive buffer
-
-void *ThreadList::restore(void *buf) {
- warning("STUB: hreadList::restore()");
-
-#if 0
- int16 i,
- threadCount;
-
- // Get the count of threads and increment the buffer pointer
- threadCount = *((int16 *)buf);
- buf = (int16 *)buf + 1;
-
- // Iterate through the archive data, reconstructing the Threads
- for (i = 0; i < threadCount; i++) {
- ThreadID id;
-
- // Retreive the Thread's id number
- id = *((ThreadID *)buf);
- buf = (ThreadID *)buf + 1;
-
- new Thread(&buf);
- }
-#endif
- return buf;
-}
-
void ThreadList::read(Common::InSaveFile *in) {
int16 threadCount;
@@ -1258,43 +1224,6 @@ int32 ThreadList::archiveSize(void) {
return size;
}
-//-------------------------------------------------------------------
-// Create an archive of this thread list in an archive buffer
-
-void *ThreadList::archive(void *buf) {
- warning("STUB: hreadList::archive()");
-
-#if 0
- int16 threadCount = 0;
- ThreadPlaceHolder *tp;
-
- // Count the active threads
- for (tp = (ThreadPlaceHolder *)list.first();
- tp != NULL;
- tp = (ThreadPlaceHolder *)tp->next())
- threadCount++;
-
- // Store the thread count in the archive buffer
- *((int16 *)buf) = threadCount;
- buf = (int16 *)buf + 1;
-
- // Iterate through the threads, archiving each
- for (tp = (ThreadPlaceHolder *)list.first();
- tp != NULL;
- tp = (ThreadPlaceHolder *)tp->next()) {
- Thread *thread = tp->getThread();
-
- // Store the Thread's id number
- *((ThreadID *)buf) = tp - array;
- buf = (ThreadID *)buf + 1;
-
- buf = thread->archive(buf);
- }
-#endif
-
- return buf;
-}
-
void ThreadList::write(Common::OutSaveFile *out) {
int16 threadCount = 0;
Thread *th;
@@ -1400,29 +1329,6 @@ void initSAGAThreads(void) {
// Simply call the Thread List default constructor
}
-//-------------------------------------------------------------------
-// Save the active SAGA threads to a save file
-
-void saveSAGAThreads(SaveFileConstructor &saveGame) {
- int32 archiveBufSize;
- void *archiveBuffer;
-
- archiveBufSize = threadList.archiveSize();
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate SAGA thread archive buffer");
-
- threadList.archive(archiveBuffer);
-
- saveGame.writeChunk(
- MakeID('S', 'A', 'G', 'A'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveSAGAThreads(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving SAGA Threads");
@@ -1435,37 +1341,6 @@ void saveSAGAThreads(Common::OutSaveFile *out) {
threadList.write(out);
}
-//-------------------------------------------------------------------
-// Load the active SAGA threads from a save file
-
-void loadSAGAThreads(SaveFileReader &saveGame) {
- // If there is no saved data, simply call the default constructor
- if (saveGame.getChunkSize() == 0) {
- new (&threadList) ThreadList;
- return;
- }
-
- void *archiveBuffer;
- void *bufferPtr;
-
- archiveBuffer = malloc(saveGame.getChunkSize());
- if (archiveBuffer == nullptr)
- error("Unable to allocate SAGA thread archive buffer");
-
- // Read the archived thread data
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- // Reconstruct stackList from archived data
- new (&threadList) ThreadList;
- bufferPtr = threadList.restore(bufferPtr);
-
- assert((char *)bufferPtr == (char *)archiveBuffer + saveGame.getChunkSize());
-
- free(archiveBuffer);
-}
-
void loadSAGAThreads(Common::InSaveFile *in, int32 chunkSize) {
debugC(2, kDebugSaveload, "Loading SAGA Threads");
@@ -1543,41 +1418,6 @@ Thread::Thread(uint16 segNum, uint16 segOff, scriptCallFrame &args) {
newThread(this);
}
-//-----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-Thread::Thread(void **buf) {
- void *bufferPtr = *buf;
-
- int16 stackOffset;
-
- programCounter = *((SegmentRef *)bufferPtr);
- bufferPtr = (SegmentRef *)bufferPtr + 1;
-
- stackSize = *((int16 *)bufferPtr);
- flags = *((int16 *)bufferPtr + 1);
- framePtr = *((int16 *)bufferPtr + 2);
- returnVal = *((int16 *)bufferPtr + 3);
- bufferPtr = (int16 *)bufferPtr + 4;
-
- waitAlarm = *((Alarm *)bufferPtr);
- bufferPtr = (Alarm *)bufferPtr + 1;
-
- stackOffset = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- codeSeg = scriptRes->loadIndexResource(programCounter.segment, "saga code segment");
-
- stackBase = (byte *)malloc(stackSize);
- stackPtr = stackBase + stackSize - stackOffset;
-
- memcpy(stackPtr, bufferPtr, stackOffset);
- bufferPtr = (uint8 *)bufferPtr + stackOffset;
-
- *buf = bufferPtr;
-
- newThread(this);
-}
-
Thread::Thread(Common::SeekableReadStream *stream) {
int16 stackOffset;
@@ -1640,34 +1480,6 @@ int32 Thread::archiveSize(void) {
+ (stackBase + stackSize) - stackPtr;
}
-//-----------------------------------------------------------------------
-// Create an archive of this thread in an archive buffer
-
-void *Thread::archive(void *buf) {
- int16 stackOffset;
-
- *((SegmentRef *)buf) = programCounter;
- buf = (SegmentRef *)buf + 1;
-
- *((int16 *)buf) = stackSize;
- *((int16 *)buf + 1) = flags;
- *((int16 *)buf + 2) = framePtr;
- *((int16 *)buf + 3) = returnVal;
- buf = (int16 *)buf + 4;
-
- *((Alarm *)buf) = waitAlarm;
- buf = (Alarm *)buf + 1;
-
- stackOffset = (stackBase + stackSize) - stackPtr;
- *((int16 *)buf) = stackOffset;
- buf = (int16 *)buf + 1;
-
- memcpy(buf, stackPtr, stackOffset);
- buf = (uint8 *)buf + stackOffset;
-
- return buf;
-}
-
void Thread::write(Common::OutSaveFile *out) {
int16 stackOffset;
@@ -1878,16 +1690,6 @@ void initSAGADataSeg(void) {
scriptRes->read(dataSegment, dataSegSize);
}
-//-----------------------------------------------------------------------
-// Save the SAGA data segment to a save file
-
-void saveSAGADataSeg(SaveFileConstructor &saveGame) {
- saveGame.writeChunk(
- MakeID('S', 'D', 'T', 'A'),
- dataSegment,
- dataSegSize);
-}
-
void saveSAGADataSeg(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Data Segment");
@@ -1896,15 +1698,6 @@ void saveSAGADataSeg(Common::OutSaveFile *out) {
out->write(dataSegment, dataSegSize);
}
-//-----------------------------------------------------------------------
-// Load the SAGA data segment from a save file
-
-void loadSAGADataSeg(SaveFileReader &saveGame) {
- debugC(2, kDebugSaveload, "Loading Data Segment");
-
- saveGame.read(dataSegment, dataSegSize);
-}
-
void loadSAGADataSeg(Common::InSaveFile *in) {
in->read(dataSegment, dataSegSize);
}
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index 2f29ec496d..dd2015569a 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -2594,18 +2594,6 @@ void initUIState(void) {
//updateAllUserControls();
}
-void saveUIState(SaveFileConstructor &saveGame) {
- UIStateArchive archive;
-
- archive.indivControlsFlag = indivControlsFlag;
- archive.indivBrother = indivBrother;
-
- saveGame.writeChunk(
- MakeID('U', 'I', 'S', 'T'),
- &archive,
- sizeof(archive));
-}
-
void saveUIState(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving UIState");
@@ -2619,17 +2607,6 @@ void saveUIState(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "... indivBrother = %d", indivBrother);
}
-void loadUIState(SaveFileReader &saveGame) {
- UIStateArchive archive;
-
- saveGame.read(&archive, sizeof(archive));
-
- indivControlsFlag = archive.indivControlsFlag;
- indivBrother = archive.indivBrother;
-
- updateAllUserControls();
-}
-
void loadUIState(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading UIState");
diff --git a/engines/saga2/intrface.h b/engines/saga2/intrface.h
index 288ec4490c..5ed9493bc1 100644
--- a/engines/saga2/intrface.h
+++ b/engines/saga2/intrface.h
@@ -89,9 +89,7 @@ bool isBrotherDead(PlayerActorID brotherID);
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);
diff --git a/engines/saga2/loadsave.cpp b/engines/saga2/loadsave.cpp
index 4ebba70552..ea1366bcf5 100644
--- a/engines/saga2/loadsave.cpp
+++ b/engines/saga2/loadsave.cpp
@@ -225,7 +225,7 @@ void loadSavedGameState(int16 saveNo) {
pauseTimer();
Common::InSaveFile *in = g_vm->getSaveFileManager()->openForLoading(getSaveFileName(saveNo));
- //SaveFileReader saveGame(saveNo);
+
ChunkID id;
int32 chunkSize;
bool notEOF;
diff --git a/engines/saga2/magic.h b/engines/saga2/magic.h
index 966cef10d4..b7a29f26cf 100644
--- a/engines/saga2/magic.h
+++ b/engines/saga2/magic.h
@@ -36,9 +36,6 @@ class Location;
class SkillProto;
class GameObject;
-class SaveFileConstructor;
-class SaveFileReader;
-
// ------------------------------------------------------------------
// This is an include file for the spellcasting interface. This file
// is meant to publish the main API functions for spell casting.
@@ -103,9 +100,7 @@ bool implementSpell(GameObject *enactor, GameObject *target, SkillProto *spell);
// spell saving & loading
void initSpellState(void);
-void saveSpellState(SaveFileConstructor &saveGame);
void saveSpellState(Common::OutSaveFile *out);
-void loadSpellState(SaveFileReader &saveGame);
void loadSpellState(Common::InSaveFile *in);
void cleanupSpellState(void);
diff --git a/engines/saga2/main.cpp b/engines/saga2/main.cpp
index d9e1bf69f8..a4517a2be6 100644
--- a/engines/saga2/main.cpp
+++ b/engines/saga2/main.cpp
@@ -660,29 +660,6 @@ void initGlobals(void) {
backgroundSimulationPaused = false;
}
-//-----------------------------------------------------------------------
-// Store miscellaneous globals in a save file
-
-void saveGlobals(SaveFileConstructor &saveGame) {
- GlobalsArchive archive;
-
- archive.objectIndex = objectIndex;
- archive.actorIndex = actorIndex;
- archive.brotherBandingEnabled = brotherBandingEnabled;
- archive.centerActorIndicatorEnabled = centerActorIndicatorEnabled;
- archive.interruptableMotionsPaused = interruptableMotionsPaused;
- archive.objectStatesPaused = objectStatesPaused;
- archive.actorStatesPaused = actorStatesPaused;
- archive.actorTasksPaused = actorTasksPaused;
- archive.combatBehaviorEnabled = combatBehaviorEnabled;
- archive.backgroundSimulationPaused = backgroundSimulationPaused;
-
- saveGame.writeChunk(
- MakeID('G', 'L', 'O', 'B'),
- &archive,
- sizeof(archive));
-}
-
void saveGlobals(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving globals");
@@ -712,26 +689,6 @@ void saveGlobals(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "... backgroundSimulationPaused = %d", backgroundSimulationPaused);
}
-//-----------------------------------------------------------------------
-// Restore miscellaneouse globals from a save file
-
-void loadGlobals(SaveFileReader &saveGame) {
- GlobalsArchive archive;
-
- saveGame.read(&archive, sizeof(archive));
-
- objectIndex = archive.objectIndex;
- actorIndex = archive.actorIndex;
- brotherBandingEnabled = archive.brotherBandingEnabled;
- centerActorIndicatorEnabled = archive.centerActorIndicatorEnabled;
- interruptableMotionsPaused = archive.interruptableMotionsPaused;
- objectStatesPaused = archive.objectStatesPaused;
- actorStatesPaused = archive.actorStatesPaused;
- actorTasksPaused = archive.actorTasksPaused;
- combatBehaviorEnabled = archive.combatBehaviorEnabled;
- backgroundSimulationPaused = archive.backgroundSimulationPaused;
-}
-
void loadGlobals(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading globals");
diff --git a/engines/saga2/mission.cpp b/engines/saga2/mission.cpp
index 9de0973759..6a368ce2a2 100644
--- a/engines/saga2/mission.cpp
+++ b/engines/saga2/mission.cpp
@@ -172,7 +172,7 @@ void ActiveMission::read(Common::InSaveFile *in) {
debugC(4, kDebugSaveload, "... generatorID = %d", _data.generatorID);
debugC(4, kDebugSaveload, "... missionScript = %d", _data.missionScript);
debugC(4, kDebugSaveload, "... missionFlags = %d", _data.missionFlags);
-
+
for (int i = 0; i < ARRAYSIZE(_data.missionVars); ++i) {
_data.missionVars[i] = in->readByte();
debugC(5, kDebugSaveload, "... missionVars[%d] = %d", i, _data.missionVars[i]);
@@ -182,7 +182,7 @@ void ActiveMission::read(Common::InSaveFile *in) {
_data.missionObjectList[i] = in->readUint16LE();
debugC(5, kDebugSaveload, "... missionObjectList[%d] = %d", i, _data.missionObjectList[i]);
}
-
+
for (int i = 0; i < ARRAYSIZE(_data.missionKnowledgeList); ++i) {
_data.missionKnowledgeList[i].id = in->readUint16LE();
@@ -209,7 +209,7 @@ void ActiveMission::write(Common::OutSaveFile *out) {
debugC(4, kDebugSaveload, "... generatorID = %d", _data.generatorID);
debugC(4, kDebugSaveload, "... missionScript = %d", _data.missionScript);
debugC(4, kDebugSaveload, "... missionFlags = %d", _data.missionFlags);
-
+
for (int i = 0; i < ARRAYSIZE(_data.missionVars); ++i) {
out->writeByte(_data.missionVars[i]);
debugC(5, kDebugSaveload, "... missionVars[%d] = %d", i, _data.missionVars[i]);
@@ -219,7 +219,7 @@ void ActiveMission::write(Common::OutSaveFile *out) {
out->writeUint16LE(_data.missionObjectList[i]);
debugC(5, kDebugSaveload, "... missionObjectList[%d] = %d", i, _data.missionObjectList[i]);
}
-
+
for (int i = 0; i < ARRAYSIZE(_data.missionKnowledgeList); ++i) {
out->writeUint16LE(_data.missionKnowledgeList[i].id);
out->writeUint16LE(_data.missionKnowledgeList[i].kID);
@@ -268,16 +268,6 @@ void initMissions(void) {
activeMissions[i]._data.missionFlags &= ~inUse;
}
-//-----------------------------------------------------------------------
-// Save the active missions
-
-void saveMissions(SaveFileConstructor &saveGame) {
- saveGame.writeChunk(
- MakeID('M', 'I', 'S', 'S'),
- &activeMissions,
- sizeof(activeMissions));
-}
-
void saveMissions(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Missions");
@@ -290,13 +280,6 @@ void saveMissions(Common::OutSaveFile *out) {
}
}
-//-----------------------------------------------------------------------
-// Restore the active missions
-
-void loadMissions(SaveFileReader &saveGame) {
- saveGame.read(&activeMissions, sizeof(activeMissions));
-}
-
void loadMissions(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading Missions");
diff --git a/engines/saga2/mission.h b/engines/saga2/mission.h
index a906acbe6f..ea1a2ffa77 100644
--- a/engines/saga2/mission.h
+++ b/engines/saga2/mission.h
@@ -70,8 +70,6 @@ struct ActiveMissionData {
class ActiveMission {
friend void initMissions(void);
- friend void saveMissions(SaveFileConstructor &saveGame);
- friend void loadMissions(SaveFileReader &saveGame);
friend void cleanupMissions(void);
public:
@@ -120,12 +118,7 @@ public:
// Initialize the active mission list
void initMissions(void);
-// Save the active missions
-void saveMissions(SaveFileConstructor &saveGame);
void saveMissions(Common::OutSaveFile *out);
-
-// Restore the active missions
-void loadMissions(SaveFileReader &saveGame);
void loadMissions(Common::InSaveFile *in);
// Cleanup the active mission list
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index 1b4df7ee9c..c668a13fe7 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -353,44 +353,6 @@ uint8 computeTurnFrames(Direction fromDir, Direction toDir) {
MotionTaskList::MotionTaskList(void) {
}
-//-----------------------------------------------------------------------
-// Reconstruct motion task list from archive buffer
-
-MotionTaskList::MotionTaskList(void **buf) {
- warning("STUB: MotionTaskList::MotionTaskList(**buf)");
-#if 0
- void *bufferPtr = *buf;
-
- int16 i,
- motionTaskCount;
-
- for (i = 0; i < ARRAYSIZE(array); i++) {
- free.addTail(array[i]);
- }
-
- // Retrieve the motion task count
- motionTaskCount = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- for (i = 0; i < motionTaskCount; i++) {
- MotionTask *mt;
-
- // Get a new MotionTask from the free list and add it to the
- // active list
- mt = (MotionTask *)free.remHead();
-#if DEBUG
- assert(mt != NULL);
-#endif
- list.addTail(*mt);
-
- // Restore the MotionTask data
- bufferPtr = mt->restore(bufferPtr);
- }
-
- *buf = bufferPtr;
-#endif
-}
-
MotionTaskList::MotionTaskList(Common::SeekableReadStream *stream) {
read(stream);
}
@@ -425,23 +387,6 @@ int32 MotionTaskList::archiveSize(void) {
return size;
}
-//-----------------------------------------------------------------------
-// Create an archive of the motion tasks in the specified buffer
-
-void *MotionTaskList::archive(void *buf) {
- int16 motionTaskCount = _list.size();
-
- // Store the motion task count
- *((int16 *)buf) = motionTaskCount;
- buf = (int16 *)buf + 1;
-
- // Archive the active motion tasks
- for (Common::List<MotionTask *>::iterator it = _list.begin(); it != _list.end(); ++it)
- buf = (*it)->archive(buf);
-
- return buf;
-}
-
void MotionTaskList::write(Common::OutSaveFile *out) {
int16 motionTaskCount = _list.size();
@@ -508,300 +453,6 @@ MotionTask *MotionTaskList::newTask(GameObject *obj) {
MotionTask member functions
* ===================================================================== */
-//-----------------------------------------------------------------------
-// Reconstruct this MotionTask from an archive buffer
-
-void *MotionTask::restore(void *buf) {
- ObjectID objectID;
-
- // Restore the motion type and previous motion type
- motionType = *((uint8 *)buf);
- prevMotionType = *((uint8 *)buf + 1);
- buf = (uint8 *)buf + 2;
-
- // Restore the thread ID
- thread = *((ThreadID *)buf);
- buf = (ThreadID *)buf + 1;
-
- // Restore the motion flags
- flags = *((uint16 *)buf);
- buf = (uint16 *)buf + 1;
-
- // Get the object ID
- objectID = *((ObjectID *)buf);
- buf = (ObjectID *)buf + 1;
-
- // Convert the object ID to and object address
- object = objectID != Nothing
- ? GameObject::objectAddress(objectID)
- : NULL;
-
- // If the object is an actor, plug this motion task into the actor
- if (object && isActor(object))
- ((Actor *)object)->moveTask = this;
-
- if (motionType == motionTypeWalk
- || prevMotionType == motionTypeWalk) {
- // Restore the target _data.locations
- immediateLocation = *((TilePoint *)buf);
- finalTarget = *((TilePoint *)buf + 1);
- buf = (TilePoint *)buf + 2;
-
- // If there is a tether restore it
- if (flags & tethered) {
- tetherMinU = *((int16 *)buf);
- tetherMinV = *((int16 *)buf + 1);
- tetherMaxU = *((int16 *)buf + 2);
- tetherMaxV = *((int16 *)buf + 3);
- buf = (int16 *)buf + 4;
- }
-
- // Restore the direction
- direction = *((Direction *)buf);
- buf = (Direction *)buf + 1;
-
- // Restore the path index and path count
- pathIndex = *((int16 *)buf);
- pathCount = *((int16 *)buf + 1);
- runCount = *((int16 *)buf + 2);
- buf = (int16 *)buf + 3;
-
- // Restore the action counter if needed
- if (flags & agitated) {
- actionCounter = *((int16 *)buf);
- buf = (int16 *)buf + 1;
- }
-
- // If there were valid path way points, restore those
- if (pathIndex >= 0 && pathIndex < pathCount) {
- int16 wayPointIndex = pathIndex;
-
- while (wayPointIndex < pathCount) {
- pathList[wayPointIndex] = *((TilePoint *)buf);
- buf = (TilePoint *)buf + 1;
-
- wayPointIndex++;
- }
- }
-
- // If this motion task previously had a path finding request
- // it must be restarted
- pathFindTask = NULL;
- }
-
- if (motionType == motionTypeThrown || motionType == motionTypeShot) {
- // Restore the velocity
- velocity = *((TilePoint *)buf);
- buf = (TilePoint *)buf + 1;
-
- // Restore other ballistic motion variables
- steps = *((int16 *)buf);
- uFrac = *((int16 *)buf + 1);
- vFrac = *((int16 *)buf + 2);
- uErrorTerm = *((int16 *)buf + 3);
- vErrorTerm = *((int16 *)buf + 4);
- buf = (int16 *)buf + 5;
-
- if (motionType == motionTypeShot) {
- ObjectID targetObjID,
- enactorID;
-
- targetObjID = *((ObjectID *)buf);
- buf = (ObjectID *)buf + 1;
-
- targetObj = targetObjID
- ? GameObject::objectAddress(targetObjID)
- : NULL;
-
- enactorID = *((ObjectID *)buf);
- buf = (ObjectID *)buf + 1;
-
- o.enactor = enactorID != Nothing
- ? (Actor *)GameObject::objectAddress(enactorID)
- : NULL;
- }
- } else if (motionType == motionTypeClimbUp
- || motionType == motionTypeClimbDown) {
- immediateLocation = *((TilePoint *)buf);
- buf = (TilePoint *)buf + 1;
- } else if (motionType == motionTypeJump) {
- velocity = *((TilePoint *)buf);
- buf = (TilePoint *)buf + 1;
- } else if (motionType == motionTypeTurn) {
- direction = *((Direction *)buf);
- buf = (Direction *)buf + 1;
- } else if (motionType == motionTypeGive) {
- targetObj = *((ObjectID *)buf) != Nothing
- ? GameObject::objectAddress(*((ObjectID *)buf))
- : NULL;
- buf = (ObjectID *)buf + 1;
- } else if (motionType == motionTypeWait) {
- actionCounter = *((int16 *)buf);
- buf = (int16 *)buf + 1;
- } else if (motionType == motionTypeUseObject
- || motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnObject
- || motionType == motionTypeDropObjectOnTAI) {
- o.directObject = *((ObjectID *)buf) != Nothing
- ? GameObject::objectAddress(*((ObjectID *)buf))
- : NULL;
- buf = (ObjectID *)buf + 1;
-
- direction = *((Direction *)buf);
- buf = (Direction *)buf + 1;
-
- if (motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeDropObjectOnObject) {
- o.indirectObject = *((ObjectID *)buf) != Nothing
- ? GameObject::objectAddress(
- *((ObjectID *)buf))
- : NULL;
- buf = (ObjectID *)buf + 1;
- } else {
- if (motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeDropObjectOnTAI) {
- o.TAI = *((ActiveItemID *)buf) != NoActiveItem
- ? ActiveItem::activeItemAddress(
- *((ActiveItemID *)buf))
- : NULL;
- buf = (ActiveItemID *)buf + 1;
- }
-
- if (motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnTAI) {
- targetLoc = *((Location *)buf);
- buf = (Location *)buf + 1;
- }
- }
- } else if (motionType == motionTypeUseTAI) {
- o.TAI = *((ActiveItemID *)buf) != NoActiveItem
- ? ActiveItem::activeItemAddress(*((ActiveItemID *)buf))
- : NULL;
- buf = (ActiveItemID *)buf + 1;
-
- direction = *((Direction *)buf);
- buf = (Direction *)buf + 1;
- } else if (motionType == motionTypeTwoHandedSwing
- || motionType == motionTypeOneHandedSwing
- || motionType == motionTypeFireBow
- || motionType == motionTypeCastSpell
- || motionType == motionTypeUseWand) {
- ObjectID targetObjID;
-
- // Restore the direction
- direction = *((Direction *)buf);
- buf = (Direction *)buf + 1;
-
- // Restore the combat motion type
- combatMotionType = *((uint8 *)buf);
- buf = (uint8 *)buf + 1;
-
- // Get the target object ID
- targetObjID = *((ObjectID *)buf);
- buf = (ObjectID *)buf + 1;
-
- // Convert the target object ID to a pointer
- targetObj = targetObjID != Nothing
- ? GameObject::objectAddress(targetObjID)
- : NULL;
-
- if (motionType == motionTypeCastSpell) {
- SpellID sid ;
- ObjectID toid ;
- ActiveItemID ttaid;
-
- // restore the spell prototype
- sid = *((SpellID *)buf);
- buf = (SpellID *)buf + 1;
- spellObj = sid != nullSpell
- ? skillProtoFromID(sid)
- : NULL;
-
- // restore object target
- toid = *((ObjectID *)buf);
- buf = (ObjectID *)buf + 1;
- targetObj = toid != Nothing
- ? GameObject::objectAddress(toid)
- : NULL;
-
- // restore TAG target
- ttaid = *((ActiveItemID *)buf);
- buf = (ActiveItemID *)buf + 1;
- targetTAG = ttaid != NoActiveItem
- ? ActiveItem::activeItemAddress(ttaid)
- : NULL;
-
- // restore _data.location target
- targetLoc = *((Location *)buf);
- buf = (Location *)buf + 1;
- }
-
- // Restore the action counter
- actionCounter = *((int16 *)buf);
- buf = (int16 *)buf + 1;
- } else if (motionType == motionTypeTwoHandedParry
- || motionType == motionTypeOneHandedParry
- || motionType == motionTypeShieldParry) {
- ObjectID attackerID,
- defensiveObjID;
-
- // Restore the direction
- direction = *((Direction *)buf);
- buf = (Direction *)buf + 1;
-
- // Get the attacker's and defensive object's IDs
- attackerID = *((ObjectID *)buf);
- defensiveObjID = *((ObjectID *)buf + 1);
- buf = (ObjectID *)buf + 2;
-
- // Convert IDs to pointers
- d.attacker = attackerID != Nothing
- ? (Actor *)GameObject::objectAddress(attackerID)
- : NULL;
-
- d.defensiveObj = defensiveObjID != Nothing
- ? GameObject::objectAddress(defensiveObjID)
- : NULL;
-
- // Restore the defense flags
- d.defenseFlags = *((uint8 *)buf);
- buf = (uint8 *)buf + 1;
-
- // Restore the action counter
- actionCounter = *((int16 *)buf);
- buf = (int16 *)buf + 1;
-
- if (motionType == motionTypeOneHandedParry) {
- // Restore the combat sub-motion type
- combatMotionType = *((uint8 *)buf);
- buf = (uint8 *)buf + 1;
- }
- } else if (motionType == motionTypeDodge
- || motionType == motionTypeAcceptHit
- || motionType == motionTypeFallDown) {
- ObjectID attackerID;
-
- // Get the attacker's ID
- attackerID = *((ObjectID *)buf);
- buf = (ObjectID *)buf + 1;
-
- // Convert ID to pointer
- d.attacker = attackerID != Nothing
- ? (Actor *)GameObject::objectAddress(attackerID)
- : NULL;
-
- // Restore the action counter
- actionCounter = *((int16 *)buf);
- buf = (int16 *)buf + 1;
- }
-
- return buf;
-}
-
void MotionTask::read(Common::InSaveFile *in) {
ObjectID objectID;
@@ -1177,277 +828,6 @@ int32 MotionTask::archiveSize(void) {
return size;
}
-//-----------------------------------------------------------------------
-// Archive this MotionTask in a buffer
-
-void *MotionTask::archive(void *buf) {
- ObjectID objectID;
-
- // Store the motion type and previous motion type
- *((uint8 *)buf) = motionType;
- *((uint8 *)buf + 1) = prevMotionType;
- buf = (uint8 *)buf + 2;
-
- // Store the thread ID
- *((ThreadID *)buf) = thread;
- buf = (ThreadID *)buf + 1;
-
- // Store the motion flags
- *((uint16 *)buf) = flags;
- buf = (uint16 *)buf + 1;
-
- // Convert the object pointer to an object ID
- objectID = object != NULL ? object->thisID() : Nothing;
-
- // Store the object ID
- *((ObjectID *)buf) = objectID;
- buf = (ObjectID *)buf + 1;
-
- if (motionType == motionTypeWalk
- || prevMotionType == motionTypeWalk) {
- // Store the target _data.locations
- *((TilePoint *)buf) = immediateLocation;
- *((TilePoint *)buf + 1) = finalTarget;
- buf = (TilePoint *)buf + 2;
-
- // If there is a tether store it
- if (flags & tethered) {
- *((int16 *)buf) = tetherMinU;
- *((int16 *)buf + 1) = tetherMinV;
- *((int16 *)buf + 2) = tetherMaxU;
- *((int16 *)buf + 3) = tetherMaxV;
- buf = (int16 *)buf + 4;
- }
-
- // Store the direction
- *((Direction *)buf) = direction;
- buf = (Direction *)buf + 1;
-
- // Store the path index and path count
- *((int16 *)buf) = pathIndex;
- *((int16 *)buf + 1) = pathCount;
- *((int16 *)buf + 2) = runCount;
- buf = (int16 *)buf + 3;
-
- // Store the action counter if needed
- if (flags & agitated) {
- *((int16 *)buf) = actionCounter;
- buf = (int16 *)buf + 1;
- }
-
- // If there are valid path way points, store them
- if (pathIndex >= 0 && pathIndex < pathCount) {
- int16 wayPointIndex = pathIndex;
-
- while (wayPointIndex < pathCount) {
- *((TilePoint *)buf) = pathList[wayPointIndex];
- buf = (TilePoint *)buf + 1;
-
- wayPointIndex++;
- }
- }
- }
-
- if (motionType == motionTypeThrown || motionType == motionTypeShot) {
- // Store the velocity
- *((TilePoint *)buf) = velocity;
- buf = (TilePoint *)buf + 1;
-
- // Store other ballistic motion variables
- *((int16 *)buf) = steps;
- *((int16 *)buf + 1) = uFrac;
- *((int16 *)buf + 2) = vFrac;
- *((int16 *)buf + 3) = uErrorTerm;
- *((int16 *)buf + 4) = vErrorTerm;
- buf = (int16 *)buf + 5;
-
- if (motionType == motionTypeShot) {
- ObjectID targetObjID,
- enactorID;
-
- targetObjID = targetObj != NULL
- ? targetObj->thisID()
- : Nothing;
-
- *((ObjectID *)buf) = targetObjID;
- buf = (ObjectID *)buf + 1;
-
- enactorID = o.enactor != NULL
- ? o.enactor->thisID()
- : Nothing;
-
- *((ObjectID *)buf) = enactorID;
- buf = (ObjectID *)buf + 1;
- }
- } else if (motionType == motionTypeClimbUp
- || motionType == motionTypeClimbDown) {
- *((TilePoint *)buf) = immediateLocation;
- buf = (TilePoint *)buf + 1;
- } else if (motionType == motionTypeJump) {
- *((TilePoint *)buf) = velocity;
- buf = (TilePoint *)buf + 1;
- } else if (motionType == motionTypeTurn) {
- *((Direction *)buf) = direction;
- buf = (Direction *)buf + 1;
- } else if (motionType == motionTypeGive) {
- *((ObjectID *)buf) = targetObj != NULL
- ? targetObj->thisID()
- : Nothing;
- buf = (ObjectID *)buf + 1;
- } else if (motionType == motionTypeUseObject
- || motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnObject
- || motionType == motionTypeDropObjectOnTAI) {
- *((ObjectID *)buf) = o.directObject != NULL
- ? o.directObject->thisID()
- : Nothing;
- buf = (ObjectID *)buf + 1;
-
- *((Direction *)buf) = direction;
- buf = (Direction *)buf + 1;
-
- if (motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeDropObjectOnObject) {
- *((ObjectID *)buf) = o.indirectObject != NULL
- ? o.indirectObject->thisID()
- : Nothing;
- buf = (ObjectID *)buf + 1;
- } else {
- if (motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeDropObjectOnTAI) {
- *((ActiveItemID *)buf) = o.TAI != NULL
- ? o.TAI->thisID()
- : NoActiveItem;
- buf = (ActiveItemID *)buf + 1;
- }
-
- if (motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnTAI) {
- *((Location *)buf) = targetLoc;
- buf = (Location *)buf + 1;
- }
- }
- } else if (motionType == motionTypeUseTAI) {
- *((ActiveItemID *)buf) = o.TAI != NULL
- ? o.TAI->thisID()
- : NoActiveItem;
- buf = (ActiveItemID *)buf + 1;
-
- *((Direction *)buf) = direction;
- buf = (Direction *)buf + 1;
- } else if (motionType == motionTypeTwoHandedSwing
- || motionType == motionTypeOneHandedSwing
- || motionType == motionTypeFireBow
- || motionType == motionTypeCastSpell
- || motionType == motionTypeUseWand) {
- ObjectID targetObjID;
-
- // Store the direction
- *((Direction *)buf) = direction;
- buf = (Direction *)buf + 1;
-
- // Store the combat motion type
- *((uint8 *)buf) = combatMotionType;
- buf = (uint8 *)buf + 1;
-
- // Convert the target object pointer to an ID
- targetObjID = targetObj != NULL ? targetObj->thisID() : Nothing;
-
- // Store the target object ID
- *((ObjectID *)buf) = targetObjID;
- buf = (ObjectID *)buf + 1;
-
- if (motionType == motionTypeCastSpell) {
- // Convert the spell object pointer to an ID
-
- SpellID sid = spellObj != NULL
- ? spellObj->getSpellID()
- : nullSpell;
-
- ObjectID toid = targetObj != NULL
- ? targetObj->thisID()
- : Nothing;
-
- ActiveItemID ttaid = targetTAG != NULL
- ? targetTAG->thisID()
- : NoActiveItem;
-
- // Store the spell prototype
- *((SpellID *)buf) = sid;
- buf = (SpellID *)buf + 1;
-
- // Store object target
- *((ObjectID *)buf) = toid;
- buf = (ObjectID *)buf + 1;
-
- // Store TAG target
- *((ActiveItemID *)buf) = ttaid;
- buf = (ActiveItemID *)buf + 1;
-
- // Store _data.location target
- *((Location *)buf) = targetLoc;
- buf = (Location *)buf + 1;
-
- }
-
- // Store the action counter
- *((int16 *)buf) = actionCounter;
- buf = (int16 *)buf + 1;
-
- } else if (motionType == motionTypeTwoHandedParry
- || motionType == motionTypeOneHandedParry
- || motionType == motionTypeShieldParry) {
- ObjectID attackerID,
- defensiveObjID;
-
- // Store the direction
- *((Direction *)buf) = direction;
- buf = (Direction *)buf + 1;
-
- attackerID = d.attacker != NULL ? d.attacker->thisID() : Nothing;
- defensiveObjID = d.defensiveObj != NULL ? d.defensiveObj->thisID() : Nothing;
-
- // Store the attacker's and defensive object's IDs
- *((ObjectID *)buf) = attackerID;
- *((ObjectID *)buf + 1) = defensiveObjID;
- buf = (ObjectID *)buf + 2;
-
- // Store the defense flags
- *((uint8 *)buf) = d.defenseFlags;
- buf = (uint8 *)buf + 1;
-
- // Store the action counter
- *((int16 *)buf) = actionCounter;
- buf = (int16 *)buf + 1;
-
- if (motionType == motionTypeOneHandedParry) {
- // Store the combat sub-motion type
- *((uint8 *)buf) = combatMotionType;
- buf = (uint8 *)buf + 1;
- }
- } else if (motionType == motionTypeDodge
- || motionType == motionTypeAcceptHit
- || motionType == motionTypeFallDown) {
- ObjectID attackerID;
-
- attackerID = d.attacker != NULL ? d.attacker->thisID() : Nothing;
-
- // Store the attacker's ID
- *((ObjectID *)buf) = attackerID;
- buf = (ObjectID *)buf + 1;
-
- // Store the action counter
- *((int16 *)buf) = actionCounter;
- buf = (int16 *)buf + 1;
- }
-
- return buf;
-}
-
void MotionTask::write(Common::OutSaveFile *out) {
ObjectID objectID;
@@ -5432,29 +4812,6 @@ void initMotionTasks(void) {
//new (g_vm->_mTaskList) MotionTaskList;
}
-//-----------------------------------------------------------------------
-// Save the motion task list to a save file
-
-void saveMotionTasks(SaveFileConstructor &saveGame) {
- int32 archiveBufSize;
- void *archiveBuffer;
-
- archiveBufSize = g_vm->_mTaskList->archiveSize();
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate motion task archive buffer");
-
- g_vm->_mTaskList->archive(archiveBuffer);
-
- saveGame.writeChunk(
- MakeID('M', 'O', 'T', 'N'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveMotionTasks(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving MotionTasks");
@@ -5468,37 +4825,6 @@ void saveMotionTasks(Common::OutSaveFile *out) {
g_vm->_mTaskList->write(out);
}
-//-----------------------------------------------------------------------
-// Load the motion task list from a save file
-
-void loadMotionTasks(SaveFileReader &saveGame) {
- warning("STUB: loadMotionTasks()");
-#if 0
- // If there is no saved data, simply call the default constructor
- if (saveGame.getChunkSize() == 0) {
- new (&g_vm->_mTaskList) MotionTaskList;
- return;
- }
-
- void *archiveBuffer;
- void *bufferPtr;
-
- archiveBuffer = malloc(saveGame.getChunkSize());
- if (archiveBuffer == NULL)
- error("Unable to allocate motion task archive buffer");
-
- // Read the archived task stack data
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- // Reconstruct g_vm->_mTaskList from archived data
- new (&g_vm->_mTaskList) MotionTaskList(&bufferPtr);
-
- free(archiveBuffer);
-#endif
-}
-
void loadMotionTasks(Common::InSaveFile *in, int32 chunkSize) {
debugC(2, kDebugSaveload, "Loading MotionTasks");
diff --git a/engines/saga2/motion.h b/engines/saga2/motion.h
index 37040422a2..54b99e500d 100644
--- a/engines/saga2/motion.h
+++ b/engines/saga2/motion.h
@@ -258,17 +258,11 @@ private:
};
- // Reconstruct this MotionTask from an archive buffer
- void *restore(void *buf);
-
void read(Common::InSaveFile *in);
// Return the number of bytes needed to archive this MotionTask
int32 archiveSize(void);
- // Archive this MotionTask in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// motion task is finished.
@@ -549,9 +543,6 @@ public:
// Default constructor
MotionTaskList(void);
- // Reconstruct motion task list from archive buffer
- MotionTaskList(void **buf);
-
MotionTaskList(Common::SeekableReadStream *stream);
void read(Common::InSaveFile *in);
@@ -560,9 +551,6 @@ public:
// in a buffer
int32 archiveSize(void);
- // Create an archive of the motion tasks in the specified buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Cleanup the motion tasks
@@ -630,12 +618,7 @@ void resumeInterruptableMotions(void);
// Initialize the motion task list
void initMotionTasks(void);
-// Save the motion task list to a save file
-void saveMotionTasks(SaveFileConstructor &saveGame);
void saveMotionTasks(Common::OutSaveFile *out);
-
-// Load the motion task list from a save file
-void loadMotionTasks(SaveFileReader &saveGame);
void loadMotionTasks(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the motion task list
diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index d27395cd02..0b78926deb 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -233,38 +233,6 @@ GameObject::GameObject(const ResourceGameObject &res) {
_data.obj = this;
}
-//-----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GameObject::GameObject(void **buf) {
- GameObjectArchive *a = (GameObjectArchive *)*buf;
-
- // Convert the protoype index into an object proto pointer
- prototype = a->protoIndex != -1
- ? &objectProtos[a->protoIndex]
- : nullptr;
-
- _data.projectDummy = 0;
- _data.location = a->location;
- _data.nameIndex = a->nameIndex;
- _data.parentID = a->parentID;
- _data.siblingID = a->siblingID;
- _data.childID = a->childID;
- _data.script = a->script;
- _data.objectFlags = a->objectFlags;
- _data.hitPoints = a->hitPoints;
- _data.bParam = a->bParam;
- _data.massCount = a->misc;
- _data.missileFacing = a->missileFacing;
- _data.currentTAG = a->currentTAG;
- _data.sightCtr = a->sightCtr;
- memset(&_data.reserved, 0, sizeof(_data.reserved));
-
- _data.obj = this;
-
- *buf = &a[1];
-}
-
GameObject::GameObject(Common::InSaveFile *in) {
debugC(3, kDebugSaveload, "Loading object %d", thisID());
@@ -307,32 +275,6 @@ int32 GameObject::archiveSize(void) {
return sizeof(GameObjectArchive);
}
-//-----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *GameObject::archive(void *buf) {
- GameObjectArchive *a = (GameObjectArchive *)buf;
-
- // Convert the prototype pointer to a prototype index
- a->protoIndex = prototype != nullptr ? prototype - objectProtos : -1;
-
- a->location = _data.location;
- a->nameIndex = _data.nameIndex;
- a->parentID = _data.parentID;
- a->siblingID = _data.siblingID;
- a->childID = _data.childID;
- a->script = _data.script;
- a->objectFlags = _data.objectFlags;
- a->hitPoints = _data.hitPoints;
- a->bParam = _data.bParam;
- a->misc = _data.massCount;
- a->missileFacing = _data.missileFacing;
- a->currentTAG = _data.currentTAG;
- a->sightCtr = _data.sightCtr;
-
- return &a[1];
-}
-
void GameObject::write(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving object %d", thisID());
@@ -2408,40 +2350,6 @@ GameWorld::GameWorld(int16 map) {
}
}
-//-------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GameWorld::GameWorld(void **buf) {
- warning("STUB:GameWorld::GameWorld()");
-#if 0
- int16 *bufferPtr = (int16 *)*buf;
-
- size.u = size.v = *bufferPtr++;
- mapNum = *bufferPtr++;
-
- if (size.u != 0) {
- int32 sectorArrayBytes;
-
- sectorArraySize = size.u / kSectorSize;
- sectorArrayBytes =
- sectorArraySize * sectorArraySize * sizeof(Sector),
- sectorArray = new Sector[sectorArrayBytes]();
-
- if (sectorArray == nullptr)
- error("Unable to allocate world %d sector array", mapNum);
-
- memcpy(sectorArray, bufferPtr, sectorArrayBytes);
-
- bufferPtr = (int16 *)((int8 *)bufferPtr + sectorArrayBytes);
- } else {
- sectorArraySize = 0;
- sectorArray = nullptr;
- }
-
- *buf = bufferPtr;
-#endif
-}
-
GameWorld::GameWorld(Common::SeekableReadStream *stream) {
size.u = size.v = stream->readSint16LE();
mapNum = stream->readSint16LE();
@@ -2489,22 +2397,6 @@ int32 GameWorld::archiveSize(void) {
return bytes;
}
-//-------------------------------------------------------------------
-// Make an archive of this world
-
-void *GameWorld::archive(void *buf) {
- int16 *bufferPtr = (int16 *)buf;
- int32 sectorArrayBytes =
- sectorArraySize * sectorArraySize * sizeof(Sector);
-
- *bufferPtr++ = size.u;
- *bufferPtr++ = mapNum;
- memcpy(bufferPtr, sectorArray, sectorArrayBytes);
-
- warning("FIXME: Unsafe pointer arithmetics in GameWorld::archive()");
- return (void *)(bufferPtr + sectorArrayBytes);
-}
-
//-------------------------------------------------------------------
// Cleanup
@@ -2792,15 +2684,6 @@ void initTempActorCount(void) {
tempActorCount[i] = 0;
}
-//-------------------------------------------------------------------
-// Save the array of temp actor counts
-void saveTempActorCount(SaveFileConstructor &saveGame) {
- saveGame.writeChunk(
- MakeID('A', 'C', 'N', 'T'),
- tempActorCount,
- actorProtoCount * sizeof(uint16));
-}
-
void saveTempActorCount(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving TempActorCount");
@@ -2811,14 +2694,6 @@ void saveTempActorCount(Common::OutSaveFile *out) {
out->writeUint16LE(tempActorCount[i]);
}
-//-------------------------------------------------------------------
-// Load the array of temp actor counts
-
-void loadTempActorCount(SaveFileReader &saveGame) {
- tempActorCount = new uint16[saveGame.getChunkSize()];
- saveGame.read(tempActorCount, saveGame.getChunkSize());
-}
-
void loadTempActorCount(Common::InSaveFile *in, int32 chunkSize) {
debugC(2, kDebugSaveload, "Loading TempActorCount");
@@ -2883,46 +2758,6 @@ void initWorlds(void) {
setCurrentMap(currentWorld->mapNum);
}
-//-------------------------------------------------------------------
-// Save the worlds to a save game file
-
-void saveWorlds(SaveFileConstructor &saveGame) {
- int16 i;
- int32 archiveBufSize = 0;
- void *archiveBuffer;
- void *bufferPtr;
-
- // Accumulate size of archive buffer
-
- // Add size of the current world's ID
- archiveBufSize += sizeof(ObjectID);
-
- for (i = 0; i < worldCount; i++)
- archiveBufSize += worldList[i].archiveSize();
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == nullptr)
- error("Unable to allocate world archive buffer");
-
- bufferPtr = archiveBuffer;
-
- // Store the current world's ID
- *((ObjectID *)bufferPtr) = currentWorld->thisID();
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Store the world data in the archive buffer
- for (i = 0; i < worldCount; i++)
- bufferPtr = worldList[i].archive(bufferPtr);
-
- // Write the archive buffer to the save file
- saveGame.writeChunk(
- MakeID('W', 'R', 'L', 'D'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveWorlds(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving worlds");
@@ -2962,48 +2797,6 @@ void saveWorlds(Common::OutSaveFile *out) {
}
}
-//-------------------------------------------------------------------
-// Load the worlds from a save game file
-
-void loadWorlds(SaveFileReader &saveGame) {
- int16 i;
- ObjectID currentWorldID;
- void *archiveBuffer;
- void *bufferPtr;
-
- // worldCount must be set by the map data initialization
- worldListSize = worldCount * sizeof(GameWorld);
-
- worldList = new GameWorld[worldListSize]();
- if (worldList == nullptr)
- error("Unable to allocate world list");
-
- archiveBuffer = malloc(saveGame.getChunkSize());
- if (archiveBuffer == nullptr)
- error("Unable to allocate world data buffer");
-
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- // Get the current world's ID
- currentWorldID = *((ObjectID *)bufferPtr);
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Iterate through the world data, initializing the world list
- for (i = 0;
- i < worldCount;
- i++)
- // Restore the world's data
- new (&worldList[i]) GameWorld(&bufferPtr);
-
- free(archiveBuffer);
-
- // Reset the current world
- currentWorld = (GameWorld *)GameObject::objectAddress(currentWorldID);
- setCurrentMap(currentWorld->mapNum);
-}
-
void loadWorlds(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading worlds");
@@ -3167,54 +2960,6 @@ void initObjects(void) {
#endif
}
-//-------------------------------------------------------------------
-// Save the object list to a save file
-
-void saveObjects(SaveFileConstructor &saveGame) {
- int16 i;
- void *archiveBuffer,
- *bufferPtr;
- int32 archiveBufSize;
- GameObject *currentObj;
-
- archiveBufSize = sizeof(objectLimboCount)
- + sizeof(actorLimboCount)
- + sizeof(importantLimboCount)
- + objectListSize;
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == nullptr)
- error("Cannot allocate object list archive buffer");
-
- bufferPtr = archiveBuffer;
-
- // Store the limbo counts
- *((int16 *)bufferPtr) = objectLimboCount;
- *((int16 *)bufferPtr + 1) = actorLimboCount;
- *((int16 *)bufferPtr + 2) = importantLimboCount;
- bufferPtr = (int16 *)bufferPtr + 3;
-
- // Store the object list
- memcpy(bufferPtr, objectList, objectListSize);
-
- // Convert the prototype pointers to prototype indexes
- for (i = 0, currentObj = (GameObject *)bufferPtr;
- i < objectCount;
- i++, currentObj++) {
- *((int16 *)¤tObj->prototype) =
- currentObj->prototype != nullptr
- ? currentObj->prototype - objectProtos
- : -1;
- }
-
- saveGame.writeChunk(
- MakeID('O', 'B', 'J', 'S'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveObjects(Common::OutSaveFile *out) {
int32 archiveBufSize;
@@ -3236,39 +2981,6 @@ void saveObjects(Common::OutSaveFile *out) {
objectList[i].write(out);
}
-//-------------------------------------------------------------------
-// Load the object list from a save file
-
-void loadObjects(SaveFileReader &saveGame) {
- int16 i;
- GameObject *obj;
-
- // Restore the limbo counts
- saveGame.read(&objectLimboCount, sizeof(objectLimboCount));
- saveGame.read(&actorLimboCount, sizeof(actorLimboCount));
- saveGame.read(&importantLimboCount, sizeof(importantLimboCount));
-
- // Restore the object list
- objectListSize = saveGame.bytesLeftInChunk();
- //objectCount = objectListSize / sizeof(GameObject);
-
- objectList = new GameObject[objectCount]();
- if (objectList == nullptr)
- error("Unable to load Objects");
-
- saveGame.read(objectList, objectListSize);
-
- for (i = 0, obj = (GameObject *)objectList;
- i < objectCount;
- i++, obj++) {
- // convert prototype ID number to actual prototype address
- obj->prototype =
- *((int16 *)&obj->prototype) != -1
- ? &objectProtos[*((int16 *)&obj->prototype)]
- : nullptr;
- }
-}
-
void loadObjects(Common::InSaveFile *in) {
// Restore the limbo counts
objectLimboCount = in->readSint16LE();
@@ -3542,16 +3254,6 @@ void initActiveRegions(void) {
}
}
-//-------------------------------------------------------------------
-// Save the active regions to a save file
-
-void saveActiveRegions(SaveFileConstructor &saveGame) {
- saveGame.writeChunk(
- MakeID('A', 'R', 'E', 'G'),
- &activeRegionList,
- sizeof(activeRegionList));
-}
-
void saveActiveRegions(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving ActiveRegions");
@@ -3566,13 +3268,6 @@ void saveActiveRegions(Common::OutSaveFile *out) {
}
}
-//-------------------------------------------------------------------
-// Load the active regions from a save file
-
-void loadActiveRegions(SaveFileReader &saveGame) {
- saveGame.read(&activeRegionList, sizeof(activeRegionList));
-}
-
void loadActiveRegions(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading ActiveRegions");
diff --git a/engines/saga2/objects.h b/engines/saga2/objects.h
index 7717be45a1..bf33d32903 100644
--- a/engines/saga2/objects.h
+++ b/engines/saga2/objects.h
@@ -37,8 +37,6 @@ namespace Saga2 {
* ======================================================================= */
class GameWorld;
-class SaveFileConstructor;
-class SaveFileReader;
const uint16 unlimitedCapacity = maxuint16;
@@ -115,22 +113,16 @@ struct ObjectData {
#include "common/pack-end.h"
void initActors(void);
-void saveActors(SaveFileConstructor &);
void saveActors(Common::OutSaveFile *out);
-void loadActors(SaveFileReader &);
void loadActors(Common::InSaveFile *in);
void cleanupActors(void);
class GameObject {
friend void initWorlds(void);
- friend void saveWorlds(SaveFileConstructor &);
- friend void loadWorlds(SaveFileReader &);
friend void cleanupWorlds(void);
friend void initObjects(void);
- friend void saveObjects(SaveFileConstructor &);
friend void saveObjects(Common::OutSaveFile *out);
- friend void loadObjects(SaveFileReader &);
friend void loadObjects(Common::InSaveFile *in);
friend void cleanupObjects(void);
@@ -187,9 +179,6 @@ public:
// Constructor -- initial construction
GameObject(const ResourceGameObject &res);
- // Constructor -- reconstruct from archive buffer
- GameObject(void **buf);
-
GameObject(Common::InSaveFile *in);
void read(Common::InSaveFile *in);
@@ -198,9 +187,6 @@ public:
// a buffer
int32 archiveSize(void);
- // Archive the object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// returns the address of the object based on the ID, and this
@@ -786,15 +772,11 @@ public:
// Initial constructor
GameWorld(int16 map);
- // Constructor -- reconstruct from archive buffer
- GameWorld(void **buf);
-
GameWorld(Common::SeekableReadStream *stream);
~GameWorld();
int32 archiveSize(void);
- void *archive(void *buf);
void cleanup(void);
@@ -854,8 +836,6 @@ inline int16 GameObject::getMapNum(void) {
class ActiveRegion {
friend void initActiveRegions(void);
- friend void saveActiveRegions(SaveFileConstructor &saveGame);
- friend void loadActiveRegions(SaveFileReader &saveGame);
friend void cleanupActiveRegions(void);
friend class ActiveRegionObjectIterator;
@@ -902,9 +882,7 @@ void updateActiveRegions(void);
ActiveRegion *getActiveRegion(PlayerActorID id);
void initActiveRegions(void);
-void saveActiveRegions(SaveFileConstructor &saveGame);
void saveActiveRegions(Common::OutSaveFile *out);
-void loadActiveRegions(SaveFileReader &saveGame);
void loadActiveRegions(Common::InSaveFile *in);
inline void cleanupActiveRegions(void) {}
@@ -1408,11 +1386,9 @@ void cleanupObjectSoundFXTable(void);
void initTempActorCount(void);
// Save the array of temp actor counts
-void saveTempActorCount(SaveFileConstructor &saveGame);
void saveTempActorCount(Common::OutSaveFile *out);
// Load the array of temp actor counts
-void loadTempActorCount(SaveFileReader &saveGame);
void loadTempActorCount(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the array to temp actor counts
@@ -1431,11 +1407,9 @@ uint16 getTempActorCount(uint16 protoNum);
void initWorlds(void);
// Save worlds to the save file
-void saveWorlds(SaveFileConstructor &saveGame);
void saveWorlds(Common::OutSaveFile *out);
// Load worlds from the save file
-void loadWorlds(SaveFileReader &saveGame);
void loadWorlds(Common::InSaveFile *in);
// Cleanup game worlds
@@ -1445,11 +1419,9 @@ void cleanupWorlds(void);
void initObjects(void);
// Save the objects to the save file
-void saveObjects(SaveFileConstructor &saveGame);
void saveObjects(Common::OutSaveFile *out);
// Load the objects from the save file
-void loadObjects(SaveFileReader &saveGame);
void loadObjects(Common::InSaveFile *in);
// Cleanup object list
diff --git a/engines/saga2/palette.h b/engines/saga2/palette.h
index b22d2447fe..b87afadf7e 100644
--- a/engines/saga2/palette.h
+++ b/engines/saga2/palette.h
@@ -76,11 +76,9 @@ void setPaletteToBlack(void);
void initPaletteState(void);
// Save the current state of the current palette and fade up/down in
// a save file.
-void savePaletteState(SaveFileConstructor &saveGame);
void savePaletteState(Common::OutSaveFile *out);
// Load and set the current state of the current palette and fade
// up/down from a save file.
-void loadPaletteState(SaveFileReader &saveGame);
void loadPaletteState(Common::InSaveFile *in);
// Cleanup the palette
inline void cleanupPaletteState(void) { /* do nothing */ }
diff --git a/engines/saga2/player.cpp b/engines/saga2/player.cpp
index 1b40514e34..f9a0392606 100644
--- a/engines/saga2/player.cpp
+++ b/engines/saga2/player.cpp
@@ -938,54 +938,6 @@ void initPlayerActors(void) {
readyContainerSetup();
}
-//-----------------------------------------------------------------------
-// Save the player list data to a save file
-
-void savePlayerActors(SaveFileConstructor &saveGame) {
- int16 i;
- PlayerActorArchive archiveBuffer[playerActors];
-
- for (i = 0; i < playerActors; i++) {
- PlayerActor *p = &playerList[i];
- PlayerActorArchive *a = &archiveBuffer[i];
-
- // Store the portrait type
- a->portraitType = p->portraitType;
-
- // Store the flags
- a->flags = p->flags;
-
- // Store the base stats
- memcpy(&a->baseStats, &p->baseStats, sizeof(a->baseStats));
-
- // Store accumulation arrays
- memcpy(
- &a->manaMemory,
- &p->manaMemory,
- sizeof(a->manaMemory));
- memcpy(
- &a->attribRecPools,
- &p->attribRecPools,
- sizeof(a->attribRecPools));
- memcpy(
- &a->attribMemPools,
- &p->attribMemPools,
- sizeof(a->attribMemPools));
-
- // Store the vitality memory
- a->vitalityMemory = p->vitalityMemory;
-
- // Store the attack notification flag
- a->notifiedOfAttack = p->notifiedOfAttack;
- }
-
- // Write the player actor chunk
- saveGame.writeChunk(
- MakeID('P', 'L', 'Y', 'R'),
- archiveBuffer,
- sizeof(archiveBuffer));
-}
-
void savePlayerActors(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving PlayerActors");
@@ -1031,52 +983,6 @@ void savePlayerActors(Common::OutSaveFile *out) {
}
}
-//-----------------------------------------------------------------------
-// Load the player list data from a save file
-
-void loadPlayerActors(SaveFileReader &saveGame) {
- int16 i;
- PlayerActorArchive archiveBuffer[playerActors];
-
- saveGame.read(archiveBuffer, sizeof(archiveBuffer));
-
- for (i = 0; i < playerActors; i++) {
- PlayerActor *p = &playerList[i];
- PlayerActorArchive *a = &archiveBuffer[i];
-
- // Restore the portrait type
- p->portraitType = a->portraitType;
-
- // Restore the flags
- p->flags = a->flags;
-
- // Restore the base stats
- memcpy(&p->baseStats, &a->baseStats, sizeof(p->baseStats));
-
- // Restore the accumulation arrays
- memcpy(
- &p->manaMemory,
- &a->manaMemory,
- sizeof(p->manaMemory));
- memcpy(
- &p->attribRecPools,
- &a->attribRecPools,
- sizeof(p->attribRecPools));
- memcpy(
- &p->attribMemPools,
- &a->attribMemPools,
- sizeof(p->attribMemPools));
-
- // Restore the vitality memory
- p->vitalityMemory = a->vitalityMemory;
-
- // Restore the attack notification flag
- p->notifiedOfAttack = a->notifiedOfAttack;
- }
-
- readyContainerSetup();
-}
-
void loadPlayerActors(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading PlayerActors");
@@ -1148,19 +1054,6 @@ void initCenterActor(void) {
updateBrotherRadioButtons(FTA_JULIAN);
}
-//-----------------------------------------------------------------------
-// Save the center actor ID and the view object ID to a save file
-
-void saveCenterActor(SaveFileConstructor &saveGame) {
- CenterActorArchive a;
-
- // Store the center actor and view object
- a.centerActor = centerActor;
- a.viewCenterObject = viewCenterObject;
-
- saveGame.writeChunk(MakeID('C', 'N', 'T', 'R'), &a, sizeof(a));
-}
-
void saveCenterActor(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving CenterActor");
@@ -1176,19 +1069,6 @@ void saveCenterActor(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "... viewCenterObject = %d", viewCenterObject);
}
-//-----------------------------------------------------------------------
-// Load the center actor ID and the view object ID from the save file
-
-void loadCenterActor(SaveFileReader &saveGame) {
- CenterActorArchive a;
-
- saveGame.read(&a, sizeof(a));
-
- // Restore the center actor and view object
- centerActor = a.centerActor;
- viewCenterObject = a.viewCenterObject;
-}
-
void loadCenterActor(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading CenterActor");
diff --git a/engines/saga2/player.h b/engines/saga2/player.h
index b5abacd29a..056880eb9a 100644
--- a/engines/saga2/player.h
+++ b/engines/saga2/player.h
@@ -50,8 +50,6 @@ class PlayerActor {
friend class Actor;
friend void initPlayerActors(void);
- friend void savePlayerActors(SaveFileConstructor &);
- friend void loadPlayerActors(SaveFileReader &);
friend void cleanupPlayerActors(void);
ObjectID actorID; // ID of player's actor
@@ -296,13 +294,7 @@ void handleEndOfCombat(void);
// Initialize the player actor list
void initPlayerActors(void);
-
-// Store the player actor list in a save file
-void savePlayerActors(SaveFileConstructor &saveGame);
void savePlayerActors(Common::OutSaveFile *out);
-
-// Load the player list data from a save file
-void loadPlayerActors(SaveFileReader &saveGame);
void loadPlayerActors(Common::InSaveFile *in);
// Cleanup the player actor list
@@ -315,12 +307,7 @@ void cleanupPlayerActors(void);
// Initialize the center actor ID and view object ID
void initCenterActor(void);
-// Save the center actor ID and the view object ID to a save file
-void saveCenterActor(SaveFileConstructor &saveGame);
void saveCenterActor(Common::OutSaveFile *out);
-
-// Load the center actor ID and the view object ID from the save file
-void loadCenterActor(SaveFileReader &saveGame);
void loadCenterActor(Common::InSaveFile *in);
// Do nothing
diff --git a/engines/saga2/script.h b/engines/saga2/script.h
index 5b69c430bf..3eeb80e008 100644
--- a/engines/saga2/script.h
+++ b/engines/saga2/script.h
@@ -124,12 +124,7 @@ enum builtinTypes {
// Load the SAGA data segment from the resource file
void initSAGADataSeg(void);
-// Save the SAGA data segment to a save file
-void saveSAGADataSeg(SaveFileConstructor &saveGame);
void saveSAGADataSeg(Common::OutSaveFile *out);
-
-// Load the SAGA data segment from a save file
-void loadSAGADataSeg(SaveFileReader &saveGame);
void loadSAGADataSeg(Common::InSaveFile *in);
// Dispose of the SAGA data segment -- do nothing
@@ -144,12 +139,7 @@ class Thread;
// Initialize the SAGA thread list
void initSAGAThreads(void);
-// Save the active SAGA threads to a save file
-void saveSAGAThreads(SaveFileConstructor &saveGame);
void saveSAGAThreads(Common::OutSaveFile *out);
-
-// Load the active SAGA threads from a save file
-void loadSAGAThreads(SaveFileReader &saveGame);
void loadSAGAThreads(Common::InSaveFile *in, int32 chunkSize);
// Dispose of the active SAGA threads
diff --git a/engines/saga2/sensor.cpp b/engines/saga2/sensor.cpp
index ab48ff3594..8d4e92cf80 100644
--- a/engines/saga2/sensor.cpp
+++ b/engines/saga2/sensor.cpp
@@ -82,57 +82,6 @@ void deleteSensor(Sensor *p) {
g_vm->_sensorList.remove(p);
}
-//----------------------------------------------------------------------
-// Reconstruct a Sensor from an archive buffer
-
-void *constructSensor(int16 ctr, void *buf) {
- int16 type;
- Sensor *sensor = nullptr;
- SensorList *sl;
-
- // Get the sensor type
- type = *((int16 *)buf);
- buf = (int16 *)buf + 1;
-
- switch (type) {
- case protaganistSensor:
- sensor = new ProtaganistSensor(&buf, ctr);
- break;
-
- case specificObjectSensor:
- sensor = new SpecificObjectSensor(&buf, ctr);
- break;
-
- case objectPropertySensor:
- sensor = new ObjectPropertySensor(&buf, ctr);
- break;
-
- case specificActorSensor:
- sensor = new SpecificActorSensor(&buf, ctr);
- break;
-
- case actorPropertySensor:
- sensor = new ActorPropertySensor(&buf, ctr);
- break;
-
- case eventSensor:
- sensor = new EventSensor(&buf, ctr);
- break;
- }
-
- assert(sensor != nullptr);
-
- // Get the sensor list
- sl = fetchSensorList(sensor->getObject());
-
- assert(sl != nullptr);
-
- // Append this Sensor to the sensor list
- sl->_list.push_back(sensor);
-
- return buf;
-}
-
void readSensor(int16 ctr, Common::InSaveFile *in) {
int16 type;
Sensor *sensor = nullptr;
@@ -190,22 +139,6 @@ int32 sensorArchiveSize(Sensor *sensor) {
+ sensor->archiveSize();
}
-//----------------------------------------------------------------------
-// Archive the specified Sensor in an archive buffer
-
-void *archiveSensor(Sensor *sensor, void *buf) {
- assert(sensor != NULL);
-
- // Store the sensor type
- *((int16 *)buf) = sensor->getType();
- buf = (int16 *)buf + 1;
-
- // Let the sensor store its data in the buffer
- buf = sensor->archive(buf);
-
- return buf;
-}
-
void writeSensor(Sensor *sensor, Common::OutSaveFile *out) {
assert(sensor != NULL);
@@ -280,76 +213,6 @@ void initSensors(void) {
assert(sizeof(EventSensor) <= maxSensorSize);
}
-//----------------------------------------------------------------------
-// Save all active sensors in a save file
-
-void saveSensors(SaveFileConstructor &saveGame) {
- warning("STUB: saveSensort()");
-#if 0
- int16 g_vm->_sensorListCount = 0,
- sensorCount = 0;
-
- SensorListHolder *listHolder;
- SensorHolder *sensorHolder;
-
- void *archiveBuffer,
- *bufferPtr;
- int32 archiveBufSize = 0;
-
- // Add the sizes of the sensor list count an sensor count
- archiveBufSize += sizeof(g_vm->_sensorListCount) + sizeof(sensorCount);
-
- // Tally the sensor lists
- for (listHolder = (SensorListHolder *)g_vm->_sensorListList.first();
- listHolder != NULL;
- listHolder = (SensorListHolder *)listHolder->next())
- g_vm->_sensorListCount++;
-
- // Add the total archive size of all of the sensor lists
- archiveBufSize += g_vm->_sensorListCount * SensorList::archiveSize();
-
- // Tally the sensors and add the archive size of each
- for (Common::List<Sensor *>::iterator it = g_vm->_sensorList.begin(); it != g_vm->_sensorList.end(); ++it) {
- sensorCount++;
- archiveBufSize += sizeof((*it)->checkCtr) + sensorArchiveSize(*it);
- }
-
- // Allocate an archive buffer
- archiveBuffer = RNewPtr(archiveBufSize, NULL, "archive buffer");
- if (archiveBuffer == NULL)
- error("Unable to allocate sensor archive buffer");
-
- bufferPtr = archiveBuffer;
-
- // Store the sensor list count and sensor count
- *((int16 *)bufferPtr) = g_vm->_sensorListCount;
- *((int16 *)bufferPtr + 1) = sensorCount;
- bufferPtr = (int16 *)bufferPtr + 2;
-
- // Archive all sensor lists
- for (Common::List<SensorList *>::iterator it = g_vm->_sensorListList.begin(); it != g_vm->_sensorListList.end(); ++it) {
- bufferPtr = (*it)->archive(bufferPtr);
-
- // Archive all sensors
- for (Common::List<Sensor *>::iterator it = g_vm->_sensorList.begin(); it != g_vm->_sensorList.end(); ++it) {
- *((int16 *)bufferPtr) = (*it)->checkCtr;
- bufferPtr = (int16 *)bufferPtr + 1;
-
- bufferPtr = archiveSensor(*it, bufferPtr);
- }
-
- assert(bufferPtr == &((uint8 *)archiveBuffer)[archiveBufSize]);
-
- // Write the data to the save file
- saveGame.writeChunk(
- MakeID('S', 'E', 'N', 'S'),
- archiveBuffer,
- archiveBufSize);
-
- RDisposePtr(archiveBuffer);
-#endif
-}
-
static int getSensorListID(SensorList *t) {
int i = 0;
for (Common::List<SensorList *>::iterator it = g_vm->_sensorListList.begin(); it != g_vm->_sensorListList.end(); it++, i++) {
@@ -418,54 +281,6 @@ void saveSensors(Common::OutSaveFile *out) {
}
}
-//----------------------------------------------------------------------
-// Load sensors from a save file
-
-void loadSensors(SaveFileReader &saveGame) {
- warning("STUB: loadSensort()");
-#if 0
- int16 i,
- g_vm->_sensorListCount,
- sensorCount;
-
- void *archiveBuffer,
- *bufferPtr;
-
- // Allocate a buffer in which to read the archive data
- archiveBuffer = RNewPtr(saveGame.getChunkSize(), NULL, "archive buffer");
- if (archiveBuffer == NULL)
- error("Unable to allocate sensor archive buffer");
-
- // Read the data
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- // Get the sensor list count and sensor count
- g_vm->_sensorListCount = *((int16 *)bufferPtr);
- sensorCount = *((int16 *)bufferPtr + 1);
- bufferPtr = (int16 *)bufferPtr + 2;
-
- // Restore all sensor lists
- for (i = 0; i < g_vm->_sensorListCount; i++)
- new SensorList(&bufferPtr);
-
- // Restore all sensors
- for (i = 0; i < sensorCount; i++) {
- int16 ctr;
-
- ctr = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- bufferPtr = constructSensor(ctr, bufferPtr);
- }
-
- assert(bufferPtr == &((uint8 *)archiveBuffer)[saveGame.getChunkSize()]);
-
- RDisposePtr(archiveBuffer);
-#endif
-}
-
void loadSensors(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading Sensors");
@@ -531,21 +346,6 @@ SensorList *fetchSensorList(GameObject *obj) {
SensorList member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-SensorList::SensorList(void **buf) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
-
- assert(isObject(*bufferPtr) || isActor(*bufferPtr));
-
- obj = GameObject::objectAddress(*bufferPtr);
-
- *buf = bufferPtr + 1;
-
- newSensorList(this);
-}
-
SensorList::SensorList(Common::InSaveFile *in) {
ObjectID id = in->readUint16LE();
@@ -556,16 +356,6 @@ SensorList::SensorList(Common::InSaveFile *in) {
newSensorList(this);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *SensorList::archive(void *buf) {
- *((ObjectID *)buf) = obj->thisID();
- buf = (ObjectID *)buf + 1;
-
- return buf;
-}
-
void SensorList::write(Common::OutSaveFile *out) {
out->writeUint16LE(obj->thisID());
}
@@ -574,32 +364,6 @@ void SensorList::write(Common::OutSaveFile *out) {
Sensor member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-Sensor::Sensor(void **buf, int16 ctr) {
- void *bufferPtr = *buf;
-
- assert(isObject(*((ObjectID *)bufferPtr))
- || isActor(*((ObjectID *)bufferPtr)));
-
- // Restore the object pointer
- obj = GameObject::objectAddress(*((ObjectID *)bufferPtr));
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Restore the ID
- id = *((SensorID *)bufferPtr);
- bufferPtr = (SensorID *)bufferPtr + 1;
-
- // Restore the range
- range = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-
- newSensor(this, ctr);
-}
-
Sensor::Sensor(Common::InSaveFile *in, int16 ctr) {
ObjectID objID = in->readUint16LE();
@@ -626,25 +390,6 @@ inline int32 Sensor::archiveSize(void) {
+ sizeof(range);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *Sensor::archive(void *buf) {
- // Store the object's ID
- *((ObjectID *)buf) = obj->thisID();
- buf = (ObjectID *)buf + 1;
-
- // Store the sensor ID
- *((SensorID *)buf) = id;
- buf = (SensorID *)buf + 1;
-
- // Store the range
- *((int16 *)buf) = range;
- buf = (int16 *)buf + 1;
-
- return buf;
-}
-
void Sensor::write(Common::OutSaveFile *out) {
// Store the object's ID
out->writeUint16LE(obj->thisID());
@@ -796,19 +541,6 @@ bool ObjectSensor::evaluateEvent(const GameEvent &) {
SpecificObjectSensor member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-SpecificObjectSensor::SpecificObjectSensor(void **buf, int16 ctr) :
- ObjectSensor(buf, ctr) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
-
- // Restore the sought object's ID
- soughtObjID = *bufferPtr++;
-
- *buf = bufferPtr;
-}
-
SpecificObjectSensor::SpecificObjectSensor(Common::InSaveFile *in, int16 ctr) :
ObjectSensor(in, ctr) {
debugC(3, kDebugSaveload, "Loading SpecificObjectSensor");
@@ -824,20 +556,6 @@ inline int32 SpecificObjectSensor::archiveSize(void) {
return ObjectSensor::archiveSize() + sizeof(soughtObjID);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *SpecificObjectSensor::archive(void *buf) {
- // Let the base class archive its data
- buf = ObjectSensor::archive(buf);
-
- // Store the sought object's ID
- *((ObjectID *)buf) = soughtObjID;
- buf = (ObjectID *)buf + 1;
-
- return buf;
-}
-
void SpecificObjectSensor::write(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "Saving SpecificObjectSensor");
@@ -908,19 +626,6 @@ bool SpecificObjectSensor::isObjectSought(GameObject *obj_) {
ObjectPropertySensor member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-ObjectPropertySensor::ObjectPropertySensor(void **buf, int16 ctr) :
- ObjectSensor(buf, ctr) {
- ObjectPropertyID *bufferPtr = (ObjectPropertyID *)*buf;
-
- // Restore the object property ID
- objectProperty = *bufferPtr++;
-
- *buf = bufferPtr;
-}
-
ObjectPropertySensor::ObjectPropertySensor(Common::InSaveFile *in, int16 ctr) :
ObjectSensor(in, ctr) {
debugC(3, kDebugSaveload, "Loading ObjectPropertySensor");
@@ -936,20 +641,6 @@ inline int32 ObjectPropertySensor::archiveSize(void) {
return ObjectSensor::archiveSize() + sizeof(objectProperty);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *ObjectPropertySensor::archive(void *buf) {
- // Let the base class archive its data
- buf = ObjectSensor::archive(buf);
-
- // Store the object property's ID
- *((ObjectPropertyID *)buf) = objectProperty;
- buf = (ObjectPropertyID *)buf + 1;
-
- return buf;
-}
-
void ObjectPropertySensor::write(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "Saving ObjectPropertySensor");
@@ -994,20 +685,6 @@ bool ActorSensor::isObjectSought(GameObject *obj_) {
SpecificActorSensor member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-SpecificActorSensor::SpecificActorSensor(void **buf, int16 ctr) : ActorSensor(buf, ctr) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
-
- assert(isActor(*bufferPtr));
-
- // Restore the sought actor pointer
- soughtActor = (Actor *)GameObject::objectAddress(*bufferPtr++);
-
- *buf = bufferPtr;
-}
-
SpecificActorSensor::SpecificActorSensor(Common::InSaveFile *in, int16 ctr) : ActorSensor(in, ctr) {
debugC(3, kDebugSaveload, "Loading SpecificActorSensor");
ObjectID actorID = in->readUint16LE();
@@ -1025,20 +702,6 @@ inline int32 SpecificActorSensor::archiveSize(void) {
return ActorSensor::archiveSize() + sizeof(ObjectID);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *SpecificActorSensor::archive(void *buf) {
- // Let the base class archive its data
- buf = ActorSensor::archive(buf);
-
- // Store the sought actor's ID
- *((ObjectID *)buf) = soughtActor->thisID();
- buf = (ObjectID *)buf + 1;
-
- return buf;
-}
-
void SpecificActorSensor::write(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "Saving SpecificActorSensor");
@@ -1100,18 +763,6 @@ bool SpecificActorSensor::isActorSought(Actor *a) {
ActorPropertySensor member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-ActorPropertySensor::ActorPropertySensor(void **buf, int16 ctr) : ActorSensor(buf, ctr) {
- ActorPropertyID *bufferPtr = (ActorPropertyID *)*buf;
-
- // Restore the actor property's ID
- actorProperty = *bufferPtr++;
-
- *buf = bufferPtr;
-}
-
ActorPropertySensor::ActorPropertySensor(Common::InSaveFile *in, int16 ctr) : ActorSensor(in, ctr) {
debugC(3, kDebugSaveload, "Loading ActorPropertySensor");
// Restore the actor property's ID
@@ -1125,20 +776,6 @@ inline int32 ActorPropertySensor::archiveSize(void) {
return ActorSensor::archiveSize() + sizeof(actorProperty);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *ActorPropertySensor::archive(void *buf) {
- // Let the base class archive its data
- buf = ActorSensor::archive(buf);
-
- // Store the actor property's ID
- *((ActorPropertyID *)buf) = actorProperty;
- buf = (ActorPropertyID *)buf + 1;
-
- return buf;
-}
-
void ActorPropertySensor::write(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "Saving ActorPropertySensor");
@@ -1179,18 +816,6 @@ EventSensor::EventSensor(
eventType(type) {
}
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-EventSensor::EventSensor(void **buf, int16 ctr) : Sensor(buf, ctr) {
- int16 *bufferPtr = (int16 *)*buf;
-
- // Restore the event type
- eventType = *bufferPtr++;
-
- *buf = bufferPtr;
-}
-
EventSensor::EventSensor(Common::InSaveFile *in, int16 ctr) : Sensor(in, ctr) {
debugC(3, kDebugSaveload, "Loading EventSensor");
// Restore the event type
@@ -1204,20 +829,6 @@ inline int32 EventSensor::archiveSize(void) {
return Sensor::archiveSize() + sizeof(eventType);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *EventSensor::archive(void *buf) {
- // Let the base class archive its data
- buf = Sensor::archive(buf);
-
- // Store the event type
- *((int16 *)buf) = eventType;
- buf = (int16 *)buf + 1;
-
- return buf;
-}
-
void EventSensor::write(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "Saving EventSensor");
diff --git a/engines/saga2/sensor.h b/engines/saga2/sensor.h
index 3f704c9bb7..293936b76a 100644
--- a/engines/saga2/sensor.h
+++ b/engines/saga2/sensor.h
@@ -79,11 +79,7 @@ void assertEvent(const GameEvent &ev);
// Initialize the sensors
void initSensors(void);
-// Save all active sensors in a save file
-void saveSensors(SaveFileConstructor &saveGame);
void saveSensors(Common::OutSaveFile *out);
-// Load sensors from a save file
-void loadSensors(SaveFileReader &saveGame);
void loadSensors(Common::InSaveFile *in);
// Cleanup the active sensors
void cleanupSensors(void);
@@ -130,9 +126,6 @@ public:
deleteSensorList(this);
}
- // Constructor -- reconstruct from archive buffer
- SensorList(void **buf);
-
SensorList(Common::InSaveFile *in);
// Return the number of bytes needed to archive this object in
@@ -141,9 +134,6 @@ public:
return sizeof(ObjectID);
}
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
GameObject *getObject(void) {
@@ -171,9 +161,6 @@ public:
newSensor(this);
}
- // Constructor -- reconstruct from an archive buffer
- Sensor(void **buf, int16 ctr);
-
Sensor(Common::InSaveFile *in, int16 ctr);
// Virtural destructor
@@ -187,9 +174,6 @@ public:
// a buffer
virtual int32 archiveSize(void);
- // Archive this object in a buffer
- virtual void *archive(void *buf);
-
virtual void write(Common::OutSaveFile *out);
// Return an integer representing the type of this sensor
@@ -223,9 +207,6 @@ public:
Sensor(o, sensorID, rng) {
}
- // Constructor -- reconstruct from an archive buffer
- ProtaganistSensor(void **buf, int16 ctr) : Sensor(buf, ctr) {}
-
ProtaganistSensor(Common::InSaveFile *in, int16 ctr) : Sensor(in, ctr) {
debugC(3, kDebugSaveload, "Loading ProtagonistSensor");
}
@@ -251,9 +232,6 @@ public:
Sensor(o, sensorID, rng) {
}
- // Constructor -- reconstruct from an archive buffer
- ObjectSensor(void **buf, int16 ctr) : Sensor(buf, ctr) {}
-
ObjectSensor(Common::InSaveFile *in, int16 ctr) : Sensor(in, ctr) {}
// Determine if the object can sense what it's looking for
@@ -285,18 +263,12 @@ public:
soughtObjID(objToSense) {
}
- // Constructor -- reconstruct from an archive buffer
- SpecificObjectSensor(void **buf, int16 ctr);
-
SpecificObjectSensor(Common::InSaveFile *in, int16 ctr);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void);
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Return an integer representing the type of this sensor
@@ -328,18 +300,12 @@ public:
objectProperty(propToSense) {
}
- // Constructor -- reconstruct from an archive buffer
- ObjectPropertySensor(void **buf, int16 ctr);
-
ObjectPropertySensor(Common::InSaveFile *in, int16 ctr);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void);
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Return an integer representing the type of this sensor
@@ -361,9 +327,6 @@ public:
ObjectSensor(o, sensorID, rng) {
}
- // Constructor -- reconstruct from an archive buffer
- ActorSensor(void **buf, int16 ctr) : ObjectSensor(buf, ctr) {}
-
ActorSensor(Common::InSaveFile *in, int16 ctr) : ObjectSensor(in, ctr) {}
private:
@@ -392,18 +355,12 @@ public:
soughtActor(actorToSense) {
}
- // Constructor -- reconstruct from an archive buffer
- SpecificActorSensor(void **buf, int16 ctr);
-
SpecificActorSensor(Common::InSaveFile *in, int16 ctr);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void);
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Return an integer representing the type of this sensor
@@ -435,18 +392,12 @@ public:
actorProperty(propToSense) {
}
- // Constructor -- reconstruct from an archive buffer
- ActorPropertySensor(void **buf, int16 ctr);
-
ActorPropertySensor(Common::InSaveFile *in, int16 ctr);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void);
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Return an integer representing the type of this sensor
@@ -472,18 +423,12 @@ public:
int16 rng,
int16 type);
- // Constructor -- reconstruct from an archive buffer
- EventSensor(void **buf, int16 ctr);
-
EventSensor(Common::InSaveFile *in, int16 ctr);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void);
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Return an integer representing the type of this sensor
diff --git a/engines/saga2/speech.cpp b/engines/saga2/speech.cpp
index 7e083acf93..d6c573a99c 100644
--- a/engines/saga2/speech.cpp
+++ b/engines/saga2/speech.cpp
@@ -132,59 +132,6 @@ inline uint32 extendID(int16 smallID) {
Speech member functions
* ===================================================================== */
-//-----------------------------------------------------------------------
-// Reconstruct this SpeechTask from an archive buffer
-
-void *Speech::restore(void *buf) {
- int16 i;
-
- // Restore the sample count and character count
- sampleCount = *((int16 *)buf);
- charCount = *((int16 *)buf + 1);
- buf = (int16 *)buf + 2;
-
- // Restore the text boundaries
- bounds = *((Rect16 *)buf);
- buf = (Rect16 *)buf + 1;
-
- // Restore the pen color and outline color
- penColor = *((uint16 *)buf);
- outlineColor = *((uint16 *)buf + 1);
- buf = (uint16 *)buf + 2;
-
- // Restore the object ID
- objID = *((ObjectID *)buf);
- buf = (ObjectID *)buf + 1;
-
- // Restore the thread ID
- thread = *((ThreadID *)buf);
- buf = (ThreadID *)buf + 1;
-
- // Restore the flags
- speechFlags = *((int16 *)buf);
- buf = (int16 *)buf + 1;
-
- // Restore the sample ID's
- for (i = 0; i < sampleCount; i++) {
- sampleID[i] = *((uint32 *)buf);
- buf = (uint32 *)buf + 1;
- }
-
- // Restore the text
- memcpy(speechBuffer, buf, charCount);
- buf = (char *)buf + charCount;
- speechBuffer[charCount] = '\0';
-
- // Requeue the speech if needed
- if (speechFlags & spQueued) {
- // Add to the active list
- speechList.remove(this);
- speechList._list.push_back(this);
- }
-
- return buf;
-}
-
void Speech::read(Common::InSaveFile *in) {
// Restore the sample count and character count
sampleCount = in->readSint16LE();
@@ -251,51 +198,6 @@ int32 Speech::archiveSize(void) {
+ sizeof(char) * charCount;
}
-//-----------------------------------------------------------------------
-// Archive this SpeechTask in a buffer
-
-void *Speech::archive(void *buf) {
- int16 i;
-
- // Store the sample count and character count
- *((int16 *)buf) = sampleCount;
- *((int16 *)buf + 1) = charCount;
- buf = (int16 *)buf + 2;
-
- // Store the text boundaries
- *((Rect16 *)buf) = bounds;
- buf = (Rect16 *)buf + 1;
-
- // Store the pen color and outline color
- *((uint16 *)buf) = penColor;
- *((uint16 *)buf + 1) = outlineColor;
- buf = (uint16 *)buf + 2;
-
- // Store the object's ID
- *((ObjectID *)buf) = objID;
- buf = (ObjectID *)buf + 1;
-
- // Store the thread ID
- *((ThreadID *)buf) = thread;
- buf = (ThreadID *)buf + 1;
-
- // Store the flags. NOTE: Make sure this speech is not stored
- // as being active
- *((int16 *)buf) = speechFlags & ~spActive;
- buf = (int16 *)buf + 1;
-
- for (i = 0; i < sampleCount; i++) {
- *((uint32 *)buf) = sampleID[i];
- buf = (uint32 *)buf + 1;
- }
-
- // Store the text
- memcpy(buf, speechBuffer, charCount);
- buf = (char *)buf + charCount;
-
- return buf;
-}
-
void Speech::write(Common::OutSaveFile *out) {
// Store the sample count and character count
out->writeSint16LE(sampleCount);
@@ -1028,33 +930,6 @@ SpeechTaskList::SpeechTaskList(void) {
lockFlag = false;
}
-//-----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-SpeechTaskList::SpeechTaskList(void **buf) {
- void *bufferPtr = *buf;
-
- int16 i,
- count;
-
- lockFlag = false;
-
- // Get the speech count
- count = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- // Restore the speeches
- for (i = 0; i < count; i++) {
- Speech *sp = new Speech;
- assert(sp != NULL);
-
- _inactiveList.push_back(sp);
- bufferPtr = sp->restore(bufferPtr);
- }
-
- *buf = bufferPtr;
-}
-
SpeechTaskList::SpeechTaskList(Common::InSaveFile *in) {
int16 count;
@@ -1096,33 +971,6 @@ int32 SpeechTaskList::archiveSize(void) {
return size;
}
-//-----------------------------------------------------------------------
-// Create an archive of the speech tasks in an archive buffer
-
-void *SpeechTaskList::archive(void *buf) {
- int16 count = 0;
-
- count += _list.size() + _inactiveList.size();
-
- // Store speech count
- *((int16 *)buf) = count;
- buf = (int16 *)buf + 1;
-
- // Store active speeches
- for (Common::List<Speech *>::iterator it = _list.begin();
- it != _list.end(); ++it) {
- buf = (*it)->archive(buf);
- }
-
- // Store inactive speeches
- for (Common::List<Speech *>::iterator it = _inactiveList.begin();
- it != _inactiveList.end(); ++it) {
- buf = (*it)->archive(buf);
- }
-
- return buf;
-}
-
void SpeechTaskList::write(Common::OutSaveFile *out) {
int i = 0;
int16 count = 0;
@@ -1297,29 +1145,6 @@ void initSpeechTasks(void) {
new (&speechList) SpeechTaskList;
}
-//-----------------------------------------------------------------------
-// Save the speech tasks in a save file
-
-void saveSpeechTasks(SaveFileConstructor &saveGame) {
- int32 archiveBufSize;
- void *archiveBuffer;
-
- archiveBufSize = speechList.archiveSize();
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate speech task archive buffer");
-
- speechList.archive(archiveBuffer);
-
- saveGame.writeChunk(
- MakeID('S', 'P', 'C', 'H'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveSpeechTasks(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Speech Tasks");
@@ -1333,34 +1158,6 @@ void saveSpeechTasks(Common::OutSaveFile *out) {
speechList.write(out);
}
-//-----------------------------------------------------------------------
-// Load the speech tasks from a save file
-
-void loadSpeechTasks(SaveFileReader &saveGame) {
- // If there is no saved data, simply call the default constructor
- if (saveGame.getChunkSize() == 0) {
- new (&speechList) SpeechTaskList;
- return;
- }
-
- void *archiveBuffer;
- void *bufferPtr;
-
- archiveBuffer = malloc(saveGame.getChunkSize());
- if (archiveBuffer == NULL)
- error("Unable to allocate speech task archive buffer");
-
- // Read the archived task stack data
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- // Reconstruct stackList from archived data
- new (&speechList) SpeechTaskList(&bufferPtr);
-
- free(archiveBuffer);
-}
-
void loadSpeechTasks(Common::InSaveFile *in, int32 chunkSize) {
debugC(2, kDebugSaveload, "Loading Speech Tasks");
diff --git a/engines/saga2/speech.h b/engines/saga2/speech.h
index 94d40f1f4d..be127bc6fd 100644
--- a/engines/saga2/speech.h
+++ b/engines/saga2/speech.h
@@ -232,11 +232,7 @@ extern SpeechTaskList &speechList;
void initSpeechTasks(void);
// Save the speech tasks in a save file
-void saveSpeechTasks(SaveFileConstructor &saveGame);
void saveSpeechTasks(Common::OutSaveFile *out);
-
-// Load the speech tasks from a save file
-void loadSpeechTasks(SaveFileReader &saveGame);
void loadSpeechTasks(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the speech task list
diff --git a/engines/saga2/spellio.cpp b/engines/saga2/spellio.cpp
index 39b5eb0afa..3dd107a135 100644
--- a/engines/saga2/spellio.cpp
+++ b/engines/saga2/spellio.cpp
@@ -216,26 +216,12 @@ void SpellStuff::addEffect(ResourceSpellEffect *rse) {
void initSpellState(void) {
}
-// ------------------------------------------------------------------
-// serialize active spells
-
-void saveSpellState(SaveFileConstructor &saveGame) {
- activeSpells.save(saveGame);
-}
-
void saveSpellState(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving SpellState");
activeSpells.write(out);
}
-// ------------------------------------------------------------------
-// read serialized active spells
-
-void loadSpellState(SaveFileReader &saveGame) {
- activeSpells.load(saveGame);
-}
-
void loadSpellState(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading SpellState");
@@ -394,21 +380,6 @@ size_t SpellDisplayList::saveSize(void) {
return total;
}
-void SpellDisplayList::save(SaveFileConstructor &saveGame) {
- size_t chunkSize = saveSize();
-
- saveGame.newChunk(spellInstCountID, chunkSize);
-
- saveGame.write(&count, sizeof(count));
- if (count) {
- for (int i = 0; i < count; i++) {
- StorageSpellInstance ssi = StorageSpellInstance(*spells[i]);
- saveGame.write(&ssi, sizeof(ssi));
- spells[i]->saveEffect(saveGame);
- }
- }
-}
-
void SpellDisplayList::write(Common::OutSaveFile *out) {
size_t chunkSize = saveSize();
@@ -429,24 +400,6 @@ void SpellDisplayList::write(Common::OutSaveFile *out) {
}
}
-void SpellDisplayList::load(SaveFileReader &saveGame) {
- uint16 tCount;
-
- saveGame.read(&tCount, sizeof(tCount));
- assert(tCount < maxCount);
- if (tCount) {
- for (int i = 0; i < tCount; i++) {
- SpellInstance *si;
- StorageSpellInstance ssi;
- saveGame.read(&ssi, sizeof(ssi));
- si = new SpellInstance(ssi);
- add(si);
- si->loadEffect(saveGame, ssi.eListSize);
- }
- }
- assert(tCount == count);
-}
-
void SpellDisplayList::read(Common::InSaveFile *in) {
uint16 tCount;
@@ -490,14 +443,6 @@ size_t SpellInstance::saveSize(void) {
return total;
}
-void SpellInstance::saveEffect(SaveFileConstructor &saveGame) {
- if (eList.count > 0 && !(maxAge > 0 && (age + 1) > maxAge))
- for (int32 i = 0; i < eList.count; i++) {
- StorageEffectron se = StorageEffectron(*eList.displayList[i].efx);
- saveGame.write(&se, sizeof(se));
- }
-}
-
void SpellInstance::writeEffect(Common::OutSaveFile *out) {
if (eList.count > 0 && !(maxAge > 0 && (age + 1) > maxAge))
for (int32 i = 0; i < eList.count; i++) {
@@ -506,18 +451,6 @@ void SpellInstance::writeEffect(Common::OutSaveFile *out) {
}
}
-void SpellInstance::loadEffect(SaveFileReader &saveGame, uint16 eListSize) {
- assert(eListSize == effect->nodeCount);
- eList.count = effect->nodeCount; //sdp->effCount;
- if (eList.count)
- for (int32 i = 0; i < eList.count; i++) {
- StorageEffectron se;
- saveGame.read(&se, sizeof(se));
- Effectron *e = new Effectron(se, this);
- eList.displayList[i].efx = e;
- }
-}
-
void SpellInstance::readEffect(Common::InSaveFile *in, uint16 eListSize) {
assert(eListSize == effect->nodeCount);
eList.count = effect->nodeCount; //sdp->effCount;
diff --git a/engines/saga2/spelshow.h b/engines/saga2/spelshow.h
index 6812bfa9ba..9222048443 100644
--- a/engines/saga2/spelshow.h
+++ b/engines/saga2/spelshow.h
@@ -315,9 +315,7 @@ public:
void init(void);
void initEffect(TilePoint);
- void loadEffect(SaveFileReader &saveGame, uint16 eListSize);
void readEffect(Common::InSaveFile *in, uint16 eListSize);
- void saveEffect(SaveFileConstructor &saveGame);
void writeEffect(Common::OutSaveFile *out);
void termEffect(void);
size_t saveSize(void);
@@ -351,9 +349,7 @@ public :
void buildList(void);
void updateStates(int32 deltaTime);
- void save(SaveFileConstructor &saveGame);
void write(Common::OutSaveFile *out);
- void load(SaveFileReader &saveGame);
void read(Common::InSaveFile *in);
void wipe(void);
size_t saveSize(void);
diff --git a/engines/saga2/target.cpp b/engines/saga2/target.cpp
index dddb2d49d4..460f79922e 100644
--- a/engines/saga2/target.cpp
+++ b/engines/saga2/target.cpp
@@ -43,52 +43,6 @@ void deleteTarget(Target *t) {
if (t) delete t;
}
-void *constructTarget(void *mem, void *buf) {
- int16 type = *((int16 *)buf);
-
- buf = (int16 *)buf + 1;
-
- switch (type) {
- case locationTarget:
- new (mem) LocationTarget(&buf);
- break;
-
- case specificTileTarget:
- new (mem) SpecificTileTarget(&buf);
- break;
-
- case tilePropertyTarget:
- new (mem) TilePropertyTarget(&buf);
- break;
-
- case specificMetaTileTarget:
- new (mem) SpecificMetaTileTarget(&buf);
- break;
-
- case metaTilePropertyTarget:
- new (mem) MetaTilePropertyTarget(&buf);
- break;
-
- case specificObjectTarget:
- new (mem) SpecificObjectTarget(&buf);
- break;
-
- case objectPropertyTarget:
- new (mem) ObjectPropertyTarget(&buf);
- break;
-
- case specificActorTarget:
- new (mem) SpecificActorTarget(&buf);
- break;
-
- case actorPropertyTarget:
- new (mem) ActorPropertyTarget(&buf);
- break;
- }
-
- return buf;
-}
-
void readTarget(void *mem, Common::InSaveFile *in) {
int16 type = in->readSint16LE();
@@ -141,16 +95,6 @@ int32 targetArchiveSize(const Target *t) {
return sizeof(int16) + t->archiveSize();
}
-void *archiveTarget(const Target *t, void *buf) {
- *((int16 *)buf) = t->getType();
- buf = (int16 *)buf + 1;
-
- buf = t->archive(buf);
-
- return buf;
-}
-
-
// Insert a location into a TargetLocationArray, using a simple
// insertion sort
void insertLocation(
@@ -205,18 +149,6 @@ bool Target::isActorTarget(void) const {
LocationTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-LocationTarget::LocationTarget(void **buf) {
- TilePoint *bufferPtr = (TilePoint *)*buf;
-
- // Restore the targe location
- loc = *bufferPtr;
-
- *buf = &bufferPtr[1];
-}
-
LocationTarget::LocationTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... LocationTarget");
@@ -232,16 +164,6 @@ inline int32 LocationTarget::archiveSize(void) const {
return sizeof(loc);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *LocationTarget::archive(void *buf) const {
- // Store the target location
- *((TilePoint *)buf) = loc;
-
- return (TilePoint *)buf + 1;
-}
-
void LocationTarget::write(Common::OutSaveFile *out) const {
// Store the target location
loc.write(out);
@@ -411,18 +333,6 @@ int16 TileTarget::where(
SpecificTileTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-SpecificTileTarget::SpecificTileTarget(void **buf) {
- TileID *bufferPtr = (TileID *)*buf;
-
- // Restore the tile ID
- tile = *bufferPtr++;
-
- *buf = bufferPtr;
-}
-
SpecificTileTarget::SpecificTileTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... SpecificTileTarget");
@@ -438,16 +348,6 @@ inline int32 SpecificTileTarget::archiveSize(void) const {
return sizeof(tile);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *SpecificTileTarget::archive(void *buf) const {
- // Store the tile ID
- *((TileID *)buf) = tile;
-
- return (TileID *)buf + 1;
-}
-
void SpecificTileTarget::write(Common::OutSaveFile *out) const {
// Store the tile ID
out->writeUint16LE(tile);
@@ -493,18 +393,6 @@ bool SpecificTileTarget::isTarget(StandingTileInfo &sti) const {
TilePropertyTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-TilePropertyTarget::TilePropertyTarget(void **buf) {
- TilePropertyID *bufferPtr = (TilePropertyID *)*buf;
-
- // Restore the TilePropertyID
- tileProp = *bufferPtr;
-
- *buf = &bufferPtr[1];
-}
-
TilePropertyTarget::TilePropertyTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... TilePropertyTarget");
@@ -520,15 +408,6 @@ inline int32 TilePropertyTarget::archiveSize(void) const {
return sizeof(tileProp);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *TilePropertyTarget::archive(void *buf) const {
- *((TilePropertyID *)buf) = tileProp;
-
- return (TilePropertyID *)buf + 1;
-}
-
void TilePropertyTarget::write(Common::OutSaveFile *out) const {
out->writeSint16LE(tileProp);
}
@@ -682,19 +561,6 @@ int16 MetaTileTarget::where(
SpecificMetaTileTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-SpecificMetaTileTarget::SpecificMetaTileTarget(void **buf) {
- MetaTileID *bufferPtr = (MetaTileID *)*buf;
-
- // Restore the MetaTileID
- meta.map = bufferPtr->map;
- meta.index = bufferPtr->index;
-
- *buf = &bufferPtr[1];
-}
-
SpecificMetaTileTarget::SpecificMetaTileTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... SpecificMetaTileTarget");
@@ -711,19 +577,6 @@ inline int32 SpecificMetaTileTarget::archiveSize(void) const {
return sizeof(MetaTileID);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *SpecificMetaTileTarget::archive(void *buf) const {
- MetaTileID *bufferPtr = (MetaTileID *)buf;
-
- // Store the MetaTileID
- bufferPtr->map = meta.map;
- bufferPtr->index = meta.index;
-
- return &bufferPtr[1];
-}
-
void SpecificMetaTileTarget::write(Common::OutSaveFile *out) const {
// Store the MetaTileID
out->writeSint16LE(meta.map);
@@ -773,18 +626,6 @@ bool SpecificMetaTileTarget::isTarget(
MetaTilePropertyTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-MetaTilePropertyTarget::MetaTilePropertyTarget(void **buf) {
- MetaTilePropertyID *bufferPtr = (MetaTilePropertyID *)*buf;
-
- // Restore the MetaTilePropertyID
- metaProp = *bufferPtr;
-
- *buf = &bufferPtr[1];
-}
-
MetaTilePropertyTarget::MetaTilePropertyTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... MetaTilePropertyTarget");
@@ -800,16 +641,6 @@ inline int32 MetaTilePropertyTarget::archiveSize(void) const {
return sizeof(metaProp);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *MetaTilePropertyTarget::archive(void *buf) const {
- // Store the MetaTilePropertyID
- *((MetaTilePropertyID *)buf) = metaProp;
-
- return (MetaTilePropertyID *)buf + 1;
-}
-
void MetaTilePropertyTarget::write(Common::OutSaveFile *out) const {
// Store the MetaTilePropertyID
out->writeSint16LE(metaProp);
@@ -1070,18 +901,6 @@ int16 ObjectTarget::object(
SpecificObjectTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-SpecificObjectTarget::SpecificObjectTarget(void **buf) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
-
- // Restore the ObjectID
- obj = *bufferPtr;
-
- *buf = &bufferPtr[1];
-}
-
SpecificObjectTarget::SpecificObjectTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... SpecificObjectTarget");
@@ -1097,16 +916,6 @@ inline int32 SpecificObjectTarget::archiveSize(void) const {
return sizeof(obj);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *SpecificObjectTarget::archive(void *buf) const {
- // Store the ObjectID
- *((ObjectID *)buf) = obj;
-
- return (ObjectID *)buf + 1;
-}
-
void SpecificObjectTarget::write(Common::OutSaveFile *out) const {
// Store the ObjectID
out->writeUint16LE(obj);
@@ -1243,18 +1052,6 @@ int16 SpecificObjectTarget::object(
ObjectPropertyTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-ObjectPropertyTarget::ObjectPropertyTarget(void **buf) {
- ObjectPropertyID *bufferPtr = (ObjectPropertyID *)*buf;
-
- // Restore the ObjectPropertyID
- objProp = *bufferPtr;
-
- *buf = &bufferPtr[1];
-}
-
ObjectPropertyTarget::ObjectPropertyTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... ObjectPropertyTarget");
@@ -1270,16 +1067,6 @@ inline int32 ObjectPropertyTarget::archiveSize(void) const {
return sizeof(objProp);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *ObjectPropertyTarget::archive(void *buf) const {
- // Store the ObjectPropertyID
- *((ObjectPropertyID *)buf) = objProp;
-
- return (ObjectPropertyID *)buf + 1;
-}
-
void ObjectPropertyTarget::write(Common::OutSaveFile *out) const {
// Store the ObjectPropertyID
out->writeSint16LE(objProp);
@@ -1357,24 +1144,6 @@ int16 ActorTarget::actor(
SpecificActorTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-SpecificActorTarget::SpecificActorTarget(void **buf) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
- ObjectID actorID;
-
- // Get the actor's ID
- actorID = *bufferPtr;
-
- // Convert the actor ID into an Actor pointer
- a = actorID != Nothing
- ? (Actor *)GameObject::objectAddress(actorID)
- : NULL;
-
- *buf = bufferPtr + 1;
-}
-
SpecificActorTarget::SpecificActorTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... SpecificActorTarget");
@@ -1397,19 +1166,6 @@ inline int32 SpecificActorTarget::archiveSize(void) const {
return sizeof(ObjectID);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *SpecificActorTarget::archive(void *buf) const {
- // Convert the actor pointer to an actor ID;
- ObjectID actorID = a != NULL ? a->thisID() : Nothing;
-
- // Store the actor ID
- *((ObjectID *)buf) = actorID;
-
- return (ObjectID *)buf + 1;
-}
-
void SpecificActorTarget::write(Common::OutSaveFile *out) const {
// Convert the actor pointer to an actor ID;
ObjectID actorID = a != NULL ? a->thisID() : Nothing;
@@ -1579,18 +1335,6 @@ int16 SpecificActorTarget::actor(
ActorPropertyTarget member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-ActorPropertyTarget::ActorPropertyTarget(void **buf) {
- ActorPropertyID *bufferPtr = (ActorPropertyID *)*buf;
-
- // Restore the ActorPropertyID
- actorProp = *bufferPtr;
-
- *buf = &bufferPtr[1];
-}
-
ActorPropertyTarget::ActorPropertyTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... ActorPropertyTarget");
@@ -1606,16 +1350,6 @@ inline int32 ActorPropertyTarget::archiveSize(void) const {
return sizeof(actorProp);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in the specified buffer
-
-void *ActorPropertyTarget::archive(void *buf) const {
- // Store the ActorPropertyID
- *((ActorPropertyID *)buf) = actorProp;
-
- return (ActorPropertyID *)buf + 1;
-}
-
void ActorPropertyTarget::write(Common::OutSaveFile *out) const {
// Store the ActorPropertyID
out->writeSint16LE(actorProp);
diff --git a/engines/saga2/target.h b/engines/saga2/target.h
index 7e3033f4ef..3887b8d9eb 100644
--- a/engines/saga2/target.h
+++ b/engines/saga2/target.h
@@ -56,11 +56,9 @@ class Target;
// Deletes targets allocated on the heap using new
void deleteTarget(Target *t);
-void *constructTarget(void *mem, void *buf);
void readTarget(void *mem, Common::InSaveFile *in);
void writeTarget(const Target *t, Common::OutSaveFile *out);
int32 targetArchiveSize(const Target *t);
-void *archiveTarget(const Target *t, void *buf);
/* ===================================================================== *
TargetLocationArray structure
@@ -144,9 +142,6 @@ public:
// a buffer
virtual int32 archiveSize(void) const = 0;
- // Create an archive of this object in the specified buffer
- virtual void *archive(void *buf) const = 0;
-
virtual void write(Common::OutSaveFile *out) const = 0;
// Return an integer representing the type of target
@@ -193,18 +188,12 @@ public:
// Constructor -- initial construction
LocationTarget(const TilePoint &tp) : loc(tp) {}
- // Constructor -- reconstruct from archive buffer
- LocationTarget(void **buf);
-
LocationTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
@@ -261,18 +250,12 @@ public:
// Constructor -- initial construction
SpecificTileTarget(TileID t) : tile(t) {}
- // Constructor -- reconstruct from archive buffer
- SpecificTileTarget(void **buf);
-
SpecificTileTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
@@ -301,18 +284,12 @@ public:
// Constructor -- initial construction
TilePropertyTarget(TilePropertyID tProp) : tileProp(tProp) {}
- // Constructor -- reconstruct from archive buffer
- TilePropertyTarget(void **buf);
-
TilePropertyTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
@@ -359,18 +336,12 @@ public:
// Constructor -- initial construction
SpecificMetaTileTarget(MetaTileID mt) : meta(mt) {}
- // Constructor -- reconstruct from archive buffer
- SpecificMetaTileTarget(void **buf);
-
SpecificMetaTileTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
@@ -401,18 +372,12 @@ public:
metaProp(mtProp) {
}
- // Constructor -- reconstruct from archive buffer
- MetaTilePropertyTarget(void **buf);
-
MetaTilePropertyTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
@@ -487,18 +452,12 @@ public:
obj((assert(isObject(ptr)), ptr->thisID())) {
}
- // Constructor -- reconstruct from archive buffer
- SpecificObjectTarget(void **buf);
-
SpecificObjectTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
@@ -544,18 +503,12 @@ public:
// Constructor -- initial construction
ObjectPropertyTarget(ObjectPropertyID prop) : objProp(prop) {}
- // Constructor -- reconstruct from archive buffer
- ObjectPropertyTarget(void **buf);
-
ObjectPropertyTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
@@ -605,18 +558,12 @@ public:
a(actor_) {
}
- // Constructor -- reconstruct from archive buffer
- SpecificActorTarget(void **buf);
-
SpecificActorTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
@@ -670,18 +617,12 @@ public:
actorProp(aProp) {
}
- // Constructor -- reconstruct from archive buffer
- ActorPropertyTarget(void **buf);
-
ActorPropertyTarget(Common::SeekableReadStream *stream);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in the specified buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of target
diff --git a/engines/saga2/task.cpp b/engines/saga2/task.cpp
index b6580c4d56..4d296305f4 100644
--- a/engines/saga2/task.cpp
+++ b/engines/saga2/task.cpp
@@ -46,16 +46,12 @@ bool actorTasksPaused;
Prototypes
* ===================================================================== */
-// Reconstruct a Task from an archive buffer
-void *constructTask(TaskID id, void *buf);
void readTask(TaskID id, Common::InSaveFile *in);
// Return the number of bytes necessary to create an archive of the
// specified Task
int32 taskArchiveSize(Task *t);
-// Create an archive of the specified Task in the specified buffer
-void *archiveTask(Task *t, void *buf);
void writeTask(Task *t, Common::OutSaveFile *out);
#if DEBUG
@@ -117,18 +113,12 @@ public:
// Destructor
~TaskStackList(void);
- // Reconstruct from an archive buffer
- void *restore(void *buf);
-
void read(Common::InSaveFile *in);
// Return the number of bytes needed to make an archive of the
// TaskStackList
int32 archiveSize(void);
- // Make an archive of the TaskStackList in an archive buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Place a TaskStack from the inactive list into the active
@@ -183,37 +173,6 @@ TaskStackList::~TaskStackList(void) {
}
}
-//----------------------------------------------------------------------
-// Reconstruct the TaskStackList from an archive buffer
-
-void *TaskStackList::restore(void *buf) {
- warning("STUB: TaskStackList::restore()");
-#if 0
- int16 i,
- taskStackCount;
-
- // Get the count of task stacks and increment the buffer pointer
- taskStackCount = *((int16 *)buf);
- buf = (int16 *)buf + 1;
-
- // Iterate through the archive data, reconstructing the TaskStacks
- for (i = 0; i < taskStackCount; i++) {
- TaskStackID id;
- TaskStack *ts;
-
- // Retreive the TaskStack's id number
- id = *((TaskStackID *)buf);
- buf = (TaskStackID *)buf + 1;
-
- ts = new (id) TaskStack(&buf);
-
- // Plug this TaskStack into the Actor
- ts->getActor()->curTask = ts;
- }
-#endif
- return buf;
-}
-
void TaskStackList::read(Common::InSaveFile *in) {
int16 taskStackCount;
@@ -256,42 +215,6 @@ int32 TaskStackList::archiveSize(void) {
return size;
}
-//----------------------------------------------------------------------
-// Make an archive of the TaskStackList in an archive buffer
-
-void *TaskStackList::archive(void *buf) {
- warning("STUB: TaskStackList::archive()");
-
-#if 0
- int16 taskStackCount = 0;
- TaskStackPlaceHolder *tsp;
-
- // Count the active task stacks
- for (tsp = (TaskStackPlaceHolder *)list.first();
- tsp != NULL;
- tsp = (TaskStackPlaceHolder *)tsp->next())
- taskStackCount++;
-
- // Store the task stack count in the archive buffer
- *((int16 *)buf) = taskStackCount;
- buf = (int16 *)buf + 1;
-
- // Iterate through the task stacks, archiving each
- for (tsp = (TaskStackPlaceHolder *)list.first();
- tsp != NULL;
- tsp = (TaskStackPlaceHolder *)tsp->next()) {
- TaskStack *ts = tsp->getTaskStack();
-
- // Store the TaskStack's id number
- *((TaskStackID *)buf) = tsp - array;
- buf = (TaskStackID *)buf + 1;
-
- buf = ts->archive(buf);
- }
-#endif
- return buf;
-}
-
void TaskStackList::write(Common::OutSaveFile *out) {
int16 taskStackCount = 0;
@@ -436,29 +359,6 @@ TaskStack *getTaskStackAddress(TaskStackID id) {
void initTaskStacks(void) {
}
-//----------------------------------------------------------------------
-// Save the stackList to a save file
-
-void saveTaskStacks(SaveFileConstructor &saveGame) {
- int32 archiveBufSize;
- void *archiveBuffer;
-
- archiveBufSize = stackList.archiveSize();
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate task stack archive buffer");
-
- stackList.archive(archiveBuffer);
-
- saveGame.writeChunk(
- MakeID('T', 'S', 'T', 'K'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveTaskStacks(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Task Stacks");
@@ -472,39 +372,6 @@ void saveTaskStacks(Common::OutSaveFile *out) {
stackList.write(out);
}
-//----------------------------------------------------------------------
-// Load the stackList from a save file
-
-void loadTaskStacks(SaveFileReader &saveGame) {
- // If there is no saved data, simply call the default constructor
- if (saveGame.getChunkSize() == 0) {
- new (&stackList) TaskStackList;
- return;
- }
-
- int32 archiveBufSize;
- void *archiveBuffer;
- void *bufferPtr;
-
- archiveBufSize = saveGame.getChunkSize();
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate task stack archive buffer");
-
- // Read the archived task stack data
- saveGame.read(archiveBuffer, archiveBufSize);
-
- bufferPtr = archiveBuffer;
-
- // Reconstruct stackList from archived data
- new (&stackList) TaskStackList;
- bufferPtr = stackList.restore(bufferPtr);
-
- assert(bufferPtr == &((char *)archiveBuffer)[archiveBufSize]);
-
- free(archiveBuffer);
-}
-
void loadTaskStacks(Common::InSaveFile *in, int32 chunkSize) {
debugC(2, kDebugSaveload, "Loading Task Stacks");
@@ -547,18 +414,12 @@ public:
// Destructor
~TaskList(void);
- // Reconstruct from an archive buffer
- void *restore(void *buf);
-
void read(Common::InSaveFile *in);
// Return the number of bytes necessary to archive this task list
// in a buffer
int32 archiveSize(void);
- // Create an archive of the task list in an archive buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
// Place a Task from the inactive list into the active
@@ -608,42 +469,6 @@ TaskList::~TaskList(void) {
}
}
-//----------------------------------------------------------------------
-// Reconstruct from an archive buffer
-
-void *TaskList::restore(void *buf) {
- warning("STUB: TaskList::restore");
-#if 0
- assert(list.first() == NULL);
-
- int16 i,
- taskCount;
- TaskPlaceHolder *tp;
-
- // Get the count of tasks and increment the buffer pointer
- taskCount = *((int16 *)buf);
- buf = (int16 *)buf + 1;
-
- // Iterate through the archive data, reconstructing the Tasks
- for (i = 0; i < taskCount; i++) {
- TaskID id;
-
- // Retreive the Task's id number
- id = *((TaskID *)buf);
- buf = (TaskID *)buf + 1;
-
- buf = constructTask(id, buf);
- }
-
- // Iterate through the Tasks to fixup the subtask pointers
- for (tp = (TaskPlaceHolder *)list.first();
- tp != NULL;
- tp = (TaskPlaceHolder *)tp->next())
- tp->getTask()->fixup();
-#endif
- return buf;
-}
-
void TaskList::read(Common::InSaveFile *in) {
int16 taskCount;
@@ -679,41 +504,6 @@ int32 TaskList::archiveSize(void) {
return size;
}
-//----------------------------------------------------------------------
-// Make an archive of the TaskList in an archive buffer
-
-void *TaskList::archive(void *buf) {
- warning("STUB: TaskList::archive()");
-#if 0
- int16 taskCount = 0;
- TaskPlaceHolder *tp;
-
- // Count the active tasks
- for (tp = (TaskPlaceHolder *)list.first();
- tp != NULL;
- tp = (TaskPlaceHolder *)tp->next())
- taskCount++;
-
- // Store the task count in the archive buffer
- *((int16 *)buf) = taskCount;
- buf = (int16 *)buf + 1;
-
- // Iterate through the tasks, archiving each
- for (tp = (TaskPlaceHolder *)list.first();
- tp != NULL;
- tp = (TaskPlaceHolder *)tp->next()) {
- Task *t = tp->getTask();
-
- // Store the Task's id number
- *((TaskID *)buf) = tp - array;
- buf = (TaskID *)buf + 1;
-
- buf = archiveTask(t, buf);
- }
-#endif
- return buf;
-}
-
void TaskList::write(Common::OutSaveFile *out) {
int16 taskCount = 0;
@@ -817,34 +607,6 @@ void initTasks(void) {
new (&taskList) TaskList;
}
-//----------------------------------------------------------------------
-// Save the taskList to save file
-
-void saveTasks(SaveFileConstructor &saveGame) {
- int32 archiveBufSize;
- void *archiveBuffer;
- void *bufferPtr;
-
- archiveBufSize = taskList.archiveSize();
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate task archive buffer");
-
- bufferPtr = archiveBuffer;
-
- bufferPtr = taskList.archive(bufferPtr);
-
- assert((uint8 *)bufferPtr - (uint8 *)archiveBuffer == archiveBufSize);
-
- saveGame.writeChunk(
- MakeID('T', 'A', 'S', 'K'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveTasks(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Tasks");
@@ -858,39 +620,6 @@ void saveTasks(Common::OutSaveFile *out) {
taskList.write(out);
}
-//----------------------------------------------------------------------
-// Load the taskList from a save file
-
-void loadTasks(SaveFileReader &saveGame) {
- // If there is no saved data, simply call the default constructor
- if (saveGame.getChunkSize() == 0) {
- new (&taskList) TaskList;
- return;
- }
-
- int32 archiveBufSize;
- void *archiveBuffer;
- void *bufferPtr;
-
- archiveBufSize = saveGame.getChunkSize();
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == NULL)
- error("Unable to allocate task archive buffer");
-
- // Read the archived task data
- saveGame.read(archiveBuffer, archiveBufSize);
-
- bufferPtr = archiveBuffer;
-
- // Reconstruct taskList from archived data
- new (&taskList) TaskList;
- bufferPtr = taskList.restore(bufferPtr);
-
- assert(bufferPtr == &((char *)archiveBuffer)[archiveBufSize]);
-
- free(archiveBuffer);
-}
-
void loadTasks(Common::InSaveFile *in, int32 chunkSize) {
debugC(2, kDebugSaveload, "Loading Tasks");
@@ -911,94 +640,6 @@ void cleanupTasks(void) {
taskList.~TaskList();
}
-//----------------------------------------------------------------------
-// Reconstruct a Task from an archive buffer
-
-void *constructTask(TaskID id, void *buf) {
- int16 type;
-
- // Get the Task type
- type = *((int16 *)buf);
- buf = (int16 *)buf + 1;
-
- // Reconstruct the Task based upon the type
- switch (type) {
- case wanderTask:
- new WanderTask(&buf, id);
- break;
-
- case tetheredWanderTask:
- new TetheredWanderTask(&buf, id);
- break;
-
- case gotoLocationTask:
- new GotoLocationTask(&buf, id);
- break;
-
- case gotoRegionTask:
- new GotoRegionTask(&buf, id);
- break;
-
- case gotoObjectTask:
- new GotoObjectTask(&buf, id);
- break;
-
- case gotoActorTask:
- new GotoActorTask(&buf, id);
- break;
-
- case goAwayFromObjectTask:
- new GoAwayFromObjectTask(&buf, id);
- break;
-
- case goAwayFromActorTask:
- new GoAwayFromActorTask(&buf, id);
- break;
-
- case huntToBeNearLocationTask:
- new HuntToBeNearLocationTask(&buf, id);
- break;
-
- case huntToBeNearObjectTask:
- new HuntToBeNearObjectTask(&buf, id);
- break;
-
- case huntToPossessTask:
- new HuntToPossessTask(&buf, id);
- break;
-
- case huntToBeNearActorTask:
- new HuntToBeNearActorTask(&buf, id);
- break;
-
- case huntToKillTask:
- new HuntToKillTask(&buf, id);
- break;
-
- case huntToGiveTask:
- new HuntToGiveTask(&buf, id);
- break;
-
- case bandTask:
- new BandTask(&buf, id);
- break;
-
- case bandAndAvoidEnemiesTask:
- new BandAndAvoidEnemiesTask(&buf, id);
- break;
-
- case followPatrolRouteTask:
- new FollowPatrolRouteTask(&buf, id);
- break;
-
- case attendTask:
- new AttendTask(&buf, id);
- break;
- }
-
- return buf;
-}
-
void readTask(TaskID id, Common::InSaveFile *in) {
int16 type;
@@ -1090,20 +731,6 @@ int32 taskArchiveSize(Task *t) {
+ t->archiveSize();
}
-//----------------------------------------------------------------------
-// Create an archive of the specified Task in the specified buffer
-
-void *archiveTask(Task *t, void *buf) {
- // Store the task's type
- *((int16 *)buf) = t->getType();
- buf = (int16 *)buf + 1;
-
- // Store the task
- buf = t->archive(buf);
-
- return buf;
-}
-
void writeTask(Task *t, Common::OutSaveFile *out) {
// Store the task's type
out->writeSint16LE(t->getType());
@@ -1116,18 +743,6 @@ void writeTask(Task *t, Common::OutSaveFile *out) {
Task member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-Task::Task(void **buf, TaskID id) {
- void *bufferPtr = *buf;
-
- // Place the stack ID into the stack pointer field
- *((TaskStackID *)&stack) = *((TaskStackID *)bufferPtr);
-
- *buf = (TaskStackID *)bufferPtr + 1;
-}
-
Task::Task(Common::InSaveFile *in, TaskID id) {
// Place the stack ID into the stack pointer field
int16 stackID = in->readSint16LE();
@@ -1143,15 +758,6 @@ inline int32 Task::archiveSize(void) const {
return sizeof(TaskStackID); // stack's ID
}
-//----------------------------------------------------------------------
-// Create an archive of this object's data in an archive buffer
-
-void *Task::archive(void *buf) const {
- *((TaskStackID *)buf) = getTaskStackID(stack);
-
- return (TaskStackID *)buf + 1;
-}
-
void Task::write(Common::OutSaveFile *out) const {
out->writeSint16LE(getTaskStackID(stack));
}
@@ -1160,23 +766,6 @@ void Task::write(Common::OutSaveFile *out) const {
WanderTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-WanderTask::WanderTask(void **buf, TaskID id) : Task(buf, id) {
- void *bufferPtr = *buf;
-
- // Restore the paused flag
- paused = *((bool *)bufferPtr);
- bufferPtr = (bool *)bufferPtr + 1;
-
- // Restore the counter
- counter = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-}
-
WanderTask::WanderTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
// Restore the paused flag
paused = in->readByte();
@@ -1195,24 +784,6 @@ int32 WanderTask::archiveSize(void) const {
+ sizeof(counter);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *WanderTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = Task::archive(buf);
-
- // Store the paused flag
- *((bool *)buf) = paused;
- buf = (bool *)buf + 1;
-
- // Store the counter
- *((int16 *)buf) = counter;
- buf = (int16 *)buf + 1;
-
- return buf;
-}
-
void WanderTask::write(Common::OutSaveFile *out) const {
// Let the base class archive its data
Task::write(out);
@@ -1306,25 +877,6 @@ void WanderTask::wander(void) {
TetheredWanderTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-TetheredWanderTask::TetheredWanderTask(void **buf, TaskID id) : WanderTask(buf, id) {
- int16 *bufferPtr = (int16 *)*buf;
-
- // Restore the tether coordinates
- minU = *bufferPtr++;
- minV = *bufferPtr++;
- maxU = *bufferPtr++;
- maxV = *bufferPtr++;
-
- // Put the gotoTether ID into the gotoTether pointer field
- *((TaskID *)&gotoTether) = *((TaskID *)bufferPtr);
- bufferPtr = (int16 *)((TaskID *)bufferPtr + 1);
-
- *buf = bufferPtr;
-}
-
TetheredWanderTask::TetheredWanderTask(Common::InSaveFile *in, TaskID id) : WanderTask(in, id) {
debugC(3, kDebugSaveload, "... Loading TetheredWanderTask");
@@ -1353,29 +905,6 @@ inline int32 TetheredWanderTask::archiveSize(void) const {
+ sizeof(TaskID); // gotoTether ID
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *TetheredWanderTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = WanderTask::archive(buf);
-
- int16 *bufferPtr = (int16 *)buf;
-
- // Archive tether coordinates
- *bufferPtr++ = minU;
- *bufferPtr++ = minV;
- *bufferPtr++ = maxU;
- *bufferPtr++ = maxV;
-
- // Archive gotoTether ID
- *((TaskID *)bufferPtr) = gotoTether != NULL
- ? getTaskID(gotoTether)
- : NoTask;
-
- return (TaskID *)bufferPtr + 1;
-}
-
void TetheredWanderTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving TetheredWanderTask");
@@ -1508,22 +1037,6 @@ TaskResult TetheredWanderTask::handleWander(void) {
GotoTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GotoTask::GotoTask(void **buf, TaskID id) : Task(buf, id) {
- void *bufferPtr = *buf;
-
- // Get the wander TaskID
- *((TaskID *)&wander) = *((TaskID *)bufferPtr);
- bufferPtr = (TaskID *)bufferPtr + 1;
-
- // Restore prevRunState
- prevRunState = *((bool *)bufferPtr);
-
- *buf = (bool *)bufferPtr + 1;
-}
-
GotoTask::GotoTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
// Get the wander TaskID
TaskID wanderID = in->readSint16LE();
@@ -1545,25 +1058,6 @@ inline int32 GotoTask::archiveSize(void) const {
+ sizeof(prevRunState);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GotoTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = Task::archive(buf);
-
- // Convert the wander Task pointer to a TaskID and store it
- // in the buffer
- *((TaskID *)buf) = wander != NULL ? getTaskID(wander) : NoTask;
- buf = (TaskID *)buf + 1;
-
- // Store prevRunState
- *((bool *)buf) = prevRunState;
- buf = (bool *)buf + 1;
-
- return buf;
-}
-
void GotoTask::write(Common::OutSaveFile *out) const {
// Let the base class archive its data
Task::write(out);
@@ -1703,23 +1197,6 @@ TaskResult GotoTask::update(void) {
GotoLocationTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GotoLocationTask::GotoLocationTask(void **buf, TaskID id) : GotoTask(buf, id) {
- void *bufferPtr = *buf;
-
- // Restore the target location
- targetLoc = *((TilePoint *)bufferPtr);
- bufferPtr = (TilePoint *)bufferPtr + 1;
-
- // Restore the runThreshold
- runThreshold = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-}
-
GotoLocationTask::GotoLocationTask(Common::InSaveFile *in, TaskID id) : GotoTask(in, id) {
debugC(3, kDebugSaveload, "... Loading GotoLocationTask");
@@ -1740,24 +1217,6 @@ inline int32 GotoLocationTask::archiveSize(void) const {
+ sizeof(runThreshold);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GotoLocationTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = GotoTask::archive(buf);
-
- // Archive the target location
- *((TilePoint *)buf) = targetLoc;
- buf = (TilePoint *)buf + 1;
-
- // Archive the run threshold
- *((uint8 *)buf) = runThreshold;
- buf = (uint8 *)buf + 1;
-
- return buf;
-}
-
void GotoLocationTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving GotoLocationTask");
@@ -1827,21 +1286,6 @@ bool GotoLocationTask::run(void) {
GotoRegionTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GotoRegionTask::GotoRegionTask(void **buf, TaskID id) : GotoTask(buf, id) {
- int16 *bufferPtr = (int16 *)*buf;
-
- // Restore the region coordinates
- regionMinU = *bufferPtr++;
- regionMinV = *bufferPtr++;
- regionMaxU = *bufferPtr++;
- regionMaxV = *bufferPtr++;
-
- *buf = bufferPtr;
-}
-
GotoRegionTask::GotoRegionTask(Common::InSaveFile *in, TaskID id) : GotoTask(in, id) {
debugC(3, kDebugSaveload, "... Loading GotoRegionTask");
@@ -1864,24 +1308,6 @@ inline int32 GotoRegionTask::archiveSize(void) const {
+ sizeof(regionMaxV);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GotoRegionTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = GotoTask::archive(buf);
-
- int16 *bufferPtr = (int16 *)buf;
-
- // Archive the region coordinates
- *bufferPtr++ = regionMinU;
- *bufferPtr++ = regionMinV;
- *bufferPtr++ = regionMaxU;
- *bufferPtr++ = regionMaxV;
-
- return bufferPtr;
-}
-
void GotoRegionTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving GotoRegionTask");
@@ -1946,30 +1372,6 @@ bool GotoRegionTask::run(void) {
GotoObjectTargetTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GotoObjectTargetTask::GotoObjectTargetTask(void **buf, TaskID id) : GotoTask(buf, id) {
- void *bufferPtr = *buf;
-
- // Restore lastTestedLoc and increment pointer
- lastTestedLoc = *((TilePoint *)bufferPtr);
- bufferPtr = (TilePoint *)bufferPtr + 1;
-
- // Restore sightCtr and increment pointer
- sightCtr = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- // Restore the flags and increment pointer
- flags = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr + 1;
-
- // Restore lastKnownLoc
- lastKnownLoc = *((TilePoint *)bufferPtr);
-
- *buf = (TilePoint *)bufferPtr + 1;
-}
-
GotoObjectTargetTask::GotoObjectTargetTask(Common::InSaveFile *in, TaskID id) : GotoTask(in, id) {
// Restore lastTestedLoc and increment pointer
lastTestedLoc.load(in);
@@ -1996,31 +1398,6 @@ inline int32 GotoObjectTargetTask::archiveSize(void) const {
+ sizeof(lastKnownLoc);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GotoObjectTargetTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = GotoTask::archive(buf);
-
- // Archive lastTestedLoc and increment pointer
- *((TilePoint *)buf) = lastTestedLoc;
- buf = (TilePoint *)buf + 1;
-
- // Archive sightCtr and increment pointer
- *((int16 *)buf) = sightCtr;
- buf = (int16 *)buf + 1;
-
- // Archive the flags and increment pointer
- *((uint8 *)buf) = flags;
- buf = (uint8 *)buf + 1;
-
- // Archive lastKnownLoc
- *((TilePoint *)buf) = lastKnownLoc;
-
- return (TilePoint *)buf + 1;
-}
-
void GotoObjectTargetTask::write(Common::OutSaveFile *out) const {
// Let the base class archive its data
GotoTask::write(out);
@@ -2127,21 +1504,6 @@ bool GotoObjectTargetTask::lineOfSight(void) {
GotoObjectTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GotoObjectTask::GotoObjectTask(void **buf, TaskID id) :
- GotoObjectTargetTask(buf, id) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
-
- // Restore the targetObj pointer
- targetObj = *bufferPtr != Nothing
- ? GameObject::objectAddress(*bufferPtr)
- : NULL;
-
- *buf = bufferPtr + 1;
-}
-
GotoObjectTask::GotoObjectTask(Common::InSaveFile *in, TaskID id) :
GotoObjectTargetTask(in, id) {
debugC(3, kDebugSaveload, "... Loading GotoObjectTask");
@@ -2162,20 +1524,6 @@ inline int32 GotoObjectTask::archiveSize(void) const {
return GotoObjectTargetTask::archiveSize() + sizeof(ObjectID);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GotoObjectTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = GotoObjectTargetTask::archive(buf);
-
- *((ObjectID *)buf) = targetObj != NULL
- ? targetObj->thisID()
- : Nothing;
-
- return (ObjectID *)buf + 1;
-}
-
void GotoObjectTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving GotoObjectTask");
@@ -2225,21 +1573,6 @@ bool GotoObjectTask::run(void) {
GotoActorTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GotoActorTask::GotoActorTask(void **buf, TaskID id) :
- GotoObjectTargetTask(buf, id) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
-
- // Restore the targetObj pointer
- targetActor = *bufferPtr != Nothing
- ? (Actor *)GameObject::objectAddress(*bufferPtr)
- : NULL;
-
- *buf = bufferPtr + 1;
-}
-
GotoActorTask::GotoActorTask(Common::InSaveFile *in, TaskID id) :
GotoObjectTargetTask(in, id) {
debugC(3, kDebugSaveload, "... Loading GotoActorTask");
@@ -2258,20 +1591,6 @@ inline int32 GotoActorTask::archiveSize(void) const {
return GotoObjectTargetTask::archiveSize() + sizeof(ObjectID);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GotoActorTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = GotoObjectTargetTask::archive(buf);
-
- *((ObjectID *)buf) = targetActor != NULL
- ? targetActor->thisID()
- : Nothing;
-
- return (ObjectID *)buf + 1;
-}
-
void GotoActorTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving GotoActorTask");
@@ -2322,24 +1641,6 @@ bool GotoActorTask::run(void) {
return lastKnownLoc != Nowhere;
}
-/* ===================================================================== *
- GoAwayFromTask member functions
- * ===================================================================== */
-
-GoAwayFromTask::GoAwayFromTask(void **buf, TaskID id) : Task(buf, id) {
- void *bufferPtr = *buf;
-
- // Get the subtask ID
- *((TaskID *)&goTask) = *((TaskID *)bufferPtr);
- bufferPtr = (TaskID *)bufferPtr + 1;
-
- // Restore the flags
- flags = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-}
-
GoAwayFromTask::GoAwayFromTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
// Get the subtask ID
TaskID goTaskID = in->readSint16LE();
@@ -2359,24 +1660,6 @@ inline int32 GoAwayFromTask::archiveSize(void) const {
return Task::archiveSize() + sizeof(TaskID) + sizeof(flags);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GoAwayFromTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = Task::archive(buf);
-
- // Store the subTask's ID
- *((TaskID *)buf) = goTask != NULL ? getTaskID(goTask) : NoTask;
- buf = (TaskID *)buf + 1;
-
- // Store the flags
- *((uint8 *)buf) = flags;
- buf = (uint8 *)buf + 1;
-
- return buf;
-}
-
void GoAwayFromTask::write(Common::OutSaveFile *out) const {
// Let the base class archive its data
Task::write(out);
@@ -2471,25 +1754,6 @@ TaskResult GoAwayFromTask::update(void) {
GoAwayFromObjectTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GoAwayFromObjectTask::GoAwayFromObjectTask(void **buf, TaskID id) :
- GoAwayFromTask(buf, id) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
-
- ObjectID objectID;
-
- // Get the object's ID
- objectID = *((ObjectID *)bufferPtr);
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Convert the ID to an object pointer
- obj = objectID != Nothing ? GameObject::objectAddress(objectID) : NULL;
-
- *buf = bufferPtr;
-}
-
GoAwayFromObjectTask::GoAwayFromObjectTask(Common::InSaveFile *in, TaskID id) :
GoAwayFromTask(in, id) {
debugC(3, kDebugSaveload, "... Loading GoAwayFromObjectTask");
@@ -2511,25 +1775,6 @@ int32 GoAwayFromObjectTask::archiveSize(void) const {
return GoAwayFromTask::archiveSize() + sizeof(ObjectID);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GoAwayFromObjectTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = GoAwayFromTask::archive(buf);
-
- ObjectID objectID;
-
- // Convert the object pointer to an object ID
- objectID = obj != NULL ? obj->thisID() : Nothing;
-
- // Store the object's ID
- *((ObjectID *)buf) = objectID;
- buf = (ObjectID *)buf + 1;
-
- return buf;
-}
-
void GoAwayFromObjectTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving GoAwayFromObjectTask");
@@ -2596,14 +1841,6 @@ GoAwayFromActorTask::GoAwayFromActorTask(
}
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-GoAwayFromActorTask::GoAwayFromActorTask(void **buf, TaskID id) : GoAwayFromTask(buf, id) {
- // Restore the target
- *buf = constructTarget(targetMem, *buf);
-}
-
GoAwayFromActorTask::GoAwayFromActorTask(Common::InSaveFile *in, TaskID id) : GoAwayFromTask(in, id) {
debugC(3, kDebugSaveload, "... Loading GoAwayFromActorTask");
@@ -2619,19 +1856,6 @@ int32 GoAwayFromActorTask::archiveSize(void) const {
return GoAwayFromTask::archiveSize() + targetArchiveSize(getTarget());
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *GoAwayFromActorTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = GoAwayFromTask::archive(buf);
-
- // Store the target
- buf = archiveTarget(getTarget(), buf);
-
- return buf;
-}
-
void GoAwayFromActorTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving GoAwayFromActorTask");
@@ -2694,25 +1918,6 @@ TilePoint GoAwayFromActorTask::getRepulsionVector(void) {
HuntTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntTask::HuntTask(void **buf, TaskID id) : Task(buf, id) {
- void *bufferPtr = *buf;
-
- // Restore the flags
- huntFlags = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr + 1;
-
- // If the flags say we have a sub task, restore it too
- if (huntFlags & (huntGoto | huntWander)) {
- *((TaskID *)&subTask) = *((TaskID *)bufferPtr);
- bufferPtr = (TaskID *)bufferPtr + 1;
- }
-
- *buf = bufferPtr;
-}
-
HuntTask::HuntTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
// Restore the flags
huntFlags = in->readByte();
@@ -2737,26 +1942,6 @@ inline int32 HuntTask::archiveSize(void) const {
return size;
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = Task::archive(buf);
-
- // Store the flags
- *((uint8 *)buf) = huntFlags;
- buf = (uint8 *)buf + 1;
-
- // If the flags say we have a sub task, store it too
- if (huntFlags & (huntGoto | huntWander)) {
- *((TaskID *)buf) = getTaskID(subTask);
- buf = (TaskID *)buf + 1;
- }
-
- return buf;
-}
-
void HuntTask::write(Common::OutSaveFile *out) const {
// Let the base class archive its data
Task::write(out);
@@ -2895,20 +2080,6 @@ HuntLocationTask::HuntLocationTask(TaskStack *ts, const Target &t) :
t.clone(targetMem);
}
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntLocationTask::HuntLocationTask(void **buf, TaskID id) : HuntTask(buf, id) {
- void *bufferPtr = *buf;
-
- // Restore the currentTarget location
- currentTarget = *((TilePoint *)bufferPtr);
- bufferPtr = (TilePoint *)bufferPtr + 1;
-
- // Restore the target
- *buf = constructTarget(targetMem, bufferPtr);
-}
-
HuntLocationTask::HuntLocationTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, id) {
// Restore the currentTarget location
currentTarget.load(in);
@@ -2927,21 +2098,6 @@ inline int32 HuntLocationTask::archiveSize(void) const {
+ targetArchiveSize(getTarget());
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntLocationTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntTask::archive(buf);
-
- // Store the current target location
- *((TilePoint *)buf) = currentTarget;
- buf = (TilePoint *)buf + 1;
-
- // Store the target
- return archiveTarget(getTarget(), buf);
-}
-
void HuntLocationTask::write(Common::OutSaveFile *out) const {
// Let the base class archive its data
HuntTask::write(out);
@@ -2981,23 +2137,6 @@ TilePoint HuntLocationTask::currentTargetLoc(void) {
HuntToBeNearLocationTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntToBeNearLocationTask::HuntToBeNearLocationTask(void **buf, TaskID id) :
- HuntLocationTask(buf, id) {
- void *bufferPtr = *buf;
-
- // Restore the range
- range = *((uint16 *)bufferPtr);
- bufferPtr = (uint16 *)bufferPtr + 1;
-
- // Restore the evaluation counter
- targetEvaluateCtr = *((uint8 *)bufferPtr);
-
- *buf = (uint8 *)bufferPtr + 1;
-}
-
HuntToBeNearLocationTask::HuntToBeNearLocationTask(Common::InSaveFile *in, TaskID id) :
HuntLocationTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToBeNearLocationTask");
@@ -3009,31 +2148,14 @@ HuntToBeNearLocationTask::HuntToBeNearLocationTask(Common::InSaveFile *in, TaskI
targetEvaluateCtr = in->readByte();
}
-//----------------------------------------------------------------------
-// Return the number of bytes needed to archive this object in
-// a buffer
-
-inline int32 HuntToBeNearLocationTask::archiveSize(void) const {
- return HuntLocationTask::archiveSize()
- + sizeof(range)
- + sizeof(targetEvaluateCtr);
-}
-
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntToBeNearLocationTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntLocationTask::archive(buf);
-
- // Store the range
- *((uint16 *)buf) = range;
- buf = (uint16 *)buf + 1;
-
- // Store the evaluation counter
- *((uint8 *)buf) = targetEvaluateCtr;
+//----------------------------------------------------------------------
+// Return the number of bytes needed to archive this object in
+// a buffer
- return (uint8 *)buf + 1;
+inline int32 HuntToBeNearLocationTask::archiveSize(void) const {
+ return HuntLocationTask::archiveSize()
+ + sizeof(range)
+ + sizeof(targetEvaluateCtr);
}
void HuntToBeNearLocationTask::write(Common::OutSaveFile *out) const {
@@ -3128,26 +2250,6 @@ HuntObjectTask::HuntObjectTask(TaskStack *ts, const ObjectTarget &ot) :
ot.clone(targetMem);
}
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntObjectTask::HuntObjectTask(void **buf, TaskID id) : HuntTask(buf, id) {
- void *bufferPtr = *buf;
- ObjectID currentTargetID;
-
- // Restore the current target ID
- currentTargetID = *((ObjectID *)bufferPtr);
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Convert the ID to a GameObject pointer
- currentTarget = currentTargetID != Nothing
- ? GameObject::objectAddress(currentTargetID)
- : NULL;
-
- // Reconstruct the object target
- *buf = constructTarget(targetMem, bufferPtr);
-}
-
HuntObjectTask::HuntObjectTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, id) {
// Restore the current target ID
ObjectID currentTargetID = in->readUint16LE();
@@ -3171,28 +2273,6 @@ inline int32 HuntObjectTask::archiveSize(void) const {
+ targetArchiveSize(getTarget());
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntObjectTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntTask::archive(buf);
-
- ObjectID currentTargetID;
-
- // Get the current target object's ID
- currentTargetID = currentTarget != NULL
- ? currentTarget->thisID()
- : Nothing;
-
- // Store the ID
- *((ObjectID *)buf) = currentTargetID;
- buf = (ObjectID *)buf + 1;
-
- // Store the object target
- return archiveTarget(getTarget(), buf);
-}
-
void HuntObjectTask::write(Common::OutSaveFile *out) const {
// Let the base class archive its data
HuntTask::write(out);
@@ -3238,23 +2318,6 @@ TilePoint HuntObjectTask::currentTargetLoc(void) {
HuntToBeNearObjectTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntToBeNearObjectTask::HuntToBeNearObjectTask(void **buf, TaskID id) :
- HuntObjectTask(buf, id) {
- void *bufferPtr = *buf;
-
- // Restore the range
- range = *((uint16 *)bufferPtr);
- bufferPtr = (uint16 *)bufferPtr + 1;
-
- // Restore the evaluation counter
- targetEvaluateCtr = *((uint8 *)bufferPtr);
-
- *buf = (uint8 *)bufferPtr + 1;
-}
-
HuntToBeNearObjectTask::HuntToBeNearObjectTask(Common::InSaveFile *in, TaskID id) :
HuntObjectTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToBeNearObjectTask");
@@ -3276,23 +2339,6 @@ inline int32 HuntToBeNearObjectTask::archiveSize(void) const {
+ sizeof(targetEvaluateCtr);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntToBeNearObjectTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntObjectTask::archive(buf);
-
- // Store the range
- *((uint16 *)buf) = range;
- buf = (uint16 *)buf + 1;
-
- // Store the evaluation counter
- *((uint8 *)buf) = targetEvaluateCtr;
-
- return (uint8 *)buf + 1;
-}
-
void HuntToBeNearObjectTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving HuntToBeNearObjectTask");
@@ -3403,22 +2449,6 @@ TaskResult HuntToBeNearObjectTask::atTargetUpdate(void) {
// Hunt to possess in not fully implemented yet
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntToPossessTask::HuntToPossessTask(void **buf, TaskID id) : HuntObjectTask(buf, id) {
- void *bufferPtr = *buf;
-
- // Restore evaluation counter
- targetEvaluateCtr = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr;
-
- // Restore grab flag
- grabFlag = *((bool *)bufferPtr);
-
- *buf = (bool *)bufferPtr + 1;
-}
-
HuntToPossessTask::HuntToPossessTask(Common::InSaveFile *in, TaskID id) : HuntObjectTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToPossessTask");
@@ -3439,23 +2469,6 @@ inline int32 HuntToPossessTask::archiveSize(void) const {
+ sizeof(grabFlag);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntToPossessTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntObjectTask::archive(buf);
-
- // Store the evaluation counter
- *((uint8 *)buf) = targetEvaluateCtr;
- buf = (uint8 *)buf + 1;
-
- // Store the grab flag
- *((bool *)buf) = grabFlag;
-
- return (bool *)buf + 1;
-}
-
void HuntToPossessTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving HuntToPossessTask");
@@ -3581,30 +2594,6 @@ HuntActorTask::HuntActorTask(
at.clone(targetMem);
}
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntActorTask::HuntActorTask(void **buf, TaskID id) : HuntTask(buf, id) {
- void *bufferPtr = *buf;
- ObjectID currentTargetID;
-
- // Restore the flags
- flags = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr + 1;
-
- // Restore the current target ID
- currentTargetID = *((ObjectID *)bufferPtr);
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Convert the ID to a GameObject pointer
- currentTarget = currentTargetID != Nothing
- ? (Actor *)GameObject::objectAddress(currentTargetID)
- : NULL;
-
- // Reconstruct the object target
- *buf = constructTarget(targetMem, bufferPtr);
-}
-
HuntActorTask::HuntActorTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, id) {
// Restore the flags
flags = in->readByte();
@@ -3632,32 +2621,6 @@ inline int32 HuntActorTask::archiveSize(void) const {
+ targetArchiveSize(getTarget());
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntActorTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntTask::archive(buf);
-
- ObjectID currentTargetID;
-
- // Store the flags
- *((uint8 *)buf) = flags;
- buf = (uint8 *)buf + 1;
-
- // Get the current target actor's ID
- currentTargetID = currentTarget != NULL
- ? currentTarget->thisID()
- : Nothing;
-
- // Store the ID
- *((ObjectID *)buf) = currentTargetID;
- buf = (ObjectID *)buf + 1;
-
- // Store the object target
- return archiveTarget(getTarget(), buf);
-}
-
void HuntActorTask::write(Common::OutSaveFile *out) const {
// Let the base class archive its data
HuntTask::write(out);
@@ -3715,27 +2678,6 @@ TilePoint HuntActorTask::currentTargetLoc(void) {
HuntToBeNearActorTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntToBeNearActorTask::HuntToBeNearActorTask(void **buf, TaskID id) :
- HuntActorTask(buf, id) {
- void *bufferPtr = *buf;
-
- // Get the goAway task ID
- *((TaskID *)&goAway) = *((TaskID *)bufferPtr);
- bufferPtr = (TaskID *)bufferPtr + 1;
-
- // Restore the range
- range = *((uint16 *)bufferPtr);
- bufferPtr = (uint16 *)bufferPtr + 1;
-
- // Restore the evaluation counter
- targetEvaluateCtr = *((uint8 *)bufferPtr);
-
- *buf = (uint8 *)bufferPtr + 1;
-}
-
HuntToBeNearActorTask::HuntToBeNearActorTask(Common::InSaveFile *in, TaskID id) :
HuntActorTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToBeNearActorTask");
@@ -3766,32 +2708,6 @@ inline int32 HuntToBeNearActorTask::archiveSize(void) const {
+ sizeof(targetEvaluateCtr);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntToBeNearActorTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntActorTask::archive(buf);
-
- TaskID goAwayID;
-
- // Convert the task pointer to a task ID
- goAwayID = goAway != NULL ? getTaskID(goAway) : NoTask;
-
- // Store the task ID
- *((TaskID *)buf) = goAwayID;
- buf = (TaskID *)buf + 1;
-
- // Store the range
- *((uint16 *)buf) = range;
- buf = (uint16 *)buf + 1;
-
- // Store the evaluation counter
- *((uint8 *)buf) = targetEvaluateCtr;
-
- return (uint8 *)buf + 1;
-}
-
void HuntToBeNearActorTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving HuntToBeNearActorTask");
@@ -3990,20 +2906,6 @@ HuntToKillTask::HuntToKillTask(
a->setFightStance(true);
}
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntToKillTask::HuntToKillTask(void **buf, TaskID id) : HuntActorTask(buf, id) {
- uint8 *bufferPtr = (uint8 *)*buf;
-
- // Restore the evaluation counter
- targetEvaluateCtr = *bufferPtr++;
- specialAttackCtr = *bufferPtr++;
- flags = *bufferPtr++;
-
- *buf = bufferPtr;
-}
-
HuntToKillTask::HuntToKillTask(Common::InSaveFile *in, TaskID id) : HuntActorTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToKillTask");
@@ -4024,22 +2926,6 @@ inline int32 HuntToKillTask::archiveSize(void) const {
+ sizeof(flags);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntToKillTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntActorTask::archive(buf);
-
- // Store the evaluation counter
- *((uint8 *)buf) = targetEvaluateCtr;
- *((uint8 *)buf + 1) = specialAttackCtr;
- *((uint8 *)buf + 2) = flags;
- buf = (uint8 *)buf + 3;
-
- return buf;
-}
-
void HuntToKillTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving HuntToKillTask");
@@ -4377,24 +3263,6 @@ void HuntToKillTask::evaluateWeapon(void) {
// Hunt to give is not implemented yet
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-HuntToGiveTask::HuntToGiveTask(void **buf, TaskID id) : HuntActorTask(buf, id) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
- ObjectID objToGiveID;
-
- // Get the object ID
- objToGiveID = *bufferPtr++;
-
- // Convert the object ID to a pointer
- objToGive = objToGiveID != Nothing
- ? GameObject::objectAddress(objToGiveID)
- : NULL;
-
- *buf = bufferPtr;
-}
-
HuntToGiveTask::HuntToGiveTask(Common::InSaveFile *in, TaskID id) : HuntActorTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToGiveTask");
@@ -4416,24 +3284,6 @@ inline int32 HuntToGiveTask::archiveSize(void) const {
+ sizeof(ObjectID); // objToGive ID
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *HuntToGiveTask::archive(void *buf) const {
- // Let base class archive its data
- buf = HuntActorTask::archive(buf);
-
- ObjectID objToGiveID;
-
- // Convert the object pointer to an ID
- objToGiveID = objToGive != NULL ? objToGive->thisID() : Nothing;
-
- // Store the ID
- *((ObjectID *)buf) = objToGiveID;
-
- return (ObjectID *)buf + 1;
-}
-
void HuntToGiveTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving HuntToGiveTask");
@@ -4549,26 +3399,6 @@ bool BandTask::BandingRepulsorIterator::next(
return false;
}
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-BandTask::BandTask(void **buf, TaskID id) : HuntTask(buf, id) {
- void *bufferPtr = *buf;
-
- *((TaskID *)&attend) = *((TaskID *)bufferPtr);
- bufferPtr = (TaskID *)bufferPtr + 1;
-
- // Restore the current target location
- currentTarget = *((TilePoint *)bufferPtr);
- bufferPtr = (TilePoint *)bufferPtr + 1;
-
- // Restore the target evaluation counter
- targetEvaluateCtr = *((uint8 *)bufferPtr);
- bufferPtr = (uint8 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-}
-
BandTask::BandTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, id) {
TaskID attendID = in->readSint16LE();
debugC(3, kDebugSaveload, "... Loading BandTask");
@@ -4597,28 +3427,6 @@ inline int32 BandTask::archiveSize(void) const {
+ sizeof(targetEvaluateCtr);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *BandTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = HuntTask::archive(buf);
-
- // Store the attend task ID
- *((TaskID *)buf) = attend != NULL ? getTaskID(attend) : NoTask;
- buf = (TaskID *)buf + 1;
-
- // Store the current target location
- *((TilePoint *)buf) = currentTarget;
- buf = (TilePoint *)buf + 1;
-
- // Store the target evaluation counter
- *((uint8 *)buf) = targetEvaluateCtr;
- buf = (uint8 *)buf + 1;
-
- return buf;
-}
-
void BandTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving BandTask");
@@ -4956,35 +3764,6 @@ BandTask::RepulsorIterator *BandAndAvoidEnemiesTask::getNewRepulsorIterator(void
FollowPatrolRouteTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-FollowPatrolRouteTask::FollowPatrolRouteTask(void **buf, TaskID id) : Task(buf, id) {
- void *bufferPtr = *buf;
-
- // Get the gotoWayPoint TaskID
- *((TaskID *)&gotoWayPoint) = *((TaskID *)bufferPtr);
- bufferPtr = (TaskID *)bufferPtr + 1;
-
- // Restore the patrol route iterator
- patrolIter = *((PatrolRouteIterator *)bufferPtr);
- bufferPtr = (PatrolRouteIterator *)bufferPtr + 1;
-
- // Restore the last waypoint number
- lastWayPointNum = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- // Restore the paused flag
- paused = *((bool *)bufferPtr);
- bufferPtr = (bool *)bufferPtr + 1;
-
- // Restore the paused counter
- counter = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-}
-
FollowPatrolRouteTask::FollowPatrolRouteTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
debugC(3, kDebugSaveload, "... Loading FollowPatrolRouteTask");
@@ -5022,43 +3801,6 @@ inline int32 FollowPatrolRouteTask::archiveSize(void) const {
+ sizeof(counter);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *FollowPatrolRouteTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = Task::archive(buf);
-
- TaskID gotoWayPointID;
-
- // Convert the gotoWayPoint pointer to a TaskID
- gotoWayPointID = gotoWayPoint != NULL
- ? getTaskID(gotoWayPoint)
- : NoTask;
-
- // Store the gotoWayPoint ID
- *((TaskID *)buf) = gotoWayPointID;
- buf = (TaskID *)buf + 1;
-
- // Store the PatrolRouteIterator
- *((PatrolRouteIterator *)buf) = patrolIter;
- buf = (PatrolRouteIterator *)buf + 1;
-
- // Store the last waypoint number
- *((int16 *)buf) = lastWayPointNum;
- buf = (int16 *)buf + 1;
-
- // Store the paused flag
- *((bool *)buf) = paused;
- buf = (bool *)buf + 1;
-
- // Store the paused counter
- *((int16 *)buf) = counter;
- buf = (int16 *)buf + 1;
-
- return buf;
-}
-
void FollowPatrolRouteTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving FollowPatrolRouteTask");
@@ -5221,22 +3963,6 @@ void FollowPatrolRouteTask::pause(void) {
AttendTask member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from archive buffer
-
-AttendTask::AttendTask(void **buf, TaskID id) : Task(buf, id) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
- ObjectID objID;
-
- // Get the object ID
- objID = *bufferPtr++;
-
- // Convert the object ID to a pointer
- obj = objID != Nothing ? GameObject::objectAddress(objID) : NULL;
-
- *buf = bufferPtr;
-}
-
AttendTask::AttendTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
debugC(3, kDebugSaveload, "... Loading AttendTask");
@@ -5257,23 +3983,6 @@ inline int32 AttendTask::archiveSize(void) const {
return Task::archiveSize() + sizeof(ObjectID);
}
-//----------------------------------------------------------------------
-// Create an archive of this object in a buffer
-
-void *AttendTask::archive(void *buf) const {
- // Let the base class archive its data
- buf = Task::archive(buf);
-
- ObjectID objID;
-
- // Convert the object pointer to an object ID
- objID = obj != NULL ? obj->thisID() : Nothing;
-
- // Store the object ID
- *((ObjectID *)buf) = objID;
-
- return (ObjectID *)buf + 1;
-}
void AttendTask::write(Common::OutSaveFile *out) const {
debugC(3, kDebugSaveload, "... Saving AttendTask");
@@ -5343,53 +4052,6 @@ bool AttendTask::operator == (const Task &t) const {
TaskStack member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// TaskStack constructor -- reconstruct from an archive buffer
-
-TaskStack::TaskStack(void **buf) {
- void *bufferPtr = *buf;
-
- // Restore the stack bottom pointer
- stackBottomID = *((TaskID *)bufferPtr);
- bufferPtr = (TaskID *)bufferPtr + 1;
-
- // Restore the actor pointer
- actor = (Actor *)GameObject::objectAddress(*((ObjectID *)bufferPtr));
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Restore the evaluation count
- evalCount = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- // Restore the evaluation rate
- evalRate = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- *buf = bufferPtr;
-}
-
-//----------------------------------------------------------------------
-// Create an archive of this TaskStack in the specified buffer
-
-void *TaskStack::archive(void *buf) {
- // Store the stack bottom TaskID
- *((TaskID *)buf) = stackBottomID;
- buf = (TaskID *)buf + 1;
-
- // Store the actor's id
- *((ObjectID *)buf) = actor->thisID();
- buf = (ObjectID *)buf + 1;
-
- // Store the evalCount and evalRate
- *((int16 *)buf) = evalCount;
- buf = (int16 *)buf + 1;
-
- *((int16 *)buf) = evalRate;
- buf = (int16 *)buf + 1;
-
- return buf;
-}
-
void TaskStack::write(Common::OutSaveFile *out) {
// Store the stack bottom TaskID
out->writeSint16LE(stackBottomID);
diff --git a/engines/saga2/task.h b/engines/saga2/task.h
index 6de50c8127..a8b2e84f88 100644
--- a/engines/saga2/task.h
+++ b/engines/saga2/task.h
@@ -86,12 +86,7 @@ TaskStack *getTaskStackAddress(TaskStackID id);
// Initialize the task stack list
void initTaskStacks(void);
-// Save the task stack list to a save file
-void saveTaskStacks(SaveFileConstructor &saveGame);
void saveTaskStacks(Common::OutSaveFile *out);
-
-// Load the task stack list from a save file
-void loadTaskStacks(SaveFileReader &saveGame);
void loadTaskStacks(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the task stacks
@@ -113,12 +108,7 @@ Task *getTaskAddress(TaskID id);
// Initialize the task list
void initTasks(void);
-// Save the task list to a save file
-void saveTasks(SaveFileConstructor &saveGame);
void saveTasks(Common::OutSaveFile *out);
-
-// Load the task list from a save file
-void loadTasks(SaveFileReader &saveGame);
void loadTasks(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the task list
@@ -148,9 +138,6 @@ public:
newTask(this, id);
}
- // Constructor -- reconstruct from archive buffer
- Task(void **buf, TaskID id);
-
Task(Common::InSaveFile *in, TaskID id);
// Virtual destructor -- do nothing
@@ -162,9 +149,6 @@ public:
// in a buffer
virtual int32 archiveSize(void) const;
- // Create an archive of this task in a buffer
- virtual void *archive(void *buf) const;
-
virtual void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -199,18 +183,12 @@ public:
wander();
}
- // Constructor -- reconstruct from archive buffer
- WanderTask(void **buf, TaskID id);
-
WanderTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -275,18 +253,12 @@ public:
_type = "TetheredWanderTask";
}
- // Constructor -- reconstruct from archive buffer
- TetheredWanderTask(void **buf, TaskID id);
-
TetheredWanderTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
#if DEBUG
@@ -325,9 +297,6 @@ public:
_type = "GotoTask";
}
- // Constructor -- reconstruct from archive buffer
- GotoTask(void **buf, TaskID id);
-
GotoTask(Common::InSaveFile *in, TaskID id);
// Fixup the subtask pointer
@@ -337,9 +306,6 @@ public:
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
#if DEBUG
@@ -380,18 +346,12 @@ public:
_type = "GotoLocationTask";
}
- // Constructor -- reconstruct from archive buffer
- GotoLocationTask(void **buf, TaskID id);
-
GotoLocationTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -442,18 +402,12 @@ public:
_type = "GotoRegionTask";
}
- // Constructor -- reconstruct from archive buffer
- GotoRegionTask(void **buf, TaskID id);
-
GotoRegionTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -505,18 +459,12 @@ public:
_type = "GotoObjectTargetTask";
}
- // Constructor -- reconstruct from archive buffer
- GotoObjectTargetTask(void **buf, TaskID id);
-
GotoObjectTargetTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
private:
@@ -556,18 +504,12 @@ public:
_type = "GotoObjectTask";
}
- // Constructor -- reconstruct from archive buffer
- GotoObjectTask(void **buf, TaskID id);
-
GotoObjectTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -600,18 +542,12 @@ public:
debugC(2, kDebugTasks, " - GotoActorTask");
_type = "GotoActorTask";
}
- // Constructor -- reconstruct from archive buffer
- GotoActorTask(void **buf, TaskID id);
-
GotoActorTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -660,18 +596,12 @@ public:
_type = "GoAwayFromTask";
}
- // Constructor -- reconstruct from archive buffer
- GoAwayFromTask(void **buf, TaskID id);
-
GoAwayFromTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
#if DEBUG
@@ -704,18 +634,12 @@ public:
_type = "GoAwayFromObjectTask";
}
- // Constructor -- reconstruct from archive buffer
- GoAwayFromObjectTask(void **buf, TaskID id);
-
GoAwayFromObjectTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -746,18 +670,12 @@ public:
const ActorTarget &at,
bool runFlag = false);
- // Constructor -- reconstruct from archive buffer
- GoAwayFromActorTask(void **buf, TaskID id);
-
GoAwayFromActorTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -795,18 +713,12 @@ public:
_type = "HuntTask";
}
- // Constructor -- reconstruct from archive buffer
- HuntTask(void **buf, TaskID id);
-
HuntTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
#if DEBUG
@@ -850,18 +762,12 @@ public:
// Constructor -- initial construction
HuntLocationTask(TaskStack *ts, const Target &t);
- // Constructor -- reconstruct from archive buffer
- HuntLocationTask(void **buf, TaskID id);
-
HuntLocationTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
protected:
@@ -899,18 +805,12 @@ public:
_type = "HuntToBeNearLocationTask";
}
- // Constructor -- reconstruct from archive buffer
- HuntToBeNearLocationTask(void **buf, TaskID id);
-
HuntToBeNearLocationTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -949,18 +849,12 @@ public:
// Constructor -- initial construction
HuntObjectTask(TaskStack *ts, const ObjectTarget &ot);
- // Constructor -- reconstruct from archive buffer
- HuntObjectTask(void **buf, TaskID id);
-
HuntObjectTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
protected:
@@ -1000,18 +894,12 @@ public:
_type = "HuntToBeNearObjectTask";
}
- // Constructor -- reconstruct from archive buffer
- HuntToBeNearObjectTask(void **buf, TaskID id);
-
HuntToBeNearObjectTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -1060,18 +948,12 @@ public:
_type = "HuntToPossessTask";
}
- // Constructor -- reconstruct from archive buffer
- HuntToPossessTask(void **buf, TaskID id);
-
HuntToPossessTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -1113,18 +995,12 @@ public:
const ActorTarget &at,
bool trackFlag);
- // Constructor -- reconstruct from archive buffer
- HuntActorTask(void **buf, TaskID id);
-
HuntActorTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
protected:
@@ -1176,18 +1052,12 @@ public:
_type = "HuntToBeNearActorTask";
}
- // Constructor -- reconstruct from archive buffer
- HuntToBeNearActorTask(void **buf, TaskID id);
-
HuntToBeNearActorTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
#if DEBUG
@@ -1248,18 +1118,12 @@ public:
const ActorTarget &at,
bool trackFlag = false);
- // Constructor -- reconstruct from archive buffer
- HuntToKillTask(void **buf, TaskID id);
-
HuntToKillTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -1310,18 +1174,12 @@ public:
_type = "HuntToGiveTask";
}
- // Constructor -- reconstruct from archive buffer
- HuntToGiveTask(void **buf, TaskID id);
-
HuntToGiveTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -1439,18 +1297,12 @@ public:
_type = "BandTask";
}
- // Constructor -- reconstruct from archive buffer
- BandTask(void **buf, TaskID id);
-
BandTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
#if DEBUG
@@ -1525,9 +1377,6 @@ public:
// Constructor -- initial constructor
BandAndAvoidEnemiesTask(TaskStack *ts) : BandTask(ts) {}
- // Constructor -- reconstruct from archive buffer
- BandAndAvoidEnemiesTask(void **buf, TaskID id) : BandTask(buf, id) {}
-
BandAndAvoidEnemiesTask(Common::InSaveFile *in, TaskID id) : BandTask(in, id) {}
// Return an integer representing the type of this task
@@ -1571,18 +1420,12 @@ public:
followPatrolRoute();
}
- // Constructor -- reconstruct from archive buffer
- FollowPatrolRouteTask(void **buf, TaskID id);
-
FollowPatrolRouteTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
#if DEBUG
@@ -1630,18 +1473,12 @@ public:
_type = "AttendTask";
}
- // Constructor -- reconstruct from archive buffer
- AttendTask(void **buf, TaskID id);
-
AttendTask(Common::InSaveFile *in, TaskID id);
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
void write(Common::OutSaveFile *out) const;
// Return an integer representing the type of this task
@@ -1676,9 +1513,6 @@ public:
subTask(NULL) {
}
- // Constructor -- reconstruct from archive buffer
- DefendTask(void **buf, TaskID id);
-
// Fixup the subtask pointer
void fixup(void);
@@ -1686,9 +1520,6 @@ public:
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
// Return an integer representing the type of this task
int16 getType(void) const;
@@ -1724,16 +1555,10 @@ public:
flags(0) {
}
- // Constructor -- reconstruct from archive buffer
- ParryTask(void **buf, TaskID id);
-
// Return the number of bytes needed to archive this object in
// a buffer
int32 archiveSize(void) const;
- // Create an archive of this object in a buffer
- void *archive(void *buf) const;
-
// Return an integer representing the type of this task
int16 getType(void) const;
@@ -1778,9 +1603,6 @@ public:
newTaskStack(this);
}
- // Constructor -- reconstruct from archive buffer
- TaskStack(void **buf);
-
// Destructor
~TaskStack(void) {
deleteTaskStack(this);
@@ -1795,9 +1617,6 @@ public:
+ sizeof(evalRate);
}
- // Create an archive of this TaskStack in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
void read(Common::InSaveFile *in);
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 0d15b35599..7fef386d25 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -781,81 +781,6 @@ void initActiveItemStates(void) {
}
}
-//-----------------------------------------------------------------------
-// Save the active item instance states in a save file
-
-void saveActiveItemStates(SaveFileConstructor &saveGame) {
- int16 i;
-
- int32 archiveBufSize = 0;
- void *archiveBuffer;
- void *bufferPtr;
-
- for (i = 0; i < worldCount; i++) {
- int32 size = tileRes->size(tagStateID + i);
- archiveBufSize += sizeof(int16);
- if (stateArray[i] != nullptr)
- archiveBufSize += size;
- }
-
- archiveBuffer = malloc(archiveBufSize);
- if (archiveBuffer == nullptr)
- error("Unable to allocate a state array archive buffer");
-
- bufferPtr = archiveBuffer;
-
- for (i = 0; i < worldCount; i++) {
- if (stateArray[i] != nullptr) {
- WorldMapData *mapData = &mapList[i];
- ActiveItemList *activeItemList = mapData->activeItemList;
- int16 activeItemCount = mapData->activeCount,
- j;
- int32 arraySize = tileRes->size(tagStateID + i);
- uint8 *bufferedStateArray;
-
- // Save the size of the state array
- WRITE_LE_INT16(bufferPtr, arraySize / sizeof(uint8));
- bufferPtr = (int16 *)bufferPtr + 1;
-
- // Copy the state data to the archive buffer
- memcpy(bufferPtr, stateArray[i], arraySize);
- // Save a pointer to the buffered data
- bufferedStateArray = (uint8 *)bufferPtr;
- bufferPtr = (uint8 *)bufferPtr + arraySize;
-
- for (j = 0; j < activeItemCount; j++) {
- ActiveItem *activeItem = activeItemList->_items[j];
- uint8 *statePtr;
-
- if (activeItem->_data.itemType != activeTypeInstance)
- continue;
-
- // Get a pointer to the current active item's state
- // data in the archive buffer
- statePtr =
- &bufferedStateArray[activeItem->_data.instance.stateIndex];
-
- // Set the high bit of the state value based upon the
- // active item's locked state
- if (activeItem->isLocked())
- *statePtr |= (1 << 7);
- else
- *statePtr &= ~(1 << 7);
- }
- } else {
- WRITE_LE_INT16(bufferPtr, 0);
- bufferPtr = (int16 *)bufferPtr + 1;
- }
- }
-
- saveGame.writeChunk(
- MakeID('T', 'A', 'G', 'S'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveActiveItemStates(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving ActiveItemStates");
@@ -911,75 +836,6 @@ void saveActiveItemStates(Common::OutSaveFile *out) {
}
}
-//-----------------------------------------------------------------------
-// Load the active item instance states from a save file
-
-void loadActiveItemStates(SaveFileReader &saveGame) {
- int16 i;
-
- void *archiveBuffer;
- void *bufferPtr;
-
- stateArray = new byte *[worldCount]();
-
- if (stateArray == nullptr)
- error("Unable to allocate the active item state array array");
-
- archiveBuffer = malloc(saveGame.getChunkSize());
-
- if (archiveBuffer == nullptr)
- error("Unable to allocate state array archive buffer");
-
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- for (i = 0; i < worldCount; i++) {
- int32 arraySize;
-
- arraySize = READ_LE_INT16(bufferPtr) * sizeof(uint8);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- if (arraySize > 0) {
- WorldMapData *mapData = &mapList[i];
- ActiveItemList *activeItemList = mapData->activeItemList;
- int16 activeItemCount = mapData->activeCount,
- j;
- uint8 *bufferedStateArray = (uint8 *)bufferPtr;
-
- for (j = 0; j < activeItemCount; j++) {
- ActiveItem *activeItem = activeItemList->_items[j];
- uint8 *statePtr;
-
- if (activeItem->_data.itemType != activeTypeInstance)
- continue;
-
- // Get a pointer to the current active item's state
- // data in the archive buffer
- statePtr =
- &bufferedStateArray[activeItem->_data.instance.stateIndex];
-
- // Reset the locked state of the active item based
- // upon the high bit of the buffered state value
- activeItem->setLocked((*statePtr & (1 << 7)) != 0);
-
- // Clear the high bit of the state value
- *statePtr &= ~(1 << 7);
- }
-
- stateArray[i] = (byte *)malloc(arraySize);
- if (stateArray[i] == nullptr)
- error("Unable to allocate active item state array");
-
- memcpy(stateArray[i], bufferPtr, arraySize);
- bufferPtr = (uint8 *)bufferPtr + arraySize;
- } else
- stateArray[i] = nullptr;
- }
-
- free(archiveBuffer);
-}
-
void loadActiveItemStates(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading ActiveItemStates");
@@ -1115,29 +971,6 @@ int32 TileActivityTaskList::archiveSize(void) {
return size;
}
-//-----------------------------------------------------------------------
-// Create an archive of this TileActivityTaskList in the specified
-// archive buffer
-
-Common::MemorySeekableReadWriteStream *TileActivityTaskList::archive(Common::MemorySeekableReadWriteStream *stream) {
- int16 taskCount = _list.size();
-
- // Store the task count
- stream->writeSint16LE(taskCount);
-
- for (Common::List<TileActivityTask *>::iterator it = _list.begin(); it != _list.end(); ++it) {
- ActiveItem *ai = (*it)->tai;
-
- // Store the activeItemID
- stream->writeSint16LE(ai->thisID());
-
- // Store the task type
- stream->writeByte((*it)->activityType);
- }
-
- return stream;
-}
-
void TileActivityTaskList::read(Common::InSaveFile *in) {
int16 taskCount;
@@ -1408,34 +1241,6 @@ void moveActiveTerrain(int32 deltaTime) {
void initTileTasks(void) {
}
-//-----------------------------------------------------------------------
-// Save the tile activity task list to a save file
-
-void saveTileTasks(SaveFileConstructor &saveGame) {
- int32 archiveBufSize;
- byte *archiveBuffer;
- Common::MemorySeekableReadWriteStream *stream;
-
- archiveBufSize = aTaskList.archiveSize();
-
- archiveBuffer = (byte *)malloc(archiveBufSize);
- if (archiveBuffer == nullptr)
- error("Unable to allocate tile activity task archive buffer");
-
- stream = new Common::MemorySeekableReadWriteStream(archiveBuffer,
- archiveBufSize,
- DisposeAfterUse::YES);
-
- aTaskList.archive(stream);
-
- saveGame.writeChunk(
- MakeID('T', 'A', 'C', 'T'),
- archiveBuffer,
- archiveBufSize);
-
- delete stream;
-}
-
void saveTileTasks(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving TileActivityTasks");
@@ -1448,34 +1253,6 @@ void saveTileTasks(Common::OutSaveFile *out) {
aTaskList.write(out);
}
-//-----------------------------------------------------------------------
-// Load the tile activity task list from a save file
-
-void loadTileTasks(SaveFileReader &saveGame) {
- // If there is no saved data, simply call the default constructor
- if (saveGame.getChunkSize() == 0) {
- new (&aTaskList) TileActivityTaskList;
- return;
- }
-
- void *archiveBuffer;
- void *bufferPtr;
-
- archiveBuffer = malloc(saveGame.getChunkSize());
- if (archiveBuffer == nullptr)
- error("Unable to allocate tile activity task archive buffer");
-
- // Read the archived tile activity task data
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- // Reconstruct aTaskList from archived data
- new (&aTaskList) TileActivityTaskList(&bufferPtr);
-
- free(archiveBuffer);
-}
-
void loadTileTasks(Common::InSaveFile *in, int32 chunkSize) {
debugC(2, kDebugSaveload, "Loading TileActivityTasks");
@@ -1849,69 +1626,6 @@ void initAutoMap(void) {
}
-//-----------------------------------------------------------------------
-
-void saveAutoMap(SaveFileConstructor &saveGame) {
- int32 totalMapSize = 0,
- totalMapIndex = 0;
- int16 i;
-
- uint8 *archiveBuffer;
- int32 archiveBufSize;
-
- for (i = 0; i < worldCount; i++) {
- MapHeader *map;
- int32 mapSize;
-
- map = mapList[i].map;
- mapSize = map->size;
- mapSize *= mapSize;
-
- totalMapSize += mapSize;
- }
-
- // Compute the number of bytes needed to store the visited bit
- // for each map metatile slot
- archiveBufSize = (totalMapSize + 7) >> 3;
-
- archiveBuffer = (uint8 *)calloc(1, archiveBufSize);
- if (archiveBuffer == nullptr)
- error("Unable to allocate auto map archive buffer");
-
- for (i = 0; i < worldCount; i++) {
- MapHeader *map;
- int32 mapSize,
- mapIndex;
- uint16 *mapData;
-
- map = mapList[i].map;
- mapSize = map->size;
- mapSize *= mapSize;
- mapData = map->mapData;
-
- for (mapIndex = 0; mapIndex < mapSize; mapIndex++) {
- if (mapData[mapIndex] & metaTileVisited) {
- // Set the bit in the archive buffer
- archiveBuffer[totalMapIndex >> 3] |=
- (1 << (totalMapIndex & 7));
- } else {
- // Clear the bit in the archive buffer
- archiveBuffer[totalMapIndex >> 3] &=
- ~(1 << (totalMapIndex & 7));
- }
-
- totalMapIndex++;
- }
- }
-
- saveGame.writeChunk(
- MakeID('A', 'M', 'A', 'P'),
- archiveBuffer,
- archiveBufSize);
-
- free(archiveBuffer);
-}
-
void saveAutoMap(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving AutoMap");
@@ -1975,54 +1689,6 @@ void saveAutoMap(Common::OutSaveFile *out) {
free(archiveBuffer);
}
-//-----------------------------------------------------------------------
-
-void loadAutoMap(SaveFileReader &saveGame) {
- debugC(2, kDebugSaveload, "Loading AutoMap");
-
- int32 totalMapIndex = 0;
- int16 i;
-
- uint8 *archiveBuffer;
- int32 archiveBufSize;
-
- archiveBufSize = saveGame.getChunkSize();
-
- archiveBuffer = (uint8 *)malloc(archiveBufSize);
- if (archiveBuffer == nullptr)
- error("Unable to allocate auto map archive buffer");
-
- saveGame.read(archiveBuffer, archiveBufSize);
-
- for (i = 0; i < worldCount; i++) {
- MapHeader *map;
- int32 mapSize,
- mapIndex;
- uint16 *mapData;
-
- map = mapList[i].map;
- mapSize = map->size;
- mapSize *= mapSize;
- mapData = map->mapData;
-
- for (mapIndex = 0; mapIndex < mapSize; mapIndex++) {
- assert((totalMapIndex >> 3) < archiveBufSize);
-
- // If the bit is set in the archive buffer, set the visited
- // bit in the map data
- if (archiveBuffer[totalMapIndex >> 3]
- & (1 << (totalMapIndex & 7)))
- mapData[mapIndex] |= metaTileVisited;
- else
- mapData[mapIndex] &= ~metaTileVisited;
-
- totalMapIndex++;
- }
- }
-
- free(archiveBuffer);
-}
-
void loadAutoMap(Common::InSaveFile *in, int32 chunkSize) {
int32 totalMapIndex = 0;
uint8 *archiveBuffer;
@@ -4577,30 +4243,6 @@ void initTileCyclingStates(void) {
}
}
-//-----------------------------------------------------------------------
-// Save the tile cycling state array in a save file
-
-void saveTileCyclingStates(SaveFileConstructor &saveGame) {
- TileCycleArchive *archiveBuffer;
- int16 i;
-
- archiveBuffer = new TileCycleArchive[cycleCount]();
- if (archiveBuffer == nullptr)
- error("Unable to allocate tile cycle data archive buffer");
-
- for (i = 0; i < cycleCount; i++) {
- archiveBuffer[i].counter = cycleList[i].counter;
- archiveBuffer[i].currentState = cycleList[i].currentState;
- }
-
- saveGame.writeChunk(
- MakeID('C', 'Y', 'C', 'L'),
- archiveBuffer,
- sizeof(TileCycleArchive) * cycleCount);
-
- delete[] archiveBuffer;
-}
-
void saveTileCyclingStates(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving TileCyclingStates");
@@ -4620,31 +4262,6 @@ void saveTileCyclingStates(Common::OutSaveFile *out) {
}
}
-//-----------------------------------------------------------------------
-// Load the tile cycling state array from a save file
-
-void loadTileCyclingStates(SaveFileReader &saveGame) {
- TileCycleArchive *archiveBuffer;
- int16 i;
-
- initTileCyclingStates();
-
- assert(saveGame.getChunkSize() == (int)sizeof(TileCycleArchive) * cycleCount);
-
- archiveBuffer = new TileCycleArchive[cycleCount]();
- if (archiveBuffer == nullptr)
- error("Unable to allocate tile cycle data archive buffer");
-
- saveGame.read(archiveBuffer, sizeof(TileCycleArchive) * cycleCount);
-
- for (i = 0; i < cycleCount; i++) {
- cycleList[i].counter = archiveBuffer[i].counter;
- cycleList[i].currentState = archiveBuffer[i].currentState;
- }
-
- delete[] archiveBuffer;
-}
-
void loadTileCyclingStates(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading TileCyclingStates");
diff --git a/engines/saga2/tile.h b/engines/saga2/tile.h
index 2e8cff1595..a7aa6fbc73 100644
--- a/engines/saga2/tile.h
+++ b/engines/saga2/tile.h
@@ -618,10 +618,6 @@ public:
// TileActivityTaskList
int32 archiveSize(void);
- // Create an archive of this TileActivityTaskList in the specified
- // archive buffer
- Common::MemorySeekableReadWriteStream *archive(Common::MemorySeekableReadWriteStream *stream);
-
void read(Common::InSaveFile *in);
void write(Common::OutSaveFile *out);
@@ -1005,12 +1001,7 @@ void initPlatformCache(void);
// Initialize the tile activity task list
void initTileTasks(void);
-// Save the tile activity task list to a save file
-void saveTileTasks(SaveFileConstructor &saveGame);
void saveTileTasks(Common::OutSaveFile *out);
-
-// Load the tile activity task list from a save file
-void loadTileTasks(SaveFileReader &saveGame);
void loadTileTasks(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the tile activity task list
@@ -1019,23 +1010,17 @@ void cleanupTileTasks(void);
TilePoint getClosestPointOnTAI(ActiveItem *TAI, GameObject *obj);
void initActiveItemStates(void);
-void saveActiveItemStates(SaveFileConstructor &saveGame);
void saveActiveItemStates(Common::OutSaveFile *out);
-void loadActiveItemStates(SaveFileReader &saveGame);
void loadActiveItemStates(Common::InSaveFile *in);
void cleanupActiveItemStates(void);
void initTileCyclingStates(void);
-void saveTileCyclingStates(SaveFileConstructor &saveGame);
void saveTileCyclingStates(Common::OutSaveFile *out);
-void loadTileCyclingStates(SaveFileReader &saveGame);
void loadTileCyclingStates(Common::InSaveFile *in);
void cleanupTileCyclingStates(void);
void initAutoMap(void);
-void saveAutoMap(SaveFileConstructor &saveGame);
void saveAutoMap(Common::OutSaveFile *out);
-void loadAutoMap(SaveFileReader &saveGame);
void loadAutoMap(Common::InSaveFile *in, int32 chunkSize);
inline void cleanupAutoMap(void) { /* nothing to do */ }
diff --git a/engines/saga2/tilemode.cpp b/engines/saga2/tilemode.cpp
index a529c66806..4130a5eb81 100644
--- a/engines/saga2/tilemode.cpp
+++ b/engines/saga2/tilemode.cpp
@@ -610,33 +610,6 @@ void initTileModeState(void) {
combatPaused = false;
}
-//-----------------------------------------------------------------------
-// Save the tile mode state to a save file
-
-void saveTileModeState(SaveFileConstructor &saveGame) {
- int32 size = 0;
-
- assert(uiKeysEnabled);
-
- // Compute the number of bytes needed
- size += sizeof(aggressiveActFlag)
- + sizeof(inCombat)
- + sizeof(combatPaused);
- if (aggressiveActFlag)
- size += sizeof(timeOfLastAggressiveAct);
-
- // Create the chunk and write the data
- saveGame.newChunk(MakeID('T', 'M', 'S', 'T'), size);
- saveGame.write(&aggressiveActFlag, sizeof(aggressiveActFlag));
- saveGame.write(&inCombat, sizeof(inCombat));
- saveGame.write(&combatPaused, sizeof(combatPaused));
- if (aggressiveActFlag) {
- saveGame.write(
- &timeOfLastAggressiveAct,
- sizeof(timeOfLastAggressiveAct));
- }
-}
-
void saveTileModeState(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving TileModeState");
@@ -666,26 +639,6 @@ void saveTileModeState(Common::OutSaveFile *out) {
timeOfLastAggressiveAct.write(out);
}
-//-----------------------------------------------------------------------
-// Load the tile mode state from a save file
-
-void loadTileModeState(SaveFileReader &saveGame) {
- debugC(2, kDebugSaveload, "Loading TileModeState");
-
- assert(uiKeysEnabled);
-
- // Simply read in the data
- saveGame.read(&aggressiveActFlag, sizeof(aggressiveActFlag));
- saveGame.read(&inCombat, sizeof(inCombat));
- saveGame.read(&combatPaused, sizeof(combatPaused));
- if (aggressiveActFlag) {
- saveGame.read(
- &timeOfLastAggressiveAct,
- sizeof(timeOfLastAggressiveAct));
- }
- tileLockFlag = false;
-}
-
void loadTileModeState(Common::InSaveFile *in) {
assert(uiKeysEnabled);
diff --git a/engines/saga2/tilemode.h b/engines/saga2/tilemode.h
index f1f4504eb6..15a802695d 100644
--- a/engines/saga2/tilemode.h
+++ b/engines/saga2/tilemode.h
@@ -31,9 +31,6 @@
namespace Saga2 {
-class SaveFileConstructor;
-class SaveFileReader;
-
// Function to enable/disable user interface keys
bool enableUIKeys(bool enabled);
@@ -48,12 +45,7 @@ void logAggressiveAct(ObjectID attackerID, ObjectID attackeeID);
// Initialize the tile mode state
void initTileModeState(void);
-// Save the tile mode state to a save file
-void saveTileModeState(SaveFileConstructor &saveGame);
void saveTileModeState(Common::OutSaveFile *out);
-
-// Load the tile mode state from a save file
-void loadTileModeState(SaveFileReader &saveGame);
void loadTileModeState(Common::InSaveFile *in);
// Cleanup the tile mode state
diff --git a/engines/saga2/timers.cpp b/engines/saga2/timers.cpp
index eceb1c37c3..4fa5ca87b7 100644
--- a/engines/saga2/timers.cpp
+++ b/engines/saga2/timers.cpp
@@ -58,15 +58,6 @@ void resumeTimer() {
timerPaused = false;
}
-void saveTimer(SaveFileConstructor &saveGame) {
- int32 time = gameTime;
-
- saveGame.writeChunk(
- MakeID('T', 'I', 'M', 'E'),
- &time,
- sizeof(time));
-}
-
void saveTimer(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving time");
@@ -79,13 +70,6 @@ void saveTimer(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "... time = %d", time);
}
-void loadTimer(SaveFileReader &saveGame) {
- int32 time;
-
- saveGame.read(&time, sizeof(time));
- gameTime = time;
-}
-
void loadTimer(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading time");
@@ -171,76 +155,6 @@ void initTimers(void) {
// Nothing to do
}
-//----------------------------------------------------------------------
-// Save the active Timers in a save file
-
-void saveTimers(SaveFileConstructor &saveGame) {
- warning("STUB: saveTimers");
-
-#if 0
- int16 timerListCount = 0,
- timerCount = 0;
-
- TimerListHolder *listHolder;
- TimerHolder *timerHolder;
-
- void *archiveBuffer,
- *bufferPtr;
- int32 archiveBufSize = 0;
-
- // Add the sizes of the timer list count an timer count
- archiveBufSize += sizeof(timerListCount) + sizeof(timerCount);
-
- // Tally the timer lists
- for (listHolder = (TimerListHolder *)timerListList.first(); listHolder != NULL; listHolder = (TimerListHolder *)listHolder->next())
- timerListCount++;
-
- // Add the total archive size of all of the timer lists
- archiveBufSize += timerListCount * TimerList::archiveSize();
-
- // Tally the timers
- for (timerHolder = (TimerHolder *)timerList.first(); timerHolder != NULL; timerHolder = (TimerHolder *)timerHolder->next())
- timerCount++;
-
- // Add the total archive size of all of the timers
- archiveBufSize += timerCount * Timer::archiveSize();
-
- // Allocate an archive buffer
- archiveBuffer = RNewPtr(archiveBufSize, NULL, "archive buffer");
- if (archiveBuffer == NULL)
- error("Unable to allocate timer archive buffer");
-
- bufferPtr = archiveBuffer;
-
- // Store the timer list count and timer count
- *((int16 *)bufferPtr) = timerListCount;
- *((int16 *)bufferPtr + 1) = timerCount;
- bufferPtr = (int16 *)bufferPtr + 2;
-
- // Archive all timer lists
- for (listHolder = (TimerListHolder *)timerListList.first();
- listHolder != NULL;
- listHolder = (TimerListHolder *)listHolder->next())
- bufferPtr = listHolder->getTimerList()->archive(bufferPtr);
-
- // Archive all timers
- for (timerHolder = (TimerHolder *)timerList.first();
- timerHolder != NULL;
- timerHolder = (TimerHolder *)timerHolder->next())
- bufferPtr = timerHolder->getTimer()->archive(bufferPtr);
-
- assert(bufferPtr == &((uint8 *)archiveBuffer)[archiveBufSize]);
-
- // Write the data to the save file
- saveGame.writeChunk(
- MakeID('T', 'I', 'M', 'R'),
- archiveBuffer,
- archiveBufSize);
-
- RDisposePtr(archiveBuffer);
-#endif
-}
-
static int getTimerListID(TimerList *t) {
int i = 0;
for (Common::List<TimerList *>::iterator it = g_vm->_timerLists.begin(); it != g_vm->_timerLists.end(); it++, i++) {
@@ -307,63 +221,6 @@ void saveTimers(Common::OutSaveFile *out) {
}
}
-//----------------------------------------------------------------------
-// Load the Timers from a save file
-
-void loadTimers(SaveFileReader &saveGame) {
- warning("STUB: loadTimers");
-
-#if 0
- int16 i,
- timerListCount,
- timerCount;
-
- void *archiveBuffer,
- *bufferPtr;
-
- // Allocate a buffer in which to read the archive data
- archiveBuffer = RNewPtr(saveGame.getChunkSize(), NULL, "archive buffer");
- if (archiveBuffer == NULL)
- error("Unable to allocate timer archive buffer");
-
- // Read the data
- saveGame.read(archiveBuffer, saveGame.getChunkSize());
-
- bufferPtr = archiveBuffer;
-
- // Get the timer list count and timer count
- timerListCount = *((int16 *)bufferPtr);
- timerCount = *((int16 *)bufferPtr + 1);
- bufferPtr = (int16 *)bufferPtr + 2;
-
- // Restore all timer lists
- for (i = 0; i < timerListCount; i++)
- new TimerList(&bufferPtr);
-
- // Restore all timers
- for (i = 0; i < timerCount; i++) {
- Timer *timer;
- TimerList *timerList;
-
- timer = new Timer(&bufferPtr);
-
- assert(timer != NULL);
-
- // Get the objects's timer list
- timerList = fetchTimerList(timer->getObject());
-
- assert(timerList != NULL);
-
- // Append this timer to the objects's timer list
- timerList->addTail(*timer);
- }
-
- assert(bufferPtr == &((uint8 *)archiveBuffer)[saveGame.getChunkSize()]);
-
- RDisposePtr(archiveBuffer);
-#endif
-}
-
void loadTimers(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading Timers");
@@ -428,21 +285,6 @@ TimerList::TimerList(GameObject *o) : _obj(o) {
g_vm->_timerLists.push_back(this);
}
-TimerList::TimerList(void **buf) {
- ObjectID *bufferPtr = (ObjectID *)*buf;
-
- warning("STUB: TimerList::TimerList(buf)");
-
- assert(isObject(*bufferPtr) || isActor(*bufferPtr));
-
- // Restore the object pointer
- _obj = GameObject::objectAddress(*bufferPtr++);
-
- *buf = bufferPtr;
-
- g_vm->_timerLists.push_back(this);
-}
-
TimerList::TimerList(Common::InSaveFile *in) {
ObjectID id = in->readUint16LE();
@@ -460,17 +302,6 @@ TimerList::~TimerList() {
g_vm->_timerLists.remove(this);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *TimerList::archive(void *buf) {
- // Store the object's ID
- *((ObjectID *)buf) = _obj->thisID();
- buf = (ObjectID *)buf + 1;
-
- return buf;
-}
-
void TimerList::write(Common::OutSaveFile *out) {
// Store the object's ID
out->writeUint16LE(_obj->thisID());
@@ -480,37 +311,6 @@ void TimerList::write(Common::OutSaveFile *out) {
Timer member functions
* ===================================================================== */
-//----------------------------------------------------------------------
-// Constructor -- reconstruct from an archive buffer
-
-Timer::Timer(void **buf) {
- void *bufferPtr = *buf;
-
- warning("STUB: Timer::Timer(buf)");
-
- assert(isObject(*((ObjectID *)bufferPtr)) || isActor(*((ObjectID *)bufferPtr)));
-
- // Restore the object pointer
- _obj = GameObject::objectAddress(*((ObjectID *)bufferPtr));
- bufferPtr = (ObjectID *)bufferPtr + 1;
-
- // Restore the timer's ID
- _id = *((TimerID *)bufferPtr);
- bufferPtr = (TimerID *)bufferPtr + 1;
-
- // Restore the frame interval
- _interval = *((int16 *)bufferPtr);
- bufferPtr = (int16 *)bufferPtr + 1;
-
- // Restore the alarm
- memcpy(&_alarm, bufferPtr, sizeof(Alarm));
- bufferPtr = (FrameAlarm *)bufferPtr + 1;
-
- *buf = bufferPtr;
-
- g_vm->_timers.push_back(this);
-}
-
Timer::Timer(Common::InSaveFile *in) {
ObjectID id = in->readUint16LE();
@@ -546,29 +346,6 @@ int32 Timer::archiveSize(void) {
+ sizeof(FrameAlarm);
}
-//----------------------------------------------------------------------
-// Archive this object in a buffer
-
-void *Timer::archive(void *buf) {
- // Store the obj's ID
- *((ObjectID *)buf) = _obj->thisID();
- buf = (ObjectID *)buf + 1;
-
- // Store the timer's ID
- *((TimerID *)buf) = _id;
- buf = (TimerID *)buf + 1;
-
- // Store the frame interval
- *((int16 *)buf) = _interval;
- buf = (int16 *)buf + 1;
-
- // Store the alarm
- memcpy(buf, &_alarm, sizeof(Alarm));
- buf = (FrameAlarm *)buf + 1;
-
- return buf;
-}
-
void Timer::write(Common::OutSaveFile *out) {
// Store the obj's ID
out->writeUint16LE(_obj->thisID());
diff --git a/engines/saga2/timers.h b/engines/saga2/timers.h
index e9b61f130b..18d95cac97 100644
--- a/engines/saga2/timers.h
+++ b/engines/saga2/timers.h
@@ -46,11 +46,7 @@ void checkTimers(void);
// Initialize the Timers
void initTimers(void);
-// Save the active Timers in a save file
-void saveTimers(SaveFileConstructor &saveGame);
void saveTimers(Common::OutSaveFile *out);
-// Load Timers from a save file
-void loadTimers(SaveFileReader &saveGame);
void loadTimers(Common::InSaveFile *in);
// Cleanup the active Timers
void cleanupTimers(void);
@@ -66,9 +62,6 @@ public:
// Constructor -- initial construction
TimerList(GameObject *o);
- // Constructor -- reconstruct from archive buffer
- TimerList(void **buf);
-
TimerList(Common::InSaveFile *in);
~TimerList();
@@ -79,9 +72,6 @@ public:
return sizeof(ObjectID);
}
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
GameObject *getObject(void) {
@@ -113,9 +103,6 @@ public:
g_vm->_timers.push_back(this);
}
- // Constructor -- reconstruct from archive buffer
- Timer(void **buf);
-
Timer(Common::InSaveFile *in);
~Timer();
@@ -124,9 +111,6 @@ public:
// a buffer
static int32 archiveSize(void);
- // Archive this object in a buffer
- void *archive(void *buf);
-
void write(Common::OutSaveFile *out);
GameObject *getObject(void) {
diff --git a/engines/saga2/vpal.cpp b/engines/saga2/vpal.cpp
index a14ce6cc23..a73ed046b8 100644
--- a/engines/saga2/vpal.cpp
+++ b/engines/saga2/vpal.cpp
@@ -341,23 +341,6 @@ void quickRestorePalette(void) {
}
-//----------------------------------------------------------------------
-// Save the current state of the current palette and fade up/down in
-// a save file.
-
-void savePaletteState(SaveFileConstructor &saveGame) {
- memcpy(&archive.currentPalette, ¤tPalette, sizeof(gPalette));
- memcpy(&archive.oldPalette, &oldPalette, sizeof(gPalette));
- memcpy(&archive.destPalette, &destPalette, sizeof(gPalette));
- archive.startTime = startTime;
- archive.totalTime = totalTime;
-
- saveGame.writeChunk(
- MakeID('P', 'A', 'L', 'E'),
- &archive,
- sizeof(archive));
-}
-
void savePaletteState(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Palette States");
@@ -374,24 +357,6 @@ void savePaletteState(Common::OutSaveFile *out) {
debugC(3, kDebugSaveload, "... totalTime = %d", totalTime);
}
-//----------------------------------------------------------------------
-// Load and set the current state of the current palette and fade
-// up/down from a save file.
-
-void loadPaletteState(SaveFileReader &saveGame) {
- gPalette tempPalette;
-
- saveGame.read(&archive, sizeof(archive));
-
- memcpy(&tempPalette, &archive.currentPalette, sizeof(gPalette));
- memcpy(&oldPalette, &archive.oldPalette, sizeof(gPalette));
- memcpy(&destPalette, &archive.destPalette, sizeof(gPalette));
- startTime = archive.startTime;
- totalTime = archive.totalTime;
-
- setCurrentPalette(&tempPalette);
-}
-
void loadPaletteState(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading Palette States");
Commit: 1d169ee4bffac7f8893cbcd954b0e7f1adb15fa9
https://github.com/scummvm/scummvm/commit/1d169ee4bffac7f8893cbcd954b0e7f1adb15fa9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T17:11:37+02:00
Commit Message:
SAGA2: Remove savefile.*
Changed paths:
R engines/saga2/savefile.cpp
R engines/saga2/savefile.h
engines/saga2/actor.cpp
engines/saga2/actor.h
engines/saga2/band.cpp
engines/saga2/calender.cpp
engines/saga2/contain.cpp
engines/saga2/fta.h
engines/saga2/interp.cpp
engines/saga2/intrface.cpp
engines/saga2/loadsave.cpp
engines/saga2/main.cpp
engines/saga2/mission.cpp
engines/saga2/module.mk
engines/saga2/motion.cpp
engines/saga2/objects.cpp
engines/saga2/player.cpp
engines/saga2/sensor.cpp
engines/saga2/speech.cpp
engines/saga2/spellio.cpp
engines/saga2/task.cpp
engines/saga2/tile.cpp
engines/saga2/tilemode.cpp
engines/saga2/timers.cpp
engines/saga2/uidialog.cpp
engines/saga2/vpal.cpp
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 2813081954..bb5a1f2ffa 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "common/debug.h"
#include "saga2/saga2.h"
@@ -42,7 +40,6 @@
#include "saga2/localize.h"
#include "saga2/intrface.h"
#include "saga2/contain.h"
-#include "saga2/savefile.h"
#include "saga2/combat.h"
// Include files needed for SAGA script dispatch
diff --git a/engines/saga2/actor.h b/engines/saga2/actor.h
index 6ef6f3bf52..188c5c6588 100644
--- a/engines/saga2/actor.h
+++ b/engines/saga2/actor.h
@@ -27,7 +27,6 @@
#ifndef SAGA2_ACTOR_H
#define SAGA2_ACTOR_H
-#include "common/savefile.h"
#include "saga2/objects.h"
namespace Saga2 {
diff --git a/engines/saga2/band.cpp b/engines/saga2/band.cpp
index f76ff7a764..5f4f2a30c5 100644
--- a/engines/saga2/band.cpp
+++ b/engines/saga2/band.cpp
@@ -24,12 +24,9 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/actor.h"
#include "saga2/band.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/calender.cpp b/engines/saga2/calender.cpp
index caa6c2394a..fcf8ee4376 100644
--- a/engines/saga2/calender.cpp
+++ b/engines/saga2/calender.cpp
@@ -24,13 +24,10 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/calender.h"
#include "saga2/intrface.h"
#include "saga2/localize.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/contain.cpp b/engines/saga2/contain.cpp
index 338e62b184..4d1652463e 100644
--- a/engines/saga2/contain.cpp
+++ b/engines/saga2/contain.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/objects.h"
#include "saga2/contain.h"
@@ -38,7 +36,6 @@
#include "saga2/imagcach.h"
#include "saga2/hresmgr.h"
#include "saga2/fontlib.h"
-#include "saga2/savefile.h"
#include "saga2/pclass.r"
diff --git a/engines/saga2/fta.h b/engines/saga2/fta.h
index 1f38a61fee..0d44746374 100644
--- a/engines/saga2/fta.h
+++ b/engines/saga2/fta.h
@@ -53,6 +53,26 @@ const int ticksPerSecond = 72; // 72 ticks per second
const int frameRate = 10,
framePeriod = ticksPerSecond / frameRate;
+/* ===================================================================== *
+ SaveFileHeader class
+ * ===================================================================== */
+
+// This structure represents the first 128 bytes written to a save game
+// file. It stores the game ID and the long name of the saved game state.
+
+struct SaveFileHeader {
+ enum {
+ kSaveNameSize = 40,
+ kHeaderSize = 128
+ };
+
+ ChunkID gameID; // ID of game (FTA2 of DINO).
+ Common::String saveName; // The long name of the saved
+
+ void read(Common::InSaveFile *in);
+ void write(Common::OutSaveFile *out);
+};
+
/* ====================================================================== *
Overall game modes
* ====================================================================== */
diff --git a/engines/saga2/interp.cpp b/engines/saga2/interp.cpp
index c79b8b2151..4db64539ff 100644
--- a/engines/saga2/interp.cpp
+++ b/engines/saga2/interp.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "common/debug.h"
#include "saga2/saga2.h"
@@ -35,7 +33,6 @@
#include "saga2/tile.h"
#include "saga2/mission.h"
#include "saga2/hresmgr.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index dd2015569a..e0d7e236ef 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/blitters.h"
#include "saga2/objects.h"
@@ -33,7 +31,6 @@
#include "saga2/intrface.h"
#include "saga2/grabinfo.h"
#include "saga2/uidialog.h"
-#include "saga2/savefile.h"
#include "saga2/motion.h"
#include "saga2/enchant.h"
#include "saga2/display.h"
diff --git a/engines/saga2/loadsave.cpp b/engines/saga2/loadsave.cpp
index ea1366bcf5..179cd4c8a7 100644
--- a/engines/saga2/loadsave.cpp
+++ b/engines/saga2/loadsave.cpp
@@ -24,11 +24,8 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/loadsave.h"
-#include "saga2/savefile.h"
#include "saga2/objects.h"
#include "saga2/tile.h"
#include "saga2/script.h"
@@ -49,6 +46,31 @@
namespace Saga2 {
+const ChunkID gameID = MKTAG('F', 'T', 'A', '2');
+
+void SaveFileHeader::read(Common::InSaveFile *in) {
+ char fileName[SaveFileHeader::kSaveNameSize];
+ gameID = in->readUint32BE();;
+ in->read(fileName, SaveFileHeader::kSaveNameSize);
+ saveName = fileName;
+}
+
+void SaveFileHeader::write(Common::OutSaveFile *out) {
+ out->writeUint32BE(gameID);
+ out->write(saveName.c_str(), saveName.size());
+
+ int remainingBytes = SaveFileHeader::kHeaderSize - saveName.size() - 4;
+
+ for (int i = 0; i < remainingBytes; ++i)
+ out->writeByte(0);
+
+ debugC(1, kDebugSaveload, "Writing game header: gameID = %s, saveName = %s", tag2str(gameID), saveName.c_str());
+}
+
+Common::String getSaveFileName(int16 saveNo) {
+ return Common::String::format("%3.3d.SAV", saveNo);
+}
+
/* ===================================================================== *
Functions
* ===================================================================== */
@@ -183,6 +205,38 @@ Common::Error saveGameState(int16 saveNo, char *saveName) {
return Common::kNoError;
}
+bool firstChunk(Common::InSaveFile *in, ChunkID &chunk, int32 &size) {
+ if (!in->seek(SaveFileHeader::kHeaderSize, SEEK_SET))
+ error("Error seeking first save game chunk");
+
+ if (in->size() - in->pos() < 8) {
+ debugC(1, kDebugSaveload, "Reached EOF on first Chunk %s", tag2str(chunk));
+ return false;
+ }
+
+ chunk = in->readUint32BE();
+ size = in->readUint32LE();
+
+ debugC(1, kDebugSaveload, "First Chunk loaded: chunkID = %s, size = %d", tag2str(chunk), size);
+
+ return true;
+}
+
+bool nextChunk(Common::InSaveFile *in, ChunkID &chunk, int32 &size) {
+ if (in->size() - in->pos() < 8) {
+ debugC(1, kDebugSaveload, "Reached EOF at %s", tag2str(chunk));
+ return false;
+ }
+
+ chunk = in->readUint32BE();
+ size = in->readUint32LE();
+
+ debugC(1, kDebugSaveload, "Next Chunk loaded: chunkID = %s, size = %d", tag2str(chunk), size);
+
+ // Return success
+ return true;
+}
+
//----------------------------------------------------------------------
// Load a previously saved game state
diff --git a/engines/saga2/main.cpp b/engines/saga2/main.cpp
index a4517a2be6..7d69f0a0f5 100644
--- a/engines/saga2/main.cpp
+++ b/engines/saga2/main.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "common/debug.h"
#include "common/events.h"
#include "common/memstream.h"
@@ -46,7 +44,6 @@
#include "saga2/loadsave.h"
#include "saga2/gamerate.h"
#include "saga2/msgbox.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/mission.cpp b/engines/saga2/mission.cpp
index 6a368ce2a2..8d55e393f8 100644
--- a/engines/saga2/mission.cpp
+++ b/engines/saga2/mission.cpp
@@ -24,12 +24,9 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/mission.h"
#include "saga2/actor.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/module.mk b/engines/saga2/module.mk
index 60f897af81..1d99ed7b6d 100644
--- a/engines/saga2/module.mk
+++ b/engines/saga2/module.mk
@@ -55,7 +55,6 @@ MODULE_OBJS := \
rect.o \
saga2.o \
sagafunc.o \
- savefile.o \
sensor.o \
shorten.o \
speech.o \
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index c668a13fe7..814aa9f42e 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/dispnode.h"
#include "saga2/tile.h"
@@ -35,7 +33,6 @@
#include "saga2/spellbuk.h"
#include "saga2/contain.h"
#include "saga2/intrface.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index 0b78926deb..7198613ba1 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/objects.h"
#include "saga2/tile.h"
@@ -44,7 +42,6 @@
#include "saga2/spellbuk.h"
#include "saga2/tilevect.h"
#include "saga2/dispnode.h"
-#include "saga2/savefile.h"
#include "saga2/methods.r" // generated by SAGA
#include "saga2/pclass.r"
diff --git a/engines/saga2/player.cpp b/engines/saga2/player.cpp
index f9a0392606..0a2f37cfb4 100644
--- a/engines/saga2/player.cpp
+++ b/engines/saga2/player.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/intrface.h"
#include "saga2/contain.h"
@@ -33,7 +31,6 @@
#include "saga2/motion.h"
#include "saga2/transit.h"
#include "saga2/localize.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/savefile.cpp b/engines/saga2/savefile.cpp
deleted file mode 100644
index 5548e4659b..0000000000
--- a/engines/saga2/savefile.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Based on the original sources
- * Faery Tale II -- The Halls of the Dead
- * (c) 1993-1996 The Wyrmkeep Entertainment Co.
- */
-
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
-#include "saga2/saga2.h"
-#include "saga2/savefile.h"
-
-namespace Saga2 {
-
-void SaveFileHeader::read(Common::InSaveFile *in) {
- char fileName[SaveFileHeader::kSaveNameSize];
- gameID = in->readUint32BE();;
- in->read(fileName, SaveFileHeader::kSaveNameSize);
- saveName = fileName;
-}
-
-void SaveFileHeader::write(Common::OutSaveFile *out) {
- out->writeUint32BE(gameID);
- out->write(saveName.c_str(), saveName.size());
-
- int remainingBytes = SaveFileHeader::kHeaderSize - saveName.size() - 4;
-
- for (int i = 0; i < remainingBytes; ++i)
- out->writeByte(0);
-
- debugC(1, kDebugSaveload, "Writing game header: gameID = %s, saveName = %s", tag2str(gameID), saveName.c_str());
-}
-
-/* ===================================================================== *
- Functions
- * ===================================================================== */
-
-//----------------------------------------------------------------------
-// Construct a file name string for a save file based on the save
-// number
-
-void getSaveFileName(int16 saveNo, char *fileName) {
- sprintf(fileName, "%3.3d.SAV", saveNo);
-}
-
-Common::String getSaveFileName(int16 saveNo) {
- return Common::String::format("%3.3d.SAV", saveNo);
-}
-
-/* ===================================================================== *
- SaveFileConstructor member functions
- * ===================================================================== */
-
-//----------------------------------------------------------------------
-// Constructor
-
-SaveFileConstructor::SaveFileConstructor(int16 saveNo, char *saveName) {
- warning("STUB: SaveFileConstructor::SaveFileConstructor");
-
-#if 0
- char fileName[fileNameSize];
-
- // Construct the file name string
- getSaveFileName(saveNo, fileName);
-
- // Open the file. Throw an exception if the file cannot be opened
- if ((fileHandle = fopen(fileName, "wb")) == NULL)
- error("Cannot create save game file \"%s\"", fileName);
-
- SaveFileHeader header;
-
- // Initialize the file header
- memset(&header, '\0', sizeof(header));
-
- header.gameID = gameID;
- Common::strlcpy(header.saveName, saveName, sizeof(header.saveName));
-
- // Write the header
- if (fwrite(&header, sizeof(header), 1, fileHandle) != 1)
- error("Error writing save game header: \"%s\"", fileName);
-
- chunkSize = posInChunk = 0;
-#endif
-}
-
-//----------------------------------------------------------------------
-// Destructor
-
-SaveFileConstructor::~SaveFileConstructor(void) {
- // Simply close the file
- if (fileHandle != NULL) fclose(fileHandle);
-}
-
-//----------------------------------------------------------------------
-// Create a new chunk without writing the chunk data. NOTE: the size
-// of a chunk must be known to call this function.
-
-bool SaveFileConstructor::newChunk(ChunkID id, int32 size) {
- // Determine if file position is at end of previous chunk
- if (posInChunk < chunkSize) return false;
-
- assert(posInChunk == chunkSize);
-
- SaveFileChunkInfo chunkHeader;
-
- // Initialize the chunk header
- chunkHeader.id = id;
- chunkHeader.size = size;
-
- // Write the chunk header
- if (fwrite(&chunkHeader, sizeof(chunkHeader), 1, fileHandle) != 1)
- error("Error writing save game chunk header");
-
- // Set the chunk variables
- chunkSize = size;
- posInChunk = 0;
-
- return true;
-}
-
-//----------------------------------------------------------------------
-// Write data to a chunk created with the newChunk() function.
-
-int32 SaveFileConstructor::write(void *buf, int32 size) {
- // If asking to write more data than the chunk size, adjust
- // the number of bytes to write
- if (size > chunkSize - posInChunk) size = chunkSize - posInChunk;
-
- // Write data
- if (size > 0 && fwrite(buf, size, 1, fileHandle) != 1)
- error("Error writing save game data");
-
- // Adjust the position in chunk
- posInChunk += size;
-
- // Return the number of bytes written
- return size;
-}
-
-//----------------------------------------------------------------------
-// Create a new chunk and write the chunk data.
-
-bool SaveFileConstructor::writeChunk(ChunkID id, void *buf, int32 size) {
- // Determine if file position is at end of previous chunk
- if (posInChunk < chunkSize) return false;
-
- assert(posInChunk == chunkSize);
-
- SaveFileChunkInfo chunkHeader;
-
- // Initialize the chunk header
- chunkHeader.id = id;
- chunkHeader.size = size;
-
- // Write the chunk header
- if (fwrite(&chunkHeader, sizeof(chunkHeader), 1, fileHandle) != 1)
- error("Error writing save game chunk header");
-
- // Write the chunk data
- if (size > 0 && fwrite(buf, size, 1, fileHandle) != 1)
- error("Error writing save game data");
-
- // Initialize the chunk varibles to indicate the file position is
- // at the end of the chunk
- chunkSize = posInChunk = size;
-
- // Return success
- return true;
-}
-
-/* ===================================================================== *
- SaveFileReader member functions
- * ===================================================================== */
-
-//----------------------------------------------------------------------
-// Constructor
-
-SaveFileReader::SaveFileReader(int16 saveNo) {
- char fileName[fileNameSize];
-
- // Construct the file name based on the save number
- getSaveFileName(saveNo, fileName);
-
- // Open the file or throw an exception
- if ((fileHandle = fopen(fileName, "rb")) == NULL)
- error("Cannot open save game file \"%s\"", fileName);
-
- // Read the save file header
- if (fread(&header, sizeof(header), 1, fileHandle) != 1)
- error("Error reading save game header: \"%s\"", fileName);
-
- // Initialize the chunk variables
- chunkSize = posInChunk = 0;
-}
-
-//----------------------------------------------------------------------
-// Destructor
-
-SaveFileReader::~SaveFileReader(void) {
- // Close the file
- if (fileHandle != NULL) fclose(fileHandle);
-}
-
-//----------------------------------------------------------------------
-// Set the first chunk to be the current chunk
-
-bool SaveFileReader::firstChunk(ChunkID &chunk, int32 &size) {
- SaveFileChunkInfo chunkHeader;
-
- // Seek the first chunk header
- if (fseek(fileHandle, sizeof(SaveFileHeader), SEEK_SET) != 0)
- error("Error seeking first save game chunk");
-
- // Read the chunk header
- if (fread(&chunkHeader, sizeof(chunkHeader), 1, fileHandle) != 1)
- return false;
-
- // Initialize the chunk variables
- chunkSize = chunkHeader.size;
- posInChunk = 0;
-
- // Return the chunk ID and chunk size
- chunk = chunkHeader.id;
- size = chunkHeader.size;
-
- // Return success
- return true;
-}
-
-bool firstChunk(Common::InSaveFile *in, ChunkID &chunk, int32 &size) {
- if (!in->seek(SaveFileHeader::kHeaderSize, SEEK_SET))
- error("Error seeking first save game chunk");
-
- if (in->size() - in->pos() < 8) {
- debugC(1, kDebugSaveload, "Reached EOF on first Chunk %s", tag2str(chunk));
- return false;
- }
-
- chunk = in->readUint32BE();
- size = in->readUint32LE();
-
- debugC(1, kDebugSaveload, "First Chunk loaded: chunkID = %s, size = %d", tag2str(chunk), size);
-
- return true;
-}
-
-//----------------------------------------------------------------------
-// Make the next chunk the current chunk
-
-bool SaveFileReader::nextChunk(ChunkID &chunk, int32 &size) {
- assert(posInChunk <= chunkSize);
-
- // If not already at the beginning of the next chunk header, seek
- // the next chunk
- if (posInChunk < chunkSize) {
- if (fseek(fileHandle, chunkSize - posInChunk, SEEK_CUR) != 0)
- error("Error seeking next save game chunk");
- }
-
- SaveFileChunkInfo chunkHeader;
-
- // Read the chunk header
- if (fread(&chunkHeader, sizeof(chunkHeader), 1, fileHandle) != 1)
- return false;
-
- // Initialize the chunk variables
- chunkSize = chunkHeader.size;
- posInChunk = 0;
-
- // Return the chunk ID and chunk size
- chunk = chunkHeader.id;
- size = chunkHeader.size;
-
- // Return success
- return true;
-}
-
-bool nextChunk(Common::InSaveFile *in, ChunkID &chunk, int32 &size) {
- if (in->size() - in->pos() < 8) {
- debugC(1, kDebugSaveload, "Reached EOF at %s", tag2str(chunk));
- return false;
- }
-
- chunk = in->readUint32BE();
- size = in->readUint32LE();
-
- debugC(1, kDebugSaveload, "Next Chunk loaded: chunkID = %s, size = %d", tag2str(chunk), size);
-
- // Return success
- return true;
-}
-
-//----------------------------------------------------------------------
-// Read data from the current chunk
-
-int32 SaveFileReader::read(void *buf, int32 size) {
- // If asking for more data than is left in the chunk adjust the
- // number of bytes to read
- if (size > chunkSize - posInChunk) size = chunkSize - posInChunk;
-
- // Read the chunk data
- if (size > 0 && fread(buf, size, 1, fileHandle) != 1)
- error("Error reading save game data");
-
- // Adjust the position in chunk
- posInChunk += size;
-
- // Return the number of bytes read
- return size;
-}
-
-} // end if namespace Saga2
diff --git a/engines/saga2/savefile.h b/engines/saga2/savefile.h
deleted file mode 100644
index e530426184..0000000000
--- a/engines/saga2/savefile.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Based on the original sources
- * Faery Tale II -- The Halls of the Dead
- * (c) 1993-1996 The Wyrmkeep Entertainment Co.
- */
-
-#ifndef SAGA2_SAVEFILE_H
-#define SAGA2_SAVEFILE_H
-
-#include "common/savefile.h"
-
-namespace Saga2 {
-
-/* ===================================================================== *
- Constants
- * ===================================================================== */
-
-const int16 saveNameSize = 40,
- fileNameSize = 260;
-
-const ChunkID gameID = MKTAG('F', 'T', 'A', '2');
-
-/* ===================================================================== *
- SaveFileHeader class
- * ===================================================================== */
-
-// This structure represents the first 128 bytes written to a save game
-// file. It stores the game ID and the long name of the saved game state.
-
-struct SaveFileHeader {
- enum {
- kSaveNameSize = 40,
- kHeaderSize = 128
- };
-
- ChunkID gameID; // ID of game (FTA2 of DINO).
- Common::String saveName; // The long name of the saved
-
- void read(Common::InSaveFile *in);
- void write(Common::OutSaveFile *out);
-};
-
-/* ===================================================================== *
- SaveFileChunkInfo class
- * ===================================================================== */
-
-// This is a save file chunk header. The save file will consist of as many
-// chunks as is needed. The first chunk begins immediately after the
-// save file header. Each chunk header has a four byte ID followed by
-// a chunk size.
-
-struct SaveFileChunkInfo {
- ChunkID id; // 4-byte chunk ID
- int32 size; // Number of bytes in chunk
-}; // 8 bytes
-
-/* ===================================================================== *
- SaveFileConstructor class
- * ===================================================================== */
-
-// This class is used to define an object which can be passed to various
-// parts of the program in order to create a save game file.
-
-class SaveFileConstructor {
- FILE *fileHandle; // A standard C file handle
-
- int32 chunkSize, // Current chunk size
- posInChunk; // Current file position
- // relative to the begining
- // of the chunk data
-
-public:
- // Constructor
- SaveFileConstructor(int16 saveNo, char *saveName);
-
- // Destructor
- ~SaveFileConstructor(void);
-
- // Create a new chunk without writing the chunk data. NOTE: the
- // size of a chunk must be known to call this function.
- bool newChunk(ChunkID id, int32 size);
-
- // Write data to a chunk created with the newChunk() function.
- int32 write(void *buf, int32 size);
-
- // Create a new chunk and write the chunk data.
- bool writeChunk(ChunkID id, void *buf, int32 size);
-};
-
-/* ===================================================================== *
- SaveFileReader class
- * ===================================================================== */
-
-// This class is used to define an object which can be passed to various
-// parts of the program in order to read data from a save game file.
-
-class SaveFileReader {
- FILE *fileHandle; // A standard C file handle
-
- int32 chunkSize, // Current chunk size
- posInChunk; // Current file position
- // relative to the begining
- // of the chunk data.
- SaveFileHeader header; // The save file header.
-
-public:
- // Constructor
- SaveFileReader(int16 saveNo);
-
- // Destructor
- ~SaveFileReader(void);
-
- // Return a pointer to the long name of the save game state
- const char *saveName(void) {
- return header.saveName.c_str();
- }
-
- // Return the number of bytes in the current chunk
- int32 getChunkSize(void) {
- return chunkSize;
- }
-
- // Set the first chunk to be the current chunk
- bool firstChunk(ChunkID &chunk, int32 &size);
-
- // Make the next chunk the current chunk
- bool nextChunk(ChunkID &chunk, int32 &size);
-
- // Read data from the current chunk
- int32 read(void *buf, int32 size);
-
- // Return the number of bytes left to be read from the
- // current chunk
- int32 bytesLeftInChunk(void) {
- return chunkSize - posInChunk;
- }
-};
-
-bool firstChunk(Common::InSaveFile *in, ChunkID &chunk, int32 &size);
-bool nextChunk(Common::InSaveFile *in, ChunkID &chunk, int32 &size);
-
-} // end of namespace Saga2
-
-#endif
diff --git a/engines/saga2/sensor.cpp b/engines/saga2/sensor.cpp
index 8d4e92cf80..ea6997fd8b 100644
--- a/engines/saga2/sensor.cpp
+++ b/engines/saga2/sensor.cpp
@@ -24,14 +24,11 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/objects.h"
#include "saga2/sensor.h"
#include "saga2/player.h"
#include "saga2/tile.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/speech.cpp b/engines/saga2/speech.cpp
index d6c573a99c..f1717884cf 100644
--- a/engines/saga2/speech.cpp
+++ b/engines/saga2/speech.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/fta.h"
#include "saga2/fontlib.h"
@@ -35,7 +33,6 @@
#include "saga2/grabinfo.h"
#include "saga2/player.h"
#include "saga2/annoy.h"
-#include "saga2/savefile.h"
#include "saga2/cmisc.h"
#include "saga2/tilemode.h"
diff --git a/engines/saga2/spellio.cpp b/engines/saga2/spellio.cpp
index 3dd107a135..fb3dc9fc86 100644
--- a/engines/saga2/spellio.cpp
+++ b/engines/saga2/spellio.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/idtypes.h"
#include "saga2/magic.h"
@@ -35,7 +33,6 @@
#include "saga2/rect.h"
#include "saga2/spellio.h"
#include "saga2/spelshow.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/task.cpp b/engines/saga2/task.cpp
index 4d296305f4..486a7785c4 100644
--- a/engines/saga2/task.cpp
+++ b/engines/saga2/task.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/fta.h"
#include "saga2/cmisc.h"
@@ -35,7 +33,6 @@
#include "saga2/band.h"
#include "saga2/sensor.h"
#include "saga2/tilemode.h"
-#include "saga2/savefile.h"
#include "saga2/tile.h"
namespace Saga2 {
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 7fef386d25..46a3ee2226 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "common/debug.h"
#include "graphics/surface.h"
@@ -42,7 +40,6 @@
#include "saga2/tagnoise.h"
#include "saga2/player.h"
#include "saga2/mapfeatr.h"
-#include "saga2/savefile.h"
// Include files needed for SAGA script dispatch
#include "saga2/script.h"
diff --git a/engines/saga2/tilemode.cpp b/engines/saga2/tilemode.cpp
index 4130a5eb81..cc7c2a1577 100644
--- a/engines/saga2/tilemode.cpp
+++ b/engines/saga2/tilemode.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/tilemode.h"
#include "saga2/tile.h"
@@ -43,7 +41,6 @@
#include "saga2/dispnode.h"
#include "saga2/uidialog.h"
#include "saga2/contain.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/timers.cpp b/engines/saga2/timers.cpp
index 4fa5ca87b7..8f604391a2 100644
--- a/engines/saga2/timers.cpp
+++ b/engines/saga2/timers.cpp
@@ -24,15 +24,12 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "common/timer.h"
#include "saga2/saga2.h"
#include "saga2/fta.h"
#include "saga2/timers.h"
#include "saga2/objects.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index 5af47edd38..29f34db077 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "common/config-manager.h"
#include "audio/mixer.h"
@@ -46,7 +44,6 @@
#include "saga2/palette.h"
#include "saga2/fontlib.h"
-#include "saga2/savefile.h"
namespace Saga2 {
diff --git a/engines/saga2/vpal.cpp b/engines/saga2/vpal.cpp
index a73ed046b8..a0d7bc0583 100644
--- a/engines/saga2/vpal.cpp
+++ b/engines/saga2/vpal.cpp
@@ -24,9 +24,8 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "common/debug.h"
+#include "common/savefile.h"
#include "graphics/palette.h"
#include "saga2/saga2.h"
@@ -35,7 +34,6 @@
#include "saga2/palette.h"
#include "saga2/display.h"
#include "saga2/hresmgr.h"
-#include "saga2/savefile.h"
namespace Saga2 {
@@ -87,8 +85,6 @@ static gPalette oldPalette, // Palette at start of fade
static int32 startTime, // Time index of start of fade
totalTime; // Total fade duration
-
-static PaletteStateArchive archive; // Used for loading and saving
// palette state
/* ===================================================================== *
Commit: 24fa43f2ceff3be49d8e6d254e4583ab5cb84d47
https://github.com/scummvm/scummvm/commit/24fa43f2ceff3be49d8e6d254e4583ab5cb84d47
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T17:11:37+02:00
Commit Message:
SAGA2: Move SaveFileHeader to more appropriate place
Changed paths:
engines/saga2/fta.h
engines/saga2/loadsave.h
diff --git a/engines/saga2/fta.h b/engines/saga2/fta.h
index 0d44746374..1f38a61fee 100644
--- a/engines/saga2/fta.h
+++ b/engines/saga2/fta.h
@@ -53,26 +53,6 @@ const int ticksPerSecond = 72; // 72 ticks per second
const int frameRate = 10,
framePeriod = ticksPerSecond / frameRate;
-/* ===================================================================== *
- SaveFileHeader class
- * ===================================================================== */
-
-// This structure represents the first 128 bytes written to a save game
-// file. It stores the game ID and the long name of the saved game state.
-
-struct SaveFileHeader {
- enum {
- kSaveNameSize = 40,
- kHeaderSize = 128
- };
-
- ChunkID gameID; // ID of game (FTA2 of DINO).
- Common::String saveName; // The long name of the saved
-
- void read(Common::InSaveFile *in);
- void write(Common::OutSaveFile *out);
-};
-
/* ====================================================================== *
Overall game modes
* ====================================================================== */
diff --git a/engines/saga2/loadsave.h b/engines/saga2/loadsave.h
index d9f01805bf..0b36a96e8a 100644
--- a/engines/saga2/loadsave.h
+++ b/engines/saga2/loadsave.h
@@ -29,6 +29,26 @@
namespace Saga2 {
+/* ===================================================================== *
+ SaveFileHeader class
+ * ===================================================================== */
+
+// This structure represents the first 128 bytes written to a save game
+// file. It stores the game ID and the long name of the saved game state.
+
+struct SaveFileHeader {
+ enum {
+ kSaveNameSize = 40,
+ kHeaderSize = 128
+ };
+
+ ChunkID gameID; // ID of game (FTA2 of DINO).
+ Common::String saveName; // The long name of the saved
+
+ void read(Common::InSaveFile *in);
+ void write(Common::OutSaveFile *out);
+};
+
// Load initial game state
void initGameState(void);
Commit: 9b8635ff80b2c41b2ecef0fdbaf7f3344e3b2654
https://github.com/scummvm/scummvm/commit/9b8635ff80b2c41b2ecef0fdbaf7f3344e3b2654
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T17:11:37+02:00
Commit Message:
SAGA2: Rename loadsave.* to saveload.*
In order to be consistent with other engines
Changed paths:
A engines/saga2/saveload.cpp
A engines/saga2/saveload.h
R engines/saga2/loadsave.cpp
R engines/saga2/loadsave.h
engines/saga2/main.cpp
engines/saga2/module.mk
engines/saga2/towerfta.cpp
engines/saga2/uidialog.cpp
diff --git a/engines/saga2/main.cpp b/engines/saga2/main.cpp
index 7d69f0a0f5..58a29bba6f 100644
--- a/engines/saga2/main.cpp
+++ b/engines/saga2/main.cpp
@@ -41,7 +41,7 @@
#include "saga2/display.h"
#include "saga2/tower.h"
#include "saga2/tromode.h"
-#include "saga2/loadsave.h"
+#include "saga2/saveload.h"
#include "saga2/gamerate.h"
#include "saga2/msgbox.h"
diff --git a/engines/saga2/module.mk b/engines/saga2/module.mk
index 1d99ed7b6d..748ad9bdad 100644
--- a/engines/saga2/module.mk
+++ b/engines/saga2/module.mk
@@ -30,7 +30,6 @@ MODULE_OBJS := \
interp.o \
intrface.o \
loadmsg.o \
- loadsave.o \
magic.o \
main.o \
mainmap.o \
@@ -55,6 +54,7 @@ MODULE_OBJS := \
rect.o \
saga2.o \
sagafunc.o \
+ saveload.o \
sensor.o \
shorten.o \
speech.o \
diff --git a/engines/saga2/loadsave.cpp b/engines/saga2/saveload.cpp
similarity index 99%
rename from engines/saga2/loadsave.cpp
rename to engines/saga2/saveload.cpp
index 179cd4c8a7..9f6c33e00a 100644
--- a/engines/saga2/loadsave.cpp
+++ b/engines/saga2/saveload.cpp
@@ -25,7 +25,7 @@
*/
#include "saga2/saga2.h"
-#include "saga2/loadsave.h"
+#include "saga2/saveload.h"
#include "saga2/objects.h"
#include "saga2/tile.h"
#include "saga2/script.h"
diff --git a/engines/saga2/loadsave.h b/engines/saga2/saveload.h
similarity index 100%
rename from engines/saga2/loadsave.h
rename to engines/saga2/saveload.h
diff --git a/engines/saga2/towerfta.cpp b/engines/saga2/towerfta.cpp
index ff01c80b74..530ae333de 100644
--- a/engines/saga2/towerfta.cpp
+++ b/engines/saga2/towerfta.cpp
@@ -37,7 +37,7 @@
#include "saga2/mouseimg.h"
#include "saga2/patrol.h"
#include "saga2/weapons.h"
-#include "saga2/loadsave.h"
+#include "saga2/saveload.h"
#include "saga2/display.h"
#include "saga2/tile.h"
diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index 29f34db077..9ed60232b5 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -31,7 +31,7 @@
#include "saga2/intrface.h"
#include "saga2/grequest.h"
#include "saga2/gtextbox.h"
-#include "saga2/loadsave.h"
+#include "saga2/saveload.h"
#include "saga2/script.h"
#include "saga2/audio.h"
More information about the Scummvm-git-logs
mailing list