mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-04 15:51:42 +00:00
SAGA2: Make more save chunk sizes portable
This commit is contained in:
parent
a5a679447e
commit
93f24f239c
engines/saga2
@ -1685,12 +1685,13 @@ void initSAGADataSeg(void) {
|
||||
scriptRes->read(dataSegment, dataSegSize);
|
||||
}
|
||||
|
||||
void saveSAGADataSeg(Common::OutSaveFile *out) {
|
||||
void saveSAGADataSeg(Common::OutSaveFile *outS) {
|
||||
debugC(2, kDebugSaveload, "Saving Data Segment");
|
||||
|
||||
out->write("SDTA", 4);
|
||||
out->writeUint32LE(dataSegSize);
|
||||
outS->write("SDTA", 4);
|
||||
CHUNK_BEGIN;
|
||||
out->write(dataSegment, dataSegSize);
|
||||
CHUNK_END;
|
||||
}
|
||||
|
||||
void loadSAGADataSeg(Common::InSaveFile *in) {
|
||||
|
@ -1049,16 +1049,15 @@ void initCenterActor(void) {
|
||||
updateBrotherRadioButtons(FTA_JULIAN);
|
||||
}
|
||||
|
||||
void saveCenterActor(Common::OutSaveFile *out) {
|
||||
void saveCenterActor(Common::OutSaveFile *outS) {
|
||||
debugC(2, kDebugSaveload, "Saving CenterActor");
|
||||
|
||||
const int32 centerActorArchiveSize = 4;
|
||||
|
||||
out->write("CNTR", 4);
|
||||
out->writeUint32LE(centerActorArchiveSize);
|
||||
outS->write("CNTR", 4);
|
||||
CHUNK_BEGIN;
|
||||
// Store the center actor and view object
|
||||
out->writeSint16LE(centerActor);
|
||||
out->writeUint16LE(viewCenterObject);
|
||||
CHUNK_END;
|
||||
|
||||
debugC(3, kDebugSaveload, "... centerActor = %d", centerActor);
|
||||
debugC(3, kDebugSaveload, "... viewCenterObject = %d", viewCenterObject);
|
||||
|
@ -307,7 +307,7 @@ void cleanupPlayerActors(void);
|
||||
// Initialize the center actor ID and view object ID
|
||||
void initCenterActor(void);
|
||||
|
||||
void saveCenterActor(Common::OutSaveFile *out);
|
||||
void saveCenterActor(Common::OutSaveFile *outS);
|
||||
void loadCenterActor(Common::InSaveFile *in);
|
||||
|
||||
// Do nothing
|
||||
|
@ -124,7 +124,7 @@ enum builtinTypes {
|
||||
// Load the SAGA data segment from the resource file
|
||||
void initSAGADataSeg(void);
|
||||
|
||||
void saveSAGADataSeg(Common::OutSaveFile *out);
|
||||
void saveSAGADataSeg(Common::OutSaveFile *outS);
|
||||
void loadSAGADataSeg(Common::InSaveFile *in);
|
||||
|
||||
// Dispose of the SAGA data segment -- do nothing
|
||||
|
@ -904,44 +904,6 @@ TileActivityTaskList::TileActivityTaskList(void) {
|
||||
//-----------------------------------------------------------------------
|
||||
// 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) {
|
||||
read(stream);
|
||||
}
|
||||
@ -950,15 +912,6 @@ TileActivityTaskList::TileActivityTaskList(Common::SeekableReadStream *stream) {
|
||||
// Return the number of bytes needed to archive this
|
||||
// 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) {
|
||||
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();
|
||||
|
||||
// Store the task count
|
||||
@ -1229,16 +1182,13 @@ void moveActiveTerrain(int32 deltaTime) {
|
||||
void initTileTasks(void) {
|
||||
}
|
||||
|
||||
void saveTileTasks(Common::OutSaveFile *out) {
|
||||
void saveTileTasks(Common::OutSaveFile *outS) {
|
||||
debugC(2, kDebugSaveload, "Saving TileActivityTasks");
|
||||
|
||||
int32 archiveBufSize;
|
||||
archiveBufSize = aTaskList.archiveSize();
|
||||
|
||||
out->write("TACT", 4);
|
||||
out->writeUint32LE(archiveBufSize);
|
||||
|
||||
outS->write("TACT", 4);
|
||||
CHUNK_BEGIN;
|
||||
aTaskList.write(out);
|
||||
CHUNK_END;
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
const int tileCycleArchiveSize = 4 + 1;
|
||||
|
||||
out->write("CYCL", 4);
|
||||
out->writeUint32LE(tileCycleArchiveSize * cycleCount);
|
||||
|
||||
outS->write("CYCL", 4);
|
||||
CHUNK_BEGIN;
|
||||
for (int i = 0; i < cycleCount; 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, "... currentState = %d", cycleList[i].currentState);
|
||||
}
|
||||
CHUNK_END;
|
||||
}
|
||||
|
||||
void loadTileCyclingStates(Common::InSaveFile *in) {
|
||||
|
@ -611,16 +611,10 @@ public:
|
||||
TileActivityTaskList(void);
|
||||
|
||||
// Reconstruct the TileActivityTaskList from an archive buffer
|
||||
TileActivityTaskList(void **buf);
|
||||
|
||||
TileActivityTaskList(Common::SeekableReadStream *stream);
|
||||
|
||||
// Return the number of bytes needed to archive this
|
||||
// TileActivityTaskList
|
||||
int32 archiveSize(void);
|
||||
|
||||
void read(Common::InSaveFile *in);
|
||||
void write(Common::OutSaveFile *out);
|
||||
void write(Common::MemoryWriteStreamDynamic *out);
|
||||
|
||||
// Cleanup this list
|
||||
void cleanup(void);
|
||||
@ -1002,7 +996,7 @@ void initPlatformCache(void);
|
||||
// Initialize the tile activity task list
|
||||
void initTileTasks(void);
|
||||
|
||||
void saveTileTasks(Common::OutSaveFile *out);
|
||||
void saveTileTasks(Common::OutSaveFile *outS);
|
||||
void loadTileTasks(Common::InSaveFile *in, int32 chunkSize);
|
||||
|
||||
// Cleanup the tile activity task list
|
||||
@ -1016,7 +1010,7 @@ void loadActiveItemStates(Common::InSaveFile *in);
|
||||
void cleanupActiveItemStates(void);
|
||||
|
||||
void initTileCyclingStates(void);
|
||||
void saveTileCyclingStates(Common::OutSaveFile *out);
|
||||
void saveTileCyclingStates(Common::OutSaveFile *outS);
|
||||
void loadTileCyclingStates(Common::InSaveFile *in);
|
||||
void cleanupTileCyclingStates(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user