diff --git a/soh/soh/Enhancements/Cheats/AdultCrawlspaces.cpp b/soh/soh/Enhancements/Cheats/AdultCrawlspaces.cpp new file mode 100644 index 00000000000..48364e83cf7 --- /dev/null +++ b/soh/soh/Enhancements/Cheats/AdultCrawlspaces.cpp @@ -0,0 +1,11 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +#define CVAR_ADULT_CRAWLSPACES_NAME CVAR_CHEAT("AdultCrawlspaces") +#define CVAR_ADULT_CRAWLSPACES_VALUE CVarGetInteger(CVAR_ADULT_CRAWLSPACES_NAME, 0) + +void RegisterAdultCrawlspaces() { + COND_VB_SHOULD(VB_LINK_BE_ABLE_TO_ENTER_CRAWLSPACE, CVAR_ADULT_CRAWLSPACES_VALUE, { *should = true; }); +} + +static RegisterShipInitFunc initFunc(RegisterAdultCrawlspaces, { CVAR_ADULT_CRAWLSPACES_NAME }); \ No newline at end of file diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index d1ed4534100..096bef1e6e3 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -2965,7 +2965,15 @@ typedef enum { // ``` // #### `args` // - `*int32_t (camId)` - VB_SHOULD_LOAD_BG_IMAGE + VB_SHOULD_LOAD_BG_IMAGE, + + // #### `result` + // ```c + // !LINK_IS_ADULT + // ``` + // #### `args` + // - None + VB_LINK_BE_ABLE_TO_ENTER_CRAWLSPACE, } GIVanillaBehavior; #endif diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index fc4f9f95c80..921cce35654 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -1763,6 +1763,9 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Climb Everything", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_CHEAT("ClimbEverything")) .Options(CheckboxOptions().Tooltip("Makes every surface in the game climbable.")); + AddWidget(path, "Adult Crawlspaces", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_CHEAT("AdultCrawlspaces")) + .Options(CheckboxOptions().Tooltip("Allows Adult Link to enter crawlspaces.")); AddWidget(path, "Moon Jump on L", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_CHEAT("MoonJumpOnL")) .Options(CheckboxOptions().Tooltip("Holding L makes you float into the air.")); 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 7ffe8af7f43..6b88be853ad 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -7637,7 +7637,8 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall f32 zVertex2; s32 i; - if (!LINK_IS_ADULT && !(this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (interactWallFlags & 0x30)) { + if (GameInteractor_Should(VB_LINK_BE_ABLE_TO_ENTER_CRAWLSPACE, !LINK_IS_ADULT) && + !(this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (interactWallFlags & 0x30)) { if (!GameInteractor_Should(VB_CRAWL, true)) { return false; } @@ -16707,4 +16708,4 @@ void Player_StartTalking(PlayState* play, Actor* actor) { this->naviActor->flags |= ACTOR_FLAG_TALK; func_80835EA4(play, 0xB); } -} +} \ No newline at end of file