Another fix, most serialization is working

- Changed some logic when giving an actor that doesn't have a modeldef a modeldef to make sure it knows it doesn't have one when cleared
- Fixed the serialization for modelData. Only problem now is that I was right about needing to push the models on load
This commit is contained in:
Shiny Metagross 2022-06-30 19:32:10 -07:00 committed by Christoph Oelckers
parent 83a23c6525
commit 5b8789977a
2 changed files with 3 additions and 2 deletions

View file

@ -5055,12 +5055,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeModel)
if (mobj->modelData == nullptr) if (mobj->modelData == nullptr)
{ {
auto ptr = Create<DActorModelData>(); auto ptr = Create<DActorModelData>();
ptr->hasModel = modeldef != NAME_None && !mobj->hasmodel ? 0 : 1; ptr->hasModel = mobj->hasmodel ? 1 : 0;
ptr->modelIDs = *new TArray<int>(); ptr->modelIDs = *new TArray<int>();
ptr->skinIDs = *new TArray<FTextureID>(); ptr->skinIDs = *new TArray<FTextureID>();
ptr->modelDef = NAME_None; ptr->modelDef = NAME_None;
mobj->modelData = ptr; mobj->modelData = ptr;
mobj->hasmodel = mobj->modelData->hasModel; mobj->hasmodel = 1;
GC::WriteBarrier(mobj, ptr); GC::WriteBarrier(mobj, ptr);
} }

View file

@ -173,6 +173,7 @@ IMPLEMENT_POINTERS_START(AActor)
IMPLEMENT_POINTER(Poisoner) IMPLEMENT_POINTER(Poisoner)
IMPLEMENT_POINTER(alternative) IMPLEMENT_POINTER(alternative)
IMPLEMENT_POINTER(ViewPos) IMPLEMENT_POINTER(ViewPos)
IMPLEMENT_POINTER(modelData)
IMPLEMENT_POINTERS_END IMPLEMENT_POINTERS_END
AActor::~AActor () AActor::~AActor ()