Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UI #695

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions TRRandomizerView/Model/BoolItemControlClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
111 changes: 91 additions & 20 deletions TRRandomizerView/Model/ControllerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -90,13 +90,18 @@ public class ControllerOptions : INotifyPropertyChanged
private List<BoolItemIDControlClass> _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;

Expand Down Expand Up @@ -1096,6 +1101,16 @@ public GlobeDisplayOption GlobeDisplay
}
}

public GlobeDisplayOption[] GlobeDisplayOptions
{
get => _globeDisplayOptions;
private set
{
_globeDisplayOptions = value;
FirePropertyChanged();
}
}

public int LevelSequencingSeed
{
get => _gameModeControl.Seed;
Expand Down Expand Up @@ -2455,6 +2470,16 @@ public BirdMonsterBehaviour BirdMonsterBehaviour
}
}

public BirdMonsterBehaviour[] BirdMonsterBehaviours
{
get => _birdMonsterBehaviours;
private set
{
_birdMonsterBehaviours = value;
FirePropertyChanged();
}
}

public DragonSpawnType DragonSpawnType
{
get => _dragonSpawnType;
Expand All @@ -2465,6 +2490,16 @@ public DragonSpawnType DragonSpawnType
}
}

public DragonSpawnType[] DragonSpawnTypes
{
get => _dragonSpawnTypes;
private set
{
_dragonSpawnTypes = value;
FirePropertyChanged();
}
}

public BoolItemControlClass SwapEnemyAppearance
{
get => _swapEnemyAppearance;
Expand Down Expand Up @@ -2515,12 +2550,12 @@ public BoolItemControlClass GiveUnarmedItems
}
}

public RandoDifficulty RandoEnemyDifficulty
public BoolItemControlClass UnrestrictedEnemyDifficulty
{
get => _randoEnemyDifficulty;
get => _unrestrictedEnemyDifficulty;
set
{
_randoEnemyDifficulty = value;
_unrestrictedEnemyDifficulty = value;
FirePropertyChanged();
}
}
Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -3339,52 +3381,78 @@ public ControllerOptions()
{
_randomizeLevelSequencing
};
SecretBoolItemControls = new List<BoolItemControlClass>()
SecretBoolItemControls = new()
{
_isHardSecrets, _allowGlitched, _guaranteeSecrets, _useRandomSecretModels
};
ItemBoolItemControls = new List<BoolItemControlClass>()
ItemBoolItemControls = new()
{
_randomizeItemTypes, _randomizeItemLocations, _includeKeyItems, _allowReturnPathLocations, _allowEnemyKeyDrops, _oneItemDifficulty, _maintainKeyContinuity, _includeExtraPickups
};
EnemyBoolItemControls = new List<BoolItemControlClass>()
EnemyBoolItemControls = new()
{
_crossLevelEnemies, _docileWillard, _protectMonks, _swapEnemyAppearance, _allowEmptyEggs, _hideEnemies, _removeLevelEndingLarson, _giveUnarmedItems,_allowEnemyKeyDrops
_crossLevelEnemies, _docileWillard, _protectMonks, _swapEnemyAppearance, _allowEmptyEggs, _hideEnemies, _removeLevelEndingLarson, _giveUnarmedItems,_allowEnemyKeyDrops, _unrestrictedEnemyDifficulty
};
TextureBoolItemControls = new List<BoolItemControlClass>()
TextureBoolItemControls = new()
{
_persistTextures, _randomizeWaterColour, _retainLevelTextures, _retainLaraTextures, _retainEnemyTextures, _retainKeySpriteTextures, _retainSecretSpriteTextures
};
AudioBoolItemControls = new List<BoolItemControlClass>()
AudioBoolItemControls = new()
{
_changeAmbientTracks, _includeBlankTracks, _changeTriggerTracks, _separateSecretTracks, _changeWeaponSFX,
_changeCrashSFX, _changeEnemySFX, _changeDoorSFX, _linkCreatureSFX, _randomizeWibble
};
OutfitBoolItemControls = new List<BoolItemControlClass>()
OutfitBoolItemControls = new()
{
_persistOutfits, _removeRobeDagger, _allowGymOutfit
};
TextBoolItemControls = new List<BoolItemControlClass>
TextBoolItemControls = new()
{
_retainKeyItemNames, _retainLevelNames
};
StartBoolItemControls = new List<BoolItemControlClass>
StartBoolItemControls = new()
{
_rotateStartPosition
};
EnvironmentBoolItemControls = new List<BoolItemControlClass>
EnvironmentBoolItemControls = new()
{
_randomizeWaterLevels, _randomizeSlotPositions, _randomizeLadders, _randomizeTraps,
_randomizeChallengeRooms, _hardEnvironmentMode, _blockShortcuts
};
HealthBoolItemControls = new List<BoolItemControlClass>
HealthBoolItemControls = new()
{
_disableHealingBetweenLevels, _disableMedpacks
};
WeatherBoolItemControls = new List<BoolItemControlClass>
WeatherBoolItemControls = new()
{
_rainyAssaultCourse, _snowyAssaultCourse, _coldAssaultCourse
};

IEnumerable<BoolItemControlClass> 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)
Expand Down Expand Up @@ -3456,6 +3524,7 @@ public void Load(TRRandomizerController controller)
RandomizeLevelSequencing.Value = _controller.RandomizeSequencing;
LevelSequencingSeed = _controller.LevelSequencingSeed;
PlayableLevelCount = _controller.PlayableLevelCount;
GlobeDisplayOptions = Enum.GetValues<GlobeDisplayOption>();
GlobeDisplay = _controller.GlobeDisplay;

RandomizeUnarmedLevels = _controller.RandomizeUnarmedLevels;
Expand Down Expand Up @@ -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>();
BirdMonsterBehaviour = _controller.BirdMonsterBehaviour;
DragonSpawnTypes = Enum.GetValues<DragonSpawnType>();
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();
Expand Down Expand Up @@ -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;

Expand Down
5 changes: 0 additions & 5 deletions TRRandomizerView/Model/OptionGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,6 @@ private void RandomizeItemOptions()
private void RandomizeEnemyOptions()
{
RandomizeBoolItems(_options.EnemyBoolItemControls);
do
{
_options.RandoEnemyDifficulty = GetRandomEnumValue<RandoDifficulty>(typeof(RandoDifficulty));
}
while (_options.RandoEnemyDifficulty == RandoDifficulty.DefaultOrNoRestrictions); // Used internally only and is not a UI option
if (_options.IsBirdMonsterBehaviourTypeSupported)
{
_options.BirdMonsterBehaviour = GetRandomEnumValue<BirdMonsterBehaviour>(typeof(BirdMonsterBehaviour));
Expand Down
Loading
Loading