[Scummvm-git-logs] scummvm master -> 23910f0d950b45711c1de499ffb370a0a30e5a31
a-yyg
76591232+a-yyg at users.noreply.github.com
Thu Jul 15 15:10:17 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:
e6365abfd9 SAGA2: Make Sensor chunk size portable
d0beb60d2f SAGA2: Make Mission chunk size portable
668e4bff41 SAGA2: Make FactionTallies chunk size portable
23910f0d95 SAGA2: Make remaining chunk sizes portable
Commit: e6365abfd95d253afb51b285015940759e76ea59
https://github.com/scummvm/scummvm/commit/e6365abfd95d253afb51b285015940759e76ea59
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-16T00:08:46+09:00
Commit Message:
SAGA2: Make Sensor chunk size portable
Changed paths:
engines/saga2/sensor.cpp
engines/saga2/sensor.h
diff --git a/engines/saga2/sensor.cpp b/engines/saga2/sensor.cpp
index ea6997fd8b..387bdcb9f5 100644
--- a/engines/saga2/sensor.cpp
+++ b/engines/saga2/sensor.cpp
@@ -125,18 +125,7 @@ void readSensor(int16 ctr, Common::InSaveFile *in) {
sl->_list.push_back(sensor);
}
-//----------------------------------------------------------------------
-// Return the number of bytes needed to archive the specified Sensor in
-// an archive buffer
-
-int32 sensorArchiveSize(Sensor *sensor) {
- assert(sensor != NULL);
-
- return sizeof(int16) // Type
- + sensor->archiveSize();
-}
-
-void writeSensor(Sensor *sensor, Common::OutSaveFile *out) {
+void writeSensor(Sensor *sensor, Common::MemoryWriteStreamDynamic *out) {
assert(sensor != NULL);
// Store the sensor type
@@ -229,32 +218,20 @@ static int getSensorID(Sensor *t) {
}
-void saveSensors(Common::OutSaveFile *out) {
+void saveSensors(Common::OutSaveFile *outS) {
debugC(2, kDebugSaveload, "Saving Sensors");
int16 sensorListCount = 0,
sensorCount = 0;
- int32 archiveBufSize = 0;
-
- // Add the sizes of the sensor list count an sensor count
- archiveBufSize += sizeof(sensorListCount) + sizeof(sensorCount);
-
// Tally the sensor lists
sensorListCount = g_vm->_sensorListList.size();
- // Add the total archive size of all of the sensor lists
- archiveBufSize += 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);
- }
-
- out->write("SENS", 4);
- out->writeUint32LE(archiveBufSize);
+ sensorCount = g_vm->_sensorList.size();
+ outS->write("SENS", 4);
+ CHUNK_BEGIN;
// Store the sensor list count and sensor count
out->writeSint16LE(sensorListCount);
out->writeSint16LE(sensorCount);
@@ -276,6 +253,7 @@ void saveSensors(Common::OutSaveFile *out) {
writeSensor(*it, out);
}
+ CHUNK_END;
}
void loadSensors(Common::InSaveFile *in) {
@@ -353,7 +331,7 @@ SensorList::SensorList(Common::InSaveFile *in) {
newSensorList(this);
}
-void SensorList::write(Common::OutSaveFile *out) {
+void SensorList::write(Common::MemoryWriteStreamDynamic *out) {
out->writeUint16LE(obj->thisID());
}
@@ -381,13 +359,7 @@ Sensor::Sensor(Common::InSaveFile *in, int16 ctr) {
//----------------------------------------------------------------------
// Return the number of bytes needed to archive this object in a buffer
-inline int32 Sensor::archiveSize(void) {
- return sizeof(ObjectID) // obj ID
- + sizeof(id)
- + sizeof(range);
-}
-
-void Sensor::write(Common::OutSaveFile *out) {
+void Sensor::write(Common::MemoryWriteStreamDynamic *out) {
// Store the object's ID
out->writeUint16LE(obj->thisID());
@@ -546,14 +518,7 @@ SpecificObjectSensor::SpecificObjectSensor(Common::InSaveFile *in, int16 ctr) :
soughtObjID = in->readUint16LE();
}
-//----------------------------------------------------------------------
-// Return the number of bytes needed to archive this object in a buffer
-
-inline int32 SpecificObjectSensor::archiveSize(void) {
- return ObjectSensor::archiveSize() + sizeof(soughtObjID);
-}
-
-void SpecificObjectSensor::write(Common::OutSaveFile *out) {
+void SpecificObjectSensor::write(Common::MemoryWriteStreamDynamic *out) {
debugC(3, kDebugSaveload, "Saving SpecificObjectSensor");
// Let the base class archive its data
@@ -631,14 +596,7 @@ ObjectPropertySensor::ObjectPropertySensor(Common::InSaveFile *in, int16 ctr) :
objectProperty = in->readSint16LE();;
}
-//----------------------------------------------------------------------
-// Return the number of bytes needed to archive this object in a buffer
-
-inline int32 ObjectPropertySensor::archiveSize(void) {
- return ObjectSensor::archiveSize() + sizeof(objectProperty);
-}
-
-void ObjectPropertySensor::write(Common::OutSaveFile *out) {
+void ObjectPropertySensor::write(Common::MemoryWriteStreamDynamic *out) {
debugC(3, kDebugSaveload, "Saving ObjectPropertySensor");
// Let the base class archive its data
@@ -692,14 +650,7 @@ SpecificActorSensor::SpecificActorSensor(Common::InSaveFile *in, int16 ctr) : Ac
soughtActor = (Actor *)GameObject::objectAddress(actorID);
}
-//----------------------------------------------------------------------
-// Return the number of bytes needed to archive this object in a buffer
-
-inline int32 SpecificActorSensor::archiveSize(void) {
- return ActorSensor::archiveSize() + sizeof(ObjectID);
-}
-
-void SpecificActorSensor::write(Common::OutSaveFile *out) {
+void SpecificActorSensor::write(Common::MemoryWriteStreamDynamic *out) {
debugC(3, kDebugSaveload, "Saving SpecificActorSensor");
// Let the base class archive its data
@@ -766,14 +717,7 @@ ActorPropertySensor::ActorPropertySensor(Common::InSaveFile *in, int16 ctr) : Ac
actorProperty = in->readSint16LE();
}
-//----------------------------------------------------------------------
-// Return the number of bytes needed to archive this object in a buffer
-
-inline int32 ActorPropertySensor::archiveSize(void) {
- return ActorSensor::archiveSize() + sizeof(actorProperty);
-}
-
-void ActorPropertySensor::write(Common::OutSaveFile *out) {
+void ActorPropertySensor::write(Common::MemoryWriteStreamDynamic *out) {
debugC(3, kDebugSaveload, "Saving ActorPropertySensor");
// Let the base class archive its data
@@ -822,11 +766,7 @@ EventSensor::EventSensor(Common::InSaveFile *in, int16 ctr) : Sensor(in, ctr) {
//----------------------------------------------------------------------
// Return the number of bytes needed to archive this object in a buffer
-inline int32 EventSensor::archiveSize(void) {
- return Sensor::archiveSize() + sizeof(eventType);
-}
-
-void EventSensor::write(Common::OutSaveFile *out) {
+void EventSensor::write(Common::MemoryWriteStreamDynamic *out) {
debugC(3, kDebugSaveload, "Saving EventSensor");
// Let the base class archive its data
diff --git a/engines/saga2/sensor.h b/engines/saga2/sensor.h
index 293936b76a..78f1cba75a 100644
--- a/engines/saga2/sensor.h
+++ b/engines/saga2/sensor.h
@@ -79,7 +79,7 @@ void assertEvent(const GameEvent &ev);
// Initialize the sensors
void initSensors(void);
-void saveSensors(Common::OutSaveFile *out);
+void saveSensors(Common::OutSaveFile *outS);
void loadSensors(Common::InSaveFile *in);
// Cleanup the active sensors
void cleanupSensors(void);
@@ -134,7 +134,7 @@ public:
return sizeof(ObjectID);
}
- void write(Common::OutSaveFile *out);
+ void write(Common::MemoryWriteStreamDynamic *out);
GameObject *getObject(void) {
return obj;
@@ -170,11 +170,7 @@ public:
deleteSensor(this);
}
- // Return the number of bytes needed to archive this object in
- // a buffer
- virtual int32 archiveSize(void);
-
- virtual void write(Common::OutSaveFile *out);
+ virtual void write(Common::MemoryWriteStreamDynamic *out);
// Return an integer representing the type of this sensor
virtual int16 getType(void) = 0;
@@ -269,7 +265,7 @@ public:
// a buffer
int32 archiveSize(void);
- void write(Common::OutSaveFile *out);
+ void write(Common::MemoryWriteStreamDynamic *out);
// Return an integer representing the type of this sensor
int16 getType(void);
@@ -306,7 +302,7 @@ public:
// a buffer
int32 archiveSize(void);
- void write(Common::OutSaveFile *out);
+ void write(Common::MemoryWriteStreamDynamic *out);
// Return an integer representing the type of this sensor
int16 getType(void);
@@ -361,7 +357,7 @@ public:
// a buffer
int32 archiveSize(void);
- void write(Common::OutSaveFile *out);
+ void write(Common::MemoryWriteStreamDynamic *out);
// Return an integer representing the type of this sensor
int16 getType(void);
@@ -398,7 +394,7 @@ public:
// a buffer
int32 archiveSize(void);
- void write(Common::OutSaveFile *out);
+ void write(Common::MemoryWriteStreamDynamic *out);
// Return an integer representing the type of this sensor
int16 getType(void);
@@ -429,7 +425,7 @@ public:
// a buffer
int32 archiveSize(void);
- void write(Common::OutSaveFile *out);
+ void write(Common::MemoryWriteStreamDynamic *out);
// Return an integer representing the type of this sensor
int16 getType(void);
Commit: d0beb60d2f9367af334fe6c2738c093d7f42942b
https://github.com/scummvm/scummvm/commit/d0beb60d2f9367af334fe6c2738c093d7f42942b
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-16T00:08:46+09:00
Commit Message:
SAGA2: Make Mission chunk size portable
Changed paths:
engines/saga2/mission.cpp
engines/saga2/mission.h
diff --git a/engines/saga2/mission.cpp b/engines/saga2/mission.cpp
index 8d55e393f8..545d64779f 100644
--- a/engines/saga2/mission.cpp
+++ b/engines/saga2/mission.cpp
@@ -196,7 +196,7 @@ void ActiveMission::read(Common::InSaveFile *in) {
debugC(4, kDebugSaveload, "... numKnowledgeIDs = %d", _data.numKnowledgeIDs);
}
-void ActiveMission::write(Common::OutSaveFile *out) {
+void ActiveMission::write(Common::MemoryWriteStreamDynamic *out) {
out->writeUint16LE(_data.missionID);
out->writeUint16LE(_data.generatorID);
out->writeUint16LE(_data.missionScript);
@@ -265,16 +265,16 @@ void initMissions(void) {
activeMissions[i]._data.missionFlags &= ~inUse;
}
-void saveMissions(Common::OutSaveFile *out) {
+void saveMissions(Common::OutSaveFile *outS) {
debugC(2, kDebugSaveload, "Saving Missions");
- out->write("MISS", 4);
- out->writeUint32LE(ActiveMission::kActiveMissionSize);
-
+ outS->write("MISS", 4);
+ CHUNK_BEGIN;
for (int i = 0; i < ARRAYSIZE(activeMissions); ++i) {
debugC(3, kDebugSaveload, "Saving Mission %d", i);
activeMissions[i].write(out);
}
+ CHUNK_END;
}
void loadMissions(Common::InSaveFile *in) {
diff --git a/engines/saga2/mission.h b/engines/saga2/mission.h
index ea1a2ffa77..09e42b0f21 100644
--- a/engines/saga2/mission.h
+++ b/engines/saga2/mission.h
@@ -74,10 +74,6 @@ class ActiveMission {
public:
- enum {
- kActiveMissionSize = 236
- };
-
ActiveMissionData _data;
public:
@@ -86,7 +82,7 @@ public:
static ActiveMission *missionAddress(int index);
void read(Common::InSaveFile *in);
- void write(Common::OutSaveFile *out);
+ void write(Common::MemoryWriteStreamDynamic *out);
void cleanup(void);
Commit: 668e4bff41dc0609fe43980a6ca51806d7fc5b31
https://github.com/scummvm/scummvm/commit/668e4bff41dc0609fe43980a6ca51806d7fc5b31
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-16T00:08:46+09:00
Commit Message:
SAGA2: Make FactionTallies chunk size portable
Changed paths:
engines/saga2/actor.cpp
engines/saga2/actor.h
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index cecf1b0cec..103b5e8b12 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -3643,16 +3643,16 @@ void initFactionTallies(void) {
memset(&factionTable, 0, sizeof(factionTable));
}
-void saveFactionTallies(Common::OutSaveFile *out) {
+void saveFactionTallies(Common::OutSaveFile *outS) {
debugC(2, kDebugSaveload, "Saving Faction Tallies");
- out->write("FACT", 4);
- out->writeUint32LE(maxFactions * factionNumColumns * sizeof(int16));
-
+ outS->write("FACT", 4);
+ CHUNK_BEGIN;
for (int i = 0; i < maxFactions; ++i) {
for (int j = 0; j < factionNumColumns; ++j)
out->writeSint16LE(factionTable[i][j]);
}
+ CHUNK_END;
}
void loadFactionTallies(Common::InSaveFile *in) {
diff --git a/engines/saga2/actor.h b/engines/saga2/actor.h
index 014cd2a371..1c37cbc30e 100644
--- a/engines/saga2/actor.h
+++ b/engines/saga2/actor.h
@@ -1119,7 +1119,7 @@ int16 AddFactionTally(int faction, enum factionTallyTypes act, int amt);
void initFactionTallies(void);
// Save the faction tallies to a save file
-void saveFactionTallies(Common::OutSaveFile *out);
+void saveFactionTallies(Common::OutSaveFile *outS);
// Load the faction tallies from a save file
void loadFactionTallies(Common::InSaveFile *in);
Commit: 23910f0d950b45711c1de499ffb370a0a30e5a31
https://github.com/scummvm/scummvm/commit/23910f0d950b45711c1de499ffb370a0a30e5a31
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-16T00:08:46+09:00
Commit Message:
SAGA2: Make remaining chunk sizes portable
Changed paths:
engines/saga2/intrface.cpp
engines/saga2/intrface.h
engines/saga2/palette.h
engines/saga2/tile.cpp
engines/saga2/tile.h
engines/saga2/tilemode.h
engines/saga2/vpal.cpp
engines/saga2/vpal.h
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index 8ea5b03648..27fda6ead0 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -2572,15 +2572,6 @@ APPFUNC(cmdManaInd) {
}
}
-struct UIStateArchive {
- bool indivControlsFlag;
- uint16 indivBrother;
-
- enum {
- kUIStateArchiveSize = 3
- };
-};
-
bool isIndivMode(void) {
return indivControlsFlag;
}
@@ -2592,14 +2583,15 @@ void initUIState(void) {
//updateAllUserControls();
}
-void saveUIState(Common::OutSaveFile *out) {
+void saveUIState(Common::OutSaveFile *outS) {
debugC(2, kDebugSaveload, "Saving UIState");
- out->write("UIST", 4);
- out->writeUint32LE(UIStateArchive::kUIStateArchiveSize);
+ outS->write("UIST", 4);
+ CHUNK_BEGIN;
out->writeUint16LE(indivControlsFlag);
out->writeUint16LE(indivBrother);
+ CHUNK_END;
debugC(3, kDebugSaveload, "... indivControlsFlag = %d", indivControlsFlag);
debugC(3, kDebugSaveload, "... indivBrother = %d", indivBrother);
diff --git a/engines/saga2/intrface.h b/engines/saga2/intrface.h
index 5ed9493bc1..d64e96e18c 100644
--- a/engines/saga2/intrface.h
+++ b/engines/saga2/intrface.h
@@ -89,7 +89,7 @@ bool isBrotherDead(PlayerActorID brotherID);
void updateIndicators(void);
void initUIState(void);
-void saveUIState(Common::OutSaveFile *out);
+void saveUIState(Common::OutSaveFile *outS);
void loadUIState(Common::InSaveFile *in);
void cleanupUIState(void);
diff --git a/engines/saga2/palette.h b/engines/saga2/palette.h
index b87afadf7e..7c0d52b997 100644
--- a/engines/saga2/palette.h
+++ b/engines/saga2/palette.h
@@ -76,7 +76,7 @@ void setPaletteToBlack(void);
void initPaletteState(void);
// Save the current state of the current palette and fade up/down in
// a save file.
-void savePaletteState(Common::OutSaveFile *out);
+void savePaletteState(Common::OutSaveFile *outS);
// Load and set the current state of the current palette and fade
// up/down from a save file.
void loadPaletteState(Common::InSaveFile *in);
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 37433a78b1..1ae0df3049 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -1568,7 +1568,7 @@ void initAutoMap(void) {
}
-void saveAutoMap(Common::OutSaveFile *out) {
+void saveAutoMap(Common::OutSaveFile *outS) {
debugC(2, kDebugSaveload, "Saving AutoMap");
int32 totalMapSize = 0,
@@ -1592,8 +1592,7 @@ void saveAutoMap(Common::OutSaveFile *out) {
// for each map metatile slot
archiveBufSize = (totalMapSize + 7) >> 3;
- out->write("AMAP", 4);
- out->writeUint32LE(archiveBufSize);
+ outS->write("AMAP", 4);
archiveBuffer = (uint8 *)calloc(archiveBufSize, 1);
if (archiveBuffer == nullptr)
@@ -1626,7 +1625,9 @@ void saveAutoMap(Common::OutSaveFile *out) {
}
}
+ CHUNK_BEGIN;
out->write(archiveBuffer, archiveBufSize);
+ CHUNK_END;
free(archiveBuffer);
}
diff --git a/engines/saga2/tile.h b/engines/saga2/tile.h
index a42b4c0f54..871d3b5e23 100644
--- a/engines/saga2/tile.h
+++ b/engines/saga2/tile.h
@@ -1015,7 +1015,7 @@ void loadTileCyclingStates(Common::InSaveFile *in);
void cleanupTileCyclingStates(void);
void initAutoMap(void);
-void saveAutoMap(Common::OutSaveFile *out);
+void saveAutoMap(Common::OutSaveFile *outS);
void loadAutoMap(Common::InSaveFile *in, int32 chunkSize);
inline void cleanupAutoMap(void) { /* nothing to do */ }
diff --git a/engines/saga2/tilemode.h b/engines/saga2/tilemode.h
index 15a802695d..2e0c379102 100644
--- a/engines/saga2/tilemode.h
+++ b/engines/saga2/tilemode.h
@@ -45,7 +45,7 @@ void logAggressiveAct(ObjectID attackerID, ObjectID attackeeID);
// Initialize the tile mode state
void initTileModeState(void);
-void saveTileModeState(Common::OutSaveFile *out);
+void saveTileModeState(Common::OutSaveFile *outS);
void loadTileModeState(Common::InSaveFile *in);
// Cleanup the tile mode state
diff --git a/engines/saga2/vpal.cpp b/engines/saga2/vpal.cpp
index a0d7bc0583..4e503fbc2a 100644
--- a/engines/saga2/vpal.cpp
+++ b/engines/saga2/vpal.cpp
@@ -34,6 +34,7 @@
#include "saga2/palette.h"
#include "saga2/display.h"
#include "saga2/hresmgr.h"
+#include "saga2/saveload.h"
namespace Saga2 {
@@ -46,22 +47,6 @@ const uint32 paletteID = MKTAG('P', 'A', 'L', 0);
extern hResContext *tileRes; // tile resource handle
extern volatile int32 gameTime;
-/* ===================================================================== *
- Local struct
- * ===================================================================== */
-
-struct PaletteStateArchive {
- gPalette currentPalette,
- oldPalette,
- destPalette;
- int32 startTime,
- totalTime;
-
- enum {
- kPaletteStateArchiveSize = 2312
- };
-};
-
/* ===================================================================== *
Exports
* ===================================================================== */
@@ -111,7 +96,7 @@ void gPalette::read(Common::InSaveFile *in) {
}
}
-void gPalette::write(Common::OutSaveFile *out) {
+void gPalette::write(Common::MemoryWriteStreamDynamic *out) {
for (int i = 0; i < 256; ++i) {
out->writeByte(entry[i].r);
out->writeByte(entry[i].g);
@@ -337,17 +322,18 @@ void quickRestorePalette(void) {
}
-void savePaletteState(Common::OutSaveFile *out) {
+void savePaletteState(Common::OutSaveFile *outS) {
debugC(2, kDebugSaveload, "Saving Palette States");
- out->write("PALE", 4);
- out->writeUint32LE(PaletteStateArchive::kPaletteStateArchiveSize);
+ outS->write("PALE", 4);
+ CHUNK_BEGIN;
currentPalette.write(out);
oldPalette.write(out);
destPalette.write(out);
out->writeSint32LE(startTime);
out->writeSint32LE(totalTime);
+ CHUNK_END;
debugC(3, kDebugSaveload, "... startTime = %d", startTime);
debugC(3, kDebugSaveload, "... totalTime = %d", totalTime);
diff --git a/engines/saga2/vpal.h b/engines/saga2/vpal.h
index 4190074375..5131fd250b 100644
--- a/engines/saga2/vpal.h
+++ b/engines/saga2/vpal.h
@@ -45,7 +45,7 @@ struct gPalette {
gPaletteEntry entry[256];
void read(Common::InSaveFile *in);
- void write(Common::OutSaveFile *out);
+ void write(Common::MemoryWriteStreamDynamic *out);
};
/* ===================================================================== *
More information about the Scummvm-git-logs
mailing list