Ejemplo n.º 1
0
 internal void SaveData(BinaryWriterBE writer)
 {
     writer.Write((short)MissionFlags);
     writer.Write((short)EnvironmentFlags);
     writer.Write((int)EntryPointFlags);
     writer.WriteMacString(LevelName, MapInfo.LevelNameLength);
 }
Ejemplo n.º 2
0
 public void Save(BinaryWriterBE writer)
 {
     writer.Write(Type);
     writer.Write(X);
     writer.Write(Y);
     writer.Write(PolygonIndex);
     writer.WriteMacString(Text, textLength);
 }
Ejemplo n.º 3
0
 public void Save(BinaryWriterBE writer)
 {
     writer.Write(Environment);
     writer.Write(PhysicsModel);
     writer.Write(Landscape);
     writer.Write((short)MissionFlags);
     writer.Write((short)EnvironmentFlags);
     writer.Write(new byte[8]);
     writer.WriteMacString(Name, LevelNameLength);
     writer.Write((int)EntryPointFlags);
 }
Ejemplo n.º 4
0
        public void Save(string filename)
        {
            using (FileStream fs = File.Open(filename, FileMode.OpenOrCreate, FileAccess.Write)) {
                CrcStream      crcStream = new CrcStream(fs);
                BinaryWriterBE writer    = new BinaryWriterBE(crcStream);

                // set up the header
                if (Directory.Count == 1)
                {
                    version = (short)WadfileVersion.SupportsOverlays;
                }
                else
                {
                    version = (short)WadfileVersion.HasInfinityStuff;
                }

                DataVersion     = (short)WadfileDataVersion.MarathonTwo;
                checksum        = 0;
                directoryOffset = headerSize;
                foreach (var kvp in Directory)
                {
                    kvp.Value.Offset = directoryOffset;
                    kvp.Value.Index  = (short)kvp.Key;
                    directoryOffset += kvp.Value.Size;
                }

                SetApplicationSpecificDirectoryDataSize();
                entryHeaderSize        = DirectoryEntry.HeaderSize;
                directoryEntryBaseSize = DirectoryEntry.BaseSize;
                ParentChecksum         = 0;

                // write the header
                writer.Write(version);
                writer.Write(DataVersion);
                writer.WriteMacString(filename.Split('.')[0], maxFilename);
                writer.Write(checksum);
                writer.Write(directoryOffset);
                writer.Write((short)Directory.Count);
                writer.Write(applicationSpecificDirectoryDataSize);
                writer.Write(entryHeaderSize);
                writer.Write(directoryEntryBaseSize);
                writer.Write(ParentChecksum);
                writer.Write(new byte[2 * 20]);

                // write wads
                foreach (var kvp in Directory)
                {
                    kvp.Value.SaveChunks(writer, GetTagOrder());
                }

                // write directory
                foreach (var kvp in Directory)
                {
                    kvp.Value.SaveEntry(writer);
                    SaveApplicationSpecificDirectoryData(writer, kvp.Value.Index);
                }

                // fix the checksum!
                checksum = crcStream.GetCRC();
                fs.Seek(68, SeekOrigin.Begin);
                writer.Write(checksum);
            }
        }