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

rooms: move height vars and functions to TRX #2542

Merged
merged 6 commits into from
Feb 21, 2025

Conversation

lahm86
Copy link
Collaborator

@lahm86 lahm86 commented Feb 21, 2025

Resolves #2541.

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 primarily replaces g_HeightType and g_GF_NoFloor with function calls in TRX, but also moves Room_GetHeight and Room_GetCeiling together as well for consistency. There remains some height specific logic in the separate modules, for example altering floor height, but that's linked with #2036 so can be handled separately there.

It seemed sensible to offer disable_floor in TR1 as part of this as it's quite a straight-forward feature.

For testing, we can check floor and ceiling heights are OK, including slopes, plus the abyss in Floating Islands. You can also try an abyss in TR1; one I tried was setting the value to 4096 in Great Pyramid and then dropping off the starting ledge. It doesn't really make sense in OG environments though, so it's definitely more of a custom level feature.

This moves TR2's no floor indicator to TRX's room module.
This adds support for no floor in TR1, in the same style as TR2's
Floating Islands.

Resolves LostArtefacts#2541.
This moves Room_GetHeight to TRX, which in turn allows us to eliminate
g_HeightType.
This moves Room_GetCeiling to TRX.
@lahm86 lahm86 added Feature New functionality Internal The invisible stuff TR2 TR1 labels Feb 21, 2025
@lahm86 lahm86 self-assigned this Feb 21, 2025
@lahm86 lahm86 requested review from a team as code owners February 21, 2025 11:11
@lahm86 lahm86 requested review from rr-, walkawayy and aredfan and removed request for a team February 21, 2025 11:11
Copy link

github-actions bot commented Feb 21, 2025

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.

LGTM and thank you.

This renames the no floor internal concept to abyss.
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.

Overall LGTM.

A potential issue I noticed is when I use the disable_floor in Great Pyramid, there's also invisible collision around the top platform that Lara will bump into if she flies around. Is that to be expected?

@lahm86
Copy link
Collaborator Author

lahm86 commented Feb 21, 2025

Thanks @aredfan. That's a good point, and could cause issues in TR2 customs as well; the hard-coding of 16384 as the absolute abyss maximum causes this, as the height at the top of the platform in GP causes things to overflow (note there is other collision here just beyond the scion platform and near the sloped ceiling, but that's OG). I've adjusted it now so it calculates the absolute floor, based on the difference between 16384 and OG floater abyss value. It'd be worth flying around near the roof in Floater to see if everything looks ok with this, and see how GP looks too. Thanks!

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.

Thank you for explaining. The issue is fixed, and the Floater and GP levels both looks good. 👍

@@ -511,12 +512,14 @@ SECTOR *Room_GetSkySector(

void Room_SetAbyssHeight(const int16_t height)
{
m_AbyssHeight = height;
m_AbyssMinHeight = height;
m_AbyssMaxHeight = height == 0 ? 0 : m_AbyssMinHeight + 30 * STEP_L;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, what does 30 * STEP_L signify? Asking cause it doesn't match 16384 (16 tiles).
Also would be good to explain what is the min and max role in the calculations, as it's become quite confusing to me. I always thought it's a simple plane.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My bad, I got my numbers muddled. I've set it now to 26 * STEP_L, so this is the difference between 16384 and Floater abyss height of 9728. This allows time when Lara is falling between setting her HP to 0 and the inventory showing, so that we don't hear Lara hit the floor. Although I've noticed that in OG, you can just hear the crunch SFX begin as the inventory opens, but we can perhaps address that separately.
We also clamp to just under the max height; in TombEditor in theory you could build a room this low.
I've added comments, hopefully they clear things up.

@lahm86 lahm86 force-pushed the trx-height-functions branch from 558e189 to 7164ca9 Compare February 21, 2025 17:21
Rather than hardcoding the maximum abyss height to 16384, we calculate
it based on the OG difference between this and Floating Islands abyss
height. This avoids potential collision issues near the top of the
level.
@lahm86 lahm86 force-pushed the trx-height-functions branch from 7164ca9 to b7faeef Compare February 21, 2025 17:26
@lahm86 lahm86 merged commit e806297 into LostArtefacts:develop Feb 21, 2025
8 checks passed
@lahm86 lahm86 deleted the trx-height-functions branch February 21, 2025 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New functionality Internal The invisible stuff TR1 TR2
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Feature: add support for no floor in TR1
3 participants