From 0a8cbc8f08fcb86672a5a1ad4b9be5f01ce0ec62 Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Sun, 3 May 2026 05:33:13 -0700 Subject: [PATCH] cave of ordeals fairy check --- src/d/actor/d_a_npc_fairy.cpp | 17 ++++++++++++----- src/d/d_save.cpp | 8 ++++++++ .../randomizer/generator/data/locations.yaml | 5 ++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/d/actor/d_a_npc_fairy.cpp b/src/d/actor/d_a_npc_fairy.cpp index 5c142d2b1f..b70d85866c 100644 --- a/src/d/actor/d_a_npc_fairy.cpp +++ b/src/d/actor/d_a_npc_fairy.cpp @@ -11,6 +11,10 @@ #include "JSystem/JHostIO/JORFile.h" #include +#if TARGET_PC +#include "dusk/randomizer/game/verify_item_functions.h" +#endif + enum fairy_RES_File_ID { /* BCK */ /* 0x09 */ BCK_FAIRY_F_SAD = 0x9, @@ -1269,11 +1273,7 @@ void daNpc_Fairy_c::AppearDemoCall() { } else { mEvtNo = EVT_APPEAR_50F_02; } -#if TARGET_PC - } else if (dComIfGs_checkEmptyBottle() || randomizer_IsActive()) { -#else - } else if (dComIfGs_checkEmptyBottle()) { -#endif + } else if (dComIfGs_checkEmptyBottle() IF_DUSK(|| randomizer_IsActive())) { mEvtNo = EVT_APPEAR_50F_01; } else { mEvtNo = EVT_APPEAR_50F_04; @@ -1337,6 +1337,13 @@ void daNpc_Fairy_c::PresentDemoCall() { item_no = 0; } +#if TARGET_PC + // If we haven't visted this great fairy before, give the random item + if (randomizer_IsActive() && !daNpcT_chkEvtBit(505)) { + item_no = verifyProgressiveItem(randomizer_getItemAtLocation("Cave of Ordeals Great Fairy Reward")); + } +#endif + fpc_ProcID id = fopAcM_createItemForPresentDemo(¤t.pos, item_no, 0, -1, -1, NULL, NULL); if (id != fpcM_ERROR_PROCESS_ID_e) { dComIfGp_event_setItemPartnerId(id); diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index fec4af4ee8..a0bcd68e1a 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -559,6 +559,14 @@ BOOL dSv_player_item_c::checkInsectBottle() { u8 dSv_player_item_c::checkEmptyBottle() { u8 bottleNum = 0; +#if TARGET_PC + if (randomizer_IsActive() && getStageID() == Cave_of_Ordeals) { + // Return 1 to allow the player to collect the item from the floor 50 reward, + // as this will make the game think that the player has an empty bottle. + return 1; + } +#endif + for (int i = 0; i < BOTTLE_MAX; i++) { if (mItems[i + SLOT_11] == dItemNo_EMPTY_BOTTLE_e) { bottleNum++; diff --git a/src/dusk/randomizer/generator/data/locations.yaml b/src/dusk/randomizer/generator/data/locations.yaml index 7eee4cdf6e..ab6814f8ea 100644 --- a/src/dusk/randomizer/generator/data/locations.yaml +++ b/src/dusk/randomizer/generator/data/locations.yaml @@ -4490,7 +4490,6 @@ - Flag: 0x47 Stage: 31 -# TODO - Name: Cave of Ordeals Great Fairy Reward Original Item: Fairy Tears Categories: @@ -4498,8 +4497,8 @@ - Npc - Cave of Ordeals - ARC - Metadata: - - None + - Location Name Lookup + Metadata: Cave of Ordeals Great Fairy Reward - Name: Mirror Chamber Warp Portal Original Item: Mirror Chamber Portal