Implemented loading/saving of line/sector health and health groups in savegames

This commit is contained in:
ZZYZX 2018-10-31 22:40:08 +02:00 committed by Christoph Oelckers
commit a6cdcab128
5 changed files with 71 additions and 1 deletions

View file

@ -56,6 +56,7 @@
#include "serializer.h"
#include "g_levellocals.h"
#include "events.h"
#include "p_destructible.h"
//==========================================================================
//
@ -74,6 +75,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, line_t &line, line_t *
.Args("args", line.args, def->args, line.special)
("portalindex", line.portalindex, def->portalindex)
("locknumber", line.locknumber, def->locknumber)
("health", line.health, def->health)
// Unless the map loader is changed the sidedef references will not change between map loads so there's no need to save them.
//.Array("sides", line.sidedef, 2)
.EndObject();
@ -293,6 +295,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
.Terrain("floorterrain", p.terrainnum[0], &def->terrainnum[0])
.Terrain("ceilingterrain", p.terrainnum[1], &def->terrainnum[1])
("scrolls", scroll, nul)
("healthfloor", p.healthfloor, def->healthfloor)
("healthceiling", p.healthceiling, def->healthceiling)
// GZDoom exclusive:
.Array("reflect", p.reflect, def->reflect, 2, true)
.EndObject();
@ -991,6 +995,8 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
arc("sectorportals", level.sectorPortals);
if (arc.isReading()) P_FinalizePortals();
// [ZZ] serialize health groups
P_SerializeHealthGroups(arc);
// [ZZ] serialize events
E_SerializeEvents(arc);
DThinker::SerializeThinkers(arc, hubload);