Skip to content

Commit

Permalink
lava: add deadly water feature (LostArtefacts#1412)
Browse files Browse the repository at this point in the history
This allows death tiles in water rooms to be acknowledged, similar to
TR2+.

Resolves LostArtefacts#1404.
  • Loading branch information
lahm86 authored Jul 16, 2024
1 parent 1a200e1 commit 058d9da
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## [Unreleased](https://github.com/LostArtefacts/TR1X/compare/stable...develop) - ××××-××-××
- added deadly water feature from TR2+ for custom levels (#1404)

## [4.2](https://github.com/LostArtefacts/TR1X/compare/4.1.2...4.2) - 2024-07-14
- added creating minidump files on crashes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
- added save game crystals game mode (enabled via gameflow)
- added per-level customizable water color (with customizable blue component)
- added per-level customizable fog distance
- added deadly water feature from TR2+

#### Miscellaneous
- added Linux builds
Expand Down
14 changes: 8 additions & 6 deletions src/game/objects/traps/lava.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

bool Lava_TestFloor(ITEM_INFO *item)
{
// OG fix: check if floor index has lava
if (g_Lara.water_status == LWS_CHEAT) {
return false;
}

if (item->hit_points < 0) {
if (item->hit_points < 0 || g_Lara.water_status == LWS_CHEAT
|| (g_Lara.water_status == LWS_ABOVE_WATER
&& item->pos.y != item->floor)) {
return false;
}

// OG fix: check if floor index has lava
int16_t room_num = item->room_number;
FLOOR_INFO *floor =
Room_GetFloor(item->pos.x, 32000, item->pos.z, &room_num);
Expand Down Expand Up @@ -81,6 +79,10 @@ void Lava_Burn(ITEM_INFO *item)

item->hit_points = -1;
item->hit_status = 1;
if (g_Lara.water_status != LWS_ABOVE_WATER) {
return;
}

for (int i = 0; i < 10; i++) {
int16_t fx_num = Effect_Create(item->room_number);
if (fx_num != NO_ITEM) {
Expand Down
6 changes: 2 additions & 4 deletions src/game/room.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,8 @@ void Room_TestTriggers(int16_t *data, bool heavy)
}

if ((*data & DATA_TYPE) == FT_LAVA) {
if (!heavy && g_LaraItem->pos.y == g_LaraItem->floor) {
if (Lava_TestFloor(g_LaraItem)) {
Lava_Burn(g_LaraItem);
}
if (!heavy && Lava_TestFloor(g_LaraItem)) {
Lava_Burn(g_LaraItem);
}

if (*data & END_BIT) {
Expand Down

0 comments on commit 058d9da

Please sign in to comment.