mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-04 00:38:59 -04:00
set rando temp flags using flows
This commit is contained in:
@@ -184,6 +184,7 @@ public:
|
||||
int event043(mesg_flow_node_event*, fopAc_ac_c*);
|
||||
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*);
|
||||
#endif
|
||||
|
||||
void initWord(fopAc_ac_c*, const char*, u8, int, fopAc_ac_c**);
|
||||
@@ -200,7 +201,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(46, 43)];
|
||||
static DUSK_GAME_DATA eventFunc mEventList[DUSK_IF_ELSE(47, 43)];
|
||||
|
||||
#if TARGET_PC
|
||||
// patch funcs for rando
|
||||
|
||||
@@ -1947,7 +1947,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(46, 43)] = {
|
||||
DUSK_GAME_DATA eventFunc dMsgFlow_c::mEventList[DUSK_IF_ELSE(47, 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,
|
||||
@@ -1960,7 +1960,7 @@ DUSK_GAME_DATA eventFunc dMsgFlow_c::mEventList[DUSK_IF_ELSE(46, 43)] = {
|
||||
&dMsgFlow_c::event036, &dMsgFlow_c::event037, &dMsgFlow_c::event038, &dMsgFlow_c::event039,
|
||||
&dMsgFlow_c::event040, &dMsgFlow_c::event041, &dMsgFlow_c::event042,
|
||||
#if TARGET_PC
|
||||
&dMsgFlow_c::event043, &dMsgFlow_c::event044, &dMsgFlow_c::event045
|
||||
&dMsgFlow_c::event043, &dMsgFlow_c::event044, &dMsgFlow_c::event045, &dMsgFlow_c::event046,
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -2836,6 +2836,13 @@ int dMsgFlow_c::event045(mesg_flow_node_event* i_flowNode_p, fopAc_ac_c* i_speak
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Sets a rando temporary flag for tracker purposes
|
||||
int dMsgFlow_c::event046(mesg_flow_node_event* i_flowNode_p, fopAc_ac_c* i_speaker_p) {
|
||||
int prm0 = getParam(i_flowNode_p->params);
|
||||
randomizer_setTempFlag({0xFF, (prm0 >> 16) & 0xFF, static_cast<u16>(prm0 & 0xFFFF)});
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Rando patch funcs
|
||||
|
||||
u32 dMsgFlow_c::getKeyForIndex(u16 nodeIdx) {
|
||||
|
||||
@@ -868,7 +868,7 @@ void randomizer_checkAndOverrideEntranceData(const char*& stageName, s8& roomNo,
|
||||
}
|
||||
}
|
||||
|
||||
static void randomizer_setTempFlag(RandomizerContext::itemLocationData data) {
|
||||
void randomizer_setTempFlag(RandomizerContext::itemLocationData data) {
|
||||
// If stage is 0xFF, then this is an event flag
|
||||
if (data.stage == 0xFF) {
|
||||
g_randomizerState.mTrackerTempEventFlag = data.flag;
|
||||
@@ -1314,38 +1314,36 @@ RandomizerContext WriteSeedData(randomizer::logic::world::World* world) {
|
||||
event.params[2] = (params >> 8) & 0xFF;
|
||||
event.params[3] = params & 0xFF;
|
||||
|
||||
// If we have a location flag, construct another FLW node to set the associated
|
||||
// flag right before receiving the item. This is so we set the proper flag
|
||||
// associated with the location before receiving the item so that the tracker/AP
|
||||
// can pick up that it happened
|
||||
if (flwEventNode["Location Flag"]) {
|
||||
auto newFlwIndex = handleCustomFlowID(location->GetName() + " Flag Set Node");
|
||||
mesg_flow_node_event flagEvent{};
|
||||
flagEvent.type = 3; // event type node
|
||||
if (flwEventNode["Location Flag"]["Save Bit Label"]) {
|
||||
u16 saveBitLabel = flwEventNode["Location Flag"]["Save Bit Label"].as<u16>();
|
||||
flagEvent.event_idx = 0; // Event Flag ON
|
||||
flagEvent.params[0] = 0;
|
||||
flagEvent.params[1] = 0;
|
||||
flagEvent.params[2] = (saveBitLabel >> 8) & 0xFF;
|
||||
flagEvent.params[3] = saveBitLabel & 0xFF;
|
||||
}
|
||||
// Construct another FLW node to set the associated flag in a temporary variable
|
||||
// right before we receive the item. This ensures that a tracker/AP can pick up
|
||||
// on the fact that we've received the item.
|
||||
auto newFlwIndex = handleCustomFlowID(location->GetName() + " Flag Set Node");
|
||||
mesg_flow_node_event flagEvent{};
|
||||
flagEvent.type = 3; // event type node
|
||||
flagEvent.event_idx = 46; // Set temporary randomizer flag
|
||||
|
||||
// Store the modified FLW nodes. The flag event takes the place of the original
|
||||
// index we're modifying and then leads into the custom index of the event that
|
||||
// sets up the item id
|
||||
flagEvent.next_node_idx = newFlwIndex;
|
||||
u32 key = (group << 16) | index;
|
||||
randoData.mFlowPatches[key] = std::bit_cast<u64>(flagEvent);
|
||||
|
||||
key = (CUSTOM_BMG_GROUP << 16) | newFlwIndex;
|
||||
randoData.mFlowPatches[key] = std::bit_cast<u64>(event);
|
||||
|
||||
} else {
|
||||
// Store the modified FLW node(s)
|
||||
u32 key = (group << 16) | index;
|
||||
randoData.mFlowPatches[key] = std::bit_cast<u64>(event);
|
||||
u8 stage{0xFF};
|
||||
u16 flag{0xFFFF};
|
||||
if (metaData["Event Flag"]) {
|
||||
flag = metaData["Event Flag"].as<u16>();
|
||||
} else if (metaData["Switch Flag"]) {
|
||||
stage = metaData["Switch Flag"]["Stage"].as<u8>();
|
||||
flag = metaData["Switch Flag"]["Flag"].as<u8>();
|
||||
}
|
||||
flagEvent.params[0] = 0;
|
||||
flagEvent.params[1] = stage;
|
||||
flagEvent.params[2] = (flag >> 8) & 0xFF;
|
||||
flagEvent.params[3] = flag & 0xFF;
|
||||
|
||||
// Store the modified FLW nodes. The flag event takes the place of the original
|
||||
// index we're modifying and then leads into the custom index of the event that
|
||||
// sets up the item id
|
||||
flagEvent.next_node_idx = newFlwIndex;
|
||||
u32 key = (group << 16) | index;
|
||||
randoData.mFlowPatches[key] = std::bit_cast<u64>(flagEvent);
|
||||
|
||||
key = (CUSTOM_BMG_GROUP << 16) | newFlwIndex;
|
||||
randoData.mFlowPatches[key] = std::bit_cast<u64>(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -222,6 +222,8 @@ void randomizer_checkAndOverrideEntranceData(const char*& i_Name, s8& i_RoomNo,
|
||||
* variable. This allows the tracker/Archipelago to know a location has been checked
|
||||
* when the item is received instead of some indeterminate amount of time afterward.
|
||||
*/
|
||||
void randomizer_setTempFlag(RandomizerContext::itemLocationData);
|
||||
|
||||
void randomizer_setTempFlagForLocation(const std::string& locationName);
|
||||
|
||||
void randomizer_setTempFlagForFLWOverride(u32 key);
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
Index: 0x18F
|
||||
Next Node Index: 0x116
|
||||
Parameters: 0x0001004A
|
||||
Location Flag:
|
||||
Save Bit Label: 0x20
|
||||
Name Lookup:
|
||||
- Uli Cradle Delivery
|
||||
Event Flag: 0x0301
|
||||
@@ -1521,8 +1519,6 @@
|
||||
Index: 0x19A
|
||||
Next Node Index: 0xF5
|
||||
Parameters: 0x00010080
|
||||
Location Flag:
|
||||
Save Bit Label: 0x79
|
||||
Name Lookup:
|
||||
- Renados Letter
|
||||
Event Flag: 0x0F80
|
||||
@@ -1552,8 +1548,6 @@
|
||||
Index: 0x55
|
||||
Next Node Index: 0x25
|
||||
Parameters: 0x00010031
|
||||
Location Flag:
|
||||
Save Bit Label: 0x46
|
||||
Name Lookup:
|
||||
- Rutelas Blessing
|
||||
Event Flag: 0x0804
|
||||
@@ -1571,8 +1565,6 @@
|
||||
Index: 0x339
|
||||
Next Node Index: 0x1ED
|
||||
Parameters: 0x0001003D
|
||||
Location Flag:
|
||||
Save Bit Label: 0x1E0
|
||||
Name Lookup:
|
||||
- Gift From Ralis
|
||||
Event Flag: 0x3B80
|
||||
@@ -1946,8 +1938,6 @@
|
||||
Index: 0x610
|
||||
Next Node Index: 0x439
|
||||
Parameters: 0x000100E9
|
||||
Location Flag:
|
||||
Save Bit Label: 0x30F
|
||||
Name Lookup:
|
||||
- Skybook From Impaz
|
||||
Event Flag: 0x5F80
|
||||
@@ -1988,8 +1978,6 @@
|
||||
Index: 0x32
|
||||
Next Node Index: 0x2A
|
||||
Parameters: 0x00010083
|
||||
Location Flag:
|
||||
Save Bit Label: 0x116
|
||||
Name Lookup:
|
||||
- Ilia Charm
|
||||
Event Flag: 0x2280
|
||||
@@ -2463,8 +2451,6 @@
|
||||
Index: 0x276
|
||||
Next Node Index: 0x1A5
|
||||
Parameters: 0x00010055
|
||||
# Location Flag: Can't be set first otherwise event flow gets messed up
|
||||
# Save Bit Label: 0x122
|
||||
Name Lookup:
|
||||
- STAR Prize 1
|
||||
Event Flag: 0x2308
|
||||
@@ -2482,8 +2468,6 @@
|
||||
Index: 0x269
|
||||
Next Node Index: 0x1A1
|
||||
Parameters: 0x00010056
|
||||
# Location Flag: Can't be set first otherwise event flow gets messed up
|
||||
# Save Bit Label: 0x125
|
||||
Name Lookup:
|
||||
- STAR Prize 2
|
||||
Event Flag: 0x2301
|
||||
|
||||
Reference in New Issue
Block a user