diff options
author | jbzdarkid <jbzdarkid@gmail.com> | 2018-10-26 19:16:51 -0700 |
---|---|---|
committer | jbzdarkid <jbzdarkid@gmail.com> | 2018-10-26 19:16:51 -0700 |
commit | ba21783815980c695128225ff4a7145e7ed2b192 (patch) | |
tree | 14a8dd189534c90fd37c38a30eca94e54e31bd59 /WitnessRandomizer/WitnessRandomizer.cpp | |
parent | 4edd6ab796f26563368e5b8487df1f1f9bb0684c (diff) | |
download | witness-tutorializer-ba21783815980c695128225ff4a7145e7ed2b192.tar.gz witness-tutorializer-ba21783815980c695128225ff4a7145e7ed2b192.tar.bz2 witness-tutorializer-ba21783815980c695128225ff4a7145e7ed2b192.zip |
Features are done, as much as I care to right now
Diffstat (limited to 'WitnessRandomizer/WitnessRandomizer.cpp')
-rw-r--r-- | WitnessRandomizer/WitnessRandomizer.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp index 70e4fb2..47f9daa 100644 --- a/WitnessRandomizer/WitnessRandomizer.cpp +++ b/WitnessRandomizer/WitnessRandomizer.cpp | |||
@@ -1,8 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * BUGS: | ||
3 | * 3-way in treehouse not working :( | ||
4 | * Mountain orange is copying movement data :( | ||
5 | * Treehouse panels are not copying color? | ||
6 | * FEATURES: | 2 | * FEATURES: |
7 | * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) | 3 | * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) |
8 | ** Think about: Jungle | 4 | ** Think about: Jungle |
@@ -11,8 +7,6 @@ | |||
11 | * Randomize audio logs | 7 | * Randomize audio logs |
12 | * Swap sounds in jungle (along with panels) -- maybe impossible | 8 | * Swap sounds in jungle (along with panels) -- maybe impossible |
13 | * Make orange 7 (all of oranges?) hard. Like big = hard. | 9 | * Make orange 7 (all of oranges?) hard. Like big = hard. |
14 | * Kill panel slowdown in tutorial | ||
15 | * Fix desert elevator (laser rando) / Add keep? | ||
16 | */ | 10 | */ |
17 | #include "Memory.h" | 11 | #include "Memory.h" |
18 | #include "WitnessRandomizer.h" | 12 | #include "WitnessRandomizer.h" |
@@ -44,16 +38,17 @@ int main(int argc, char** argv) | |||
44 | 38 | ||
45 | // Content swaps -- must happen before squarePanels | 39 | // Content swaps -- must happen before squarePanels |
46 | randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE); | 40 | randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE); |
47 | randomizer.Randomize(leftForwardRightPanels, SWAP_LINES | SWAP_STYLE); | 41 | randomizer.Randomize(leftForwardRightPanels, SWAP_LINES); |
48 | 42 | ||
49 | randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE); | 43 | randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE); |
50 | 44 | ||
51 | // Frame swaps -- must happen after squarePanels | 45 | // Frame swaps -- must happen after squarePanels |
52 | randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE); | 46 | randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE); |
53 | 47 | ||
54 | |||
55 | // Target swaps, can happen whenever | 48 | // Target swaps, can happen whenever |
56 | randomizer.Randomize(lasers, SWAP_TARGETS); | 49 | randomizer.Randomize(lasers, SWAP_TARGETS); |
50 | // Read the target of keep front laser, and write it to keep back laser. | ||
51 | randomizer.Overwrite(0x0360E, 0x03317, 0x2BC, sizeof(int)); | ||
57 | 52 | ||
58 | std::vector<int> randomOrder = std::vector(junglePanels.size(), 0); | 53 | std::vector<int> randomOrder = std::vector(junglePanels.size(), 0); |
59 | std::iota(randomOrder.begin(), randomOrder.end(), 0); | 54 | std::iota(randomOrder.begin(), randomOrder.end(), 0); |
@@ -138,7 +133,7 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { | |||
138 | } | 133 | } |
139 | if (flags & SWAP_LINES) { | 134 | if (flags & SWAP_LINES) { |
140 | offsets[0x230] = 16; // traced_edges | 135 | offsets[0x230] = 16; // traced_edges |
141 | offsets[0x220] = sizeof(void*); // *pattern_name | 136 | // offsets[0x220] = sizeof(void*); // *pattern_name |
142 | // offsets[0x240] = sizeof(void*); // *mesh_name | 137 | // offsets[0x240] = sizeof(void*); // *mesh_name |
143 | offsets[0x2FC] = sizeof(int); // is_cylinder | 138 | offsets[0x2FC] = sizeof(int); // is_cylinder |
144 | offsets[0x300] = sizeof(float); // cylinder_z0 | 139 | offsets[0x300] = sizeof(float); // cylinder_z0 |
@@ -164,7 +159,6 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { | |||
164 | offsets[0x440] = sizeof(void*); // *reflection_data | 159 | offsets[0x440] = sizeof(void*); // *reflection_data |
165 | offsets[0x448] = sizeof(int); // grid_size_x | 160 | offsets[0x448] = sizeof(int); // grid_size_x |
166 | offsets[0x44C] = sizeof(int); // grid_size_y | 161 | offsets[0x44C] = sizeof(int); // grid_size_y |
167 | offsets[0x450] = sizeof(int); // style_flags // This is required to not ignore dots | ||
168 | offsets[0x45C] = sizeof(int); // sequence_len | 162 | offsets[0x45C] = sizeof(int); // sequence_len |
169 | offsets[0x460] = sizeof(void*); // *sequence | 163 | offsets[0x460] = sizeof(void*); // *sequence |
170 | offsets[0x468] = sizeof(int); // dot_sequence_len | 164 | offsets[0x468] = sizeof(int); // dot_sequence_len |
@@ -173,8 +167,6 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { | |||
173 | offsets[0x480] = sizeof(void*); // *dot_sequence_reflection | 167 | offsets[0x480] = sizeof(void*); // *dot_sequence_reflection |
174 | offsets[0x4B0] = sizeof(void*); // *panel_target | 168 | offsets[0x4B0] = sizeof(void*); // *panel_target |
175 | offsets[0x4D8] = sizeof(void*); // *specular_texture | 169 | offsets[0x4D8] = sizeof(void*); // *specular_texture |
176 | } | ||
177 | if (flags & SWAP_STYLE) { | ||
178 | offsets[0xC8] = 16; // path_color | 170 | offsets[0xC8] = 16; // path_color |
179 | offsets[0xD8] = 16; // reflection_path_color | 171 | offsets[0xD8] = 16; // reflection_path_color |
180 | // offsets[0xE8] = 16; // deprecated_finished_path_color | 172 | // offsets[0xE8] = 16; // deprecated_finished_path_color |
@@ -204,9 +196,14 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { | |||
204 | offsets[0x4A8] = sizeof(void*); // *colored_regions | 196 | offsets[0x4A8] = sizeof(void*); // *colored_regions |
205 | // offsets[0x4B8] = sizeof(void*); // *backing_texture | 197 | // offsets[0x4B8] = sizeof(void*); // *backing_texture |
206 | } | 198 | } |
199 | if (flags & SWAP_STYLE) { | ||
200 | offsets[0x450] = sizeof(int); // style_flags | ||
201 | } | ||
202 | /* | ||
207 | if (flags & SWAP_BACK_DISTANCE) { | 203 | if (flags & SWAP_BACK_DISTANCE) { |
208 | offsets[0x22C] = sizeof(float); // extra_back_distance | 204 | offsets[0x22C] = sizeof(float); // extra_back_distance |
209 | } | 205 | } |
206 | */ | ||
210 | 207 | ||
211 | for (auto const& [offset, size] : offsets) { | 208 | for (auto const& [offset, size] : offsets) { |
212 | SwapPanelData(panel1, panel2, offset, size); | 209 | SwapPanelData(panel1, panel2, offset, size); |
@@ -262,3 +259,8 @@ void WitnessRandomizer::TurnOn(int panel) { | |||
262 | void WitnessRandomizer::TurnOff(int panel) { | 259 | void WitnessRandomizer::TurnOff(int panel) { |
263 | _memory.WriteData<float>({0x5B28C0, 0x18, panel*8, 0x2A8}, {0.0f, 0.0f}); | 260 | _memory.WriteData<float>({0x5B28C0, 0x18, panel*8, 0x2A8}, {0.0f, 0.0f}); |
264 | } | 261 | } |
262 | |||
263 | void WitnessRandomizer::Overwrite(int panel1, int panel2, int offset, int size) { | ||
264 | std::vector<byte> data = _memory.ReadData<int>({0x5B28C0, 0x18, panel1*8, offset}, size); | ||
265 | _memory.WriteData<byte>({0x5B28C0, 0x18, panel2*8, offset}, data); | ||
266 | } \ No newline at end of file | ||