Skip to content

Commit

Permalink
vb
Browse files Browse the repository at this point in the history
  • Loading branch information
briaguya-ai committed Jan 31, 2025
1 parent e036c68 commit 7b1041c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
24 changes: 24 additions & 0 deletions soh/soh/Enhancements/AssignableTunicsAndBoots.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"

// Most of the assignable tunics and boots logic has not been moved
// over to use hooks yet. It currently lives directly in z_player.c
// in Player_UseTunicBoots (where the actual logic lives), which is
// called by Player_UpdateCommon

#define CVAR_TUNICBOOTS_NAME CVAR_ENHANCEMENT("AssignableTunicsAndBoots")
#define CVAR_TUNICBOOTS_DEFAULT 0
#define CVAR_TUNICBOOTS_VALUE CVarGetInteger(CVAR_TUNICBOOTS_NAME, CVAR_TUNICBOOTS_DEFAULT)

void RegisterTunicBootsChangeUseHeldItem() {
COND_VB_SHOULD(VB_CHANGE_HELD_ITEM_AND_USE_ITEM, CVAR_TUNICBOOTS_VALUE != CVAR_TUNICBOOTS_DEFAULT, {
int32_t item = va_arg(args, int32_t);

if (item >= ITEM_TUNIC_KOKIRI && item <= ITEM_BOOTS_HOVER) {
*should = false;
return;
}
});
}

static RegisterShipInitFunc initFunc(RegisterTunicBootsChangeUseHeldItem, { CVAR_TUNICBOOTS_NAME });
3 changes: 3 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,9 @@ typedef enum {
VB_SPAWN_SONG_FAIRY,
// Opt: *EnGs
VB_SPAWN_GOSSIP_STONE_FAIRY,

/*** Equippable tunics and boots ***/
VB_CHANGE_HELD_ITEM_AND_USE_ITEM,
} GIVanillaBehavior;

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -2572,7 +2572,7 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) {
if ((item < ITEM_NONE_FE) && (Player_ItemToItemAction(item) == this->heldItemAction)) {
sHeldItemButtonIsHeldDown = true;
}
} else if (item < ITEM_TUNIC_KOKIRI || item > ITEM_BOOTS_HOVER) {
} else if (GameInteractor_Should(VB_CHANGE_HELD_ITEM_AND_USE_ITEM, true, item)) {
this->heldItemButton = i;
Player_UseItem(play, this, item);
}
Expand Down

0 comments on commit 7b1041c

Please sign in to comment.