Skip to content

Commit

Permalink
LostArtefacts#314 Enemy Meshes
Browse files Browse the repository at this point in the history
If enemies take on Lara's appearance, we don't target them for texture randomization (can cause issues with Lara's model). Also reduces the enemy count for Floaters as we can't remove the existing Marco model because of precompiled deduplication (classic Floater texture bug).
  • Loading branch information
lahm86 committed Apr 26, 2022
1 parent fb5b8fe commit 00469c1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ protected override void ProcessRemovals(AbstractTexturePacker<TR2Entities, TR2Le
removals.Add(TR2Entities.Map_M_U);
}

// Marco is in Floaters by default but he isn't used. Get rid of him to free up space.
List<TRModel> models = _level.Models.ToList();
if (models.Find(m => m.ID == (uint)TR2Entities.MarcoBartoli) != null && models.Find(m => m.ID == (uint)TR2Entities.DragonBack_H) == null)
{
removals.Add(TR2Entities.MarcoBartoli);
}
// Marco is in Floaters by default but he isn't used. Removing the textures will break precompiled deduplication
// so this remains unimplemented for the time being.
//List<TRModel> models = _level.Models.ToList();
//if (models.Find(m => m.ID == (uint)TR2Entities.MarcoBartoli) != null && models.Find(m => m.ID == (uint)TR2Entities.DragonBack_H) == null)
//{
// removals.Add(TR2Entities.MarcoBartoli);
//}

if (_entitiesToRemove != null)
{
Expand Down
3 changes: 3 additions & 0 deletions TRRandomizerCore/Randomizers/TR2/TR2EnemyRandomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,9 @@ private void RandomizeEnemyMeshes(TR2CombinedLevel level, EnemyRandomizationColl
enemyModel.StartingMesh = laraModel.StartingMesh;
enemyModel.NumMeshes = laraModel.NumMeshes;
}

// Remove texture randomization for this enemy as it's no longer required
TextureMonitor.ClearMonitor(level.Name, laraClones);
}

if (enemies.All.Contains(TR2Entities.MarcoBartoli)
Expand Down
4 changes: 4 additions & 0 deletions TRRandomizerCore/Textures/Monitoring/TextureMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public void RemoveSources(IEnumerable<StaticTextureSource<E>> sources)
foreach (StaticTextureSource<E> source in sources)
{
_entitySources.Remove(source);
if (PreparedLevelMapping != null && PreparedLevelMapping.ContainsKey(source))
{
PreparedLevelMapping.Remove(source);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion TRRandomizerCore/Utilities/TR2EnemyUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ static TR2EnemyUtilities()
[TR2LevelNames.BARTOLI] = -2,
[TR2LevelNames.OPERA] = -2,
[TR2LevelNames.DA] = -1,
[TR2LevelNames.TIBET] = -1
[TR2LevelNames.TIBET] = -1,
[TR2LevelNames.FLOATER] = -1,
}
};

Expand Down

0 comments on commit 00469c1

Please sign in to comment.