tr2/objects/bird_guardian: remove hard-coded end level behaviour
Some checks are pending
Run code linters / Run code linters (push) Waiting to run
Publish a pre-release / Build TR1 (push) Has been skipped
Publish a pre-release / Build TR2 (push) Has been skipped
Publish a pre-release / Create a prerelease (push) Has been skipped

This removes the hard-coded end level behaviour of the bird guardian in
TR2. For OG, an injection is provided to add a command to the death
animation to yield the same result; custom levels can modify the object
accordingly externally.

Resolves #1583.
This commit is contained in:
lahm86 2025-04-11 21:24:54 +01:00
parent 0674d546c4
commit adf2703305
7 changed files with 28 additions and 11 deletions

View file

@ -309,6 +309,7 @@
], ],
"injections": [ "injections": [
"data/injections/common_pickup_meshes.bin", "data/injections/common_pickup_meshes.bin",
"data/injections/guardian_death_commands.bin",
"data/injections/palace_fd.bin", "data/injections/palace_fd.bin",
"data/injections/palace_itemrots.bin", "data/injections/palace_itemrots.bin",
], ],

View file

@ -106,6 +106,9 @@
{"type": "total_stats", "background_path": "data/images/end.png"}, {"type": "total_stats", "background_path": "data/images/end.png"},
{"type": "level_complete"}, {"type": "level_complete"},
], ],
"injections": [
"data/injections/guardian_death_commands.bin",
],
}, },
// 5. Nightmare in Vegas // 5. Nightmare in Vegas
@ -124,6 +127,9 @@
{"type": "level_stats"}, {"type": "level_stats"},
{"type": "level_complete"}, {"type": "level_complete"},
], ],
"injections": [
"data/injections/guardian_death_commands.bin",
],
}, },
], ],

View file

@ -1376,7 +1376,22 @@ provided with the game achieves.
#### TR2 #### TR2
TBD <table>
<tr valign="top" align="left">
<th>Injection file</th>
<th>Purpose</th>
</tr>
<tr valign="top">
<td>
<code>guardian_death_commands.bin</code>
</td>
<td>
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.
</td>
</tr>
</table>
## FMVs ## FMVs

View file

@ -15,6 +15,7 @@
- fixed the console opening when remapping its key (#2641) - 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) - 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 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 ## [0.10](https://github.com/LostArtefacts/TRX/compare/tr2-0.9.2...tr2-0.10) - 2025-03-18
- added support for 60 FPS rendering - added support for 60 FPS rendering

View file

@ -308,6 +308,7 @@ as Notepad.
- added developer console (accessible with `/`, see [COMMANDS.md](COMMANDS.md) for details) - added developer console (accessible with `/`, see [COMMANDS.md](COMMANDS.md) for details)
- added ability to disable FMVs - added ability to disable FMVs
- added per-level customizable fog distance - added per-level customizable fog distance
- removed the hard-coded end-level behaviour of the bird guardian for custom levels
#### Miscellaneous #### Miscellaneous
- added Linux builds - added Linux builds

View file

@ -17,7 +17,6 @@
#define BIRD_GUARDIAN_ATTACK_1_RANGE SQUARE(WALL_L) // = 1048576 #define BIRD_GUARDIAN_ATTACK_1_RANGE SQUARE(WALL_L) // = 1048576
#define BIRD_GUARDIAN_ATTACK_2_RANGE SQUARE(WALL_L * 2) // = 4194304 #define BIRD_GUARDIAN_ATTACK_2_RANGE SQUARE(WALL_L * 2) // = 4194304
#define BIRD_GUARDIAN_PUNCH_DAMAGE 200 #define BIRD_GUARDIAN_PUNCH_DAMAGE 200
#define BIRD_GUARDIAN_DEATH_FRAME 158
// clang-format on // clang-format on
typedef enum { typedef enum {
@ -187,15 +186,9 @@ static void M_Control(const int16_t item_num)
default: default:
break; break;
} }
} else { } else if (item->current_anim_state != BIRD_GUARDIAN_STATE_DEATH) {
if (item->current_anim_state != BIRD_GUARDIAN_STATE_DEATH) { Item_SwitchToAnim(item, BIRD_GUARDIAN_ANIM_DEATH, 0);
Item_SwitchToAnim(item, BIRD_GUARDIAN_ANIM_DEATH, 0); item->current_anim_state = BIRD_GUARDIAN_STATE_DEATH;
item->current_anim_state = BIRD_GUARDIAN_STATE_DEATH;
}
if (Item_TestFrameEqual(item, BIRD_GUARDIAN_DEATH_FRAME)) {
g_LevelComplete = true;
}
} }
Creature_Head(item, head); Creature_Head(item, head);