Skip to content

Commit a60dc27

Browse files
committed
Add option to remove TR3 crystals
1 parent a7ea993 commit a60dc27

8 files changed

Lines changed: 52 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## [Unreleased](https://github.com/LostArtefacts/TR-Rando/compare/V1.11.0...master) - xxxx-xx-xx
2+
- added an option to remove crystals in classic TR3
23

34
## [V1.11.0](https://github.com/LostArtefacts/TR-Rando/compare/V1.10.2...V1.11.0) - 2025-10-05
45
- added support for TR1X 4.15 (now the minimum version supported) (#803)

TRRandomizerCore/Editors/RandomizerSettings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public class RandomizerSettings
149149
public bool AutoLaunchGame { get; set; }
150150
public bool AddReturnPaths { get; set; }
151151
public bool FixOGBugs { get; set; }
152+
public bool RemoveCrystals { get; set; }
152153

153154
public bool RandomizeItemTypes { get; set; }
154155
public bool RandomizeItemPositions { get; set; }
@@ -343,6 +344,7 @@ public void ApplyConfig(Config config)
343344
AutoLaunchGame = config.GetBool(nameof(AutoLaunchGame));
344345
AddReturnPaths = config.GetBool(nameof(AddReturnPaths), true);
345346
FixOGBugs = config.GetBool(nameof(FixOGBugs), true);
347+
RemoveCrystals = config.GetBool(nameof(RemoveCrystals));
346348

347349
RandomizeSecretRewardsPhysical = config.GetBool(nameof(RandomizeSecretRewardsPhysical));
348350
SecretRewardsPhysicalSeed = config.GetInt(nameof(SecretRewardsPhysicalSeed), defaultSeed);
@@ -515,6 +517,7 @@ public void StoreConfig(Config config)
515517
config[nameof(AutoLaunchGame)] = AutoLaunchGame;
516518
config[nameof(AddReturnPaths)] = AddReturnPaths;
517519
config[nameof(FixOGBugs)] = FixOGBugs;
520+
config[nameof(RemoveCrystals)] = RemoveCrystals;
518521

519522
config[nameof(RandomizeSecretRewardsPhysical)] = RandomizeSecretRewardsPhysical;
520523
config[nameof(SecretRewardsPhysicalSeed)] = SecretRewardsPhysicalSeed;

TRRandomizerCore/Processors/TR3/TR3SequenceProcessor.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,19 @@ private void AdjustLevel(TR3CombinedLevel level)
148148
}
149149
}
150150
}
151+
152+
if (Settings.RemoveCrystals)
153+
{
154+
for (int i = 0; i < level.Data.Entities.Count; i++)
155+
{
156+
var item = level.Data.Entities[i];
157+
if (item.TypeID == TR3Type.SaveCrystal_P)
158+
{
159+
item.TypeID = TR3Type.LookAtItem_H;
160+
ItemFactory.FreeItem(level.Name, i);
161+
}
162+
}
163+
}
151164
}
152165

153166
private void ImportUPV(TR3CombinedLevel level)

TRRandomizerCore/TRRandomizerController.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,12 @@ public bool FixOGBugs
12111211
set => LevelRandomizer.FixOGBugs = value;
12121212
}
12131213

1214+
public bool RemoveCrystals
1215+
{
1216+
get => LevelRandomizer.RemoveCrystals;
1217+
set => LevelRandomizer.RemoveCrystals = value;
1218+
}
1219+
12141220
public bool RandomizeVfx
12151221
{
12161222
get => LevelRandomizer.RandomizeVfx;

TRRandomizerCore/TRRandomizerType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,5 @@ public enum TRRandomizerType
7171
Wireframe,
7272
HideDeadTrexes,
7373
Vehicles,
74+
RemoveCrystals,
7475
}

TRRandomizerCore/TRVersionSupport.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ internal class TRVersionSupport
180180
TRRandomizerType.LevelSequence,
181181
TRRandomizerType.NightMode,
182182
TRRandomizerType.Outfit,
183+
TRRandomizerType.RemoveCrystals,
183184
TRRandomizerType.ReturnPaths,
184185
TRRandomizerType.RewardRooms,
185186
TRRandomizerType.Secret,

TRRandomizerView/Model/ControllerOptions.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ControllerOptions : INotifyPropertyChanged
2828

2929
private GameMode _gameMode;
3030
private GameMode[] _gameModes;
31-
private bool _addReturnPaths, _fixOGBugs, _disableDemos, _autoLaunchGame;
31+
private bool _addReturnPaths, _fixOGBugs, _disableDemos, _autoLaunchGame, _removeCrystals;
3232

3333
private BoolItemControlClass _randomizeLevelSequencing;
3434
private BoolItemControlClass _isHardSecrets, _allowGlitched, _guaranteeSecrets, _useRandomSecretModels, _enableUWCornerSecrets;
@@ -1548,6 +1548,16 @@ public bool FixOGBugs
15481548
}
15491549
}
15501550

1551+
public bool RemoveCrystals
1552+
{
1553+
get => _removeCrystals;
1554+
set
1555+
{
1556+
_removeCrystals = value;
1557+
FirePropertyChanged();
1558+
}
1559+
}
1560+
15511561
public bool DisableDemos
15521562
{
15531563
get => _disableDemos;
@@ -3056,6 +3066,7 @@ public void Load(TRRandomizerController controller)
30563066
AutoLaunchGame = _controller.AutoLaunchGame;
30573067
AddReturnPaths = _controller.AddReturnPaths;
30583068
FixOGBugs = _controller.FixOGBugs;
3069+
RemoveCrystals = _controller.RemoveCrystals;
30593070

30603071
SpriteRandoModes = Enum.GetValues<SpriteRandoMode>();
30613072
SpriteRandoMode = _controller.SpriteRandoMode;
@@ -3289,6 +3300,7 @@ public void Save()
32893300
_controller.AutoLaunchGame = AutoLaunchGame;
32903301
_controller.AddReturnPaths = AddReturnPaths;
32913302
_controller.FixOGBugs = FixOGBugs;
3303+
_controller.RemoveCrystals = RemoveCrystals;
32923304

32933305
_controller.SpriteRandoMode = SpriteRandoMode;
32943306
_controller.RandomizeItemSprites = RandomizeItemSprites;
@@ -3373,6 +3385,7 @@ public void Unload()
33733385
public bool IsItemSpriteTypeSupported => IsRandomizationSupported(TRRandomizerType.ItemSprite);
33743386
public bool IsReturnPathsTypeSupported => IsRandomizationSupported(TRRandomizerType.ReturnPaths);
33753387
public bool IsGeneralBugFixesTypeSupported => IsRandomizationSupported(TRRandomizerType.GeneralBugFixes);
3388+
public bool IsRemoveCrystalsTypeSupported => IsRandomizationSupported(TRRandomizerType.RemoveCrystals);
33763389

33773390
private bool IsRandomizationSupported(TRRandomizerType randomizerType)
33783391
{

TRRandomizerView/Windows/GlobalSettingsWindow.xaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
<RowDefinition Height="Auto"/>
5555
<RowDefinition Height="Auto"/>
5656
<RowDefinition Height="Auto"/>
57+
<RowDefinition Height="Auto"/>
5758
</Grid.RowDefinitions>
5859
<Grid.ColumnDefinitions>
5960
<ColumnDefinition Width="Auto"/>
@@ -104,6 +105,18 @@
104105
Grid.Column="1"
105106
Visibility="{Binding IsGeneralBugFixesTypeSupported, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolToCollapsedConverter}}"
106107
Text="Fix original level bugs and oversights, such as missing textures or untriggered enemies."/>
108+
109+
<CheckBox
110+
Grid.Row="4"
111+
Visibility="{Binding IsRemoveCrystalsTypeSupported, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolToCollapsedConverter}}"
112+
IsChecked="{Binding RemoveCrystals, Mode=TwoWay}"
113+
Content="Remove crystals"/>
114+
<TextBlock
115+
Grid.Row="4"
116+
Grid.Column="1"
117+
Visibility="{Binding IsRemoveCrystalsTypeSupported, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolToCollapsedConverter}}">
118+
Removes all savegame/healing crystal items.
119+
</TextBlock>
107120
</Grid>
108121

109122
<Border

0 commit comments

Comments
 (0)