private void pack_flags() { data_flags = 0; if (Interior) { data_flags = BinaryFlag.set((ushort)data_flags, (ushort)FLAGS_CELL.Interior); } if (HasWater) { data_flags = BinaryFlag.set((ushort)data_flags, (ushort)FLAGS_CELL.HasWater); } }
public static TES5.Group convert(string file) { TES5.Group fact = new TES5.Group("FACT"); TES3.ESM.open(file); while (TES3.ESM.find("FACT")) { TES3.Record f3 = new TES3.Record(); f3.read(); string editor_id = f3.find_first("NAME").readString(); string full_name = f3.find_first("NAME") != null?f3.find_first("NAME").readString() : null; TES5.Record f5 = new TES5.Record("FACT", editor_id); if (full_name != null) { f5.addField(new TES5.Field("FULL", Text.zstring(full_name))); } List <TES3.SubRecord> ANAMs = f3.find_all("ANAM", true); List <TES3.SubRecord> INTVs = f3.find_all("INTV", true); foreach (TES3.SubRecord intv in INTVs) { int reaction = intv.getData().ReadInt32(); if (reaction <= -3) // make hostile { reaction = 1; } else if (reaction > -3 && reaction <= 1) { reaction = 0; } else if (reaction >= 2) { reaction = 2; } } uint flags = 0; flags = BinaryFlag.set(flags, 0x8000); f5.addField(new TES5.Field("DATA", Binary.toBin(flags))); fact.addRecord(f5); } TES3.ESM.close(); return(fact); }
static TES5.Record make_txst(string editor_id, string texture) { texture = texture.Replace(".tga", ".dds"); string path = "morrowind\\"; TES5.Record txset = new TES5.Record("TXST"); txset.addField(new TES5.Field("EDID", Text.editor_id(editor_id))); txset.addField(new TES5.Field("OBND", new byte[12])); txset.addField(new TES5.Field("TX00", Text.zstring(path + texture))); txset.addField(new TES5.Field("TX01", Text.zstring(path + texture.Replace(".dds", "_n.dds")))); ushort flag = (ushort)BinaryFlag.set(0, 0x01); txset.addField(new TES5.Field("DNAM", Binary.toBin(flag))); return(txset); }
public Record(string type, bool compressed = false) { if (type == null) { return; } this.type = type.ToCharArray(0, 4); //this.flags = flags; if (compressed) { this.compressed = compressed; this.flags = BinaryFlag.set((uint)0, (uint)FLAGS.compressed); } this.id = FormID.getNew(); this.revision = 5906; this.version = 43; this.unknown = 0; }
public XCLL() { Ambient = new byte[4]; Directional = new byte[4]; FogNear = new byte[4]; AmbientX_plus = new byte[4] { 255, 255, 255, 0 }; AmbientX_minus = new byte[4] { 255, 255, 255, 0 }; AmbientY_plus = new byte[4] { 255, 255, 255, 0 }; AmbientY_minus = new byte[4] { 255, 255, 255, 0 }; AmbientZ_plus = new byte[4] { 255, 255, 255, 0 }; AmbientZ_minus = new byte[4] { 255, 255, 255, 0 }; SpecularColor = new byte[4]; FogFar2 = new byte[4]; Inheritflags_minuscontrols = (uint)BinaryFlag.set(0, 0x0001); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0002); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0004); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0008); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0010); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0020); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0040); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0080); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0100); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0200); Inheritflags_minuscontrols = (uint)BinaryFlag.set(Inheritflags_minuscontrols, 0x0400); FogPow = 1.0f; FresnelPower = 1.0f; FogMax = 1.0f; }
public void make_persistent() { this.flags = BinaryFlag.set(this.flags, 0x400); }
//byte[] compressed_data; // END Data public void setFlag(uint option) { flags = BinaryFlag.set(flags, option); }
public void pack() { addField(new Field("EDID", Text.editor_id(editor_id))); if (full_name != null) { addField(new Field("FULL", Text.zstring(full_name))); } if (model != null) { addField(new Field("MODL", Text.model_path(model))); } if (icon != null) { addField(new Field("ICON", Text.zstring(icon))); } // FIELD -> DATA { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); bw.Write((UInt32)Time); bw.Write((UInt32)Radius); bw.Write((byte)r); bw.Write((byte)g); bw.Write((byte)b); bw.Write((byte)0); UInt32 flags = 0; if (Dynamic) { flags = BinaryFlag.set(flags, (UInt32)0x0001); } if (carried) { flags = BinaryFlag.set(flags, (UInt32)0x0002); } if (Flicker) { flags = BinaryFlag.set(flags, (UInt32)0x0008); } if (Off) { flags = BinaryFlag.set(flags, (UInt32)0x0020); } if (FlickerSlow) { flags = BinaryFlag.set(flags, (UInt32)0x0040); } if (Pulse) { flags = BinaryFlag.set(flags, (UInt32)0x0080); } if (Spotlight) { flags = BinaryFlag.set(flags, (UInt32)0x0400); } if (Hemisphere) { flags = BinaryFlag.set(flags, (UInt32)0x0800); } if (Omnidirectional) { flags = BinaryFlag.set(flags, (UInt32)0x1000); } bw.Write((UInt32)flags); bw.Write((float)Falloff_Exponent); bw.Write((float)FOV); bw.Write((float)Near_Clip); bw.Write((float)Period); bw.Write((float)Intensity_Amplitude); bw.Write((float)Movement_Amplitude); bw.Write((UInt32)Value); bw.Write((float)Weight); if (ms.Length != 48) { Log.error("LIGH:DATA must be 48 bytes"); } addField(new Field("DATA", ms.ToArray())); } }