- extended walltype to directly manage Blood's XWALL.

Unfortunately this had to be done in the base class so that we can still maintain the walls in a global array.
The tradeoffs of better abstractions would be far too costly here than the added 16 bytes to the wall struct.
This commit is contained in:
Christoph Oelckers 2021-11-20 17:01:59 +01:00
parent 6217623c24
commit 94a37dfcdc
11 changed files with 301 additions and 262 deletions

View file

@ -60,6 +60,8 @@
#include "hw_sections.h"
#include "sectorgeometry.h"
#include "d_net.h"
#include "ns.h"
#include "games/blood/src/mapstructs.h"
#include <zlib.h>
@ -75,7 +77,13 @@ int SaveVersion;
void SerializeMap(FSerializer &arc);
FixedBitArray<MAXSPRITES> activeSprites;
CVAR(String, cl_savedir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(String, cl_savedir, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
BEGIN_BLD_NS
FSerializer& Serialize(FSerializer& arc, const char* keyname, XWALL& w, XWALL* def);
END_BLD_NS
//=============================================================================
//
@ -555,8 +563,30 @@ FSerializer &Serialize(FSerializer &arc, const char *key, walltype &c, walltype
("hitag", c.hitag, def->hitag)
("extra", c.extra, def->extra)
("portalflags", c.portalflags, def->portalflags)
("portalnum", c.portalnum, def->portalnum)
.EndObject();
("portalnum", c.portalnum, def->portalnum);
// Save the blood-specific extensions only when playing Blood
if (isBlood())
{
arc("wallbase", c.baseWall, def->baseWall);
if (arc.isWriting())
{
if (c.hasX())
{
BLD_NS::Serialize(arc, "xwall", *c._xw, nullptr);
}
}
else
{
if (arc.HasObject("xwall"))
{
c.allocX();
BLD_NS::Serialize(arc, "xwall", *c._xw, nullptr);
}
}
}
arc.EndObject();
}
return arc;
}