summary refs log tree commit diff stats
path: root/WitnessRandomizer
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-10-27 17:18:43 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-10-27 17:18:43 -0700
commit76bcf9faffde81bf34ed5138db7b181694bce635 (patch)
tree29e5b3dfaeb555105e5748f0ae68d902570407e2 /WitnessRandomizer
parent7e6307117421cacc6e4bb6ef5b2909a19879ae3f (diff)
downloadwitness-tutorializer-76bcf9faffde81bf34ed5138db7b181694bce635.tar.gz
witness-tutorializer-76bcf9faffde81bf34ed5138db7b181694bce635.tar.bz2
witness-tutorializer-76bcf9faffde81bf34ed5138db7b181694bce635.zip
Fix random order not working
Diffstat (limited to 'WitnessRandomizer')
-rw-r--r--WitnessRandomizer/Panels.h62
-rw-r--r--WitnessRandomizer/WitnessRandomizer.cpp155
-rw-r--r--WitnessRandomizer/WitnessRandomizer.h8
3 files changed, 114 insertions, 111 deletions
diff --git a/WitnessRandomizer/Panels.h b/WitnessRandomizer/Panels.h index 747bbc7..9d4e88c 100644 --- a/WitnessRandomizer/Panels.h +++ b/WitnessRandomizer/Panels.h
@@ -2,7 +2,7 @@
2#include <vector> 2#include <vector>
3 3
4// Some of these (the puzzle ones) are duplicated elsewhere 4// Some of these (the puzzle ones) are duplicated elsewhere
5const std::vector<int> lasers = { 5std::vector<int> lasers = {
6 0x0360D, // Symmetry 6 0x0360D, // Symmetry
7 0x03615, // Swamp 7 0x03615, // Swamp
8 0x09DE0, // Bunker 8 0x09DE0, // Bunker
@@ -18,24 +18,24 @@ const std::vector<int> lasers = {
18}; 18};
19 19
20// Note: Some of these (non-desert) are duplicated elsewhere 20// Note: Some of these (non-desert) are duplicated elsewhere
21const std::vector<int> burnablePanels = { 21std::vector<int> burnablePanels = {
22// 0x17D9C, // Treehouse Yellow 7 22 0x17D9C, // Treehouse Yellow 7
23// 0x17DC2, // Treehouse Yellow 8 23 0x17DC2, // Treehouse Yellow 8
24// 0x17DC4, // Treehouse Yellow 9 24 0x17DC4, // Treehouse Yellow 9
25// 0x00999, // Swamp Discontinuous 1 25 0x00999, // Swamp Discontinuous 1
26// 0x0099D, // Swamp Discontinuous 2 26 0x0099D, // Swamp Discontinuous 2
27// 0x009A0, // Swamp Discontinuous 3 27 0x009A0, // Swamp Discontinuous 3
28// 0x009A1, // Swamp Discontinuous 4 28 0x009A1, // Swamp Discontinuous 4
29// 0x00007, // Swamp Rotation Tutorial 1 29 0x00007, // Swamp Rotation Tutorial 1
30// 0x00008, // Swamp Rotation Tutorial 2 30 0x00008, // Swamp Rotation Tutorial 2
31// 0x00009, // Swamp Rotation Tutorial 3 31 0x00009, // Swamp Rotation Tutorial 3
32// 0x0000A, // Swamp Rotation Tutorial 4 32 0x0000A, // Swamp Rotation Tutorial 4
33// 0x28AC7, // Town Blue 1 33 0x28AC7, // Town Blue 1
34// 0x28AC8, // Town Blue 2 34 0x28AC8, // Town Blue 2
35// 0x28ACA, // Town Blue 3 35 0x28ACA, // Town Blue 3
36// 0x28ACB, // Town Blue 4 36 0x28ACB, // Town Blue 4
37// 0x28ACC, // Town Blue 5 37 0x28ACC, // Town Blue 5
38// 0x17CF0, // Mill Discard 38 0x17CF0, // Mill Discard
39 39
40 0x00698, // Desert Surface 1 40 0x00698, // Desert Surface 1
41 0x0048F, // Desert Surface 2 41 0x0048F, // Desert Surface 2
@@ -63,7 +63,7 @@ const std::vector<int> burnablePanels = {
63 63
64// Note: Some of these (non-controls) are duplicated elsewhere 64// Note: Some of these (non-controls) are duplicated elsewhere
65// TODO: Gave up 65// TODO: Gave up
66const std::vector<int> leftRightPanels = { 66std::vector<int> leftRightPanels = {
67 0x01A54, // Glass Factory Entry 67 0x01A54, // Glass Factory Entry
68 0x00086, // Glass Factory Vertical Symmetry 1 68 0x00086, // Glass Factory Vertical Symmetry 1
69 0x00087, // Glass Factory Vertical Symmetry 2 69 0x00087, // Glass Factory Vertical Symmetry 2
@@ -77,7 +77,7 @@ const std::vector<int> leftRightPanels = {
77}; 77};
78 78
79// Note: Some of these (non-controls) are duplicated elsewhere 79// Note: Some of these (non-controls) are duplicated elsewhere
80const std::vector<int> upDownPanels = { 80std::vector<int> upDownPanels = {
81 0x0008D, // Glass Factory Rotational Symmetry 1 81 0x0008D, // Glass Factory Rotational Symmetry 1
82 0x00081, // Glass Factory Rotational Symmetry 2 82 0x00081, // Glass Factory Rotational Symmetry 2
83 0x00083, // Glass Factory Rotational Symmetry 3 83 0x00083, // Glass Factory Rotational Symmetry 3
@@ -100,7 +100,7 @@ const std::vector<int> upDownPanels = {
100}; 100};
101 101
102// Note: Some of these (non-controls) are duplicated elsewhere 102// Note: Some of these (non-controls) are duplicated elsewhere
103const std::vector<int> leftForwardRightPanels = { 103std::vector<int> leftForwardRightPanels = {
104// 0x00075, // Symmetry Island Colored Dots 3 104// 0x00075, // Symmetry Island Colored Dots 3
105// 0x288EA, // UTM Perspective 1 105// 0x288EA, // UTM Perspective 1
106// 0x288FC, // UTM Perspective 2 106// 0x288FC, // UTM Perspective 2
@@ -112,7 +112,7 @@ const std::vector<int> leftForwardRightPanels = {
112 0x17E52, // Treehouse Green 4 112 0x17E52, // Treehouse Green 4
113}; 113};
114 114
115const std::vector<int> pillars = { 115std::vector<int> pillars = {
116 0x0383D, // Mountain 3 Left Pillar 1 116 0x0383D, // Mountain 3 Left Pillar 1
117 0x0383F, // Mountain 3 Left Pillar 2 117 0x0383F, // Mountain 3 Left Pillar 2
118 0x03859, // Mountain 3 Left Pillar 3 118 0x03859, // Mountain 3 Left Pillar 3
@@ -126,7 +126,7 @@ const std::vector<int> pillars = {
126// 0x1C319, // Challenge Right Pillar 126// 0x1C319, // Challenge Right Pillar
127}; 127};
128 128
129const std::vector<int> mountainMultipanel = { 129std::vector<int> mountainMultipanel = {
130 0x09FCC, // Mountain 2 Multipanel 1 130 0x09FCC, // Mountain 2 Multipanel 1
131 0x09FCE, // Mountain 2 Multipanel 2 131 0x09FCE, // Mountain 2 Multipanel 2
132 0x09FCF, // Mountain 2 Multipanel 3 132 0x09FCF, // Mountain 2 Multipanel 3
@@ -135,7 +135,7 @@ const std::vector<int> mountainMultipanel = {
135 0x09FD2, // Mountain 2 Multipanel 6 135 0x09FD2, // Mountain 2 Multipanel 6
136}; 136};
137 137
138const std::vector<int> squarePanels = { 138std::vector<int> squarePanels = {
139 0x00064, // Tutorial Straight 139 0x00064, // Tutorial Straight
140 0x00182, // Tutorial Bend 140 0x00182, // Tutorial Bend
141 0x0A3B2, // Tutorial Back Right 141 0x0A3B2, // Tutorial Back Right
@@ -449,11 +449,12 @@ const std::vector<int> squarePanels = {
449 0x00558, // UTM Blue Right Near 2 449 0x00558, // UTM Blue Right Near 2
450 0x00567, // UTM Blue Right Near 3 450 0x00567, // UTM Blue Right Near 3
451 0x006FE, // UTM Blue Right Near 4 451 0x006FE, // UTM Blue Right Near 4
452 0x0A16E, // UTM Challenge Entrance
452 0x039B4, // Tunnels Theater Catwalk 453 0x039B4, // Tunnels Theater Catwalk
453 0x09E85, // Tunnels Town Shortcut 454 0x09E85, // Tunnels Town Shortcut
454}; 455};
455 456
456const std::vector<int> shadowsPanels = { 457std::vector<int> shadowsPanels = {
457 0x198B5, // Shadows Tutorial 1 458 0x198B5, // Shadows Tutorial 1
458 0x198BD, // Shadows Tutorial 2 459 0x198BD, // Shadows Tutorial 2
459 0x198BF, // Shadows Tutorial 3 460 0x198BF, // Shadows Tutorial 3
@@ -478,7 +479,7 @@ const std::vector<int> shadowsPanels = {
478 0x19650, // Shadows Laser 479 0x19650, // Shadows Laser
479}; 480};
480 481
481const std::vector<int> monasteryPanels = { 482std::vector<int> monasteryPanels = {
482 0x00B10, // Monastery Left Door 483 0x00B10, // Monastery Left Door
483 0x00290, // Monastery Exterior 1 484 0x00290, // Monastery Exterior 1
484 0x00C92, // Monastery Right Door 485 0x00C92, // Monastery Right Door
@@ -493,7 +494,7 @@ const std::vector<int> monasteryPanels = {
493 0x17CA4, // Monastery Laser 494 0x17CA4, // Monastery Laser
494}; 495};
495 496
496const std::vector<int> bunkerPanels = { 497std::vector<int> bunkerPanels = {
497 0x09F7D, // Bunker Tutorial 1 498 0x09F7D, // Bunker Tutorial 1
498 0x09FDC, // Bunker Tutorial 2 499 0x09FDC, // Bunker Tutorial 2
499 0x09FF7, // Bunker Tutorial 3 500 0x09FF7, // Bunker Tutorial 3
@@ -514,7 +515,7 @@ const std::vector<int> bunkerPanels = {
514 0x0A079, // Bunker Elevator 515 0x0A079, // Bunker Elevator
515}; 516};
516 517
517const std::vector<int> junglePanels = { 518std::vector<int> junglePanels = {
518 0x002C4, // Jungle Waves 1 519 0x002C4, // Jungle Waves 1
519 0x00767, // Jungle Waves 2 520 0x00767, // Jungle Waves 2
520 0x002C6, // Jungle Waves 3 521 0x002C6, // Jungle Waves 3
@@ -533,7 +534,7 @@ const std::vector<int> junglePanels = {
533}; 534};
534 535
535// There might be something to do with these, I haven't decided yet. 536// There might be something to do with these, I haven't decided yet.
536const std::vector<int> nothingPanels = { 537std::vector<int> nothingPanels = {
537// Doors & Shortcuts & Shortcut doors & Door controls 538// Doors & Shortcuts & Shortcut doors & Door controls
538 0x0C339, // Desert Surface Door 539 0x0C339, // Desert Surface Door
539 0x0A249, // Desert Pond Exit Door 540 0x0A249, // Desert Pond Exit Door
@@ -664,7 +665,6 @@ const std::vector<int> nothingPanels = {
664// 0x3C114, // Mountain 3 Right Open Door 665// 0x3C114, // Mountain 3 Right Open Door
665 0x09F7F, // Mountaintop Laser Box 666 0x09F7F, // Mountaintop Laser Box
666 0x17C34, // Mountaintop Perspective 667 0x17C34, // Mountaintop Perspective
667 0x0A16E, // UTM Challenge Entrance
668// 0x334E1, // UTM Secret Door Control 668// 0x334E1, // UTM Secret Door Control
669// 0x2773D, // Tunnels Desert Shortcut 669// 0x2773D, // Tunnels Desert Shortcut
670// 0x27732, // Tunnels Theater Shortcut 670// 0x27732, // Tunnels Theater Shortcut
diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp index 6ce0256..0135cc9 100644 --- a/WitnessRandomizer/WitnessRandomizer.cpp +++ b/WitnessRandomizer/WitnessRandomizer.cpp
@@ -13,6 +13,8 @@
13 ** Think about: Jungle 13 ** Think about: Jungle
14 ** Hard: Monastery 14 ** Hard: Monastery
15 ** Do: Challenge 15 ** Do: Challenge
16 * Block swamp snipe w/ distance gate
17 * Turn off shadows 8
16 * Randomize audio logs 18 * Randomize audio logs
17 * Swap sounds in jungle (along with panels) -- maybe impossible 19 * Swap sounds in jungle (along with panels) -- maybe impossible
18 * Make orange 7 (all of oranges?) hard. Like big = hard. 20 * Make orange 7 (all of oranges?) hard. Like big = hard.
@@ -44,88 +46,89 @@ int main(int argc, char** argv)
44 if (argc == 2) { 46 if (argc == 2) {
45 srand(atoi(argv[1])); // Seed from the command line 47 srand(atoi(argv[1])); // Seed from the command line
46 } else { 48 } else {
47 int seed = time(nullptr) % (1 << 16); // Seed from the time in milliseconds 49 srand(static_cast<unsigned int>(time(nullptr)));
50 int seed = rand() % (1 << 16); // Seed from the time in milliseconds
48 std::cout << "Selected seed: " << seed << std::endl; 51 std::cout << "Selected seed: " << seed << std::endl;
49 srand(seed); 52 srand(seed);
50 } 53 }
51 54
52// randomizer.SwapPanels(0x28AC7, 0x00698, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 1 55 randomizer.SwapPanels(0x28AC7, 0x00698, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 1
53// randomizer.SwapPanels(0x28AC8, 0x0048F, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 2 56 randomizer.SwapPanels(0x28AC8, 0x0048F, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 2
54// randomizer.SwapPanels(0x28ACA, 0x09F92, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 3 57 randomizer.SwapPanels(0x28ACA, 0x09F92, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 3
55// randomizer.SwapPanels(0x28ACB, 0x0A036, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 4 58 randomizer.SwapPanels(0x28ACB, 0x0A036, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 4
56// randomizer.SwapPanels(0x28ACC, 0x09DA6, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 5 59 randomizer.SwapPanels(0x28ACC, 0x09DA6, SWAP_LINES | SWAP_STYLE); // Symmetry Island Colored Dots 5
57// 0x00079; // Symmetry Island Colored Dots 6 60 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
67 // Content swaps -- must happen before squarePanels
68 randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE);
69 randomizer.Randomize(leftForwardRightPanels, SWAP_LINES);
70
71 randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE);
72
73 // Frame swaps -- must happen after squarePanels
74 randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE);
75
76 // Target swaps, can happen whenever
77 randomizer.Randomize(lasers, SWAP_TARGETS);
78 // Read the target of keep front laser, and write it to keep back laser.
79 std::vector<int> keepFrontLaserTarget = randomizer.ReadPanelData<int>(0x0360E, TARGET, 1);
80 randomizer.WritePanelData<int>(0x03317, TARGET, keepFrontLaserTarget);
81
82 std::vector<int> randomOrder;
83
84 /* Jungle
85 randomOrder = std::vector(junglePanels.size(), 0);
86 std::iota(randomOrder.begin(), randomOrder.end(), 0);
87 // Randomize Waves 2-7
88 // Waves 1 cannot be randomized, since no other panel can start on
89 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 1, 7);
90 // Randomize Pitches 1-6 onto themselves
91 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 7, 13);
92 randomizer.ReassignTargets(junglePanels, randomOrder);
93 */
94 61
95 /* Bunker */ 62 0x0005D; // Outside Tutorial Dots Tutorial 1
96 randomOrder = std::vector(bunkerPanels.size(), 0); 63 0x0005E; // Outside Tutorial Dots Tutorial 2
97 std::iota(randomOrder.begin(), randomOrder.end(), 0); 64 0x0005F; // Outside Tutorial Dots Tutorial 3
98 // Randomize Tutorial 2-Advanced Tutorial 4 + Glass 1 65 0x00060; // Outside Tutorial Dots Tutorial 4
99 // Tutorial 1 cannot be randomized, since no other panel can start on 66 0x00061; // Outside Tutorial Dots Tutorial 5
100 // Glass 1 will become door + glass 1, due to the targetting system
101 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 1, 10);
102 // Randomize Glass 1-3 into everything after the door
103 const size_t glassDoorIndex = find(randomOrder, 9) + 1;
104 randomizer.RandomizeRange(randomOrder, SWAP_NONE, glassDoorIndex, 12);
105 randomizer.ReassignTargets(bunkerPanels, randomOrder);
106 67
107 /* Shadows */
108 randomOrder = std::vector(shadowsPanels.size(), 0);
109 std::iota(randomOrder.begin(), randomOrder.end(), 0);
110 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 0, 8); // Tutorial
111 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 8, 16); // Avoid
112 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 16, 21); // Follow
113 randomizer.ReassignTargets(shadowsPanels, randomOrder);
114 // Turn off original starting panel
115 randomizer.WritePanelData<float>(shadowsPanels[0], POWER, {0.0f, 0.0f});
116 // Turn on new starting panel
117 randomizer.WritePanelData<float>(shadowsPanels[randomOrder[0]], POWER, {1.0f, 1.0f});
118 68
119 /* Monastery
120 randomOrder = std::vector(monasteryPanels.size(), 0);
121 std::iota(randomOrder.begin(), randomOrder.end(), 0);
122 randomizer.RandomizeRange(randomOrder, SWAP_NONE, 2, 6); // outer 2 & 3, inner 1
123 // Once outer 3 and right door are solved, inner 2-4 are accessible
124 int innerPanelsIndex = max(find(randomOrder, 2), find(randomOrder, 4));
125 randomizer.RandomizeRange(randomOrder, SWAP_NONE, innerPanelsIndex, 9); // Inner 2-4
126 69
127 randomizer.ReassignTargets(monasteryPanels, randomOrder); 70// // Content swaps -- must happen before squarePanels
128 */ 71// randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE);
72// randomizer.Randomize(leftForwardRightPanels, SWAP_LINES);
73//
74// randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE);
75//
76// // Frame swaps -- must happen after squarePanels
77// randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE);
78//
79// // Target swaps, can happen whenever
80// randomizer.Randomize(lasers, SWAP_TARGETS);
81// // Read the target of keep front laser, and write it to keep back laser.
82// std::vector<int> keepFrontLaserTarget = randomizer.ReadPanelData<int>(0x0360E, TARGET, 1);
83// randomizer.WritePanelData<int>(0x03317, TARGET, keepFrontLaserTarget);
84//
85// std::vector<int> randomOrder;
86//
87// /* Jungle
88// randomOrder = std::vector(junglePanels.size(), 0);
89// std::iota(randomOrder.begin(), randomOrder.end(), 0);
90// // Randomize Waves 2-7
91// // Waves 1 cannot be randomized, since no other panel can start on
92// randomizer.RandomizeRange(randomOrder, SWAP_NONE, 1, 7);
93// // Randomize Pitches 1-6 onto themselves
94// randomizer.RandomizeRange(randomOrder, SWAP_NONE, 7, 13);
95// randomizer.ReassignTargets(junglePanels, randomOrder);
96// */
97//
98// /* Bunker */
99// randomOrder = std::vector(bunkerPanels.size(), 0);
100// std::iota(randomOrder.begin(), randomOrder.end(), 0);
101// // Randomize Tutorial 2-Advanced Tutorial 4 + Glass 1
102// // Tutorial 1 cannot be randomized, since no other panel can start on
103// // Glass 1 will become door + glass 1, due to the targetting system
104// randomizer.RandomizeRange(randomOrder, SWAP_NONE, 1, 10);
105// // Randomize Glass 1-3 into everything after the door
106// const size_t glassDoorIndex = find(randomOrder, 9) + 1;
107// randomizer.RandomizeRange(randomOrder, SWAP_NONE, glassDoorIndex, 12);
108// randomizer.ReassignTargets(bunkerPanels, randomOrder);
109//
110// /* Shadows */
111// randomOrder = std::vector(shadowsPanels.size(), 0);
112// std::iota(randomOrder.begin(), randomOrder.end(), 0);
113// randomizer.RandomizeRange(randomOrder, SWAP_NONE, 0, 8); // Tutorial
114// randomizer.RandomizeRange(randomOrder, SWAP_NONE, 8, 16); // Avoid
115// randomizer.RandomizeRange(randomOrder, SWAP_NONE, 16, 21); // Follow
116// randomizer.ReassignTargets(shadowsPanels, randomOrder);
117// // Turn off original starting panel
118// randomizer.WritePanelData<float>(shadowsPanels[0], POWER, {0.0f, 0.0f});
119// // Turn on new starting panel
120// randomizer.WritePanelData<float>(shadowsPanels[randomOrder[0]], POWER, {1.0f, 1.0f});
121//
122// /* Monastery
123// randomOrder = std::vector(monasteryPanels.size(), 0);
124// std::iota(randomOrder.begin(), randomOrder.end(), 0);
125// randomizer.RandomizeRange(randomOrder, SWAP_NONE, 2, 6); // outer 2 & 3, inner 1
126// // Once outer 3 and right door are solved, inner 2-4 are accessible
127// int innerPanelsIndex = max(find(randomOrder, 2), find(randomOrder, 4));
128// randomizer.RandomizeRange(randomOrder, SWAP_NONE, innerPanelsIndex, 9); // Inner 2-4
129//
130// randomizer.ReassignTargets(monasteryPanels, randomOrder);
131// */
129} 132}
130 133
131WitnessRandomizer::WitnessRandomizer() 134WitnessRandomizer::WitnessRandomizer()
@@ -149,12 +152,12 @@ WitnessRandomizer::WitnessRandomizer()
149 WritePanelData<float>(0x002C2, CURSOR_SPEED_SCALE, {1.0}); 152 WritePanelData<float>(0x002C2, CURSOR_SPEED_SCALE, {1.0});
150} 153}
151 154
152void WitnessRandomizer::Randomize(const std::vector<int>& panels, int flags) { 155void WitnessRandomizer::Randomize(std::vector<int>& panels, int flags) {
153 return RandomizeRange(panels, flags, 0, panels.size()); 156 return RandomizeRange(panels, flags, 0, panels.size());
154} 157}
155 158
156// Range is [start, end) 159// Range is [start, end)
157void WitnessRandomizer::RandomizeRange(std::vector<int> panels, int flags, size_t startIndex, size_t endIndex) { 160void WitnessRandomizer::RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex) {
158 if (panels.size() == 0) return; 161 if (panels.size() == 0) return;
159 if (startIndex >= endIndex) return; 162 if (startIndex >= endIndex) return;
160 if (endIndex >= panels.size()) endIndex = panels.size(); 163 if (endIndex >= panels.size()) endIndex = panels.size();
diff --git a/WitnessRandomizer/WitnessRandomizer.h b/WitnessRandomizer/WitnessRandomizer.h index 0c73b89..bb9db44 100644 --- a/WitnessRandomizer/WitnessRandomizer.h +++ b/WitnessRandomizer/WitnessRandomizer.h
@@ -1,7 +1,7 @@
1#pragma once 1#pragma once
2 2
3//#define GLOBALS 0x5B28C0 3#define GLOBALS 0x5B28C0
4#define GLOBALS 0x62A080 4// #define GLOBALS 0x62A080
5 5
6int SWAP_NONE = 0x0; 6int SWAP_NONE = 0x0;
7int SWAP_TARGETS = 0x1; 7int SWAP_TARGETS = 0x1;
@@ -12,8 +12,8 @@ class WitnessRandomizer {
12public: 12public:
13 WitnessRandomizer(); 13 WitnessRandomizer();
14 14
15 void Randomize(const std::vector<int>& panels, int flags); 15 void Randomize(std::vector<int>& panels, int flags);
16 void RandomizeRange(std::vector<int> panels, int flags, size_t startIndex, size_t endIndex); 16 void RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex);
17 void SwapPanels(int panel1, int panel2, int flags); 17 void SwapPanels(int panel1, int panel2, int flags);
18 void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order); 18 void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order);
19 19