/// <summary>
/// Initiates loading of walls.
/// </summary>
public void Init()
{
var wallGlobalsPath = ContentManager.GetPath("objectdata/globals/walls.iff");
WallGlobals = new IffFile(wallGlobalsPath);
var buildGlobalsPath = ContentManager.GetPath("objectdata/globals/build.iff");
BuildGlobals = new IffFile(buildGlobalsPath); //todo: centralize?
InitGlobals();
ushort wallID = 256;
var archives = new string[]
{
"housedata/walls/walls.far",
"housedata/walls2/walls2.far",
"housedata/walls3/walls3.far",
"housedata/walls4/walls4.far"
};
for (var i = 0; i < archives.Length; i++)
{
var archivePath = ContentManager.GetPath(archives[i]);
var archive = new FAR1Archive(archivePath, true);
var entries = archive.GetAllEntries();
foreach (var entry in entries)
{
var iff = new IffFile();
DynamicWallFromID[new string(entry.Key.TakeWhile(x => x != '.').ToArray()).ToLowerInvariant()] = wallID;
var bytes = archive.GetEntry(entry);
using (var stream = new MemoryStream(bytes))
{
iff.Read(stream);
}
var catStrings = iff.Get <STR>(0);
Entries.Add(wallID, new WallReference(this)
{
ID = wallID,
FileName = entry.Key,
Name = catStrings.GetString(0),
Price = int.Parse(catStrings.GetString(1)),
Description = catStrings.GetString(2)
});
wallID++;
}
archive.Close();
}
var far1 = new FAR1Provider <IffFile>(ContentManager, new IffCodec(), new Regex(".*/walls.*\\.far"));
far1.Init();
Walls = far1;
NumWalls = wallID;
}