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

camera: fix unchecked NO_HEIGHT usage #2569

Merged
merged 2 commits into from
Feb 28, 2025

Conversation

lahm86
Copy link
Collaborator

@lahm86 lahm86 commented Feb 28, 2025

Resolves #1034.

Checklist

  • I have read the coding conventions
  • I have added a changelog entry about what my pull request accomplishes, or it is an internal change
  • I have added a readme entry about my new feature or OG bug fix, or it is a different change

Description

This resolves instances where the camera Y shift could result in extremely large values when NO_HEIGHT is involved, hence resulting in the camera going out of bounds for a frame or so. We now check for this case and use the previous valid Y position of the camera. @aredfan has provided saves in the issue where there are prominent cases of this.

This doesn't fix all instances where the camera can go into walls/OOB - the other related issue is with the interpolated values, which we'll tackle separately. This PR addresses only those instances where the camera is thrown up to -32768.

@lahm86 lahm86 added OG bug A bug in original game TR2 TR1 labels Feb 28, 2025
@lahm86 lahm86 self-assigned this Feb 28, 2025
@lahm86 lahm86 requested review from a team as code owners February 28, 2025 20:24
@lahm86 lahm86 requested review from rr-, walkawayy and aredfan and removed request for a team February 28, 2025 20:24
Copy link

github-actions bot commented Feb 28, 2025

This resolves an OG bug whereby the camera shift could result in
extremely large values when NO_HEIGHT is involved, hence resulting in
the camera going out of bounds for a frame or so. We now check for this
case and use the previous valid Y position of the camera.

Resolves LostArtefacts#1034.
This neatens the bounce control in the TR1 camera, similar to TR2.
@lahm86 lahm86 force-pushed the issue-1034-clamp-camera-shift branch from a808392 to 2b9c72a Compare February 28, 2025 20:44
@lahm86
Copy link
Collaborator Author

lahm86 commented Feb 28, 2025

Slight logic re-organisation, so we're testing for no height first to still allow a LOS check. This gives a slightly smoother shift in some cases e.g. in the save below if you jump straight up
save_tr1_03.zip

Copy link
Collaborator

@aredfan aredfan left a comment

Choose a reason for hiding this comment

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

I can confirm the scenarios from the issue are fixed. Also City of Khamoon and Wreck of the Maria Doria, room 52 both LGTM.

It's fantastic to see this bugfix introduced to TRX. Thank you again. 👍

@walkawayy
Copy link
Collaborator

Slight logic re-organisation, so we're testing for no height first to still allow a LOS check. This gives a slightly smoother shift in some cases e.g. in the save below if you jump straight up save_tr1_03.zip

I can't load the save for some reason due to the item count.

game/savegame/savegame_bson.c 474 M_LoadItems Malformed save: expected 93 items, got 94
game/game_flow/sequencer_events.c 155 M_HandlePlayLevel Failed to load save file!
libtrx/game/game_flow/sequencer.c 39 M_RunEvent event type=loop_game(1) data=0xa finished, result: action=exit_to_title, param=0
game/shell.c 197 Shell_Main action=exit_to_title param=0
libtrx/game/savegame.c 15 Savegame_UnbindSlot Resetting the save slot
game/level.c 521 Level_Initialise num=0 (data/title.phd)
game/savegame/savegame.c 169 Savegame_GetCurrentInfo Warning: unable to get resume info for level 0 (type=title)

@aredfan
Copy link
Collaborator

aredfan commented Feb 28, 2025

I can't load the save for some reason due to the item count.

I ran into the same issue, I figured I needed to enable the Restore PS1 enemies option.

@lahm86
Copy link
Collaborator Author

lahm86 commented Feb 28, 2025

Ah, sorry, I forget the mummy can cause this issue. Thanks.

@lahm86 lahm86 merged commit 3ece4b7 into LostArtefacts:develop Feb 28, 2025
8 checks passed
@lahm86 lahm86 deleted the issue-1034-clamp-camera-shift branch February 28, 2025 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OG bug A bug in original game TR1 TR2
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

OG bug: Displaced camera moments
4 participants