diff --git a/source/exhumed/src/items.cpp b/source/exhumed/src/items.cpp index 39b80dbb5..528a34ecb 100644 --- a/source/exhumed/src/items.cpp +++ b/source/exhumed/src/items.cpp @@ -109,12 +109,16 @@ short nRegenerates; short nFirstRegenerate; short nMagicCount; -static SavegameHelper sghitems("items", - SV(nRegenerates), - SV(nFirstRegenerate), - SV(nMagicCount), - nullptr); - +void SerializeItems(FSerializer& arc) +{ + if (arc.BeginObject("items")) + { + arc("regenerates", nRegenerates) + ("first", nFirstRegenerate) + ("magiccount", nMagicCount) + .EndObject(); + } +} void BuildItemAnim(short nSprite) { diff --git a/source/exhumed/src/move.cpp b/source/exhumed/src/move.cpp index e1b3a9eef..f41522ce3 100644 --- a/source/exhumed/src/move.cpp +++ b/source/exhumed/src/move.cpp @@ -53,21 +53,38 @@ BlockInfo sBlockInfo[kMaxPushBlocks]; short nChunkSprite[kMaxMoveChunks]; +FSerializer& Serialize(FSerializer& arc, const char* keyname, BlockInfo& w, BlockInfo* def) +{ + if (arc.BeginObject(keyname)) + { + arc("at8", w.field_8) + ("sprite", w.nSprite) + ("x", w.x) + ("y", w.y) + .EndObject(); + } + return arc; +} -static SavegameHelper sghmove("move", - SV(nPushBlocks), - SV(overridesect), - SV(NearCount), - SV(hihit), - SV(sprceiling), - SV(sprfloor), - SV(lohit), - SA(nBodySprite), - SA(NearSector), - SA(sBlockInfo), - SA(nChunkSprite), - nullptr); - +void SerializeMove(FSerializer& arc) +{ + if (arc.BeginObject("move")) + { + arc("nearcount", NearCount) + .Array("nearsector", NearSector, NearCount) + ("pushcount", nPushBlocks) + .Array("blocks", sBlockInfo, nPushBlocks) + ("chunkcount", nCurChunkNum) + .Array("chunks", nChunkSprite, kMaxMoveChunks) + ("overridesect", overridesect) + ("hihit", hihit) + ("lohit", lohit) + ("sprceiling", sprceiling) + ("sprfloor", sprfloor) + .Array("bodysprite", nBodySprite, 50) + .EndObject(); + } +} signed int lsqrt(int a1) { diff --git a/source/exhumed/src/save.cpp b/source/exhumed/src/save.cpp index 05721704a..7a14c3778 100644 --- a/source/exhumed/src/save.cpp +++ b/source/exhumed/src/save.cpp @@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS void SerializeAnim(FSerializer& arc); +void SerializeItems(FSerializer& arc); +void SerializeMove(FSerializer& arc); void SerializeObjects(FSerializer& arc); void SerializePlayer(FSerializer& arc); void SerializeRa(FSerializer& arc); @@ -71,6 +73,8 @@ void GameInterface::SerializeGameState(FSerializer& arc) if (arc.BeginObject("exhumed")) { SerializeAnim(arc); + SerializeItems(arc); + SerializeMove(arc); SerializeObjects(arc); SerializePlayer(arc); SerializeRa(arc);