Export DecalBase

Allows setting this between Actors with type safety. Now also serializes these fields.
This commit is contained in:
Boondorl 2025-07-27 17:56:44 -04:00 committed by Ricardo Luís Vaz Silva
commit b6b3c311e1
8 changed files with 61 additions and 2 deletions

View file

@ -52,6 +52,7 @@
#include "g_levellocals.h"
#include "p_conversation.h"
#include "p_terrain.h"
#include "decallib.h"
#include "serializer_internal.h"
@ -449,6 +450,34 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FState *&state, FState
}
template<> FSerializer& Serialize(FSerializer& arc, const char* key, FDecalBase*& decal, FDecalBase** def)
{
if (arc.isWriting())
{
if (!arc.w->inObject() || def == nullptr || decal != *def)
{
arc.WriteKey(key);
if (decal == nullptr)
arc.w->Null();
else
arc.w->String(decal->GetDecalName().GetChars());
}
}
else
{
auto d = arc.r->FindKey(key);
if (d != nullptr)
{
if (!d->IsString())
decal = nullptr;
else
decal = DecalLibrary.GetDecalBaseByName(d->GetString());
}
}
return arc;
}
//==========================================================================
//
//