diff options
Diffstat (limited to 'WitnessRandomizer/WitnessRandomizer.cpp')
| -rw-r--r-- | WitnessRandomizer/WitnessRandomizer.cpp | 33 | 
1 files changed, 27 insertions, 6 deletions
| diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp index e7ab2aa..7827ddb 100644 --- a/WitnessRandomizer/WitnessRandomizer.cpp +++ b/WitnessRandomizer/WitnessRandomizer.cpp | |||
| @@ -1,8 +1,12 @@ | |||
| 1 | /* | 1 | /* | 
| 2 | * TODO: Split out main() logic into another file, and move into separate functions for easier testing. Then write tests. | ||
| 2 | * BUGS: | 3 | * BUGS: | 
| 3 | * Shipwreck vault fails, possibly because of dot_reflection? | 4 | * Shipwreck vault fails, possibly because of dot_reflection? Sometimes? | 
| 4 | * Treehouse pivots *should* work, but I need to not copy style_flags. | 5 | * Treehouse pivots *should* work, but I need to not copy style_flags. | 
| 5 | This seems to cause crashes when pivots appear elsewhere in the world. | 6 | This seems to cause crashes when pivots appear elsewhere in the world. | 
| 7 | * Some panels are impossible casually: (idc, I think) | ||
| 8 | ** Town Stars, Invisible dots | ||
| 9 | * Something is wrong with jungle | ||
| 6 | * FEATURES: | 10 | * FEATURES: | 
| 7 | * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) | 11 | * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) | 
| 8 | ** Think about: Jungle | 12 | ** Think about: Jungle | 
| @@ -34,7 +38,6 @@ size_t find(const std::vector<T> &data, T search, size_t startIndex = 0) { | |||
| 34 | 38 | ||
| 35 | int main(int argc, char** argv) | 39 | int main(int argc, char** argv) | 
| 36 | { | 40 | { | 
| 37 | |||
| 38 | WitnessRandomizer randomizer = WitnessRandomizer(); | 41 | WitnessRandomizer randomizer = WitnessRandomizer(); | 
| 39 | 42 | ||
| 40 | if (argc == 2) { | 43 | if (argc == 2) { | 
| @@ -45,6 +48,22 @@ int main(int argc, char** argv) | |||
| 45 | srand(seed); | 48 | srand(seed); | 
| 46 | } | 49 | } | 
| 47 | 50 | ||
| 51 | /* | ||
| 52 | randomizer.SwapPanels(0x0007C, 0x0005D, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 1 | ||
| 53 | randomizer.SwapPanels(0x0007E, 0x0005E, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 2 | ||
| 54 | randomizer.SwapPanels(0x00075, 0x0005F, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 3 | ||
| 55 | randomizer.SwapPanels(0x00073, 0x00060, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 4 | ||
| 56 | randomizer.SwapPanels(0x00077, 0x00061, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 5 | ||
| 57 | 0x00079; // Symmetry Island Colored Dots 6 | ||
| 58 | |||
| 59 | 0x0005D; // Outside Tutorial Dots Tutorial 1 | ||
| 60 | 0x0005E; // Outside Tutorial Dots Tutorial 2 | ||
| 61 | 0x0005F; // Outside Tutorial Dots Tutorial 3 | ||
| 62 | 0x00060; // Outside Tutorial Dots Tutorial 4 | ||
| 63 | 0x00061; // Outside Tutorial Dots Tutorial 5 | ||
| 64 | */ | ||
| 65 | |||
| 66 | |||
| 48 | // Content swaps -- must happen before squarePanels | 67 | // Content swaps -- must happen before squarePanels | 
| 49 | randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE); | 68 | randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE); | 
| 50 | randomizer.Randomize(leftForwardRightPanels, SWAP_LINES); | 69 | randomizer.Randomize(leftForwardRightPanels, SWAP_LINES); | 
| @@ -60,8 +79,10 @@ int main(int argc, char** argv) | |||
| 60 | std::vector<int> keepFrontLaserTarget = randomizer.ReadPanelData<int>(0x0360E, TARGET, 1); | 79 | std::vector<int> keepFrontLaserTarget = randomizer.ReadPanelData<int>(0x0360E, TARGET, 1); | 
| 61 | randomizer.WritePanelData<int>(0x03317, TARGET, keepFrontLaserTarget); | 80 | randomizer.WritePanelData<int>(0x03317, TARGET, keepFrontLaserTarget); | 
| 62 | 81 | ||
| 63 | /* Jungle */ | 82 | std::vector<int> randomOrder; | 
| 64 | std::vector<int> randomOrder = std::vector(junglePanels.size(), 0); | 83 | |
| 84 | /* Jungle | ||
| 85 | randomOrder = std::vector(junglePanels.size(), 0); | ||
| 65 | std::iota(randomOrder.begin(), randomOrder.end(), 0); | 86 | std::iota(randomOrder.begin(), randomOrder.end(), 0); | 
| 66 | // Randomize Waves 2-7 | 87 | // Randomize Waves 2-7 | 
| 67 | // Waves 1 cannot be randomized, since no other panel can start on | 88 | // Waves 1 cannot be randomized, since no other panel can start on | 
| @@ -69,6 +90,7 @@ int main(int argc, char** argv) | |||
| 69 | // Randomize Pitches 1-6 onto themselves | 90 | // Randomize Pitches 1-6 onto themselves | 
| 70 | randomizer.RandomizeRange(randomOrder, SWAP_NONE, 7, 13); | 91 | randomizer.RandomizeRange(randomOrder, SWAP_NONE, 7, 13); | 
| 71 | randomizer.ReassignTargets(junglePanels, randomOrder); | 92 | randomizer.ReassignTargets(junglePanels, randomOrder); | 
| 93 | */ | ||
| 72 | 94 | ||
| 73 | /* Bunker */ | 95 | /* Bunker */ | 
| 74 | randomOrder = std::vector(bunkerPanels.size(), 0); | 96 | randomOrder = std::vector(bunkerPanels.size(), 0); | 
| @@ -104,7 +126,6 @@ int main(int argc, char** argv) | |||
| 104 | 126 | ||
| 105 | randomizer.ReassignTargets(monasteryPanels, randomOrder); | 127 | randomizer.ReassignTargets(monasteryPanels, randomOrder); | 
| 106 | */ | 128 | */ | 
| 107 | |||
| 108 | } | 129 | } | 
| 109 | 130 | ||
| 110 | WitnessRandomizer::WitnessRandomizer() | 131 | WitnessRandomizer::WitnessRandomizer() | 
| @@ -117,7 +138,7 @@ WitnessRandomizer::WitnessRandomizer() | |||
| 117 | // Distance-gate shadows laser to prevent sniping through the bars | 138 | // Distance-gate shadows laser to prevent sniping through the bars | 
| 118 | WritePanelData<float>(0x19650, MAX_BROADCAST_DISTANCE, {2.5f}); | 139 | WritePanelData<float>(0x19650, MAX_BROADCAST_DISTANCE, {2.5f}); | 
| 119 | // Change the shadows tutorial cable to only activate avoid | 140 | // Change the shadows tutorial cable to only activate avoid | 
| 120 | WritePanelData<int>(0x319A8, 0xD8, {0}); | 141 | WritePanelData<int>(0x319A8, CABLE_TARGET_2, {0}); | 
| 121 | // Change shadows avoid 8 to power shadows follow | 142 | // Change shadows avoid 8 to power shadows follow | 
| 122 | WritePanelData<int>(0x1972F, TARGET, {0x1C34C}); | 143 | WritePanelData<int>(0x1972F, TARGET, {0x1C34C}); | 
| 123 | 144 | ||
