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

Equip dupe fix #2655

Merged
merged 1 commit into from
Aug 20, 2023
Merged

Conversation

inspectredc
Copy link
Contributor

@inspectredc inspectredc commented Mar 31, 2023

This PR reintroduces equip duping which was removed in https://github.com/HarbourMasters/Shipwright/pull/525 which introduced dpad equips.

In the original game elemental arrows temporarily use different addresses (0xBF to 0xC1) for the equipTargetItem index. The code later checks for these values to correct them while it also does checks to swap items in cases where the equipTargetSlot is the same as items on the cButtonSlots. These extra steps were removed with the introduction of dpad equips. Instead the elemental arrows' equipTargetItem indexes were corrected before these checks. I believe this is what lead to the removal of unnecessary checks that the original would do, including a check that would swap the equips when the equipTargetItem is bow and an elemental arrow is equipped to a different buttonItems slot than the equipTargetCBtn. It is this check which is triggered only when performing equip dupe and as the current swapping only looks for the equipTargetSlots and not the removed bow case. This PR readds this case into the buttonItems swap loop.

Build Artifacts

@inspectredc
Copy link
Contributor Author

Just to try and help this along with the review:

Here is the section which would allow for equip duping in the original code

} else if (pauseCtx->equipTargetItem == ITEM_BOW) {
if ((gSaveContext.equips.buttonItems[2] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[2] <= ITEM_BOW_ARROW_LIGHT)) {
gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[1];
gSaveContext.equips.cButtonSlots[1] = gSaveContext.equips.cButtonSlots[0];
Interface_LoadItemIcon2(globalCtx, 2);
} else if ((gSaveContext.equips.buttonItems[3] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[3] <= ITEM_BOW_ARROW_LIGHT)) {
gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[1];
gSaveContext.equips.cButtonSlots[2] = gSaveContext.equips.cButtonSlots[0];
Interface_LoadItemIcon2(globalCtx, 3);
}
}

(repeated again for each button later on)

This PR just condenses that section back into the code to fit in with the dpad equips without having to have all the repeated statements

@garrettjoecox garrettjoecox added this to the MacReady milestone Jun 13, 2023
Copy link
Contributor

@garrettjoecox garrettjoecox left a comment

Choose a reason for hiding this comment

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

LGTM

@garrettjoecox garrettjoecox merged commit 55cd8c1 into HarbourMasters:develop Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants