SAGA2: Remove old save/load methods
This commit is contained in:
parent
e0d1854c01
commit
eb7c7273db
44 changed files with 6 additions and 5720 deletions
|
@ -1192,83 +1192,6 @@ Actor::Actor(const ResourceActor &res) : GameObject(res) {
|
||||||
evalActorEnchantments(this);
|
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) {
|
Actor::Actor(Common::InSaveFile *in) : GameObject(in) {
|
||||||
debugC(3, kDebugSaveload, "Loading actor %d", thisID());
|
debugC(3, kDebugSaveload, "Loading actor %d", thisID());
|
||||||
|
|
||||||
|
@ -1412,81 +1335,13 @@ int32 Actor::archiveSize(void) {
|
||||||
return size;
|
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) {
|
void Actor::write(Common::OutSaveFile *out) {
|
||||||
ProtoObj *holdProto = prototype;
|
ProtoObj *holdProto = prototype;
|
||||||
|
|
||||||
debugC(3, kDebugSaveload, "Saving actor %d", thisID());
|
debugC(3, kDebugSaveload, "Saving actor %d", thisID());
|
||||||
|
|
||||||
warning("STUB: Actor::write: Pointer arithmetic");
|
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
|
// will store the index correctly
|
||||||
if (prototype != NULL)
|
if (prototype != NULL)
|
||||||
prototype = &objectProtos[(ActorProto *)prototype - actorProtos];
|
prototype = &objectProtos[(ActorProto *)prototype - actorProtos];
|
||||||
|
@ -3688,45 +3543,6 @@ void initActors(void) {
|
||||||
actorList[2].disposition = dispositionPlayer + 2;
|
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) {
|
void saveActors(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving actors");
|
debugC(2, kDebugSaveload, "Saving actors");
|
||||||
|
|
||||||
|
@ -3750,40 +3566,6 @@ void saveActors(Common::OutSaveFile *out) {
|
||||||
actorList[i].write(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) {
|
void loadActors(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading actors");
|
debugC(2, kDebugSaveload, "Loading actors");
|
||||||
|
|
||||||
|
@ -3873,16 +3655,6 @@ void initFactionTallies(void) {
|
||||||
memset(&factionTable, 0, sizeof(factionTable));
|
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) {
|
void saveFactionTallies(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving Faction Tallies");
|
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) {
|
void loadFactionTallies(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading Faction Tallies");
|
debugC(2, kDebugSaveload, "Loading Faction Tallies");
|
||||||
|
|
||||||
|
|
|
@ -728,9 +728,6 @@ public:
|
||||||
// Constructor - initial actor construction
|
// Constructor - initial actor construction
|
||||||
Actor(const ResourceActor &res);
|
Actor(const ResourceActor &res);
|
||||||
|
|
||||||
// Reconstruct from archive buffer
|
|
||||||
Actor(void **buf);
|
|
||||||
|
|
||||||
Actor(Common::InSaveFile *in);
|
Actor(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
@ -739,9 +736,6 @@ public:
|
||||||
// Return the number of bytes needed to archive this actor
|
// Return the number of bytes needed to archive this actor
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this actor in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
static Actor *newActor(
|
static Actor *newActor(
|
||||||
|
@ -1125,11 +1119,9 @@ int16 AddFactionTally(int faction, enum factionTallyTypes act, int amt);
|
||||||
void initFactionTallies(void);
|
void initFactionTallies(void);
|
||||||
|
|
||||||
// Save the faction tallies to a save file
|
// Save the faction tallies to a save file
|
||||||
void saveFactionTallies(SaveFileConstructor &saveGame);
|
|
||||||
void saveFactionTallies(Common::OutSaveFile *out);
|
void saveFactionTallies(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the faction tallies from a save file
|
// Load the faction tallies from a save file
|
||||||
void loadFactionTallies(SaveFileReader &saveGame);
|
|
||||||
void loadFactionTallies(Common::InSaveFile *in);
|
void loadFactionTallies(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Cleanup the faction tally table
|
// Cleanup the faction tally table
|
||||||
|
|
|
@ -50,22 +50,6 @@ ActorAssignment::ActorAssignment(Actor *a, uint16 until) :
|
||||||
a->flags |= hasAssignment;
|
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) {
|
ActorAssignment::ActorAssignment(Actor *ac, Common::SeekableReadStream *stream) {
|
||||||
startFrame = stream->readUint16LE();
|
startFrame = stream->readUint16LE();
|
||||||
endFrame = stream->readUint16LE();
|
endFrame = stream->readUint16LE();
|
||||||
|
@ -103,18 +87,6 @@ inline int32 ActorAssignment::archiveSize(void) const {
|
||||||
return sizeof(startFrame) + sizeof(endFrame);
|
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 {
|
void ActorAssignment::write(Common::OutSaveFile *out) const {
|
||||||
out->writeUint16LE(startFrame);
|
out->writeUint16LE(startFrame);
|
||||||
out->writeUint16LE(endFrame);
|
out->writeUint16LE(endFrame);
|
||||||
|
@ -206,30 +178,6 @@ PatrolRouteAssignment::PatrolRouteAssignment(
|
||||||
flags(0) {
|
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) :
|
PatrolRouteAssignment::PatrolRouteAssignment(Actor *a, Common::SeekableReadStream *stream) :
|
||||||
ActorAssignment(a, stream) {
|
ActorAssignment(a, stream) {
|
||||||
debugC(4, kDebugSaveload, "... Loading PatrolRouteAssignment");
|
debugC(4, kDebugSaveload, "... Loading PatrolRouteAssignment");
|
||||||
|
@ -260,30 +208,6 @@ inline int32 PatrolRouteAssignment::archiveSize(void) const {
|
||||||
+ sizeof(flags);
|
+ 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 {
|
void PatrolRouteAssignment::write(Common::OutSaveFile *out) const {
|
||||||
debugC(3, kDebugSaveload, "... Saving PatrolRouteAssignment");
|
debugC(3, kDebugSaveload, "... Saving PatrolRouteAssignment");
|
||||||
|
|
||||||
|
@ -404,22 +328,6 @@ void HuntToBeNearLocationAssignment::initialize(
|
||||||
range = r;
|
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) :
|
HuntToBeNearLocationAssignment::HuntToBeNearLocationAssignment(Actor *a, Common::SeekableReadStream *stream) :
|
||||||
ActorAssignment(a, stream) {
|
ActorAssignment(a, stream) {
|
||||||
debugC(4, kDebugSaveload, "... Loading HuntToBeNearLocationAssignment");
|
debugC(4, kDebugSaveload, "... Loading HuntToBeNearLocationAssignment");
|
||||||
|
@ -441,23 +349,6 @@ inline int32 HuntToBeNearLocationAssignment::archiveSize(void) const {
|
||||||
+ sizeof(range);
|
+ 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 {
|
void HuntToBeNearLocationAssignment::write(Common::OutSaveFile *out) const {
|
||||||
debugC(3, kDebugSaveload, "... Saving HuntToBeNearLocationAssignment");
|
debugC(3, kDebugSaveload, "... Saving HuntToBeNearLocationAssignment");
|
||||||
|
|
||||||
|
@ -537,27 +428,6 @@ void HuntToBeNearActorAssignment::initialize(
|
||||||
flags = trackFlag ? track : 0;
|
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) :
|
HuntToBeNearActorAssignment::HuntToBeNearActorAssignment(Actor *a, Common::SeekableReadStream *stream) :
|
||||||
ActorAssignment(a, stream) {
|
ActorAssignment(a, stream) {
|
||||||
debugC(4, kDebugSaveload, "... Loading HuntToBeNearActorAssignment");
|
debugC(4, kDebugSaveload, "... Loading HuntToBeNearActorAssignment");
|
||||||
|
@ -582,28 +452,6 @@ inline int32 HuntToBeNearActorAssignment::archiveSize(void) const {
|
||||||
+ sizeof(flags);
|
+ 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 {
|
void HuntToBeNearActorAssignment::write(Common::OutSaveFile *out) const {
|
||||||
debugC(3, kDebugSaveload, "... Saving HuntToBeNearActorAssignment");
|
debugC(3, kDebugSaveload, "... Saving HuntToBeNearActorAssignment");
|
||||||
|
|
||||||
|
@ -689,23 +537,6 @@ void HuntToKillAssignment::initialize(
|
||||||
| (specificActorFlag ? specificActor : 0);
|
| (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
|
// Return the number of bytes need to archive the data in this
|
||||||
// assignment
|
// assignment
|
||||||
|
@ -716,24 +547,6 @@ inline int32 HuntToKillAssignment::archiveSize(void) const {
|
||||||
+ sizeof(flags);
|
+ 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 {
|
void HuntToKillAssignment::write(Common::OutSaveFile *out) const {
|
||||||
debugC(3, kDebugSaveload, "... Saving HuntToKillAssignment");
|
debugC(3, kDebugSaveload, "... Saving HuntToKillAssignment");
|
||||||
|
|
||||||
|
@ -802,21 +615,6 @@ Task *HuntToKillAssignment::getTask(TaskStack *ts) {
|
||||||
TetheredAssignment member functions
|
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) {
|
TetheredAssignment::TetheredAssignment(Actor *ac, Common::SeekableReadStream *stream) : ActorAssignment(ac, stream) {
|
||||||
debugC(4, kDebugSaveload, "... Loading TetheredAssignment");
|
debugC(4, kDebugSaveload, "... Loading TetheredAssignment");
|
||||||
|
|
||||||
|
@ -839,25 +637,6 @@ inline int32 TetheredAssignment::archiveSize(void) const {
|
||||||
+ sizeof(maxV);
|
+ 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 {
|
void TetheredAssignment::write(Common::OutSaveFile *out) const {
|
||||||
debugC(3, kDebugSaveload, "... Saving TetheredAssignment");
|
debugC(3, kDebugSaveload, "... Saving TetheredAssignment");
|
||||||
|
|
||||||
|
@ -912,22 +691,6 @@ AttendAssignment::AttendAssignment(Actor *a, uint16 until, GameObject *o) :
|
||||||
obj(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) {
|
AttendAssignment::AttendAssignment(Actor *a, Common::SeekableReadStream *stream) : ActorAssignment(a, stream) {
|
||||||
debugC(4, kDebugSaveload, "... Loading AttendAssignment");
|
debugC(4, kDebugSaveload, "... Loading AttendAssignment");
|
||||||
|
|
||||||
|
@ -949,25 +712,6 @@ inline int32 AttendAssignment::archiveSize(void) const {
|
||||||
+ sizeof(ObjectID);
|
+ 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 {
|
void AttendAssignment::write(Common::OutSaveFile *out) const {
|
||||||
debugC(3, kDebugSaveload, "... Saving AttendAssignment");
|
debugC(3, kDebugSaveload, "... Saving AttendAssignment");
|
||||||
|
|
||||||
|
@ -1002,41 +746,6 @@ Task *AttendAssignment::getTask(TaskStack *ts) {
|
||||||
Misc functions
|
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) {
|
void readAssignment(Actor *a, Common::InSaveFile *in) {
|
||||||
// Get the type which is the first word in the archive buffer
|
// Get the type which is the first word in the archive buffer
|
||||||
int16 type = in->readSint16LE();
|
int16 type = in->readSint16LE();
|
||||||
|
@ -1075,24 +784,6 @@ int32 assignmentArchiveSize(Actor *a) {
|
||||||
return assign != NULL ? sizeof(int16) + assign->archiveSize() : 0;
|
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) {
|
void writeAssignment(Actor *a, Common::OutSaveFile *out) {
|
||||||
ActorAssignment *assign = a->getAssignment();
|
ActorAssignment *assign = a->getAssignment();
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,6 @@ public:
|
||||||
// Constructor
|
// Constructor
|
||||||
ActorAssignment(Actor *a, uint16 until);
|
ActorAssignment(Actor *a, uint16 until);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
ActorAssignment(Actor *a, void **buf);
|
|
||||||
|
|
||||||
ActorAssignment(Actor *a, Common::SeekableReadStream *stream);
|
ActorAssignment(Actor *a, Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
@ -76,10 +73,6 @@ public:
|
||||||
// assignment
|
// assignment
|
||||||
virtual int32 archiveSize(void) const;
|
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;
|
virtual void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Construct a TaskStack for this assignment
|
// Construct a TaskStack for this assignment
|
||||||
|
@ -135,19 +128,12 @@ public:
|
||||||
int16 start = -1,
|
int16 start = -1,
|
||||||
int16 end = -1);
|
int16 end = -1);
|
||||||
|
|
||||||
// Constructor -- constructs from archive buffer
|
|
||||||
PatrolRouteAssignment(Actor *a, void **buf);
|
|
||||||
|
|
||||||
PatrolRouteAssignment(Actor *a, Common::SeekableReadStream *stream);
|
PatrolRouteAssignment(Actor *a, Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes need to archive the data in this
|
// Return the number of bytes need to archive the data in this
|
||||||
// assignment
|
// assignment
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this assignment
|
// 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);
|
HuntToBeNearLocationAssignment(Actor *a, Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes need to archive the data in this
|
// Return the number of bytes need to archive the data in this
|
||||||
// assignment
|
// assignment
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
int16 type(void) const;
|
int16 type(void) const;
|
||||||
|
@ -296,19 +275,12 @@ public:
|
||||||
initialize(at, r, trackFlag);
|
initialize(at, r, trackFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstructs from archive buffer
|
|
||||||
HuntToBeNearActorAssignment(Actor *a, void **buf);
|
|
||||||
|
|
||||||
HuntToBeNearActorAssignment(Actor *a, Common::SeekableReadStream *stream);
|
HuntToBeNearActorAssignment(Actor *a, Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes need to archive the data in this
|
// Return the number of bytes need to archive the data in this
|
||||||
// assignment
|
// assignment
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
int16 type(void) const;
|
int16 type(void) const;
|
||||||
|
@ -376,17 +348,10 @@ public:
|
||||||
initialize(at, trackFlag, false);
|
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
|
// Return the number of bytes need to archive the data in this
|
||||||
// assignment
|
// assignment
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Determine if assignment's time limit is up or if the actor is
|
// Determine if assignment's time limit is up or if the actor is
|
||||||
|
@ -427,18 +392,12 @@ public:
|
||||||
maxV(reg.max.v) {
|
maxV(reg.max.v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TetheredAssignment(Actor *a, void **buf);
|
|
||||||
|
|
||||||
TetheredAssignment(Actor *a, Common::SeekableReadStream *stream);
|
TetheredAssignment(Actor *a, Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes need to archive the data in this
|
// Return the number of bytes need to archive the data in this
|
||||||
// assignment
|
// assignment
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -451,9 +410,6 @@ public:
|
||||||
// Constructor -- initial assignment construction
|
// Constructor -- initial assignment construction
|
||||||
TetheredWanderAssignment(Actor *a, uint16 until, const TileRegion ®);
|
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) {}
|
TetheredWanderAssignment(Actor *a, Common::SeekableReadStream *stream) : TetheredAssignment(a, stream) {}
|
||||||
|
|
||||||
// Return an integer representing the type of this assignment
|
// Return an integer representing the type of this assignment
|
||||||
|
@ -475,19 +431,12 @@ public:
|
||||||
// Constructor -- initial assignment construction
|
// Constructor -- initial assignment construction
|
||||||
AttendAssignment(Actor *a, uint16 until, GameObject *o);
|
AttendAssignment(Actor *a, uint16 until, GameObject *o);
|
||||||
|
|
||||||
// Constructor -- constructs from archive buffer
|
|
||||||
AttendAssignment(Actor *a, void **buf);
|
|
||||||
|
|
||||||
AttendAssignment(Actor *a, Common::SeekableReadStream *stream);
|
AttendAssignment(Actor *a, Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes need to archive the data in this
|
// Return the number of bytes need to archive the data in this
|
||||||
// assignment
|
// assignment
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this assignment
|
// Return an integer representing the type of this assignment
|
||||||
|
@ -502,16 +451,10 @@ protected:
|
||||||
Prototypes
|
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
|
// Return the number of bytes necessary to archive this actor's
|
||||||
// assignment in an archive buffer
|
// assignment in an archive buffer
|
||||||
int32 assignmentArchiveSize(Actor *a);
|
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 writeAssignment(Actor *a, Common::OutSaveFile *out);
|
||||||
void readAssignment(Actor *a, Common::InSaveFile *in);
|
void readAssignment(Actor *a, Common::InSaveFile *in);
|
||||||
|
|
||||||
|
|
|
@ -52,31 +52,6 @@ BandList::~BandList(void) {
|
||||||
delete _list[i];
|
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) {
|
void BandList::read(Common::InSaveFile *in) {
|
||||||
int16 bandCount;
|
int16 bandCount;
|
||||||
// Get the count of bands and increment the buffer pointer
|
// Get the count of bands and increment the buffer pointer
|
||||||
|
@ -107,35 +82,6 @@ int32 BandList::archiveSize(void) {
|
||||||
return size;
|
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) {
|
void BandList::write(Common::OutSaveFile *out) {
|
||||||
int16 bandCount = 0;
|
int16 bandCount = 0;
|
||||||
|
|
||||||
|
@ -258,29 +204,6 @@ Band *getBandAddress(BandID id) {
|
||||||
void initBands(void) {
|
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) {
|
void saveBands(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving Bands");
|
debugC(2, kDebugSaveload, "Saving Bands");
|
||||||
|
|
||||||
|
@ -294,35 +217,6 @@ void saveBands(Common::OutSaveFile *out) {
|
||||||
g_vm->_bandList->write(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) {
|
void loadBands(Common::InSaveFile *in, int32 chunkSize) {
|
||||||
debugC(2, kDebugSaveload, "Loading Bands");
|
debugC(2, kDebugSaveload, "Loading Bands");
|
||||||
|
|
||||||
|
@ -372,35 +266,6 @@ Band::Band(Actor *l) : leader(l), memberCount(0) {
|
||||||
members[i] = nullptr;
|
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) {
|
Band::Band(Common::InSaveFile *in) {
|
||||||
ObjectID leaderID = in->readUint16LE();
|
ObjectID leaderID = in->readUint16LE();
|
||||||
|
|
||||||
|
@ -441,29 +306,6 @@ int32 Band::archiveSize(void) {
|
||||||
+ sizeof(ObjectID) * memberCount; // members' ID's
|
+ 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) {
|
void Band::write(Common::OutSaveFile *out) {
|
||||||
// Store the leader's ID
|
// Store the leader's ID
|
||||||
out->writeUint16LE(leader->thisID());
|
out->writeUint16LE(leader->thisID());
|
||||||
|
|
|
@ -51,11 +51,7 @@ Band *getBandAddress(BandID id);
|
||||||
|
|
||||||
// Initialize the band list
|
// Initialize the band list
|
||||||
void initBands(void);
|
void initBands(void);
|
||||||
// Save the active band structures in a save file
|
|
||||||
void saveBands(SaveFileConstructor &saveGame);
|
|
||||||
void saveBands(Common::OutSaveFile *out);
|
void saveBands(Common::OutSaveFile *out);
|
||||||
// Load the band structures from a save file
|
|
||||||
void loadBands(SaveFileReader &saveGame);
|
|
||||||
void loadBands(Common::InSaveFile *in, int32 chunkSize);
|
void loadBands(Common::InSaveFile *in, int32 chunkSize);
|
||||||
// Cleanup the band list
|
// Cleanup the band list
|
||||||
void cleanupBands(void);
|
void cleanupBands(void);
|
||||||
|
@ -80,18 +76,12 @@ public:
|
||||||
// Destructor
|
// Destructor
|
||||||
~BandList(void);
|
~BandList(void);
|
||||||
|
|
||||||
// Reconstruct from an archive buffer
|
|
||||||
void *restore(void *buf);
|
|
||||||
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Return the number of bytes necessary to archive this task list
|
// Return the number of bytes necessary to archive this task list
|
||||||
// in a buffer
|
// in a buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Create an archive of the task list in an archive buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Place a Band from the inactive list into the active
|
// Place a Band from the inactive list into the active
|
||||||
|
@ -135,9 +125,6 @@ public:
|
||||||
Band();
|
Band();
|
||||||
Band(Actor *l);
|
Band(Actor *l);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
Band(void **buf);
|
|
||||||
|
|
||||||
Band(Common::InSaveFile *in);
|
Band(Common::InSaveFile *in);
|
||||||
|
|
||||||
~Band() { deleteBand(this); }
|
~Band() { deleteBand(this); }
|
||||||
|
@ -146,9 +133,6 @@ public:
|
||||||
// buffer
|
// buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
Actor *getLeader(void) {
|
Actor *getLeader(void) {
|
||||||
|
|
|
@ -267,18 +267,6 @@ void initCalender(void) {
|
||||||
calender.frameInHour = 0;
|
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) {
|
void saveCalender(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving calender");
|
debugC(2, kDebugSaveload, "Saving calender");
|
||||||
|
|
||||||
|
@ -292,17 +280,6 @@ void saveCalender(Common::OutSaveFile *out) {
|
||||||
calender.write(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) {
|
void loadCalender(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading calender");
|
debugC(2, kDebugSaveload, "Loading calender");
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,6 @@
|
||||||
|
|
||||||
namespace Saga2 {
|
namespace Saga2 {
|
||||||
|
|
||||||
class SaveFileConstructor;
|
|
||||||
class SaveFileReader;
|
|
||||||
|
|
||||||
/* ===================================================================== *
|
/* ===================================================================== *
|
||||||
CalenderTime class
|
CalenderTime class
|
||||||
* ===================================================================== */
|
* ===================================================================== */
|
||||||
|
@ -100,9 +97,7 @@ uint32 operator - (const CalenderTime &time1, const CalenderTime &time2);
|
||||||
|
|
||||||
void initCalender(void);
|
void initCalender(void);
|
||||||
|
|
||||||
void saveCalender(SaveFileConstructor &saveGame);
|
|
||||||
void saveCalender(Common::OutSaveFile *out);
|
void saveCalender(Common::OutSaveFile *out);
|
||||||
void loadCalender(SaveFileReader &saveGame);
|
|
||||||
void loadCalender(Common::InSaveFile *in);
|
void loadCalender(Common::InSaveFile *in);
|
||||||
|
|
||||||
bool isDayTime(void);
|
bool isDayTime(void);
|
||||||
|
|
|
@ -1434,40 +1434,6 @@ ContainerNode::~ContainerNode() {
|
||||||
g_vm->_containerList->remove(this);
|
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) {
|
void ContainerNode::read(Common::InSaveFile *in) {
|
||||||
// Restore fields
|
// Restore fields
|
||||||
object = in->readUint16LE();
|
object = in->readUint16LE();
|
||||||
|
@ -1821,57 +1787,6 @@ void initContainerNodes(void) {
|
||||||
#endif
|
#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) {
|
void saveContainerNodes(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving Container Nodes");
|
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) {
|
void loadContainerNodes(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading Container Nodes");
|
debugC(2, kDebugSaveload, "Loading Container Nodes");
|
||||||
|
|
||||||
|
|
|
@ -449,8 +449,6 @@ public:
|
||||||
static int32 archiveSize(void) {
|
static int32 archiveSize(void) {
|
||||||
return sizeof(Archive);
|
return sizeof(Archive);
|
||||||
}
|
}
|
||||||
void *restore(void *buf);
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
@ -544,9 +542,7 @@ void initContainers(void);
|
||||||
void cleanupContainers(void);
|
void cleanupContainers(void);
|
||||||
|
|
||||||
void initContainerNodes(void);
|
void initContainerNodes(void);
|
||||||
void saveContainerNodes(SaveFileConstructor &saveGame);
|
|
||||||
void saveContainerNodes(Common::OutSaveFile *out);
|
void saveContainerNodes(Common::OutSaveFile *out);
|
||||||
void loadContainerNodes(SaveFileReader &saveGame);
|
|
||||||
void loadContainerNodes(Common::InSaveFile *in);
|
void loadContainerNodes(Common::InSaveFile *in);
|
||||||
void cleanupContainerNodes(void);
|
void cleanupContainerNodes(void);
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
|
|
||||||
namespace Saga2 {
|
namespace Saga2 {
|
||||||
|
|
||||||
class SaveFileConstructor;
|
|
||||||
class SaveFileReader;
|
|
||||||
class hResContext;
|
class hResContext;
|
||||||
class hResource;
|
class hResource;
|
||||||
|
|
||||||
|
@ -123,12 +121,7 @@ extern GameMode IntroMode,
|
||||||
// Initialize the timer
|
// Initialize the timer
|
||||||
void initTimer(void);
|
void initTimer(void);
|
||||||
|
|
||||||
// Save the timer to a save file
|
|
||||||
void saveTimer(SaveFileConstructor &saveGame);
|
|
||||||
void saveTimer(Common::OutSaveFile *out);
|
void saveTimer(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the timer from a save file
|
|
||||||
void loadTimer(SaveFileReader &saveGame);
|
|
||||||
void loadTimer(Common::InSaveFile *in);
|
void loadTimer(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Cleanup the timer -- nothing to do
|
// Cleanup the timer -- nothing to do
|
||||||
|
@ -196,9 +189,7 @@ void cleanupPathFinder(void);
|
||||||
* ===================================================================== */
|
* ===================================================================== */
|
||||||
|
|
||||||
void initGlobals(void);
|
void initGlobals(void);
|
||||||
void saveGlobals(SaveFileConstructor &saveGame);
|
|
||||||
void saveGlobals(Common::OutSaveFile *out);
|
void saveGlobals(Common::OutSaveFile *out);
|
||||||
void loadGlobals(SaveFileReader &saveGame);
|
|
||||||
void loadGlobals(Common::InSaveFile *in);
|
void loadGlobals(Common::InSaveFile *in);
|
||||||
inline void cleanupGlobals(void) {} // do nothing
|
inline void cleanupGlobals(void) {} // do nothing
|
||||||
|
|
||||||
|
|
|
@ -1156,18 +1156,12 @@ public:
|
||||||
_list[i] = nullptr;
|
_list[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconstruct from archive buffer
|
|
||||||
void *restore(void *buf);
|
|
||||||
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this thread list
|
// Return the number of bytes needed to archive this thread list
|
||||||
// in an archive buffer
|
// in an archive buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Create an archive of this thread list in an archive buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Cleanup the active threads
|
// Cleanup the active threads
|
||||||
|
@ -1199,34 +1193,6 @@ public:
|
||||||
Thread *next(Thread *thread);
|
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) {
|
void ThreadList::read(Common::InSaveFile *in) {
|
||||||
int16 threadCount;
|
int16 threadCount;
|
||||||
|
|
||||||
|
@ -1258,43 +1224,6 @@ int32 ThreadList::archiveSize(void) {
|
||||||
return size;
|
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) {
|
void ThreadList::write(Common::OutSaveFile *out) {
|
||||||
int16 threadCount = 0;
|
int16 threadCount = 0;
|
||||||
Thread *th;
|
Thread *th;
|
||||||
|
@ -1400,29 +1329,6 @@ void initSAGAThreads(void) {
|
||||||
// Simply call the Thread List default constructor
|
// 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) {
|
void saveSAGAThreads(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving SAGA Threads");
|
debugC(2, kDebugSaveload, "Saving SAGA Threads");
|
||||||
|
|
||||||
|
@ -1435,37 +1341,6 @@ void saveSAGAThreads(Common::OutSaveFile *out) {
|
||||||
threadList.write(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) {
|
void loadSAGAThreads(Common::InSaveFile *in, int32 chunkSize) {
|
||||||
debugC(2, kDebugSaveload, "Loading SAGA Threads");
|
debugC(2, kDebugSaveload, "Loading SAGA Threads");
|
||||||
|
|
||||||
|
@ -1543,41 +1418,6 @@ Thread::Thread(uint16 segNum, uint16 segOff, scriptCallFrame &args) {
|
||||||
newThread(this);
|
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) {
|
Thread::Thread(Common::SeekableReadStream *stream) {
|
||||||
int16 stackOffset;
|
int16 stackOffset;
|
||||||
|
|
||||||
|
@ -1640,34 +1480,6 @@ int32 Thread::archiveSize(void) {
|
||||||
+ (stackBase + stackSize) - stackPtr;
|
+ (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) {
|
void Thread::write(Common::OutSaveFile *out) {
|
||||||
int16 stackOffset;
|
int16 stackOffset;
|
||||||
|
|
||||||
|
@ -1878,16 +1690,6 @@ void initSAGADataSeg(void) {
|
||||||
scriptRes->read(dataSegment, dataSegSize);
|
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) {
|
void saveSAGADataSeg(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving Data Segment");
|
debugC(2, kDebugSaveload, "Saving Data Segment");
|
||||||
|
|
||||||
|
@ -1896,15 +1698,6 @@ void saveSAGADataSeg(Common::OutSaveFile *out) {
|
||||||
out->write(dataSegment, dataSegSize);
|
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) {
|
void loadSAGADataSeg(Common::InSaveFile *in) {
|
||||||
in->read(dataSegment, dataSegSize);
|
in->read(dataSegment, dataSegSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2594,18 +2594,6 @@ void initUIState(void) {
|
||||||
//updateAllUserControls();
|
//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) {
|
void saveUIState(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving UIState");
|
debugC(2, kDebugSaveload, "Saving UIState");
|
||||||
|
|
||||||
|
@ -2619,17 +2607,6 @@ void saveUIState(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "... indivBrother = %d", indivBrother);
|
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) {
|
void loadUIState(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading UIState");
|
debugC(2, kDebugSaveload, "Loading UIState");
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,7 @@ bool isBrotherDead(PlayerActorID brotherID);
|
||||||
void updateIndicators(void);
|
void updateIndicators(void);
|
||||||
|
|
||||||
void initUIState(void);
|
void initUIState(void);
|
||||||
void saveUIState(SaveFileConstructor &saveGame);
|
|
||||||
void saveUIState(Common::OutSaveFile *out);
|
void saveUIState(Common::OutSaveFile *out);
|
||||||
void loadUIState(SaveFileReader &saveGame);
|
|
||||||
void loadUIState(Common::InSaveFile *in);
|
void loadUIState(Common::InSaveFile *in);
|
||||||
void cleanupUIState(void);
|
void cleanupUIState(void);
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ void loadSavedGameState(int16 saveNo) {
|
||||||
pauseTimer();
|
pauseTimer();
|
||||||
|
|
||||||
Common::InSaveFile *in = g_vm->getSaveFileManager()->openForLoading(getSaveFileName(saveNo));
|
Common::InSaveFile *in = g_vm->getSaveFileManager()->openForLoading(getSaveFileName(saveNo));
|
||||||
//SaveFileReader saveGame(saveNo);
|
|
||||||
ChunkID id;
|
ChunkID id;
|
||||||
int32 chunkSize;
|
int32 chunkSize;
|
||||||
bool notEOF;
|
bool notEOF;
|
||||||
|
|
|
@ -36,9 +36,6 @@ class Location;
|
||||||
class SkillProto;
|
class SkillProto;
|
||||||
class GameObject;
|
class GameObject;
|
||||||
|
|
||||||
class SaveFileConstructor;
|
|
||||||
class SaveFileReader;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// This is an include file for the spellcasting interface. This file
|
// This is an include file for the spellcasting interface. This file
|
||||||
// is meant to publish the main API functions for spell casting.
|
// 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
|
// spell saving & loading
|
||||||
void initSpellState(void);
|
void initSpellState(void);
|
||||||
void saveSpellState(SaveFileConstructor &saveGame);
|
|
||||||
void saveSpellState(Common::OutSaveFile *out);
|
void saveSpellState(Common::OutSaveFile *out);
|
||||||
void loadSpellState(SaveFileReader &saveGame);
|
|
||||||
void loadSpellState(Common::InSaveFile *in);
|
void loadSpellState(Common::InSaveFile *in);
|
||||||
void cleanupSpellState(void);
|
void cleanupSpellState(void);
|
||||||
|
|
||||||
|
|
|
@ -660,29 +660,6 @@ void initGlobals(void) {
|
||||||
backgroundSimulationPaused = false;
|
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) {
|
void saveGlobals(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving globals");
|
debugC(2, kDebugSaveload, "Saving globals");
|
||||||
|
|
||||||
|
@ -712,26 +689,6 @@ void saveGlobals(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "... backgroundSimulationPaused = %d", backgroundSimulationPaused);
|
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) {
|
void loadGlobals(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading globals");
|
debugC(2, kDebugSaveload, "Loading globals");
|
||||||
|
|
||||||
|
|
|
@ -268,16 +268,6 @@ void initMissions(void) {
|
||||||
activeMissions[i]._data.missionFlags &= ~inUse;
|
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) {
|
void saveMissions(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving Missions");
|
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) {
|
void loadMissions(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading Missions");
|
debugC(2, kDebugSaveload, "Loading Missions");
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,6 @@ struct ActiveMissionData {
|
||||||
class ActiveMission {
|
class ActiveMission {
|
||||||
|
|
||||||
friend void initMissions(void);
|
friend void initMissions(void);
|
||||||
friend void saveMissions(SaveFileConstructor &saveGame);
|
|
||||||
friend void loadMissions(SaveFileReader &saveGame);
|
|
||||||
friend void cleanupMissions(void);
|
friend void cleanupMissions(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -120,12 +118,7 @@ public:
|
||||||
// Initialize the active mission list
|
// Initialize the active mission list
|
||||||
void initMissions(void);
|
void initMissions(void);
|
||||||
|
|
||||||
// Save the active missions
|
|
||||||
void saveMissions(SaveFileConstructor &saveGame);
|
|
||||||
void saveMissions(Common::OutSaveFile *out);
|
void saveMissions(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Restore the active missions
|
|
||||||
void loadMissions(SaveFileReader &saveGame);
|
|
||||||
void loadMissions(Common::InSaveFile *in);
|
void loadMissions(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Cleanup the active mission list
|
// Cleanup the active mission list
|
||||||
|
|
|
@ -353,44 +353,6 @@ uint8 computeTurnFrames(Direction fromDir, Direction toDir) {
|
||||||
MotionTaskList::MotionTaskList(void) {
|
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) {
|
MotionTaskList::MotionTaskList(Common::SeekableReadStream *stream) {
|
||||||
read(stream);
|
read(stream);
|
||||||
}
|
}
|
||||||
|
@ -425,23 +387,6 @@ int32 MotionTaskList::archiveSize(void) {
|
||||||
return size;
|
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) {
|
void MotionTaskList::write(Common::OutSaveFile *out) {
|
||||||
int16 motionTaskCount = _list.size();
|
int16 motionTaskCount = _list.size();
|
||||||
|
|
||||||
|
@ -508,300 +453,6 @@ MotionTask *MotionTaskList::newTask(GameObject *obj) {
|
||||||
MotionTask member functions
|
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) {
|
void MotionTask::read(Common::InSaveFile *in) {
|
||||||
ObjectID objectID;
|
ObjectID objectID;
|
||||||
|
|
||||||
|
@ -1177,277 +828,6 @@ int32 MotionTask::archiveSize(void) {
|
||||||
return size;
|
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) {
|
void MotionTask::write(Common::OutSaveFile *out) {
|
||||||
ObjectID objectID;
|
ObjectID objectID;
|
||||||
|
|
||||||
|
@ -5432,29 +4812,6 @@ void initMotionTasks(void) {
|
||||||
//new (g_vm->_mTaskList) MotionTaskList;
|
//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) {
|
void saveMotionTasks(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving MotionTasks");
|
debugC(2, kDebugSaveload, "Saving MotionTasks");
|
||||||
|
|
||||||
|
@ -5468,37 +4825,6 @@ void saveMotionTasks(Common::OutSaveFile *out) {
|
||||||
g_vm->_mTaskList->write(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) {
|
void loadMotionTasks(Common::InSaveFile *in, int32 chunkSize) {
|
||||||
debugC(2, kDebugSaveload, "Loading MotionTasks");
|
debugC(2, kDebugSaveload, "Loading MotionTasks");
|
||||||
|
|
||||||
|
|
|
@ -258,17 +258,11 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reconstruct this MotionTask from an archive buffer
|
|
||||||
void *restore(void *buf);
|
|
||||||
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this MotionTask
|
// Return the number of bytes needed to archive this MotionTask
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this MotionTask in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// motion task is finished.
|
// motion task is finished.
|
||||||
|
@ -549,9 +543,6 @@ public:
|
||||||
// Default constructor
|
// Default constructor
|
||||||
MotionTaskList(void);
|
MotionTaskList(void);
|
||||||
|
|
||||||
// Reconstruct motion task list from archive buffer
|
|
||||||
MotionTaskList(void **buf);
|
|
||||||
|
|
||||||
MotionTaskList(Common::SeekableReadStream *stream);
|
MotionTaskList(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
|
@ -560,9 +551,6 @@ public:
|
||||||
// in a buffer
|
// in a buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Create an archive of the motion tasks in the specified buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Cleanup the motion tasks
|
// Cleanup the motion tasks
|
||||||
|
@ -630,12 +618,7 @@ void resumeInterruptableMotions(void);
|
||||||
// Initialize the motion task list
|
// Initialize the motion task list
|
||||||
void initMotionTasks(void);
|
void initMotionTasks(void);
|
||||||
|
|
||||||
// Save the motion task list to a save file
|
|
||||||
void saveMotionTasks(SaveFileConstructor &saveGame);
|
|
||||||
void saveMotionTasks(Common::OutSaveFile *out);
|
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);
|
void loadMotionTasks(Common::InSaveFile *in, int32 chunkSize);
|
||||||
|
|
||||||
// Cleanup the motion task list
|
// Cleanup the motion task list
|
||||||
|
|
|
@ -233,38 +233,6 @@ GameObject::GameObject(const ResourceGameObject &res) {
|
||||||
_data.obj = this;
|
_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) {
|
GameObject::GameObject(Common::InSaveFile *in) {
|
||||||
debugC(3, kDebugSaveload, "Loading object %d", thisID());
|
debugC(3, kDebugSaveload, "Loading object %d", thisID());
|
||||||
|
|
||||||
|
@ -307,32 +275,6 @@ int32 GameObject::archiveSize(void) {
|
||||||
return sizeof(GameObjectArchive);
|
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) {
|
void GameObject::write(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving object %d", thisID());
|
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) {
|
GameWorld::GameWorld(Common::SeekableReadStream *stream) {
|
||||||
size.u = size.v = stream->readSint16LE();
|
size.u = size.v = stream->readSint16LE();
|
||||||
mapNum = stream->readSint16LE();
|
mapNum = stream->readSint16LE();
|
||||||
|
@ -2489,22 +2397,6 @@ int32 GameWorld::archiveSize(void) {
|
||||||
return bytes;
|
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
|
// Cleanup
|
||||||
|
|
||||||
|
@ -2792,15 +2684,6 @@ void initTempActorCount(void) {
|
||||||
tempActorCount[i] = 0;
|
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) {
|
void saveTempActorCount(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving TempActorCount");
|
debugC(2, kDebugSaveload, "Saving TempActorCount");
|
||||||
|
|
||||||
|
@ -2811,14 +2694,6 @@ void saveTempActorCount(Common::OutSaveFile *out) {
|
||||||
out->writeUint16LE(tempActorCount[i]);
|
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) {
|
void loadTempActorCount(Common::InSaveFile *in, int32 chunkSize) {
|
||||||
debugC(2, kDebugSaveload, "Loading TempActorCount");
|
debugC(2, kDebugSaveload, "Loading TempActorCount");
|
||||||
|
|
||||||
|
@ -2883,46 +2758,6 @@ void initWorlds(void) {
|
||||||
setCurrentMap(currentWorld->mapNum);
|
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) {
|
void saveWorlds(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving worlds");
|
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) {
|
void loadWorlds(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading worlds");
|
debugC(2, kDebugSaveload, "Loading worlds");
|
||||||
|
|
||||||
|
@ -3167,54 +2960,6 @@ void initObjects(void) {
|
||||||
#endif
|
#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) {
|
void saveObjects(Common::OutSaveFile *out) {
|
||||||
int32 archiveBufSize;
|
int32 archiveBufSize;
|
||||||
|
|
||||||
|
@ -3236,39 +2981,6 @@ void saveObjects(Common::OutSaveFile *out) {
|
||||||
objectList[i].write(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) {
|
void loadObjects(Common::InSaveFile *in) {
|
||||||
// Restore the limbo counts
|
// Restore the limbo counts
|
||||||
objectLimboCount = in->readSint16LE();
|
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) {
|
void saveActiveRegions(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving ActiveRegions");
|
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) {
|
void loadActiveRegions(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading ActiveRegions");
|
debugC(2, kDebugSaveload, "Loading ActiveRegions");
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,6 @@ namespace Saga2 {
|
||||||
* ======================================================================= */
|
* ======================================================================= */
|
||||||
|
|
||||||
class GameWorld;
|
class GameWorld;
|
||||||
class SaveFileConstructor;
|
|
||||||
class SaveFileReader;
|
|
||||||
|
|
||||||
const uint16 unlimitedCapacity = maxuint16;
|
const uint16 unlimitedCapacity = maxuint16;
|
||||||
|
|
||||||
|
@ -115,22 +113,16 @@ struct ObjectData {
|
||||||
#include "common/pack-end.h"
|
#include "common/pack-end.h"
|
||||||
|
|
||||||
void initActors(void);
|
void initActors(void);
|
||||||
void saveActors(SaveFileConstructor &);
|
|
||||||
void saveActors(Common::OutSaveFile *out);
|
void saveActors(Common::OutSaveFile *out);
|
||||||
void loadActors(SaveFileReader &);
|
|
||||||
void loadActors(Common::InSaveFile *in);
|
void loadActors(Common::InSaveFile *in);
|
||||||
void cleanupActors(void);
|
void cleanupActors(void);
|
||||||
class GameObject {
|
class GameObject {
|
||||||
|
|
||||||
friend void initWorlds(void);
|
friend void initWorlds(void);
|
||||||
friend void saveWorlds(SaveFileConstructor &);
|
|
||||||
friend void loadWorlds(SaveFileReader &);
|
|
||||||
friend void cleanupWorlds(void);
|
friend void cleanupWorlds(void);
|
||||||
|
|
||||||
friend void initObjects(void);
|
friend void initObjects(void);
|
||||||
friend void saveObjects(SaveFileConstructor &);
|
|
||||||
friend void saveObjects(Common::OutSaveFile *out);
|
friend void saveObjects(Common::OutSaveFile *out);
|
||||||
friend void loadObjects(SaveFileReader &);
|
|
||||||
friend void loadObjects(Common::InSaveFile *in);
|
friend void loadObjects(Common::InSaveFile *in);
|
||||||
friend void cleanupObjects(void);
|
friend void cleanupObjects(void);
|
||||||
|
|
||||||
|
@ -187,9 +179,6 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
GameObject(const ResourceGameObject &res);
|
GameObject(const ResourceGameObject &res);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GameObject(void **buf);
|
|
||||||
|
|
||||||
GameObject(Common::InSaveFile *in);
|
GameObject(Common::InSaveFile *in);
|
||||||
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
|
@ -198,9 +187,6 @@ public:
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive the object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// returns the address of the object based on the ID, and this
|
// returns the address of the object based on the ID, and this
|
||||||
|
@ -786,15 +772,11 @@ public:
|
||||||
// Initial constructor
|
// Initial constructor
|
||||||
GameWorld(int16 map);
|
GameWorld(int16 map);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GameWorld(void **buf);
|
|
||||||
|
|
||||||
GameWorld(Common::SeekableReadStream *stream);
|
GameWorld(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
~GameWorld();
|
~GameWorld();
|
||||||
|
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void cleanup(void);
|
void cleanup(void);
|
||||||
|
|
||||||
|
@ -854,8 +836,6 @@ inline int16 GameObject::getMapNum(void) {
|
||||||
class ActiveRegion {
|
class ActiveRegion {
|
||||||
|
|
||||||
friend void initActiveRegions(void);
|
friend void initActiveRegions(void);
|
||||||
friend void saveActiveRegions(SaveFileConstructor &saveGame);
|
|
||||||
friend void loadActiveRegions(SaveFileReader &saveGame);
|
|
||||||
friend void cleanupActiveRegions(void);
|
friend void cleanupActiveRegions(void);
|
||||||
|
|
||||||
friend class ActiveRegionObjectIterator;
|
friend class ActiveRegionObjectIterator;
|
||||||
|
@ -902,9 +882,7 @@ void updateActiveRegions(void);
|
||||||
ActiveRegion *getActiveRegion(PlayerActorID id);
|
ActiveRegion *getActiveRegion(PlayerActorID id);
|
||||||
|
|
||||||
void initActiveRegions(void);
|
void initActiveRegions(void);
|
||||||
void saveActiveRegions(SaveFileConstructor &saveGame);
|
|
||||||
void saveActiveRegions(Common::OutSaveFile *out);
|
void saveActiveRegions(Common::OutSaveFile *out);
|
||||||
void loadActiveRegions(SaveFileReader &saveGame);
|
|
||||||
void loadActiveRegions(Common::InSaveFile *in);
|
void loadActiveRegions(Common::InSaveFile *in);
|
||||||
inline void cleanupActiveRegions(void) {}
|
inline void cleanupActiveRegions(void) {}
|
||||||
|
|
||||||
|
@ -1408,11 +1386,9 @@ void cleanupObjectSoundFXTable(void);
|
||||||
void initTempActorCount(void);
|
void initTempActorCount(void);
|
||||||
|
|
||||||
// Save the array of temp actor counts
|
// Save the array of temp actor counts
|
||||||
void saveTempActorCount(SaveFileConstructor &saveGame);
|
|
||||||
void saveTempActorCount(Common::OutSaveFile *out);
|
void saveTempActorCount(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the array of temp actor counts
|
// Load the array of temp actor counts
|
||||||
void loadTempActorCount(SaveFileReader &saveGame);
|
|
||||||
void loadTempActorCount(Common::InSaveFile *in, int32 chunkSize);
|
void loadTempActorCount(Common::InSaveFile *in, int32 chunkSize);
|
||||||
|
|
||||||
// Cleanup the array to temp actor counts
|
// Cleanup the array to temp actor counts
|
||||||
|
@ -1431,11 +1407,9 @@ uint16 getTempActorCount(uint16 protoNum);
|
||||||
void initWorlds(void);
|
void initWorlds(void);
|
||||||
|
|
||||||
// Save worlds to the save file
|
// Save worlds to the save file
|
||||||
void saveWorlds(SaveFileConstructor &saveGame);
|
|
||||||
void saveWorlds(Common::OutSaveFile *out);
|
void saveWorlds(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load worlds from the save file
|
// Load worlds from the save file
|
||||||
void loadWorlds(SaveFileReader &saveGame);
|
|
||||||
void loadWorlds(Common::InSaveFile *in);
|
void loadWorlds(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Cleanup game worlds
|
// Cleanup game worlds
|
||||||
|
@ -1445,11 +1419,9 @@ void cleanupWorlds(void);
|
||||||
void initObjects(void);
|
void initObjects(void);
|
||||||
|
|
||||||
// Save the objects to the save file
|
// Save the objects to the save file
|
||||||
void saveObjects(SaveFileConstructor &saveGame);
|
|
||||||
void saveObjects(Common::OutSaveFile *out);
|
void saveObjects(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the objects from the save file
|
// Load the objects from the save file
|
||||||
void loadObjects(SaveFileReader &saveGame);
|
|
||||||
void loadObjects(Common::InSaveFile *in);
|
void loadObjects(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Cleanup object list
|
// Cleanup object list
|
||||||
|
|
|
@ -76,11 +76,9 @@ void setPaletteToBlack(void);
|
||||||
void initPaletteState(void);
|
void initPaletteState(void);
|
||||||
// Save the current state of the current palette and fade up/down in
|
// Save the current state of the current palette and fade up/down in
|
||||||
// a save file.
|
// a save file.
|
||||||
void savePaletteState(SaveFileConstructor &saveGame);
|
|
||||||
void savePaletteState(Common::OutSaveFile *out);
|
void savePaletteState(Common::OutSaveFile *out);
|
||||||
// Load and set the current state of the current palette and fade
|
// Load and set the current state of the current palette and fade
|
||||||
// up/down from a save file.
|
// up/down from a save file.
|
||||||
void loadPaletteState(SaveFileReader &saveGame);
|
|
||||||
void loadPaletteState(Common::InSaveFile *in);
|
void loadPaletteState(Common::InSaveFile *in);
|
||||||
// Cleanup the palette
|
// Cleanup the palette
|
||||||
inline void cleanupPaletteState(void) { /* do nothing */ }
|
inline void cleanupPaletteState(void) { /* do nothing */ }
|
||||||
|
|
|
@ -938,54 +938,6 @@ void initPlayerActors(void) {
|
||||||
readyContainerSetup();
|
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) {
|
void savePlayerActors(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving PlayerActors");
|
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) {
|
void loadPlayerActors(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading PlayerActors");
|
debugC(2, kDebugSaveload, "Loading PlayerActors");
|
||||||
|
|
||||||
|
@ -1148,19 +1054,6 @@ void initCenterActor(void) {
|
||||||
updateBrotherRadioButtons(FTA_JULIAN);
|
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) {
|
void saveCenterActor(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving CenterActor");
|
debugC(2, kDebugSaveload, "Saving CenterActor");
|
||||||
|
|
||||||
|
@ -1176,19 +1069,6 @@ void saveCenterActor(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "... viewCenterObject = %d", viewCenterObject);
|
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) {
|
void loadCenterActor(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading CenterActor");
|
debugC(2, kDebugSaveload, "Loading CenterActor");
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,6 @@ class PlayerActor {
|
||||||
friend class Actor;
|
friend class Actor;
|
||||||
|
|
||||||
friend void initPlayerActors(void);
|
friend void initPlayerActors(void);
|
||||||
friend void savePlayerActors(SaveFileConstructor &);
|
|
||||||
friend void loadPlayerActors(SaveFileReader &);
|
|
||||||
friend void cleanupPlayerActors(void);
|
friend void cleanupPlayerActors(void);
|
||||||
|
|
||||||
ObjectID actorID; // ID of player's actor
|
ObjectID actorID; // ID of player's actor
|
||||||
|
@ -296,13 +294,7 @@ void handleEndOfCombat(void);
|
||||||
// Initialize the player actor list
|
// Initialize the player actor list
|
||||||
void initPlayerActors(void);
|
void initPlayerActors(void);
|
||||||
|
|
||||||
|
|
||||||
// Store the player actor list in a save file
|
|
||||||
void savePlayerActors(SaveFileConstructor &saveGame);
|
|
||||||
void savePlayerActors(Common::OutSaveFile *out);
|
void savePlayerActors(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the player list data from a save file
|
|
||||||
void loadPlayerActors(SaveFileReader &saveGame);
|
|
||||||
void loadPlayerActors(Common::InSaveFile *in);
|
void loadPlayerActors(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Cleanup the player actor list
|
// Cleanup the player actor list
|
||||||
|
@ -315,12 +307,7 @@ void cleanupPlayerActors(void);
|
||||||
// Initialize the center actor ID and view object ID
|
// Initialize the center actor ID and view object ID
|
||||||
void initCenterActor(void);
|
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);
|
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);
|
void loadCenterActor(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|
|
@ -124,12 +124,7 @@ enum builtinTypes {
|
||||||
// Load the SAGA data segment from the resource file
|
// Load the SAGA data segment from the resource file
|
||||||
void initSAGADataSeg(void);
|
void initSAGADataSeg(void);
|
||||||
|
|
||||||
// Save the SAGA data segment to a save file
|
|
||||||
void saveSAGADataSeg(SaveFileConstructor &saveGame);
|
|
||||||
void saveSAGADataSeg(Common::OutSaveFile *out);
|
void saveSAGADataSeg(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the SAGA data segment from a save file
|
|
||||||
void loadSAGADataSeg(SaveFileReader &saveGame);
|
|
||||||
void loadSAGADataSeg(Common::InSaveFile *in);
|
void loadSAGADataSeg(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Dispose of the SAGA data segment -- do nothing
|
// Dispose of the SAGA data segment -- do nothing
|
||||||
|
@ -144,12 +139,7 @@ class Thread;
|
||||||
// Initialize the SAGA thread list
|
// Initialize the SAGA thread list
|
||||||
void initSAGAThreads(void);
|
void initSAGAThreads(void);
|
||||||
|
|
||||||
// Save the active SAGA threads to a save file
|
|
||||||
void saveSAGAThreads(SaveFileConstructor &saveGame);
|
|
||||||
void saveSAGAThreads(Common::OutSaveFile *out);
|
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);
|
void loadSAGAThreads(Common::InSaveFile *in, int32 chunkSize);
|
||||||
|
|
||||||
// Dispose of the active SAGA threads
|
// Dispose of the active SAGA threads
|
||||||
|
|
|
@ -82,57 +82,6 @@ void deleteSensor(Sensor *p) {
|
||||||
g_vm->_sensorList.remove(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) {
|
void readSensor(int16 ctr, Common::InSaveFile *in) {
|
||||||
int16 type;
|
int16 type;
|
||||||
Sensor *sensor = nullptr;
|
Sensor *sensor = nullptr;
|
||||||
|
@ -190,22 +139,6 @@ int32 sensorArchiveSize(Sensor *sensor) {
|
||||||
+ sensor->archiveSize();
|
+ 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) {
|
void writeSensor(Sensor *sensor, Common::OutSaveFile *out) {
|
||||||
assert(sensor != NULL);
|
assert(sensor != NULL);
|
||||||
|
|
||||||
|
@ -280,76 +213,6 @@ void initSensors(void) {
|
||||||
assert(sizeof(EventSensor) <= maxSensorSize);
|
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) {
|
static int getSensorListID(SensorList *t) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Common::List<SensorList *>::iterator it = g_vm->_sensorListList.begin(); it != g_vm->_sensorListList.end(); it++, i++) {
|
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) {
|
void loadSensors(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading Sensors");
|
debugC(2, kDebugSaveload, "Loading Sensors");
|
||||||
|
|
||||||
|
@ -531,21 +346,6 @@ SensorList *fetchSensorList(GameObject *obj) {
|
||||||
SensorList member functions
|
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) {
|
SensorList::SensorList(Common::InSaveFile *in) {
|
||||||
ObjectID id = in->readUint16LE();
|
ObjectID id = in->readUint16LE();
|
||||||
|
|
||||||
|
@ -556,16 +356,6 @@ SensorList::SensorList(Common::InSaveFile *in) {
|
||||||
newSensorList(this);
|
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) {
|
void SensorList::write(Common::OutSaveFile *out) {
|
||||||
out->writeUint16LE(obj->thisID());
|
out->writeUint16LE(obj->thisID());
|
||||||
}
|
}
|
||||||
|
@ -574,32 +364,6 @@ void SensorList::write(Common::OutSaveFile *out) {
|
||||||
Sensor member functions
|
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) {
|
Sensor::Sensor(Common::InSaveFile *in, int16 ctr) {
|
||||||
ObjectID objID = in->readUint16LE();
|
ObjectID objID = in->readUint16LE();
|
||||||
|
|
||||||
|
@ -626,25 +390,6 @@ inline int32 Sensor::archiveSize(void) {
|
||||||
+ sizeof(range);
|
+ 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) {
|
void Sensor::write(Common::OutSaveFile *out) {
|
||||||
// Store the object's ID
|
// Store the object's ID
|
||||||
out->writeUint16LE(obj->thisID());
|
out->writeUint16LE(obj->thisID());
|
||||||
|
@ -796,19 +541,6 @@ bool ObjectSensor::evaluateEvent(const GameEvent &) {
|
||||||
SpecificObjectSensor member functions
|
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) :
|
SpecificObjectSensor::SpecificObjectSensor(Common::InSaveFile *in, int16 ctr) :
|
||||||
ObjectSensor(in, ctr) {
|
ObjectSensor(in, ctr) {
|
||||||
debugC(3, kDebugSaveload, "Loading SpecificObjectSensor");
|
debugC(3, kDebugSaveload, "Loading SpecificObjectSensor");
|
||||||
|
@ -824,20 +556,6 @@ inline int32 SpecificObjectSensor::archiveSize(void) {
|
||||||
return ObjectSensor::archiveSize() + sizeof(soughtObjID);
|
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) {
|
void SpecificObjectSensor::write(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "Saving SpecificObjectSensor");
|
debugC(3, kDebugSaveload, "Saving SpecificObjectSensor");
|
||||||
|
|
||||||
|
@ -908,19 +626,6 @@ bool SpecificObjectSensor::isObjectSought(GameObject *obj_) {
|
||||||
ObjectPropertySensor member functions
|
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) :
|
ObjectPropertySensor::ObjectPropertySensor(Common::InSaveFile *in, int16 ctr) :
|
||||||
ObjectSensor(in, ctr) {
|
ObjectSensor(in, ctr) {
|
||||||
debugC(3, kDebugSaveload, "Loading ObjectPropertySensor");
|
debugC(3, kDebugSaveload, "Loading ObjectPropertySensor");
|
||||||
|
@ -936,20 +641,6 @@ inline int32 ObjectPropertySensor::archiveSize(void) {
|
||||||
return ObjectSensor::archiveSize() + sizeof(objectProperty);
|
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) {
|
void ObjectPropertySensor::write(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "Saving ObjectPropertySensor");
|
debugC(3, kDebugSaveload, "Saving ObjectPropertySensor");
|
||||||
|
|
||||||
|
@ -994,20 +685,6 @@ bool ActorSensor::isObjectSought(GameObject *obj_) {
|
||||||
SpecificActorSensor member functions
|
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) {
|
SpecificActorSensor::SpecificActorSensor(Common::InSaveFile *in, int16 ctr) : ActorSensor(in, ctr) {
|
||||||
debugC(3, kDebugSaveload, "Loading SpecificActorSensor");
|
debugC(3, kDebugSaveload, "Loading SpecificActorSensor");
|
||||||
ObjectID actorID = in->readUint16LE();
|
ObjectID actorID = in->readUint16LE();
|
||||||
|
@ -1025,20 +702,6 @@ inline int32 SpecificActorSensor::archiveSize(void) {
|
||||||
return ActorSensor::archiveSize() + sizeof(ObjectID);
|
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) {
|
void SpecificActorSensor::write(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "Saving SpecificActorSensor");
|
debugC(3, kDebugSaveload, "Saving SpecificActorSensor");
|
||||||
|
|
||||||
|
@ -1100,18 +763,6 @@ bool SpecificActorSensor::isActorSought(Actor *a) {
|
||||||
ActorPropertySensor member functions
|
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) {
|
ActorPropertySensor::ActorPropertySensor(Common::InSaveFile *in, int16 ctr) : ActorSensor(in, ctr) {
|
||||||
debugC(3, kDebugSaveload, "Loading ActorPropertySensor");
|
debugC(3, kDebugSaveload, "Loading ActorPropertySensor");
|
||||||
// Restore the actor property's ID
|
// Restore the actor property's ID
|
||||||
|
@ -1125,20 +776,6 @@ inline int32 ActorPropertySensor::archiveSize(void) {
|
||||||
return ActorSensor::archiveSize() + sizeof(actorProperty);
|
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) {
|
void ActorPropertySensor::write(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "Saving ActorPropertySensor");
|
debugC(3, kDebugSaveload, "Saving ActorPropertySensor");
|
||||||
|
|
||||||
|
@ -1179,18 +816,6 @@ EventSensor::EventSensor(
|
||||||
eventType(type) {
|
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) {
|
EventSensor::EventSensor(Common::InSaveFile *in, int16 ctr) : Sensor(in, ctr) {
|
||||||
debugC(3, kDebugSaveload, "Loading EventSensor");
|
debugC(3, kDebugSaveload, "Loading EventSensor");
|
||||||
// Restore the event type
|
// Restore the event type
|
||||||
|
@ -1204,20 +829,6 @@ inline int32 EventSensor::archiveSize(void) {
|
||||||
return Sensor::archiveSize() + sizeof(eventType);
|
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) {
|
void EventSensor::write(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "Saving EventSensor");
|
debugC(3, kDebugSaveload, "Saving EventSensor");
|
||||||
|
|
||||||
|
|
|
@ -79,11 +79,7 @@ void assertEvent(const GameEvent &ev);
|
||||||
|
|
||||||
// Initialize the sensors
|
// Initialize the sensors
|
||||||
void initSensors(void);
|
void initSensors(void);
|
||||||
// Save all active sensors in a save file
|
|
||||||
void saveSensors(SaveFileConstructor &saveGame);
|
|
||||||
void saveSensors(Common::OutSaveFile *out);
|
void saveSensors(Common::OutSaveFile *out);
|
||||||
// Load sensors from a save file
|
|
||||||
void loadSensors(SaveFileReader &saveGame);
|
|
||||||
void loadSensors(Common::InSaveFile *in);
|
void loadSensors(Common::InSaveFile *in);
|
||||||
// Cleanup the active sensors
|
// Cleanup the active sensors
|
||||||
void cleanupSensors(void);
|
void cleanupSensors(void);
|
||||||
|
@ -130,9 +126,6 @@ public:
|
||||||
deleteSensorList(this);
|
deleteSensorList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
SensorList(void **buf);
|
|
||||||
|
|
||||||
SensorList(Common::InSaveFile *in);
|
SensorList(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
|
@ -141,9 +134,6 @@ public:
|
||||||
return sizeof(ObjectID);
|
return sizeof(ObjectID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
GameObject *getObject(void) {
|
GameObject *getObject(void) {
|
||||||
|
@ -171,9 +161,6 @@ public:
|
||||||
newSensor(this);
|
newSensor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from an archive buffer
|
|
||||||
Sensor(void **buf, int16 ctr);
|
|
||||||
|
|
||||||
Sensor(Common::InSaveFile *in, int16 ctr);
|
Sensor(Common::InSaveFile *in, int16 ctr);
|
||||||
|
|
||||||
// Virtural destructor
|
// Virtural destructor
|
||||||
|
@ -187,9 +174,6 @@ public:
|
||||||
// a buffer
|
// a buffer
|
||||||
virtual int32 archiveSize(void);
|
virtual int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
virtual void *archive(void *buf);
|
|
||||||
|
|
||||||
virtual void write(Common::OutSaveFile *out);
|
virtual void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Return an integer representing the type of this sensor
|
// Return an integer representing the type of this sensor
|
||||||
|
@ -223,9 +207,6 @@ public:
|
||||||
Sensor(o, sensorID, rng) {
|
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) {
|
ProtaganistSensor(Common::InSaveFile *in, int16 ctr) : Sensor(in, ctr) {
|
||||||
debugC(3, kDebugSaveload, "Loading ProtagonistSensor");
|
debugC(3, kDebugSaveload, "Loading ProtagonistSensor");
|
||||||
}
|
}
|
||||||
|
@ -251,9 +232,6 @@ public:
|
||||||
Sensor(o, sensorID, rng) {
|
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) {}
|
ObjectSensor(Common::InSaveFile *in, int16 ctr) : Sensor(in, ctr) {}
|
||||||
|
|
||||||
// Determine if the object can sense what it's looking for
|
// Determine if the object can sense what it's looking for
|
||||||
|
@ -285,18 +263,12 @@ public:
|
||||||
soughtObjID(objToSense) {
|
soughtObjID(objToSense) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from an archive buffer
|
|
||||||
SpecificObjectSensor(void **buf, int16 ctr);
|
|
||||||
|
|
||||||
SpecificObjectSensor(Common::InSaveFile *in, int16 ctr);
|
SpecificObjectSensor(Common::InSaveFile *in, int16 ctr);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Return an integer representing the type of this sensor
|
// Return an integer representing the type of this sensor
|
||||||
|
@ -328,18 +300,12 @@ public:
|
||||||
objectProperty(propToSense) {
|
objectProperty(propToSense) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from an archive buffer
|
|
||||||
ObjectPropertySensor(void **buf, int16 ctr);
|
|
||||||
|
|
||||||
ObjectPropertySensor(Common::InSaveFile *in, int16 ctr);
|
ObjectPropertySensor(Common::InSaveFile *in, int16 ctr);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Return an integer representing the type of this sensor
|
// Return an integer representing the type of this sensor
|
||||||
|
@ -361,9 +327,6 @@ public:
|
||||||
ObjectSensor(o, sensorID, rng) {
|
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) {}
|
ActorSensor(Common::InSaveFile *in, int16 ctr) : ObjectSensor(in, ctr) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -392,18 +355,12 @@ public:
|
||||||
soughtActor(actorToSense) {
|
soughtActor(actorToSense) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from an archive buffer
|
|
||||||
SpecificActorSensor(void **buf, int16 ctr);
|
|
||||||
|
|
||||||
SpecificActorSensor(Common::InSaveFile *in, int16 ctr);
|
SpecificActorSensor(Common::InSaveFile *in, int16 ctr);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Return an integer representing the type of this sensor
|
// Return an integer representing the type of this sensor
|
||||||
|
@ -435,18 +392,12 @@ public:
|
||||||
actorProperty(propToSense) {
|
actorProperty(propToSense) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from an archive buffer
|
|
||||||
ActorPropertySensor(void **buf, int16 ctr);
|
|
||||||
|
|
||||||
ActorPropertySensor(Common::InSaveFile *in, int16 ctr);
|
ActorPropertySensor(Common::InSaveFile *in, int16 ctr);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Return an integer representing the type of this sensor
|
// Return an integer representing the type of this sensor
|
||||||
|
@ -472,18 +423,12 @@ public:
|
||||||
int16 rng,
|
int16 rng,
|
||||||
int16 type);
|
int16 type);
|
||||||
|
|
||||||
// Constructor -- reconstruct from an archive buffer
|
|
||||||
EventSensor(void **buf, int16 ctr);
|
|
||||||
|
|
||||||
EventSensor(Common::InSaveFile *in, int16 ctr);
|
EventSensor(Common::InSaveFile *in, int16 ctr);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void);
|
int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Return an integer representing the type of this sensor
|
// Return an integer representing the type of this sensor
|
||||||
|
|
|
@ -132,59 +132,6 @@ inline uint32 extendID(int16 smallID) {
|
||||||
Speech member functions
|
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) {
|
void Speech::read(Common::InSaveFile *in) {
|
||||||
// Restore the sample count and character count
|
// Restore the sample count and character count
|
||||||
sampleCount = in->readSint16LE();
|
sampleCount = in->readSint16LE();
|
||||||
|
@ -251,51 +198,6 @@ int32 Speech::archiveSize(void) {
|
||||||
+ sizeof(char) * charCount;
|
+ 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) {
|
void Speech::write(Common::OutSaveFile *out) {
|
||||||
// Store the sample count and character count
|
// Store the sample count and character count
|
||||||
out->writeSint16LE(sampleCount);
|
out->writeSint16LE(sampleCount);
|
||||||
|
@ -1028,33 +930,6 @@ SpeechTaskList::SpeechTaskList(void) {
|
||||||
lockFlag = false;
|
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) {
|
SpeechTaskList::SpeechTaskList(Common::InSaveFile *in) {
|
||||||
int16 count;
|
int16 count;
|
||||||
|
|
||||||
|
@ -1096,33 +971,6 @@ int32 SpeechTaskList::archiveSize(void) {
|
||||||
return size;
|
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) {
|
void SpeechTaskList::write(Common::OutSaveFile *out) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int16 count = 0;
|
int16 count = 0;
|
||||||
|
@ -1297,29 +1145,6 @@ void initSpeechTasks(void) {
|
||||||
new (&speechList) SpeechTaskList;
|
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) {
|
void saveSpeechTasks(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving Speech Tasks");
|
debugC(2, kDebugSaveload, "Saving Speech Tasks");
|
||||||
|
|
||||||
|
@ -1333,34 +1158,6 @@ void saveSpeechTasks(Common::OutSaveFile *out) {
|
||||||
speechList.write(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) {
|
void loadSpeechTasks(Common::InSaveFile *in, int32 chunkSize) {
|
||||||
debugC(2, kDebugSaveload, "Loading Speech Tasks");
|
debugC(2, kDebugSaveload, "Loading Speech Tasks");
|
||||||
|
|
||||||
|
|
|
@ -232,11 +232,7 @@ extern SpeechTaskList &speechList;
|
||||||
void initSpeechTasks(void);
|
void initSpeechTasks(void);
|
||||||
|
|
||||||
// Save the speech tasks in a save file
|
// Save the speech tasks in a save file
|
||||||
void saveSpeechTasks(SaveFileConstructor &saveGame);
|
|
||||||
void saveSpeechTasks(Common::OutSaveFile *out);
|
void saveSpeechTasks(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the speech tasks from a save file
|
|
||||||
void loadSpeechTasks(SaveFileReader &saveGame);
|
|
||||||
void loadSpeechTasks(Common::InSaveFile *in, int32 chunkSize);
|
void loadSpeechTasks(Common::InSaveFile *in, int32 chunkSize);
|
||||||
|
|
||||||
// Cleanup the speech task list
|
// Cleanup the speech task list
|
||||||
|
|
|
@ -216,26 +216,12 @@ void SpellStuff::addEffect(ResourceSpellEffect *rse) {
|
||||||
void initSpellState(void) {
|
void initSpellState(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// serialize active spells
|
|
||||||
|
|
||||||
void saveSpellState(SaveFileConstructor &saveGame) {
|
|
||||||
activeSpells.save(saveGame);
|
|
||||||
}
|
|
||||||
|
|
||||||
void saveSpellState(Common::OutSaveFile *out) {
|
void saveSpellState(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving SpellState");
|
debugC(2, kDebugSaveload, "Saving SpellState");
|
||||||
|
|
||||||
activeSpells.write(out);
|
activeSpells.write(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// read serialized active spells
|
|
||||||
|
|
||||||
void loadSpellState(SaveFileReader &saveGame) {
|
|
||||||
activeSpells.load(saveGame);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadSpellState(Common::InSaveFile *in) {
|
void loadSpellState(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading SpellState");
|
debugC(2, kDebugSaveload, "Loading SpellState");
|
||||||
|
|
||||||
|
@ -394,21 +380,6 @@ size_t SpellDisplayList::saveSize(void) {
|
||||||
return total;
|
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) {
|
void SpellDisplayList::write(Common::OutSaveFile *out) {
|
||||||
size_t chunkSize = saveSize();
|
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) {
|
void SpellDisplayList::read(Common::InSaveFile *in) {
|
||||||
uint16 tCount;
|
uint16 tCount;
|
||||||
|
|
||||||
|
@ -490,14 +443,6 @@ size_t SpellInstance::saveSize(void) {
|
||||||
return total;
|
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) {
|
void SpellInstance::writeEffect(Common::OutSaveFile *out) {
|
||||||
if (eList.count > 0 && !(maxAge > 0 && (age + 1) > maxAge))
|
if (eList.count > 0 && !(maxAge > 0 && (age + 1) > maxAge))
|
||||||
for (int32 i = 0; i < eList.count; i++) {
|
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) {
|
void SpellInstance::readEffect(Common::InSaveFile *in, uint16 eListSize) {
|
||||||
assert(eListSize == effect->nodeCount);
|
assert(eListSize == effect->nodeCount);
|
||||||
eList.count = effect->nodeCount; //sdp->effCount;
|
eList.count = effect->nodeCount; //sdp->effCount;
|
||||||
|
|
|
@ -315,9 +315,7 @@ public:
|
||||||
|
|
||||||
void init(void);
|
void init(void);
|
||||||
void initEffect(TilePoint);
|
void initEffect(TilePoint);
|
||||||
void loadEffect(SaveFileReader &saveGame, uint16 eListSize);
|
|
||||||
void readEffect(Common::InSaveFile *in, uint16 eListSize);
|
void readEffect(Common::InSaveFile *in, uint16 eListSize);
|
||||||
void saveEffect(SaveFileConstructor &saveGame);
|
|
||||||
void writeEffect(Common::OutSaveFile *out);
|
void writeEffect(Common::OutSaveFile *out);
|
||||||
void termEffect(void);
|
void termEffect(void);
|
||||||
size_t saveSize(void);
|
size_t saveSize(void);
|
||||||
|
@ -351,9 +349,7 @@ public :
|
||||||
void buildList(void);
|
void buildList(void);
|
||||||
void updateStates(int32 deltaTime);
|
void updateStates(int32 deltaTime);
|
||||||
|
|
||||||
void save(SaveFileConstructor &saveGame);
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
void load(SaveFileReader &saveGame);
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
void wipe(void);
|
void wipe(void);
|
||||||
size_t saveSize(void);
|
size_t saveSize(void);
|
||||||
|
|
|
@ -43,52 +43,6 @@ void deleteTarget(Target *t) {
|
||||||
if (t) delete 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) {
|
void readTarget(void *mem, Common::InSaveFile *in) {
|
||||||
int16 type = in->readSint16LE();
|
int16 type = in->readSint16LE();
|
||||||
|
|
||||||
|
@ -141,16 +95,6 @@ int32 targetArchiveSize(const Target *t) {
|
||||||
return sizeof(int16) + t->archiveSize();
|
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
|
// Insert a location into a TargetLocationArray, using a simple
|
||||||
// insertion sort
|
// insertion sort
|
||||||
void insertLocation(
|
void insertLocation(
|
||||||
|
@ -205,18 +149,6 @@ bool Target::isActorTarget(void) const {
|
||||||
LocationTarget member functions
|
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) {
|
LocationTarget::LocationTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... LocationTarget");
|
debugC(5, kDebugSaveload, "...... LocationTarget");
|
||||||
|
|
||||||
|
@ -232,16 +164,6 @@ inline int32 LocationTarget::archiveSize(void) const {
|
||||||
return sizeof(loc);
|
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 {
|
void LocationTarget::write(Common::OutSaveFile *out) const {
|
||||||
// Store the target location
|
// Store the target location
|
||||||
loc.write(out);
|
loc.write(out);
|
||||||
|
@ -411,18 +333,6 @@ int16 TileTarget::where(
|
||||||
SpecificTileTarget member functions
|
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) {
|
SpecificTileTarget::SpecificTileTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... SpecificTileTarget");
|
debugC(5, kDebugSaveload, "...... SpecificTileTarget");
|
||||||
|
|
||||||
|
@ -438,16 +348,6 @@ inline int32 SpecificTileTarget::archiveSize(void) const {
|
||||||
return sizeof(tile);
|
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 {
|
void SpecificTileTarget::write(Common::OutSaveFile *out) const {
|
||||||
// Store the tile ID
|
// Store the tile ID
|
||||||
out->writeUint16LE(tile);
|
out->writeUint16LE(tile);
|
||||||
|
@ -493,18 +393,6 @@ bool SpecificTileTarget::isTarget(StandingTileInfo &sti) const {
|
||||||
TilePropertyTarget member functions
|
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) {
|
TilePropertyTarget::TilePropertyTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... TilePropertyTarget");
|
debugC(5, kDebugSaveload, "...... TilePropertyTarget");
|
||||||
|
|
||||||
|
@ -520,15 +408,6 @@ inline int32 TilePropertyTarget::archiveSize(void) const {
|
||||||
return sizeof(tileProp);
|
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 {
|
void TilePropertyTarget::write(Common::OutSaveFile *out) const {
|
||||||
out->writeSint16LE(tileProp);
|
out->writeSint16LE(tileProp);
|
||||||
}
|
}
|
||||||
|
@ -682,19 +561,6 @@ int16 MetaTileTarget::where(
|
||||||
SpecificMetaTileTarget member functions
|
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) {
|
SpecificMetaTileTarget::SpecificMetaTileTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... SpecificMetaTileTarget");
|
debugC(5, kDebugSaveload, "...... SpecificMetaTileTarget");
|
||||||
|
|
||||||
|
@ -711,19 +577,6 @@ inline int32 SpecificMetaTileTarget::archiveSize(void) const {
|
||||||
return sizeof(MetaTileID);
|
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 {
|
void SpecificMetaTileTarget::write(Common::OutSaveFile *out) const {
|
||||||
// Store the MetaTileID
|
// Store the MetaTileID
|
||||||
out->writeSint16LE(meta.map);
|
out->writeSint16LE(meta.map);
|
||||||
|
@ -773,18 +626,6 @@ bool SpecificMetaTileTarget::isTarget(
|
||||||
MetaTilePropertyTarget member functions
|
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) {
|
MetaTilePropertyTarget::MetaTilePropertyTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... MetaTilePropertyTarget");
|
debugC(5, kDebugSaveload, "...... MetaTilePropertyTarget");
|
||||||
|
|
||||||
|
@ -800,16 +641,6 @@ inline int32 MetaTilePropertyTarget::archiveSize(void) const {
|
||||||
return sizeof(metaProp);
|
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 {
|
void MetaTilePropertyTarget::write(Common::OutSaveFile *out) const {
|
||||||
// Store the MetaTilePropertyID
|
// Store the MetaTilePropertyID
|
||||||
out->writeSint16LE(metaProp);
|
out->writeSint16LE(metaProp);
|
||||||
|
@ -1070,18 +901,6 @@ int16 ObjectTarget::object(
|
||||||
SpecificObjectTarget member functions
|
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) {
|
SpecificObjectTarget::SpecificObjectTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... SpecificObjectTarget");
|
debugC(5, kDebugSaveload, "...... SpecificObjectTarget");
|
||||||
|
|
||||||
|
@ -1097,16 +916,6 @@ inline int32 SpecificObjectTarget::archiveSize(void) const {
|
||||||
return sizeof(obj);
|
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 {
|
void SpecificObjectTarget::write(Common::OutSaveFile *out) const {
|
||||||
// Store the ObjectID
|
// Store the ObjectID
|
||||||
out->writeUint16LE(obj);
|
out->writeUint16LE(obj);
|
||||||
|
@ -1243,18 +1052,6 @@ int16 SpecificObjectTarget::object(
|
||||||
ObjectPropertyTarget member functions
|
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) {
|
ObjectPropertyTarget::ObjectPropertyTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... ObjectPropertyTarget");
|
debugC(5, kDebugSaveload, "...... ObjectPropertyTarget");
|
||||||
|
|
||||||
|
@ -1270,16 +1067,6 @@ inline int32 ObjectPropertyTarget::archiveSize(void) const {
|
||||||
return sizeof(objProp);
|
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 {
|
void ObjectPropertyTarget::write(Common::OutSaveFile *out) const {
|
||||||
// Store the ObjectPropertyID
|
// Store the ObjectPropertyID
|
||||||
out->writeSint16LE(objProp);
|
out->writeSint16LE(objProp);
|
||||||
|
@ -1357,24 +1144,6 @@ int16 ActorTarget::actor(
|
||||||
SpecificActorTarget member functions
|
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) {
|
SpecificActorTarget::SpecificActorTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... SpecificActorTarget");
|
debugC(5, kDebugSaveload, "...... SpecificActorTarget");
|
||||||
|
|
||||||
|
@ -1397,19 +1166,6 @@ inline int32 SpecificActorTarget::archiveSize(void) const {
|
||||||
return sizeof(ObjectID);
|
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 {
|
void SpecificActorTarget::write(Common::OutSaveFile *out) const {
|
||||||
// Convert the actor pointer to an actor ID;
|
// Convert the actor pointer to an actor ID;
|
||||||
ObjectID actorID = a != NULL ? a->thisID() : Nothing;
|
ObjectID actorID = a != NULL ? a->thisID() : Nothing;
|
||||||
|
@ -1579,18 +1335,6 @@ int16 SpecificActorTarget::actor(
|
||||||
ActorPropertyTarget member functions
|
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) {
|
ActorPropertyTarget::ActorPropertyTarget(Common::SeekableReadStream *stream) {
|
||||||
debugC(5, kDebugSaveload, "...... ActorPropertyTarget");
|
debugC(5, kDebugSaveload, "...... ActorPropertyTarget");
|
||||||
|
|
||||||
|
@ -1606,16 +1350,6 @@ inline int32 ActorPropertyTarget::archiveSize(void) const {
|
||||||
return sizeof(actorProp);
|
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 {
|
void ActorPropertyTarget::write(Common::OutSaveFile *out) const {
|
||||||
// Store the ActorPropertyID
|
// Store the ActorPropertyID
|
||||||
out->writeSint16LE(actorProp);
|
out->writeSint16LE(actorProp);
|
||||||
|
|
|
@ -56,11 +56,9 @@ class Target;
|
||||||
// Deletes targets allocated on the heap using new
|
// Deletes targets allocated on the heap using new
|
||||||
void deleteTarget(Target *t);
|
void deleteTarget(Target *t);
|
||||||
|
|
||||||
void *constructTarget(void *mem, void *buf);
|
|
||||||
void readTarget(void *mem, Common::InSaveFile *in);
|
void readTarget(void *mem, Common::InSaveFile *in);
|
||||||
void writeTarget(const Target *t, Common::OutSaveFile *out);
|
void writeTarget(const Target *t, Common::OutSaveFile *out);
|
||||||
int32 targetArchiveSize(const Target *t);
|
int32 targetArchiveSize(const Target *t);
|
||||||
void *archiveTarget(const Target *t, void *buf);
|
|
||||||
|
|
||||||
/* ===================================================================== *
|
/* ===================================================================== *
|
||||||
TargetLocationArray structure
|
TargetLocationArray structure
|
||||||
|
@ -144,9 +142,6 @@ public:
|
||||||
// a buffer
|
// a buffer
|
||||||
virtual int32 archiveSize(void) const = 0;
|
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;
|
virtual void write(Common::OutSaveFile *out) const = 0;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -193,18 +188,12 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
LocationTarget(const TilePoint &tp) : loc(tp) {}
|
LocationTarget(const TilePoint &tp) : loc(tp) {}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
LocationTarget(void **buf);
|
|
||||||
|
|
||||||
LocationTarget(Common::SeekableReadStream *stream);
|
LocationTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -261,18 +250,12 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
SpecificTileTarget(TileID t) : tile(t) {}
|
SpecificTileTarget(TileID t) : tile(t) {}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
SpecificTileTarget(void **buf);
|
|
||||||
|
|
||||||
SpecificTileTarget(Common::SeekableReadStream *stream);
|
SpecificTileTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -301,18 +284,12 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
TilePropertyTarget(TilePropertyID tProp) : tileProp(tProp) {}
|
TilePropertyTarget(TilePropertyID tProp) : tileProp(tProp) {}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
TilePropertyTarget(void **buf);
|
|
||||||
|
|
||||||
TilePropertyTarget(Common::SeekableReadStream *stream);
|
TilePropertyTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -359,18 +336,12 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
SpecificMetaTileTarget(MetaTileID mt) : meta(mt) {}
|
SpecificMetaTileTarget(MetaTileID mt) : meta(mt) {}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
SpecificMetaTileTarget(void **buf);
|
|
||||||
|
|
||||||
SpecificMetaTileTarget(Common::SeekableReadStream *stream);
|
SpecificMetaTileTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -401,18 +372,12 @@ public:
|
||||||
metaProp(mtProp) {
|
metaProp(mtProp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
MetaTilePropertyTarget(void **buf);
|
|
||||||
|
|
||||||
MetaTilePropertyTarget(Common::SeekableReadStream *stream);
|
MetaTilePropertyTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -487,18 +452,12 @@ public:
|
||||||
obj((assert(isObject(ptr)), ptr->thisID())) {
|
obj((assert(isObject(ptr)), ptr->thisID())) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
SpecificObjectTarget(void **buf);
|
|
||||||
|
|
||||||
SpecificObjectTarget(Common::SeekableReadStream *stream);
|
SpecificObjectTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -544,18 +503,12 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
ObjectPropertyTarget(ObjectPropertyID prop) : objProp(prop) {}
|
ObjectPropertyTarget(ObjectPropertyID prop) : objProp(prop) {}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
ObjectPropertyTarget(void **buf);
|
|
||||||
|
|
||||||
ObjectPropertyTarget(Common::SeekableReadStream *stream);
|
ObjectPropertyTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -605,18 +558,12 @@ public:
|
||||||
a(actor_) {
|
a(actor_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
SpecificActorTarget(void **buf);
|
|
||||||
|
|
||||||
SpecificActorTarget(Common::SeekableReadStream *stream);
|
SpecificActorTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
@ -670,18 +617,12 @@ public:
|
||||||
actorProp(aProp) {
|
actorProp(aProp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
ActorPropertyTarget(void **buf);
|
|
||||||
|
|
||||||
ActorPropertyTarget(Common::SeekableReadStream *stream);
|
ActorPropertyTarget(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of target
|
// Return an integer representing the type of target
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -86,12 +86,7 @@ TaskStack *getTaskStackAddress(TaskStackID id);
|
||||||
// Initialize the task stack list
|
// Initialize the task stack list
|
||||||
void initTaskStacks(void);
|
void initTaskStacks(void);
|
||||||
|
|
||||||
// Save the task stack list to a save file
|
|
||||||
void saveTaskStacks(SaveFileConstructor &saveGame);
|
|
||||||
void saveTaskStacks(Common::OutSaveFile *out);
|
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);
|
void loadTaskStacks(Common::InSaveFile *in, int32 chunkSize);
|
||||||
|
|
||||||
// Cleanup the task stacks
|
// Cleanup the task stacks
|
||||||
|
@ -113,12 +108,7 @@ Task *getTaskAddress(TaskID id);
|
||||||
// Initialize the task list
|
// Initialize the task list
|
||||||
void initTasks(void);
|
void initTasks(void);
|
||||||
|
|
||||||
// Save the task list to a save file
|
|
||||||
void saveTasks(SaveFileConstructor &saveGame);
|
|
||||||
void saveTasks(Common::OutSaveFile *out);
|
void saveTasks(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the task list from a save file
|
|
||||||
void loadTasks(SaveFileReader &saveGame);
|
|
||||||
void loadTasks(Common::InSaveFile *in, int32 chunkSize);
|
void loadTasks(Common::InSaveFile *in, int32 chunkSize);
|
||||||
|
|
||||||
// Cleanup the task list
|
// Cleanup the task list
|
||||||
|
@ -148,9 +138,6 @@ public:
|
||||||
newTask(this, id);
|
newTask(this, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
Task(void **buf, TaskID id);
|
|
||||||
|
|
||||||
Task(Common::InSaveFile *in, TaskID id);
|
Task(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Virtual destructor -- do nothing
|
// Virtual destructor -- do nothing
|
||||||
|
@ -162,9 +149,6 @@ public:
|
||||||
// in a buffer
|
// in a buffer
|
||||||
virtual int32 archiveSize(void) const;
|
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;
|
virtual void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -199,18 +183,12 @@ public:
|
||||||
wander();
|
wander();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
WanderTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
WanderTask(Common::InSaveFile *in, TaskID id);
|
WanderTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -275,18 +253,12 @@ public:
|
||||||
_type = "TetheredWanderTask";
|
_type = "TetheredWanderTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
TetheredWanderTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
TetheredWanderTask(Common::InSaveFile *in, TaskID id);
|
TetheredWanderTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -325,9 +297,6 @@ public:
|
||||||
_type = "GotoTask";
|
_type = "GotoTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GotoTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GotoTask(Common::InSaveFile *in, TaskID id);
|
GotoTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Fixup the subtask pointer
|
// Fixup the subtask pointer
|
||||||
|
@ -337,9 +306,6 @@ public:
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -380,18 +346,12 @@ public:
|
||||||
_type = "GotoLocationTask";
|
_type = "GotoLocationTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GotoLocationTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GotoLocationTask(Common::InSaveFile *in, TaskID id);
|
GotoLocationTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -442,18 +402,12 @@ public:
|
||||||
_type = "GotoRegionTask";
|
_type = "GotoRegionTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GotoRegionTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GotoRegionTask(Common::InSaveFile *in, TaskID id);
|
GotoRegionTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -505,18 +459,12 @@ public:
|
||||||
_type = "GotoObjectTargetTask";
|
_type = "GotoObjectTargetTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GotoObjectTargetTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GotoObjectTargetTask(Common::InSaveFile *in, TaskID id);
|
GotoObjectTargetTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -556,18 +504,12 @@ public:
|
||||||
_type = "GotoObjectTask";
|
_type = "GotoObjectTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GotoObjectTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GotoObjectTask(Common::InSaveFile *in, TaskID id);
|
GotoObjectTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -600,18 +542,12 @@ public:
|
||||||
debugC(2, kDebugTasks, " - GotoActorTask");
|
debugC(2, kDebugTasks, " - GotoActorTask");
|
||||||
_type = "GotoActorTask";
|
_type = "GotoActorTask";
|
||||||
}
|
}
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GotoActorTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GotoActorTask(Common::InSaveFile *in, TaskID id);
|
GotoActorTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -660,18 +596,12 @@ public:
|
||||||
_type = "GoAwayFromTask";
|
_type = "GoAwayFromTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GoAwayFromTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GoAwayFromTask(Common::InSaveFile *in, TaskID id);
|
GoAwayFromTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -704,18 +634,12 @@ public:
|
||||||
_type = "GoAwayFromObjectTask";
|
_type = "GoAwayFromObjectTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GoAwayFromObjectTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GoAwayFromObjectTask(Common::InSaveFile *in, TaskID id);
|
GoAwayFromObjectTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -746,18 +670,12 @@ public:
|
||||||
const ActorTarget &at,
|
const ActorTarget &at,
|
||||||
bool runFlag = false);
|
bool runFlag = false);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
GoAwayFromActorTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
GoAwayFromActorTask(Common::InSaveFile *in, TaskID id);
|
GoAwayFromActorTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -795,18 +713,12 @@ public:
|
||||||
_type = "HuntTask";
|
_type = "HuntTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntTask(Common::InSaveFile *in, TaskID id);
|
HuntTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -850,18 +762,12 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
HuntLocationTask(TaskStack *ts, const Target &t);
|
HuntLocationTask(TaskStack *ts, const Target &t);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntLocationTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntLocationTask(Common::InSaveFile *in, TaskID id);
|
HuntLocationTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -899,18 +805,12 @@ public:
|
||||||
_type = "HuntToBeNearLocationTask";
|
_type = "HuntToBeNearLocationTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntToBeNearLocationTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntToBeNearLocationTask(Common::InSaveFile *in, TaskID id);
|
HuntToBeNearLocationTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -949,18 +849,12 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
HuntObjectTask(TaskStack *ts, const ObjectTarget &ot);
|
HuntObjectTask(TaskStack *ts, const ObjectTarget &ot);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntObjectTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntObjectTask(Common::InSaveFile *in, TaskID id);
|
HuntObjectTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1000,18 +894,12 @@ public:
|
||||||
_type = "HuntToBeNearObjectTask";
|
_type = "HuntToBeNearObjectTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntToBeNearObjectTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntToBeNearObjectTask(Common::InSaveFile *in, TaskID id);
|
HuntToBeNearObjectTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -1060,18 +948,12 @@ public:
|
||||||
_type = "HuntToPossessTask";
|
_type = "HuntToPossessTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntToPossessTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntToPossessTask(Common::InSaveFile *in, TaskID id);
|
HuntToPossessTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -1113,18 +995,12 @@ public:
|
||||||
const ActorTarget &at,
|
const ActorTarget &at,
|
||||||
bool trackFlag);
|
bool trackFlag);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntActorTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntActorTask(Common::InSaveFile *in, TaskID id);
|
HuntActorTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1176,18 +1052,12 @@ public:
|
||||||
_type = "HuntToBeNearActorTask";
|
_type = "HuntToBeNearActorTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntToBeNearActorTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntToBeNearActorTask(Common::InSaveFile *in, TaskID id);
|
HuntToBeNearActorTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -1248,18 +1118,12 @@ public:
|
||||||
const ActorTarget &at,
|
const ActorTarget &at,
|
||||||
bool trackFlag = false);
|
bool trackFlag = false);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntToKillTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntToKillTask(Common::InSaveFile *in, TaskID id);
|
HuntToKillTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -1310,18 +1174,12 @@ public:
|
||||||
_type = "HuntToGiveTask";
|
_type = "HuntToGiveTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
HuntToGiveTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
HuntToGiveTask(Common::InSaveFile *in, TaskID id);
|
HuntToGiveTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -1439,18 +1297,12 @@ public:
|
||||||
_type = "BandTask";
|
_type = "BandTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
BandTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
BandTask(Common::InSaveFile *in, TaskID id);
|
BandTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -1525,9 +1377,6 @@ public:
|
||||||
// Constructor -- initial constructor
|
// Constructor -- initial constructor
|
||||||
BandAndAvoidEnemiesTask(TaskStack *ts) : BandTask(ts) {}
|
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) {}
|
BandAndAvoidEnemiesTask(Common::InSaveFile *in, TaskID id) : BandTask(in, id) {}
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -1571,18 +1420,12 @@ public:
|
||||||
followPatrolRoute();
|
followPatrolRoute();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
FollowPatrolRouteTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
FollowPatrolRouteTask(Common::InSaveFile *in, TaskID id);
|
FollowPatrolRouteTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -1630,18 +1473,12 @@ public:
|
||||||
_type = "AttendTask";
|
_type = "AttendTask";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
AttendTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
AttendTask(Common::InSaveFile *in, TaskID id);
|
AttendTask(Common::InSaveFile *in, TaskID id);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
int32 archiveSize(void) const;
|
||||||
|
|
||||||
// Create an archive of this object in a buffer
|
|
||||||
void *archive(void *buf) const;
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out) const;
|
void write(Common::OutSaveFile *out) const;
|
||||||
|
|
||||||
// Return an integer representing the type of this task
|
// Return an integer representing the type of this task
|
||||||
|
@ -1676,9 +1513,6 @@ public:
|
||||||
subTask(NULL) {
|
subTask(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
DefendTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
// Fixup the subtask pointer
|
// Fixup the subtask pointer
|
||||||
void fixup(void);
|
void fixup(void);
|
||||||
|
|
||||||
|
@ -1686,9 +1520,6 @@ public:
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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
|
// Return an integer representing the type of this task
|
||||||
int16 getType(void) const;
|
int16 getType(void) const;
|
||||||
|
|
||||||
|
@ -1724,16 +1555,10 @@ public:
|
||||||
flags(0) {
|
flags(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
ParryTask(void **buf, TaskID id);
|
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this object in
|
// Return the number of bytes needed to archive this object in
|
||||||
// a buffer
|
// a buffer
|
||||||
int32 archiveSize(void) const;
|
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
|
// Return an integer representing the type of this task
|
||||||
int16 getType(void) const;
|
int16 getType(void) const;
|
||||||
|
|
||||||
|
@ -1778,9 +1603,6 @@ public:
|
||||||
newTaskStack(this);
|
newTaskStack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
TaskStack(void **buf);
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~TaskStack(void) {
|
~TaskStack(void) {
|
||||||
deleteTaskStack(this);
|
deleteTaskStack(this);
|
||||||
|
@ -1795,9 +1617,6 @@ public:
|
||||||
+ sizeof(evalRate);
|
+ sizeof(evalRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an archive of this TaskStack in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
|
|
|
@ -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) {
|
void saveActiveItemStates(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving ActiveItemStates");
|
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) {
|
void loadActiveItemStates(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading ActiveItemStates");
|
debugC(2, kDebugSaveload, "Loading ActiveItemStates");
|
||||||
|
|
||||||
|
@ -1115,29 +971,6 @@ int32 TileActivityTaskList::archiveSize(void) {
|
||||||
return size;
|
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) {
|
void TileActivityTaskList::read(Common::InSaveFile *in) {
|
||||||
int16 taskCount;
|
int16 taskCount;
|
||||||
|
|
||||||
|
@ -1408,34 +1241,6 @@ void moveActiveTerrain(int32 deltaTime) {
|
||||||
void initTileTasks(void) {
|
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) {
|
void saveTileTasks(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving TileActivityTasks");
|
debugC(2, kDebugSaveload, "Saving TileActivityTasks");
|
||||||
|
|
||||||
|
@ -1448,34 +1253,6 @@ void saveTileTasks(Common::OutSaveFile *out) {
|
||||||
aTaskList.write(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) {
|
void loadTileTasks(Common::InSaveFile *in, int32 chunkSize) {
|
||||||
debugC(2, kDebugSaveload, "Loading TileActivityTasks");
|
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) {
|
void saveAutoMap(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving AutoMap");
|
debugC(2, kDebugSaveload, "Saving AutoMap");
|
||||||
|
|
||||||
|
@ -1975,54 +1689,6 @@ void saveAutoMap(Common::OutSaveFile *out) {
|
||||||
free(archiveBuffer);
|
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) {
|
void loadAutoMap(Common::InSaveFile *in, int32 chunkSize) {
|
||||||
int32 totalMapIndex = 0;
|
int32 totalMapIndex = 0;
|
||||||
uint8 *archiveBuffer;
|
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) {
|
void saveTileCyclingStates(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving TileCyclingStates");
|
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) {
|
void loadTileCyclingStates(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading TileCyclingStates");
|
debugC(2, kDebugSaveload, "Loading TileCyclingStates");
|
||||||
|
|
||||||
|
|
|
@ -618,10 +618,6 @@ public:
|
||||||
// TileActivityTaskList
|
// TileActivityTaskList
|
||||||
int32 archiveSize(void);
|
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 read(Common::InSaveFile *in);
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
|
@ -1005,12 +1001,7 @@ void initPlatformCache(void);
|
||||||
// Initialize the tile activity task list
|
// Initialize the tile activity task list
|
||||||
void initTileTasks(void);
|
void initTileTasks(void);
|
||||||
|
|
||||||
// Save the tile activity task list to a save file
|
|
||||||
void saveTileTasks(SaveFileConstructor &saveGame);
|
|
||||||
void saveTileTasks(Common::OutSaveFile *out);
|
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);
|
void loadTileTasks(Common::InSaveFile *in, int32 chunkSize);
|
||||||
|
|
||||||
// Cleanup the tile activity task list
|
// Cleanup the tile activity task list
|
||||||
|
@ -1019,23 +1010,17 @@ void cleanupTileTasks(void);
|
||||||
TilePoint getClosestPointOnTAI(ActiveItem *TAI, GameObject *obj);
|
TilePoint getClosestPointOnTAI(ActiveItem *TAI, GameObject *obj);
|
||||||
|
|
||||||
void initActiveItemStates(void);
|
void initActiveItemStates(void);
|
||||||
void saveActiveItemStates(SaveFileConstructor &saveGame);
|
|
||||||
void saveActiveItemStates(Common::OutSaveFile *out);
|
void saveActiveItemStates(Common::OutSaveFile *out);
|
||||||
void loadActiveItemStates(SaveFileReader &saveGame);
|
|
||||||
void loadActiveItemStates(Common::InSaveFile *in);
|
void loadActiveItemStates(Common::InSaveFile *in);
|
||||||
void cleanupActiveItemStates(void);
|
void cleanupActiveItemStates(void);
|
||||||
|
|
||||||
void initTileCyclingStates(void);
|
void initTileCyclingStates(void);
|
||||||
void saveTileCyclingStates(SaveFileConstructor &saveGame);
|
|
||||||
void saveTileCyclingStates(Common::OutSaveFile *out);
|
void saveTileCyclingStates(Common::OutSaveFile *out);
|
||||||
void loadTileCyclingStates(SaveFileReader &saveGame);
|
|
||||||
void loadTileCyclingStates(Common::InSaveFile *in);
|
void loadTileCyclingStates(Common::InSaveFile *in);
|
||||||
void cleanupTileCyclingStates(void);
|
void cleanupTileCyclingStates(void);
|
||||||
|
|
||||||
void initAutoMap(void);
|
void initAutoMap(void);
|
||||||
void saveAutoMap(SaveFileConstructor &saveGame);
|
|
||||||
void saveAutoMap(Common::OutSaveFile *out);
|
void saveAutoMap(Common::OutSaveFile *out);
|
||||||
void loadAutoMap(SaveFileReader &saveGame);
|
|
||||||
void loadAutoMap(Common::InSaveFile *in, int32 chunkSize);
|
void loadAutoMap(Common::InSaveFile *in, int32 chunkSize);
|
||||||
inline void cleanupAutoMap(void) { /* nothing to do */ }
|
inline void cleanupAutoMap(void) { /* nothing to do */ }
|
||||||
|
|
||||||
|
|
|
@ -610,33 +610,6 @@ void initTileModeState(void) {
|
||||||
combatPaused = false;
|
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) {
|
void saveTileModeState(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving TileModeState");
|
debugC(2, kDebugSaveload, "Saving TileModeState");
|
||||||
|
|
||||||
|
@ -666,26 +639,6 @@ void saveTileModeState(Common::OutSaveFile *out) {
|
||||||
timeOfLastAggressiveAct.write(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) {
|
void loadTileModeState(Common::InSaveFile *in) {
|
||||||
assert(uiKeysEnabled);
|
assert(uiKeysEnabled);
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
|
|
||||||
namespace Saga2 {
|
namespace Saga2 {
|
||||||
|
|
||||||
class SaveFileConstructor;
|
|
||||||
class SaveFileReader;
|
|
||||||
|
|
||||||
// Function to enable/disable user interface keys
|
// Function to enable/disable user interface keys
|
||||||
bool enableUIKeys(bool enabled);
|
bool enableUIKeys(bool enabled);
|
||||||
|
|
||||||
|
@ -48,12 +45,7 @@ void logAggressiveAct(ObjectID attackerID, ObjectID attackeeID);
|
||||||
// Initialize the tile mode state
|
// Initialize the tile mode state
|
||||||
void initTileModeState(void);
|
void initTileModeState(void);
|
||||||
|
|
||||||
// Save the tile mode state to a save file
|
|
||||||
void saveTileModeState(SaveFileConstructor &saveGame);
|
|
||||||
void saveTileModeState(Common::OutSaveFile *out);
|
void saveTileModeState(Common::OutSaveFile *out);
|
||||||
|
|
||||||
// Load the tile mode state from a save file
|
|
||||||
void loadTileModeState(SaveFileReader &saveGame);
|
|
||||||
void loadTileModeState(Common::InSaveFile *in);
|
void loadTileModeState(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Cleanup the tile mode state
|
// Cleanup the tile mode state
|
||||||
|
|
|
@ -58,15 +58,6 @@ void resumeTimer() {
|
||||||
timerPaused = false;
|
timerPaused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveTimer(SaveFileConstructor &saveGame) {
|
|
||||||
int32 time = gameTime;
|
|
||||||
|
|
||||||
saveGame.writeChunk(
|
|
||||||
MakeID('T', 'I', 'M', 'E'),
|
|
||||||
&time,
|
|
||||||
sizeof(time));
|
|
||||||
}
|
|
||||||
|
|
||||||
void saveTimer(Common::OutSaveFile *out) {
|
void saveTimer(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving time");
|
debugC(2, kDebugSaveload, "Saving time");
|
||||||
|
|
||||||
|
@ -79,13 +70,6 @@ void saveTimer(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "... time = %d", time);
|
debugC(3, kDebugSaveload, "... time = %d", time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadTimer(SaveFileReader &saveGame) {
|
|
||||||
int32 time;
|
|
||||||
|
|
||||||
saveGame.read(&time, sizeof(time));
|
|
||||||
gameTime = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadTimer(Common::InSaveFile *in) {
|
void loadTimer(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading time");
|
debugC(2, kDebugSaveload, "Loading time");
|
||||||
|
|
||||||
|
@ -171,76 +155,6 @@ void initTimers(void) {
|
||||||
// Nothing to do
|
// 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) {
|
static int getTimerListID(TimerList *t) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Common::List<TimerList *>::iterator it = g_vm->_timerLists.begin(); it != g_vm->_timerLists.end(); it++, i++) {
|
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) {
|
void loadTimers(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading Timers");
|
debugC(2, kDebugSaveload, "Loading Timers");
|
||||||
|
|
||||||
|
@ -428,21 +285,6 @@ TimerList::TimerList(GameObject *o) : _obj(o) {
|
||||||
g_vm->_timerLists.push_back(this);
|
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) {
|
TimerList::TimerList(Common::InSaveFile *in) {
|
||||||
ObjectID id = in->readUint16LE();
|
ObjectID id = in->readUint16LE();
|
||||||
|
|
||||||
|
@ -460,17 +302,6 @@ TimerList::~TimerList() {
|
||||||
g_vm->_timerLists.remove(this);
|
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) {
|
void TimerList::write(Common::OutSaveFile *out) {
|
||||||
// Store the object's ID
|
// Store the object's ID
|
||||||
out->writeUint16LE(_obj->thisID());
|
out->writeUint16LE(_obj->thisID());
|
||||||
|
@ -480,37 +311,6 @@ void TimerList::write(Common::OutSaveFile *out) {
|
||||||
Timer member functions
|
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) {
|
Timer::Timer(Common::InSaveFile *in) {
|
||||||
ObjectID id = in->readUint16LE();
|
ObjectID id = in->readUint16LE();
|
||||||
|
|
||||||
|
@ -546,29 +346,6 @@ int32 Timer::archiveSize(void) {
|
||||||
+ sizeof(FrameAlarm);
|
+ 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) {
|
void Timer::write(Common::OutSaveFile *out) {
|
||||||
// Store the obj's ID
|
// Store the obj's ID
|
||||||
out->writeUint16LE(_obj->thisID());
|
out->writeUint16LE(_obj->thisID());
|
||||||
|
|
|
@ -46,11 +46,7 @@ void checkTimers(void);
|
||||||
|
|
||||||
// Initialize the Timers
|
// Initialize the Timers
|
||||||
void initTimers(void);
|
void initTimers(void);
|
||||||
// Save the active Timers in a save file
|
|
||||||
void saveTimers(SaveFileConstructor &saveGame);
|
|
||||||
void saveTimers(Common::OutSaveFile *out);
|
void saveTimers(Common::OutSaveFile *out);
|
||||||
// Load Timers from a save file
|
|
||||||
void loadTimers(SaveFileReader &saveGame);
|
|
||||||
void loadTimers(Common::InSaveFile *in);
|
void loadTimers(Common::InSaveFile *in);
|
||||||
// Cleanup the active Timers
|
// Cleanup the active Timers
|
||||||
void cleanupTimers(void);
|
void cleanupTimers(void);
|
||||||
|
@ -66,9 +62,6 @@ public:
|
||||||
// Constructor -- initial construction
|
// Constructor -- initial construction
|
||||||
TimerList(GameObject *o);
|
TimerList(GameObject *o);
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
TimerList(void **buf);
|
|
||||||
|
|
||||||
TimerList(Common::InSaveFile *in);
|
TimerList(Common::InSaveFile *in);
|
||||||
|
|
||||||
~TimerList();
|
~TimerList();
|
||||||
|
@ -79,9 +72,6 @@ public:
|
||||||
return sizeof(ObjectID);
|
return sizeof(ObjectID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
GameObject *getObject(void) {
|
GameObject *getObject(void) {
|
||||||
|
@ -113,9 +103,6 @@ public:
|
||||||
g_vm->_timers.push_back(this);
|
g_vm->_timers.push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor -- reconstruct from archive buffer
|
|
||||||
Timer(void **buf);
|
|
||||||
|
|
||||||
Timer(Common::InSaveFile *in);
|
Timer(Common::InSaveFile *in);
|
||||||
|
|
||||||
~Timer();
|
~Timer();
|
||||||
|
@ -124,9 +111,6 @@ public:
|
||||||
// a buffer
|
// a buffer
|
||||||
static int32 archiveSize(void);
|
static int32 archiveSize(void);
|
||||||
|
|
||||||
// Archive this object in a buffer
|
|
||||||
void *archive(void *buf);
|
|
||||||
|
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::OutSaveFile *out);
|
||||||
|
|
||||||
GameObject *getObject(void) {
|
GameObject *getObject(void) {
|
||||||
|
|
|
@ -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) {
|
void savePaletteState(Common::OutSaveFile *out) {
|
||||||
debugC(2, kDebugSaveload, "Saving Palette States");
|
debugC(2, kDebugSaveload, "Saving Palette States");
|
||||||
|
|
||||||
|
@ -374,24 +357,6 @@ void savePaletteState(Common::OutSaveFile *out) {
|
||||||
debugC(3, kDebugSaveload, "... totalTime = %d", totalTime);
|
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) {
|
void loadPaletteState(Common::InSaveFile *in) {
|
||||||
debugC(2, kDebugSaveload, "Loading Palette States");
|
debugC(2, kDebugSaveload, "Loading Palette States");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue