- fixed incomplete hudmessage serialization.

- fixed a few errors in the ACS module serializer.
- reordered a few things to how they were in the old code.
- optimized serialization of the level.Scrolls array to happen within the sector. This is to allow skipping 0-entries which normally constitute the vast majority of them.
This commit is contained in:
Christoph Oelckers 2016-09-20 13:21:41 +02:00
commit f3e8c7c241
6 changed files with 100 additions and 68 deletions

View file

@ -29,6 +29,7 @@
#include "r_data/r_interpolate.h"
#include "g_shared/a_sharedglobal.h"
#include "po_man.h"
#include "v_font.h"
char nulspace[1024 * 1024 * 4];
@ -211,6 +212,7 @@ void FSerializer::WriteKey(const char *key)
{
if (isWriting() && w->inObject())
{
assert(key != nullptr);
if (key == nullptr)
{
I_Error("missing element name");
@ -426,7 +428,6 @@ FSerializer &FSerializer::ScriptNum(const char *key, int &num)
{
w->mWriter.Int(num);
}
w->mWriter.EndArray();
}
else
{
@ -1434,4 +1435,33 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, char *&pstr
}
}
return arc;
}
}
//==========================================================================
//
//
//
//==========================================================================
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FFont *&font, FFont **def)
{
if (arc.isWriting())
{
const char *n = font->GetName();
return arc.StringPtr(key, n);
}
else
{
const char *n;
arc.StringPtr(key, n);
font = V_GetFont(n);
if (font == NULL)
{
Printf("Could not load font %s\n", n);
font = SmallFont;
}
return arc;
}
}