public WorldMapObjectPlacementData(IBinaryReader reader, string[] names) { WmoPath = names[reader.ReadInt32()]; var uniqueId = reader.ReadInt32(); AbsolutePosition = reader.ReadVector3(); Rotation = reader.ReadVector3(); Bounds = CAaBox.Read(reader); reader.Offset += 8; // unused }
public MLDX(WOTLK.Chunks.MDDF wotlk) : base(wotlk, "MLDX", false) { int boundingSize = Program.config.BoundingSize; int boundingRadius = Program.config.BoundingRadius; if (Program.config.DynamicBoundingGeneration) { int count = wotlk.DoodadDefs.Count; if (wotlk.DoodadDefs.Count > 1000) { boundingSize = Convert.ToInt32(boundingSize - ((wotlk.DoodadDefs.Count - 1000) / 10)); boundingRadius = Convert.ToInt32(boundingRadius - ((wotlk.DoodadDefs.Count - 1000) / 10)); if (boundingSize < 10) { boundingSize = 10; Logger.log("Bounding size was too small. Set to 10", Logger.Type.WARNING); } if (boundingRadius < 10) { boundingRadius = 10; Logger.log("Bounding radius was too small. Set to 10", Logger.Type.WARNING); } } } /* * doodadDef.Position.X = bounding.Y * doodadDef.Position.Y = bounding.Z * doodadDef.Position.Z = bounding.X */ foreach (DoodadDef doodadDef in wotlk.DoodadDefs) { lod_extent extent = new lod_extent(); CAaBox bounding = new CAaBox(); Vector min = new Vector(); Vector max = new Vector(); min.X = ConvertClientCoordsToServerCoords(doodadDef.Position.Z) - boundingSize; min.Y = ConvertClientCoordsToServerCoords(doodadDef.Position.X) - boundingSize; min.Z = doodadDef.Position.Y - boundingSize; max.X = ConvertClientCoordsToServerCoords(doodadDef.Position.Z) + boundingSize; max.Y = ConvertClientCoordsToServerCoords(doodadDef.Position.X) + boundingSize; max.Z = doodadDef.Position.Y + boundingSize; bounding.Min = min; bounding.Max = max; extent.Bounding = bounding; extent.Radius = boundingRadius; doodadExtents.Add(extent); } Header.ChangeSize(RecalculateSize()); }
public MODF(BinaryReader br) { NameId = br.ReadUInt32(); UniqueId = br.ReadInt32(); Pos = br.ReadStruct <C3Vector>(); Rot = br.ReadStruct <C3Vector>(); Extents = br.ReadStruct <CAaBox>(); Flags = br.ReadEnum <MODF_Flags>(); DoodadSet = br.ReadUInt16(); NameSet = br.ReadUInt16(); Scale = br.ReadUInt16(); }
public MOGI(BinaryReader br, uint version) { if (version == 14) { Offset = br.ReadUInt32(); Size = br.ReadUInt32(); } Flags = br.ReadEnum <MOGP_Flags>(); AaBox = br.ReadStruct <CAaBox>(); NameIndex = br.ReadInt32(); }
private void ReadHeader(BinaryReader br) { GroupName = br.ReadUInt32(); DbgName = br.ReadUInt32(); Flags = br.ReadEnum <MOGP_Flags>(); BoundingBox = br.ReadStruct <CAaBox>(); PortalStart = Version == 14 ? br.ReadInt32() : br.ReadInt16(); PortalCount = Version == 14 ? br.ReadUInt32() : br.ReadUInt16(); if (Version != 14) { TransBatchCount = br.ReadUInt16(); IntBatchCount = br.ReadUInt16(); ExtBatchCount = br.ReadUInt16(); Padding = br.ReadUInt16(); if (Padding.Value != 0) { throw new Exception("NOT PADDING"); } } FogIds = br.ReadBytes(4); GroupLiquid = br.ReadUInt32(); if (Version == 14) { IntBatch = br.ReadStructArray <SMOGxBatch>(4); ExtBatch = br.ReadStructArray <SMOGxBatch>(4); } UniqueId = br.ReadInt32(); if (Version != 14) { Flags2 = br.ReadUInt32(); Unknown_0x40 = br.ReadUInt32(); if (Flags2 > 0 || Unknown_0x40 > 0) { throw new Exception("NOT PADDING"); } } else { br.BaseStream.Position += 8; // pad } }
public MODF(char[] magic, byte[] size, byte[] content) : base(magic, size) { using (BinaryReader reader = new BinaryReader(new MemoryStream(content))) { while (reader.BaseStream.Position < reader.BaseStream.Length) { mapObjDef entry = new mapObjDef(); Vector pos = new Vector(); Vector rot = new Vector(); CAaBox ext = new CAaBox(); Vector min = new Vector(); Vector max = new Vector(); entry.NameID = reader.ReadUInt32(); entry.UniqueID = reader.ReadUInt32(); pos.X = reader.ReadSingle(); pos.Y = reader.ReadSingle(); pos.Z = reader.ReadSingle(); entry.Position = pos; rot.X = reader.ReadSingle(); rot.Y = reader.ReadSingle(); rot.Z = reader.ReadSingle(); entry.Rotation = rot; min.X = reader.ReadSingle(); min.Y = reader.ReadSingle(); min.Z = reader.ReadSingle(); max.X = reader.ReadSingle(); max.Y = reader.ReadSingle(); max.Z = reader.ReadSingle(); ext.Min = min; ext.Max = max; entry.Extents = ext; entry.Flags = reader.ReadUInt16(); entry.DoodadSet = reader.ReadUInt16(); entry.NameSet = reader.ReadUInt16(); entry.Scale = reader.ReadUInt16(); mapObjDefs.Add(entry); } } }
public MOHD(BinaryReader br, uint version) { NTextures = br.ReadUInt32(); NGroups = br.ReadUInt32(); NPortals = br.ReadUInt32(); NLights = br.ReadUInt32(); NDoodadNames = br.ReadUInt32(); NDoodadDefs = br.ReadUInt32(); NDoodadSets = br.ReadUInt32(); AmbColor = br.ReadStruct <CImVector>(); WmoID = br.ReadUInt32(); if (version == 14) { br.BaseStream.Position += 0x1C; } else { BoundingBox = br.ReadStruct <CAaBox>(); Flags = br.ReadEnum <MOHD_Flags>(); } }
public static void WriteCAaBox(this BinaryWriter writer, CAaBox box) { writer.WriteC3Vector(box.Min); writer.WriteC3Vector(box.Max); }