Skip to content

Commit

Permalink
Miscellaneous TRR fixes (#715)
Browse files Browse the repository at this point in the history
Resolves #712.
Resolves #713.
Resolves #714.
Resolves #716.
Resolves #717.
Resolves #718.
  • Loading branch information
lahm86 authored Jun 23, 2024
1 parent 484f6ef commit 362ca6b
Show file tree
Hide file tree
Showing 16 changed files with 292 additions and 21 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
## [Unreleased](https://github.com/LostArtefacts/TR-Rando/compare/V1.9.0...master) - xxxx-xx-xx
## [Unreleased](https://github.com/LostArtefacts/TR-Rando/compare/V1.9.1...master) - xxxx-xx-xx

## [V1.9.1](https://github.com/LostArtefacts/TR-Rando/compare/V1.9.0...V1.9.1) - 2024-06-23
- fixed a missing reference related to Willard, which would cause enemy randomization to fail if he was selected (#712)
- fixed the "show error folder" link in popup message windows not working (#713)
- fixed being unable to randomize enemies natively in TR1R (#716)
- fixed the key in Jungle appearing mid-air or inside walls (#717)
- fixed a pickup issue in Natla's Mines that could cause a crash (#718)
- restored the option to replace required enemies in TR1R (#714)

## [V1.9.0](https://github.com/LostArtefacts/TR-Rando/compare/V1.8.4...V1.9.0) - 2024-06-22
- added support for TR1X V4 (#626)
Expand Down
1 change: 1 addition & 0 deletions TRDataControl/Data/Remastered/TR3RDataCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public override TR3RAlias GetAlias(TR3Type key)
[TR3Type.TinnosWasp] = TR3LevelNames.TINNOS,

[TR3Type.Willie] = TR3LevelNames.WILLIE,
[TR3Type.AIPath_N] = TR3LevelNames.WILLIE,
[TR3Type.RXGunLad] = TR3LevelNames.WILLIE,

[TR3Type.Winston] = TR3LevelNames.ASSAULT,
Expand Down
1 change: 0 additions & 1 deletion TRRandomizerCore/Editors/TR1RemasteredEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ protected override void ApplyConfig(Config config)
Settings.AllowReturnPathLocations = false;
Settings.AddReturnPaths = false;
Settings.FixOGBugs = false;
Settings.ReplaceRequiredEnemies = false;
Settings.SwapEnemyAppearance = false;
Settings.SecretRewardMode = TRSecretRewardMode.Stack;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private void AddUnarmedLevelAmmo(TR1CombinedLevel level)
return;
}

_allocator.AddUnarmedLevelAmmo(level.Name, level.Data, (loc, type) =>
_allocator.AddUnarmedLevelAmmo(level.Name, level.Data, true, (loc, type) =>
{
level.Script.AddStartInventoryItem(ItemUtilities.ConvertToScriptItem(type));
});
Expand Down
17 changes: 14 additions & 3 deletions TRRandomizerCore/Randomizers/TR1/Remastered/TR1REnemyRandomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private void ApplyPostRandomization(TR1RCombinedLevel level, EnemyRandomizationC

private void UpdateAtlanteanPDP(TR1RCombinedLevel level, EnemyRandomizationCollection<TR1Type> enemies)
{
if (!enemies.Available.Contains(TR1Type.ShootingAtlantean_N) || level.PDPData.ContainsKey(TR1Type.ShootingAtlantean_N))
if (enemies == null || !enemies.Available.Contains(TR1Type.ShootingAtlantean_N) || level.PDPData.ContainsKey(TR1Type.ShootingAtlantean_N))
{
return;
}
Expand Down Expand Up @@ -167,7 +167,7 @@ private void AdjustTihocanEnding(TR1RCombinedLevel level)
level.Data.Entities.AddRange(TR1ItemAllocator.TihocanEndItems);
}

private static void AdjustScionEnding(TR1RCombinedLevel level)
private void AdjustScionEnding(TR1RCombinedLevel level)
{
if (level.Data.Models.ContainsKey(TR1Type.ScionPiece4_S_P)
&& (level.Data.Models.ContainsKey(TR1Type.TRex) || level.Data.Models.ContainsKey(TR1Type.Adam)))
Expand All @@ -176,6 +176,17 @@ private static void AdjustScionEnding(TR1RCombinedLevel level)
// but support for PDP isn't there yet.
level.PDPData.ChangeKey(TR1Type.ScionPiece4_S_P, TR1Type.ScionPiece3_S_P);
}
else if (level.Is(TR1LevelNames.QUALOPEC) && Settings.ReplaceRequiredEnemies)
{
// The scion must be shot to end the level - in OG, it's hidden and a Qualopec skeleton is the target;
// we can't add remastered meshes yet so we just add the actual scion so it's obvious, and make the sound
// effect from Pyramid available too.
TRDictionary<TR1Type, TRModel> pyramidPDP = _pdpControl.Read(Path.Combine(BackupPath, Path.ChangeExtension(TR1LevelNames.PYRAMID, ".PDP")));
level.PDPData[TR1Type.ScionPiece3_S_P] = pyramidPDP[TR1Type.ScionPiece3_S_P];

TR1Level pyramidLevel = _levelControl.Read(Path.Combine(BackupPath, TR1LevelNames.PYRAMID));
level.Data.SoundEffects[TR1SFX.ScionLoop] = pyramidLevel.SoundEffects[TR1SFX.ScionLoop];
}
}

private void AddUnarmedLevelAmmo(TR1RCombinedLevel level)
Expand All @@ -185,7 +196,7 @@ private void AddUnarmedLevelAmmo(TR1RCombinedLevel level)
return;
}

_allocator.AddUnarmedLevelAmmo(level.Name, level.Data, (loc, type) =>
_allocator.AddUnarmedLevelAmmo(level.Name, level.Data, false, (loc, type) =>
{
if (ItemFactory.CanCreateItem(level.Name, level.Data.Entities))
{
Expand Down
6 changes: 3 additions & 3 deletions TRRandomizerCore/Randomizers/TR1/Shared/TR1EnemyAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ private void AmendAtlanteanModels(TR1Level level, EnemyRandomizationCollection<T
}
}

public void AddUnarmedLevelAmmo(string levelName, TR1Level level, Action<Location, TR1Type> createItemCallback)
public void AddUnarmedLevelAmmo(string levelName, TR1Level level, bool changeWeapon, Action<Location, TR1Type> createItemCallback)
{
if (!Settings.CrossLevelEnemies || !Settings.GiveUnarmedItems)
{
Expand Down Expand Up @@ -783,7 +783,7 @@ public void AddUnarmedLevelAmmo(string levelName, TR1Level level, Action<Locatio
createItemCallback(weaponLocation, TR1Type.Pistols_S_P);
}

if (difficulty > EnemyDifficulty.Easy)
if (changeWeapon && difficulty > EnemyDifficulty.Easy)
{
while (weaponEntity.TypeID == TR1Type.Pistols_S_P)
{
Expand All @@ -793,7 +793,7 @@ public void AddUnarmedLevelAmmo(string levelName, TR1Level level, Action<Locatio

TR1Type weaponType = weaponEntity.TypeID;
int ammoAllocation = TR1EnemyUtilities.GetStartingAmmo(weaponType);
if (ammoAllocation > 0)
if (changeWeapon && ammoAllocation > 0)
{
ammoAllocation *= (int)difficulty;
TR1Type ammoType = TR1TypeUtilities.GetWeaponAmmo(weaponType);
Expand Down
10 changes: 10 additions & 0 deletions TRRandomizerCore/Randomizers/TR3/Remastered/TR3RItemRandomizer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using TRGE.Core;
using TRLevelControl;
using TRLevelControl.Helpers;
using TRLevelControl.Model;
using TRRandomizerCore.Helpers;
Expand Down Expand Up @@ -61,6 +62,15 @@ public void FinalizeRandomization()
_levelInstance.Script.OriginalSequence, _levelInstance.HasExposureMeter);
}

if (_levelInstance.Is(TR3LevelNames.JUNGLE)
&& _levelInstance.Data.Entities.Find(e => e.TypeID == TR3Type.Key4_P) is TR3Entity key)
{
// Counteract the shift done by the game in patch 3. Nudge it slightly further in case
// we land on an enemy.
key.X += TRConsts.Step2 * 3 + 1;
key.Z += TRConsts.Step2;
}

SaveLevelInstance();
}

Expand Down
Loading

0 comments on commit 362ca6b

Please sign in to comment.