Skip to content

Commit

Permalink
midas_touch: prevent item duplication (LostArtefacts#1416)
Browse files Browse the repository at this point in the history
This retains the Midas Touch item number that Lara is interacting with
until the puzzle item is added to inventory, so to avoid adjacent
objects triggering the pickup together.

Resolves LostArtefacts#1415.
  • Loading branch information
lahm86 authored Jul 19, 2024
1 parent 058d9da commit 6968ddd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [Unreleased](https://github.com/LostArtefacts/TR1X/compare/stable...develop) - ××××-××-××
- added deadly water feature from TR2+ for custom levels (#1404)
- fixed adjacent Midas Touch objects potentially allowing gold bar duplication in custom levels (#1415)

## [4.2](https://github.com/LostArtefacts/TR1X/compare/4.1.2...4.2) - 2024-07-14
- added creating minidump files on crashes
Expand Down
12 changes: 6 additions & 6 deletions src/game/objects/traps/midas_touch.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ void MidasTouch_Collision(
break;
}

if (lara_item->current_anim_state == LS_USE_MIDAS) {
if (Item_TestFrameEqual(lara_item, LF_PICKUP_GOLD_BAR)) {
Overlay_AddPickup(O_PUZZLE_ITEM1);
Inv_AddItem(O_PUZZLE_ITEM1);
}
if (lara_item->current_anim_state == LS_USE_MIDAS
&& g_Lara.interact_target.item_num == item_num
&& Item_TestFrameEqual(lara_item, LF_PICKUP_GOLD_BAR)) {
Overlay_AddPickup(O_PUZZLE_ITEM1);
Inv_AddItem(O_PUZZLE_ITEM1);
g_Lara.interact_target.item_num = NO_OBJECT;
}

if (!lara_item->gravity_status && lara_item->current_anim_state == LS_STOP
Expand Down Expand Up @@ -100,7 +101,6 @@ void MidasTouch_Collision(
Item_SwitchToObjAnim(lara_item, EXTRA_ANIM_PLACE_BAR, 0, O_LARA_EXTRA);
g_Lara.gun_status = LGS_HANDS_BUSY;
g_Lara.interact_target.is_moving = false;
g_Lara.interact_target.item_num = NO_OBJECT;
}

if (!g_Input.action || g_Lara.gun_status != LGS_ARMLESS
Expand Down

0 comments on commit 6968ddd

Please sign in to comment.