From 5b8789977a3c833cdf00ad3158c9b6d387918883 Mon Sep 17 00:00:00 2001 From: Shiny Metagross <30511800+ShinyMetagross@users.noreply.github.com> Date: Thu, 30 Jun 2022 19:32:10 -0700 Subject: [PATCH] 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 --- src/playsim/p_actionfunctions.cpp | 4 ++-- src/playsim/p_mobj.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 6d9dc0d107..ecd761fc43 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -5055,12 +5055,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeModel) if (mobj->modelData == nullptr) { auto ptr = Create(); - ptr->hasModel = modeldef != NAME_None && !mobj->hasmodel ? 0 : 1; + ptr->hasModel = mobj->hasmodel ? 1 : 0; ptr->modelIDs = *new TArray(); ptr->skinIDs = *new TArray(); ptr->modelDef = NAME_None; mobj->modelData = ptr; - mobj->hasmodel = mobj->modelData->hasModel; + mobj->hasmodel = 1; GC::WriteBarrier(mobj, ptr); } diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 6315421d64..1107608138 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -173,6 +173,7 @@ IMPLEMENT_POINTERS_START(AActor) IMPLEMENT_POINTER(Poisoner) IMPLEMENT_POINTER(alternative) IMPLEMENT_POINTER(ViewPos) + IMPLEMENT_POINTER(modelData) IMPLEMENT_POINTERS_END AActor::~AActor ()