tr2/inventory: handle GF weapon removal and addition
Some checks failed
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
Run code linters / Run code linters (push) Has been cancelled

This responds to scenarios when the game flow removes all weapons but
also re-adds pistols, such that Lara's meshes can be drawn correctly.

Resolves #2677.
This commit is contained in:
lahm86 2025-03-23 20:06:57 +00:00
parent f396ef4514
commit 0939b6b384
2 changed files with 9 additions and 5 deletions

View file

@ -3,6 +3,7 @@
- added the bonus level game flow type, which allows for levels to be unlocked if all main game secrets are found (#2668)
- added the ability for custom levels to have up to two of each secret type per level (#2674)
- fixed the final two levels not allowing for secrets to be counted in the statistics (#1582)
- fixed Lara's holsters being empty if a game flow level removes all weapons but also re-adds the pistols (#2677)
- removed the need to specify in the game flow levels that have no secrets (secrets will be automatically counted) (#1582)
## [0.10](https://github.com/LostArtefacts/TRX/compare/tr2-0.9.2...tr2-0.10) - 2025-03-18

View file

@ -139,11 +139,6 @@ void GF_InventoryModifier_Apply(
{
START_INFO *const start = Savegame_GetCurrentInfo(level);
if (!start->has_pistols && m_Add2InvItems[O_PISTOL_ITEM]) {
start->has_pistols = 1;
Inv_AddItem(O_PISTOL_ITEM);
}
if (m_RemoveWeapons) {
start->has_pistols = 0;
start->has_magnums = 0;
@ -156,6 +151,14 @@ void GF_InventoryModifier_Apply(
start->gun_status = LGS_ARMLESS;
}
if (!start->has_pistols && m_Add2InvItems[O_PISTOL_ITEM]) {
start->has_pistols = 1;
Inv_AddItem(O_PISTOL_ITEM);
if (start->gun_type == LGT_UNARMED) {
start->gun_type = LGT_PISTOLS;
}
}
if (m_RemoveAmmo) {
start->m16_ammo = 0;
start->grenade_ammo = 0;