public void BlueprintReset(string path)
{
string filename = Path.GetFileName(path);
try
{
using (var file = new BinaryReader(File.OpenRead(Path.Combine(FSOEnvironment.UserDir, "LocalHouse/") + filename.Substring(0, filename.Length - 4) + ".fsov")))
{
var marshal = new FSO.SimAntics.Marshals.VMMarshal();
marshal.Deserialize(file);
//vm.SendCommand(new VMStateSyncCmd()
//{
// State = marshal
//});
vm.Load(marshal);
vm.Reset();
}
}
catch (Exception)
{
var floorClip = Rectangle.Empty;
var offset = new Point();
var targetSize = 0;
var isIff = path.EndsWith(".iff");
short jobLevel = -1;
if (isIff)
{
jobLevel = short.Parse(path.Substring(path.Length - 6, 2));
}
vm.SendCommand(new VMBlueprintRestoreCmd
{
JobLevel = jobLevel,
XMLData = File.ReadAllBytes(path),
IffData = isIff,
FloorClipX = floorClip.X,
FloorClipY = floorClip.Y,
FloorClipWidth = floorClip.Width,
FloorClipHeight = floorClip.Height,
OffsetX = offset.X,
OffsetY = offset.Y,
TargetSize = targetSize
});
}
vm.Tick();
if (ActiveFamily == null)
{
vm.SetGlobalValue(32, 1);
vm.SpeedMultiplier = -1;
}
}