Revert "Animations bugfix"

This reverts commit c3d3984725.
This commit is contained in:
Lucca Faria Ferri 2023-02-03 12:01:10 -08:00
parent c3d3984725
commit 0489f9e47a
2 changed files with 15256 additions and 30534 deletions

View File

@ -1901,33 +1901,7 @@ namespace DiIiS_NA.Core.MPQ
}
public static Dictionary<string, int> LoadAnim()
{
var dict = Enum.GetValues<AnimationSno>().ToDictionary(x => x.ToString(), x => (int)x);
// TODO: merge with LINQ above.
// this parses enum values that has SnoFileNameAttribute, in case the dict linq above didn't get a correct name
// for the actor file.
foreach (var d in Enum.GetValues<AnimationSno>())
{
var enumType = typeof(AnimationSno);
var memberInfos =
enumType.GetMember(d.ToString());
if (memberInfos.Length == 0)
continue;
var enumValueMemberInfo = memberInfos.FirstOrDefault(m => m.DeclaringType == enumType);
if (enumValueMemberInfo == null) continue;
var valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(SnoFileNameAttribute), false)
.Select(s=>(SnoFileNameAttribute)s)
.FirstOrDefault();
if (valueAttributes != null)
{
if (dict.ContainsKey(valueAttributes.FileName))
{
dict.Remove(valueAttributes.FileName);
}
dict.Add(valueAttributes.FileName, (int)d);
}
}
return dict;
return Enum.GetValues<AnimationSno>().ToDictionary(x => x.ToString(), x => (int)x);
}
public static Dictionary<string, int> LoadAnimation2D()
{

File diff suppressed because it is too large Load Diff