From a11427a48f46c713d6c7d564c77a0eb3f0efa1ab Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Sun, 3 May 2026 16:06:45 -0700 Subject: [PATCH] dungeon reward and boss heart container checks --- src/d/actor/d_a_obj_bosswarp.cpp | 7 ++ src/d/d_msg_flow.cpp | 8 ++ src/d/d_msg_object.cpp | 17 ++++- .../randomizer/game/randomizer_context.cpp | 18 +++++ .../randomizer/game/randomizer_context.hpp | 1 + .../randomizer/generator/data/locations.yaml | 73 ++++++++++++------- 6 files changed, 95 insertions(+), 29 deletions(-) diff --git a/src/d/actor/d_a_obj_bosswarp.cpp b/src/d/actor/d_a_obj_bosswarp.cpp index b107971f8f..8fb38e37ae 100644 --- a/src/d/actor/d_a_obj_bosswarp.cpp +++ b/src/d/actor/d_a_obj_bosswarp.cpp @@ -506,6 +506,13 @@ int daObjBossWarp_c::demoProc() { mDoMtx_stack_c::multVec(&mYstoneTargetPos, &mYstoneTargetPos); mYstonePos.x = mYstoneTargetPos.x; mYstonePos.z = mYstoneTargetPos.z; +#if TARGET_PC + // Skip giving the vanilla dungeon reward in rando + if (randomizer_IsActive()) { + mCounter = 0; + break; + } +#endif switch (getNowLevel()) { case 0: dComIfGs_onCollectCrystal(0); diff --git a/src/d/d_msg_flow.cpp b/src/d/d_msg_flow.cpp index 48dcc4f03a..60ef7ab3e5 100644 --- a/src/d/d_msg_flow.cpp +++ b/src/d/d_msg_flow.cpp @@ -529,6 +529,14 @@ int dMsgFlow_c::setNormalMsg(mesg_flow_node* i_flowNode_p, fopAc_ac_c* i_speaker msg_no = getItemMessageID(itemId); // Ignore the rest of the flow after this var_r29->next_node_idx = -1; + } else { + u32 key = (dMsgObject_getGroupID() << 16) | msg_no; + auto& flowItemOverrides = randomizer_GetContext().mFlowItemMessageOverrides; + if (flowItemOverrides.contains(key)) { + u8 itemId = verifyProgressiveItem(flowItemOverrides[key]); + msg_no = getItemMessageID(itemId); + execItemGet(itemId); + } } } #endif diff --git a/src/d/d_msg_object.cpp b/src/d/d_msg_object.cpp index 00dfc6626e..b6db9c47d1 100644 --- a/src/d/d_msg_object.cpp +++ b/src/d/d_msg_object.cpp @@ -26,11 +26,14 @@ #include #include "JSystem/JKernel/JKRExpHeap.h" -#include "dusk/version.hpp" #include "m_Do/m_Do_controller_pad.h" #include "m_Do/m_Do_lib.h" #if TARGET_PC +#include "d/d_item.h" +#include "dusk/randomizer/game/tools.h" +#include "dusk/randomizer/game/verify_item_functions.h" +#include "dusk/version.hpp" #include "dusk/settings.h" #include #include @@ -681,6 +684,18 @@ u32 dMsgObject_c::getMessageIndex(u32 param_0) { } u32 dMsgObject_c::getRevoMessageIndex(u32 param_1) { +#if TARGET_PC + if (randomizer_IsActive()) { + u32 key = (dMsgObject_getGroupID() << 16) | param_1; + auto& flowItemOverrides = randomizer_GetContext().mFlowItemMessageOverrides; + if (flowItemOverrides.contains(key)) { + u8 itemId = verifyProgressiveItem(flowItemOverrides[key]); + param_1 = getItemMessageID(itemId); + execItemGet(itemId); + } + } +#endif + if (!g_MsgObject_HIO_c.mMessageDisplay) { return param_1; } diff --git a/src/dusk/randomizer/game/randomizer_context.cpp b/src/dusk/randomizer/game/randomizer_context.cpp index 9506dd0f0d..eb2880e5f7 100644 --- a/src/dusk/randomizer/game/randomizer_context.cpp +++ b/src/dusk/randomizer/game/randomizer_context.cpp @@ -68,6 +68,9 @@ std::optional RandomizerContext::WriteToFile() { const std::unordered_map u16ShopOverrides(this->mShopOverrides.begin(), this->mShopOverrides.end()); out["mShopOverrides"] = u16ShopOverrides; + const std::unordered_map u32FlowItemMessageOverrides(this->mFlowItemMessageOverrides.begin(), this->mFlowItemMessageOverrides.end()); + out["mFlowItemMessageOverrides"] = u32FlowItemMessageOverrides; + out["mItemLocations"] = this->mItemLocations; out["mStartHour"] = static_cast(this->mStartHour); @@ -173,6 +176,13 @@ std::optional RandomizerContext::LoadFromHash(const std::string& ha this->mShopOverrides[key] = itemId; } + // FLW Override items + for (const auto& flwNode : in["mFlowItemMessageOverrides"]) { + u32 key = flwNode.first.as(); + u8 itemId = flwNode.second.as(); + this->mFlowItemMessageOverrides[key] = itemId; + } + // Items we call by location name for (const auto& locationNode : in["mItemLocations"]) { const auto& locationName = locationNode.first.as(); @@ -652,6 +662,14 @@ void GenerateAndWriteSeed(std::string& generationStatusMsg) { randoData.mShopOverrides[key] = location->GetCurrentItem()->GetID(); } + // Items whose text we determine during a FLW message + if (location->HasCategories("FLW Message")) { + u8 group = metaData[0]["Group"].as(); + u16 messageId = metaData[0]["Message Id"].as(); + u32 key = (group << 16) | messageId; + randoData.mFlowItemMessageOverrides[key] = location->GetCurrentItem()->GetID(); + } + // Items that we lookup just by calling their location name if (location->HasCategories("Location Name Lookup")) { const auto& locationName = metaData.as(); diff --git a/src/dusk/randomizer/game/randomizer_context.hpp b/src/dusk/randomizer/game/randomizer_context.hpp index 5989b9629b..1713a2eca2 100644 --- a/src/dusk/randomizer/game/randomizer_context.hpp +++ b/src/dusk/randomizer/game/randomizer_context.hpp @@ -36,6 +36,7 @@ public: std::unordered_map mSkyCharacterOverrides{}; std::unordered_map mGoldenWolfOverrides{}; std::unordered_map mShopOverrides{}; + std::unordered_map mFlowItemMessageOverrides{}; std::unordered_map mItemLocations{}; u8 mStartHour{0}; u8 mMapBits{}; diff --git a/src/dusk/randomizer/generator/data/locations.yaml b/src/dusk/randomizer/generator/data/locations.yaml index aa1699eaea..38ac9a9c1a 100644 --- a/src/dusk/randomizer/generator/data/locations.yaml +++ b/src/dusk/randomizer/generator/data/locations.yaml @@ -4696,7 +4696,6 @@ - Tbox ID: 2 Stage: 6 -# TODO - Name: Forest Temple Diababa Heart Container Original Item: Heart Container Categories: @@ -4704,10 +4703,11 @@ - Dungeon - Forest Temple - Boss + - Freestanding Item Metadata: - - None + - Stage: 7 + Flag: 0x9F -# TODO - Name: Forest Temple Dungeon Reward Original Item: Progressive Fused Shadow Categories: @@ -4716,9 +4716,11 @@ - Dungeon Reward - REL - ARC + - FLW Message Goal Location: True Metadata: - - None + - Group: 5 + Message Id: 5001 # GORON MINES @@ -4957,7 +4959,6 @@ - Tbox ID: 30 Stage: 3 -# TODO - Name: Goron Mines Fyrus Heart Container Original Item: Heart Container Categories: @@ -4965,10 +4966,11 @@ - Dungeon - Goron Mines - Boss + - Freestanding Item Metadata: - - None + - Stage: 4 + Flag: 0x9F -# TODO - Name: Goron Mines Dungeon Reward Original Item: Progressive Fused Shadow Categories: @@ -4977,9 +4979,12 @@ - Dungeon Reward - REL - ARC + - FLW Message Goal Location: True Metadata: - - None + - Group: 5 + Message Id: 6011 + # LAKEBED TEMPLE @@ -5279,7 +5284,6 @@ - Tbox ID: 12 Stage: 0 -# TODO - Name: Lakebed Temple Morpheel Heart Container Original Item: Heart Container Categories: @@ -5287,10 +5291,11 @@ - Dungeon - Lakebed Temple - Boss + - Freestanding Item Metadata: - - None + - Stage: 1 + Flag: 0x9F -# TODO - Name: Lakebed Temple Dungeon Reward Original Item: Progressive Fused Shadow Categories: @@ -5299,9 +5304,11 @@ - Dungeon Reward - REL - ARC + - FLW Message Goal Location: True Metadata: - - None + - Group: 5 + Message Id: 7001 # ARBITERS GROUNDS @@ -5547,7 +5554,6 @@ - Tbox ID: 20 Stage: 24 -# TODO - Name: Arbiters Grounds Stallord Heart Container Original Item: Heart Container Categories: @@ -5555,10 +5561,11 @@ - Arbiters Grounds - Dungeon - Boss + - Freestanding Item Metadata: - - None + - Stage: 25 + Flag: 0x9F -# TODO - Name: Arbiters Grounds Dungeon Reward Original Item: Progressive Mirror Shard Categories: @@ -5824,7 +5831,6 @@ - Tbox ID: 11 Stage: 27 -# TODO - Name: Snowpeak Ruins Blizzeta Heart Container Original Item: Heart Container Categories: @@ -5832,8 +5838,10 @@ - Dungeon - Snowpeak Ruins - Boss + - Freestanding Item Metadata: - - None + - Stage: 28 + Flag: 0x9F - Name: Snowpeak Ruins Dungeon Reward Original Item: Progressive Mirror Shard @@ -5843,9 +5851,12 @@ - Dungeon Reward - REL - ARC + - FLW Message Goal Location: True Metadata: - - None + - Group: 5 + Message Id: 9301 + - Name: Temple of Time Lobby Lantern Chest Original Item: Temple of Time Small Key @@ -6053,7 +6064,6 @@ - Tbox ID: 0 Stage: 11 -# TODO - Name: Temple of Time Armogohma Heart Container Original Item: Heart Container Categories: @@ -6061,10 +6071,11 @@ - Dungeon - Temple of Time - Boss + - Freestanding Item Metadata: - - None + - Stage: 10 + Flag: 0x9F -# TODO - Name: Temple of Time Dungeon Reward Original Item: Progressive Mirror Shard Categories: @@ -6073,9 +6084,12 @@ - Dungeon Reward - REL - ARC + - FLW Message Goal Location: True Metadata: - - None + - Group: 5 + Message Id: 9401 + # CITY IN THE SKY @@ -6372,7 +6386,6 @@ - Tbox ID: 17 Stage: 12 -# TODO - Name: City in the Sky Argorok Heart Container Original Item: Heart Container Categories: @@ -6380,10 +6393,11 @@ - Dungeon - City in the Sky - Boss + - Freestanding Item Metadata: - - None + - Stage: 13 + Flag: 0x9F -# TODO - Name: City in the Sky Dungeon Reward Original Item: Progressive Mirror Shard Categories: @@ -6392,9 +6406,11 @@ - Dungeon Reward - REL - ARC + - FLW Message Goal Location: True Metadata: - - None + - Group: 5 + Message Id: 11001 # PALACE OF TWILIGHT @@ -6591,7 +6607,6 @@ - Tbox ID: 26 Stage: 15 -# TODO - Name: Palace of Twilight Zant Heart Container Original Item: Heart Container Categories: @@ -6599,9 +6614,11 @@ - Palace of Twilight - Heart Container - Dungeon Reward + - Freestanding Item Goal Location: True Metadata: - - None + - Stage: 16 + Flag: 0x80 # HYRULE CASTLE