summary refs log tree commit diff stats
path: root/WitnessRandomizer
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-10-25 21:57:21 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-10-25 21:57:21 -0700
commit4edd6ab796f26563368e5b8487df1f1f9bb0684c (patch)
tree2a39c9dc3935cfe97898bfa1e0d628802b9deb24 /WitnessRandomizer
parenta96cea16828973b92c465fb84de2554779f07101 (diff)
downloadwitness-tutorializer-4edd6ab796f26563368e5b8487df1f1f9bb0684c.tar.gz
witness-tutorializer-4edd6ab796f26563368e5b8487df1f1f9bb0684c.tar.bz2
witness-tutorializer-4edd6ab796f26563368e5b8487df1f1f9bb0684c.zip
Some sequence randomization, and swapping some control panels.
Diffstat (limited to 'WitnessRandomizer')
-rw-r--r--WitnessRandomizer/Memory.cpp2
-rw-r--r--WitnessRandomizer/Memory.h1
-rw-r--r--WitnessRandomizer/Panels.h371
-rw-r--r--WitnessRandomizer/WitnessRandomizer.cpp175
-rw-r--r--WitnessRandomizer/WitnessRandomizer.h9
5 files changed, 334 insertions, 224 deletions
diff --git a/WitnessRandomizer/Memory.cpp b/WitnessRandomizer/Memory.cpp index 304b7b4..8ad5452 100644 --- a/WitnessRandomizer/Memory.cpp +++ b/WitnessRandomizer/Memory.cpp
@@ -51,7 +51,7 @@ Memory::~Memory() {
51 51
52void Memory::ThrowError() { 52void Memory::ThrowError() {
53 std::string message(256, '\0'); 53 std::string message(256, '\0');
54 FormatMessageA(4096, NULL, GetLastError(), 1024, &message[0], message.length(), NULL); 54 FormatMessageA(4096, NULL, GetLastError(), 1024, &message[0], static_cast<DWORD>(message.length()), NULL);
55 OutputDebugStringA(message.c_str()); 55 OutputDebugStringA(message.c_str());
56 exit(EXIT_FAILURE); 56 exit(EXIT_FAILURE);
57} 57}
diff --git a/WitnessRandomizer/Memory.h b/WitnessRandomizer/Memory.h index adc1287..390269c 100644 --- a/WitnessRandomizer/Memory.h +++ b/WitnessRandomizer/Memory.h
@@ -28,6 +28,7 @@ public:
28 // std::this_thread::sleep_for(10ms); 28 // std::this_thread::sleep_for(10ms);
29 } 29 }
30 ThrowError(); 30 ThrowError();
31 return {};
31 } 32 }
32 33
33 template <class T> 34 template <class T>
diff --git a/WitnessRandomizer/Panels.h b/WitnessRandomizer/Panels.h index fff7053..3120357 100644 --- a/WitnessRandomizer/Panels.h +++ b/WitnessRandomizer/Panels.h
@@ -60,22 +60,55 @@ std::vector<int> burnablePanels = {
60 0x012D7, // Desert Final Far 60 0x012D7, // Desert Final Far
61}; 61};
62 62
63// Note: Some of these (non-switches) are duplicated elsewhere 63// Note: Some of these (non-controls) are duplicated elsewhere
64// TODO: Gave up
64std::vector<int> leftRightPanels = { 65std::vector<int> leftRightPanels = {
66 0x01A54, // Glass Factory Entry
67 0x00086, // Glass Factory Vertical Symmetry 1
68 0x00087, // Glass Factory Vertical Symmetry 2
69 0x00059, // Glass Factory Vertical Symmetry 3
70 0x00062, // Glass Factory Vertical Symmetry 4
71 0x00025, // Symmetry Island Black Dots 4
72 0x00026, // Symmetry Island Black Dots 5
73 0x00072, // Symmetry Island Fading Lines 3
74
65 0x17D02, // Town Windmill Control 75 0x17D02, // Town Windmill Control
66}; 76};
67 77
68// Note: Some of these (non-switches) are duplicated elsewhere 78// Note: Some of these (non-controls) are duplicated elsewhere
69std::vector<int> upDownPanels = { 79std::vector<int> upDownPanels = {
80 0x0008D, // Glass Factory Rotational Symmetry 1
81 0x00081, // Glass Factory Rotational Symmetry 2
82 0x00083, // Glass Factory Rotational Symmetry 3
83 0x00084, // Glass Factory Melting 1
84 0x00070, // Symmetry Island Fading Lines 5
85 0x01E5A, // Mill Entry Door Left
86 0x28AC7, // Town Blue 1
87 0x28AC8, // Town Blue 2
88 0x28ACA, // Town Blue 3
89 0x28ACB, // Town Blue 4
90 0x28ACC, // Town Blue 5
91 0x00029, // UTM Invisible Dots Symmetry 3
92
70 0x0A3B5, // Tutorial Back Left 93 0x0A3B5, // Tutorial Back Left
71 0x17CC4, // Mill Elevator Control 94 0x17CC4, // Mill Elevator Control
95 0x335AB, // UTM In Elevator Control
96 0x3369D, // UTM Lower Elevator Control
97 0x335AC, // UTM Upper Elevator Control
98 0x09EEB, // Mountain 2 Elevator
72}; 99};
73 100
101// Note: Some of these (non-controls) are duplicated elsewhere
74std::vector<int> leftForwardRightPanels = { 102std::vector<int> leftForwardRightPanels = {
75 0x17DD1, // Treehouse Left Orange 9 has to pivot 103// 0x00075, // Symmetry Island Colored Dots 3
76 0x17CE3, // Treehouse Right Orange 4 has to pivot 104// 0x288EA, // UTM Perspective 1
77 0x17DB7, // Treehouse Right Orange 10 has to pivot 105// 0x288FC, // UTM Perspective 2
78 0x17E52, // Treehouse Green 4 has to pivot 106// 0x289E7, // UTM Perspective 3
107
108 0x17DD1, // Treehouse Left Orange 9
109 0x17CE3, // Treehouse Right Orange 4
110 0x17DB7, // Treehouse Right Orange 10
111 0x17E52, // Treehouse Green 4
79}; 112};
80 113
81std::vector<int> pillars = { 114std::vector<int> pillars = {
@@ -101,159 +134,6 @@ std::vector<int> mountainMultipanel = {
101 0x09FD2, // Mountain 2 Multipanel 6 134 0x09FD2, // Mountain 2 Multipanel 6
102}; 135};
103 136
104// There might be something to do with these, I haven't decided yet.
105std::vector<int> nothingPanels = {
106// Doors & Shortcuts & Shortcut doors & Door controls
107 0x0C339, // Desert Surface Door
108 0x0A249, // Desert Pond Exit Door
109 0x275ED, // Mill EP Door
110 0x17CAC, // Mill Stairs Shortcut Door
111 0x38663, // Boathouse Shortcut
112 0x09E49, // Keep Shadows Shortcut
113 0x0361B, // Keep Tower Shortcut
114 0x334DC, // Shadows Inner Door Control
115 0x334DB, // Shadows Outer Door Control
116 0x2700B, // Treehouse Exterior Door Control
117 0x17CBC, // Treehouse Interior Door Control
118// 0x337FA, // Jungle Shortcut
119
120// Controls (?)
121 0x09FA0, // Desert Surface 3 Control
122 0x09F86, // Desert Surface 8 Control
123 0x1C2DF, // Desert Flood Control Lower Far Left
124 0x1831E, // Desert Flood Control Lower Far Right
125 0x1C260, // Desert Flood Control Lower Near Left
126 0x1831C, // Desert Flood Control Lower Near Right
127 0x1C2F3, // Desert Flood Control Raise Far Left
128 0x1831D, // Desert Flood Control Raise Far Right
129 0x1C2B1, // Desert Flood Control Raise Near Left
130 0x1831B, // Desert Flood Control Raise Near Right
131 0x0A015, // Desert Final Far Control
132 0x03678, // Mill Lower Ramp Contol
133 0x03679, // Mill Lower Lift Control
134 0x03675, // Mill Upper Lift Control
135 0x03676, // Mill Upper Ramp Control
136 0x03852, // Boathouse Ramp Angle Control
137 0x03858, // Boathouse Ramp Position Control
138 0x275FA, // Boathouse Hook Control
139 0x037FF, // Treehouse Drawbridge Control
140 0x09F98, // Town Laser Redirect Control
141 0x334D8, // Town RGB Light Control
142 0x17E2B, // Swamp Flood Gate Control
143 0x00609, // Swamp Surface Sliding Bridge Control
144 0x18488, // Swamp Underwater Sliding Bridge Control
145 0x17C0A, // Swamp Island Control 1
146 0x17E07, // Swamp Island Control 2
147 0x181F5, // Swamp Rotating Bridge Control
148
149// Vault Boxes
150 0x03481, // Outside Tutorial Vault Box
151 0x0339E, // Desert Vault Box
152 0x03535, // Shipwreck Vault Box
153 0x03702, // Jungle Vault Box
154 0x03542, // Mountainside Vault Box
155
156// Boat Summons
157 0x17CC8, // Glass Factory Summon Boat
158 0x17CA6, // Boathouse Summon Boat
159 0x17C95, // Treehouse Summon Boat
160 0x0A054, // Town Summon Boat
161 0x09DB8, // Swamp Summon Boat
162 0x17CDF, // Jungle Summon Boat
163
164// Identical sets
165 0x00143, // Orchard Apple Tree 1
166 0x0003B, // Orchard Apple Tree 2
167 0x00055, // Orchard Apple Tree 3
168 0x032F7, // Orchard Apple Tree 4
169 0x032FF, // Orchard Apple Tree 5
170 0x009B8, // Symmetry Island Transparent 1
171 0x003E8, // Symmetry Island Transparent 2
172 0x00A15, // Symmetry Island Transparent 3
173 0x00B53, // Symmetry Island Transparent 4
174 0x00B8D, // Symmetry Island Transparent 5
175
176// Misc
177 0x03629, // Tutorial Gate Open
178 0x09FAA, // Desert Lightswitch
179 0x0C335, // Tutorial Pillar
180 0x0C373, // Tutorial Patio floor
181 0x1C349, // Symmetry Island Door 2 - Collision fails here, sadly
182 0x18076, // Desert Flood Exit - I am doing something with this -- but it's a very unique panel.
183 0x0A15C, // Desert Final Left Convex
184 0x09FFF, // Desert Final Left Concave
185 0x0A15F, // Desert Final Near
186 0x033EA, // Keep Yellow Pressure Plates
187 0x0A3A8, // Keep Yellow Reset
188 0x01BE9, // Keep Purple Pressure Plates
189 0x0A3B9, // Keep Purple Reset
190 0x01CD3, // Keep Green Pressure Plates
191 0x0A3BB, // Keep Green Reset
192 0x01D3F, // Keep Blue Pressure Plates
193 0x0A3AD, // Keep Blue Reset
194 0x2896A, // Town Bridge
195 0x28A69, // Town Lattice
196 0x28A79, // Town Maze
197 0x28B39, // Town Red Hexagonal
198 0x034E3, // Town Soundproof Dots
199 0x034E4, // Town Soundproof Waves
200 0x079DF, // Town Triple
201 0x00815, // Theater Video Input
202 0x03553, // Theater Tutorial Video
203 0x03552, // Theater Desert Video
204 0x0354E, // Theater Jungle Video
205 0x03549, // Theater Challenge Video
206 0x0354F, // Theater Shipwreck Video
207 0x03545, // Theater Mountain Video
208 0x18590, // Town Transparent
209 0x28AE3, // Town Wire
210
211
212// 0x09E39, // Mountain 1 Purple Pathway
213// 0x33AF5, // Mountain 1 Blue 1
214// 0x33AF7, // Mountain 1 Blue 2
215// 0x09F6E, // Mountain 1 Blue 3
216// 0x09FD8, // Mountain 2 Rainbow 5
217// 0x09E86, // Mountain 2 Blue Pathway
218// 0x09ED8, // Mountain 2 Orange Pathway
219// 0x09EEB, // Mountain 2 Elevator
220 0x09F8E, // Mountain 3 Near Right Floor
221 0x09FC1, // Mountain 3 Near Left Floor
222 0x09F01, // Mountain 3 Far Right Floor
223 0x09EFF, // Mountain 3 Far Left Floor
224 0x09FDA, // Mountain 3 Giant Floor
225// 0x01983, // Mountain 3 Left Peekaboo
226// 0x01987, // Mountain 3 Right Peekaboo
227// 0x3D9A6, // Mountain 3 Left Close Door
228// 0x3D9A7, // Mountain 3 Right Close Door
229// 0x3D9AA, // Mountain 3 Left Activate Elevator
230// 0x3D9A8, // Mountain 3 Right Activate Elevator
231// 0x3D9A9, // Mountain 3 Launch Elevator
232// 0x3C113, // Mountain 3 Left Open Door
233// 0x3C114, // Mountain 3 Right Open Door
234// 0x09F7F, // Mountaintop Laser Box
235// 0x17C34, // Mountaintop Perspective
236// 0x0A16E, // UTM Challenge Entrance
237// 0x335AB, // UTM In Elevator Control
238// 0x3369D, // UTM Lower Elevator Control
239// 0x288EA, // UTM Perspective 1
240// 0x288FC, // UTM Perspective 2
241// 0x289E7, // UTM Perspective 3
242// 0x288AA, // UTM Perspective 4
243// 0x334E1, // UTM Secret Door Control
244// 0x335AC, // UTM Upper Elevator Control
245// 0x2773D, // Tunnels Desert Shortcut
246// 0x27732, // Tunnels Theater Shortcut
247// 0x2FAF6, // Tunnels Vault Box
248// 0x0A099, // Bunker Glass Door
249// 0x34BC5, // Bunker Open Ultraviolet
250// 0x34BC6, // Bunker Close Ultraviolet
251// 0x15ADD, // Jungle Vault
252// 0x17CAA, // Jungle Courtyard Gate
253// 0x17CAB, // Jungle Pop-up Wall
254 0x0005C, // Glass Factory Vertical Symmetry 5
255};
256
257std::vector<int> squarePanels = { 137std::vector<int> squarePanels = {
258 0x00064, // Tutorial Straight 138 0x00064, // Tutorial Straight
259 0x00182, // Tutorial Bend 139 0x00182, // Tutorial Bend
@@ -453,6 +333,7 @@ std::vector<int> squarePanels = {
453 0x0A168, // Theater Sun Exit 333 0x0A168, // Theater Sun Exit
454 0x00B10, // Monastery Left Door 334 0x00B10, // Monastery Left Door
455 0x00C92, // Monastery Right Door 335 0x00C92, // Monastery Right Door
336 0x17C2E, // Bunker Entry Door
456 0x0056E, // Swamp Entry 337 0x0056E, // Swamp Entry
457 0x00469, // Swamp Tutorial 1 338 0x00469, // Swamp Tutorial 1
458 0x00472, // Swamp Tutorial 2 339 0x00472, // Swamp Tutorial 2
@@ -573,7 +454,15 @@ std::vector<int> squarePanels = {
573 0x09E85, // Tunnels Town Shortcut 454 0x09E85, // Tunnels Town Shortcut
574}; 455};
575 456
576std::vector<int> shadowsPanels = { // works beautifully, can solve based on panel color and where start/end points are if your memory is good 457std::vector<int> shadowsPanels = {
458 0x198B5, // Shadows Tutorial 1
459 0x198BD, // Shadows Tutorial 2
460 0x198BF, // Shadows Tutorial 3
461 0x19771, // Shadows Tutorial 4
462 0x0A8DC, // Shadows Tutorial 5
463 0x0AC74, // Shadows Tutorial 6
464 0x0AC7A, // Shadows Tutorial 7
465 0x0A8E0, // Shadows Tutorial 8
577 0x386FA, // Shadows Avoid 1 466 0x386FA, // Shadows Avoid 1
578 0x1C33F, // Shadows Avoid 2 467 0x1C33F, // Shadows Avoid 2
579 0x196E2, // Shadows Avoid 3 468 0x196E2, // Shadows Avoid 3
@@ -587,17 +476,12 @@ std::vector<int> shadowsPanels = { // works beautifully, can solve based on pane
587 0x197E0, // Shadows Follow 3 476 0x197E0, // Shadows Follow 3
588 0x197E8, // Shadows Follow 4 477 0x197E8, // Shadows Follow 4
589 0x197E5, // Shadows Follow 5 478 0x197E5, // Shadows Follow 5
590 0x198B5, // Shadows Tutorial 1 479 0x19650, // Shadows Laser
591 0x198BD, // Shadows Tutorial 2
592 0x198BF, // Shadows Tutorial 3
593 0x19771, // Shadows Tutorial 4
594 0x0A8DC, // Shadows Tutorial 5
595 0x0AC74, // Shadows Tutorial 6
596 0x0AC7A, // Shadows Tutorial 7
597 0x0A8E0, // Shadows Tutorial 8
598}; 480};
599 481
600std::vector<int> monasteryPanels = { 482std::vector<int> monasteryPanels = {
483 0x00B10, // Monastery Left Door
484 0x00C92, // Monastery Right Door
601 0x00290, // Monastery Exterior 1 485 0x00290, // Monastery Exterior 1
602 0x00038, // Monastery Exterior 2 486 0x00038, // Monastery Exterior 2
603 0x00037, // Monastery Exterior 3 487 0x00037, // Monastery Exterior 3
@@ -607,10 +491,10 @@ std::vector<int> monasteryPanels = {
607 0x193AB, // Monastery Interior 3 491 0x193AB, // Monastery Interior 3
608 0x193A6, // Monastery Interior 4 492 0x193A6, // Monastery Interior 4
609// 0x03713, // Monastery Shortcut 493// 0x03713, // Monastery Shortcut
494 0x17CA4, // Monastery Laser
610}; 495};
611 496
612std::vector<int> bunkerPanels = { // this doesn't want to behave, I have no idea 497std::vector<int> bunkerPanels = {
613 0x17C2E, // Bunker Entry Door
614 0x09F7D, // Bunker Tutorial 1 498 0x09F7D, // Bunker Tutorial 1
615 0x09FDC, // Bunker Tutorial 2 499 0x09FDC, // Bunker Tutorial 2
616 0x09FF7, // Bunker Tutorial 3 500 0x09FF7, // Bunker Tutorial 3
@@ -620,11 +504,14 @@ std::vector<int> bunkerPanels = { // this doesn't want to behave, I have no idea
620 0x09DA1, // Bunker Advanced 2 504 0x09DA1, // Bunker Advanced 2
621 0x09DA2, // Bunker Advanced 3 505 0x09DA2, // Bunker Advanced 3
622 0x09DAF, // Bunker Advanced 4 506 0x09DAF, // Bunker Advanced 4
507// 0x0A099, // Bunker Glass Door
623 0x0A010, // Bunker Glass 1 508 0x0A010, // Bunker Glass 1
624 0x0A01B, // Bunker Glass 2 509 0x0A01B, // Bunker Glass 2
625 0x0A01F, // Bunker Glass 3 510 0x0A01F, // Bunker Glass 3
626 0x17E63, // Bunker Ultraviolet 1 511 0x17E63, // Bunker Ultraviolet 1
627 0x17E67, // Bunker Ultraviolet 2 512 0x17E67, // Bunker Ultraviolet 2
513 0x34BC5, // Bunker Open Ultraviolet
514 0x34BC6, // Bunker Close Ultraviolet
628 0x0A079, // Bunker Elevator 515 0x0A079, // Bunker Elevator
629}; 516};
630 517
@@ -636,10 +523,154 @@ std::vector<int> junglePanels = {
636 0x0070F, // Jungle Waves 5 523 0x0070F, // Jungle Waves 5
637 0x0087D, // Jungle Waves 6 524 0x0087D, // Jungle Waves 6
638 0x002C7, // Jungle Waves 7 525 0x002C7, // Jungle Waves 7
526// 0x17CAB, // Jungle Pop-up Wall
639 0x0026D, // Jungle Dots 1 527 0x0026D, // Jungle Dots 1
640 0x0026E, // Jungle Dots 2 528 0x0026E, // Jungle Dots 2
641 0x0026F, // Jungle Dots 3 529 0x0026F, // Jungle Dots 3
642 0x00C3F, // Jungle Dots 4 530 0x00C3F, // Jungle Dots 4
643 0x00C41, // Jungle Dots 5 531 0x00C41, // Jungle Dots 5
644 0x014B2, // Jungle Dots 6 532 0x014B2, // Jungle Dots 6
533 0x03616, // Jungle Laser
534};
535
536// There might be something to do with these, I haven't decided yet.
537std::vector<int> nothingPanels = {
538// Doors & Shortcuts & Shortcut doors & Door controls
539 0x0C339, // Desert Surface Door
540 0x0A249, // Desert Pond Exit Door
541 0x275ED, // Mill EP Door
542 0x17CAC, // Mill Stairs Shortcut Door
543 0x38663, // Boathouse Shortcut
544 0x09E49, // Keep Shadows Shortcut
545 0x0361B, // Keep Tower Shortcut
546 0x334DC, // Shadows Inner Door Control
547 0x334DB, // Shadows Outer Door Control
548 0x2700B, // Treehouse Exterior Door Control
549 0x17CBC, // Treehouse Interior Door Control
550 0x337FA, // Jungle Shortcut
551
552// Controls (?)
553 0x09FA0, // Desert Surface 3 Control
554 0x09F86, // Desert Surface 8 Control
555 0x1C2DF, // Desert Flood Control Lower Far Left
556 0x1831E, // Desert Flood Control Lower Far Right
557 0x1C260, // Desert Flood Control Lower Near Left
558 0x1831C, // Desert Flood Control Lower Near Right
559 0x1C2F3, // Desert Flood Control Raise Far Left
560 0x1831D, // Desert Flood Control Raise Far Right
561 0x1C2B1, // Desert Flood Control Raise Near Left
562 0x1831B, // Desert Flood Control Raise Near Right
563 0x0A015, // Desert Final Far Control
564 0x03678, // Mill Lower Ramp Contol
565 0x03679, // Mill Lower Lift Control
566 0x03675, // Mill Upper Lift Control
567 0x03676, // Mill Upper Ramp Control
568 0x03852, // Boathouse Ramp Angle Control
569 0x03858, // Boathouse Ramp Position Control
570 0x275FA, // Boathouse Hook Control
571 0x037FF, // Treehouse Drawbridge Control
572 0x09F98, // Town Laser Redirect Control
573 0x334D8, // Town RGB Light Control
574 0x17E2B, // Swamp Flood Gate Control
575 0x00609, // Swamp Surface Sliding Bridge Control
576 0x18488, // Swamp Underwater Sliding Bridge Control
577 0x17C0A, // Swamp Island Control 1
578 0x17E07, // Swamp Island Control 2
579 0x181F5, // Swamp Rotating Bridge Control
580
581// Vault Boxes
582 0x03481, // Outside Tutorial Vault Box
583 0x0339E, // Desert Vault Box
584 0x03535, // Shipwreck Vault Box
585 0x03702, // Jungle Vault Box
586 0x03542, // Mountainside Vault Box
587 0x2FAF6, // Tunnels Vault Box
588
589// Boat Summons
590 0x17CC8, // Glass Factory Summon Boat
591 0x17CA6, // Boathouse Summon Boat
592 0x17C95, // Treehouse Summon Boat
593 0x0A054, // Town Summon Boat
594 0x09DB8, // Swamp Summon Boat
595 0x17CDF, // Jungle Summon Boat
596
597// Identical sets
598 0x00143, // Orchard Apple Tree 1
599 0x0003B, // Orchard Apple Tree 2
600 0x00055, // Orchard Apple Tree 3
601 0x032F7, // Orchard Apple Tree 4
602 0x032FF, // Orchard Apple Tree 5
603 0x009B8, // Symmetry Island Transparent 1
604 0x003E8, // Symmetry Island Transparent 2
605 0x00A15, // Symmetry Island Transparent 3
606 0x00B53, // Symmetry Island Transparent 4
607 0x00B8D, // Symmetry Island Transparent 5
608
609// Misc
610 0x03629, // Tutorial Gate Open
611 0x09FAA, // Desert Lightswitch
612 0x0C335, // Tutorial Pillar
613 0x0C373, // Tutorial Patio floor
614 0x1C349, // Symmetry Island Door 2 - Collision fails here, sadly
615 0x18076, // Desert Flood Exit - I am doing something with this -- but it's a very unique panel.
616 0x0A15C, // Desert Final Left Convex
617 0x09FFF, // Desert Final Left Concave
618 0x0A15F, // Desert Final Near
619 0x033EA, // Keep Yellow Pressure Plates
620 0x0A3A8, // Keep Yellow Reset
621 0x01BE9, // Keep Purple Pressure Plates
622 0x0A3B9, // Keep Purple Reset
623 0x01CD3, // Keep Green Pressure Plates
624 0x0A3BB, // Keep Green Reset
625 0x01D3F, // Keep Blue Pressure Plates
626 0x0A3AD, // Keep Blue Reset
627 0x2896A, // Town Bridge
628 0x28A69, // Town Lattice
629 0x28A79, // Town Maze
630 0x28B39, // Town Red Hexagonal
631 0x034E3, // Town Soundproof Dots
632 0x034E4, // Town Soundproof Waves
633 0x079DF, // Town Triple
634 0x00815, // Theater Video Input
635 0x03553, // Theater Tutorial Video
636 0x03552, // Theater Desert Video
637 0x0354E, // Theater Jungle Video
638 0x03549, // Theater Challenge Video
639 0x0354F, // Theater Shipwreck Video
640 0x03545, // Theater Mountain Video
641 0x18590, // Town Transparent
642 0x28AE3, // Town Wire
643
644
645 0x09E39, // Mountain 1 Purple Pathway
646// 0x33AF5, // Mountain 1 Blue 1
647// 0x33AF7, // Mountain 1 Blue 2
648// 0x09F6E, // Mountain 1 Blue 3
649// 0x09FD8, // Mountain 2 Rainbow 5
650 0x09E86, // Mountain 2 Blue Pathway
651 0x09ED8, // Mountain 2 Orange Pathway
652 0x09F8E, // Mountain 3 Near Right Floor
653 0x09FC1, // Mountain 3 Near Left Floor
654 0x09F01, // Mountain 3 Far Right Floor
655 0x09EFF, // Mountain 3 Far Left Floor
656 0x09FDA, // Mountain 3 Giant Floor
657// 0x01983, // Mountain 3 Left Peekaboo
658// 0x01987, // Mountain 3 Right Peekaboo
659// 0x3D9A6, // Mountain 3 Left Close Door
660// 0x3D9A7, // Mountain 3 Right Close Door
661// 0x3D9AA, // Mountain 3 Left Activate Elevator
662// 0x3D9A8, // Mountain 3 Right Activate Elevator
663// 0x3D9A9, // Mountain 3 Launch Elevator
664// 0x3C113, // Mountain 3 Left Open Door
665// 0x3C114, // Mountain 3 Right Open Door
666 0x09F7F, // Mountaintop Laser Box
667 0x17C34, // Mountaintop Perspective
668 0x0A16E, // UTM Challenge Entrance
669// 0x334E1, // UTM Secret Door Control
670// 0x2773D, // Tunnels Desert Shortcut
671// 0x27732, // Tunnels Theater Shortcut
672// 0x0A099, // Bunker Glass Door
673// 0x15ADD, // Jungle Vault
674// 0x17CAA, // Jungle Courtyard Gate
675 0x0005C, // Glass Factory Vertical Symmetry 5
645}; 676};
diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp index 2a06ee2..70e4fb2 100644 --- a/WitnessRandomizer/WitnessRandomizer.cpp +++ b/WitnessRandomizer/WitnessRandomizer.cpp
@@ -1,22 +1,33 @@
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?
2 * FEATURES: 6 * FEATURES:
3 * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) 7 * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?)
4 ** Jungle(?), Bunker, Monastery, Challenge(!), Shadows 8 ** Think about: Jungle
9 ** Hard: Monastery
10 ** Do: Challenge
5 * Randomize audio logs 11 * Randomize audio logs
6 * List of panels which split left/right (for left/right controls)
7 * List of panels which split up/down (for up/down controls)
8 * Swap sounds in jungle (along with panels) -- maybe impossible 12 * Swap sounds in jungle (along with panels) -- maybe impossible
9 * Make orange 7 (all of oranges?) hard. Like big = hard. 13 * Make orange 7 (all of oranges?) hard. Like big = hard.
10 * Kill panel slowdown in tutorial 14 * Kill panel slowdown in tutorial
11 * Fix desert elevator (laser rando) / Add keep? 15 * Fix desert elevator (laser rando) / Add keep?
12 * TRY:
13 * Swap treehouse pivots
14*/ 16*/
15#include "Memory.h" 17#include "Memory.h"
16#include "WitnessRandomizer.h" 18#include "WitnessRandomizer.h"
17#include "Panels.h" 19#include "Panels.h"
18#include <string> 20#include <string>
19#include <iostream> 21#include <iostream>
22#include <numeric>
23
24template <class T>
25int find(const std::vector<T> &data, T search, int startIndex = 0) {
26 for (int i=startIndex ; i<data.size(); i++) {
27 if (data[i] == search) return i;
28 }
29 return -1;
30}
20 31
21int main(int argc, char** argv) 32int main(int argc, char** argv)
22{ 33{
@@ -24,60 +35,75 @@ int main(int argc, char** argv)
24 35
25 if (argc == 2) { 36 if (argc == 2) {
26 srand(atoi(argv[1])); // Seed with RNG from command line 37 srand(atoi(argv[1])); // Seed with RNG from command line
38 } else {
39 int seed = rand() % 1 << 16;
40 std::cout << "Selected seed:" << seed << std::endl;
41 srand(seed);
27 } 42 }
28 43
29 //* 44
30 randomizer.Randomize(lasers, SWAP_TARGETS); 45 // Content swaps -- must happen before squarePanels
31 46 randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE);
32 randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE); 47 randomizer.Randomize(leftForwardRightPanels, SWAP_LINES | SWAP_STYLE);
33 randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE); 48
34 49 randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE);
35 50
36 // randomizer.Randomize(monasteryPanels, SWAP_TARGETS); 51 // Frame swaps -- must happen after squarePanels
37 // randomizer.Randomize(shadowsPanels, SWAP_TARGETS); 52 randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE);
38 // randomizer.Randomize(bunkerPanels, SWAP_TARGETS); 53
39 54
40 // randomizer.Randomize(junglePanels, SWAP_LINES | SWAP_STYLE); 55 // Target swaps, can happen whenever
41 // randomizer.Randomize(mountainMultipanel, SWAP_LINES | SWAP_STYLE); 56 randomizer.Randomize(lasers, SWAP_TARGETS);
42 // randomizer.Randomize(pillars, SWAP_LINES | SWAP_STYLE | SWAP_BACK_DISTANCE); 57
43 58 std::vector<int> randomOrder = std::vector(junglePanels.size(), 0);
44 /*/ 59 std::iota(randomOrder.begin(), randomOrder.end(), 0);
45 int BOATH_3_1 = 0x21B5; 60 // Randomize Waves 2-7
46 int MILL_L_1 = 0xE0C; 61 // Waves 1 cannot be randomized, since no other panel can start on
47 int MILL_U_1 = 0x557; 62 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 1, 7);
48 int QUARRY_E_1 = 0x9E57; 63 // Randomize Pitches 1-6 onto themselves
49 int QUARRY_E_2 = 0x17C09; 64 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 7, 13);
50 int MILL_E_1 = 0x1E5A; 65 randomizer.ReassignTargets(junglePanels, randomOrder);
51 int BUNKER_G_1 = 0xA010; 66
52 int BUNKER_T_1 = 0x9F7D; 67 randomOrder = std::vector(bunkerPanels.size(), 0);
53 int TUT_PILLAR = 0xC335; 68 std::iota(randomOrder.begin(), randomOrder.end(), 0);
54 int TUT_F_C = 0x293; 69 // Randomize Tutorial 2-Advanced Tutorial 4 + Glass 1
55 int PILLAR_L_1 = 0x383D; 70 // Tutorial 1 cannot be randomized, since no other panel can start on
56 int PILLAR_L_4 = 0x339BB; 71 // Glass 1 will become door + glass 1, due to the targetting system
57 int PILLAR_C = 0x9DD5; 72 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 1, 10);
58 int PILLAR_C_L = 0x1C31A; 73 // Randomize Glass 1-3 into everything after the door
59 int DESERT_1 = 0x00698; 74 int glassDoorIndex = find(randomOrder, 9) + 1;
60 int DESERT_L_2 = 0x006E3; 75 randomizer.RandomizeRange(randomOrder, SWAP_NONE, glassDoorIndex, 12);
61 int TOWN_S_1 = 0x28AC7; 76 randomizer.ReassignTargets(bunkerPanels, randomOrder);
62 77
63 78 randomOrder = std::vector(shadowsPanels.size(), 0);
64 //randomizer.SwapPanels(PILLAR_L_1, PILLAR_C_L, SWAP_LINES | SWAP_STYLE | SWAP_BACK_DISTANCE); 79 std::iota(randomOrder.begin(), randomOrder.end(), 0);
65 //randomizer.SwapPanelData(PILLAR_L_1, PILLAR_C_L, 0x200, 0x50); 80 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 0, 8); // Tutorial
66 // Turn on the panel 81 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 8, 16); // Avoid
67 //randomizer._memory.WriteData<float>({0x5B28C0, 0x18, PILLAR_L_1*8, 0x2A8}, {1.0f, 1.0f}); 82 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 16, 21); // Follow
68 83 randomizer.ReassignTargets(shadowsPanels, randomOrder);
69 // randomizer.SwapPanels(PILLAR_L_1, PILLAR_C_L, SWAP_LINES | SWAP_STYLE | SWAP_BACK_DISTANCE); 84 randomizer.TurnOff(shadowsPanels[0]);
70 //*/ 85 randomizer.TurnOn(shadowsPanels[randomOrder[0]]);
71} 86}
72 87
73WitnessRandomizer::WitnessRandomizer() : _memory("witness64_d3d11.exe") 88WitnessRandomizer::WitnessRandomizer() : _memory("witness64_d3d11.exe")
74{ 89{
75 // Turn off desert flood final 90 // Turn off desert flood final
76 _memory.WriteData<float>({0x5B28C0, 0x18, 0x18076*8, 0x2A8}, {0.0f, 0.0f}); 91 TurnOff(0x18076);
77 // Change desert floating target to desert flood final 92 // Change desert floating target to desert flood final
78 _memory.WriteData<int>({0x5B28C0, 0x18, 0x17ECA*8, 0x2BC}, {0x18077}); 93 _memory.WriteData<int>({0x5B28C0, 0x18, 0x17ECA*8, 0x2BC}, {0x18077});
79 // Distance-gate shadows laser to prevent sniping through the bars 94 // Distance-gate shadows laser to prevent sniping through the bars
80 _memory.WriteData<float>({0x5B28C0, 0x18, 0x19650*8, 0x3C0}, {2.0f}); 95 _memory.WriteData<float>({0x5B28C0, 0x18, 0x19650*8, 0x3C0}, {2.5f});
96 // Change the shadows tutorial cable to only activate avoid
97 _memory.WriteData<int>({0x5B28C0, 0x18, 0x319A8*8, 0xD8}, {0});
98 // Change shadows avoid 8 to power shadows follow
99 _memory.WriteData<int>({0x5B28C0, 0x18, 0x1972F*8, 0x2BC}, {0x1C34C});
100 // Disable tutorial cursor speed modifications
101 _memory.WriteData<float>({0x5B28C0, 0x18, 0x00295*8, 0x358}, {1.0});
102 _memory.WriteData<float>({0x5B28C0, 0x18, 0x0C373*8, 0x358}, {1.0});
103 _memory.WriteData<float>({0x5B28C0, 0x18, 0x00293*8, 0x358}, {1.0});
104 _memory.WriteData<float>({0x5B28C0, 0x18, 0x002C2*8, 0x358}, {1.0});
105
106
81 107
82 // Explicitly set back-off distance for the challenge entry & final 2 pillars 108 // Explicitly set back-off distance for the challenge entry & final 2 pillars
83// _memory.WriteData<float>({0x5B28C0, 0x18, 0x9DD5*8, 0x22C}, {2.5f}); 109// _memory.WriteData<float>({0x5B28C0, 0x18, 0x9DD5*8, 0x22C}, {2.5f});
@@ -85,10 +111,17 @@ WitnessRandomizer::WitnessRandomizer() : _memory("witness64_d3d11.exe")
85// _memory.WriteData<float>({0x5B28C0, 0x18, 0x1C319*8, 0x22C}, {3.0f}); 111// _memory.WriteData<float>({0x5B28C0, 0x18, 0x1C319*8, 0x22C}, {3.0f});
86} 112}
87 113
88void WitnessRandomizer::Randomize(std::vector<int> panels, int flags) { 114void WitnessRandomizer::Randomize(std::vector<int> &panels, int flags) {
115 return RandomizeRange(panels, flags, 0, panels.size());
116}
117
118// Range is [start, end)
119void WitnessRandomizer::RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex) {
89 if (panels.size() == 0) return; 120 if (panels.size() == 0) return;
90 for (size_t i=panels.size() - 1; i > 1; i--) { 121 if (startIndex >= endIndex) return;
91 int target = rand() % i; 122 if (endIndex >= panels.size()) endIndex = panels.size();
123 for (size_t i = endIndex-1; i > startIndex+1; i--) {
124 size_t target = rand() % (i - startIndex) + startIndex;
92 if (i != target) { 125 if (i != target) {
93 // std::cout << "Swapping panels " << std::hex << panels[i] << " and " << std::hex << panels[target] << std::endl; 126 // std::cout << "Swapping panels " << std::hex << panels[i] << " and " << std::hex << panels[target] << std::endl;
94 SwapPanels(panels[i], panels[target], flags); 127 SwapPanels(panels[i], panels[target], flags);
@@ -180,6 +213,36 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) {
180 } 213 }
181} 214}
182 215
216/*
217void WitnessRandomizer::SwapTargetList(const std::vector<int>& initialOrder, const std::vector<int>& randomizedOrder) {
218 std::vector<std::vector<int>> randomizedTargets;
219 for (int panel : randomizedOrder) {
220 randomizedTargets.push_back(_memory.ReadData<int>({0x5B28C0, 0x18, panel*8, 0x2BC}, 1));
221 }
222 for (int i=0; i<initialOrder.size(); i++) {
223 int panel = initialOrder[i];
224 std::vector<int> target = randomizedTargets[i];
225 _memory.WriteData<int>({0x5B28C0, 0x18, panel*8, 0x2BC}, target);
226 }
227}
228*/
229
230void WitnessRandomizer::ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order) {
231 std::vector<int> targetToActivatePanel = {panels[0] + 1};
232 for (int panel : panels) {
233 int target = _memory.ReadData<int>({0x5B28C0, 0x18, panel*8, 0x2BC}, 1)[0];
234 targetToActivatePanel.push_back(target);
235 }
236
237 for (int i=0; i<order.size() - 1; i++) {
238 // order[i+1] is the target panel
239 // order[i+1] - 1 is the (real) panel before the target panel
240 // targets[order[i+1] - 1] is the (real) target which will activate the target panel
241 int panelTarget = targetToActivatePanel[order[i+1]];
242 _memory.WriteData<int>({0x5B28C0, 0x18, panels[order[i]]*8, 0x2BC}, {panelTarget});
243 }
244}
245
183void WitnessRandomizer::SwapPanelData(int panel1, int panel2, int finalOffset, int dataSize) { 246void WitnessRandomizer::SwapPanelData(int panel1, int panel2, int finalOffset, int dataSize) {
184 // Currently wired for old version 247 // Currently wired for old version
185 std::vector<int> panel1Offset = {0x5B28C0, 0x18, panel1*8, finalOffset}; 248 std::vector<int> panel1Offset = {0x5B28C0, 0x18, panel1*8, finalOffset};
@@ -191,3 +254,11 @@ void WitnessRandomizer::SwapPanelData(int panel1, int panel2, int finalOffset, i
191 _memory.WriteData<byte>(panel2Offset, panel1Data); 254 _memory.WriteData<byte>(panel2Offset, panel1Data);
192 _memory.WriteData<byte>(panel1Offset, panel2Data); 255 _memory.WriteData<byte>(panel1Offset, panel2Data);
193} 256}
257
258void WitnessRandomizer::TurnOn(int panel) {
259 _memory.WriteData<float>({0x5B28C0, 0x18, panel*8, 0x2A8}, {1.0f, 1.0f});
260}
261
262void WitnessRandomizer::TurnOff(int panel) {
263 _memory.WriteData<float>({0x5B28C0, 0x18, panel*8, 0x2A8}, {0.0f, 0.0f});
264}
diff --git a/WitnessRandomizer/WitnessRandomizer.h b/WitnessRandomizer/WitnessRandomizer.h index 7618e91..f9a66c4 100644 --- a/WitnessRandomizer/WitnessRandomizer.h +++ b/WitnessRandomizer/WitnessRandomizer.h
@@ -1,5 +1,6 @@
1#pragma once 1#pragma once
2 2
3int SWAP_NONE = 0x0;
3int SWAP_TARGETS = 0x1; 4int SWAP_TARGETS = 0x1;
4int SWAP_LINES = 0x2; 5int SWAP_LINES = 0x2;
5int SWAP_STYLE = 0x4; 6int SWAP_STYLE = 0x4;
@@ -10,10 +11,16 @@ public:
10 11
11 WitnessRandomizer(); 12 WitnessRandomizer();
12 13
13 void Randomize(std::vector<int> panels, int flags); 14 void Randomize(std::vector<int> &panels, int flags);
15 void RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex);
14 void SwapPanels(int panel1, int panel2, int flags); 16 void SwapPanels(int panel1, int panel2, int flags);
17 void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order);
18
15 19
16//private: 20//private:
21 void TurnOn(int panel);
22 void TurnOff(int panel);
23
17 void SwapPanelData(int panel1, int panel2, int finalOffset, int dataSize); 24 void SwapPanelData(int panel1, int panel2, int finalOffset, int dataSize);
18 25
19 Memory _memory; 26 Memory _memory;