From eb95f9060f26b5f78bb9dd716f297955c04990db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 13 May 2025 19:30:04 +0000 Subject: [PATCH] Faster empty bottle, faster bean skulltula (#5355) * Faster empty bottle, faster bean skulltula * shipinit --- .../TimeSavers/FasterBeanSkulltula.cpp | 13 +++++++++++++ .../TimeSavers/FasterBottleEmpty.cpp | 19 +++++++++++++++++++ .../vanilla-behavior/GIVanillaBehavior.h | 16 ++++++++++++++++ soh/soh/SohGui/SohMenuEnhancements.cpp | 7 +++++++ .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.c | 4 +++- .../actors/ovl_player_actor/z_player.c | 2 ++ 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp create mode 100644 soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp diff --git a/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp b/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp new file mode 100644 index 000000000..20011bba3 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp @@ -0,0 +1,13 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "z64save.h" +} + +void RegisterFasterBeanSkulltula() { + COND_VB_SHOULD(VB_SPAWN_BEAN_SKULLTULA, CVarGetInteger(CVAR_ENHANCEMENT("FasterBeanSkull"), 0), + { *should = true; }); +} + +static RegisterShipInitFunc initFunc(RegisterFasterBeanSkulltula, { CVAR_ENHANCEMENT("FasterBeanSkull") }); diff --git a/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp b/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp new file mode 100644 index 000000000..47b6b7461 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp @@ -0,0 +1,19 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "z64save.h" +} + +void RegisterFasterEmptyBottle() { + COND_VB_SHOULD(VB_EMPTYING_BOTTLE, CVarGetInteger(CVAR_ENHANCEMENT("FasterBottleEmpty"), 0), { + Player* player = va_arg(args, Player*); + if (player->skelAnime.curFrame <= 60.0f) { + player->skelAnime.playSpeed = 3.0f; + } else { + player->skelAnime.playSpeed = 1.0f; + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterFasterEmptyBottle, { CVAR_ENHANCEMENT("FasterBottleEmpty") }); diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 0748d913a..597be2a97 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -462,6 +462,14 @@ typedef enum { // - `*int16_t` (item id) VB_DRAW_AMMO_COUNT, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - Player* + VB_EMPTYING_BOTTLE, + // #### `result` // ```c // (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play) @@ -1827,6 +1835,14 @@ typedef enum { // - `*ObjBean` VB_SPAWN_BEAN_STALK_FAIRIES, + // #### `result` + // ```c + // this->timer >= 60 + // ``` + // #### `args` + // - `None` + VB_SPAWN_BEAN_SKULLTULA, + // #### `result` // ```c // true diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 82a1d0fae..95c942d37 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -373,6 +373,9 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim")) .Options(CheckboxOptions().Tooltip("Skips Link's taking breath animation after coming up from water. " "This setting does not interfere with getting items from underwater.")); + AddWidget(path, "Empty Bottles Faster", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FasterBottleEmpty")) + .Options(CheckboxOptions().Tooltip("Speeds up emptying animation when dumping out the contents of a bottle.")); AddWidget(path, "Vine/Ladder Climb Speed +%d", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("ClimbSpeed")) .Options(IntSliderOptions().Min(0).Max(12).DefaultValue(0).Format("+%d")); @@ -430,6 +433,10 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Link as Default File Name", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("LinkDefaultName")) .Options(CheckboxOptions().Tooltip("Allows you to have \"Link\" as a premade file name.")); + AddWidget(path, "Spawn Bean Skulltula Faster", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FasterBeanSkull")) + .Options(CheckboxOptions().Tooltip( + "Makes Gold Skulltulas come out of bean patches faster after bugs dig into center.")); AddWidget(path, "Biggoron Forge Time: %d days", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("ForgeTime")) .Options(IntSliderOptions().Min(0).Max(3).DefaultValue(3).Format("%d days").Tooltip( diff --git a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 1fb3effc1..c193ede65 100644 --- a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -7,6 +7,8 @@ #include "z_obj_makekinsuta.h" #include "vt.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED void ObjMakekinsuta_Init(Actor* thisx, PlayState* play); @@ -47,7 +49,7 @@ void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { void func_80B98320(ObjMakekinsuta* this, PlayState* play) { if (this->unk_152 != 0) { - if (this->timer >= 60 && !func_8002DEEC(GET_PLAYER(play))) { + if (GameInteractor_Should(VB_SPAWN_BEAN_SKULLTULA, this->timer >= 60) && !func_8002DEEC(GET_PLAYER(play))) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, (this->actor.params | 0x8000), true); this->actionFunc = ObjMakekinsuta_DoNothing; diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 4da9e0deb..d97dcdc08 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -14752,6 +14752,8 @@ static AnimSfxEntry D_80854A34[] = { void Player_Action_8084EFC0(Player* this, PlayState* play) { Player_DecelerateToZero(this); + GameInteractor_Should(VB_EMPTYING_BOTTLE, true, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083C0E8(this, play); func_8005B1A4(Play_GetCamera(play, 0));