Skip to content

Commit

Permalink
Fix alias priorities
Browse files Browse the repository at this point in the history
This only affected TRR because of the way we merge the PDP files, but ultimately this performs a better check on alias priorities before import i.e. if the level already has an alias of a type and it's the "chosen one", remove the other's blob before proceeding.
TR3 aliases for Lara misc are ignored because none contain critical commands like ending the level.
  • Loading branch information
lahm86 committed Jun 9, 2024
1 parent e4f0c81 commit 5d62ed2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
15 changes: 10 additions & 5 deletions TRDataControl/Transport/TRDataImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,22 @@ private void CleanAliases()

private void ValidateBlobList(List<T> modelTypes, List<B> importBlobs)
{
Dictionary<T, List<T>> detectedAliases = new();
foreach (T entity in modelTypes)
Dictionary<T, SortedSet<T>> detectedAliases = new();
foreach (T type in modelTypes)
{
if (Data.IsAlias(entity))
T inferredType = type;
if (Data.AliasPriority?.ContainsKey(type) ?? false)
{
T masterType = Data.TranslateAlias(entity);
inferredType = Data.GetLevelAlias(LevelName, type);
}
if (Data.IsAlias(inferredType))
{
T masterType = Data.TranslateAlias(inferredType);
if (!detectedAliases.ContainsKey(masterType))
{
detectedAliases[masterType] = new();
}
detectedAliases[masterType].Add(entity);
detectedAliases[masterType].Add(inferredType);
}
}

Expand Down
17 changes: 17 additions & 0 deletions TRLevelControl/Helpers/TR1TypeUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ public static class TR1TypeUtilities
{
public static readonly Dictionary<TR1Type, Dictionary<TR1Type, List<string>>> LevelAliases = new()
{
[TR1Type.LaraMiscAnim_H] = new()
{
[TR1Type.LaraMiscAnim_H_General] =
new() { TR1LevelNames.CAVES, TR1LevelNames.VILCABAMBA, TR1LevelNames.FOLLY, TR1LevelNames.COLOSSEUM, TR1LevelNames.CISTERN, TR1LevelNames.TIHOCAN },
[TR1Type.LaraMiscAnim_H_Valley] =
new() { TR1LevelNames.VALLEY },
[TR1Type.LaraMiscAnim_H_Qualopec] =
new() { TR1LevelNames.QUALOPEC },
[TR1Type.LaraMiscAnim_H_Midas] =
new() { TR1LevelNames.MIDAS },
[TR1Type.LaraMiscAnim_H_Sanctuary] =
new() { TR1LevelNames.SANCTUARY },
[TR1Type.LaraMiscAnim_H_Atlantis] =
new() { TR1LevelNames.ATLANTIS },
[TR1Type.LaraMiscAnim_H_Pyramid] =
new() { TR1LevelNames.PYRAMID },
},
[TR1Type.FlyingAtlantean] = new()
{
[TR1Type.BandagedFlyer] =
Expand Down
15 changes: 15 additions & 0 deletions TRLevelControl/Helpers/TR2TypeUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ public static class TR2TypeUtilities
[TR2Type.LaraAssault] =
new() { TR2LevelNames.ASSAULT },
},
[TR2Type.LaraMiscAnim_H] = new()
{
[TR2Type.LaraMiscAnim_H_Wall] =
new() { TR2LevelNames.GW },
[TR2Type.LaraMiscAnim_H_Venice] =
new() { TR2LevelNames.BARTOLI },
[TR2Type.LaraMiscAnim_H_Unwater] =
new() { TR2LevelNames.RIG, TR2LevelNames.DA, TR2LevelNames.FATHOMS, TR2LevelNames.DORIA, TR2LevelNames.DECK },
[TR2Type.LaraMiscAnim_H_Ice] =
new() { TR2LevelNames.COT, TR2LevelNames.CHICKEN },
[TR2Type.LaraMiscAnim_H_Xian] =
new() { TR2LevelNames.FLOATER, TR2LevelNames.LAIR },
[TR2Type.LaraMiscAnim_H_HSH] =
new() { TR2LevelNames.HOME }
},
[TR2Type.Barracuda] = new()
{
[TR2Type.BarracudaIce] =
Expand Down

0 comments on commit 5d62ed2

Please sign in to comment.