public static LandSurf Read(StreamReader data, StreamWriter outputData, bool write = true) { LandSurf obj = new LandSurf(); obj.HasPalShift = Utils.readAndWriteUInt32(data, outputData, write); // This is always 0 if (obj.HasPalShift == 1) { // PalShift.Read would go here, if it ever actually existed...which it doesn't. } else { obj.texMerge = TexMerge.Read(data, outputData, write); } return(obj); }
public static LandSurf Read(byte[] buffer, StreamReader data, StreamWriter outputData, bool write = true) { LandSurf obj = new LandSurf(); obj.HasPalShift = Utils.ReadAndWriteUInt32(buffer, data, outputData, write); // This is always 0 if (obj.HasPalShift == 1) { // PalShift.Read would go here, if it ever actually existed...which it doesn't. // PalShift is used in software rendering in pre-ToD versions } else { obj.texMerge = TexMerge.Read(buffer, data, outputData, write); } return(obj); }
public static TexMerge Read(StreamReader data, StreamWriter outputData, bool write = true) { TexMerge obj = new TexMerge(); obj.CornerTerrainMaps = new List <TerrainAlphaMap>(); obj.SideTerrainMaps = new List <TerrainAlphaMap>(); obj.RoadMaps = new List <RoadAlphaMap>(); obj.TerrainDescription = new List <TMTerrainDesc>(); //obj.BaseTexSize = Utils.readAndWriteUInt32(data, outputData, write); obj.BaseTexSize = Utils.readAndWriteUInt32(data, outputData, false); outputData.BaseStream.Write(BitConverter.GetBytes((uint)256), 0, 4); uint num_corner_terrain_maps = Utils.readAndWriteUInt32(data, outputData, write); for (uint i = 0; i < num_corner_terrain_maps; i++) { obj.CornerTerrainMaps.Add(TerrainAlphaMap.Read(data, outputData, write)); } uint num_side_terrain_maps = Utils.readAndWriteUInt32(data, outputData, write); for (uint i = 0; i < num_side_terrain_maps; i++) { obj.SideTerrainMaps.Add(TerrainAlphaMap.Read(data, outputData, write)); } uint num_road_maps = Utils.readAndWriteUInt32(data, outputData, write); for (uint i = 0; i < num_road_maps; i++) { obj.RoadMaps.Add(RoadAlphaMap.Read(data, outputData, write)); } uint num_terrain_desc = Utils.readAndWriteUInt32(data, outputData, write); for (uint i = 0; i < num_terrain_desc; i++) { obj.TerrainDescription.Add(TMTerrainDesc.Read(data, outputData, write)); } //TMTerrainDesc BarrenRock = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Grassland = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Ice = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc LushGrass = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc MarshSparseSwamp = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc MudRichDirt = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc ObsidianPlain = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc PackedDirt = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc PatchyDirt = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc PatchyGrassland = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc SandYellow = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc SandGrey = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc SandRockStrewn = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc SedimentaryRock = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc SemiBarrenRock = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Snow = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc WaterRunning = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc WaterStandingFresh = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc WaterShallowSea = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc WaterShallowStillSea = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc WaterDeepSea = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Forestfloor = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc FauxWaterRunning = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc SeaSlime = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Argila = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Volcano1 = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Volcano2 = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc BlueIce = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Moss = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc DarkMoss = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc olthoi = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc DesolateLands = TMTerrainDesc.Read(data, outputData, false); //TMTerrainDesc Road = TMTerrainDesc.Read(data, outputData, false); //BarrenRock.terrainTex = Snow.terrainTex; //Grassland.terrainTex.TexGID = 0x0500146B; ////LushGrass.terrainTex = Snow.terrainTex; ////PatchyDirt.terrainTex = Snow.terrainTex; //PatchyGrassland.terrainTex = Snow.terrainTex; ////Forestfloor.terrainTex = Ice.terrainTex; //WaterRunning.terrainTex = BlueIce.terrainTex; //WaterStandingFresh.terrainTex = BlueIce.terrainTex; //BarrenRock.Write(outputData); //Grassland.Write(outputData); //Ice.Write(outputData); //LushGrass.Write(outputData); //MarshSparseSwamp.Write(outputData); //MudRichDirt.Write(outputData); //ObsidianPlain.Write(outputData); //PackedDirt.Write(outputData); //PatchyDirt.Write(outputData); //PatchyGrassland.Write(outputData); //SandYellow.Write(outputData); //SandGrey.Write(outputData); //SandRockStrewn.Write(outputData); //SedimentaryRock.Write(outputData); //SemiBarrenRock.Write(outputData); //Snow.Write(outputData); //WaterRunning.Write(outputData); //WaterStandingFresh.Write(outputData); //WaterShallowSea.Write(outputData); //WaterShallowStillSea.Write(outputData); //WaterDeepSea.Write(outputData); //Forestfloor.Write(outputData); //FauxWaterRunning.Write(outputData); //SeaSlime.Write(outputData); //Argila.Write(outputData); //Volcano1.Write(outputData); //Volcano2.Write(outputData); //BlueIce.Write(outputData); //Moss.Write(outputData); //DarkMoss.Write(outputData); //olthoi.Write(outputData); //DesolateLands.Write(outputData); //Road.Write(outputData); return(obj); }