public Chunk_MODS(WMOFile file) : base(file, "MODS", Magic) { int setCount = (int)ChunkSize / 32; sets = new DoodadSet[setCount]; for (int i = 0; i < setCount; i++) { sets[i] = DoodadSet.Read(file); file.skip(4); // Unused } LogWrite("Loaded " + setCount + " doodad sets."); }
// This chunk defines doodad sets. public static void ReadMODS(Stream WMOrootstream, int MODSsize) { int numberOfSets = MODSsize / 32; List <DoodadSet> DoodadSets = new List <DoodadSet>(); for (int i = 0; i < numberOfSets; ++i) { DoodadSet doodadSet = new DoodadSet(); byte[] nameBytes = new byte[20]; WMOrootstream.Read(nameBytes, 0, 20); doodadSet.name = Encoding.UTF8.GetString(nameBytes).TrimEnd('\0'); doodadSet.firstDoodadInstanceIndex = ReadLong(WMOrootstream); doodadSet.doodadInstanceCount = ReadLong(WMOrootstream); int Unused = ReadLong(WMOrootstream); DoodadSets.Add(doodadSet); } }
static void ReadMODS(BinaryReader br, WMORoot wmo) { wmo.DoodadSets = new DoodadSet[wmo.Header.DoodadSetCount]; for (int i = 0; i < wmo.Header.DoodadSetCount; i++) { var d = new DoodadSet { SetName = br.ReadFixedString(20), FirstInstanceIndex = br.ReadUInt32(), InstanceCount = br.ReadUInt32() }; br.ReadInt32(); // padding wmo.DoodadSets[i] = d; } }
private static IEnumerable <IModelDefinition> DefinitionsForSet(IEnumerable <IModelDefinition> defs, DoodadSet set) { return(defs.Skip(set.FirstDefinition).Take(set.DefinitionCount)); }