Skip to content

Commit

Permalink
Fix fast arrow and fask masks colliding. (#28)
Browse files Browse the repository at this point in the history
Now whenever the bow is out the user can change arrows, and once put away, the user can use goron mask.
  • Loading branch information
PhlexPlexico authored Feb 7, 2024
1 parent cfa6d0b commit 9a57947
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions code/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ namespace rnd {
const u32 pressedButtons = gctx->pad_state.input.buttons.flags;
const u32 newButtons = gctx->pad_state.input.new_buttons.flags;
#if defined ENABLE_DEBUG || defined DEBUG_PRINT
auto& saveData = game::GetCommonData().save;
auto* saveData = GetContext().gctx->GetPlayerActor();
if (newButtons == (u32)game::pad::Button::ZR)
rnd::util::Print("%s: Sword flag is %u\n", __func__, saveData.player.magic);
rnd::util::Print("%s: Player held item is %#04x\n", __func__, saveData->held_item);
#endif
if (gSettingsContext.customMaskButton != 0 && pressedButtons == gSettingsContext.customMaskButton) {
game::ui::OpenScreen(game::ui::ScreenType::Masks);
Expand Down
3 changes: 2 additions & 1 deletion code/source/rnd/link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ namespace rnd::link {
// Reset the override action if the player is not using a bow.
constexpr u8 first = u8(game::Action::Arrow);
constexpr u8 last = u8(game::Action::LightArrow);
const bool is_using = player->action_type == game::act::Player::ActionType::Type3 || player->projectile_actor;
const bool is_using = player->action_type == game::act::Player::ActionType::Type3 || player->projectile_actor ||
(player->held_item > game::ItemId::Ocarina && player->held_item < game::ItemId::FairyOcarina);
if (first > u8(player->current_action) || u8(player->current_action) > last || !is_using) {
s_fast_arrow_state = {};
return;
Expand Down
12 changes: 6 additions & 6 deletions code/source/rnd/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@ namespace rnd {
// If we're disabled then just run the default return.
if (gSettingsContext.enableFastArrowSwap == 0) {
return gSettingsContext.enableFastMaskTransform;
} else if (gSettingsContext.enableFastMaskTransform &&
player->flags1.IsSet(game::act::Player::Flag1::FirstPersonMode) &&
(player->held_item >= game::ItemId::Arrow && player->held_item <= game::ItemId::LightArrow)) {
} else if ((gSettingsContext.enableFastMaskTransform &&
player->flags1.IsSet(game::act::Player::Flag1::FirstPersonMode)) ||
(player->held_item >= game::ItemId::Arrow && player->held_item <= game::ItemId::LightArrow))
return 0x00;
} else {
else {
return gSettingsContext.enableFastMaskTransform;
}
}
}
// TODO: Change the addr
/* typedef void (*Health_ChangeBy_proc)(GlobalContext *arg1, u32 arg2);
#define Health_ChangeBy_addr 0x352dbc
#define Health_ChangeBy ((Health_ChangeBy_proc)Health_ChangeBy_addr)
#define Health_ChangeBy_addr 0x352dbc
#define Health_ChangeBy ((Health_ChangeBy_proc)Health_ChangeBy_addr)
void FairyPickupHealAmount(void) {
if (gSettingsContext.heartDropRefill == HeartDropRefillSetting::HEARTDROPREFILL_NOREFILL \
|| gSettingsContext.heartDropRefill == HeartDropRefillSetting::HEARTDROPREFILL_NODROPREFILL) {
Expand Down

0 comments on commit 9a57947

Please sign in to comment.