Skip to content

Commit d1fb43d

Browse files
committed
Adjust TR2R Diving Area ending
Enforces a different way to end Diving Area in TR2R if enemies are randomized. Resolves LostArtefacts#814.
1 parent 45cfe2b commit d1fb43d

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## [Unreleased](https://github.com/LostArtefacts/TR-Rando/compare/V1.10.2...master) - xxxx-xx-xx
22
- added Spanish translations for TR1 (#800)
3+
- fixed a crash at the end of Diving Area in TR2R (#814)
34

45
## [V1.10.2](https://github.com/LostArtefacts/TR-Rando/compare/V1.10.1...V1.10.2) - 2024-12-06
56
- added support for TR1X 4.6 (#796)

TRRandomizerCore/Randomizers/TR2/Remastered/TR2REnemyRandomizer.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,25 @@ private void RandomizeEnemies(TR2RCombinedLevel level, EnemyRandomizationCollect
140140

141141
private void ApplyPostRandomization(TR2RCombinedLevel level)
142142
{
143+
AdjustDivingAreaEnd(level);
143144
RestoreHSHDog(level);
144145
MakeChickensUnconditional(level);
145146
AddUnarmedItems(level);
146147
}
147148

149+
private static void AdjustDivingAreaEnd(TR2RCombinedLevel level)
150+
{
151+
if (!level.Is(TR2LevelNames.DA))
152+
{
153+
return;
154+
}
155+
156+
// TR2R crashes at the end of DA in some cases because of presumably hard-coded dying monk
157+
// checks. Change the monk's type to allow environment mods to detect the change and make
158+
// further adjustments.
159+
level.Data.Entities[117].TypeID = TR2Type.PushButtonSwitch;
160+
}
161+
148162
private static void RestoreHSHDog(TR2RCombinedLevel level)
149163
{
150164
if (!level.Is(TR2LevelNames.HOME))

TRRandomizerCore/Resources/TR2/Environment/PLATFORM.TR2-Environment.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,6 +2587,77 @@
25872587
}
25882588
}
25892589
]
2590+
},
2591+
{
2592+
"Condition": {
2593+
"Comments": "If the end monk is no longer of that type, it's been done to avoid TR2R crashing. Add further tweaks to end the level.",
2594+
"ConditionType": 0,
2595+
"EntityIndex": 117,
2596+
"EntityType": 256
2597+
},
2598+
"OnFalse": [
2599+
{
2600+
"EMType": 71,
2601+
"Tags": [
2602+
13
2603+
],
2604+
"Locations": [
2605+
{
2606+
"X": 54784,
2607+
"Y": 3072,
2608+
"Z": 61952,
2609+
"Room": 5
2610+
}
2611+
],
2612+
"ActionItem": {
2613+
"Parameter": 117
2614+
}
2615+
},
2616+
{
2617+
"EMType": 45,
2618+
"EntityIndex": 117,
2619+
"NewEntityType": 103
2620+
},
2621+
{
2622+
"EMType": 45,
2623+
"EntityIndex": 116,
2624+
"NewEntityType": 67
2625+
},
2626+
{
2627+
"EMType": 44,
2628+
"EntityIndex": 117,
2629+
"TargetLocation": {
2630+
"X": 55808,
2631+
"Y": 4608,
2632+
"Z": 61952,
2633+
"Room": 77
2634+
}
2635+
},
2636+
{
2637+
"EMType": 44,
2638+
"EntityIndex": 116,
2639+
"TargetLocation": {
2640+
"X": 57856,
2641+
"Y": 5632,
2642+
"Z": 61952,
2643+
"Room": 77
2644+
}
2645+
},
2646+
{
2647+
"EMType": 61,
2648+
"EntityLocation": 117,
2649+
"Trigger": {
2650+
"TrigType": 2,
2651+
"Mask": 31,
2652+
"SwitchOrKeyRef": 117,
2653+
"Actions": [
2654+
{
2655+
"Action": 7
2656+
}
2657+
]
2658+
}
2659+
}
2660+
]
25902661
}
25912662
],
25922663
"ConditionalOneOf": [],

0 commit comments

Comments
 (0)