diff --git a/libultraship b/libultraship index 3ef24c3d16..a8bdcab363 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 3ef24c3d1645fe1fc2a7065d1c2e132973ebc151 +Subproject commit a8bdcab363571038bb71f195f21ec3e9033a220d diff --git a/mm/2s2h/BenGui/BenMenu.cpp b/mm/2s2h/BenGui/BenMenu.cpp index 5c11a1cbdc..f0b88d2a2b 100644 --- a/mm/2s2h/BenGui/BenMenu.cpp +++ b/mm/2s2h/BenGui/BenMenu.cpp @@ -1450,6 +1450,11 @@ void BenMenu::AddEnhancements() { .Options(CheckboxOptions().Tooltip( "Fixes a bug that results in the wrong audio playing upon receiving a 4th piece of heart to " "fill a new heart container.")); + AddWidget(path, "Fix Deku Butler Shock Animation", WIDGET_CVAR_CHECKBOX) + .CVar("gEnhancements.Fixes.DekuButlerFixShockLoopAnimation") + .Options(CheckboxOptions().Tooltip( + "Fixes a bug where the Deku Butler loops the incorrect animation in the cutscene that plays after " + "freeing the Deku Princess.")); // Restorations path = { "Enhancements", "Restorations", SECTION_COLUMN_1 }; diff --git a/mm/2s2h/Enhancements/Fixes/FixDekuButlerShockLoopAnimation.cpp b/mm/2s2h/Enhancements/Fixes/FixDekuButlerShockLoopAnimation.cpp new file mode 100644 index 0000000000..d27b37cfd7 --- /dev/null +++ b/mm/2s2h/Enhancements/Fixes/FixDekuButlerShockLoopAnimation.cpp @@ -0,0 +1,24 @@ +#include +#include "2s2h/GameInteractor/GameInteractor.h" +#include "2s2h/ShipInit.hpp" + +extern "C" { +#include "src/overlays/actors/ovl_En_Dno/z_en_dno.h" +} + +#define CVAR_NAME "gEnhancements.Fixes.DekuButlerFixShockLoopAnimation" +#define CVAR CVarGetInteger(CVAR_NAME, 0) + +#define EN_DNO_ANIM_SHOCK_LOOP 18 + +void RegisterDekuButlerFixShockLoopAnimation() { + COND_VB_SHOULD(VB_DEKU_BUTLER_FIX_SHOCK_ANIM, CVAR, { + EnDno* dno = va_arg(args, EnDno*); + u8* changeAnim = va_arg(args, u8*); + if (dno->animIndex == EN_DNO_ANIM_SHOCK_LOOP) { + *changeAnim = false; + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterDekuButlerFixShockLoopAnimation, { CVAR_NAME }); diff --git a/mm/2s2h/GameInteractor/GameInteractor_VanillaBehavior.h b/mm/2s2h/GameInteractor/GameInteractor_VanillaBehavior.h index 0d84558fa3..4e1260f70d 100644 --- a/mm/2s2h/GameInteractor/GameInteractor_VanillaBehavior.h +++ b/mm/2s2h/GameInteractor/GameInteractor_VanillaBehavior.h @@ -245,6 +245,14 @@ typedef enum { // - `*f32` (speed) VB_CLAMP_ANIMATION_SPEED, + // #### `result` + // ```c + // this->animIndex == EN_DNO_ANIM_SHOCK_LOOP + // ``` + // #### `args` + // - `this->animIndex == EN_DNO_ANIM_SHOCK_LOOP` (bool) + VB_DEKU_BUTLER_FIX_SHOCK_ANIM, + // #### `result` // ```c // gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_NONE diff --git a/mm/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/mm/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 45ccae5e12..56aebfc683 100644 --- a/mm/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/mm/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -11,6 +11,7 @@ #include "z_en_dno.h" #include "overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "2s2h/GameInteractor/GameInteractor.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -961,6 +962,7 @@ void func_80A73408(EnDno* this, PlayState* play) { break; case 2: + GameInteractor_Should(VB_DEKU_BUTLER_FIX_SHOCK_ANIM, true, this, &changeAnim); nextAnimIndex = EN_DNO_ANIM_SHOCK_START; break;