Skip to content

Commit

Permalink
Retain prisoners in TR3R
Browse files Browse the repository at this point in the history
Resolves #739.
  • Loading branch information
lahm86 committed Aug 9, 2024
1 parent a2fe77f commit 099997b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- fixed secrets in 40 Fathoms all generally appearing too close to the start of the level (#729)
- fixed the Jade secret appearing before the Stone in TR2R Floating Islands (#729)
- fixed being unable to collect secret artefacts in TR3R High Security Compound (#737)
- fixed (the lack of) prisoners in Area51 crashing the game when loading a save (#739)
- improved data integrity checks when opening a folder and prior to randomization (#719)

## [V1.9.1](https://github.com/LostArtefacts/TR-Rando/compare/V1.9.0...V1.9.1) - 2024-06-23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected override void StartImpl()
List<TR3CombinedLevel> levels = new(_enemyMapping.Keys);
foreach (TR3CombinedLevel level in levels)
{
_enemyMapping[level] = _outer._allocator.SelectCrossLevelEnemies(level.Name, level.Data, level.Sequence);
_enemyMapping[level] = _outer._allocator.SelectCrossLevelEnemies(level.Name, level.Data, level.Sequence, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected override void StartImpl()
List<TR3RCombinedLevel> levels = new(_enemyMapping.Keys);
foreach (TR3RCombinedLevel level in levels)
{
_enemyMapping[level] = _outer._allocator.SelectCrossLevelEnemies(level.Name, level.Data, level.Sequence);
_enemyMapping[level] = _outer._allocator.SelectCrossLevelEnemies(level.Name, level.Data, level.Sequence, true);
}
}

Expand Down
14 changes: 13 additions & 1 deletion TRRandomizerCore/Randomizers/TR3/Shared/TR3EnemyAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override Dictionary<TR3Type, List<int>> GetRestrictedRooms(string leve
protected override bool IsOneShotType(TR3Type type)
=> _oneShotEnemies.Contains(type);

public EnemyTransportCollection<TR3Type> SelectCrossLevelEnemies(string levelName, TR3Level level, int levelSequence)
public EnemyTransportCollection<TR3Type> SelectCrossLevelEnemies(string levelName, TR3Level level, int levelSequence, bool remastered)
{
if (levelName == TR3LevelNames.ASSAULT)
{
Expand Down Expand Up @@ -76,6 +76,18 @@ public EnemyTransportCollection<TR3Type> SelectCrossLevelEnemies(string levelNam
}
}

if (remastered && (levelName == TR3LevelNames.HSC || levelName == TR3LevelNames.AREA51))
{
// TRR prisoners have to remain because of (presumably) the way the game fixes them not being friendly.
if (!newTypes.Contains(TR3Type.Prisoner))
{
newTypes.Add(TR3Type.Prisoner);
}

level.Entities.FindAll(e => e.TypeID == TR3Type.Prisoner)
.ForEach(e => ItemFactory.LockItem(levelName, level.Entities.IndexOf(e)));
}

foreach (int itemIndex in ItemFactory.GetLockedItems(levelName))
{
TR3Entity item = level.Entities[itemIndex];
Expand Down

0 comments on commit 099997b

Please sign in to comment.