diff --git a/projects/Randomizer/features/wheel_initialization.cpp b/projects/Randomizer/features/wheel_initialization.cpp index 011e13ca10b..9d8e09f5478 100644 --- a/projects/Randomizer/features/wheel_initialization.cpp +++ b/projects/Randomizer/features/wheel_initialization.cpp @@ -41,7 +41,7 @@ namespace randomizer::features::wheel { initialize_item(9000, 0, "Show last pickup", "Displays the message associated\nwith the last pickup.", "file:assets/icons/wheel/show_last_pickup.blue.png", [](auto, auto, auto) { core::message_controller().requeue_last_saved(); }); initialize_item(9000, 1, "Show progress, with hints.", "Displays current goal mode progress and bought hints.", "file:assets/icons/wheel/progress_summary.blue.png", - [](auto, auto, auto) { }); + [](auto, auto, auto) { game_seed().grant(core::api::uber_states::UberState(UberStateGroup::GameState, 8), 0); }); initialize_item(9000, 2, "Warp to credits", "Warp directly to the credits,\nonly works if you have finished the bingo.", "file:assets/icons/wheel/warp_to_credits.blue.png", [](auto, auto, auto) { if (core::api::uber_states::UberState().get()) { diff --git a/projects/Randomizer/game/behaviour_changes/teleporter_map_activation.cpp b/projects/Randomizer/game/behaviour_changes/teleporter_map_activation.cpp index 577de4eb5d6..0083a4b34e9 100644 --- a/projects/Randomizer/game/behaviour_changes/teleporter_map_activation.cpp +++ b/projects/Randomizer/game/behaviour_changes/teleporter_map_activation.cpp @@ -1,4 +1,5 @@ #include +#include #include @@ -49,6 +50,7 @@ namespace { auto it = tps_by_position.find(std::make_pair(static_cast(position.x), static_cast(position.y))); if (it != tps_by_position.end()) { it->second.set(true); + randomizer::queue_reach_check(); } } diff --git a/projects/Randomizer/seed/seed.cpp b/projects/Randomizer/seed/seed.cpp index 89210dbb1b1..517ba5d1d9c 100644 --- a/projects/Randomizer/seed/seed.cpp +++ b/projects/Randomizer/seed/seed.cpp @@ -153,6 +153,10 @@ namespace randomizer::seed { break; } } + + if (!to_grant.empty()) { + queue_reach_check(); + } } void Seed::call_procedure(int id) { diff --git a/projects/Randomizer/uber_states/trigger_reach_check.cpp b/projects/Randomizer/uber_states/trigger_reach_check.cpp index f7b42993f51..66edb7d1a19 100644 --- a/projects/Randomizer/uber_states/trigger_reach_check.cpp +++ b/projects/Randomizer/uber_states/trigger_reach_check.cpp @@ -12,6 +12,13 @@ namespace randomizer::uber_states { std::unordered_set tracked_states; + auto on_after_respawn = core::api::game::event_bus().register_handler( + GameEvent::Respawn, EventTiming::After, [](auto, auto) { queue_reach_check(); }); + auto on_after_checkpoint_loaded = core::api::game::event_bus().register_handler( + GameEvent::FinishedLoadingCheckpoint, EventTiming::After, [](auto, auto) { queue_reach_check(); }); + auto on_after_save_loaded = core::api::game::event_bus().register_handler( + GameEvent::FinishedLoadingSave, EventTiming::After, [](auto, auto) { queue_reach_check(); }); + auto on_uber_state = notification_bus().register_handler([](auto params) { if (tracked_states.contains(params.state)) { queue_reach_check(); @@ -21,6 +28,7 @@ namespace randomizer::uber_states { auto on_game_ready = modloader::event_bus().register_handler(ModloaderEvent::GameReady, [](auto) { std::ifstream state_data(modloader::base_path() / "state_data.csv"); std::string line; + std::getline(state_data, line); while (std::getline(state_data, line)) { std::vector parts; split_str(line, parts, ','); @@ -28,15 +36,12 @@ namespace randomizer::uber_states { trim(str); } - auto& condition_part = parts[2]; - if (parts.size() >= 4) { - condition_part += ">="; - condition_part += parts[3].empty() ? "0" : parts[3]; + int group, state; + if (!string_convert(parts[1], group) || !string_convert(parts[2], state)) { + continue; } - UberStateCondition condition; - core::api::uber_states::parse_condition(std::span(parts.begin() + 1, parts.begin() + 3), condition); - tracked_states.emplace(condition.state); + tracked_states.emplace(UberState(group, state)); } }); } // namespace