unsheathe without slashing (#6216)

This commit is contained in:
Jameriquiah
2026-02-27 21:34:56 -05:00
committed by GitHub
parent d46bfd9716
commit 9f56ef5090
4 changed files with 33 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
#include <libultraship/bridge.h>
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/ShipInit.hpp"
#define CVAR_UNSHEATHE_NAME CVAR_ENHANCEMENT("UnsheatheWithoutSlashing")
#define CVAR_UNSHEATHE_VALUE CVarGetInteger(CVAR_UNSHEATHE_NAME, 0)
void RegisterUnsheatheWithoutSlashing() {
COND_VB_SHOULD(VB_USE_HELD_ITEM_AFTER_CHANGE, CVAR_UNSHEATHE_VALUE, {
Player* player = va_arg(args, Player*);
ItemID heldItemId = static_cast<ItemID>(player->heldItemId);
if ((heldItemId == ITEM_SWORD_KOKIRI) || (heldItemId == ITEM_SWORD_MASTER)) {
*should = false;
}
});
}
static RegisterShipInitFunc initFunc(RegisterUnsheatheWithoutSlashing, { CVAR_UNSHEATHE_NAME });

View File

@@ -2386,6 +2386,14 @@ typedef enum {
// - `*EnMk`
VB_USE_EYEDROP_DIALOGUE,
// #### `result`
// ```c
// (this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)
// ```
// #### `args`
// - `*Player`
VB_USE_HELD_ITEM_AFTER_CHANGE,
// #### `result`
// ```c
// (shapeRotY < -0x2E93) || (shapeRotY >= 0x7C19)

View File

@@ -776,6 +776,9 @@ void SohMenu::AddMenuEnhancements() {
"Allows Strength to be toggled on and off by pressing A on the Strength Upgrade "
"in the Equipment Subscreen of the Pause Menu. This allows performing some glitches "
"that require the player to not have Strength."));
AddWidget(path, "Unsheathe Sword Without Slashing", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("UnsheatheWithoutSlashing"))
.Options(CheckboxOptions().Tooltip("Allows Link to unsheathe sword without slashing automatically."));
AddWidget(path, "Sword Toggle Options", WIDGET_CVAR_COMBOBOX)
.CVar(CVAR_ENHANCEMENT("SwordToggle"))
.PreFunc(

View File

@@ -2834,8 +2834,10 @@ s32 Player_UpperAction_Sword(Player* this, PlayState* play) {
s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->upperSkelAnime) ||
((Player_ItemToItemAction(this->heldItemId) == this->heldItemAction) &&
(sUseHeldItem =
(sUseHeldItem || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) {
(sUseHeldItem = (sUseHeldItem || GameInteractor_Should(VB_USE_HELD_ITEM_AFTER_CHANGE,
((this->modelAnimType != PLAYER_ANIMTYPE_3) &&
(play->shootingGalleryStatus == 0)),
this))))) {
Player_SetUpperActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]);
this->unk_834 = 0;
this->idleType = PLAYER_IDLE_DEFAULT;