From 4e987e523a020ccff4b128c5eadeb5d0611ea733 Mon Sep 17 00:00:00 2001 From: dexy Date: Wed, 5 May 2021 19:03:32 +1000 Subject: [PATCH] Added FragGlassWindow flags lo/hi bytes for research purposes --- CodeWalker.Core/GameFiles/GameFileCache.cs | 33 ++++++++++----------- CodeWalker.Core/GameFiles/Resources/Frag.cs | 2 ++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CodeWalker.Core/GameFiles/GameFileCache.cs b/CodeWalker.Core/GameFiles/GameFileCache.cs index eecd23f..8ba3019 100644 --- a/CodeWalker.Core/GameFiles/GameFileCache.cs +++ b/CodeWalker.Core/GameFiles/GameFileCache.cs @@ -3955,7 +3955,7 @@ namespace CodeWalker.GameFiles bool savetest = false; var errorfiles = new List(); var sb = new StringBuilder(); - int[] flagcheck = new int[16]; + var flagdict = new Dictionary(); foreach (RpfFile file in AllRpfs) { foreach (RpfEntry entry in file.AllEntries) @@ -3996,25 +3996,24 @@ namespace CodeWalker.GameFiles { continue; } } - var groups = yft?.Fragment?.PhysicsLODGroup?.PhysicsLOD1?.Groups?.data_items; - if (groups != null) - { - foreach (var g in groups) - { - ushort f = (ushort)(g.UnkByte52 + (g.UnkByte53 << 8)); - for (int i = 0; i < 16; i++) - { - if (flagcheck[i]>=3) continue; - var t = 1 << i; - if ((f & t) > 0) - { - sb.AppendLine(entry.Path + ": " + g.Name.ToString() + ", UnkByte52:" + g.UnkByte52.ToString() + ", UnkByte53:" + g.UnkByte53.ToString() + " zflag:" + (i+1).ToString()); - flagcheck[i]++; - } - } + if (yft?.Fragment?.GlassWindows?.data_items != null) + { + var lastf = -1; + for (int i = 0; i < yft.Fragment.GlassWindows.data_items.Length; i++) + { + var w = yft.Fragment.GlassWindows.data_items[i]; + if (w.Flags == lastf) continue; + lastf = w.Flags; + flagdict.TryGetValue(w.Flags, out int n); + if (n < 10) + { + flagdict[w.Flags] = n + 1; + sb.AppendLine(entry.Path + " Window " + i.ToString() + ": Flags " + w.Flags.ToString() + ", Low:" + w.FlagsLo.ToString() + ", High:" + w.FlagsHi.ToString()); + } } } + } } //catch (Exception ex) diff --git a/CodeWalker.Core/GameFiles/Resources/Frag.cs b/CodeWalker.Core/GameFiles/Resources/Frag.cs index aadb286..76766df 100644 --- a/CodeWalker.Core/GameFiles/Resources/Frag.cs +++ b/CodeWalker.Core/GameFiles/Resources/Frag.cs @@ -1162,6 +1162,8 @@ namespace CodeWalker.GameFiles public float UnkFloat22 { get; set; } public uint UnkUint4 = 0x7f800001; // 0x7f800001 + public byte FlagsLo { get { return (byte)((Flags >> 0) & 0xFF); } } + public byte FlagsHi { get { return (byte)((Flags >> 8) & 0xFF); } } public FragPhysTypeGroup Group { get; set; } public FragPhysicsLOD GroupLOD { get; set; }