Skip to content

Commit

Permalink
Fix TR3 no-secret levels
Browse files Browse the repository at this point in the history
Regression from #681.
  • Loading branch information
lahm86 committed May 30, 2024
1 parent bb10647 commit dc07dc1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion TRRandomizerCore/Randomizers/Shared/SecretArtefactPlacer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ public void InitialiseLevel(TRGameVersion version,
_sectorGetter = sectorGetter;
_sectorEntityTester = sectorEntityTester;

foreach (TRRoomSector sector in _rooms.SelectMany(r => r.Sectors))
RemoveDefaultSecrets(_rooms, _floorData);
}

public void RemoveDefaultSecrets<R>(List<R> rooms, FDControl floorData)
where R : TRRoom
{
foreach (TRRoomSector sector in rooms.SelectMany(r => r.Sectors))
{
if (sector.FDIndex == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,10 @@ internal void ApplyRandomization()
// Convert the placeholder reward room into an actual room now that secrets are positioned.
_outer.ActualiseRewardRoom(level, rewardRoom);
}
else if (!level.HasSecrets)
{
_outer._placer.RemoveDefaultSecrets(level.Data.Rooms, level.Data.FloorData);
}

_outer.SaveLevel(level);

Expand Down

0 comments on commit dc07dc1

Please sign in to comment.