This commit is contained in:
Eblo 2025-08-18 22:27:44 -04:00 committed by GitHub
commit 9ed844bf3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 1 deletions

View file

@ -0,0 +1,31 @@
#include "public/bridge/consolevariablebridge.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
extern "C" {
#include "src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h"
}
#define CVAR_WIDE_SHUTTER_DOOR_RANGE CVAR_ENHANCEMENT("WideShutterDoorRange")
#define WIDE_SHUTTER_DOOR_RANGE_DEFAULT 0
#define CVAR_WIDE_SHUTTER_DOOR_RANGE_VALUE CVarGetInteger(CVAR_WIDE_SHUTTER_DOOR_RANGE, WIDE_SHUTTER_DOOR_RANGE_DEFAULT)
// The X range is 70 on NTSC 1.0 and 50 in later versions. The Y range is 15 in any version.
// https://github.com/zeldaret/oot/blob/6ecb84097c1a9a8426f3815c84aa6a5d49ad5804/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c#L248-L259
#define SHUTTER_DOOR_RANGE_X 70
#define SHUTTER_DOOR_RANGE_Y 15
void RegisterWideShutterDoorRange() {
COND_VB_SHOULD(VB_BE_NEAR_DOOR_SHUTTER, CVAR_WIDE_SHUTTER_DOOR_RANGE_VALUE, {
DoorShutter* doorShutter = va_arg(args, DoorShutter*);
Vec3f relPlayerPos = *va_arg(args, Vec3f*);
// Jabu-Jabu door, Phantom Ganon bars, Gohma door, or boss door
if (doorShutter->unk_16C == 3 || doorShutter->unk_16C == 4 || doorShutter->unk_16C == 5 ||
doorShutter->unk_16C == 7) {
*should = (SHUTTER_DOOR_RANGE_X < fabsf(relPlayerPos.x) || SHUTTER_DOOR_RANGE_Y < fabsf(relPlayerPos.y));
}
});
}
static RegisterShipInitFunc initFunc_WideShutterDoorRange(RegisterWideShutterDoorRange,
{ CVAR_WIDE_SHUTTER_DOOR_RANGE });

View file

@ -2245,6 +2245,14 @@ typedef enum {
// #### `args` // #### `args`
// - `*EnBox` // - `*EnBox`
VB_CHEST_USE_ICE_EFFECT, VB_CHEST_USE_ICE_EFFECT,
// #### `result`
// ```c
// arg3 < fabsf(sp1C.x) || arg4 < fabsf(sp1C.y)
// ```
// #### `args`
// - `*DoorShutter`
VB_BE_NEAR_DOOR_SHUTTER,
} GIVanillaBehavior; } GIVanillaBehavior;
#endif #endif

View file

@ -1161,6 +1161,10 @@ void SohMenu::AddMenuEnhancements() {
.CVar(CVAR_ENHANCEMENT("NGCKaleidoSwitcher")) .CVar(CVAR_ENHANCEMENT("NGCKaleidoSwitcher"))
.Options(CheckboxOptions().Tooltip( .Options(CheckboxOptions().Tooltip(
"Makes L and R switch pages like on the GameCube. Z opens the Debug Menu instead.")); "Makes L and R switch pages like on the GameCube. Z opens the Debug Menu instead."));
AddWidget(path, "Wide Door Ranges", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("WideShutterDoorRange"))
.Options(CheckboxOptions().Tooltip("Restores the wider range of certain shutter doors from NTSC 1.0.\n"
"Notably affects Jabu-Jabu and boss doors."));
// Difficulty Options // Difficulty Options
path.sidebarName = "Difficulty"; path.sidebarName = "Difficulty";

View file

@ -335,7 +335,7 @@ f32 func_80996840(PlayState* play, DoorShutter* this, f32 arg2, f32 arg3, f32 ar
sp28.y = player->actor.world.pos.y + arg2; sp28.y = player->actor.world.pos.y + arg2;
sp28.z = player->actor.world.pos.z; sp28.z = player->actor.world.pos.z;
Actor_WorldToActorCoords(&this->dyna.actor, &sp1C, &sp28); Actor_WorldToActorCoords(&this->dyna.actor, &sp1C, &sp28);
if (arg3 < fabsf(sp1C.x) || arg4 < fabsf(sp1C.y)) { if (GameInteractor_Should(VB_BE_NEAR_DOOR_SHUTTER, arg3 < fabsf(sp1C.x) || arg4 < fabsf(sp1C.y), this, &sp1C)) {
return FLT_MAX; return FLT_MAX;
} else { } else {
return sp1C.z; return sp1C.z;