[Scummvm-git-logs] scummvm master -> 79102d81907488788129004320f04f468c8bdb28
a-yyg
76591232+a-yyg at users.noreply.github.com
Sun Jul 11 04:29:02 UTC 2021
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
caf6f57b48 SAGA2: Implement TaskActivityList save/load
10fd1031e5 SAGA2: Implement Speech Tasks save/loading
558ecdc97d SAGA2: Implement ActiveRegion save/loading
79102d8190 SAGA2: Replace sizeof by constant in saveActiveRegions
Commit: caf6f57b485efc6fc9a6b727065386d0b5b7590a
https://github.com/scummvm/scummvm/commit/caf6f57b485efc6fc9a6b727065386d0b5b7590a
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-11T13:22:49+09:00
Commit Message:
SAGA2: Implement TaskActivityList save/load
Changed paths:
engines/saga2/loadsave.cpp
engines/saga2/tile.cpp
engines/saga2/tile.h
diff --git a/engines/saga2/loadsave.cpp b/engines/saga2/loadsave.cpp
index 89f077c025..c9463c01fe 100644
--- a/engines/saga2/loadsave.cpp
+++ b/engines/saga2/loadsave.cpp
@@ -159,9 +159,9 @@ Common::Error saveGameState(int16 saveNo, char *saveName) {
saveMotionTasks(out);
saveTaskStacks(out);
saveTasks(out);
+ saveTileTasks(out);
#if 0
- saveTileTasks(saveGame);
saveSpeechTasks(saveGame);
saveActiveRegions(saveGame);
saveTimers(saveGame);
@@ -330,15 +330,15 @@ void loadSavedGameState(int16 saveNo) {
} else
error("Tasks loaded prematurely");
break;
-#if 0
case MKTAG('T', 'A', 'C', 'T'):
if (loadFlags & loadWorldsFlag) {
- loadTileTasks(saveGame);
+ loadTileTasks(in, chunkSize);
loadFlags |= loadTileTasksFlag;
} else
error("TileActivityTasks loaded prematurely");
break;
+#if 0
case MKTAG('S', 'P', 'C', 'H'):
if (!(~loadFlags & (loadActorsFlag | loadObjectsFlag))) {
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 0859b4d8a7..8487c2afcf 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -1098,6 +1098,10 @@ TileActivityTaskList::TileActivityTaskList(void **buf) {
#endif
}
+TileActivityTaskList::TileActivityTaskList(Common::SeekableReadStream *stream) {
+ read(stream);
+}
+
//-----------------------------------------------------------------------
// Return the number of bytes needed to archive this
// TileActivityTaskList
@@ -1134,6 +1138,54 @@ Common::MemorySeekableReadWriteStream *TileActivityTaskList::archive(Common::Mem
return stream;
}
+void TileActivityTaskList::read(Common::InSaveFile *in) {
+ int16 taskCount;
+
+ // Retreive the task count
+ taskCount = in->readSint16LE();
+ debugC(3, kDebugSaveload, "... taskCount = %d", taskCount);
+
+ for (int i = 0; i < taskCount; i++) {
+ ActiveItem *tai;
+ uint8 activityType;
+
+ int16 val = in->readSint16LE();
+ tai = ActiveItem::activeItemAddress(ActiveItemID(val));
+ debugC(4, kDebugSaveload, "...... activeItemID = %d", val);
+
+ activityType = in->readByte();
+ debugC(4, kDebugSaveload, "...... activityType = %d", activityType);
+
+ if (tai != nullptr) {
+ TileActivityTask *tat;
+
+ tat = newTask(tai);
+ if (tat != nullptr)
+ tat->activityType = activityType;
+ }
+ }
+}
+
+void TileActivityTaskList::write(Common::OutSaveFile *out) {
+ int16 taskCount = _list.size();
+
+ // Store the task count
+ out->writeSint16LE(taskCount);
+ debugC(3, kDebugSaveload, "... taskCount = %d", taskCount);
+
+ for (Common::List<TileActivityTask *>::iterator it = _list.begin(); it != _list.end(); ++it) {
+ ActiveItem *ai = (*it)->tai;
+
+ // Store the activeItemID
+ out->writeSint16LE(ai->thisID().val);
+ debugC(4, kDebugSaveload, "...... activeItemID = %d", ai->thisID().val);
+
+ // Store the task type
+ out->writeByte((*it)->activityType);
+ debugC(4, kDebugSaveload, "...... activityType = %d", (*it)->activityType);
+ }
+}
+
//-----------------------------------------------------------------------
// Cleanup
@@ -1384,6 +1436,18 @@ void saveTileTasks(SaveFileConstructor &saveGame) {
delete stream;
}
+void saveTileTasks(Common::OutSaveFile *out) {
+ debugC(2, kDebugSaveload, "Saving TileActivityTasks");
+
+ int32 archiveBufSize;
+ archiveBufSize = aTaskList.archiveSize();
+
+ out->write("TACT", 4);
+ out->writeUint32LE(archiveBufSize);
+
+ aTaskList.write(out);
+}
+
//-----------------------------------------------------------------------
// Load the tile activity task list from a save file
@@ -1412,6 +1476,17 @@ void loadTileTasks(SaveFileReader &saveGame) {
free(archiveBuffer);
}
+void loadTileTasks(Common::InSaveFile *in, int32 chunkSize) {
+ debugC(2, kDebugSaveload, "Loading TileActivityTasks");
+
+ // If there is no saved data, simply call the default constructor
+ if (chunkSize == 0)
+ return;
+
+ // Reconstruct aTaskList from archived data
+ aTaskList.read(in);
+}
+
//-----------------------------------------------------------------------
// Cleanup the tile activity task list
diff --git a/engines/saga2/tile.h b/engines/saga2/tile.h
index 0a42ccf5b5..93b56c4140 100644
--- a/engines/saga2/tile.h
+++ b/engines/saga2/tile.h
@@ -612,6 +612,8 @@ public:
// 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);
@@ -620,6 +622,9 @@ public:
// archive buffer
Common::MemorySeekableReadWriteStream *archive(Common::MemorySeekableReadWriteStream *stream);
+ void read(Common::InSaveFile *in);
+ void write(Common::OutSaveFile *out);
+
// Cleanup this list
void cleanup(void);
@@ -1002,9 +1007,11 @@ void initTileTasks(void);
// Save the tile activity task list to a save file
void saveTileTasks(SaveFileConstructor &saveGame);
+void saveTileTasks(Common::OutSaveFile *out);
// Load the tile activity task list from a save file
void loadTileTasks(SaveFileReader &saveGame);
+void loadTileTasks(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the tile activity task list
void cleanupTileTasks(void);
Commit: 10fd1031e5a65990e93bd141adb93b60fac9a483
https://github.com/scummvm/scummvm/commit/10fd1031e5a65990e93bd141adb93b60fac9a483
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-11T13:22:49+09:00
Commit Message:
SAGA2: Implement Speech Tasks save/loading
Changed paths:
engines/saga2/loadsave.cpp
engines/saga2/rect.cpp
engines/saga2/rect.h
engines/saga2/speech.cpp
engines/saga2/speech.h
diff --git a/engines/saga2/loadsave.cpp b/engines/saga2/loadsave.cpp
index c9463c01fe..8e8c3c33fa 100644
--- a/engines/saga2/loadsave.cpp
+++ b/engines/saga2/loadsave.cpp
@@ -160,9 +160,9 @@ Common::Error saveGameState(int16 saveNo, char *saveName) {
saveTaskStacks(out);
saveTasks(out);
saveTileTasks(out);
+ saveSpeechTasks(out);
#if 0
- saveSpeechTasks(saveGame);
saveActiveRegions(saveGame);
saveTimers(saveGame);
saveSensors(saveGame);
@@ -338,15 +338,15 @@ void loadSavedGameState(int16 saveNo) {
} else
error("TileActivityTasks loaded prematurely");
break;
-#if 0
case MKTAG('S', 'P', 'C', 'H'):
if (!(~loadFlags & (loadActorsFlag | loadObjectsFlag))) {
- loadSpeechTasks(saveGame);
+ loadSpeechTasks(in, chunkSize);
loadFlags |= loadSpeechTasksFlag;
} else
error("SpeechTasks loaded prematurely");
break;
+#if 0
case MKTAG('A', 'R', 'E', 'G'):
loadActiveRegions(saveGame);
diff --git a/engines/saga2/rect.cpp b/engines/saga2/rect.cpp
index ba5e0e3df9..1617ccc587 100644
--- a/engines/saga2/rect.cpp
+++ b/engines/saga2/rect.cpp
@@ -40,6 +40,20 @@ void Point16::write(Common::OutSaveFile *out) {
out->writeSint16LE(y);
}
+void Rect16::read(Common::InSaveFile *in) {
+ x = in->readSint16LE();
+ y = in->readSint16LE();
+ width = in->readSint16LE();
+ height = in->readSint16LE();
+}
+
+void Rect16::write(Common::OutSaveFile *out) {
+ out->writeSint16LE(x);
+ out->writeSint16LE(y);
+ out->writeSint16LE(width);
+ out->writeSint16LE(height);
+}
+
Rect16 bound(const Rect16 a, const Rect16 b) {
int16 x1, x2, y1, y2;
diff --git a/engines/saga2/rect.h b/engines/saga2/rect.h
index 98c8ddd827..336797d8e0 100644
--- a/engines/saga2/rect.h
+++ b/engines/saga2/rect.h
@@ -314,6 +314,9 @@ public:
height = r.height;
}
+ void read(Common::InSaveFile *in);
+ void write(Common::OutSaveFile *out);
+
// Rect16 operators
friend int operator==(Rect16 a, Rect16 b) {
diff --git a/engines/saga2/speech.cpp b/engines/saga2/speech.cpp
index 267a7fecd7..7e083acf93 100644
--- a/engines/saga2/speech.cpp
+++ b/engines/saga2/speech.cpp
@@ -185,6 +185,56 @@ void *Speech::restore(void *buf) {
return buf;
}
+void Speech::read(Common::InSaveFile *in) {
+ // Restore the sample count and character count
+ sampleCount = in->readSint16LE();
+ charCount = in->readSint16LE();
+
+ // Restore the text boundaries
+ bounds.read(in);
+
+ // Restore the pen color and outline color
+ penColor = in->readUint16LE();
+ outlineColor = in->readUint16LE();
+
+ // Restore the object ID
+ objID = in->readUint16LE();
+
+ // Restore the thread ID
+ thread = in->readSint16LE();
+
+ // Restore the flags
+ speechFlags = in->readSint16LE();
+
+ debugC(4, kDebugSaveload, "...... sampleCount = %d", sampleCount);
+ debugC(4, kDebugSaveload, "...... charCount = %d", charCount);
+ debugC(4, kDebugSaveload, "...... penColor = %d", penColor);
+ debugC(4, kDebugSaveload, "...... outlineColor = %d", outlineColor);
+ debugC(4, kDebugSaveload, "...... bounds = (%d, %d, %d, %d)",
+ bounds.x, bounds.y, bounds.width, bounds.height);
+ debugC(4, kDebugSaveload, "...... objID = %d", objID);
+ debugC(4, kDebugSaveload, "...... thread = %d", thread);
+ debugC(4, kDebugSaveload, "...... speechFlags = %d", speechFlags);
+
+ // Restore the sample ID's
+ for (int i = 0; i < sampleCount; i++) {
+ sampleID[i] = in->readUint32LE();
+ debugC(4, kDebugSaveload, "...... sampleID[%d] = %d", i, sampleID[i]);
+ }
+
+ // Restore the text
+ in->read(speechBuffer, charCount);
+ speechBuffer[charCount] = '\0';
+ debugC(4, kDebugSaveload, "...... speechBuffer = %s", speechBuffer);
+
+ // Requeue the speech if needed
+ if (speechFlags & spQueued) {
+ // Add to the active list
+ speechList.remove(this);
+ speechList._list.push_back(this);
+ }
+}
+
//-----------------------------------------------------------------------
// Return the number of bytes needed to archive this SpeechTask
@@ -246,6 +296,48 @@ void *Speech::archive(void *buf) {
return buf;
}
+void Speech::write(Common::OutSaveFile *out) {
+ // Store the sample count and character count
+ out->writeSint16LE(sampleCount);
+ out->writeSint16LE(charCount);
+
+ // Store the text boundaries
+ bounds.write(out);
+
+ // Store the pen color and outline color
+ out->writeUint16LE(penColor);
+ out->writeUint16LE(outlineColor);
+
+ // Store the object's ID
+ out->writeUint16LE(objID);
+
+ // Store the thread ID
+ out->writeSint16LE(thread);
+
+ // Store the flags. NOTE: Make sure this speech is not stored
+ // as being active
+ out->writeSint16LE(speechFlags & ~spActive);
+
+ debugC(4, kDebugSaveload, "...... sampleCount = %d", sampleCount);
+ debugC(4, kDebugSaveload, "...... charCount = %d", charCount);
+ debugC(4, kDebugSaveload, "...... penColor = %d", penColor);
+ debugC(4, kDebugSaveload, "...... outlineColor = %d", outlineColor);
+ debugC(4, kDebugSaveload, "...... bounds = (%d, %d, %d, %d)",
+ bounds.x, bounds.y, bounds.width, bounds.height);
+ debugC(4, kDebugSaveload, "...... objID = %d", objID);
+ debugC(4, kDebugSaveload, "...... thread = %d", thread);
+ debugC(4, kDebugSaveload, "...... speechFlags = %d", speechFlags);
+
+ for (int i = 0; i < sampleCount; i++) {
+ out->writeUint32LE(sampleID[i]);
+ debugC(4, kDebugSaveload, "...... sampleID[%d] = %d", i, sampleID[i]);
+ }
+
+ // Store the text
+ out->write(speechBuffer, charCount);
+ debugC(4, kDebugSaveload, "...... speechBuffer = %s", speechBuffer);
+}
+
//-----------------------------------------------------------------------
// Append text and sample to existing speech record
@@ -963,6 +1055,26 @@ SpeechTaskList::SpeechTaskList(void **buf) {
*buf = bufferPtr;
}
+SpeechTaskList::SpeechTaskList(Common::InSaveFile *in) {
+ int16 count;
+
+ lockFlag = false;
+
+ // Get the speech count
+ count = in->readSint16LE();
+ debugC(3, kDebugSaveload, "... count = %d", count);
+
+ // Restore the speeches
+ for (int i = 0; i < count; i++) {
+ Speech *sp = new Speech;
+ assert(sp != NULL);
+ debugC(3, kDebugSaveload, "Loading Speech %d", i++);
+
+ _inactiveList.push_back(sp);
+ sp->read(in);
+ }
+}
+
//-----------------------------------------------------------------------
// Return the number of bytes needed to archive the speech tasks
@@ -1011,6 +1123,31 @@ void *SpeechTaskList::archive(void *buf) {
return buf;
}
+void SpeechTaskList::write(Common::OutSaveFile *out) {
+ int i = 0;
+ int16 count = 0;
+
+ count += _list.size() + _inactiveList.size();
+
+ // Store speech count
+ out->writeSint16LE(count);
+ debugC(3, kDebugSaveload, "... count = %d", count);
+
+ // Store active speeches
+ for (Common::List<Speech *>::iterator it = _list.begin();
+ it != _list.end(); ++it) {
+ debugC(3, kDebugSaveload, "Saving Speech %d (active)", i++);
+ (*it)->write(out);
+ }
+
+ // Store inactive speeches
+ for (Common::List<Speech *>::iterator it = _inactiveList.begin();
+ it != _inactiveList.end(); ++it) {
+ debugC(3, kDebugSaveload, "Saving Speech %d (inactive)", i++);
+ (*it)->write(out);
+ }
+}
+
//-----------------------------------------------------------------------
// Cleanup the speech tasks
@@ -1183,6 +1320,19 @@ void saveSpeechTasks(SaveFileConstructor &saveGame) {
free(archiveBuffer);
}
+void saveSpeechTasks(Common::OutSaveFile *out) {
+ debugC(2, kDebugSaveload, "Saving Speech Tasks");
+
+ int32 archiveBufSize;
+
+ archiveBufSize = speechList.archiveSize();
+
+ out->write("SPCH", 4);
+ out->writeUint32LE(archiveBufSize);
+
+ speechList.write(out);
+}
+
//-----------------------------------------------------------------------
// Load the speech tasks from a save file
@@ -1211,6 +1361,19 @@ void loadSpeechTasks(SaveFileReader &saveGame) {
free(archiveBuffer);
}
+void loadSpeechTasks(Common::InSaveFile *in, int32 chunkSize) {
+ debugC(2, kDebugSaveload, "Loading Speech Tasks");
+
+ // If there is no saved data, simply call the default constructor
+ if (chunkSize == 0) {
+ new (&speechList) SpeechTaskList;
+ return;
+ }
+
+ // Reconstruct stackList from archived data
+ new (&speechList) SpeechTaskList(in);
+}
+
//-----------------------------------------------------------------------
// Cleanup the speech task list
diff --git a/engines/saga2/speech.h b/engines/saga2/speech.h
index a285e09dd7..94d40f1f4d 100644
--- a/engines/saga2/speech.h
+++ b/engines/saga2/speech.h
@@ -113,12 +113,16 @@ private:
// Reconstruct this SpeechTask from an archive buffer
void *restore(void *buf);
+ void read(Common::InSaveFile *in);
+
// Return the number of bytes needed to archive this SpeechTask
int32 archiveSize(void);
// Archive this SpeechTask in a buffer
void *archive(void *buf);
+ void write(Common::OutSaveFile *out);
+
bool setupActive(void); // render speech into temp image
bool displayText(void);
int16 fits(int16 space);
@@ -185,12 +189,16 @@ public:
// Constructor -- reconstruct from archive buffer
SpeechTaskList(void **buf);
+ SpeechTaskList(Common::InSaveFile *in);
+
// Return the number of bytes needed to archive the speech tasks
int32 archiveSize(void);
// Create an archive of the speech tasks in an archive buffer
void *archive(void *buf);
+ void write(Common::OutSaveFile *out);
+
// Cleanup the speech tasks
void cleanup(void);
@@ -225,9 +233,11 @@ void initSpeechTasks(void);
// Save the speech tasks in a save file
void saveSpeechTasks(SaveFileConstructor &saveGame);
+void saveSpeechTasks(Common::OutSaveFile *out);
// Load the speech tasks from a save file
void loadSpeechTasks(SaveFileReader &saveGame);
+void loadSpeechTasks(Common::InSaveFile *in, int32 chunkSize);
// Cleanup the speech task list
void cleanupSpeechTasks(void);
Commit: 558ecdc97d94869138af344831b38f03b99ee096
https://github.com/scummvm/scummvm/commit/558ecdc97d94869138af344831b38f03b99ee096
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-11T13:22:49+09:00
Commit Message:
SAGA2: Implement ActiveRegion save/loading
Changed paths:
engines/saga2/loadsave.cpp
engines/saga2/objects.cpp
engines/saga2/objects.h
engines/saga2/tcoords.h
diff --git a/engines/saga2/loadsave.cpp b/engines/saga2/loadsave.cpp
index 8e8c3c33fa..7cca8bfc7d 100644
--- a/engines/saga2/loadsave.cpp
+++ b/engines/saga2/loadsave.cpp
@@ -161,9 +161,9 @@ Common::Error saveGameState(int16 saveNo, char *saveName) {
saveTasks(out);
saveTileTasks(out);
saveSpeechTasks(out);
+ saveActiveRegions(out);
#if 0
- saveActiveRegions(saveGame);
saveTimers(saveGame);
saveSensors(saveGame);
saveTempActorCount(saveGame);
@@ -346,12 +346,12 @@ void loadSavedGameState(int16 saveNo) {
} else
error("SpeechTasks loaded prematurely");
break;
-#if 0
case MKTAG('A', 'R', 'E', 'G'):
- loadActiveRegions(saveGame);
+ loadActiveRegions(in);
loadFlags |= loadActiveRegionsFlag;
break;
+#if 0
case MKTAG('T', 'I', 'M', 'R'):
if (loadFlags & loadActorsFlag) {
diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index 40d473384b..2cb21383fe 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -3347,6 +3347,32 @@ void Sector::write(Common::OutSaveFile *out) {
//-------------------------------------------------------------------
// Update this active region
+void ActiveRegion::read(Common::InSaveFile *in) {
+ anchor = in->readUint16LE();
+ anchorLoc.load(in);
+ worldID = in->readUint16LE();
+ region.read(in);
+
+ debugC(4, kDebugSaveload, "... anchor = %d", anchor);
+ debugC(4, kDebugSaveload, "... anchorLoc = (%d, %d, %d)", anchorLoc.u, anchorLoc.v, anchorLoc.z);
+ debugC(4, kDebugSaveload, "... worldID = %d", worldID);
+ debugC(4, kDebugSaveload, "... region = (min: (%d, %d, %d), max: (%d, %d, %d))",
+ region.min.u, region.min.v, region.min.z, region.max.u, region.max.v, region.max.z);
+}
+
+void ActiveRegion::write(Common::OutSaveFile *out) {
+ out->writeUint16LE(anchor);
+ anchorLoc.write(out);
+ out->writeUint16LE(worldID);
+ region.write(out);
+
+ debugC(4, kDebugSaveload, "... anchor = %d", anchor);
+ debugC(4, kDebugSaveload, "... anchorLoc = (%d, %d, %d)", anchorLoc.u, anchorLoc.v, anchorLoc.z);
+ debugC(4, kDebugSaveload, "... worldID = %d", worldID);
+ debugC(4, kDebugSaveload, "... region = (min: (%d, %d, %d), max: (%d, %d, %d))",
+ region.min.u, region.min.v, region.min.z, region.max.u, region.max.v, region.max.z);
+}
+
void ActiveRegion::update(void) {
GameObject *obj = GameObject::objectAddress(anchor);
GameWorld *world = (GameWorld *)GameObject::objectAddress(worldID);
@@ -3504,6 +3530,18 @@ void saveActiveRegions(SaveFileConstructor &saveGame) {
sizeof(activeRegionList));
}
+void saveActiveRegions(Common::OutSaveFile *out) {
+ debugC(2, kDebugSaveload, "Saving ActiveRegions");
+
+ out->write("AREG", 4);
+ out->writeUint32LE(sizeof(activeRegionList));
+
+ for (int i = 0; i < playerActors; ++i) {
+ debugC(3, kDebugSaveload, "Saving Active Region %d", i);
+ activeRegionList[i].write(out);
+ }
+}
+
//-------------------------------------------------------------------
// Load the active regions from a save file
@@ -3511,6 +3549,15 @@ void loadActiveRegions(SaveFileReader &saveGame) {
saveGame.read(&activeRegionList, sizeof(activeRegionList));
}
+void loadActiveRegions(Common::InSaveFile *in) {
+ debugC(2, kDebugSaveload, "Loading ActiveRegions");
+
+ for (int i = 0; i < playerActors; ++i) {
+ debugC(3, kDebugSaveload, "Loading Active Region %d", i);
+ activeRegionList[i].read(in);
+ }
+}
+
/* ======================================================================= *
SectorRegionObjectIterator member functions
* ======================================================================= */
diff --git a/engines/saga2/objects.h b/engines/saga2/objects.h
index 8198a2245e..477c12525b 100644
--- a/engines/saga2/objects.h
+++ b/engines/saga2/objects.h
@@ -870,6 +870,9 @@ public:
ActiveRegion() : anchor(0), worldID(0) {}
void update(void);
+ void read(Common::InSaveFile *in);
+ void write(Common::OutSaveFile *out);
+
// Return the current region in tile point coords
TileRegion getRegion(void) {
TileRegion tReg;
@@ -896,7 +899,9 @@ ActiveRegion *getActiveRegion(PlayerActorID id);
void initActiveRegions(void);
void saveActiveRegions(SaveFileConstructor &saveGame);
+void saveActiveRegions(Common::OutSaveFile *out);
void loadActiveRegions(SaveFileReader &saveGame);
+void loadActiveRegions(Common::InSaveFile *in);
inline void cleanupActiveRegions(void) {}
/* ======================================================================= *
diff --git a/engines/saga2/tcoords.h b/engines/saga2/tcoords.h
index 20fe1a3f04..acb84a899e 100644
--- a/engines/saga2/tcoords.h
+++ b/engines/saga2/tcoords.h
@@ -222,6 +222,16 @@ const extern StaticTilePoint Nowhere;
struct TileRegion {
TilePoint min,
max;
+
+ void read(Common::InSaveFile *in) {
+ min.load(in);
+ max.load(in);
+ }
+
+ void write(Common::OutSaveFile *out) {
+ min.write(out);
+ max.write(out);
+ }
};
/* ============================================================================ *
Commit: 79102d81907488788129004320f04f468c8bdb28
https://github.com/scummvm/scummvm/commit/79102d81907488788129004320f04f468c8bdb28
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-11T13:28:18+09:00
Commit Message:
SAGA2: Replace sizeof by constant in saveActiveRegions
Changed paths:
engines/saga2/objects.cpp
engines/saga2/objects.h
diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index 2cb21383fe..9cc0b63a3b 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -3534,7 +3534,9 @@ void saveActiveRegions(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving ActiveRegions");
out->write("AREG", 4);
- out->writeUint32LE(sizeof(activeRegionList));
+
+ const int saveSize = ActiveRegion::kActiveRegionSize * playerActors;
+ out->writeUint32LE(saveSize);
for (int i = 0; i < playerActors; ++i) {
debugC(3, kDebugSaveload, "Saving Active Region %d", i);
diff --git a/engines/saga2/objects.h b/engines/saga2/objects.h
index 477c12525b..0e36c3de87 100644
--- a/engines/saga2/objects.h
+++ b/engines/saga2/objects.h
@@ -867,6 +867,10 @@ class ActiveRegion {
public:
+ enum {
+ kActiveRegionSize = 22
+ };
+
ActiveRegion() : anchor(0), worldID(0) {}
void update(void);
More information about the Scummvm-git-logs
mailing list