diff --git a/data/tr2/ship/cfg/TR2X_gameflow.json5 b/data/tr2/ship/cfg/TR2X_gameflow.json5
index 23423c38d..a196316f7 100644
--- a/data/tr2/ship/cfg/TR2X_gameflow.json5
+++ b/data/tr2/ship/cfg/TR2X_gameflow.json5
@@ -309,6 +309,7 @@
],
"injections": [
"data/injections/common_pickup_meshes.bin",
+ "data/injections/guardian_death_commands.bin",
"data/injections/palace_fd.bin",
"data/injections/palace_itemrots.bin",
],
diff --git a/data/tr2/ship/cfg/TR2X_gameflow_gm.json5 b/data/tr2/ship/cfg/TR2X_gameflow_gm.json5
index 975a3a7d7..0a7b490f3 100644
--- a/data/tr2/ship/cfg/TR2X_gameflow_gm.json5
+++ b/data/tr2/ship/cfg/TR2X_gameflow_gm.json5
@@ -106,6 +106,9 @@
{"type": "total_stats", "background_path": "data/images/end.png"},
{"type": "level_complete"},
],
+ "injections": [
+ "data/injections/guardian_death_commands.bin",
+ ],
},
// 5. Nightmare in Vegas
@@ -124,6 +127,9 @@
{"type": "level_stats"},
{"type": "level_complete"},
],
+ "injections": [
+ "data/injections/guardian_death_commands.bin",
+ ],
},
],
diff --git a/data/tr2/ship/data/injections/guardian_death_commands.bin b/data/tr2/ship/data/injections/guardian_death_commands.bin
new file mode 100644
index 000000000..70801064d
Binary files /dev/null and b/data/tr2/ship/data/injections/guardian_death_commands.bin differ
diff --git a/docs/GAME_FLOW.md b/docs/GAME_FLOW.md
index de2303079..a708aac88 100644
--- a/docs/GAME_FLOW.md
+++ b/docs/GAME_FLOW.md
@@ -1376,7 +1376,22 @@ provided with the game achieves.
#### TR2
-TBD
+
+
+ Injection file |
+ Purpose |
+
+
+
+ guardian_death_commands.bin
+ |
+
+ Injects an animation command for the bird guardian to end the level on the
+ final frame of its death animation. The original hard-coded end-level
+ behaviour is removed in TR2X.
+ |
+
+
## FMVs
diff --git a/docs/tr2/CHANGELOG.md b/docs/tr2/CHANGELOG.md
index 975bffda7..55f42608a 100644
--- a/docs/tr2/CHANGELOG.md
+++ b/docs/tr2/CHANGELOG.md
@@ -15,6 +15,7 @@
- fixed the console opening when remapping its key (#2641)
- fixed sprites rendering black if no shade value is assigned in the level (#2701, regression from 0.8)
- removed the need to specify in the game flow levels that have no secrets (secrets will be automatically counted) (#1582)
+- removed the hard-coded end-level behaviour of the bird guardian for custom levels (#1583)
## [0.10](https://github.com/LostArtefacts/TRX/compare/tr2-0.9.2...tr2-0.10) - 2025-03-18
- added support for 60 FPS rendering
diff --git a/docs/tr2/README.md b/docs/tr2/README.md
index 8b390e2d8..45b9b2c46 100644
--- a/docs/tr2/README.md
+++ b/docs/tr2/README.md
@@ -308,6 +308,7 @@ as Notepad.
- added developer console (accessible with `/`, see [COMMANDS.md](COMMANDS.md) for details)
- added ability to disable FMVs
- added per-level customizable fog distance
+- removed the hard-coded end-level behaviour of the bird guardian for custom levels
#### Miscellaneous
- added Linux builds
diff --git a/src/tr2/game/objects/creatures/bird_guardian.c b/src/tr2/game/objects/creatures/bird_guardian.c
index 8db943b54..c94801892 100644
--- a/src/tr2/game/objects/creatures/bird_guardian.c
+++ b/src/tr2/game/objects/creatures/bird_guardian.c
@@ -17,7 +17,6 @@
#define BIRD_GUARDIAN_ATTACK_1_RANGE SQUARE(WALL_L) // = 1048576
#define BIRD_GUARDIAN_ATTACK_2_RANGE SQUARE(WALL_L * 2) // = 4194304
#define BIRD_GUARDIAN_PUNCH_DAMAGE 200
-#define BIRD_GUARDIAN_DEATH_FRAME 158
// clang-format on
typedef enum {
@@ -187,15 +186,9 @@ static void M_Control(const int16_t item_num)
default:
break;
}
- } else {
- if (item->current_anim_state != BIRD_GUARDIAN_STATE_DEATH) {
- Item_SwitchToAnim(item, BIRD_GUARDIAN_ANIM_DEATH, 0);
- item->current_anim_state = BIRD_GUARDIAN_STATE_DEATH;
- }
-
- if (Item_TestFrameEqual(item, BIRD_GUARDIAN_DEATH_FRAME)) {
- g_LevelComplete = true;
- }
+ } else if (item->current_anim_state != BIRD_GUARDIAN_STATE_DEATH) {
+ Item_SwitchToAnim(item, BIRD_GUARDIAN_ANIM_DEATH, 0);
+ item->current_anim_state = BIRD_GUARDIAN_STATE_DEATH;
}
Creature_Head(item, head);