diff --git a/data/tr2/ship/cfg/TR2X_gameflow.json5 b/data/tr2/ship/cfg/TR2X_gameflow.json5 index 5b3e17d4a..017f6b1a7 100644 --- a/data/tr2/ship/cfg/TR2X_gameflow.json5 +++ b/data/tr2/ship/cfg/TR2X_gameflow.json5 @@ -234,6 +234,7 @@ {"type": "level_complete"}, ], "injections": [ + "data/injections/deck_fd.bin", "data/injections/deck_itemrots.bin", "data/injections/deck_pickup_meshes.bin", "data/injections/living_deck_goon_sfx.bin", diff --git a/data/tr2/ship/data/injections/deck_fd.bin b/data/tr2/ship/data/injections/deck_fd.bin new file mode 100644 index 000000000..4f56521cb Binary files /dev/null and b/data/tr2/ship/data/injections/deck_fd.bin differ diff --git a/docs/tr2/CHANGELOG.md b/docs/tr2/CHANGELOG.md index 6a089ca8a..0c645c4d6 100644 --- a/docs/tr2/CHANGELOG.md +++ b/docs/tr2/CHANGELOG.md @@ -34,6 +34,7 @@ - fixed a softlock in Temple of Xian if the main chamber key is missed (#2042) - fixed a potential softlock in Floating Islands if returning towards the level start from the gold secret (#2590) - fixed a potential softlock in Nightmare in Vegas where the bird monster could remain inactive, or the flip map not set (#1851) +- fixed invalid portals in The Deck between rooms 17 and 104, which could result in Lara seeing enemies in disconnected rooms (#2393) - fixed the camera going out of bounds in 60fps near specific invalid floor data (known as no-space) (#2764, regression from 0.10) - fixed sprites rendering black if no shade value is assigned in the level (#2701, regression from 0.8) - fixed a crash if an image was missing diff --git a/docs/tr2/README.md b/docs/tr2/README.md index 6f038554c..5daba4bc0 100644 --- a/docs/tr2/README.md +++ b/docs/tr2/README.md @@ -211,6 +211,7 @@ as Notepad. - 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 + - **The Deck**: fixed invalid portals between rooms 17 and 104, which could result in Lara seeing enemies in disconnected rooms - **Tibetan Foothills**: added missing triggers for the drawbridge in room 96 (after the flipmap) - **Catacombs of the Talion**: changed some music triggers to pads near the first yeti, and added missing triggers and ladder in room 116 (after the flipmap) - **Ice Palace**: fixed door 143's position to resolve the invisible wall in front of it, and added an extra pickup trigger beside the Gong Hammer in room 29 diff --git a/src/libtrx/game/inject/editors/rooms.c b/src/libtrx/game/inject/editors/rooms.c index b2a62b421..2e4f02f80 100644 --- a/src/libtrx/game/inject/editors/rooms.c +++ b/src/libtrx/game/inject/editors/rooms.c @@ -299,7 +299,7 @@ static void M_RoomPortalEdits( const ROOM *const room = Room_Get(base_room); PORTAL *portal = nullptr; for (int32_t j = 0; j < room->portals->count; j++) { - PORTAL room_portal = room->portals->portal[j]; + const PORTAL room_portal = room->portals->portal[j]; if (room_portal.room_num == link_room && j == portal_index) { portal = &room->portals->portal[j]; break; @@ -314,10 +314,23 @@ static void M_RoomPortalEdits( continue; } + bool empty_portal = true; for (int32_t j = 0; j < 4; j++) { portal->vertex[j].x += VFile_ReadS16(injection->fp); portal->vertex[j].y += VFile_ReadS16(injection->fp); portal->vertex[j].z += VFile_ReadS16(injection->fp); + empty_portal &= portal->vertex[j].x == 0 && portal->vertex[j].y == 0 + && portal->vertex[j].z == 0; + } + + // An injection that has reset all vertices such that the portal size is + // now 0, should be interpreted as a command to ignore that portal. + if (empty_portal) { + for (int32_t j = portal_index + 1; j < room->portals->count; j++) { + room->portals->portal[j - 1] = room->portals->portal[j]; + } + room->portals->portal[room->portals->count - 1] = *portal; + room->portals->count--; } } }