mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-11 19:23:01 +00:00
SAGA2: Make more save chunk sizes portable
This commit is contained in:
parent
a5a679447e
commit
93f24f239c
@ -1685,12 +1685,13 @@ void initSAGADataSeg(void) {
|
|||||||
scriptRes->read(dataSegment, dataSegSize);
|
scriptRes->read(dataSegment, dataSegSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveSAGADataSeg(Common::OutSaveFile *out) {
|
void saveSAGADataSeg(Common::OutSaveFile *outS) {
|
||||||
debugC(2, kDebugSaveload, "Saving Data Segment");
|
debugC(2, kDebugSaveload, "Saving Data Segment");
|
||||||
|
|
||||||
out->write("SDTA", 4);
|
outS->write("SDTA", 4);
|
||||||
out->writeUint32LE(dataSegSize);
|
CHUNK_BEGIN;
|
||||||
out->write(dataSegment, dataSegSize);
|
out->write(dataSegment, dataSegSize);
|
||||||
|
CHUNK_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadSAGADataSeg(Common::InSaveFile *in) {
|
void loadSAGADataSeg(Common::InSaveFile *in) {
|
||||||
|
@ -1049,16 +1049,15 @@ void initCenterActor(void) {
|
|||||||
updateBrotherRadioButtons(FTA_JULIAN);
|
updateBrotherRadioButtons(FTA_JULIAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveCenterActor(Common::OutSaveFile *out) {
|
void saveCenterActor(Common::OutSaveFile *outS) {
|
||||||
debugC(2, kDebugSaveload, "Saving CenterActor");
|
debugC(2, kDebugSaveload, "Saving CenterActor");
|
||||||
|
|
||||||
const int32 centerActorArchiveSize = 4;
|
outS->write("CNTR", 4);
|
||||||
|
CHUNK_BEGIN;
|
||||||
out->write("CNTR", 4);
|
|
||||||
out->writeUint32LE(centerActorArchiveSize);
|
|
||||||
// Store the center actor and view object
|
// Store the center actor and view object
|
||||||
out->writeSint16LE(centerActor);
|
out->writeSint16LE(centerActor);
|
||||||
out->writeUint16LE(viewCenterObject);
|
out->writeUint16LE(viewCenterObject);
|
||||||
|
CHUNK_END;
|
||||||
|
|
||||||
debugC(3, kDebugSaveload, "... centerActor = %d", centerActor);
|
debugC(3, kDebugSaveload, "... centerActor = %d", centerActor);
|
||||||
debugC(3, kDebugSaveload, "... viewCenterObject = %d", viewCenterObject);
|
debugC(3, kDebugSaveload, "... viewCenterObject = %d", viewCenterObject);
|
||||||
|
@ -307,7 +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);
|
||||||
|
|
||||||
void saveCenterActor(Common::OutSaveFile *out);
|
void saveCenterActor(Common::OutSaveFile *outS);
|
||||||
void loadCenterActor(Common::InSaveFile *in);
|
void loadCenterActor(Common::InSaveFile *in);
|
||||||
|
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@ -124,7 +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);
|
||||||
|
|
||||||
void saveSAGADataSeg(Common::OutSaveFile *out);
|
void saveSAGADataSeg(Common::OutSaveFile *outS);
|
||||||
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
|
||||||
|
@ -904,44 +904,6 @@ TileActivityTaskList::TileActivityTaskList(void) {
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Reconstruct the TileActivityTaskList from an archive buffer
|
// Reconstruct the TileActivityTaskList from an archive buffer
|
||||||
|
|
||||||
TileActivityTaskList::TileActivityTaskList(void **buf) {
|
|
||||||
warning("STUB: TileActivityTaskList::TileActivityTaskList(void **buf)");
|
|
||||||
#if 0
|
|
||||||
void *bufferPtr = *buf;
|
|
||||||
|
|
||||||
int16 taskCount;
|
|
||||||
|
|
||||||
for (uint i = 0; i < ARRAYSIZE(array); i++) {
|
|
||||||
free.addTail(array[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retreive the task count
|
|
||||||
taskCount = READ_LE_INT16(bufferPtr);
|
|
||||||
bufferPtr = (int16 *)bufferPtr + 1;
|
|
||||||
|
|
||||||
for (int i = 0; i < taskCount; i++) {
|
|
||||||
ActiveItem *tai;
|
|
||||||
uint8 activityType;
|
|
||||||
|
|
||||||
tai = ActiveItem::activeItemAddress(*((ActiveItemID *)bufferPtr));
|
|
||||||
bufferPtr = (ActiveItemID *)bufferPtr + 1;
|
|
||||||
|
|
||||||
activityType = *((uint8 *)bufferPtr);
|
|
||||||
bufferPtr = (uint8 *)bufferPtr + 1;
|
|
||||||
|
|
||||||
if (tai != nullptr) {
|
|
||||||
TileActivityTask *tat;
|
|
||||||
|
|
||||||
tat = newTask(tai);
|
|
||||||
if (tat != nullptr)
|
|
||||||
tat->activityType = activityType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*buf = bufferPtr;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
TileActivityTaskList::TileActivityTaskList(Common::SeekableReadStream *stream) {
|
TileActivityTaskList::TileActivityTaskList(Common::SeekableReadStream *stream) {
|
||||||
read(stream);
|
read(stream);
|
||||||
}
|
}
|
||||||
@ -950,15 +912,6 @@ TileActivityTaskList::TileActivityTaskList(Common::SeekableReadStream *stream) {
|
|||||||
// Return the number of bytes needed to archive this
|
// Return the number of bytes needed to archive this
|
||||||
// TileActivityTaskList
|
// TileActivityTaskList
|
||||||
|
|
||||||
int32 TileActivityTaskList::archiveSize(void) {
|
|
||||||
int32 size = sizeof(int16);
|
|
||||||
|
|
||||||
for (Common::List<TileActivityTask *>::iterator it = _list.begin(); it != _list.end(); ++it)
|
|
||||||
size += sizeof(ActiveItemID) + sizeof(uint8);
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TileActivityTaskList::read(Common::InSaveFile *in) {
|
void TileActivityTaskList::read(Common::InSaveFile *in) {
|
||||||
int16 taskCount;
|
int16 taskCount;
|
||||||
|
|
||||||
@ -987,7 +940,7 @@ void TileActivityTaskList::read(Common::InSaveFile *in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileActivityTaskList::write(Common::OutSaveFile *out) {
|
void TileActivityTaskList::write(Common::MemoryWriteStreamDynamic *out) {
|
||||||
int16 taskCount = _list.size();
|
int16 taskCount = _list.size();
|
||||||
|
|
||||||
// Store the task count
|
// Store the task count
|
||||||
@ -1229,16 +1182,13 @@ void moveActiveTerrain(int32 deltaTime) {
|
|||||||
void initTileTasks(void) {
|
void initTileTasks(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveTileTasks(Common::OutSaveFile *out) {
|
void saveTileTasks(Common::OutSaveFile *outS) {
|
||||||
debugC(2, kDebugSaveload, "Saving TileActivityTasks");
|
debugC(2, kDebugSaveload, "Saving TileActivityTasks");
|
||||||
|
|
||||||
int32 archiveBufSize;
|
outS->write("TACT", 4);
|
||||||
archiveBufSize = aTaskList.archiveSize();
|
CHUNK_BEGIN;
|
||||||
|
|
||||||
out->write("TACT", 4);
|
|
||||||
out->writeUint32LE(archiveBufSize);
|
|
||||||
|
|
||||||
aTaskList.write(out);
|
aTaskList.write(out);
|
||||||
|
CHUNK_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadTileTasks(Common::InSaveFile *in, int32 chunkSize) {
|
void loadTileTasks(Common::InSaveFile *in, int32 chunkSize) {
|
||||||
@ -4235,14 +4185,10 @@ void initTileCyclingStates(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveTileCyclingStates(Common::OutSaveFile *out) {
|
void saveTileCyclingStates(Common::OutSaveFile *outS) {
|
||||||
debugC(2, kDebugSaveload, "Saving TileCyclingStates");
|
debugC(2, kDebugSaveload, "Saving TileCyclingStates");
|
||||||
|
outS->write("CYCL", 4);
|
||||||
const int tileCycleArchiveSize = 4 + 1;
|
CHUNK_BEGIN;
|
||||||
|
|
||||||
out->write("CYCL", 4);
|
|
||||||
out->writeUint32LE(tileCycleArchiveSize * cycleCount);
|
|
||||||
|
|
||||||
for (int i = 0; i < cycleCount; i++) {
|
for (int i = 0; i < cycleCount; i++) {
|
||||||
debugC(3, kDebugSaveload, "Saving TileCyclingState %d", i);
|
debugC(3, kDebugSaveload, "Saving TileCyclingState %d", i);
|
||||||
|
|
||||||
@ -4252,6 +4198,7 @@ void saveTileCyclingStates(Common::OutSaveFile *out) {
|
|||||||
debugC(4, kDebugSaveload, "... counter = %d", cycleList[i].counter);
|
debugC(4, kDebugSaveload, "... counter = %d", cycleList[i].counter);
|
||||||
debugC(4, kDebugSaveload, "... currentState = %d", cycleList[i].currentState);
|
debugC(4, kDebugSaveload, "... currentState = %d", cycleList[i].currentState);
|
||||||
}
|
}
|
||||||
|
CHUNK_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadTileCyclingStates(Common::InSaveFile *in) {
|
void loadTileCyclingStates(Common::InSaveFile *in) {
|
||||||
|
@ -611,16 +611,10 @@ public:
|
|||||||
TileActivityTaskList(void);
|
TileActivityTaskList(void);
|
||||||
|
|
||||||
// Reconstruct the TileActivityTaskList from an archive buffer
|
// Reconstruct the TileActivityTaskList from an archive buffer
|
||||||
TileActivityTaskList(void **buf);
|
|
||||||
|
|
||||||
TileActivityTaskList(Common::SeekableReadStream *stream);
|
TileActivityTaskList(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
// Return the number of bytes needed to archive this
|
|
||||||
// TileActivityTaskList
|
|
||||||
int32 archiveSize(void);
|
|
||||||
|
|
||||||
void read(Common::InSaveFile *in);
|
void read(Common::InSaveFile *in);
|
||||||
void write(Common::OutSaveFile *out);
|
void write(Common::MemoryWriteStreamDynamic *out);
|
||||||
|
|
||||||
// Cleanup this list
|
// Cleanup this list
|
||||||
void cleanup(void);
|
void cleanup(void);
|
||||||
@ -1002,7 +996,7 @@ void initPlatformCache(void);
|
|||||||
// Initialize the tile activity task list
|
// Initialize the tile activity task list
|
||||||
void initTileTasks(void);
|
void initTileTasks(void);
|
||||||
|
|
||||||
void saveTileTasks(Common::OutSaveFile *out);
|
void saveTileTasks(Common::OutSaveFile *outS);
|
||||||
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
|
||||||
@ -1016,7 +1010,7 @@ void loadActiveItemStates(Common::InSaveFile *in);
|
|||||||
void cleanupActiveItemStates(void);
|
void cleanupActiveItemStates(void);
|
||||||
|
|
||||||
void initTileCyclingStates(void);
|
void initTileCyclingStates(void);
|
||||||
void saveTileCyclingStates(Common::OutSaveFile *out);
|
void saveTileCyclingStates(Common::OutSaveFile *outS);
|
||||||
void loadTileCyclingStates(Common::InSaveFile *in);
|
void loadTileCyclingStates(Common::InSaveFile *in);
|
||||||
void cleanupTileCyclingStates(void);
|
void cleanupTileCyclingStates(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user