From abf0206706a7ed5ad47a8428c9689427704a34e1 Mon Sep 17 00:00:00 2001 From: Boondorl Date: Thu, 14 Nov 2024 22:27:08 -0500 Subject: [PATCH] Fixes for serializing and initializing Fixed missing DViewPosition serializing. Fixed missing initializers in player_t. --- src/playsim/actor.h | 8 ++------ src/playsim/d_player.h | 14 +++++++------- src/playsim/p_mobj.cpp | 7 +++++++ src/playsim/p_user.cpp | 1 + 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index f516b79f1e..586ec377c8 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -756,12 +756,6 @@ public: int Flags; // Functions - DViewPosition() - { - Offset = { 0,0,0 }; - Flags = 0; - } - void Set(DVector3 &off, int f = -1) { ZeroSubnormalsF(off.X); @@ -777,6 +771,8 @@ public: { return Offset.isZero(); } + + void Serialize(FSerializer& arc) override; }; const double MinVel = EQUAL_EPSILON; diff --git a/src/playsim/d_player.h b/src/playsim/d_player.h index 2a2fd33346..47c339e426 100644 --- a/src/playsim/d_player.h +++ b/src/playsim/d_player.h @@ -322,8 +322,8 @@ public: AActor *mo = nullptr; uint8_t playerstate = 0; ticcmd_t cmd = {}; - usercmd_t original_cmd; - uint32_t original_oldbuttons; + usercmd_t original_cmd = {}; + uint32_t original_oldbuttons = 0; userinfo_t userinfo; // [RH] who is this? @@ -340,7 +340,7 @@ public: // mo->velx and mo->vely represent true velocity experienced by player. // This only represents the thrust that the player applies himself. // This avoids anomalies with such things as Boom ice and conveyors. - DVector2 Vel = { 0,0 }; + DVector2 Vel; bool centering = false; uint8_t turnticks = 0; @@ -419,10 +419,10 @@ public: FString SoundClass; FString LogText; // [RH] Log for Strife FString SubtitleText; - int SubtitleCounter; + int SubtitleCounter = 0; - DAngle MinPitch = nullAngle; // Viewpitch limits (negative is up, positive is down) - DAngle MaxPitch = nullAngle; + DAngle MinPitch; // Viewpitch limits (negative is up, positive is down) + DAngle MaxPitch; double crouchfactor = 0; double crouchoffset = 0; @@ -432,7 +432,7 @@ public: // [CW] I moved these here for multiplayer conversation support. TObjPtr ConversationNPC = MakeObjPtr(nullptr), ConversationPC = MakeObjPtr(nullptr); - DAngle ConversationNPCAngle = nullAngle; + DAngle ConversationNPCAngle; bool ConversationFaceTalker = false; DVector3 LastSafePos = {}; // Mark the last known safe location the player was standing. diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index ad95f8ac65..2ef17b2a90 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -1545,6 +1545,13 @@ void DActorModelData::OnDestroy() animationIDs.Reset(); } +void DViewPosition::Serialize(FSerializer& arc) +{ + Super::Serialize(arc); + arc("offset", Offset) + ("flags", Flags); +} + //---------------------------------------------------------------------------- // // PROC P_ExplodeMissile diff --git a/src/playsim/p_user.cpp b/src/playsim/p_user.cpp index 652d533ca2..9342597975 100644 --- a/src/playsim/p_user.cpp +++ b/src/playsim/p_user.cpp @@ -1788,6 +1788,7 @@ void player_t::Serialize(FSerializer &arc) ("musinfoactor", MUSINFOactor) ("musinfotics", MUSINFOtics) ("soundclass", SoundClass) + ("angleoffsettargets", angleOffsetTargets); ("lastsafepos", LastSafePos); if (arc.isWriting ())