Skip to content

Commit

Permalink
VBify ganons key door
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Aug 31, 2024
1 parent 467f6b1 commit 6a4d6e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ typedef enum {
// Opt: *ObjTsubo
VB_POT_DRAW,
VB_POT_DROP_ITEM,
// Opt: *ActorDoorShutter
VB_LOCK_DOOR,

/*** Play Cutscenes ***/

Expand Down
13 changes: 12 additions & 1 deletion soh/soh/Enhancements/randomizer/ShufflePots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern "C" {
#include "z64.h"
#include "variables.h"
#include "overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h"
#include "overlays/actors/Ovl_Door_Shutter/z_door_shutter.h"

u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey);
GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
Expand Down Expand Up @@ -77,7 +78,7 @@ void PotOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* optio
*should = false;
}
}

// Do not spawn vanilla item from pot, instead spawn the ranomized item.
if (id == VB_POT_DROP_ITEM) {
ObjTsubo* potActor = static_cast<ObjTsubo*>(optionalArg);
Expand All @@ -86,6 +87,16 @@ void PotOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* optio
*should = false;
}
}

// Unlock early Ganon's Boss Key doors to allow access to the pots there when pots are shuffled in dungeon
if (id == VB_LOCK_DOOR) {
DoorShutter* doorActor = static_cast<DoorShutter*>(optionalArg);
uint8_t shufflePotSetting = Randomizer_GetSettingValue(RSK_SHUFFLE_POTS);
if (gPlayState->sceneNum == SCENE_GANONS_TOWER && doorActor->dyna.actor.world.pos.y == 800 &&
(shufflePotSetting == RO_SHUFFLE_POTS_DUNGEONS || shufflePotSetting == RO_SHUFFLE_POTS_ALL)) {
*should = false;
}
}
}

void RegisterShufflePots() {
Expand Down
6 changes: 1 addition & 5 deletions soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) {
DoorShutter_SetupAction(this, DoorShutter_SetupType);
this->unk_16B = phi_a3;
if (this->doorType == SHUTTER_KEY_LOCKED || this->doorType == SHUTTER_BOSS) {
// Unlock early Ganon's Boss Key doors to allow access to the pots there when "Shuffle Pots" is on.
uint8_t unlockForShufflePots = play->sceneNum == SCENE_GANONS_TOWER &&
Randomizer_GetSettingValue(RSK_SHUFFLE_POTS) &&
this->dyna.actor.world.pos.y == 800;
if (!Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) && !unlockForShufflePots) {
if (GameInteractor_Should(VB_LOCK_DOOR, !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F), this)) {
this->unk_16E = 10;
}
Actor_SetFocus(&this->dyna.actor, 60.0f);
Expand Down

0 comments on commit 6a4d6e1

Please sign in to comment.