tr1/carrier: fix initial sector selection for falling items

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.
This commit is contained in:
lahm86 2024-12-20 20:03:39 +00:00 committed by Marcin Kurczewski
parent 2ab543fbd3
commit aa9077dd2e
No known key found for this signature in database
GPG key ID: CC65E6FD28CAE42A
2 changed files with 6 additions and 2 deletions

View file

@ -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)

View file

@ -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;