/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/c10022aa46e208b1593dd537c2607784aac158f1/Engine/Source/Runtime/Engine/Private/Collision/Collision.cpp#L42 /// </summary> /// <param name="reader"></param> public void Serialize(NetBitReader reader) { // pack bitfield with flags // Most of the time the vectors are the same values, use that as an optimization BlockingHit = reader.ReadBit(); StartPenetrating = reader.ReadBit(); var bImpactPointEqualsLocation = reader.ReadBit(); var bImpactNormalEqualsNormal = reader.ReadBit(); // Often times the indexes are invalid, use that as an optimization var bInvalidItem = reader.ReadBit(); var bInvalidFaceIndex = reader.ReadBit(); var bNoPenetrationDepth = reader.ReadBit(); var bInvalidElementIndex = reader.EngineNetworkVersion >= EngineNetworkVersionHistory.HISTORY_ENUM_SERIALIZATION_COMPAT && reader.ReadBit(); Time = reader.ReadSingle(); Location = reader.ReadPackedVector(1, 20); Normal = reader.SerializePropertyVectorNormal(); ImpactPoint = !bImpactPointEqualsLocation?reader.ReadPackedVector(1, 20) : Location; ImpactNormal = !bImpactNormalEqualsNormal?reader.SerializePropertyVectorNormal() : Normal; TraceStart = reader.ReadPackedVector(1, 20); TraceEnd = reader.ReadPackedVector(1, 20); PenetrationDepth = !bNoPenetrationDepth?reader.SerializePropertyFloat() : 0.0f; Distance = (ImpactPoint - TraceStart).Size(); Item = !bInvalidItem?reader.ReadInt32() : 0; PhysMaterial = reader.SerializePropertyObject(); if (reader.EngineNetworkVersion < EngineNetworkVersionHistory.HISTORY_HITRESULT_INSTANCEHANDLE) { Actor = reader.SerializePropertyObject(); } else { Actor = reader.SerializePropertyObject(); // see https://github.com/EpicGames/UnrealEngine/blob/4564529ed77196caada6971f5de1be829900b9e1/Engine/Source/Runtime/Engine/Private/EngineTypes.cpp#L558 //Ar << Handle.Actor; //Ar << Handle.Manager; //Ar << Handle.InstanceIndex; } Component = reader.SerializePropertyObject(); BoneName = reader.SerializePropertyName(); FaceIndex = !bInvalidFaceIndex?reader.ReadInt32() : 0; ElementIndex = !bInvalidElementIndex && reader.EngineNetworkVersion >= EngineNetworkVersionHistory.HISTORY_ENUM_SERIALIZATION_COMPAT ? reader.ReadByte() : new byte(); }
public void Serialize(NetBitReader reader) { var isHardcoded = reader.ReadBoolean(); if (isHardcoded) { uint nameIndex; if (reader.EngineNetworkVersion < EngineNetworkVersionHistory.HISTORY_CHANNEL_NAMES) { nameIndex = reader.ReadUInt32(); } else { nameIndex = reader.ReadIntPacked(); } Value = ((UnrealNames)nameIndex).ToString(); return; } var inString = reader.ReadFString(); var inNumber = reader.ReadInt32(); Value = inString; }
/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/6c20d9831a968ad3cb156442bebb41a883e62152/Engine/Source/Runtime/Core/Private/Internationalization/Text.cpp#L794 /// </summary> /// <param name="reader"></param> public void Serialize(NetBitReader reader) { var flags = reader.ReadInt32(); var historyType = reader.ReadByteAsEnum <ETextHistoryType>(); switch (historyType) { case ETextHistoryType.Base: Namespace = reader.ReadFString(); Key = reader.ReadFString(); Text = reader.ReadFString(); break; } }
public void Serialize(NetBitReader reader) { int flags = reader.ReadInt32(); ETextHistoryType historyType = reader.ReadByteAsEnum <ETextHistoryType>(); switch (historyType) { case ETextHistoryType.Base: Namespace = reader.ReadFString(); Key = reader.ReadFString(); Text = reader.ReadFString(); break; default: //Need to add other formats as they're encountered break; } }
/* * private FRepMovement AsRepMovement() * { * _reader.Reset(); * * FRepMovement repMovement = _reader.SerializeRepMovement(); * * if(_reader.IsError || !_reader.AtEnd()) * { * return null; * } * * return repMovement; * } */ private string AsStaticName() { _reader.Reset(); var isHardcoded = _reader.ReadBoolean(); if (isHardcoded) { uint nameIndex; if (_reader.EngineNetworkVersion < EngineNetworkVersionHistory.HISTORY_CHANNEL_NAMES) { nameIndex = _reader.ReadUInt32(); } else { nameIndex = _reader.ReadIntPacked(); } if (_reader.IsError || !_reader.AtEnd()) { return(null); } return(((UnrealNames)nameIndex).ToString()); } var inString = _reader.ReadFString(); var inNumber = _reader.ReadInt32(); if (_reader.IsError || !_reader.AtEnd()) { return(null); } return(inString); }
public void Serialize(NetBitReader reader) { int length = reader.ReadInt32(); EncryptedReplayData = reader.ReadBytes(length); }
/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/c10022aa46e208b1593dd537c2607784aac158f1/Engine/Source/Runtime/Engine/Private/Collision/Collision.cpp#L42 /// </summary> /// <param name="reader"></param> public void Serialize(NetBitReader reader) { // pack bitfield with flags var flags = reader.ReadBits(7); // Most of the time the vectors are the same values, use that as an optimization BlockingHit = flags[0]; StartPenetrating = flags[1]; bool bImpactPointEqualsLocation = flags[2]; bool bImpactNormalEqualsNormal = flags[3]; // Often times the indexes are invalid, use that as an optimization bool bInvalidItem = flags[4]; bool bInvalidFaceIndex = flags[5]; bool bNoPenetrationDepth = flags[6]; Time = reader.ReadSingle(); Location = reader.ReadPackedVector(1, 20); Normal = reader.SerializePropertyVectorNormal(); if (!bImpactPointEqualsLocation) { ImpactPoint = reader.ReadPackedVector(1, 20); } else { ImpactPoint = Location; } if (!bImpactNormalEqualsNormal) { ImpactNormal = reader.SerializePropertyVectorNormal(); } else { ImpactNormal = Normal; } TraceStart = reader.ReadPackedVector(1, 20); TraceEnd = reader.ReadPackedVector(1, 20); if (!bNoPenetrationDepth) { PenetrationDepth = reader.SerializePropertyFloat(); } else { PenetrationDepth = 0.0f; } Distance = (ImpactPoint - TraceStart).Size(); if (!bInvalidItem) { Item = reader.ReadInt32(); } else { Item = 0; } PhysMaterial = reader.SerializePropertyObject(); Actor = reader.SerializePropertyObject(); Component = reader.SerializePropertyObject(); BoneName = reader.SerializePropertyName(); if (!bInvalidFaceIndex) { FaceIndex = reader.ReadInt32(); } else { FaceIndex = 0; } }