From 92084d06a5c87338cc988b5bc5868e617213e6b9 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Sun, 24 Nov 2019 12:28:53 -0800 Subject: Try/catch, and select seed --- Source/Randomizer.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'Source/Randomizer.cpp') diff --git a/Source/Randomizer.cpp b/Source/Randomizer.cpp index 13f381a..1427f4d 100644 --- a/Source/Randomizer.cpp +++ b/Source/Randomizer.cpp @@ -129,28 +129,28 @@ void Randomizer::Randomize() { // Sig scans will be run during challenge randomization. // Seed challenge first for future-proofing - RandomizeChallenge(); + MEMORY_CATCH(RandomizeChallenge()); // Content swaps -- must happen before squarePanels - Randomize(upDownPanels, SWAP::LINES | SWAP::COLORS); - Randomize(leftForwardRightPanels, SWAP::LINES | SWAP::COLORS); + MEMORY_CATCH(Randomize(upDownPanels, SWAP::LINES | SWAP::COLORS)); + MEMORY_CATCH(Randomize(leftForwardRightPanels, SWAP::LINES | SWAP::COLORS)); - Randomize(squarePanels, SWAP::LINES | SWAP::COLORS); + MEMORY_CATCH(Randomize(squarePanels, SWAP::LINES | SWAP::COLORS)); // Individual area modifications - RandomizeTutorial(); - RandomizeDesert(); - RandomizeQuarry(); - RandomizeTreehouse(); - RandomizeKeep(); - RandomizeShadows(); - RandomizeMonastery(); - RandomizeBunker(); - RandomizeJungle(); - RandomizeSwamp(); - RandomizeMountain(); - RandomizeTown(); - RandomizeSymmetry(); + MEMORY_CATCH(RandomizeTutorial()); + MEMORY_CATCH(RandomizeDesert()); + MEMORY_CATCH(RandomizeQuarry()); + MEMORY_CATCH(RandomizeTreehouse()); + MEMORY_CATCH(RandomizeKeep()); + MEMORY_CATCH(RandomizeShadows()); + MEMORY_CATCH(RandomizeMonastery()); + MEMORY_CATCH(RandomizeBunker()); + MEMORY_CATCH(RandomizeJungle()); + MEMORY_CATCH(RandomizeSwamp()); + MEMORY_CATCH(RandomizeMountain()); + MEMORY_CATCH(RandomizeTown()); + MEMORY_CATCH(RandomizeSymmetry()); // RandomizeAudioLogs(); } @@ -210,6 +210,7 @@ void Randomizer::RandomizeQuarry() { void Randomizer::RandomizeTreehouse() { // Ensure that whatever pivot panels we have are flagged as "pivotable" + // @Bug: Can return {}, be careful! int panelFlags = _memory->ReadEntityData(0x17DD1, STYLE_FLAGS, 1)[0]; _memory->WriteEntityData(0x17DD1, STYLE_FLAGS, {panelFlags | 0x8000}); panelFlags = _memory->ReadEntityData(0x17CE3, STYLE_FLAGS, 1)[0]; -- cgit 1.4.1