mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-03 10:41:24 +00:00
Backend update from GZDoom.
This commit is contained in:
parent
a9dc57e99f
commit
6c702847ff
31 changed files with 1239 additions and 63 deletions
|
@ -1656,6 +1656,84 @@ FSerializer &Serialize(FSerializer &arc, const char *key, NumericValue &value, N
|
|||
return arc;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PFunctionPointer
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void SerializeFunctionPointer(FSerializer &arc, const char *key, FunctionPointerValue *&p)
|
||||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if(p)
|
||||
{
|
||||
arc.BeginObject(key);
|
||||
arc("Class",p->ClassName);
|
||||
arc("Function",p->FunctionName);
|
||||
arc.EndObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
arc.WriteKey(key);
|
||||
arc.w->Null();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(p);
|
||||
auto v = arc.r->FindKey(key);
|
||||
if(!v || v->IsNull())
|
||||
{
|
||||
p = nullptr;
|
||||
}
|
||||
else if(v->IsObject())
|
||||
{
|
||||
arc.r->mObjects.Push(FJSONObject(v)); // BeginObject
|
||||
|
||||
const char * cstr;
|
||||
arc.StringPtr("Class", cstr);
|
||||
|
||||
if(!cstr)
|
||||
{
|
||||
arc.StringPtr("Function", cstr);
|
||||
if(!cstr)
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "Function Pointer missing Class and Function Fields in Object\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "Function Pointer missing Class Field in Object\n");
|
||||
}
|
||||
arc.mErrors++;
|
||||
arc.EndObject();
|
||||
p = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
p->ClassName = FString(cstr);
|
||||
arc.StringPtr("Function", cstr);
|
||||
|
||||
if(!cstr)
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "Function Pointer missing Function Field in Object\n");
|
||||
arc.mErrors++;
|
||||
arc.EndObject();
|
||||
p = nullptr;
|
||||
return;
|
||||
}
|
||||
p->FunctionName = FString(cstr);
|
||||
arc.EndObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "Function Pointer is not an Object\n");
|
||||
arc.mErrors++;
|
||||
p = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "renderstyle.h"
|
||||
FSerializer& Serialize(FSerializer& arc, const char* key, FRenderStyle& style, FRenderStyle* def)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue