unsheathe without slashing (#6216)
This commit is contained in:
18
soh/soh/Enhancements/UnsheatheWithoutSlashing.cpp
Normal file
18
soh/soh/Enhancements/UnsheatheWithoutSlashing.cpp
Normal 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 });
|
||||||
@@ -2386,6 +2386,14 @@ typedef enum {
|
|||||||
// - `*EnMk`
|
// - `*EnMk`
|
||||||
VB_USE_EYEDROP_DIALOGUE,
|
VB_USE_EYEDROP_DIALOGUE,
|
||||||
|
|
||||||
|
// #### `result`
|
||||||
|
// ```c
|
||||||
|
// (this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)
|
||||||
|
// ```
|
||||||
|
// #### `args`
|
||||||
|
// - `*Player`
|
||||||
|
VB_USE_HELD_ITEM_AFTER_CHANGE,
|
||||||
|
|
||||||
// #### `result`
|
// #### `result`
|
||||||
// ```c
|
// ```c
|
||||||
// (shapeRotY < -0x2E93) || (shapeRotY >= 0x7C19)
|
// (shapeRotY < -0x2E93) || (shapeRotY >= 0x7C19)
|
||||||
|
|||||||
@@ -776,6 +776,9 @@ void SohMenu::AddMenuEnhancements() {
|
|||||||
"Allows Strength to be toggled on and off by pressing A on the Strength Upgrade "
|
"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 "
|
"in the Equipment Subscreen of the Pause Menu. This allows performing some glitches "
|
||||||
"that require the player to not have Strength."));
|
"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)
|
AddWidget(path, "Sword Toggle Options", WIDGET_CVAR_COMBOBOX)
|
||||||
.CVar(CVAR_ENHANCEMENT("SwordToggle"))
|
.CVar(CVAR_ENHANCEMENT("SwordToggle"))
|
||||||
.PreFunc(
|
.PreFunc(
|
||||||
|
|||||||
@@ -2834,8 +2834,10 @@ s32 Player_UpperAction_Sword(Player* this, PlayState* play) {
|
|||||||
s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) {
|
s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) {
|
||||||
if (LinkAnimation_Update(play, &this->upperSkelAnime) ||
|
if (LinkAnimation_Update(play, &this->upperSkelAnime) ||
|
||||||
((Player_ItemToItemAction(this->heldItemId) == this->heldItemAction) &&
|
((Player_ItemToItemAction(this->heldItemId) == this->heldItemAction) &&
|
||||||
(sUseHeldItem =
|
(sUseHeldItem = (sUseHeldItem || GameInteractor_Should(VB_USE_HELD_ITEM_AFTER_CHANGE,
|
||||||
(sUseHeldItem || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) {
|
((this->modelAnimType != PLAYER_ANIMTYPE_3) &&
|
||||||
|
(play->shootingGalleryStatus == 0)),
|
||||||
|
this))))) {
|
||||||
Player_SetUpperActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]);
|
Player_SetUpperActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]);
|
||||||
this->unk_834 = 0;
|
this->unk_834 = 0;
|
||||||
this->idleType = PLAYER_IDLE_DEFAULT;
|
this->idleType = PLAYER_IDLE_DEFAULT;
|
||||||
|
|||||||
Reference in New Issue
Block a user