Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TR1X bug: Lara can reach trigger through closed UW gate #1419

Closed
aredfan opened this issue Jul 24, 2024 · 4 comments · Fixed by #1422
Closed

TR1X bug: Lara can reach trigger through closed UW gate #1419

aredfan opened this issue Jul 24, 2024 · 4 comments · Fixed by #1422
Labels
TR1 TRX bug A bug with TRX
Milestone

Comments

@aredfan
Copy link
Collaborator

aredfan commented Jul 24, 2024

A regression since 1.1.5, possibly 1.1.4 too but I'm unable to check the latter version because it crashes.

The issue is not present in 1.1.3.


This bug manifests in 2 ways:

  • The camera doesn't get pushed out after the gate closes.
  • Lara can swim against the gate to reach the trigger on the other side which opens the gate.

TombATI

TombATI.mp4

TR1X

TR1X.mp4
@aredfan aredfan added the TRX bug A bug with TRX label Jul 24, 2024
@Richard-L
Copy link
Collaborator

Would this at all have anything to do with the dive roll which native TR1 doesn't have?

@rr-
Copy link
Collaborator

rr- commented Jul 24, 2024

No – the glitch stems from a patch added in cb928f9 to prevent Lara from voiding when a timed door closes on her. Removing it fixes the issue, but also brings the previous bug back.

diff --git a/src/game/objects/general/door.c b/src/game/objects/general/door.c
index 307c5a03..58a9cdb2 100644
--- a/src/game/objects/general/door.c
+++ b/src/game/objects/general/door.c
@@ -38,10 +38,6 @@ static void Door_Shut(DOORPOS_DATA *d, ITEM_INFO *item)
         return;
     }
 
-    if (item && Door_LaraDoorCollision(item)) {
-        return;
-    }
-
     floor->index = 0;
     floor->box = NO_BOX;
     floor->floor = NO_HEIGHT / 256;

@rr- rr- added this to the 4.3 milestone Jul 24, 2024
@rr-
Copy link
Collaborator

rr- commented Jul 24, 2024

Here's another propsed patch that changes the proximity check to a block check.
To see its effectiveness we'll need a test level where the OG bug (with door closing automatically on Lara causing her to void) can be reproduced. CC @lahm86

diff --git a/src/game/objects/general/door.c b/src/game/objects/general/door.c
index 307c5a03..4a7141f7 100644
--- a/src/game/objects/general/door.c
+++ b/src/game/objects/general/door.c
@@ -23,12 +23,12 @@ static bool Door_LaraDoorCollision(ITEM_INFO *item)
     if (!g_LaraItem) {
         return false;
     }
-    int32_t max_dist = SQUARE((WALL_L * 2) >> 8);
-    int32_t dx = ABS(item->pos.x - g_LaraItem->pos.x) >> 8;
-    int32_t dy = ABS(item->pos.y - g_LaraItem->pos.y) >> 8;
-    int32_t dz = ABS(item->pos.z - g_LaraItem->pos.z) >> 8;
-    int32_t dist = SQUARE(dx) + SQUARE(dy) + SQUARE(dz);
-    return dist < max_dist;
+
+    return (
+        ((item->pos.x & ~WALL_L) == (g_LaraItem->pos.x & ~WALL_L)) &&
+        ((item->pos.y & ~WALL_L) == (g_LaraItem->pos.y & ~WALL_L)) &&
+        ((item->pos.z & ~WALL_L) == (g_LaraItem->pos.z & ~WALL_L))
+    );
 }
 
 static void Door_Shut(DOORPOS_DATA *d, ITEM_INFO *item)

@lahm86
Copy link
Collaborator

lahm86 commented Jul 24, 2024

Here is a test level. It's when a door isn't on a portal AFAIK; Lara certainly voids with this in TombATI.
LEVEL1.zip

In OG, I think you can recreate it in room 42 in Atlantis if you go onto the antipad and then go back while the door's closing.
image

rr- added a commit that referenced this issue Jul 24, 2024
Resolves #1419.

Removes the proximity test and instead checks if Lara is on the same
tile where the ghost block will spawn.
@rr- rr- closed this as completed in 07a34f0 Jul 25, 2024
@rr- rr- added the TR1 label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TR1 TRX bug A bug with TRX
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants