Skip to content

Commit

Permalink
tr1/carrier: fix initial sector selection for falling items
Browse files Browse the repository at this point in the history
This ensures that if an item is dropped exactly at the height of a
vertical portal, we get the room just above that portal first to ensure
that later the item is placed in the correct room, and hence drawn
there.

Resolves #2088.
  • Loading branch information
lahm86 committed Dec 21, 2024
1 parent b2259ef commit ebb76d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/tr1/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr1-4.7...develop) - ××××-××-××
- fixed falling pickup items not being drawn when they land in rare cases (#2088)

## [4.7](https://github.com/LostArtefacts/TRX/compare/tr1-4.6.1...tr1-4.7) - 2024-12-20
- added support for Wayland in binary Linux builds (#1927)
Expand Down
7 changes: 5 additions & 2 deletions src/tr1/game/carrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ static void M_AnimateDrop(CARRIED_ITEM *const item)

ITEM *const pickup = Item_Get(item->spawn_num);
int16_t room_num = pickup->room_num;
const SECTOR *const sector =
Room_GetSector(pickup->pos.x, pickup->pos.y, pickup->pos.z, &room_num);
// For cases where a flyer has dropped an item exactly on a portal, we need
// to ensure that the initial sector is in the room above, hence we test
// slightly above the initial y position.
const SECTOR *const sector = Room_GetSector(
pickup->pos.x, pickup->pos.y - 10, pickup->pos.z, &room_num);
const int16_t height =
Room_GetHeight(sector, pickup->pos.x, pickup->pos.y, pickup->pos.z);
const bool in_water = g_RoomInfo[pickup->room_num].flags & RF_UNDERWATER;
Expand Down

0 comments on commit ebb76d2

Please sign in to comment.