Skip to content

Fix: Reset waterbox collisions in Lake Hylia and Morphas room#2346

Merged
dcvz merged 2 commits intoHarbourMasters:develop-bradleyfrom
Archez:fix-waterbox-collisions
Jan 17, 2023
Merged

Fix: Reset waterbox collisions in Lake Hylia and Morphas room#2346
dcvz merged 2 commits intoHarbourMasters:develop-bradleyfrom
Archez:fix-waterbox-collisions

Conversation

@Archez
Copy link
Contributor

@Archez Archez commented Jan 10, 2023

Due to Ships resource caching and the game code modifying waterbox collisions, modifications are permanently made to the cached data, meaning that subsequent loads of scenes already have modified waterboxes and behave incorrectly.

In lieu of a cache invalidation mechanism for scenes, this PR resets the modified waterboxes to their original load value when ever the scene loads/unloads.

Both Lake Hylia and Morphas room have fixes added to fix the waterbox as reported from the issue bellow.

Fixes #2331

Build Artifacts

// Go slightly beyond -681 so the smoothing doesn't slow down too much (matches the reverse of water rise func)
Math_SmoothStepToF(&this->lakeHyliaWaterLevel, -682.0f, 0.1f, 1.0f, 0.001f);
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED;
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin = WATER_LEVEL_RIVER_LOWER_Z - 50;
Copy link
Contributor

Choose a reason for hiding this comment

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

@Archez this 50 feels like a magic number, could you explain where it's coming from?

Copy link
Contributor Author

@Archez Archez Jan 17, 2023

Choose a reason for hiding this comment

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

Its to mimic what happens from the Init func

play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin -= 50;

I can instead create a separate #define that contains the subtraction

Copy link
Contributor

@briaguya0 briaguya0 Jan 17, 2023

Choose a reason for hiding this comment

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

I can instead create a separate #define that contains the subtraction

no need, thanks for explaining!

@dcvz dcvz merged commit fda198d into HarbourMasters:develop-bradley Jan 17, 2023
@Archez Archez deleted the fix-waterbox-collisions branch January 17, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants