summary refs log tree commit diff stats
path: root/WitnessRandomizer/WitnessRandomizer.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-10-23 22:12:38 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-10-23 22:12:38 -0700
commit922dbb03a50a54f3e5ae9efaec3b4759cd701c3e (patch)
tree08c0053b92b1e32e3c74b074815411f71e497eb5 /WitnessRandomizer/WitnessRandomizer.cpp
parentfac6378cf7370b93099ff73851cc9a0b68497335 (diff)
downloadwitness-tutorializer-922dbb03a50a54f3e5ae9efaec3b4759cd701c3e.tar.gz
witness-tutorializer-922dbb03a50a54f3e5ae9efaec3b4759cd701c3e.tar.bz2
witness-tutorializer-922dbb03a50a54f3e5ae9efaec3b4759cd701c3e.zip
move panels to new file, additional filtering, additional swapping.
Diffstat (limited to 'WitnessRandomizer/WitnessRandomizer.cpp')
-rw-r--r--WitnessRandomizer/WitnessRandomizer.cpp710
1 files changed, 52 insertions, 658 deletions
diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp index 9178888..4b91dac 100644 --- a/WitnessRandomizer/WitnessRandomizer.cpp +++ b/WitnessRandomizer/WitnessRandomizer.cpp
@@ -1,14 +1,23 @@
1/* 1/*
2 * BUGS: 2 * BUGS:
3 * Something is wrong with bunker 3 * Something is wrong with bunker
4 * Shipwreck vault does not copy well
5 * Pillars can be swapped but they don't zoom you out enough. Maybe SWAP_DISTANCE?
4 * FEATURES: 6 * FEATURES:
7 * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?)
5 * Randomize audio logs 8 * Randomize audio logs
6 * Compile panel lists in a more reasonable way
7 * Separate panels out by "square", which can probably be anywhere 9 * Separate panels out by "square", which can probably be anywhere
8 * List of panels which can be valid "Burn" (aka desert) substitutes: Prevent (or limit) panel counting 10 * List of panels which can be valid "Burn" (aka desert) substitutes: Prevent (or limit) panel counting
11 * List of panels which split left/right (for left/right controls)
12 * List of panels which split up/down (for up/down controls)
13 * Swap sounds in jungle (along with panels) -- maybe impossible
14 * Make orange 7 (all of oranges?) hard. Like big = hard.
15 * TRY:
16 * Swap treehouse pivots
9*/ 17*/
10#include "Memory.h" 18#include "Memory.h"
11#include "WitnessRandomizer.h" 19#include "WitnessRandomizer.h"
20#include "Panels.h"
12#include <string> 21#include <string>
13#include <iostream> 22#include <iostream>
14 23
@@ -16,657 +25,42 @@ int main(int argc, char** argv)
16{ 25{
17 WitnessRandomizer randomizer = WitnessRandomizer(); 26 WitnessRandomizer randomizer = WitnessRandomizer();
18 27
19 //*
20
21 std::vector<int> lasers = {
22 0x0360D, // Symmetry
23 0x03615, // Swamp
24 0x09DE0, // Bunker
25 0x17CA4, // Monastery
26 0x032F5, // Town
27 0x03613, // Treehouse
28// 0x03608, // Desert
29 0x03612, // Quarry
30 0x03616, // Jungle
31 };
32 randomizer.Randomize(lasers, SWAP_TARGETS);
33
34
35 if (argc == 2) { 28 if (argc == 2) {
36 srand(atoi(argv[1])); // Seed with RNG from command line 29 srand(atoi(argv[1])); // Seed with RNG from command line
37 } 30 }
38 31
39 std::vector<int> tutorialPanels = { 32 // randomizer.Randomize(bunkerPanels, SWAP_LINES | SWAP_COLORS);
40 // 0x0A3B5, // Back Left 33 //*
41 0x0A3B2, // Back Right 34 randomizer.Randomize(lasers, SWAP_TARGETS);
42 0x00295, // Center Left 35 randomizer.Randomize(tutorialPanels, SWAP_TARGETS);
43 0x00293, // Front Center 36 randomizer.Randomize(monasteryPanels, SWAP_TARGETS);
44 0x002C2, // Front Left 37 randomizer.Randomize(shadowsPanels, SWAP_TARGETS);
45 0x0C335, // Pillar
46 0x0C373, // Patio floor
47 };
48
49 randomizer.Randomize(tutorialPanels, SWAP_TARGETS);
50
51 std::vector<int> outsidetutorialPanels = {
52 0x0005D, //Outside Tutorial Dots Tutorial 1
53 0x0005E, //Outside Tutorial Dots Tutorial 2
54 0x0005F, //Outside Tutorial Dots Tutorial 3
55 0x00060, //Outside Tutorial Dots Tutorial 4
56 0x00061, //Outside Tutorial Dots Tutorial 5
57 0x018AF, //Outside Tutorial Stones Tutorial 1
58 0x0001B, //Outside Tutorial Stones Tutorial 2
59 0x012C9, //Outside Tutorial Stones Tutorial 3
60 0x0001C, //Outside Tutorial Stones Tutorial 4
61 0x0001D, //Outside Tutorial Stones Tutorial 5
62 0x0001E, //Outside Tutorial Stones Tutorial 6
63 0x0001F, //Outside Tutorial Stones Tutorial 7
64 0x00020, //Outside Tutorial Stones Tutorial 8
65 0x00021, //Outside Tutorial Stones Tutorial 9
66 0x033D4, //Outside Tutorial Vault
67// 0x03481, //Outside Tutorial Vault Box
68 0x0A171, //Tutorial Optional Door 1
69 0x04CA4, //Tutorial Optional Door 2
70 0x17CFB, //Outside Tutorial Discard
71// 0x00143. //Orchard Apple Tree 1
72// 0x0003B. //Orchard Apple Tree 2
73// 0x00055. //Orchard Apple Tree 3
74// 0x032F7. //Orchard Apple Tree 4
75// 0x032FF. //Orchard Apple Tree 5
76 };
77 randomizer.Randomize(outsidetutorialPanels, SWAP_LINES | SWAP_COLORS);
78
79
80 std::vector<int> symmetryPanels = {
81// 0x3C12B, // Glass Factory Discard
82 0x01A54, // Glass Factory Entry
83 0x00086, // Glass Factory Vertical Symmetry 1
84 0x00087, // Glass Factory Vertical Symmetry 2
85 0x00059, // Glass Factory Vertical Symmetry 3
86 0x00062, // Glass Factory Vertical Symmetry 4
87 0x0005C, // Glass Factory Vertical Symmetry 5
88 // 0x17CC8, // Glass Factory Summon Boat
89 0x0008D, // Glass Factory Rotational Symmetry 1
90 0x00081, // Glass Factory Rotational Symmetry 2
91 0x00083, // Glass Factory Rotational Symmetry 3
92 0x00084, // Glass Factory Melting 1
93 0x00082, // Glass Factory Melting 2
94 0x0343A, // Glass Factory Melting 3
95
96 0x000B0, // Symmetry Island Door 1
97 0x00022, // Symmetry Island Black Dots 1
98 0x00023, // Symmetry Island Black Dots 2
99 0x00024, // Symmetry Island Black Dots 3
100 0x00025, // Symmetry Island Black Dots 4
101 0x00026, // Symmetry Island Black Dots 5
102 0x0007C, // Symmetry Island Colored Dots 1
103 0x0007E, // Symmetry Island Colored Dots 2
104 0x00075, // Symmetry Island Colored Dots 3
105 0x00073, // Symmetry Island Colored Dots 4
106 0x00077, // Symmetry Island Colored Dots 5
107 0x00079, // Symmetry Island Colored Dots 6
108 0x00065, // Symmetry Island Fading Lines 1
109 0x0006D, // Symmetry Island Fading Lines 2
110 0x00072, // Symmetry Island Fading Lines 3
111 0x0006F, // Symmetry Island Fading Lines 4
112 0x00070, // Symmetry Island Fading Lines 5
113 0x00071, // Symmetry Island Fading Lines 6
114 0x00076, // Symmetry Island Fading Lines 7
115 // 0x009B8, // Symmetry Island Transparent 1 // Too mean for right now
116 // 0x003E8, // Symmetry Island Transparent 2 // Too mean for right now
117 // 0x00A15, // Symmetry Island Transparent 3 // Too mean for right now
118 // 0x00B53, // Symmetry Island Transparent 4 // Too mean for right now
119 // 0x00B8D, // Symmetry Island Transparent 5 // Too mean for right now
120 // 0x1C349, // Symmetry Island Door 2 - Collision fails here, sadly
121 0x00A52, // Symmetry Island Laser Yellow 1
122 0x00A57, // Symmetry Island Laser Yellow 2
123 0x00A5B, // Symmetry Island Laser Yellow 3
124 0x00A61, // Symmetry Island Laser Blue 1
125 0x00A64, // Symmetry Island Laser Blue 2
126 0x00A68, // Symmetry Island Laser Blue 3
127 };
128 randomizer.Randomize(symmetryPanels, SWAP_LINES | SWAP_COLORS);
129
130
131
132 std::vector<int> desertPanels = {
133// 0x17CE7, // Desert Discard
134// 0x0CC7B, // Desert Vault
135// 0x0339E, // Desert Vault Box
136 0x00698, // Desert Surface 1
137 0x0048F, // Desert Surface 2
138 0x09F92, // Desert Surface 3
139// 0x09FA0, // Desert Surface 3 Control
140 0x0A036, // Desert Surface 4
141 0x09DA6, // Desert Surface 5
142 0x0A049, // Desert Surface 6
143 0x0A053, // Desert Surface 7
144 0x09F94, // Desert Surface 8
145// 0x09F86, // Desert Surface 8 Control
146// 0x0C339, // Desert Surface Door
147// 0x09FAA, // Desert Lightswitch
148 0x00422, // Desert Light 1
149 0x006E3, // Desert Light 2
150// 0x0A02D, // Desert Light 3
151 0x00C72, // Desert Pond 1
152 0x0129D, // Desert Pond 2
153 0x008BB, // Desert Pond 3
154 0x0078D, // Desert Pond 4
155 0x18313, // Desert Pond 5
156// 0x0A249, // Desert Pond Exit Door
157// 0x1C2DF, // Desert Flood Control Lower Far Left
158// 0x1831E, // Desert Flood Control Lower Far Right
159// 0x1C260, // Desert Flood Control Lower Near Left
160// 0x1831C, // Desert Flood Control Lower Near Right
161// 0x1C2F3, // Desert Flood Control Raise Far Left
162// 0x1831D, // Desert Flood Control Raise Far Right
163// 0x1C2B1, // Desert Flood Control Raise Near Left
164// 0x1831B, // Desert Flood Control Raise Near Right
165 0x04D18, // Desert Flood 1
166 0x01205, // Desert Flood 2
167 0x181AB, // Desert Flood 3
168 0x0117A, // Desert Flood 4
169 0x17ECA, // Desert Flood 5
170// 0x18076, // Desert Flood Exit
171// 0x0A15C, // Desert Final Left Convex
172// 0x09FFF, // Desert Final Left Concave
173// 0x0A15F, // Desert Final Near
174// 0x17C31, // Desert Final Transparent
175 0x012D7, // Desert Final Far
176// 0x0A015, // Desert Final Far Control
177 };
178
179 randomizer.Randomize(desertPanels, SWAP_LINES);
180
181 std::vector<int> quarryPanels = {
182 0x01E5A, // Mill Entry Door Left
183 0x01E59, // Mill Entry Door Right
184// 0x03678, // Mill Lower Ramp Contol
185 0x00E0C, // Mill Lower Row 1
186 0x01489, // Mill Lower Row 2
187 0x0148A, // Mill Lower Row 3
188 0x014D9, // Mill Lower Row 4
189 0x014E7, // Mill Lower Row 5
190 0x014E8, // Mill Lower Row 6
191// 0x03679, // Mill Lower Lift Control
192 0x00557, // Mill Upper Row 1
193 0x005F1, // Mill Upper Row 2
194 0x00620, // Mill Upper Row 3
195 0x009F5, // Mill Upper Row 4
196 0x0146C, // Mill Upper Row 5
197 0x3C12D, // Mill Upper Row 6
198 0x03686, // Mill Upper Row 7
199 0x014E9, // Mill Upper Row 8
200 0x0367C, // Mill Control Room 1
201// 0x03675, // Mill Upper Lift Control
202// 0x03676, // Mill Upper Ramp Control
203 0x3C125, // Mill Control Room 2
204// 0x275ED, // Mill EP Door
205// 0x17CAC, // Mill Stairs Shortcut Door
206 0x03677, // Mill Stairs Control
207// 0x17CF0, // Mill Discard
208// 0x17CC4, // Mill Elevator Control
209 0x021D5, // Boathouse Ramp Activation Shapers
210 0x034D4, // Boathouse Ramp Activation Stars
211// 0x03852, // Boathouse Ramp Angle Control
212 0x021B3, // Boathouse Erasers and Shapers 1
213 0x021B4, // Boathouse Erasers and Shapers 2
214 0x021B0, // Boathouse Erasers and Shapers 3
215 0x021AF, // Boathouse Erasers and Shapers 4
216 0x021AE, // Boathouse Erasers and Shapers 5
217// 0x17CA6, // Boathouse Summon Boat
218// 0x03858, // Boathouse Ramp Position Control
219// 0x38663, // Boathouse Shortcut
220 0x021B5, // Boathouse Erasers and Stars 1
221 0x021B6, // Boathouse Erasers and Stars 2
222 0x021B7, // Boathouse Erasers and Stars 3
223 0x021BB, // Boathouse Erasers and Stars 4
224 0x09DB5, // Boathouse Erasers and Stars 5
225 0x09DB1, // Boathouse Erasers and Stars 6
226 0x3C124, // Boathouse Erasers and Stars 7
227 0x09DB3, // Boathouse Erasers Shapers and Stars 1
228 0x09DB4, // Boathouse Erasers Shapers and Stars 2
229 0x0A3CB, // Boathouse Erasers Shapers and Stars 3
230 0x0A3CC, // Boathouse Erasers Shapers and Stars 4
231 0x0A3D0, // Boathouse Erasers Shapers and Stars 5
232// 0x275FA, // Boathouse Hook Control
233 0x09E57, // Quarry Entry Gate 1
234 0x17C09, // Quarry Entry Gate 2
235 };
236 randomizer.Randomize(quarryPanels, SWAP_LINES | SWAP_COLORS);
237
238 std::vector<int> treehousePanels = { //worked fine until I commented out pivoting panels, puzzles solve fine if you know solution but star and dot colors are all messed up
239// 0x17C95, // Treehouse Summon Boat
240 0x0288C, // Treehouse Door 1
241 0x02886, // Treehouse Door 2
242 0x17D72, // Treehouse Yellow 1
243 0x17D8F, // Treehouse Yellow 2
244 0x17D74, // Treehouse Yellow 3
245 0x17DAC, // Treehouse Yellow 4
246 0x17D9E, // Treehouse Yellow 5
247 0x17DB9, // Treehouse Yellow 6
248 0x17D9C, // Treehouse Yellow 7
249 0x17DC2, // Treehouse Yellow 8
250 0x17DC4, // Treehouse Yellow 9
251 0x0A182, // Treehouse Door 3
252 0x17DC8, // Treehouse First Purple 1
253 0x17DC7, // Treehouse First Purple 2
254 0x17CE4, // Treehouse First Purple 3
255 0x17D2D, // Treehouse First Purple 4
256 0x17D6C, // Treehouse First Purple 5
257 0x17D9B, // Treehouse Second Purple 1
258 0x17D99, // Treehouse Second Purple 2
259 0x17DAA, // Treehouse Second Purple 3
260 0x17D97, // Treehouse Second Purple 4
261 0x17BDF, // Treehouse Second Purple 5
262 0x17D91, // Treehouse Second Purple 6
263 0x17DC6, // Treehouse Second Purple 7
264 0x17DB3, // Treehouse Left Orange 1
265 0x17DB5, // Treehouse Left Orange 2
266 0x17DB6, // Treehouse Left Orange 3
267 0x17DC0, // Treehouse Left Orange 4
268 0x17DD7, // Treehouse Left Orange 5
269 0x17DD9, // Treehouse Left Orange 6
270 0x17DB8, // Treehouse Left Orange 7
271 0x17DDC, // Treehouse Left Orange 8
272// 0x17DD1, // Treehouse Left Orange 9 has to pivot
273 0x17DDE, // Treehouse Left Orange 10
274 0x17DE3, // Treehouse Left Orange 11
275 0x17DEC, // Treehouse Left Orange 12
276 0x17DAE, // Treehouse Left Orange 13
277 0x17DB0, // Treehouse Left Orange 14
278 0x17DDB, // Treehouse Left Orange 15
279 0x17D88, // Treehouse Right Orange 1
280 0x17DB4, // Treehouse Right Orange 2
281 0x17D8C, // Treehouse Right Orange 3
282 0x17CE3, // Treehouse Right Orange 4
283// 0x17DCD, // Treehouse Right Orange 5 has to pivot
284 0x17DB2, // Treehouse Right Orange 6
285 0x17DCC, // Treehouse Right Orange 7
286 0x17DCA, // Treehouse Right Orange 8
287 0x17D8E, // Treehouse Right Orange 9
288// 0x17DB7, // Treehouse Right Orange 10 has to pivot
289 0x17DB1, // Treehouse Right Orange 11
290 0x17DA2, // Treehouse Right Orange 12
291 0x17E3C, // Treehouse Green 1
292 0x17E4D, // Treehouse Green 2
293 0x17E4F, // Treehouse Green 3
294 0x17E52, // Treehouse Green 4
295 0x17E5B, // Treehouse Green 5
296 0x17E5F, // Treehouse Green 6
297 0x17E61, // Treehouse Green 7
298 0x17FA9, // Treehouse Green Bridge Discard
299 0x17FA0, // Treehouse Laser Discard
300// 0x2700B, // Treehouse Exterior Door Control
301// 0x17CBC, // Treehouse Interior Door Control
302// 0x037FF, // Treehouse Drawbridge Control
303 };
304 randomizer.Randomize(treehousePanels, SWAP_LINES | SWAP_COLORS);
305
306 std::vector<int> keepPanels = {
307 0x00139, // Keep Hedges 1
308 0x019DC, // Keep Hedges 2
309 0x019E7, // Keep Hedges 3
310 0x01A0F, // Keep Hedges 4
311// 0x033EA, // Keep Yellow Pressure Plates
312// 0x0A3A8, // Keep Yellow Reset
313// 0x01BE9, // Keep Purple Pressure Plates
314// 0x0A3B9, // Keep Purple Reset
315// 0x01CD3, // Keep Green Pressure Plates
316// 0x0A3BB, // Keep Green Reset
317// 0x01D3F, // Keep Blue Pressure Plates
318// 0x0A3AD, // Keep Blue Reset
319 0x0360E, // Keep Front Laser
320 0x03317, // Keep Back Laser
321// 0x09E49, // Keep Shadows Shortcut
322// 0x0361B, // Keep Tower Shortcut
323 0x17D27, // Keep Discard
324 0x17D28, // Shipwreck Discard
325 0x00AFB, // Shipwreck Vault
326// 0x03535, // Shipwreck Vault Box
327 };
328 randomizer.Randomize(keepPanels, SWAP_LINES | SWAP_COLORS);
329
330 std::vector<int> shadowsPanels = { //works beautifully, can solve based on panel color and where start/end points are if your memory is good
331 0x386FA, //Shadows Avoid 1
332 0x1C33F, //Shadows Avoid 2
333 0x196E2, //Shadows Avoid 3
334 0x1972A, //Shadows Avoid 4
335 0x19809, //Shadows Avoid 5
336 0x19806, //Shadows Avoid 6
337 0x196F8, //Shadows Avoid 7
338 0x1972F, //Shadows Avoid 8
339 0x19797, //Shadows Follow 1
340 0x1979A, //Shadows Follow 2
341 0x197E0, //Shadows Follow 3
342 0x197E8, //Shadows Follow 4
343 0x197E5, //Shadows Follow 5
344// 0x334DC, //Shadows Inner Door Control
345 0x19650, //Shadows Laser
346// 0x334DB, //Shadows Outer Door Control
347 0x198B5, //Shadows Tutorial 1
348 0x198BD, //Shadows Tutorial 2
349 0x198BF, //Shadows Tutorial 3
350 0x19771, //Shadows Tutorial 4
351 0x0A8DC, //Shadows Tutorial 5
352 0x0AC74, //Shadows Tutorial 6
353 0x0AC7A, //Shadows Tutorial 7
354 0x0A8E0, //Shadows Tutorial 8
355 };
356 randomizer.Randomize(shadowsPanels, SWAP_LINES | SWAP_COLORS);
357
358 std::vector<int> townPanels = { //appears to be ok but keeps crashing game?
359 0x2899C, //Town 25 Dots 1
360 0x28A33, //Town 25 Dots 2
361 0x28ABF, //Town 25 Dots 3
362 0x28AC0, //Town 25 Dots 4
363 0x28AC1, //Town 25 Dots 5
364 0x28938, //Town Apple Tree
365 0x28AC7, //Town Blue 1
366 0x28AC8, //Town Blue 2
367 0x28ACA, //Town Blue 3
368 0x28ACB, //Town Blue 4
369 0x28ACC, //Town Blue 5
370// 0x0A054, //Town Summon Boat
371// 0x2896A, //Town Bridge
372 0x28A0D, //Town Church Stars
373 0x28AD9, //Town Eraser
374 0x28998, //Town Green Door
375// 0x09F98, //Town Laser Redirect Control
376// 0x1C344, //Town Laser Redirect Panel 1
377// 0x1C343, //Town Laser Redirect Panel 2
378// 0x28A69, //Town Lattice
379 0x28A79, //Town Maze
380 0x0A0C8, //Town Orange Crate
381 0x17D01, //Town Orange Crate Discard
382// 0x28B39, //Town Red Hexagonal
383// 0x334D8, //Town RGB Light Control
384 0x03C08, //Town RGB Stars
385 0x03C0C, //Town RGB Stones
386 0x17C71, //Town Rooftop Discard
387// 0x034E3, //Town Soundproof Dots panels in their locations must match so can't swap unless that is fixed
388// 0x034E4, //Town Soundproof Waves
389 0x18590, //Town Transparent
390// 0x079DF, //Town Triple
391 0x17D02, //Town Windmill Control
392 0x17F5F, //Town Windmill Door
393 0x28AE3, //Town Wire
394 0x17F89, //Theater Entrance
395// 0x00815, //Theater Video Input
396// 0x03553, //Theater Tutorial Video
397// 0x03552, //Theater Desert Video
398// 0x0354E, //Theater Jungle Video
399// 0x03549, //Theater Challenge Video
400// 0x0354F, //Theater Shipwreck Video
401// 0x03545, //Theater Mountain Video
402 0x17CF7, //Theater Discard
403 0x33AB2, //Theater Corona Exit
404 0x0A168, //Theater Sun Exit
405 };
406 randomizer.Randomize(townPanels, SWAP_LINES | SWAP_COLORS);
407
408 std::vector<int> monasteryPanels = {
409// 0x00B10, //Monastery Left Door
410// 0x00C92, //Monastery Right Door
411 0x00290, //Monastery Exterior 1
412 0x00038, //Monastery Exterior 2
413 0x00037, //Monastery Exterior 3
414// 0x09D9B, //Monastery Bonsai
415 0x193A7, //Monastery Interior 1
416 0x193AA, //Monastery Interior 2
417 0x193AB, //Monastery Interior 3
418 0x193A6, //Monastery Interior 4
419 0x03713, //Monastery Shortcut
420 };
421 randomizer.Randomize(monasteryPanels, SWAP_TARGETS);
422
423 std::vector<int> junglePanels = {
424// 0x17CDF, //Jungle Summon Boat
425 0x17F9B, //Jungle Discard
426 0x002C4, //Jungle Waves 1
427 0x00767, //Jungle Waves 2
428 0x002C6, //Jungle Waves 3
429 0x0070E, //Jungle Waves 4
430 0x0070F, //Jungle Waves 5
431 0x0087D, //Jungle Waves 6
432 0x002C7, //Jungle Waves 7
433// 0x15ADD, //Jungle Vault
434// 0x03702, //Jungle Vault Box
435// 0x17CAA, //Jungle Courtyard Gate
436 0x0026D, //Jungle Dots 1
437 0x0026E, //Jungle Dots 2
438 0x0026F, //Jungle Dots 3
439 0x00C3F, //Jungle Dots 4
440 0x00C41, //Jungle Dots 5
441 0x014B2, //Jungle Dots 6
442// 0x17CAB, //Jungle Pop - up Wall
443// 0x337FA, //Jungle Shortcut
444 };
445 randomizer.Randomize(junglePanels, SWAP_LINES | SWAP_COLORS);
446
447// std::vector<int> bunkerPanels = { this doesn't want to behave, I have no idea
448// 0x17C2E, //Bunker Entry Door
449// 0x09F7D, //Bunker Tutorial 1
450// 0x09FDC, //Bunker Tutorial 2
451// 0x09FF7, //Bunker Tutorial 3
452// 0x09F82, //Bunker Tutorial 4
453// 0x09FF8, //Bunker Tutorial 5
454// 0x09D9F, //Bunker Advanced 1
455// 0x09DA1, //Bunker Advanced 2
456// 0x09DA2, //Bunker Advanced 3
457// 0x09DAF, //Bunker Advanced 4
458// // 0x0A099, //Bunker Glass Door
459// // 0x0A010, //Bunker Glass 1
460// // 0x0A01B, //Bunker Glass 2
461// // 0x0A01F, //Bunker Glass 3
462// 0x34BC5, //Bunker Open Ultraviolet
463// 0x34BC6, //Bunker Close Ultraviolet
464// 0x17E63, //Bunker Ultraviolet 1
465// 0x17E67, //Bunker Ultraviolet 2
466// 0x0A079, //Bunker Elevator
467// };
468// randomizer.Randomize(bunkerPanels, SWAP_LINES | SWAP_COLORS);
469
470 std::vector<int> swampPanels = { //appears to work ok swapping panels but keeps crashing game?
471 0x0056E, //Swamp Entry
472 0x00469, //Swamp Tutorial 1
473 0x00472, //Swamp Tutorial 2
474 0x00262, //Swamp Tutorial 3
475 0x00474, //Swamp Tutorial 4
476 0x00553, //Swamp Tutorial 5
477 0x0056F, //Swamp Tutorial 6
478 0x00390, //Swamp Tutorial 7
479 0x010CA, //Swamp Tutorial 8
480 0x00983, //Swamp Tutorial 9
481 0x00984, //Swamp Tutorial 10
482 0x00986, //Swamp Tutorial 11
483 0x00985, //Swamp Tutorial 12
484 0x00987, //Swamp Tutorial 13
485 0x181A9, //Swamp Tutorial 14
486// 0x00609, //Swamp Surface Sliding Bridge Control
487 0x00982, //Swamp Red 1
488 0x0097F, //Swamp Red 2
489 0x0098F, //Swamp Red 3
490 0x00990, //Swamp Red 4
491 0x17C0D, //Swamp Red Shortcut 1
492 0x17C0E, //Swamp Red Shortcut 2
493 0x00999, //Swamp Discontinuous 1
494 0x0099D, //Swamp Discontinuous 2
495 0x009A0, //Swamp Discontinuous 3
496 0x009A1, //Swamp Discontinuous 4
497 0x00007, //Swamp Rotation Tutorial 1
498 0x00008, //Swamp Rotation Tutorial 2
499 0x00009, //Swamp Rotation Tutorial 3
500 0x0000A, //Swamp Rotation Tutorial 4
501 0x181F5, //Swamp Rotating Bridge Control
502 0x009AB, //Swamp Blue Underwater 1
503 0x009AD, //Swamp Blue Underwater 2
504 0x009AE, //Swamp Blue Underwater 3
505 0x009AF, //Swamp Blue Underwater 4
506 0x00006, //Swamp Blue Underwater 5
507 0x003B2, //Swamp Rotation Advanced 1
508 0x00A1E, //Swamp Rotation Advanced 2
509 0x00C2E, //Swamp Rotation Advanced 3
510 0x00E3A, //Swamp Rotation Advanced 4
511// 0x17E2B, //Swamp Flood Gate Control
512// 0x09DB8, //Swamp Summon Boat
513 0x009A6, //Swamp Purple Tetris
514// 0x18488, //Swamp Underwater Sliding Bridge Control
515 0x00002, //Swamp Teal Underwater 1
516 0x00004, //Swamp Teal Underwater 2
517 0x00005, //Swamp Teal Underwater 3
518 0x013E6, //Swamp Teal Underwater 4
519 0x00596, //Swamp Teal Underwater 5
520 0x00001, //Swamp Red Underwater 1
521 0x014D2, //Swamp Red Underwater 2
522 0x014D4, //Swamp Red Underwater 3
523 0x014D1, //Swamp Red Underwater 4
524 0x17C0A, //Swamp Island Control 1
525 0x17E07, //Swamp Island Control 2
526 0x17C05, //Swamp Laser Shortcut 1
527 0x17C02, //Swamp Laser Shortcut 2
528 };
529 randomizer.Randomize(swampPanels, SWAP_LINES | SWAP_COLORS);
530
531 std::vector<int> mountainPanels = {
532// 0x09E39, //Mountain 1 Purple Pathway
533 0x09E73, //Mountain 1 Orange 1
534 0x09E75, //Mountain 1 Orange 2
535 0x09E78, //Mountain 1 Orange 3
536 0x09E79, //Mountain 1 Orange 4
537 0x09E6C, //Mountain 1 Orange 5
538 0x09E6F, //Mountain 1 Orange 6
539 0x09E6B, //Mountain 1 Orange 7
540// 0x33AF5, //Mountain 1 Blue 1
541// 0x33AF7, //Mountain 1 Blue 2
542// 0x09F6E, //Mountain 1 Blue 3
543 0x09EAD, //Mountain 1 Purple 1
544 0x09EAF, //Mountain 1 Purple 2
545 0x09E7A, //Mountain 1 Green 1
546 0x09E71, //Mountain 1 Green 2
547 0x09E72, //Mountain 1 Green 3
548 0x09E69, //Mountain 1 Green 4
549 0x09E7B, //Mountain 1 Green 5
550 0x09FD3, //Mountain 2 Rainbow 1
551 0x09FD4, //Mountain 2 Rainbow 2
552 0x09FD6, //Mountain 2 Rainbow 3
553 0x09FD7, //Mountain 2 Rainbow 4
554 0x09FD8, //Mountain 2 Rainbow 5
555// 0x09E86, //Mountain 2 Blue Pathway
556// 0x09FCC, //Mountain 2 Multipanel 1 panels work fine other places but the actual location isn't on - I think maybe it needs all the panels the same
557// 0x09FCE, //Mountain 2 Multipanel 2
558// 0x09FCF, //Mountain 2 Multipanel 3
559// 0x09FD0, //Mountain 2 Multipanel 4
560// 0x09FD1, //Mountain 2 Multipanel 5
561// 0x09FD2, //Mountain 2 Multipanel 6
562// 0x09ED8, //Mountain 2 Orange Pathway
563// 0x09EEB, //Mountain 2 Elevator
564 0x17F93, //Mountain 2 Discard
565 0x09F8E, //Mountain 3 Near Right Floor
566 0x09FC1, //Mountain 3 Near Left Floor
567 0x09F01, //Mountain 3 Far Right Floor
568 0x09EFF, //Mountain 3 Far Left Floor
569 0x09FDA, //Mountain 3 Giant Floor
570 0x17FA2, //Mountain 3 Secret Door
571// 0x01983, //Mountain 3 Left Peekaboo
572// 0x01987, //Mountain 3 Right Peekaboo
573// 0x0383D, //Mountain 3 Left Pillar 1
574// 0x0383F, //Mountain 3 Left Pillar 2
575// 0x03859, //Mountain 3 Left Pillar 3
576// 0x339BB, //Mountain 3 Left Pillar 4
577// 0x0383A, //Mountain 3 Right Pillar 1
578// 0x09E56, //Mountain 3 Right Pillar 2
579// 0x09E5A, //Mountain 3 Right Pillar 3
580// 0x33961, //Mountain 3 Right Pillar 4
581// 0x3D9A6, //Mountain 3 Left Close Door
582// 0x3D9A7, //Mountain 3 Right Close Door
583// 0x3D9AA, //Mountain 3 Left Activate Elevator
584// 0x3D9A8, //Mountain 3 Right Activate Elevator
585// 0x3D9A9, //Mountain 3 Launch Elevator
586// 0x3C113, //Mountain 3 Left Open Door
587// 0x3C114, //Mountain 3 Right Open Door
588 0x17C42, //Mountainside Discard
589 0x002A6, //Mountainside Vault
590// 0x03542, //Mountainside Vault Box
591// 0x09F7F, //Mountaintop Laser Box
592// 0x17C34, //Mountaintop Perspective
593 0x0042D, //Mountaintop River
594 };
595 randomizer.Randomize(mountainPanels, SWAP_LINES | SWAP_COLORS);
596
597// std::vector<int> utmPanels = { this looks like it swaps ok but crashes to much to tell, not sure why it's not happy
598// 0x0A16E, //UTM Challenge Entrance
599// // 0x09DD5, //UTM Challenge Pillar
600// 0x00FF8, //UTM Entrance Door
601// 0x0A16B, //UTM Green Dots 1
602// 0x0A2CE, //UTM Green Dots 2
603// 0x0A2D7, //UTM Green Dots 3
604// 0x0A2DD, //UTM Green Dots 4
605// 0x0A2EA, //UTM Green Dots 5
606// 0x17FB9, //UTM Green Dots 6
607// 0x335AB, //UTM In Elevator Control
608// 0x0008F, //UTM Invisible Dots 1
609// 0x0006B, //UTM Invisible Dots 2
610// 0x0008B, //UTM Invisible Dots 3
611// 0x0008C, //UTM Invisible Dots 4
612// 0x0008A, //UTM Invisible Dots 5
613// 0x00089, //UTM Invisible Dots 6
614// 0x0006A, //UTM Invisible Dots 7
615// 0x0006C, //UTM Invisible Dots 8
616// 0x00027, //UTM Invisible Dots Symmetry 1
617// 0x00028, //UTM Invisible Dots Symmetry 2
618// 0x00029, //UTM Invisible Dots Symmetry 3
619// 0x3369D, //UTM Lower Elevator Control
620// 0x021D7, //UTM Mountainside Shortcut
621// // 0x288EA, //UTM Perspective 1
622// // 0x288FC, //UTM Perspective 2
623// // 0x289E7, //UTM Perspective 3
624// // 0x288AA, //UTM Perspective 4
625// 0x00B71, //UTM Quarry
626// 0x01A31, //UTM Rainbow
627// // 0x334E1, //UTM Secret Door Control
628// 0x32962, //UTM Swamp
629// 0x32966, //UTM Treehouse
630// 0x335AC, //UTM Upper Elevator Control
631// 0x17CF2, //UTM Waterfall Shortcut
632// 0x00A72, //UTM Blue Cave In
633// 0x009A4, //UTM Blue Discontinuous
634// 0x018A0, //UTM Blue Easy Symmetry
635// 0x01A0D, //UTM Blue Hard Symmetry
636// 0x008B8, //UTM Blue Left 1
637// 0x00973, //UTM Blue Left 2
638// 0x0097B, //UTM Blue Left 3
639// 0x0097D, //UTM Blue Left 4
640// 0x0097E, //UTM Blue Left 5
641// 0x00994, //UTM Blue Right Far 1
642// 0x334D5, //UTM Blue Right Far 2
643// 0x00995, //UTM Blue Right Far 3
644// 0x00996, //UTM Blue Right Far 4
645// 0x00998, //UTM Blue Right Far 5
646// 0x00190, //UTM Blue Right Near 1
647// 0x00558, //UTM Blue Right Near 2
648// 0x00567, //UTM Blue Right Near 3
649// 0x006FE, //UTM Blue Right Near 4
650// // 0x2773D, //Tunnels Desert Shortcut
651// 0x039B4, //Tunnels Theater Catwalk
652// // 0x27732, //Tunnels Theater Shortcut
653// // 0x2FAF6, //Tunnels Vault Box
654// 0x09E85, //Tunnels Town Shortcut
655// };
656// randomizer.Randomize(utmPanels, SWAP_LINES | SWAP_COLORS);
657
658 38
659 /*/ 39 randomizer.Randomize(desertPanels, SWAP_LINES);
40 randomizer.Randomize(treehousePanels, SWAP_LINES);
660 41
42 std::vector<int> squarePanels;
43 for (auto panelSet : {outsideTutorialPanels, symmetryPanels, quarryPanels, keepPanels, townPanels, bunkerPanels, swampPanels, mountainPanels, utmPanels}) {
44 squarePanels.insert(squarePanels.end(), panelSet.begin(), panelSet.end());
45 }
46 randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_COLORS);
661 47
48 randomizer.Randomize(junglePanels, SWAP_LINES | SWAP_COLORS);
49 randomizer.Randomize(mountainMultipanel, SWAP_LINES | SWAP_COLORS);
50 randomizer.Randomize(pillars, SWAP_LINES | SWAP_COLORS);
51 /*/
662 int BOATH_3_1 = 0x21B5; 52 int BOATH_3_1 = 0x21B5;
663 int MILL_L_1 = 0xE0C; 53 int MILL_L_1 = 0xE0C;
664 int MILL_U_1 = 0x557; 54 int MILL_U_1 = 0x557;
665 int QUARRY_E_1 = 0x9E57; 55 int QUARRY_E_1 = 0x9E57;
666 int QUARRY_E_2 = 0x17C09; 56 int QUARRY_E_2 = 0x17C09;
667 int MILL_E_1 = 0x1E5A; 57 int MILL_E_1 = 0x1E5A;
58 int BUNKER_G_1 = 0xA010;
59 int BUNKER_T_1 = 0x9F7D;
60 int TUT_PILLAR = 0xC335;
61 int TUT_F_C = 0x293;
668 62
669 randomizer.SwapPanels(BOATH_3_1, QUARRY_E_1, SWAP_LINES | SWAP_COLORS); 63 randomizer.SwapPanels(TUT_PILLAR, TUT_F_C, SWAP_LINES | SWAP_COLORS);
670 //*/ 64 //*/
671} 65}
672 66
@@ -679,6 +73,7 @@ WitnessRandomizer::WitnessRandomizer() : _memory(Memory("witness64_d3d11.exe"))
679} 73}
680 74
681void WitnessRandomizer::Randomize(std::vector<int> panels, int flags) { 75void WitnessRandomizer::Randomize(std::vector<int> panels, int flags) {
76 if (panels.size() == 0) return;
682 for (size_t i=panels.size() - 1; i > 1; i--) { 77 for (size_t i=panels.size() - 1; i > 1; i--) {
683 int target = rand() % i; 78 int target = rand() % i;
684 if (i != target) { 79 if (i != target) {
@@ -696,34 +91,39 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) {
696 offsets[0x2BC] = sizeof(int); 91 offsets[0x2BC] = sizeof(int);
697 } 92 }
698 if (flags & SWAP_LINES) { 93 if (flags & SWAP_LINES) {
94 offsets[0x230] = 16; // traced_edges
95// offsets[0x220] = sizeof(void*); // *pattern_name
96// offsets[0x240] = sizeof(void*); // *mesh_name
97 offsets[0x2FC] = sizeof(int); // is_cylinder
98 offsets[0x300] = sizeof(float); // cylinder_z0
99 offsets[0x304] = sizeof(float); // cylinder_z1
100 offsets[0x308] = sizeof(float); // cylinder_radius
101// offsets[0x35C] = sizeof(int); // solvable_from_behind
102
103// offsets[0x30C] = sizeof(float); // uv_to_world_scale
104 offsets[0x3A4] = sizeof(float); // path_width_scale
105 offsets[0x3A8] = sizeof(float); // startpoint_scale
699 offsets[0x3B8] = sizeof(int); // num_dots 106 offsets[0x3B8] = sizeof(int); // num_dots
700 offsets[0x3BC] = sizeof(int); // num_connections 107 offsets[0x3BC] = sizeof(int); // num_connections
701 offsets[0x3C8] = sizeof(void*); // *dot_positions 108 offsets[0x3C8] = sizeof(void*); // *dot_positions
702 offsets[0x3D0] = sizeof(void*); // *dot_flags 109 offsets[0x3D0] = sizeof(void*); // *dot_flags
703 offsets[0x3D8] = sizeof(void*); // *dot_connection_a 110 offsets[0x3D8] = sizeof(void*); // *dot_connection_a
704 offsets[0x3E0] = sizeof(void*); // *dot_connection_b 111 offsets[0x3E0] = sizeof(void*); // *dot_connection_b
112 offsets[0x420] = sizeof(void*); // *decorations
113 offsets[0x428] = sizeof(void*); // *decoration_flags
114 offsets[0x438] = sizeof(int); // num_decorations
705 offsets[0x440] = sizeof(void*); // *reflection_data 115 offsets[0x440] = sizeof(void*); // *reflection_data
706 offsets[0x448] = sizeof(int); // grid_size_x 116 offsets[0x448] = sizeof(int); // grid_size_x
707 offsets[0x44C] = sizeof(int); // grid_size_y 117 offsets[0x44C] = sizeof(int); // grid_size_y
708 offsets[0x450] = sizeof(int); // style_flags // This is required to not ignore dots 118 offsets[0x450] = sizeof(int); // style_flags // This is required to not ignore dots
709 offsets[0x4B0] = sizeof(void*); // *panel_target
710 offsets[0x4D8] = sizeof(void*); // *specular_texture
711
712 offsets[0x420] = sizeof(void*); // *decorations
713 offsets[0x428] = sizeof(void*); // *decoration_flags
714 offsets[0x438] = sizeof(int); // num_decorations
715
716 offsets[0x45C] = sizeof(int); // sequence_len 119 offsets[0x45C] = sizeof(int); // sequence_len
717 offsets[0x460] = sizeof(void*); // *sequence 120 offsets[0x460] = sizeof(void*); // *sequence
718 offsets[0x468] = sizeof(int); // dot_sequence_len 121 offsets[0x468] = sizeof(int); // dot_sequence_len
719 offsets[0x470] = sizeof(void*); // *dot_sequence 122 offsets[0x470] = sizeof(void*); // *dot_sequence
720 offsets[0x478] = sizeof(int); // dot_sequence_len_reflection 123 offsets[0x478] = sizeof(int); // dot_sequence_len_reflection
721 offsets[0x480] = sizeof(void*); // *dot_sequence_reflection 124 offsets[0x480] = sizeof(void*); // *dot_sequence_reflection
722 125 offsets[0x4B0] = sizeof(void*); // *panel_target
723 offsets[0x3A4] = sizeof(float); // path_width_scale 126 offsets[0x4D8] = sizeof(void*); // *specular_texture
724 offsets[0x3A8] = sizeof(float); // startpoint_scale
725
726 offsets[0x230] = 16; // traced_edges
727 127
728 // TODO: Try using is_cylinder to swap into tutorial pillar. If it fails, discard. 128 // TODO: Try using is_cylinder to swap into tutorial pillar. If it fails, discard.
729 // Probably not: Extra back distance 129 // Probably not: Extra back distance
@@ -778,12 +178,6 @@ void WitnessRandomizer::SwapPanelData(int panel1, int panel2, int finalOffset, i
778 std::vector<byte> panel1Data = _memory.ReadData<byte>(panel1Offset, dataSize); 178 std::vector<byte> panel1Data = _memory.ReadData<byte>(panel1Offset, dataSize);
779 std::vector<byte> panel2Data = _memory.ReadData<byte>(panel2Offset, dataSize); 179 std::vector<byte> panel2Data = _memory.ReadData<byte>(panel2Offset, dataSize);
780 180
781 bool failed = _memory.WriteData<byte>(panel2Offset, panel1Data); 181 _memory.WriteData<byte>(panel2Offset, panel1Data);
782 if (failed) { 182 _memory.WriteData<byte>(panel1Offset, panel2Data);
783 _memory.WriteData<byte>(panel2Offset, panel1Data);
784 }
785 failed = _memory.WriteData<byte>(panel1Offset, panel2Data);
786 if (failed) {
787 _memory.WriteData<byte>(panel1Offset, panel2Data);
788 }
789} 183}