Fix A_ChangeModel serialization
I overlooked this part on my first A_ChangeModel fix
This commit is contained in:
parent
631eb5847b
commit
ce479e09ff
10 changed files with 95 additions and 76 deletions
|
|
@ -101,6 +101,7 @@
|
|||
#include "fragglescript/t_fs.h"
|
||||
#include "shadowinlines.h"
|
||||
#include "d_net.h"
|
||||
#include "model.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
@ -1387,18 +1388,57 @@ bool AActor::Massacre ()
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void SerializeModelID(FSerializer &arc, const char *key, int &id)
|
||||
{ // TODO: make it a proper serializable type (FModelID) instead of an int
|
||||
if(arc.isWriting())
|
||||
{
|
||||
if(id >= 0)
|
||||
{
|
||||
arc(key, Models[id]->mFilePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(arc.HasKey(key))
|
||||
{
|
||||
std::pair<FString, FString> modelFile;
|
||||
arc(key, modelFile);
|
||||
|
||||
id = FindModel(modelFile.first.GetChars(), modelFile.second.GetChars(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, ModelOverride &mo, ModelOverride *def)
|
||||
{
|
||||
arc.BeginObject(key);
|
||||
arc("modelID", mo.modelID);
|
||||
SerializeModelID(arc, "model", mo.modelID);
|
||||
arc("surfaceSkinIDs", mo.surfaceSkinIDs);
|
||||
arc.EndObject();
|
||||
return arc;
|
||||
}
|
||||
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, AnimModelOverride &amo, AnimModelOverride *def)
|
||||
{
|
||||
int ok = arc.BeginObject(key);
|
||||
if(arc.isReading() && !ok)
|
||||
{
|
||||
amo.id = -1;
|
||||
}
|
||||
else if(ok)
|
||||
{
|
||||
SerializeModelID(arc, "model", amo.id);
|
||||
arc.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, struct AnimOverride &ao, struct AnimOverride *def)
|
||||
{
|
||||
//TODO
|
||||
arc.BeginObject(key);
|
||||
arc("firstFrame", ao.firstFrame);
|
||||
arc("lastFrame", ao.lastFrame);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue