Skip to content

Commit 5d98dbc

Browse files
committed
Update NetworkStateChanged_t
1 parent 3ac724c commit 5d98dbc

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

public/entity2/entitynetwork.h

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class CEntityInstancePolymorphicMetadataHelper;
1919

2020
struct NetworkStateChanged_t
2121
{
22-
NetworkStateChanged_t() : m_Unk00(1), m_Unk48(-1), m_nArrayIndex(-1), m_nPathIndex(ChangeAccessorFieldPathIndex_t()), m_Unk60(0) { }
23-
explicit NetworkStateChanged_t( bool bFullChanged ) : m_Unk00(static_cast<uint32>(!bFullChanged)), m_Unk48(-1), m_nArrayIndex(-1), m_nPathIndex(ChangeAccessorFieldPathIndex_t()), m_Unk60(0) { }
22+
NetworkStateChanged_t() : m_nChangeType(1), m_Unk48(-1), m_nArrayIndex(-1), m_nPathIndex(ChangeAccessorFieldPathIndex_t()), m_bChainedPath(0) { }
23+
explicit NetworkStateChanged_t( bool bFullChanged ) : m_nChangeType(static_cast<uint32>(!bFullChanged)), m_Unk48(-1), m_nArrayIndex(-1), m_nPathIndex(ChangeAccessorFieldPathIndex_t()), m_bChainedPath(0) { }
2424

2525
// nLocalOffset is the flattened field offset
2626
// calculated taking into account embedded structures
@@ -30,18 +30,28 @@ struct NetworkStateChanged_t
3030
// nPathIndex is the value to specify
3131
// if the path to the field goes through one or more pointers, otherwise pass -1
3232
// this value is usually a member of the CNetworkVarChainer and belongs to the last object in the chain
33-
NetworkStateChanged_t( uint32 nLocalOffset, int32 nArrayIndex = -1, ChangeAccessorFieldPathIndex_t nPathIndex = ChangeAccessorFieldPathIndex_t() ) : m_Unk00(1), m_LocalOffsets{ nLocalOffset }, m_Unk48(-1), m_nArrayIndex(nArrayIndex), m_nPathIndex(nPathIndex), m_Unk60(0) { }
34-
NetworkStateChanged_t( CUtlVector<uint32> vecLocalOffsets, int32 nArrayIndex = -1, ChangeAccessorFieldPathIndex_t nPathIndex = ChangeAccessorFieldPathIndex_t() ) : m_Unk00(1), m_LocalOffsets(Move(vecLocalOffsets)), m_Unk48(-1), m_nArrayIndex(nArrayIndex), m_nPathIndex(nPathIndex), m_Unk60(1) { }
33+
NetworkStateChanged_t( uint32 nLocalOffset, int32 nArrayIndex = -1, ChangeAccessorFieldPathIndex_t nPathIndex = ChangeAccessorFieldPathIndex_t() )
34+
: m_nChangeType(1), m_LocalOffsets{ nLocalOffset }, m_Unk48(-1), m_nArrayIndex(nArrayIndex), m_nPathIndex(nPathIndex), m_bChainedPath(0) { }
35+
NetworkStateChanged_t( CUtlVector<uint32> vecLocalOffsets, int32 nArrayIndex = -1, ChangeAccessorFieldPathIndex_t nPathIndex = ChangeAccessorFieldPathIndex_t() )
36+
: m_nChangeType(1), m_LocalOffsets(Move(vecLocalOffsets)), m_Unk48(-1), m_nArrayIndex(nArrayIndex), m_nPathIndex(nPathIndex), m_bChainedPath(1) { }
3537

36-
uint32 m_Unk00; // Perhaps it is an enum, default 1, when 0 adds FL_FULL_EDICT_CHANGED
37-
CUtlVector<uint32> m_LocalOffsets;
38-
// Probably only works in the debug build, as it has always been empty
38+
uint32 m_nChangeType; // 1 = field change (default), 0 = full entity dirty (FL_FULL_EDICT_CHANGED)
39+
CUtlVector<uint32> m_LocalOffsets; // Local byte offsets of changed field(s) within the entity/embedded struct.
40+
41+
// Debug-only strings (always empty in release builds).
3942
CUtlString m_ClassName;
4043
CUtlString m_FieldName;
41-
int32 m_Unk48; // default -1
42-
int32 m_nArrayIndex; // default -1
43-
ChangeAccessorFieldPathIndex_t m_nPathIndex; // default -1 (can also be -2)
44-
int16 m_Unk60; // default 0, if m_LocalOffsets has multiple values, it is set to 1
44+
45+
int32 m_Unk48;
46+
int32 m_nArrayIndex; // Index into array element if the field is a CNetworkUtlVectorBase, otherwise -1.
47+
48+
// Path index through pointer chain (from CNetworkVarChainer::m_PathIndex), -1 if direct.
49+
// CNetworkVarChainer::NetworkStateChanged overwrites this with its own m_PathIndex.
50+
ChangeAccessorFieldPathIndex_t m_nPathIndex;
51+
52+
// 0 = single offset, 1 = m_LocalOffsets has multiple values (chained/nested path).
53+
// Checked as bool: if true AND m_nPathIndex < 0, the notification is suppressed.
54+
int16 m_bChainedPath;
4555
};
4656
COMPILE_TIME_ASSERT( sizeof( NetworkStateChanged_t ) == 64 );
4757

0 commit comments

Comments
 (0)