LostArtefacts / TRX

Open source re-implementation of Tomb Raider I and Tomb Raider II, along with additional enhancements and bugfixes
https://lostartefacts.dev/
GNU General Public License v3.0
584 stars 37 forks source link

T1M bug: Electricity stays animated on inventory screen #767

Closed aredfan closed 1 year ago

aredfan commented 1 year ago

https://user-images.githubusercontent.com/94776985/224924118-55cbe437-bc1e-4f34-9fc9-a38c25b68076.mp4

Richard-L commented 1 year ago

Yes, this is a good find I had recorded too about a year ago or so. Don't think I posted it. I believe it's similar on PS1. We should investigate. This light beam does all sorts of funny things.

The Scion in this scene has another weirdness in that it emits blood when you shoot it. I believe there was also discussion at some point if shooting it should count as a kill or not.

aredfan commented 1 year ago

Yeah it's weird the scion emits blood or counts as a kill. Interestingly there are four mandatory kills in a glitchless pacifist run; Larson in Peru, Pierre, Giant Atlantean and the Scion.

Ah, this bug doesn't just happen in The Great Pyramid but also happens in Thor's room of St. Francis' Folly.

walkawayy commented 1 year ago

Is this an OG bug?

aredfan commented 1 year ago

Nope, I checked in TombATI and the bug doesn't happen there.

rr- commented 1 year ago

If it's an easy fix (and I believe it is) we should fix it as part of 2.14.

walkawayy commented 1 year ago

If it's an easy fix (and I believe it is) we should fix it as part of 2.14.

I looked into it briefly at one point. Is it because the lightning draw (that should stay on the inventory screen) has a random draw which can change while the inventory is open? I tried digging through the file history to see what changed, but it was hard to track from decomp through the renames.

rr- commented 1 year ago

That's a great find. If the compass doesn't use the same function to rotate the needle, I think it'll be enough to freeze get random draw when we detect a pause, either in the inventory screen or in the pause screen, by not advancing the internal accumulator. I hope this can be achieved by consulting GAME_INFO or something as I'd like to avoid introducing new global symbols for this kind of check.

lahm86 commented 1 year ago

Found another instance in gun.c. This also happens if you are firing while passing the end level trigger i.e. the stats screen is also affected.

https://user-images.githubusercontent.com/33758420/228349462-2834053e-a27e-47c5-973d-7c38e7c87e99.mp4

walkawayy commented 1 year ago

Did you confirm that Random_GetDraw was the reason this happens? We do have g_OverlayFlag that could be useful here, but it's been removed in a number of spots compared to the original code. Also the values it uses have no constants defined for them, so I don't know exactly how it works.

lahm86 commented 1 year ago

Yes, it's definitely Random_GetDraw so you were spot on with that 👍 I was looking at g_OverlayFlag and was also not following the meanings. I'll try making a new defined enum and adding it to GAME_INFO and then explicitly changing it when in the inventory, pause and stats screen. If this is acceptable, we can maybe come back to deciphering g_OverlayFlag, merging it with the new enum and getting rid of the global.