Skip to content

Commit

Permalink
tr2/boat: fix Lara's room number when on boat
Browse files Browse the repository at this point in the history
This tests Lara's position more accurately for cases when the boat's
room number is the water room below, but we want Lara to be defined in
the dry room above to remove her underwater hue.

Resolves #1596.
  • Loading branch information
lahm86 committed Oct 26, 2024
1 parent 802740c commit 4f38037
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- fixed the camera being cut off after using the gong hammer in Ice Palace (#1580)
- fixed the audio not being in sync when Lara strikes the gong in Ice Palace (#1725)
- fixed door cheat not working with drawbridges (#1748)
- fixed Lara's underwater hue being retained when re-entering a boat (#1596)

## [0.5](https://github.com/LostArtefacts/TRX/compare/afaf12a...tr2-0.5) - 2024-10-08
- added `/sfx` command
Expand Down
1 change: 1 addition & 0 deletions docs/tr2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ decompilation process. We recognize that there is much work to be done.

- fixed TGA screenshots crashing the game
- fixed the camera being cut off after using the gong hammer in Ice Palace
- fixed Lara's underwater hue being retained when re-entering a boat

#### Audio

Expand Down
9 changes: 7 additions & 2 deletions src/tr2/game/objects/vehicles/boat.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ void __cdecl Boat_Control(const int16_t item_num)
const int32_t hfr = Boat_TestWaterHeight(boat, BOAT_FRONT, BOAT_SIDE, &fr);

int16_t room_num = boat->room_num;
const SECTOR *const sector =
const SECTOR *sector =
Room_GetSector(boat->pos.x, boat->pos.y, boat->pos.z, &room_num);
int32_t height =
Room_GetHeight(sector, boat->pos.x, boat->pos.y, boat->pos.z);
Expand Down Expand Up @@ -711,7 +711,6 @@ void __cdecl Boat_Control(const int16_t item_num)

if (room_num != boat->room_num) {
Item_NewRoom(item_num, room_num);
Item_NewRoom(g_Lara.item_num, room_num);
}

boat->rot.z += boat_data->tilt_angle;
Expand All @@ -722,6 +721,12 @@ void __cdecl Boat_Control(const int16_t item_num)
lara->rot.y = boat->rot.y;
lara->rot.z = boat->rot.z;

sector = Room_GetSector(
lara->pos.x, lara->pos.y - 5, lara->pos.z, &room_num);
if (room_num != g_LaraItem->room_num) {
Item_NewRoom(g_Lara.item_num, room_num);
}

Item_Animate(lara);

if (lara->hit_points > 0) {
Expand Down

0 comments on commit 4f38037

Please sign in to comment.