move more checks from code into flows

This commit is contained in:
gymnast86
2026-08-04 07:02:13 -07:00
parent e5b9af9c53
commit 56bede561c
7 changed files with 202 additions and 97 deletions
+2 -1
View File
@@ -185,6 +185,7 @@ public:
int event044(mesg_flow_node_event*, fopAc_ac_c*);
int event045(mesg_flow_node_event*, fopAc_ac_c*);
int event046(mesg_flow_node_event*, fopAc_ac_c*);
int event047(mesg_flow_node_event*, fopAc_ac_c*);
#endif
void initWord(fopAc_ac_c*, const char*, u8, int, fopAc_ac_c**);
@@ -201,7 +202,7 @@ public:
bool checkEndFlow() { return (u32)field_0x26 == 1; }
static DUSK_GAME_DATA queryFunc mQueryList[DUSK_IF_ELSE(56, 53)];
static DUSK_GAME_DATA eventFunc mEventList[DUSK_IF_ELSE(47, 43)];
static DUSK_GAME_DATA eventFunc mEventList[DUSK_IF_ELSE(48, 43)];
#if TARGET_PC
// patch funcs for rando
+14 -49
View File
@@ -26,7 +26,7 @@
// Macros for somewhat gracefully handling custom flow ids
// The game likes to directly index into the flow node table a lot, so this macro keeps
// reletively the same syntax in all the places that happens
// relatively the same syntax in all the places that happens
#if TARGET_PC
#define M_FLOW_NODE_TBL(index) \
(*(index >= BASE_CUSTOM_MSG_AND_FLOW_ID && index != 0xFFFF && randomizer_IsActive() ? \
@@ -906,22 +906,6 @@ u16 dMsgFlow_c::query001(mesg_flow_node_branch* i_flowNode_p, fopAc_ac_c* i_spea
const u16 prm0 = i_flowNode_p->param;
u16 ret = dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[prm0]) == false;
#if TARGET_PC
if (randomizer_IsActive()) {
switch (prm0) {
case 0xFA: // MDH Completed
{
// Check to see if currently in Jovani's house
if (playerIsInRoomStage(5, allStages[Castle_Town_Shops])) {
return 0; // Return 0 to be able to turn souls into Jovani pre MDH
}
break;
}
default:
break;
}
}
#endif
if (param_2 != 0) {
// "Flag Check"
OS_REPORT("\x1B[44;33mフラグチェック           \x1B[m|:");
@@ -1286,20 +1270,6 @@ u16 dMsgFlow_c::query022(mesg_flow_node_branch* i_flowNode_p, fopAc_ac_c* i_spea
const u8 prm0 = i_flowNode_p->param;
u16 ret = checkItemGet(prm0 & 0xFF, 1) ? 0 : 1;
#if TARGET_PC
// Check to see if we're currently in one of the Ordon interiors
if (randomizer_IsActive() && daAlink_c::checkStageName(allStages[Ordon_Village_Interiors]))
{
// Check to see if checking for the Iron Boots
if (prm0 == dItemNo_Randomizer_HVY_BOOTS_e)
{
// Return false so that the door in Bo's house can be opened without having the
// Iron Boots
return 0;
}
}
#endif
if (param_2 != 0) {
// "Get Check"
OS_REPORT("\x1B[44;33m所持チェック            \x1B[m|:");
@@ -1342,16 +1312,6 @@ u16 dMsgFlow_c::query025(mesg_flow_node_branch* i_flowNode_p, fopAc_ac_c* i_spea
const u8 prm0 = i_flowNode_p->param;
u16 ret = dComIfGs_checkEmptyBottle() >= prm0 ? 0 : 1;
#if TARGET_PC
// Check to see if currently in one of the Kakariko interiors and if the red potion item is randomized
if (randomizer_IsActive() && playerIsInRoomStage(3, allStages[Kakariko_Village_Interiors]) &&
randomizer_GetContext().mShopOverrides.contains(0x4461)) // 0x4461 is the key for the red potion item
{
// Return 0 so the player can buy the red potion item from the shop.
return 0;
}
#endif
if (param_2 != 0) {
// "Empty Bottle Count Check"
OS_REPORT("\x1B[44;33m空きビン数チェック         \x1B[m|:");
@@ -1947,7 +1907,7 @@ u16 dMsgFlow_c::query056(mesg_flow_node_branch* i_flowNode_p, fopAc_ac_c* i_spea
}
#endif
DUSK_GAME_DATA eventFunc dMsgFlow_c::mEventList[DUSK_IF_ELSE(47, 43)] = {
DUSK_GAME_DATA eventFunc dMsgFlow_c::mEventList[DUSK_IF_ELSE(48, 43)] = {
&dMsgFlow_c::event000, &dMsgFlow_c::event001, &dMsgFlow_c::event002, &dMsgFlow_c::event003,
&dMsgFlow_c::event004, &dMsgFlow_c::event005, &dMsgFlow_c::event006, &dMsgFlow_c::event007,
&dMsgFlow_c::event008, &dMsgFlow_c::event009, &dMsgFlow_c::event010, &dMsgFlow_c::event011,
@@ -1961,6 +1921,7 @@ DUSK_GAME_DATA eventFunc dMsgFlow_c::mEventList[DUSK_IF_ELSE(47, 43)] = {
&dMsgFlow_c::event040, &dMsgFlow_c::event041, &dMsgFlow_c::event042,
#if TARGET_PC
&dMsgFlow_c::event043, &dMsgFlow_c::event044, &dMsgFlow_c::event045, &dMsgFlow_c::event046,
&dMsgFlow_c::event047,
#endif
};
@@ -2696,15 +2657,8 @@ int dMsgFlow_c::event035(mesg_flow_node_event* i_flowNode_p, fopAc_ac_c* i_speak
if (prm0 == dItemNo_TOMATO_PUREE_e || prm0 == dItemNo_TASTE_e) {
dComIfGs_offItemFirstBit(prm0);
} else if (prm0 == dItemNo_RAFRELS_MEMO_e || prm0 == dItemNo_ASHS_SCRIBBLING_e) {
// Only delete the item in rando if it's Ashei's sketch
IF_DUSK(if (!randomizer_IsActive() || prm0 == dItemNo_ASHS_SCRIBBLING_e))
dComIfGs_setItem(SLOT_19, dItemNo_NONE_e);
} else if (prm0 == dItemNo_LETTER_e || prm0 == dItemNo_BILL_e || prm0 == dItemNo_WOOD_STATUE_e || prm0 == dItemNo_IRIAS_PENDANT_e) {
#if TARGET_PC
if (randomizer_IsActive())
offWarashibeItem(prm0);
else
#endif
dComIfGs_setWarashibeItem(dItemNo_NONE_e);
}
@@ -2843,6 +2797,17 @@ int dMsgFlow_c::event046(mesg_flow_node_event* i_flowNode_p, fopAc_ac_c* i_speak
return 1;
}
// Calls offWarashibeItem for the passed in Ilia quest item
int dMsgFlow_c::event047(mesg_flow_node_event* i_flowNode_p, fopAc_ac_c* i_speaker_p) {
int prm0 = getParam(i_flowNode_p->params);
if (prm0 == dItemNo_LETTER_e || prm0 == dItemNo_BILL_e || prm0 == dItemNo_WOOD_STATUE_e || prm0 == dItemNo_IRIAS_PENDANT_e) {
offWarashibeItem(prm0);
}
return 1;
}
// Rando patch funcs
u32 dMsgFlow_c::getKeyForIndex(u16 nodeIdx) {
-21
View File
@@ -19,13 +19,6 @@
#include "d/actor/d_a_tag_shop_item.h"
#include <cstring>
#if TARGET_PC
#include "dusk/randomizer/game/randomizer_context.hpp"
#include "dusk/randomizer/game/verify_item_functions.h"
#include "dusk/randomizer/game/tools.h"
#include "dusk/randomizer/game/stages.h"
#endif
static daTag_ShopItem_c* dShopSystem_itemActor[7] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
};
@@ -1201,20 +1194,6 @@ int dShopSystem_c::seq_decide_yes(fopAc_ac_c* actor, dMsgFlow_c* i_flow) {
if (mFlow.getEventId(&itemNo) == 1) {
if (i_flow->doFlow(actor, NULL, 0)) {
if (mItemPartnerId == fpcM_ERROR_PROCESS_ID_e) {
#if TARGET_PC
// In rando, override the item if it's one of our unique shop checks
if (randomizer_IsActive()) {
u8 stageId = getStageID();
u16 key = (stageId << 8) | itemNo;
if (randomizer_GetContext().mShopOverrides.contains(key)) {
itemNo = verifyProgressiveItem(randomizer_GetContext().mShopOverrides[key]);
// Update the shop item flag no matter what in Kak Malo Mart
if (playerIsInRoomStage(3, "R_SP109")) {
setSoldOutFlag();
}
}
}
#endif
mItemPartnerId =
fopAcM_createItemForPresentDemo(&current.pos, itemNo, 0, -1, -1, NULL, NULL);
}
@@ -1498,6 +1498,14 @@ RandomizerContext WriteSeedData(randomizer::logic::world::World* world) {
for (const auto& groupNode : flowPatches) {
u8 groupNo = groupNode.first.as<u8>();
for (const auto& flowNode : groupNode.second) {
// Check to see if this patch is contingent on a specific setting
if (flowNode["only if"]) {
const auto& condition = flowNode["only if"].as<std::string>();
// If the required condition isn't set, then skip this one
if (!world->EvaluateSettingCondition(condition)) {
continue;
}
}
std::string name{};
std::list<u16> indices{};
if (flowNode["index"]) {
@@ -1662,6 +1670,14 @@ RandomizerContext WriteSeedData(randomizer::logic::world::World* world) {
// Text Overrides
auto textOverrides = LOAD_EMBED_YAML(RANDO_DATA_PATH "text/text_overrides.yaml");
for (const auto& overrideNode : textOverrides) {
// Check to see if this override is contingent on a specific setting
if (overrideNode["Only If"]) {
const auto& condition = overrideNode["Only If"].as<std::string>();
// If the required condition isn't set, then skip this one
if (!world->EvaluateSettingCondition(condition)) {
continue;
}
}
const auto& name = overrideNode["Name"].as<std::string>();
u8 group;
u16 messageId;
@@ -22,7 +22,20 @@
parameters: 0x00000000
next node index: Custom Midna Call Begin
#1: # zel_01.bmg
1: # zel_01.bmg - Ordon Village
# Patch the flow in Bo's house that normally prevents us from leaving without
# Having the iron boots. Patch it so we take the flow which allows us to leave
# no matter what
- index: 0x8F
type: branch
num results: 2
query: 21
parameters: 0x0045
next node index: 0x4B
results:
- 0x90
- 0x90
2: # zel_02.bmg
# Patch Barnes branch to see if you can buy the bomb bag to use
# query 54 (custom event check) instead of query 22 (how many bomb bags the player has)
@@ -33,6 +46,37 @@
parameters: 0x004D
next node index: 0x340
# Change the flow of buying the red potion item in Kak Malo Mart to not check for an empty bottle first
# if the item is randomized. Change both branch paths to lead to the same next node
- only if: Shop_Items == On
index: 0x43F
type: branch
num results: 2
query: 24
parameters: 0x00000001
next node index: 0x2EA
results:
- 0x440
- 0x440
# Change the flow of buying the red potion item in Kak Malo Mart to set the sold out flag if shop
# items are randomized
- only if: Shop_Items == On
index: 0x445
type: event
event: 3
parameters: 0x0000001E
next node index: Kakariko Malo Mart Red Potion Sold Out
# Change the flow of buying the wooden shield in Kak Malo Mart to set the sold out flag if shop
# items are randomized
- only if: Shop_Items == On
index: 0x417
type: event
event: 3
parameters: 0x00000032
next node index: Kakariko Malo Mart Wooden Shield Sold Out
#3: # zel_03.bmg
4: # zel_04.bmg - Castle Town
# Patch Charlo to check for 100 rupees instead of 30
@@ -66,6 +110,17 @@
parameters: 0x00000000
next node index: 0x10C
# Patch Jovani flow so that we can turn in poe souls before completing MDH
- index: 0x832
type: branch
num results: 2
query: 1
parameters: 0x01C8
next node index: 0x763
results:
- 0x834 # Skip over 0x833 and go directly to 0x834
- 0x84E
# Patch Jovani to skip checking whether we've received the first
# or second reward and skip straight to the second reward if we're
# talking to him for the first time with 60 souls
@@ -82,6 +137,14 @@
parameters: 0x00000063
next node index: Jovani Check 20 Reward Obtained
# Patch the flow of showing the Doctor the Invoice to call our custom
# event which calls offWarashibeItem instead of setWarashibeItem
- index: 0x2D7
type: event
event: 47
parameters: 0x00000081
next node index: 0x1D3
5: # zel_05.bmg
# Patch Yeta flow to always give the map check even if the player has obtained the Ordon Cheese
- index: 0x8
@@ -114,7 +177,12 @@
#6: # zel_06.bmg
#7: # zel_07.bmg
#8: # zel_08.bmg
8: # zel_08.bmg - HF, Outside CT, LH, UZR, Zora's River, KB2, Title Screen
# Skip over the node which deletes auru's memo from the inventory after showing it to Fyer
- index: 0x53
type: message
inf index: 0xA7
next flow index: 0x54 # Go directly to 0x54 instead of 0x5D
# Custom Flow Nodes
9:
@@ -303,6 +371,28 @@
parameters: 0x00000000
next node index: 0x116
#################################################
# KAKARIKO MALO MART #
#################################################
# Run event 24 which sets the shop sold out flag
- name: Kakariko Malo Mart Red Potion Sold Out
type: event
event: 24
parameters: 0x00000000
next node index: 0x2F2
# Run event 24 which sets the shop sold out flag
- name: Kakariko Malo Mart Wooden Shield Sold Out
type: event
event: 24
parameters: 0x00000000
next node index: 0x2D0
#################################################
# JOVANI #
#################################################
# Check to see if we've obtained the 20 Poe Soul Reward.
# If we haven't then branch to giving the reward
- name: Jovani Check 20 Reward Obtained
@@ -64,6 +64,11 @@
- Overworld
- Ordona Province
Metadata:
FLW Event:
- Group: 1
Index: 0x4D2
Next Node Index: 0x2FA
Parameters: 0x0001004B
Shop:
- Stage: 65
Item: 0x4B
@@ -1342,6 +1347,11 @@
- Kakariko Village
- ARC
Metadata:
FLW Event:
- Group: 2
Index: 0x439
Next Node Index: 0x2E8
Parameters: 0x0001003E
Shop:
- Stage: 68
Item: 0x3E
@@ -1356,6 +1366,11 @@
- Kakariko Village
- ARC
Metadata:
FLW Event:
- Group: 2
Index: 0x427
Next Node Index: 0x2DB
Parameters: 0x0001002C
Shop:
- Stage: 68
Item: 0x2C
@@ -1370,6 +1385,11 @@
- Kakariko Village
- ARC
Metadata:
FLW Event:
- Group: 2
Index: 0x449
Next Node Index: 0x2F3
Parameters: 0x00010061
Shop:
- Stage: 68
Item: 0x61
@@ -1384,6 +1404,11 @@
- Kakariko Village
- ARC
Metadata:
FLW Event:
- Group: 2
Index: 0x41C
Next Node Index: 0x2D3
Parameters: 0x0001002B
Shop:
- Stage: 68
Item: 0x2B
@@ -2479,6 +2504,11 @@
- Castle Town
- ARC
Metadata:
FLW Event:
- Group: 4
Index: 0x610
Next Node Index: 0x5AE
Parameters: 0x00010030
Shop:
- Stage: 73
Item: 0x30
@@ -243,19 +243,23 @@
Group: 0
Message Id: 2041
- Name: Slingshot Shop Text
- Only If: Shop_Items == On
Name: Slingshot Shop Text
Group: 1
Message Id: 7009
- Name: Slingshot Shop Too Expensive Text
- Only If: Shop_Items == On
Name: Slingshot Shop Too Expensive Text
Group: 1
Message Id: 7014
- Name: Slingshot Shop Purchase Confirmation Text
- Only If: Shop_Items == On
Name: Slingshot Shop Purchase Confirmation Text
Group: 1
Message Id: 7015
- Name: Slingshot Shop After Purchase Text
- Only If: Shop_Items == On
Name: Slingshot Shop After Purchase Text
Group: 1
Message Id: 7016
@@ -267,83 +271,103 @@
Group: 2
Message Id: 5155
- Name: Kakariko Malo Mart Wooden Shield Purchase Confirmation Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Wooden Shield Purchase Confirmation Text
Group: 2
Message Id: 5809
- Name: Kakariko Malo Mart Wooden Shield Too Expensive Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Wooden Shield Too Expensive Text
Group: 2
Message Id: 5810
- Name: Kakariko Malo Mart Hylian Shield Purchase Confirmation Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hylian Shield Purchase Confirmation Text
Group: 2
Message Id: 5813
- Name: Kakariko Malo Mart Hylian Shield Too Expensive Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hylian Shield Too Expensive Text
Group: 2
Message Id: 5814
- Name: Kakariko Malo Mart Hylian Shield After Purchase Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hylian Shield After Purchase Text
Group: 2
Message Id: 5818
- Name: Kakariko Malo Mart Hawkeye Purchase Confirmation Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hawkeye Purchase Confirmation Text
Group: 2
Message Id: 5820
- Name: Kakariko Malo Mart Hawkeye Too Expensive Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hawkeye Too Expensive Text
Group: 2
Message Id: 5821
- Name: Kakariko Malo Mart Hawkeye After Purchase Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hawkeye After Purchase Text
Group: 2
Message Id: 5822
- Name: Kakariko Malo Mart Red Potion Too Expensive Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Red Potion Too Expensive Text
Group: 2
Message Id: 5824
- Name: Kakariko Malo Mart Red Potion Purchase Confirmation Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Red Potion Purchase Confirmation Text
Group: 2
Message Id: 5825
- Name: Kakariko Malo Mart Red Potion Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Red Potion Text
Group: 2
Message Id: 5990
- Name: Kakariko Malo Mart Hawkeye Coming Soon Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hawkeye Coming Soon Text
Group: 2
Message Id: 5991
- Name: Kakariko Malo Mart Hawkeye Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hawkeye Text
Group: 2
Message Id: 5992
- Name: Kakariko Malo Mart Sold Out Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Sold Out Text
Group: 2
Message Id: 5996
- Name: Kakariko Malo Mart Wooden Shield Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Wooden Shield Text
Group: 2
Message Id: 5998
- Name: Kakariko Malo Mart Hylian Shield Text
- Only If: Shop_Items == On
Name: Kakariko Malo Mart Hylian Shield Text
Group: 2
Message Id: 5999
- Name: Chudleys Shop Magic Armor Text
- Only If: Shop_Items == On
Name: Chudleys Shop Magic Armor Text
Group: 4
Message Id: 5413
- Name: Castle Town Malo Mart Magic Armor After Purchase Text
- Only If: Shop_Items == On
Name: Castle Town Malo Mart Magic Armor After Purchase Text
Group: 4
Message Id: 5433
- Name: Castle Town Malo Mart Magic Armor Text
- Only If: Shop_Items == On
Name: Castle Town Malo Mart Magic Armor Text
Group: 4
Message Id: 5440
- Name: Castle Town Malo Mart Magic Armor Sold Out Text
- Only If: Shop_Items == On
Name: Castle Town Malo Mart Magic Armor Sold Out Text
Group: 4
Message Id: 5451