mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-20 22:33:55 -04:00
Added FSO.Files for use with the API server
Don't ask me. FreeSO is the prime example of dependency hell.
This commit is contained in:
parent
4b5e584eeb
commit
8fec258215
104 changed files with 14653 additions and 163 deletions
61
server/tso.files/Formats/IFF/Chunks/WALm.cs
Executable file
61
server/tso.files/Formats/IFF/Chunks/WALm.cs
Executable file
|
@ -0,0 +1,61 @@
|
|||
using FSO.Files.Utils;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace FSO.Files.Formats.IFF.Chunks
|
||||
{
|
||||
/// <summary>
|
||||
/// WALm and FLRm chunks, used for mapping walls and floors in ARRY chunks to walls and floors in resource files (outwith floors.iff)
|
||||
/// </summary>
|
||||
public class WALm : IffChunk
|
||||
{
|
||||
public List<WALmEntry> Entries;
|
||||
|
||||
public override void Read(IffFile iff, Stream stream)
|
||||
{
|
||||
using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
|
||||
{
|
||||
var zero = io.ReadInt32();
|
||||
var version = io.ReadInt32(); //should be 0
|
||||
var walm = io.ReadInt32(); //mLAW/mRLF
|
||||
|
||||
var count = io.ReadInt32();
|
||||
Entries = new List<WALmEntry>();
|
||||
|
||||
for (int i=0; i<count; i++)
|
||||
{
|
||||
//size of fields depends on chunk id.
|
||||
Entries.Add(new WALmEntry(io, ChunkID));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FLRm : WALm
|
||||
{
|
||||
//literally no difference
|
||||
}
|
||||
|
||||
public class WALmEntry
|
||||
{
|
||||
public string Name;
|
||||
public int Unknown; //usually 1
|
||||
public byte ID;
|
||||
public byte[] Unknown2;
|
||||
public WALmEntry(IoBuffer io, int id)
|
||||
{
|
||||
Name = io.ReadNullTerminatedString();
|
||||
if (Name.Length % 2 == 0) io.ReadByte(); //pad to short width
|
||||
Unknown = io.ReadInt32(); //index in iff?
|
||||
ID = io.ReadByte();
|
||||
Unknown2 = io.ReadBytes(5 + id * 2);
|
||||
|
||||
//id 0 seems to be an older format
|
||||
//unknown2 is 01 00 00 00 00 00
|
||||
//id 1 adds more fields
|
||||
//unknown2 is 01 01 00 00 00 00 00 00
|
||||
|
||||
//related to number of walls or floors in the file?
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue