public unsafe ItemArt() { FileStream fs = new FileStream(Engine.FileManager.ResolveMUL(Files.ArtIdx), FileMode.Open, FileAccess.Read, FileShare.Read); fs.Seek(0x30000L, SeekOrigin.Begin); fixed(Entry3D *entrydRef = this.m_Index) { Engine.NativeRead(fs, (void *)entrydRef, 0x30000); } fs.Close(); this.m_Stream = new FileStream(Engine.FileManager.ResolveMUL(Files.ArtMul), FileMode.Open, FileAccess.Read, FileShare.Read); this.m_Verdata = new FileStream(Engine.FileManager.ResolveMUL(Files.Verdata), FileMode.Open, FileAccess.Read, FileShare.Read); int num = 0; Engine.NativeRead(this.m_Verdata, (void *)&num, 4); if (num > 0) { Entry5D[] entrydArray = new Entry5D[num]; fixed(Entry5D *entrydRef2 = entrydArray) { Engine.NativeRead(this.m_Verdata, (void *)entrydRef2, num * 20); for (int k = 0; k < num; k++) { Entry5D entryd = entrydRef2[k]; if (((entryd.m_FileID == 4) && (entryd.m_BlockID >= 0x4000)) && (entryd.m_BlockID < 0x8000)) { entryd.m_BlockID &= 0x3fff; this.m_Index[entryd.m_BlockID].m_Lookup = entryd.m_Lookup; this.m_Index[entryd.m_BlockID].m_Length = entryd.m_Length; this.m_Index[entryd.m_BlockID].m_Extra = entryd.m_Extra; } } } } ArtTableEntry[] entries = ArtTable.m_Entries; for (int i = 0; i < this.m_Translate.Length; i++) { this.m_Translate[i] = i; } int length = entries.Length; for (int j = 0; j < length; j++) { ArtTableEntry entry = entries[j]; if ((entry.m_OldID >= 0x4000) && (entry.m_NewID >= 0x4000)) { this.m_Translate[entry.m_NewID & 0x3fff] = entry.m_OldID & 0x3fff; if (this.m_Index[entry.m_NewID & 0x3fff].m_Lookup == -1) { this.m_Index[entry.m_NewID & 0x3fff].m_Lookup = j | -2147483648; this.m_Index[entry.m_NewID & 0x3fff].m_Length = this.m_Index[entry.m_OldID & 0x3fff].m_Length; } } } }
public void Translate(ref int itemID) { itemID &= 0x3fff; int length = this.m_Index[itemID].m_Length; if (((length != -1) && ((length & -2147483648) != 0)) && (this.m_Index[itemID].m_Lookup == -1)) { ArtTableEntry entry = ArtTable.m_Entries[length & 0x7fffffff]; itemID = entry.m_OldID & 0x3fff; } }
public void Translate(ref int itemID, ref int hue) { itemID &= 0x3fff; int lookup = this.m_Index[itemID].m_Lookup; if (((lookup != -1) && ((lookup & -2147483648) != 0)) && (this.m_Index[itemID].m_Lookup == -1)) { ArtTableEntry entry = ArtTable.m_Entries[lookup & 0x7fffffff]; itemID = entry.m_OldID & 0x3fff; hue = entry.m_NewHue; } }
protected override bool CoreLookup() { FileStream verdata; Entry3D entryd = this.m_Items.m_Index[this.m_ItemID]; int lookup = entryd.m_Lookup; int length = entryd.m_Length; if (lookup == -1) { return(false); } bool flag = (length & -2147483648) != 0; if ((lookup & -2147483648) != 0) { lookup &= 0x7fffffff; ArtTableEntry entry = ArtTable.m_Entries[lookup]; lookup = this.m_Items.m_Index[entry.m_OldID & 0x3fff].m_Lookup; if (lookup == -1) { return(false); } } if (flag) { length &= 0x7fffffff; this.m_Items.m_Verdata.Seek((long)lookup, SeekOrigin.Begin); verdata = this.m_Items.m_Verdata; } else { this.m_Items.m_Stream.Seek((long)lookup, SeekOrigin.Begin); verdata = this.m_Items.m_Stream; } if ((this.m_Buffer == null) || (length > this.m_Buffer.Length)) { this.m_Buffer = new byte[length]; } if (Engine.NativeRead(verdata, this.m_Buffer, 0, length) != length) { return(false); } int num4 = this.m_Buffer[4] | (this.m_Buffer[5] << 8); int num5 = this.m_Buffer[6] | (this.m_Buffer[7] << 8); return((num4 > 0) && (num5 > 0)); }
public unsafe LandArt() { Stream stream = Engine.FileManager.OpenMUL(Files.ArtIdx); byte[] buffer = new byte[0x30000]; Engine.NativeRead((FileStream)stream, buffer, 0, buffer.Length); stream.Close(); fixed(byte *numRef = buffer) { int *numPtr = (int *)numRef; int num = 0; while (num < 0x4000) { this.m_Lookup[num++] = numPtr[0]; numPtr += 3; } } this.m_Length = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0x10, 0x11, 0x12, 0x13, 20, 0x15, 0x16, 0x16, 0x15, 20, 0x13, 0x12, 0x11, 0x10, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; this.m_Offset = new int[] { 0x15, 20, 0x13, 0x12, 0x11, 0x10, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0x10, 0x11, 0x12, 0x13, 20, 0x15 }; this.m_Stream = Engine.FileManager.OpenMUL(Files.ArtMul); ArtTableEntry[] entries = ArtTable.m_Entries; int length = entries.Length; for (int i = 0; i < length; i++) { ArtTableEntry entry = entries[i]; if (((entry.m_OldID < 0x4000) && (entry.m_NewID < 0x4000)) && (this.m_Lookup[entry.m_OldID & 0x3fff] >= 0)) { this.m_Lookup[entry.m_NewID & 0x3fff] = this.m_Lookup[entry.m_OldID & 0x3fff]; } } }