diff --git a/soh/soh/Enhancements/TimeSavers/FasterShadowShip.cpp b/soh/soh/Enhancements/TimeSavers/FasterShadowShip.cpp new file mode 100644 index 000000000..c59ccc603 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/FasterShadowShip.cpp @@ -0,0 +1,26 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "functions.h" +#include "src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h" +} + +void RegisterFasterShadowShip() { + COND_VB_SHOULD(VB_SHADOW_SHIP_SET_SPEED, CVarGetInteger(CVAR_ENHANCEMENT("FasterShadowShip"), 0), { + BgHakaShip* ship = va_arg(args, BgHakaShip*); + PlayState* play = va_arg(args, PlayState*); + if (!Play_InCsMode(play)) { + if (Actor_FindNearby(play, &ship->dyna.actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 800.0) == NULL && + Actor_FindNearby(play, &ship->dyna.actor, ACTOR_PLAYER, ACTORCAT_PLAYER, 450.0) != NULL) { + *should = false; + ship->dyna.actor.speedXZ = 25.0f; + } else if (ship->dyna.actor.speedXZ > 4.0f) { + *should = false; + ship->dyna.actor.speedXZ = 4.0f; + } + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterFasterShadowShip, { CVAR_ENHANCEMENT("FasterShadowShip") }); diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index d57d5029a..ccedf066c 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -1687,6 +1687,15 @@ typedef enum { // - `*int16_t` - original next entrance index (`play->setupExitList[exitIndex - 1]`) VB_SET_VOIDOUT_FROM_SURFACE, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - BgHakaShip* + // - PlayState* + VB_SHADOW_SHIP_SET_SPEED, + // #### `result` // ```c // (!CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 0b78892d4..12a95cb52 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -365,6 +365,9 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Faster Heavy Block Lift", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("FasterHeavyBlockLift")) .Options(CheckboxOptions().Tooltip("Speeds up lifting Silver Rocks and Obelisks.")); + AddWidget(path, "Faster Shadow Ship", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FasterShadowShip")) + .Options(CheckboxOptions().Tooltip("Speeds up ship in Shadow Temple.")); AddWidget(path, "Fast Chests", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("FastChests")) .Options(CheckboxOptions().Tooltip("Makes Link always kick the chest to open it, instead of doing the longer " diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index bdca027bc..e595b8e62 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -7,6 +7,8 @@ #include "z_bg_haka_ship.h" #include "objects/object_haka_objects/object_haka_objects.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) void BgHakaShip_Init(Actor* thisx, PlayState* play); @@ -133,7 +135,7 @@ void BgHakaShip_Move(BgHakaShip* this, PlayState* play) { this->dyna.actor.speedXZ = 0.0f; Message_StartTextbox(play, 0x5071, NULL); this->actionFunc = BgHakaShip_SetupCrash; - } else { + } else if (GameInteractor_Should(VB_SHADOW_SHIP_SET_SPEED, true, this, play)) { Math_StepToF(&this->dyna.actor.speedXZ, 4.0f, 0.2f); } child = this->dyna.actor.child;