Skip to content

Fix for Epona spawning when entering scene on water#2553

Open
djevangelia wants to merge 5 commits into
OoTRandomizer:Devfrom
djevangelia:waterpona
Open

Fix for Epona spawning when entering scene on water#2553
djevangelia wants to merge 5 commits into
OoTRandomizer:Devfrom
djevangelia:waterpona

Conversation

@djevangelia

Copy link
Copy Markdown

Prevent spawning on Epona on water when entering an Epona-allowed scene when "exited on horse" is set. Fixes #2012.

When Epona is spawned during scene entry, there is no check to ensure she doesn't spawn on water.
The Y displacement is due to line checks not being run and therefore variables for front and back Y position are not updated.
The displacement is thus to Y 0.0 - Lake Hylia 0.0 is up in the sky. See the issue above for more details.

Entering a new scene, Player_SetStartingMovement checks if a waterbox is below player (regardless if above or under the ground floor). The new function check runs directly after waterbox check if there is a waterbox:

  • Check if R_EXITED_SCENE_RIDING_HORSE (decomp name) is true, and if the scene allows Epona
  • Then, do line intersection test between player Y and (waterbox surface Y - player Y)
  • If intersection Y <= surface Y, dismount if:
  • scene is not Lake Hylia, or
  • scene is Lake Hylia and player X is not -1045 (allows for warping into riding). (Domain into Lake with empty lake and from fishing also dismounts, but seems impossible to leave the area mounted anyway, so I'm leaving it like this. Fishing should be easy fix if requested)

Debug run example: https://www.youtube.com/watch?v=rd34SAitudE (Ares)
The number 0-1 is R_EXITED_SCENE_RIDING_HORSE. If it is set to 0 due to water, text is displayed.

Code questions:

  • I had to add the CollisionContext struct from decomp to z64.h/z64_game to call BgCheck_AnyLineTest1. I assume a different name is needed.
  • I put the definition of BgCheck_AnyLineTest1 in z_player.c because it's only called by two actors in vanilla, so the demand isn't high.
  • I put R_EXITED_SCENE_RIDING_HORSE in player.h because it's player related and needed to access it from debug, but maybe that too could be put in z_player.c or z64.h.

Testing

Tested in Ares 1.47, Project64 3.0.1 and Mupen64plus 2.8 by entering areas in debug. For this testing, easiest way is to bind R_EXITED_SCENE_RIDING_HORSE (include player.h), like putting this in debug_utilities:

if (z64_game.common.input[0].pad_pressed.l) {
        R_EXITED_SCENE_RIDING_HORSE = 1;
    }
    else if (z64_game.common.input[0].pad_pressed.r) {
        R_EXITED_SCENE_RIDING_HORSE = 0;
    }

@fenhl fenhl added Type: Bug Something isn't working Component: ASM/C Changes some internals of the ASM/C libraries Status: Needs Review Someone should be looking at it labels Apr 16, 2026
Comment thread ASM/c/player.h Outdated
Comment thread ASM/c/z_player.c Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: ASM/C Changes some internals of the ASM/C libraries Status: Needs Review Someone should be looking at it Type: Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Going through loading zones on Epona in Entrance Randomizer can cause Link to be stuck on Epona, forcing the player to Save + Quit

3 participants