properly patch CT malo mart door to be open at any time of day

This commit is contained in:
gymnast86
2026-06-20 10:24:17 -07:00
parent 4d8fcfa551
commit 6bf0dfd92a
2 changed files with 65 additions and 33 deletions
+7
View File
@@ -199,6 +199,13 @@ public:
static queryFunc mQueryList[DUSK_IF_ELSE(54, 53)];
static eventFunc mEventList[DUSK_IF_ELSE(45, 43)];
#if TARGET_PC
// patch funcs for rando
void randoPatchNodeType(u8& type, u16 nodeIdx);
void randoPatchBranchNode(mesg_flow_node_branch*& branch_node, u16 nodeIdx);
void randoPatchEventNode(mesg_flow_node_event*& event_node, u16 nodeIdx);
#endif
private:
/* 0x04 */ u8* mFlow_p;
/* 0x08 */ u8* mLabelInfo_p;
+58 -33
View File
@@ -116,6 +116,10 @@ int dMsgFlow_c::checkOpenDoor(fopAc_ac_c* i_speaker_p, int* param_2) {
while ((nodeIdx != 0xFFFF && !var_r27) && !var_r25) {
u8 type = mFlowNodeTBL[nodeIdx].message.type;
#if TARGET_PC
randoPatchNodeType(type, nodeIdx);
#endif
switch(type) {
case NODETYPE_MESSAGE_e: {
msg_node = &mFlowNodeTBL[nodeIdx].message;
@@ -126,6 +130,10 @@ int dMsgFlow_c::checkOpenDoor(fopAc_ac_c* i_speaker_p, int* param_2) {
case NODETYPE_BRANCH_e: {
branch_node = (mesg_flow_node_branch*)&mFlowNodeTBL[nodeIdx].branch;
#if TARGET_PC
randoPatchBranchNode(branch_node, nodeIdx);
#endif
switch(branch_node->query_idx) {
case 0:
case 4:
@@ -145,6 +153,10 @@ int dMsgFlow_c::checkOpenDoor(fopAc_ac_c* i_speaker_p, int* param_2) {
case NODETYPE_EVENT_e: {
event_node = &mFlowNodeTBL[nodeIdx].event;
#if TARGET_PC
randoPatchEventNode(event_node, nodeIdx);
#endif
switch(event_node->event_idx) {
case 12:
var_r27 = TRUE;
@@ -658,17 +670,7 @@ int dMsgFlow_c::branchNodeProc(fopAc_ac_c* i_speaker_p, fopAc_ac_c** i_talkPartn
node = &mFlowNodeTBL[mNodeIdx].branch;
#if TARGET_PC
// Overwrite this node if we have a patch for it
if (randomizer_IsActive()) {
u32 key = (dMsgObject_getGroupID() << 16) | mNodeIdx;
// Dirty check to see if this node is part of bmg 0
if (*(reinterpret_cast<u16*>(&mFlowNodeTBL[0])) == 0x0803) {
key &= 0x0000FFFF;
}
if (randomizer_GetContext().mFlowPatches.contains(key)) {
node = reinterpret_cast<mesg_flow_node_branch*>(&randomizer_GetContext().mFlowPatches[key]);
}
}
randoPatchBranchNode(node, mNodeIdx);
#endif
u16 proc_status = (this->*mQueryList[node->query_idx])(node, i_speaker_p, 1);
@@ -682,17 +684,7 @@ int dMsgFlow_c::eventNodeProc(fopAc_ac_c* i_speaker_p, fopAc_ac_c** i_talkPartne
mesg_flow_node_event* node = NULL;
node = &mFlowNodeTBL[mNodeIdx].event;
#if TARGET_PC
// Overwrite this node if we have a patch for it
if (randomizer_IsActive()) {
u32 key = (dMsgObject_getGroupID() << 16) | mNodeIdx;
// Dirty check to see if this node is part of bmg 0
if (*(reinterpret_cast<u16*>(&mFlowNodeTBL[0])) == 0x0803) {
key &= 0x0000FFFF;
}
if (randomizer_GetContext().mFlowPatches.contains(key)) {
node = reinterpret_cast<mesg_flow_node_event*>(&randomizer_GetContext().mFlowPatches[key]);
}
}
randoPatchEventNode(node, mNodeIdx);
#endif
int proc_status = (this->*mEventList[node->event_idx])(node, i_speaker_p);
@@ -767,17 +759,7 @@ int dMsgFlow_c::nodeProc(fopAc_ac_c* i_speaker_p, fopAc_ac_c** i_talkPartners) {
u8 type = mFlowNodeTBL[mNodeIdx].message.type;
#if TARGET_PC
// Overwrite the type if we have a patch for this index
if (randomizer_IsActive()) {
u32 key = (dMsgObject_getGroupID() << 16) | mNodeIdx;
// Dirty check to see if this node is part of bmg 0
if (*(reinterpret_cast<u16*>(&mFlowNodeTBL[0])) == 0x0803) {
key &= 0x0000FFFF;
}
if (randomizer_GetContext().mFlowPatches.contains(key)) {
type = reinterpret_cast<mesg_flow_node*>(&randomizer_GetContext().mFlowPatches[key])->type;
}
}
randoPatchNodeType(type, mNodeIdx);
#endif
switch (type) {
case NODETYPE_MESSAGE_e:
@@ -2749,4 +2731,47 @@ int dMsgFlow_c::event044(mesg_flow_node_event* i_flowNode_p, fopAc_ac_c* i_speak
}
return 1;
}
// Rando patch funcs
void dMsgFlow_c::randoPatchNodeType(u8& type, u16 nodeIdx) {
// Overwrite the type if we have a patch for this index
if (randomizer_IsActive()) {
u32 key = (dMsgObject_getGroupID() << 16) | nodeIdx;
// Dirty check to see if this node is part of bmg 0
if (*(reinterpret_cast<u16*>(&mFlowNodeTBL[0])) == 0x0803) {
key &= 0x0000FFFF;
}
if (randomizer_GetContext().mFlowPatches.contains(key)) {
type = reinterpret_cast<mesg_flow_node*>(&randomizer_GetContext().mFlowPatches[key])->type;
}
}
}
void dMsgFlow_c::randoPatchBranchNode(mesg_flow_node_branch*& branch_node, u16 nodeIdx) {
// Overwrite this node if we have a patch for it
if (randomizer_IsActive()) {
u32 key = (dMsgObject_getGroupID() << 16) | nodeIdx;
// Dirty check to see if this node is part of bmg 0
if (*(reinterpret_cast<u16*>(&mFlowNodeTBL[0])) == 0x0803) {
key &= 0x0000FFFF;
}
if (randomizer_GetContext().mFlowPatches.contains(key)) {
branch_node = reinterpret_cast<mesg_flow_node_branch*>(&randomizer_GetContext().mFlowPatches[key]);
}
}
}
void dMsgFlow_c::randoPatchEventNode(mesg_flow_node_event*& event_node, u16 nodeIdx) {
// Overwrite this node if we have a patch for it
if (randomizer_IsActive()) {
u32 key = (dMsgObject_getGroupID() << 16) | nodeIdx;
// Dirty check to see if this node is part of bmg 0
if (*(reinterpret_cast<u16*>(&mFlowNodeTBL[0])) == 0x0803) {
key &= 0x0000FFFF;
}
if (randomizer_GetContext().mFlowPatches.contains(key)) {
event_node = reinterpret_cast<mesg_flow_node_event*>(&randomizer_GetContext().mFlowPatches[key]);
}
}
}
#endif