From 9d72a97fd88e437194aae2368042fe23aa89111e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Tue, 12 Nov 2024 16:57:04 -0300 Subject: [PATCH] serialize animData, update subsector on deserialize --- src/common/engine/serializer.h | 3 ++- src/playsim/p_effect.cpp | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/common/engine/serializer.h b/src/common/engine/serializer.h index 40b6ab7062a..902d4226c73 100644 --- a/src/common/engine/serializer.h +++ b/src/common/engine/serializer.h @@ -252,7 +252,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, struct ModelOverride & FSerializer &Serialize(FSerializer &arc, const char *key, struct AnimModelOverride &mo, struct AnimModelOverride *def); FSerializer &Serialize(FSerializer &arc, const char *key, ModelAnim &ao, ModelAnim *def); FSerializer &Serialize(FSerializer &arc, const char *key, ModelAnimFrame &ao, ModelAnimFrame *def); -FSerializer& Serialize(FSerializer& arc, const char* key, FTranslationID& value, FTranslationID* defval); +FSerializer &Serialize(FSerializer& arc, const char* key, FTranslationID& value, FTranslationID* defval); +FSerializer &Serialize(FSerializer& arc, const char* key, struct FStandaloneAnimation& value, struct FStandaloneAnimation* defval); void SerializeFunctionPointer(FSerializer &arc, const char *key, FunctionPointerValue *&p); diff --git a/src/playsim/p_effect.cpp b/src/playsim/p_effect.cpp index 5abf899eb26..c48cafb8550 100644 --- a/src/playsim/p_effect.cpp +++ b/src/playsim/p_effect.cpp @@ -1254,12 +1254,24 @@ float DVisualThinker::GetOffset(bool y) const // Needed for the renderer. return (float)((flags & VTF_FlipOffsetX) ? Offset.X : -Offset.X); } + +FSerializer& Serialize(FSerializer& arc, const char* key, FStandaloneAnimation& value, FStandaloneAnimation* defval) +{ + arc.BeginObject(key); + arc("SwitchTic", value.SwitchTic); + arc("AnimIndex", value.AnimIndex); + arc("CurFrame", value.CurFrame); + arc("Ok", value.ok); + arc("AnimType", value.AnimType); + arc.EndObject(); + return arc; +} + void DVisualThinker::Serialize(FSerializer& arc) { Super::Serialize(arc); - arc - ("pos", PT.Pos) + arc ("pos", PT.Pos) ("vel", PT.Vel) ("prev", Prev) ("scale", Scale) @@ -1273,9 +1285,14 @@ void DVisualThinker::Serialize(FSerializer& arc) ("cursector", cursector) ("scolor", PT.color) ("lightlevel", LightLevel) + ("animData", PT.animData) ("flags", PT.flags) ("visualThinkerFlags", flags); - + + if(arc.isReading()) + { + UpdateSector(); + } } IMPLEMENT_CLASS(DVisualThinker, false, false);