Skip to content

Commit

Permalink
update reach water
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro413 committed May 2, 2024
1 parent 8c36a07 commit 1f2df17
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
12 changes: 10 additions & 2 deletions TagTool/Shaders/ShaderMatching/ShaderMatcherNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,17 @@ private Rmt2Descriptor RebuildRmt2Options(Rmt2Descriptor srcRmt2Descriptor, Stre

string methodName = BaseCache.StringTable.GetString(baseRmdfDefinition.Categories[i].Name);

if (methodName == "reach_compatibility")
if (PortingCache.Version >= CacheVersion.HaloReach && methodName == "reach_compatibility")
{
newOptions.Add(PortingCache.Version >= CacheVersion.HaloReach ? (byte)1 : (byte)0);
if (portingRmdfDefinition.GetCategoryOption(PortingCache, "detail", srcRmt2Descriptor.Options) == "repeat")
{
int potentialIndex = baseRmdfDefinition.GetCategoryOptionIndex(BaseCache, "reach_compatibility", "enabled_detail_repeat");
newOptions.Add(potentialIndex != -1 ? (byte)potentialIndex : (byte)1);
}
else
{
newOptions.Add(1);
}
continue;
}

Expand Down
28 changes: 28 additions & 0 deletions TagTool/Tags/Definitions/RenderMethodDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using TagTool.Shaders;
using System.Collections.Generic;
using System;
using System.IO;

namespace TagTool.Tags.Definitions
{
Expand Down Expand Up @@ -153,5 +154,32 @@ public bool ContainsCategory(GameCache cache, string categoryName)
}
return false;
}

public string GetCategoryOption(GameCache cache, string categoryName, byte[] options)
{
for (int i = 0; i < Categories.Count; i++)
{
if (cache.StringTable.GetString(Categories[i].Name) == categoryName)
return cache.StringTable.GetString(Categories[i].ShaderOptions[options[i]].Name);
}
return "INVALID_CATEGORY";
}

public int GetCategoryOptionIndex(GameCache cache, string categoryName, string optionName)
{
for (int i = 0; i < Categories.Count; i++)
{
if (cache.StringTable.GetString(Categories[i].Name) == categoryName)
{
for (int j = 0; j < Categories[i].ShaderOptions.Count; j++)
{
if (cache.StringTable.GetString(Categories[i].ShaderOptions[j].Name) == optionName)
return j;
}
break;
}
}
return -1;
}
}
}

0 comments on commit 1f2df17

Please sign in to comment.