Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

overlay: fix regression in pickup display #215

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

lahm86
Copy link
Collaborator

@lahm86 lahm86 commented Sep 7, 2024

Resolves #213.

This was introduced in a7604d3. I am assuming there is something not quite adding up in the underwater pickup collision (yet to be decompiled). As we retain int16_t for the time being in ITEM_INFO, this solution fixes the problem, although it's less than ideal. LMK if you think there is a better stopgap.

@lahm86 lahm86 self-assigned this Sep 7, 2024
@lahm86 lahm86 requested review from a team as code owners September 7, 2024 19:22
@lahm86 lahm86 requested review from rr-, walkawayy and aredfan and removed request for a team September 7, 2024 19:22
Copy link
Collaborator

@rr- rr- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only place that needs updating is the function declaration and definition, the other places will promote the type automatically.

TBH I don't understand why this crashes. I get that the size of GAME_OBJECT_ID is 4 bytes whereas the size of int16_t is 2, but x86 should align each parameter in function calls to 4 bytes anyway: https://stackoverflow.com/questions/30679702/why-function-parameter-occupy-at-least-4-bytes-stack-on-x86

@lahm86 lahm86 force-pushed the issue-213-pickup-display-cast branch from ddf30a5 to c0edeef Compare September 8, 2024 08:19
@lahm86 lahm86 force-pushed the issue-213-pickup-display-cast branch from c0edeef to 67d1144 Compare September 8, 2024 08:22
@lahm86
Copy link
Collaborator Author

lahm86 commented Sep 8, 2024

I think the only place that needs updating is the function declaration and definition, the other places will promote the type automatically.

TBH I don't understand why this crashes. I get that the size of GAME_OBJECT_ID is 4 bytes whereas the size of int16_t is 2, but x86 should align each parameter in function calls to 4 bytes anyway: https://stackoverflow.com/questions/30679702/why-function-parameter-occupy-at-least-4-bytes-stack-on-x86

It makes no sense to me either. I guess once we have pickup collision decompiled we can go back to the way it was. I can't imagine it's called from anywhere else, other than the gameflow and on pickup, but we'll see. It's so strange that there is no issue above water, even if you drain an underwater room with a pickup.
Code tidied up, so redundant casts removed in gameflow.c, All pickups seem good, and gameflow displays are still working e.g. secret rewards.

@lahm86 lahm86 requested a review from rr- September 8, 2024 08:26
@lahm86 lahm86 added this to the 0.3 milestone Sep 8, 2024
@lahm86 lahm86 merged commit db17390 into LostArtefacts:develop Sep 8, 2024
2 checks passed
@lahm86 lahm86 deleted the issue-213-pickup-display-cast branch September 8, 2024 11:55
@rr- rr- added the TR2 label Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TR2X bug: the game crashes when Lara picks up items underwater
3 participants