From 24b33aae155c24f5fff535b048225e85caf13ad0 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Mon, 17 Feb 2020 19:55:57 -0500 Subject: [PATCH] Fix references to layout header to access certain data --- File_Format_Library/FileFormats/Layout/CAFE/Panes/PAN1.cs | 1 + File_Format_Library/FileFormats/Layout/CTR/Panes/PAN1.cs | 2 ++ File_Format_Library/FileFormats/Layout/Rev/BRLYT.cs | 8 ++++---- File_Format_Library/FileFormats/Layout/Rev/Panes/BND1.cs | 2 +- File_Format_Library/FileFormats/Layout/Rev/Panes/PAN1.cs | 5 ++++- File_Format_Library/FileFormats/Layout/Rev/Panes/PIC1.cs | 2 +- File_Format_Library/FileFormats/Layout/Rev/Panes/TXT1.cs | 2 +- File_Format_Library/FileFormats/Layout/Rev/Panes/WND1.cs | 2 +- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/File_Format_Library/FileFormats/Layout/CAFE/Panes/PAN1.cs b/File_Format_Library/FileFormats/Layout/CAFE/Panes/PAN1.cs index f01d8c9d..fcc7cec7 100644 --- a/File_Format_Library/FileFormats/Layout/CAFE/Panes/PAN1.cs +++ b/File_Format_Library/FileFormats/Layout/CAFE/Panes/PAN1.cs @@ -48,6 +48,7 @@ namespace LayoutBXLYT.Cafe public PAN1(BxlytHeader header, string name) : base() { + LayoutFile = header; LoadDefaults(); Name = name; } diff --git a/File_Format_Library/FileFormats/Layout/CTR/Panes/PAN1.cs b/File_Format_Library/FileFormats/Layout/CTR/Panes/PAN1.cs index 305ca2e0..5ba1876d 100644 --- a/File_Format_Library/FileFormats/Layout/CTR/Panes/PAN1.cs +++ b/File_Format_Library/FileFormats/Layout/CTR/Panes/PAN1.cs @@ -47,6 +47,7 @@ namespace LayoutBXLYT.CTR } public PAN1(BxlytHeader header, string name) : base() { + LayoutFile = header; LoadDefaults(); Name = name; } @@ -80,6 +81,7 @@ namespace LayoutBXLYT.CTR public PAN1(FileReader reader, BxlytHeader header) : base() { + LayoutFile = header; _flags1 = reader.ReadByte(); byte origin = reader.ReadByte(); Alpha = reader.ReadByte(); diff --git a/File_Format_Library/FileFormats/Layout/Rev/BRLYT.cs b/File_Format_Library/FileFormats/Layout/Rev/BRLYT.cs index 4bc1d265..8438eaa3 100644 --- a/File_Format_Library/FileFormats/Layout/Rev/BRLYT.cs +++ b/File_Format_Library/FileFormats/Layout/Rev/BRLYT.cs @@ -113,8 +113,8 @@ namespace LayoutBXLYT foreach (var tex in tpl.TextureList) { //Only need the first texture - if (!textures.ContainsKey(file.FileName)) - textures.Add(file.FileName, tex); + if (!textures.ContainsKey(tpl.FileName)) + textures.Add(tpl.FileName, tex); } } } @@ -374,7 +374,7 @@ namespace LayoutBXLYT MaterialList = new MAT1(reader, this); break; case "pan1": - var panel = new PAN1(reader); + var panel = new PAN1(reader, this); AddPaneToTable(panel); if (!setRoot) { @@ -400,7 +400,7 @@ namespace LayoutBXLYT currentPane = textPanel; break; case "bnd1": - var boundsPanel = new BND1(reader); + var boundsPanel = new BND1(reader, this); AddPaneToTable(boundsPanel); SetPane(boundsPanel, parentPane); diff --git a/File_Format_Library/FileFormats/Layout/Rev/Panes/BND1.cs b/File_Format_Library/FileFormats/Layout/Rev/Panes/BND1.cs index d6977f6b..fc60dde5 100644 --- a/File_Format_Library/FileFormats/Layout/Rev/Panes/BND1.cs +++ b/File_Format_Library/FileFormats/Layout/Rev/Panes/BND1.cs @@ -22,7 +22,7 @@ namespace LayoutBXLYT.Revolution Name = name; } - public BND1(FileReader reader) : base(reader) + public BND1(FileReader reader, BxlytHeader header) : base(reader, header) { } diff --git a/File_Format_Library/FileFormats/Layout/Rev/Panes/PAN1.cs b/File_Format_Library/FileFormats/Layout/Rev/Panes/PAN1.cs index 09ab2123..c1da237c 100644 --- a/File_Format_Library/FileFormats/Layout/Rev/Panes/PAN1.cs +++ b/File_Format_Library/FileFormats/Layout/Rev/Panes/PAN1.cs @@ -49,6 +49,8 @@ namespace LayoutBXLYT.Revolution public PAN1(BxlytHeader header, string name) : base() { + LayoutFile = header; + LoadDefaults(); Name = name; } @@ -73,8 +75,9 @@ namespace LayoutBXLYT.Revolution Bottom = 2 }; - public PAN1(FileReader reader) : base() + public PAN1(FileReader reader, BxlytHeader header) : base() { + LayoutFile = header; _flags1 = reader.ReadByte(); byte origin = reader.ReadByte(); Alpha = reader.ReadByte(); diff --git a/File_Format_Library/FileFormats/Layout/Rev/Panes/PIC1.cs b/File_Format_Library/FileFormats/Layout/Rev/Panes/PIC1.cs index 60d3fb5a..4e7934a3 100644 --- a/File_Format_Library/FileFormats/Layout/Rev/Panes/PIC1.cs +++ b/File_Format_Library/FileFormats/Layout/Rev/Panes/PIC1.cs @@ -70,7 +70,7 @@ namespace LayoutBXLYT.Revolution Material = (BxlytMaterial)Material.Clone(); } - public PIC1(FileReader reader, BRLYT.Header header) : base(reader) + public PIC1(FileReader reader, BRLYT.Header header) : base(reader, header) { ParentLayout = header; diff --git a/File_Format_Library/FileFormats/Layout/Rev/Panes/TXT1.cs b/File_Format_Library/FileFormats/Layout/Rev/Panes/TXT1.cs index 9a2bd732..3b24dbf3 100644 --- a/File_Format_Library/FileFormats/Layout/Rev/Panes/TXT1.cs +++ b/File_Format_Library/FileFormats/Layout/Rev/Panes/TXT1.cs @@ -208,7 +208,7 @@ namespace LayoutBXLYT.Revolution ShadowItalic = 0; } - public TXT1(FileReader reader, BxlytHeader header) : base(reader) + public TXT1(FileReader reader, BxlytHeader header) : base(reader, header) { layoutFile = header; diff --git a/File_Format_Library/FileFormats/Layout/Rev/Panes/WND1.cs b/File_Format_Library/FileFormats/Layout/Rev/Panes/WND1.cs index 1d624f47..5dcca412 100644 --- a/File_Format_Library/FileFormats/Layout/Rev/Panes/WND1.cs +++ b/File_Format_Library/FileFormats/Layout/Rev/Panes/WND1.cs @@ -175,7 +175,7 @@ namespace LayoutBXLYT.Revolution SetFrames(header); } - public WND1(BxlytHeader header, FileReader reader) : base(reader) + public WND1(BxlytHeader header, FileReader reader) : base(reader, header) { layoutHeader = header; WindowFrames = new List();