From 40da7918a872e4feca6584742495ad8616062363 Mon Sep 17 00:00:00 2001 From: lahm86 <33758420+lahm86@users.noreply.github.com> Date: Fri, 31 May 2024 15:45:23 +0100 Subject: [PATCH 1/2] Update UI --- .../Model/BoolItemControlClass.cs | 2 + TRRandomizerView/Model/ControllerOptions.cs | 111 ++++-- TRRandomizerView/Model/OptionGenerator.cs | 5 - TRRandomizerView/Windows/AdvancedWindow.xaml | 327 ++++++------------ .../Windows/AdvancedWindow.xaml.cs | 55 --- 5 files changed, 198 insertions(+), 302 deletions(-) diff --git a/TRRandomizerView/Model/BoolItemControlClass.cs b/TRRandomizerView/Model/BoolItemControlClass.cs index 1680c22fb..26904ba28 100644 --- a/TRRandomizerView/Model/BoolItemControlClass.cs +++ b/TRRandomizerView/Model/BoolItemControlClass.cs @@ -41,6 +41,8 @@ public bool IsActive public string Title { get; set; } public string Description { get; set; } + public string HelpURL { get; set; } + public bool HasHelpURL => HelpURL != null; public event PropertyChangedEventHandler PropertyChanged; diff --git a/TRRandomizerView/Model/ControllerOptions.cs b/TRRandomizerView/Model/ControllerOptions.cs index 79d476844..8feb6a90c 100644 --- a/TRRandomizerView/Model/ControllerOptions.cs +++ b/TRRandomizerView/Model/ControllerOptions.cs @@ -38,7 +38,7 @@ public class ControllerOptions : INotifyPropertyChanged private bool _useRewardRoomCameras; private uint _minSecretCount, _maxSecretCount; private BoolItemControlClass _includeKeyItems, _allowReturnPathLocations, _includeExtraPickups, _randomizeItemTypes, _randomizeItemLocations, _allowEnemyKeyDrops, _maintainKeyContinuity, _oneItemDifficulty; - private BoolItemControlClass _crossLevelEnemies, _protectMonks, _docileWillard, _swapEnemyAppearance, _allowEmptyEggs, _hideEnemies, _removeLevelEndingLarson, _giveUnarmedItems; + private BoolItemControlClass _crossLevelEnemies, _protectMonks, _docileWillard, _swapEnemyAppearance, _allowEmptyEggs, _hideEnemies, _removeLevelEndingLarson, _giveUnarmedItems, _unrestrictedEnemyDifficulty; private BoolItemControlClass _persistTextures, _randomizeWaterColour, _retainLevelTextures, _retainKeySpriteTextures, _retainSecretSpriteTextures, _retainEnemyTextures, _retainLaraTextures; private BoolItemControlClass _changeAmbientTracks, _includeBlankTracks, _changeTriggerTracks, _separateSecretTracks, _changeWeaponSFX, _changeCrashSFX, _changeEnemySFX, _changeDoorSFX, _linkCreatureSFX, _randomizeWibble; private BoolItemControlClass _persistOutfits, _removeRobeDagger, _allowGymOutfit; @@ -90,13 +90,18 @@ public class ControllerOptions : INotifyPropertyChanged private List _selectableEnemies; private bool _useEnemyExclusions, _showExclusionWarnings; - private RandoDifficulty _randoEnemyDifficulty; + private ItemRange[] _itemRanges; private ItemRange _keyItemRange; + + private GlobeDisplayOption[] _globeDisplayOptions; private GlobeDisplayOption _globeDisplayOption; + + private BirdMonsterBehaviour[] _birdMonsterBehaviours; private BirdMonsterBehaviour _birdMonsterBehaviour; + + private DragonSpawnType[] _dragonSpawnTypes; private DragonSpawnType _dragonSpawnType; - private ItemRange[] _itemRanges; private Language[] _availableLanguages; private Language _gameStringLanguage; @@ -1096,6 +1101,16 @@ public GlobeDisplayOption GlobeDisplay } } + public GlobeDisplayOption[] GlobeDisplayOptions + { + get => _globeDisplayOptions; + private set + { + _globeDisplayOptions = value; + FirePropertyChanged(); + } + } + public int LevelSequencingSeed { get => _gameModeControl.Seed; @@ -2455,6 +2470,16 @@ public BirdMonsterBehaviour BirdMonsterBehaviour } } + public BirdMonsterBehaviour[] BirdMonsterBehaviours + { + get => _birdMonsterBehaviours; + private set + { + _birdMonsterBehaviours = value; + FirePropertyChanged(); + } + } + public DragonSpawnType DragonSpawnType { get => _dragonSpawnType; @@ -2465,6 +2490,16 @@ public DragonSpawnType DragonSpawnType } } + public DragonSpawnType[] DragonSpawnTypes + { + get => _dragonSpawnTypes; + private set + { + _dragonSpawnTypes = value; + FirePropertyChanged(); + } + } + public BoolItemControlClass SwapEnemyAppearance { get => _swapEnemyAppearance; @@ -2515,12 +2550,12 @@ public BoolItemControlClass GiveUnarmedItems } } - public RandoDifficulty RandoEnemyDifficulty + public BoolItemControlClass UnrestrictedEnemyDifficulty { - get => _randoEnemyDifficulty; + get => _unrestrictedEnemyDifficulty; set { - _randoEnemyDifficulty = value; + _unrestrictedEnemyDifficulty = value; FirePropertyChanged(); } } @@ -3099,6 +3134,13 @@ public ControllerOptions() Description = "If a level is unarmed, give extra ammo, medipacks and a weapon other than the pistols (based on enemy difficulty)." }; BindingOperations.SetBinding(GiveUnarmedItems, BoolItemControlClass.IsActiveProperty, randomizeEnemiesBinding); + UnrestrictedEnemyDifficulty = new() + { + Title = "Unrestricted difficulty", + Description = "Disables virtually all cross-level enemy restrictions except for technical ones.", + HelpURL = "https://github.com/LostArtefacts/TR-Rando/blob/master/Resources/Documentation/ENEMIES.md", + }; + BindingOperations.SetBinding(UnrestrictedEnemyDifficulty, BoolItemControlClass.IsActiveProperty, randomizeEnemiesBinding); // Textures Binding randomizeTexturesBinding = new(nameof(RandomizeTextures)) { Source = this }; @@ -3339,52 +3381,78 @@ public ControllerOptions() { _randomizeLevelSequencing }; - SecretBoolItemControls = new List() + SecretBoolItemControls = new() { _isHardSecrets, _allowGlitched, _guaranteeSecrets, _useRandomSecretModels }; - ItemBoolItemControls = new List() + ItemBoolItemControls = new() { _randomizeItemTypes, _randomizeItemLocations, _includeKeyItems, _allowReturnPathLocations, _allowEnemyKeyDrops, _oneItemDifficulty, _maintainKeyContinuity, _includeExtraPickups }; - EnemyBoolItemControls = new List() + EnemyBoolItemControls = new() { - _crossLevelEnemies, _docileWillard, _protectMonks, _swapEnemyAppearance, _allowEmptyEggs, _hideEnemies, _removeLevelEndingLarson, _giveUnarmedItems,_allowEnemyKeyDrops + _crossLevelEnemies, _docileWillard, _protectMonks, _swapEnemyAppearance, _allowEmptyEggs, _hideEnemies, _removeLevelEndingLarson, _giveUnarmedItems,_allowEnemyKeyDrops, _unrestrictedEnemyDifficulty }; - TextureBoolItemControls = new List() + TextureBoolItemControls = new() { _persistTextures, _randomizeWaterColour, _retainLevelTextures, _retainLaraTextures, _retainEnemyTextures, _retainKeySpriteTextures, _retainSecretSpriteTextures }; - AudioBoolItemControls = new List() + AudioBoolItemControls = new() { _changeAmbientTracks, _includeBlankTracks, _changeTriggerTracks, _separateSecretTracks, _changeWeaponSFX, _changeCrashSFX, _changeEnemySFX, _changeDoorSFX, _linkCreatureSFX, _randomizeWibble }; - OutfitBoolItemControls = new List() + OutfitBoolItemControls = new() { _persistOutfits, _removeRobeDagger, _allowGymOutfit }; - TextBoolItemControls = new List + TextBoolItemControls = new() { _retainKeyItemNames, _retainLevelNames }; - StartBoolItemControls = new List + StartBoolItemControls = new() { _rotateStartPosition }; - EnvironmentBoolItemControls = new List + EnvironmentBoolItemControls = new() { _randomizeWaterLevels, _randomizeSlotPositions, _randomizeLadders, _randomizeTraps, _randomizeChallengeRooms, _hardEnvironmentMode, _blockShortcuts }; - HealthBoolItemControls = new List + HealthBoolItemControls = new() { _disableHealingBetweenLevels, _disableMedpacks }; - WeatherBoolItemControls = new List + WeatherBoolItemControls = new() { _rainyAssaultCourse, _snowyAssaultCourse, _coldAssaultCourse }; + + IEnumerable controls = GameOrderBoolItemControls + .Concat(SecretBoolItemControls) + .Concat(ItemBoolItemControls) + .Concat(EnemyBoolItemControls) + .Concat(TextureBoolItemControls) + .Concat(AudioBoolItemControls) + .Concat(OutfitBoolItemControls) + .Concat(TextureBoolItemControls) + .Concat(StartBoolItemControls) + .Concat(EnvironmentBoolItemControls) + .Concat(HealthBoolItemControls) + .Concat(WeatherBoolItemControls); + + foreach (BoolItemControlClass control in controls) + { + control.PropertyChanged += BoolControl_PropertyChanged; + } + } + + private void BoolControl_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(BoolItemControlClass.Value)) + { + FirePropertyChanged(e.PropertyName); + } } private void IncludeKeyItems_PropertyChanged(object sender, PropertyChangedEventArgs e) @@ -3456,6 +3524,7 @@ public void Load(TRRandomizerController controller) RandomizeLevelSequencing.Value = _controller.RandomizeSequencing; LevelSequencingSeed = _controller.LevelSequencingSeed; PlayableLevelCount = _controller.PlayableLevelCount; + GlobeDisplayOptions = Enum.GetValues(); GlobeDisplay = _controller.GlobeDisplay; RandomizeUnarmedLevels = _controller.RandomizeUnarmedLevels; @@ -3543,14 +3612,16 @@ public void Load(TRRandomizerController controller) CrossLevelEnemies.Value = _controller.CrossLevelEnemies; ProtectMonks.Value = _controller.ProtectMonks; DocileWillard.Value = _controller.DocileWillard; + BirdMonsterBehaviours = Enum.GetValues(); BirdMonsterBehaviour = _controller.BirdMonsterBehaviour; + DragonSpawnTypes = Enum.GetValues(); DragonSpawnType = _controller.DragonSpawnType; SwapEnemyAppearance.Value = _controller.SwapEnemyAppearance; AllowEmptyEggs.Value = _controller.AllowEmptyEggs; HideEnemies.Value = _controller.HideEnemiesUntilTriggered; RemoveLevelEndingLarson.Value = _controller.RemoveLevelEndingLarson; GiveUnarmedItems.Value = _controller.GiveUnarmedItems; - RandoEnemyDifficulty = _controller.RandoEnemyDifficulty; + UnrestrictedEnemyDifficulty.Value = _controller.RandoEnemyDifficulty == RandoDifficulty.NoRestrictions; UseEnemyExclusions = _controller.UseEnemyExclusions; ShowExclusionWarnings = _controller.ShowExclusionWarnings; LoadEnemyExclusions(); @@ -3859,7 +3930,7 @@ public void Save() _controller.HideEnemiesUntilTriggered = HideEnemies.Value; _controller.RemoveLevelEndingLarson = RemoveLevelEndingLarson.Value; _controller.GiveUnarmedItems = GiveUnarmedItems.Value; - _controller.RandoEnemyDifficulty = RandoEnemyDifficulty; + _controller.RandoEnemyDifficulty = UnrestrictedEnemyDifficulty.Value ? RandoDifficulty.NoRestrictions : RandoDifficulty.Default; _controller.UseEnemyExclusions = UseEnemyExclusions; _controller.ShowExclusionWarnings = ShowExclusionWarnings; diff --git a/TRRandomizerView/Model/OptionGenerator.cs b/TRRandomizerView/Model/OptionGenerator.cs index 7f6f0a92d..afd7cbdcc 100644 --- a/TRRandomizerView/Model/OptionGenerator.cs +++ b/TRRandomizerView/Model/OptionGenerator.cs @@ -272,11 +272,6 @@ private void RandomizeItemOptions() private void RandomizeEnemyOptions() { RandomizeBoolItems(_options.EnemyBoolItemControls); - do - { - _options.RandoEnemyDifficulty = GetRandomEnumValue(typeof(RandoDifficulty)); - } - while (_options.RandoEnemyDifficulty == RandoDifficulty.DefaultOrNoRestrictions); // Used internally only and is not a UI option if (_options.IsBirdMonsterBehaviourTypeSupported) { _options.BirdMonsterBehaviour = GetRandomEnumValue(typeof(BirdMonsterBehaviour)); diff --git a/TRRandomizerView/Windows/AdvancedWindow.xaml b/TRRandomizerView/Windows/AdvancedWindow.xaml index 1ef0544b0..213ff6d51 100644 --- a/TRRandomizerView/Windows/AdvancedWindow.xaml +++ b/TRRandomizerView/Windows/AdvancedWindow.xaml @@ -14,7 +14,6 @@ ShowInTaskbar="False" SizeToContent="WidthAndHeight" Loaded="Window_Loaded" - IsVisibleChanged="Window_IsVisibleChanged" Closing="Window_Closing" Title="Advanced"> @@ -95,7 +94,6 @@ - @@ -166,25 +164,40 @@ - - - - + + + @@ -370,69 +383,39 @@ - - - - + + - - - - - - - - - - - - - - - @@ -447,118 +430,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - @@ -597,7 +502,7 @@ - - - - - - - @@ -1061,63 +966,41 @@ - - - - + + - - - - - - - - - - - - - - - - - - - @@ -1469,7 +1352,7 @@ - - - @@ -1732,7 +1615,7 @@ - Date: Fri, 31 May 2024 15:54:31 +0100 Subject: [PATCH 2/2] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fc31ecdd..313b16ce4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - fixed a key item softlock in Crash Site (#662) - fixed incorrect item and mesh positions in Home Sweet Home when mirrored (#676) - fixed uncontrolled SFX in gym/assault course levels not being linked to the correct setting (#684) +- improved the layout of some options in the UI (#694) ## [V1.8.4](https://github.com/LostArtefacts/TR-Rando/compare/V1.8.3...V1.8.4) - 2024-02-12 - fixed item locking logic so that secrets that rely on specific enemies will always be obtainable (#570)