public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); var roomN = reader.ReadInt32(); Rooms = new VMRoomPortal[roomN]; for (int i = 0; i < roomN; i++) { Rooms[i] = new VMRoomPortal(reader); } if (reader.ReadBoolean()) { CurrentPortal = new VMRoomPortal(reader); } var wtLen = reader.ReadInt32(); if (wtLen > -1) { WalkTo = new Point[wtLen]; for (int i = 0; i < wtLen; i++) { WalkTo[i] = new Point(reader.ReadInt32(), reader.ReadInt32()); } } WalkDirection = reader.ReadDouble(); TargetDirection = reader.ReadDouble(); IgnoreRooms = reader.ReadBoolean(); State = (VMRoutingFrameState)reader.ReadByte(); PortalTurns = reader.ReadInt32(); WaitTime = reader.ReadInt32(); Timeout = reader.ReadInt32(); Retries = reader.ReadInt32(); AttemptedChair = reader.ReadBoolean(); TurnTweak = reader.ReadSingle(); TurnFrames = reader.ReadInt32(); MoveTotalFrames = reader.ReadInt32(); MoveFrames = reader.ReadInt32(); Velocity = reader.ReadInt32(); CallFailureTrees = reader.ReadBoolean(); var igrN = reader.ReadInt32(); IgnoredRooms = new VMRoomPortal[igrN]; for (int i = 0; i < igrN; i++) { IgnoredRooms[i] = new VMRoomPortal(reader); } var avaN = reader.ReadInt32(); AvatarsToConsider = new short[avaN]; for (int i = 0; i < avaN; i++) { AvatarsToConsider[i] = reader.ReadInt16(); } PreviousPosition.Deserialize(reader); CurrentWaypoint.Deserialize(reader); RoomRouteInvalid = reader.ReadBoolean(); if (reader.ReadBoolean()) { Slot = SLOTItemSerializer.Deserialize(reader); } Target = reader.ReadInt16(); var chLen = reader.ReadInt32(); if (chLen > -1) { Choices = new VMFindLocationResultMarshal[chLen]; for (int i = 0; i < chLen; i++) { Choices[i] = new VMFindLocationResultMarshal(); Choices[i].Deserialize(reader); } } if (reader.ReadBoolean()) { CurRoute = new VMFindLocationResultMarshal(); CurRoute.Deserialize(reader); } if (Version > 29) { LastWalkStyle = reader.ReadInt16(); } }
public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); var bezierRouting = (Version > 31); var roomN = reader.ReadInt32(); Rooms = new VMRoomPortal[roomN]; for (int i = 0; i < roomN; i++) { Rooms[i] = new VMRoomPortal(reader); } if (reader.ReadBoolean()) { CurrentPortal = new VMRoomPortal(reader); } var wtLen = reader.ReadInt32(); Point[] points = null; if (wtLen > -1) { WalkTo = new VMIPathSegment[wtLen]; if (bezierRouting) { for (int i = 0; i < wtLen; i++) { WalkTo[i] = ReadGenericSegment(reader); } } else { //old point list. convert to line segments. points = new Point[wtLen]; for (int i = 0; i < wtLen; i++) { points[i] = new Point(reader.ReadInt32(), reader.ReadInt32()); } } } WalkDirection = reader.ReadDouble(); TargetDirection = reader.ReadDouble(); IgnoreRooms = reader.ReadBoolean(); State = (VMRoutingFrameState)reader.ReadByte(); PortalTurns = reader.ReadInt32(); WaitTime = reader.ReadInt32(); Timeout = reader.ReadInt32(); Retries = reader.ReadInt32(); AttemptedChair = reader.ReadBoolean(); TurnTweak = reader.ReadSingle(); TurnFrames = reader.ReadInt32(); MoveTotalFrames = reader.ReadInt32(); MoveFrames = reader.ReadInt32(); Velocity = reader.ReadInt32(); CallFailureTrees = reader.ReadBoolean(); var igrN = reader.ReadInt32(); IgnoredRooms = new VMRoomPortal[igrN]; for (int i = 0; i < igrN; i++) { IgnoredRooms[i] = new VMRoomPortal(reader); } var avaN = reader.ReadInt32(); AvatarsToConsider = new short[avaN]; for (int i = 0; i < avaN; i++) { AvatarsToConsider[i] = reader.ReadInt16(); } LotTilePos CurrentWaypoint = new LotTilePos(); PreviousPosition.Deserialize(reader); if (bezierRouting) { CurrentPath = ReadGenericSegment(reader); } else { //convert old format into new CurrentWaypoint.Deserialize(reader); CurrentPath = new VMPathLineSegment( new Point(PreviousPosition.x * 0x8000, PreviousPosition.y * 0x8000), new Point(CurrentWaypoint.x * 0x8000, CurrentWaypoint.y * 0x8000)); if (points != null) { if (points.Length > 0) { WalkTo = new VMIPathSegment[points.Length]; WalkTo[0] = new VMPathLineSegment( new Point(CurrentWaypoint.x * 0x8000, CurrentWaypoint.y * 0x8000), new Point(points[0].X * 0x8000, points[0].Y * 0x8000)); for (int i = 1; i < WalkTo.Length; i++) { WalkTo[i] = new VMPathLineSegment( new Point(points[i - 1].X * 0x8000, points[i - 1].Y * 0x8000), new Point(points[i].X * 0x8000, points[i].Y * 0x8000)); } } else { WalkTo = new VMIPathSegment[0]; } } else { WalkTo = null; } } CurrentPath.CalculateTotalFrames(); CurrentPath.UpdateTotalFrames(MoveTotalFrames); CurrentPath.ResetToFrame(MoveFrames); RoomRouteInvalid = reader.ReadBoolean(); if (reader.ReadBoolean()) { Slot = SLOTItemSerializer.Deserialize(reader); } Target = reader.ReadInt16(); var chLen = reader.ReadInt32(); if (chLen > -1) { Choices = new VMFindLocationResultMarshal[chLen]; for (int i = 0; i < chLen; i++) { Choices[i] = new VMFindLocationResultMarshal(); Choices[i].Deserialize(reader); } } if (reader.ReadBoolean()) { CurRoute = new VMFindLocationResultMarshal(); CurRoute.Deserialize(reader); } if (Version > 29) { LastWalkStyle = reader.ReadInt16(); } }