public static TriggerConditional Read(BinaryReader br) { var cond = new TriggerConditional { LeftId = br.ReadUInt32(), RightId = br.ReadUInt32(), Type = br.ReadByte() }; br.ReadBytes(3); return(cond); }
public override void Unserialize(BinaryReader br, UInt32 mapVersion) { Name = br.ReadStringOn(65); ReactionType = br.ReadByte(); ActOnActivator = br.ReadBoolean(); ObjectiveIDCheck = br.ReadInt32(); DoForConvoy = br.ReadBoolean(); GenericVar1 = br.ReadSingle(); GenericVar2 = br.ReadSingle(); GenericVar3 = br.ReadSingle(); if (ReactionType == 10) // Reaction Transfer Map { MapTransferType = br.ReadByte(); MapTrasferData = br.ReadUInt32(); } else { var size = br.ReadInt32(); for (var i = 0; i < size; ++i) { Objects.Add(br.ReadUInt32()); } } var numOfItems = br.ReadUInt32(); for (var i = 0; i < numOfItems; ++i) { Reactions.Add(br.ReadUInt32()); } if (ReactionType == 18 && br.ReadByte() != 0) // Reaction Text { ReactionText = new CVOGReactionText(br, mapVersion); } if (mapVersion >= 8) { AllConditionsNeeded = br.ReadBoolean(); var numOfConds = br.ReadUInt32(); for (var i = 0; i < numOfConds; ++i) { TriggerConditionals.Add(TriggerConditional.Read(br)); } DoForAllPlayers = br.ReadBoolean(); } if (mapVersion >= 9) { if (ReactionType == 46 || ReactionType == 47 || ReactionType == 76 || ReactionType == 77) { // ReactionTimerStart / ReactionTimerStop / ReactionPlayMusic / ReactionPath MiscText = br.ReadLengthedString(); } } if (mapVersion >= 10) { if (ReactionType == 35 || ReactionType == 64 || ReactionType == 65) // ReactionAddWaypoint / ReactionSetMapDynamicWaypoint / ReactionSetProgressBar { WaypointType = br.ReadUInt32(); WaypointText = br.ReadLengthedString(); } } if (mapVersion >= 16 && (ReactionType == 37 || mapVersion == 16)) // ReactionGiveMissionDialog { var missionCount = br.ReadUInt32(); for (var i = 0; i < missionCount; ++i) { MissionTypes.Add(br.ReadInt32()); } var missionCount2 = br.ReadUInt32(); for (var i = 0; i < missionCount2; ++i) { Missions.Add(br.ReadInt32()); } } if (mapVersion < 20) { // Unreachable Debug.Assert(false, "Reached unreachable code!"); /*var a = br.ReadUInt32(); * for (var i = 0; i < 0; ++i) * { * var b = br.ReadUInt32(); * } * var c = br.ReadUInt32(); * var d = br.ReadInt32(); * if (d > 0) * br.BaseStream.Seek(d, SeekOrigin.Current);*/ } }
public override void Unserialize(BinaryReader br, UInt32 mapVersion) { Location = Vector4.Read(br); Quaternion = Vector4.Read(br); Radius = br.ReadSingle(); Name = br.ReadStringOn(64); RetriggerDelay = br.ReadSingle(); ActivateDelay = br.ReadSingle(); ActivationCount = br.ReadInt32(); TargetType = br.ReadByte(); DoCollision = br.ReadBoolean(); DoConditionals = br.ReadBoolean(); if (mapVersion >= 44) { ShowMapTransitionDecals = br.ReadBoolean(); } DoOnActivate = br.ReadBoolean(); AllConditionNeeded = br.ReadBoolean(); if (mapVersion >= 60) { ApplyToAllColliders = br.ReadBoolean(); } else { ApplyToAllColliders = DoCollision && RetriggerDelay <= 0.0f; } uint numReac = br.ReadUInt32(); for (int i = 0; i < numReac; ++i) { Reactions.Add(br.ReadUInt32()); } uint numTarget = br.ReadUInt32(); for (int i = 0; i < numTarget; ++i) { Targets.Add(TFID.Read(br)); } uint numConditials = br.ReadUInt32(); for (int i = 0; i < numConditials; ++i) { TriggerConditionals.Add(TriggerConditional.Read(br)); } if (mapVersion >= 9) { Color = br.ReadUInt32(); } if (mapVersion >= 55) { TriggerId = br.ReadUInt32(); } }