Export DecalBase
Allows setting this between Actors with type safety. Now also serializes these fields.
This commit is contained in:
parent
4acc5f2a7d
commit
b6b3c311e1
8 changed files with 61 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue