Skip to content

Call D-pad items by vanilla function (remove D-pad quickdraw)#2558

Open
djevangelia wants to merge 6 commits into
OoTRandomizer:Devfrom
djevangelia:dpaduseitem
Open

Call D-pad items by vanilla function (remove D-pad quickdraw)#2558
djevangelia wants to merge 6 commits into
OoTRandomizer:Devfrom
djevangelia:dpaduseitem

Conversation

@djevangelia
Copy link
Copy Markdown

Call D-pad item use function from Player_ProcessItemButtons (vanilla function that handles using B and C buttons), to match how normal items are used. Fixes #1654.

Using a new C button item such as Ocarina requires passing through many functions: Player_UpdateUpperBody (part of many actions), Player_CanUpdateItems (first check of various conditions that prohibit item use/change), Player_UpdateItems (second check) and then check if button is pressed/held by Player_ProcessItemButtons. If the button is pressed, the new item starts to get changed into through Player_UseItem. If the checks are bypassed or lessened by calling Player_UseItem in another way, there is a risk of item-related bugs such as quickdraw.

The cause of bottle on B when quickdrawing is that the held item button (last pressed button) remains as B when player is holding a C button. I tried fixing it by changing the held item button when using D-pad Ocarina but this results in problems: either no catch at all (if replaced with high number), or you have to check the C buttons for empty bottle and choose that button (what if two are equipped?). Other approaches very difficult without sabotaging normal quickdraw.

I don't think there's a way around this bug other than making use requirements for D-pad Ocarina match C-button Ocarina, so making the D-pad use the player function that handles B and C use seems reasonable.

  • The D-pad call is made here in Player_ProcessItemButtons after no B or C buttons are pressed but before checking if one is held. So, it can interrupt aiming with ranged weapon etc.
  • I've kept the randomizer use condition CAN_USE_OCARINA as it contains item slot Ocarina requirement which otherwise is lost, and item restrictions which are applied through a different path on a button basis (so not applied to D unless changed).
  • D-pad down now interrupts firing Hookshot and first person mode.
  • I renamed z64_usebutton to the decomp name Player_UseItem to make it easier to find the source code, and it's more accurate as the function is used not only for button item use (put away is UseItem with item none etc).
  • Other D-pad uses (adult equipment, pause) are unchanged.
  • I haven't changed the D-pad item draw so there might be mismatch between actual item usability and shown usability. I did briefly test setting a variable in Player_ProcessItemButtons to signal D-pad item use is allowed, but didn't notice much difference and considering how normal buttons only dim if restricted and again that's part of different path, I removed it.

Testing

Tested in Ares 1.47, Project64 3.0.1 and Mupen64plus 2.8. Tested by using Ocarina and Bunny Hood in Kokiri Forest combined with items.
Quickdrawing doesn't work: https://www.youtube.com/watch?v=VraIC5QJTzs
Ocarina seems to behave like C buttons when interrupting first person and loaded ranged weapon.

@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 22, 2026
@shirosoluna
Copy link
Copy Markdown

shirosoluna commented Apr 23, 2026

this did not affect traditional methods of obtaining quickdraw, and bottle on B is still obtainable
tested on Wii VC

@flagrama
Copy link
Copy Markdown

(above comment is a good thing, not an issue with the PR)

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.

Ocarina on d-pad lets you quickdraw

4 participants