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

TR2/3 Fixes #318

Merged
merged 3 commits into from
Mar 26, 2022
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 TRLevelReader/Model/TR2/Enums/TR2Entities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public enum TR2Entities
LaraMiscAnim_H_Xian, // Death-by-Guard, inspecting dagger
LaraMiscAnim_H_Wall, // Death-by-Barney
LaraMiscAnim_H_HSH, // Inspecting dagger at home
LaraMiscAnim_H_Venice, // Bartoli's detonator

// Split Lara's outfits and weapon animations
LaraSun = 3000,
Expand Down
2 changes: 1 addition & 1 deletion TRModelTransporter/Data/TR2DefaultDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public IEnumerable<int> GetIgnorableTextureIndices(TR2Entities entity)

[TR2Entities.LaraMiscAnim_H] = new List<TR2Entities>
{
TR2Entities.LaraMiscAnim_H_Wall, TR2Entities.LaraMiscAnim_H_Unwater, TR2Entities.LaraMiscAnim_H_Ice, TR2Entities.LaraMiscAnim_H_Xian, TR2Entities.LaraMiscAnim_H_HSH
TR2Entities.LaraMiscAnim_H_Wall, TR2Entities.LaraMiscAnim_H_Unwater, TR2Entities.LaraMiscAnim_H_Ice, TR2Entities.LaraMiscAnim_H_Xian, TR2Entities.LaraMiscAnim_H_HSH, TR2Entities.LaraMiscAnim_H_Venice
},

[TR2Entities.TigerOrSnowLeopard] = new List<TR2Entities>
Expand Down
50 changes: 36 additions & 14 deletions TRRandomizerCore/Randomizers/TR2/TR2EnemyRandomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -680,20 +680,42 @@ private void RandomizeEnemies(TR2CombinedLevel level, EnemyRandomizationCollecti

private void RandomizeEnemyMeshes(TR2CombinedLevel level, EnemyRandomizationCollection enemies)
{
// #314 A very primitive start to mixing-up enemy meshes - if we have both monk types, and we're
// not using docile chickens, make one set of monks become Lara.
if (Settings.CrossLevelEnemies
&& !Settings.DocileBirdMonsters
&& enemies.Available.Contains(TR2Entities.MonkWithKnifeStick)
&& enemies.Available.Contains(TR2Entities.MonkWithLongStick))
{
TR2Entities monkType = _generator.Next(0, 2) == 0 ? TR2Entities.MonkWithKnifeStick : TR2Entities.MonkWithLongStick;
List<TRModel> models = level.Data.Models.ToList();
TRModel laraModel = models.Find(m => m.ID == (uint)TR2Entities.Lara);
TRModel monkModel = models.Find(m => m.ID == (uint)monkType);
monkModel.MeshTree = laraModel.MeshTree;
monkModel.StartingMesh = laraModel.StartingMesh;
monkModel.NumMeshes = laraModel.NumMeshes;
// #314 A very primitive start to mixing-up enemy meshes - monks and yetis can take on Lara's meshes
// without manipulation, so add a random chance of this happening if any of these models are in place.
if (!Settings.CrossLevelEnemies)
{
return;
}

List<TR2Entities> laraClones = new List<TR2Entities>();
const int chance = 2;
if (!Settings.DocileBirdMonsters)
{
AddRandomLaraClone(enemies, TR2Entities.MonkWithKnifeStick, laraClones, chance);
AddRandomLaraClone(enemies, TR2Entities.MonkWithLongStick, laraClones, chance);
}

AddRandomLaraClone(enemies, TR2Entities.Yeti, laraClones, chance);

if (laraClones.Count > 0)
{
List<TRModel> levelModels = level.Data.Models.ToList();
TRModel laraModel = levelModels.Find(m => m.ID == (uint)TR2Entities.Lara);
foreach (TR2Entities enemyType in laraClones)
{
TRModel enemyModel = levelModels.Find(m => m.ID == (uint)enemyType);
enemyModel.MeshTree = laraModel.MeshTree;
enemyModel.StartingMesh = laraModel.StartingMesh;
enemyModel.NumMeshes = laraModel.NumMeshes;
}
}
}

private void AddRandomLaraClone(EnemyRandomizationCollection enemies, TR2Entities enemyType, List<TR2Entities> cloneCollection, int chance)
{
if (enemies.Available.Contains(enemyType) && _generator.Next(0, chance) == 0)
{
cloneCollection.Add(enemyType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,81 @@
"EMType": 45,
"EntityIndex": 182,
"NewEntityType": 137
},

{
"Comments": "There are hard-coded shenanigans for the missile blast, meaning it won't work in mirrored. So make it a dramatic medi pack instead, and make the beams other pickups.",
"EMType": 45,
"EntityIndex": 70,
"NewEntityType": 177
},
{
"EMType": 45,
"EntityIndex": 72,
"NewEntityType": 178
},
{
"EMType": 45,
"EntityIndex": 77,
"NewEntityType": 169
},
{
"Comments": "Move the items to the floor.",
"EMType": 44,
"EntityIndex": 70,
"TargetLocation": {
"X": 44038,
"Y": 6400,
"Z": 64500,
"Room": 52,
"Angle": -32768
}
},
{
"EMType": 44,
"EntityIndex": 72,
"TargetLocation": {
"X": 55808,
"Y": 5632,
"Z": 65024,
"Room": 57,
"Angle": -16384
}
},
{
"EMType": 44,
"EntityIndex": 77,
"TargetLocation": {
"X": 55808,
"Y": 5632,
"Z": 62976,
"Room": 57,
"Angle": -16384
}
},
{
"Comments": "Get rid of the missile static meshes.",
"EMType": 25,
"ClearFromRooms": {
"17": [ 49, 51, 53 ],
"18": [ 147, 148 ],
"19": [ 49, 51, 53 ],
"20": [ 49, 51, 53 ]
}
},
{
"Comments": "Make the camera look at the medi pack.",
"EMType": 66,
"TrigAction": 6,
"NewParameter": 70,
"Locations": [
{
"X": 47616,
"Y": 5888,
"Z": 62976,
"Room": 109
}
]
}
]
}
3 changes: 3 additions & 0 deletions TRRandomizerCore/Utilities/TR2EnemyUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ public static Dictionary<TR2Entities, TR2Entities> GetAliasPriority(string lvlNa
{
switch (lvlName)
{
case TR2LevelNames.BARTOLI:
priorities[TR2Entities.LaraMiscAnim_H] = TR2Entities.LaraMiscAnim_H_Venice;
break;
case TR2LevelNames.RIG:
case TR2LevelNames.DA:
case TR2LevelNames.DORIA:
Expand Down