mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-04-28 21:27:58 +03:00
Fix some options not updating correctly when dropping jsons and applying Presets (#5240)
* Re-Run ship init funcs on json drop and preset apply * Prevent registering rando locations from running more than once * Moves registered=true right after early return * Move ShipInit call into applyPreset
This commit is contained in:
parent
4d18a36e1a
commit
554379fd70
9 changed files with 23 additions and 0 deletions
|
@ -34,6 +34,7 @@ void applyPreset(std::vector<PresetEntry> entries) {
|
|||
}
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||
}
|
||||
ShipInit::Init("*");
|
||||
}
|
||||
|
||||
void DrawPresetSelector(PresetType presetTypeId) {
|
||||
|
|
|
@ -59,6 +59,9 @@ void RegisterShuffleCows() {
|
|||
static RegisterShipInitFunc initFunc(RegisterShuffleCows, { "IS_RANDO" });
|
||||
|
||||
void Rando::StaticData::RegisterCowLocations() {
|
||||
static bool registered = false;
|
||||
if (registered) return;
|
||||
registered = true;
|
||||
// clang-format-off
|
||||
locationTable[RC_KF_LINKS_HOUSE_COW] = Location::Base(RC_KF_LINKS_HOUSE_COW, RCQUEST_BOTH, RCTYPE_COW, ACTOR_EN_COW, SCENE_LINKS_HOUSE, 0x00, "Links House Cow", RHT_KF_LINKS_HOUSE_COW, RG_MILK, SpoilerCollectionCheck::RandomizerInf(RAND_INF_COWS_MILKED_KF_LINKS_HOUSE_COW));
|
||||
locationTable[RC_HF_COW_GROTTO_COW] = Location::Base(RC_HF_COW_GROTTO_COW, RCQUEST_BOTH, RCTYPE_COW, RCAREA_HYRULE_FIELD, ACTOR_EN_COW, SCENE_GROTTOS, TWO_ACTOR_PARAMS(3485, -291), "Cow Grotto Cow", RHT_HF_COW_GROTTO_COW, RG_MILK, SpoilerCollectionCheck::RandomizerInf(RAND_INF_COWS_MILKED_HF_COW_GROTTO_COW));
|
||||
|
|
|
@ -278,6 +278,9 @@ void RegisterShuffleCrates() {
|
|||
}
|
||||
|
||||
void Rando::StaticData::RegisterCrateLocations() {
|
||||
static bool registered = false;
|
||||
if (registered) return;
|
||||
registered = true;
|
||||
// clang-format off
|
||||
// Overworld Crates
|
||||
// Randomizer Check Randomizer Check Quest Area Scene ID Params Short Name Hint Text Key Vanilla Spoiler Collection Check
|
||||
|
|
|
@ -185,6 +185,9 @@ void ShuffleFairies_UnregisterHooks() {
|
|||
}
|
||||
|
||||
void Rando::StaticData::RegisterFairyLocations() {
|
||||
static bool registered = false;
|
||||
if (registered) return;
|
||||
registered = true;
|
||||
// clang-format off
|
||||
locationTable[RC_SFM_FAIRY_GROTTO_FAIRY_1] = Location::Fairy(RC_SFM_FAIRY_GROTTO_FAIRY_1, RCQUEST_BOTH, RCAREA_SACRED_FOREST_MEADOW, SCENE_FAIRYS_FOUNTAIN, 0x1800, "Grotto Fairy 1", RHT_SFM_FAIRY_GROTTO_FAIRY, SpoilerCollectionCheck::RandomizerInf(RAND_INF_SFM_FAIRY_GROTTO_FAIRY_1));
|
||||
locationTable[RC_SFM_FAIRY_GROTTO_FAIRY_2] = Location::Fairy(RC_SFM_FAIRY_GROTTO_FAIRY_2, RCQUEST_BOTH, RCAREA_SACRED_FOREST_MEADOW, SCENE_FAIRYS_FOUNTAIN, 0x1801, "Grotto Fairy 2", RHT_SFM_FAIRY_GROTTO_FAIRY, SpoilerCollectionCheck::RandomizerInf(RAND_INF_SFM_FAIRY_GROTTO_FAIRY_2));
|
||||
|
|
|
@ -45,6 +45,9 @@ void ShuffleFreestanding_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* sh
|
|||
}
|
||||
|
||||
void Rando::StaticData::RegisterFreestandingLocations() {
|
||||
static bool registered = false;
|
||||
if (registered) return;
|
||||
registered = true;
|
||||
// clang-format off
|
||||
locationTable[RC_KF_BOULDER_RUPEE_2] = Location::Collectable(RC_KF_BOULDER_RUPEE_2, RCQUEST_BOTH, RCTYPE_FREESTANDING, ACTOR_EN_ITEM00, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-712, 1857), "Boulder Maze Second Rupee", RHT_KOKIRI_FOREST_RUPEE, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_BOULDER_RUPEE_2));
|
||||
locationTable[RC_KF_BOULDER_RUPEE_1] = Location::Collectable(RC_KF_BOULDER_RUPEE_1, RCQUEST_BOTH, RCTYPE_FREESTANDING, ACTOR_EN_ITEM00, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-1009, 1556), "Boulder Maze First Rupee", RHT_KOKIRI_FOREST_RUPEE, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_BOULDER_RUPEE_1));
|
||||
|
|
|
@ -157,6 +157,9 @@ void RegisterShuffleGrass() {
|
|||
|
||||
|
||||
void Rando::StaticData::RegisterGrassLocations() {
|
||||
static bool registered = false;
|
||||
if (registered) return;
|
||||
registered = true;
|
||||
// clang-format off
|
||||
// Overworld Grass
|
||||
// Randomizer Check Randomizer Check Quest Area Scene ID Params Short Name Spoiler Name Hint Text Key Vanilla Spoiler Collection Check
|
||||
|
|
|
@ -95,6 +95,9 @@ void ShufflePots_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va
|
|||
}
|
||||
|
||||
void Rando::StaticData::RegisterPotLocations() {
|
||||
static bool registered = false;
|
||||
if (registered) return;
|
||||
registered = true;
|
||||
// clang-format off
|
||||
// Overworld Pots
|
||||
// Randomizer Check Randomizer Check Quest Area Scene ID Params Short Name Hint Text Key Vanilla Spoiler Collection Check
|
||||
|
|
|
@ -580,6 +580,9 @@ extern "C" {
|
|||
}
|
||||
|
||||
void Rando::StaticData::RegisterFishLocations() {
|
||||
static bool registered = false;
|
||||
if (registered) return;
|
||||
registered = true;
|
||||
// clang-format off
|
||||
// Fishing Pond
|
||||
locationTable[RC_LH_CHILD_FISH_1] = Location::Fish(RC_LH_CHILD_FISH_1, RCQUEST_BOTH, ACTOR_FISHING, SCENE_FISHING_POND, 100, RAND_INF_CHILD_FISH_1, "Child Pond Fish 1", RHT_LH_POND_FISH, RG_NONE);
|
||||
|
|
|
@ -2538,6 +2538,7 @@ void SoH_ProcessDroppedFiles(std::string filePath) {
|
|||
std::dynamic_pointer_cast<Ship::ConsoleWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->ClearBindings();
|
||||
|
||||
gui->SaveConsoleVariablesNextFrame();
|
||||
ShipInit::Init("*");
|
||||
|
||||
uint32_t finalHash = boost::hash_32<std::string>{}(configJson.dump());
|
||||
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Configuration Loaded. Hash: %d", finalHash);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue