libtrx/rooms/common: fix adjoining room array limit

This ensures we don't write beyond array bounds when scanning for a
room's neighbours, and specifically prevents the skidoo causing a
crash if in a room with many neighbours.

Resolves #1987.
This commit is contained in:
lahm86 2024-12-05 22:16:13 +00:00
parent 8fbcf5e34a
commit 9a0902fa15
3 changed files with 5 additions and 0 deletions

View file

@ -30,6 +30,7 @@
- fixed wrongly positioned doors in Ice Palace and Floating Islands, which caused invisible walls (#1963)
- fixed picking up the Gong Hammer in Ice Palace sometimes not opening the nearby door (#1716)
- fixed room 98 in Wreck of the Maria Doria not having water (#1939)
- fixed a potential crash if Lara is on the skidoo in a room with many other adjoining rooms (#1987)
- removed unused detail level option
## [0.6](https://github.com/LostArtefacts/TRX/compare/tr2-0.5...tr2-0.6) - 2024-11-06

View file

@ -40,6 +40,7 @@ decompilation process. We recognize that there is much work to be done.
- fixed new saves not displaying the save count in the passport
- fixed Lara getting stuck in her hit animation if she is hit while mounting the boat or skidoo
- fixed the detonator key and gong hammer not activating their target items when manually selected from the inventory
- fixed a potential crash if Lara is on the skidoo in a room with many other adjoining rooms
- fixed the following floor data issues:
- **Opera House**: fixed the trigger under item 203 to trigger it rather than item 204
- **Wreck of the Maria Doria**: fixed room 98 not having water

View file

@ -167,6 +167,9 @@ int32_t Room_GetAdjoiningRooms(
const PORTALS *const portals = Room_Get(init_room_num)->portals;
if (portals != NULL) {
for (int32_t i = 0; i < portals->count; i++) {
if (count >= max_room_num_count) {
break;
}
const int16_t room_num = portals->portal[i].room_num;
out_room_nums[count++] = room_num;
}