[Enhancement] Enable putaway as Fierce Deity (#717)
Some checks are pending
generate-builds / generate-2ship-otr (push) Waiting to run
generate-builds / build-macos (push) Blocked by required conditions
generate-builds / build-linux (push) Blocked by required conditions
generate-builds / build-windows (push) Blocked by required conditions

* Add enhancement to enable putaway as Fierce Deity

* Fix hooks for putaway and FD sword wield

---------

Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
This commit is contained in:
Eblo 2024-10-10 08:51:05 -04:00 committed by GitHub
parent 4d3c39224c
commit bb386e25a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 33 additions and 5 deletions

View File

@ -716,6 +716,8 @@ void DrawEnhancementsMenu() {
}
UIWidgets::CVarCheckbox("Instant Putaway", "gEnhancements.Player.InstantPutaway",
{ .tooltip = "Allows Link to instantly puts away held item without waiting." });
UIWidgets::CVarCheckbox("Fierce Deity Putaway", "gEnhancements.Player.FierceDeityPutaway",
{ .tooltip = "Allows Fierce Deity Link to put away his sword." });
ImGui::EndMenu();
}

View File

@ -1001,6 +1001,8 @@ void AddEnhancements() {
([](widgetInfo& info) { RegisterFastFlowerLaunch(); }) },
{ "Instant Putaway", "gEnhancements.Player.InstantPutaway",
"Allows Link to instantly puts away held item without waiting.", WIDGET_CVAR_CHECKBOX },
{ "Fierce Deity Putaway", "gEnhancements.Player.FierceDeityPutaway",
"Allows Fierce Deity Link to put away his sword.", WIDGET_CVAR_CHECKBOX },
{ "Climb speed",
"gEnhancements.PlayerMovement.ClimbSpeed",
"Increases the speed at which Link climbs vines and ladders.",

View File

@ -54,6 +54,7 @@ void InitEnhancements() {
RegisterClimbSpeed();
RegisterFastFlowerLaunch();
RegisterInstantPutaway();
RegisterFierceDeityPutaway();
// Songs
RegisterEnableSunsSong();

View File

@ -0,0 +1,19 @@
#include <libultraship/bridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"
#include "variables.h"
void RegisterFierceDeityPutaway() {
REGISTER_VB_SHOULD(VB_SHOULD_PUTAWAY, {
if (CVarGetInteger("gEnhancements.Player.FierceDeityPutaway", 0)) {
Player* player = GET_PLAYER(gPlayState);
if (player->transformation == PLAYER_FORM_FIERCE_DEITY)
*should = true;
}
});
REGISTER_VB_SHOULD(VB_FD_ALWAYS_WIELD_SWORD, {
if (CVarGetInteger("gEnhancements.Player.FierceDeityPutaway", 0)) {
*should = false;
}
});
}

View File

@ -4,5 +4,6 @@
void RegisterClimbSpeed();
void RegisterFastFlowerLaunch();
void RegisterInstantPutaway();
void RegisterFierceDeityPutaway();
#endif // PLAYER_H

View File

@ -65,6 +65,8 @@ typedef enum {
VB_ZTARGET_SPEED_CHECK,
VB_THIEF_BIRD_STEAL,
VB_PLAY_CREMIA_HUG_CUTSCENE,
VB_FD_ALWAYS_WIELD_SWORD,
VB_SHOULD_PUTAWAY,
VB_ELEGY_CHECK_SCENE,
} GIVanillaBehavior;

View File

@ -3761,8 +3761,9 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) {
ItemId item;
EquipSlot i = func_8082FDC4();
i = ((i >= EQUIP_SLOT_A) && (this->transformation == PLAYER_FORM_FIERCE_DEITY) &&
(this->heldItemAction != PLAYER_IA_SWORD_TWO_HANDED))
i = GameInteractor_Should(VB_FD_ALWAYS_WIELD_SWORD, (i >= EQUIP_SLOT_A) &&
(this->transformation == PLAYER_FORM_FIERCE_DEITY) &&
(this->heldItemAction != PLAYER_IA_SWORD_TWO_HANDED))
? EQUIP_SLOT_B
: i;
@ -8115,7 +8116,7 @@ s32 Player_ActionChange_6(Player* this, PlayState* play) {
}
if ((this->putAwayCountdown == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_KOKIRI) &&
(this->transformation != PLAYER_FORM_FIERCE_DEITY)) {
GameInteractor_Should(VB_SHOULD_PUTAWAY, (this->transformation != PLAYER_FORM_FIERCE_DEITY))) {
Player_UseItem(play, this, ITEM_NONE);
} else {
this->stateFlags2 ^= PLAYER_STATE2_100000;
@ -11243,8 +11244,8 @@ void Player_SetDoAction(PlayState* play, Player* this) {
} else if ((this->transformation == PLAYER_FORM_DEKU) && !(this->stateFlags1 & PLAYER_STATE1_8000000) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
doActionA = DO_ACTION_ATTACK;
} else if (((this->transformation == PLAYER_FORM_HUMAN) ||
(this->transformation == PLAYER_FORM_ZORA)) &&
} else if (GameInteractor_Should(VB_SHOULD_PUTAWAY, ((this->transformation == PLAYER_FORM_HUMAN) ||
(this->transformation == PLAYER_FORM_ZORA))) &&
((this->heldItemAction >= PLAYER_IA_SWORD_KOKIRI) ||
((this->stateFlags2 & PLAYER_STATE2_100000) &&
(play->actorCtx.targetCtx.fairyActor == NULL)))) {