public void WriteToStream(BinaryWriter bout) { RotationVector.WriteShort3Coord64(bout); OriginPosition.WriteShort3Coord64(bout); bout.Write(ObjtType); StreamUtils.WriteByteFlag(bout, FlagUnknown); StreamUtils.WriteByteFlag(bout, IsSolid); bout.Write(ShortUnknown); }
public void WriteToStream(BinaryWriter bout) { bout.Write((short)WeaponType); bout.Write(ShortUnknown); OriginPosition.WriteShort3Coord64(bout); }
public override void Serialise(Stream outStr) { BinaryWriter bout = new BinaryWriter(outStr); //header bout.Write(DeclaredIdx); StreamUtils.WriteASCIINullTermString(outStr, DeclaredName); OriginPosition.WriteShort3Coord64(bout); RotationVector.WriteShort3Coord64(bout); bout.Write(Width); bout.Write(Height); bout.Write(ScaleX); bout.Write(ScaleY); //every flat has a tex array: for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { bout.Write(TextureIds[x][y]); bout.Write(TerrainHeight[x][y]); } } //General flags StreamUtils.WriteShortFlag(bout, HasMetaData); StreamUtils.WriteShortFlag(bout, FlgB); StreamUtils.WriteShortFlag(bout, FlgC); StreamUtils.WriteShortFlag(bout, Visible); StreamUtils.WriteByteFlag(bout, FlgE); //N.B. byte here. See Deserialise. //what do these mean? bout.Write(NextN); //unless (HasMetaData), we're done... if (HasMetaData) { //load the tex metadata for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { bout.Write(TexMetaData[x][y]); } } //objects: bout.Write((short)Objects.Length); foreach (ObjectEntry o in Objects) { o.WriteToStream(bout); } //weapons: bout.Write((short)Weapons.Length); foreach (WeaponEntry w in Weapons) { w.WriteToStream(bout); } } //pool5 hack: if (TrailingData != null) { bout.Write(TrailingData); } }