Skip to content

Commit

Permalink
Fix texture corruption
Browse files Browse the repository at this point in the history
  • Loading branch information
lahm86 committed Jun 17, 2024
1 parent 2551656 commit 6852961
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions TRRandomizerCore/Randomizers/Shared/TextureAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ Dictionary<T, R> AllocateLevel(TRRScriptedLevel level, TRGData trgData)
else if (Settings.TextureMode == TextureMode.Game)
{
TRRScriptedLevel nextLevel = levelSwaps[levels.IndexOf(level)];
baseTextures.AddRange(textureCache[nextLevel]);
newTextures = textureCache[nextLevel];

while (newTextures.Count < trgData.Textures.Count)
List<ushort> textureSet = textureCache[nextLevel].RandomSelection(Generator,
Math.Min(trgData.Textures.Count, textureCache[nextLevel].Count));
while (textureSet.Count < trgData.Textures.Count)
{
newTextures.Add(newTextures.RandomItem(Generator));
textureSet.Add(textureCache[nextLevel].RandomItem(Generator));
}

baseTextures.AddRange(textureCache[nextLevel]);
newTextures.AddRange(textureSet);
}
else
{
Expand Down

0 comments on commit 6852961

Please sign in to comment.