Skip to content

Commit

Permalink
serialize animData, update subsector on deserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 committed Nov 12, 2024
1 parent b66eba6 commit 9d72a97
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/common/engine/serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
23 changes: 20 additions & 3 deletions src/playsim/p_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down

0 comments on commit 9d72a97

Please sign in to comment.