about summary refs log tree commit diff stats
path: root/Source/Randomizer.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-11-01 20:56:56 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-11-01 20:56:56 -0700
commit5de975b03c7200cc66188a4b1a76e1213524975d (patch)
treee3ed982a0dd4fee4db402532aeda2e6bf5e66344 /Source/Randomizer.cpp
parent3557f0ba80942397a9d963208695b4fa80290cb0 (diff)
downloadwitness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.tar.gz
witness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.tar.bz2
witness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.zip
pain and suffering, but I can read/write decorations & dots.
Diffstat (limited to 'Source/Randomizer.cpp')
-rw-r--r--Source/Randomizer.cpp74
1 files changed, 37 insertions, 37 deletions
diff --git a/Source/Randomizer.cpp b/Source/Randomizer.cpp index 9622601..8833078 100644 --- a/Source/Randomizer.cpp +++ b/Source/Randomizer.cpp
@@ -66,19 +66,19 @@ short Randomizer::Randomize(int seed)
66 66
67void Randomizer::AdjustSpeed() { 67void Randomizer::AdjustSpeed() {
68 // Desert Surface Final Control 68 // Desert Surface Final Control
69 _core.WritePanelData<float>(0x09F95, OPEN_RATE, {0.04f}); // 4x 69 _core._memory.WritePanelData<float>(0x09F95, OPEN_RATE, {0.04f}); // 4x
70 // Swamp Sliding Bridge 70 // Swamp Sliding Bridge
71 _core.WritePanelData<float>(0x0061A, OPEN_RATE, {0.1f}); // 4x 71 _core._memory.WritePanelData<float>(0x0061A, OPEN_RATE, {0.1f}); // 4x
72 // Mountain 2 Elevator 72 // Mountain 2 Elevator
73 _core.WritePanelData<float>(0x09EEC, OPEN_RATE, {0.075f}); // 3x 73 _core._memory.WritePanelData<float>(0x09EEC, OPEN_RATE, {0.075f}); // 3x
74} 74}
75 75
76void Randomizer::RandomizeTutorial() { 76void Randomizer::RandomizeTutorial() {
77 // Disable tutorial cursor speed modifications (not working?) 77 // Disable tutorial cursor speed modifications (not working?)
78 _core.WritePanelData<float>(0x00295, CURSOR_SPEED_SCALE, {1.0}); 78 _core._memory.WritePanelData<float>(0x00295, CURSOR_SPEED_SCALE, {1.0});
79 _core.WritePanelData<float>(0x0C373, CURSOR_SPEED_SCALE, {1.0}); 79 _core._memory.WritePanelData<float>(0x0C373, CURSOR_SPEED_SCALE, {1.0});
80 _core.WritePanelData<float>(0x00293, CURSOR_SPEED_SCALE, {1.0}); 80 _core._memory.WritePanelData<float>(0x00293, CURSOR_SPEED_SCALE, {1.0});
81 _core.WritePanelData<float>(0x002C2, CURSOR_SPEED_SCALE, {1.0}); 81 _core._memory.WritePanelData<float>(0x002C2, CURSOR_SPEED_SCALE, {1.0});
82} 82}
83 83
84void Randomizer::RandomizeSymmetry() { 84void Randomizer::RandomizeSymmetry() {
@@ -88,11 +88,11 @@ void Randomizer::RandomizeDesert() {
88 _core.Randomize(desertPanels, SWAP_LINES); 88 _core.Randomize(desertPanels, SWAP_LINES);
89 89
90 // Turn off desert surface 8 90 // Turn off desert surface 8
91 _core.WritePanelData<float>(0x09F94, POWER, {0.0, 0.0}); 91 _core._memory.WritePanelData<float>(0x09F94, POWER, {0.0, 0.0});
92 // Turn off desert flood final 92 // Turn off desert flood final
93 _core.WritePanelData<float>(0x18076, POWER, {0.0, 0.0}); 93 _core._memory.WritePanelData<float>(0x18076, POWER, {0.0, 0.0});
94 // Change desert floating target to desert flood final 94 // Change desert floating target to desert flood final
95 _core.WritePanelData<int>(0x17ECA, TARGET, {0x18077}); 95 _core._memory.WritePanelData<int>(0x17ECA, TARGET, {0x18077});
96} 96}
97 97
98void Randomizer::RandomizeQuarry() { 98void Randomizer::RandomizeQuarry() {
@@ -100,14 +100,14 @@ void Randomizer::RandomizeQuarry() {
100 100
101void Randomizer::RandomizeTreehouse() { 101void Randomizer::RandomizeTreehouse() {
102 // Ensure that whatever pivot panels we have are flagged as "pivotable" 102 // Ensure that whatever pivot panels we have are flagged as "pivotable"
103 int panelFlags = _core.ReadPanelData<int>(0x17DD1, STYLE_FLAGS, 1)[0]; 103 int panelFlags = _core._memory.ReadPanelData<int>(0x17DD1, STYLE_FLAGS, 1)[0];
104 _core.WritePanelData<int>(0x17DD1, STYLE_FLAGS, {panelFlags | 0x8000}); 104 _core._memory.WritePanelData<int>(0x17DD1, STYLE_FLAGS, {panelFlags | 0x8000});
105 panelFlags = _core.ReadPanelData<int>(0x17CE3, STYLE_FLAGS, 1)[0]; 105 panelFlags = _core._memory.ReadPanelData<int>(0x17CE3, STYLE_FLAGS, 1)[0];
106 _core.WritePanelData<int>(0x17CE3, STYLE_FLAGS, {panelFlags | 0x8000}); 106 _core._memory.WritePanelData<int>(0x17CE3, STYLE_FLAGS, {panelFlags | 0x8000});
107 panelFlags = _core.ReadPanelData<int>(0x17DB7, STYLE_FLAGS, 1)[0]; 107 panelFlags = _core._memory.ReadPanelData<int>(0x17DB7, STYLE_FLAGS, 1)[0];
108 _core.WritePanelData<int>(0x17DB7, STYLE_FLAGS, {panelFlags | 0x8000}); 108 _core._memory.WritePanelData<int>(0x17DB7, STYLE_FLAGS, {panelFlags | 0x8000});
109 panelFlags = _core.ReadPanelData<int>(0x17E52, STYLE_FLAGS, 1)[0]; 109 panelFlags = _core._memory.ReadPanelData<int>(0x17E52, STYLE_FLAGS, 1)[0];
110 _core.WritePanelData<int>(0x17E52, STYLE_FLAGS, {panelFlags | 0x8000}); 110 _core._memory.WritePanelData<int>(0x17E52, STYLE_FLAGS, {panelFlags | 0x8000});
111} 111}
112 112
113void Randomizer::RandomizeKeep() { 113void Randomizer::RandomizeKeep() {
@@ -115,11 +115,11 @@ void Randomizer::RandomizeKeep() {
115 115
116void Randomizer::RandomizeShadows() { 116void Randomizer::RandomizeShadows() {
117 // Distance-gate shadows laser to prevent sniping through the bars 117 // Distance-gate shadows laser to prevent sniping through the bars
118 _core.WritePanelData<float>(0x19650, MAX_BROADCAST_DISTANCE, {2.5}); 118 _core._memory.WritePanelData<float>(0x19650, MAX_BROADCAST_DISTANCE, {2.5});
119 // Change the shadows tutorial cable to only activate avoid 119 // Change the shadows tutorial cable to only activate avoid
120 _core.WritePanelData<int>(0x319A8, CABLE_TARGET_2, {0}); 120 _core._memory.WritePanelData<int>(0x319A8, CABLE_TARGET_2, {0});
121 // Change shadows avoid 8 to power shadows follow 121 // Change shadows avoid 8 to power shadows follow
122 _core.WritePanelData<int>(0x1972F, TARGET, {0x1C34C}); 122 _core._memory.WritePanelData<int>(0x1972F, TARGET, {0x1C34C});
123 123
124 std::vector<int> randomOrder(shadowsPanels.size(), 0); 124 std::vector<int> randomOrder(shadowsPanels.size(), 0);
125 std::iota(randomOrder.begin(), randomOrder.end(), 0); 125 std::iota(randomOrder.begin(), randomOrder.end(), 0);
@@ -128,9 +128,9 @@ void Randomizer::RandomizeShadows() {
128 _core.RandomizeRange(randomOrder, SWAP_NONE, 16, 21); // Follow 128 _core.RandomizeRange(randomOrder, SWAP_NONE, 16, 21); // Follow
129 _core.ReassignTargets(shadowsPanels, randomOrder); 129 _core.ReassignTargets(shadowsPanels, randomOrder);
130 // Turn off original starting panel 130 // Turn off original starting panel
131 _core.WritePanelData<float>(shadowsPanels[0], POWER, {0.0f, 0.0f}); 131 _core._memory.WritePanelData<float>(shadowsPanels[0], POWER, {0.0f, 0.0f});
132 // Turn on new starting panel 132 // Turn on new starting panel
133 _core.WritePanelData<float>(shadowsPanels[randomOrder[0]], POWER, {1.0f, 1.0f}); 133 _core._memory.WritePanelData<float>(shadowsPanels[randomOrder[0]], POWER, {1.0f, 1.0f});
134} 134}
135 135
136void Randomizer::RandomizeTown() { 136void Randomizer::RandomizeTown() {
@@ -167,7 +167,7 @@ void Randomizer::RandomizeJungle() {
167 167
168void Randomizer::RandomizeSwamp() { 168void Randomizer::RandomizeSwamp() {
169 // Distance-gate swamp snipe 1 to prevent RNG swamp snipe 169 // Distance-gate swamp snipe 1 to prevent RNG swamp snipe
170 _core.WritePanelData<float>(0x17C05, MAX_BROADCAST_DISTANCE, {15.0}); 170 _core._memory.WritePanelData<float>(0x17C05, MAX_BROADCAST_DISTANCE, {15.0});
171} 171}
172 172
173void Randomizer::RandomizeMountain() { 173void Randomizer::RandomizeMountain() {
@@ -178,7 +178,7 @@ void Randomizer::RandomizeMountain() {
178 // Randomize final pillars order 178 // Randomize final pillars order
179 std::vector<int> targets = {pillars[0] + 1}; 179 std::vector<int> targets = {pillars[0] + 1};
180 for (const int pillar : pillars) { 180 for (const int pillar : pillars) {
181 int target = _core.ReadPanelData<int>(pillar, TARGET, 1)[0]; 181 int target = _core._memory.ReadPanelData<int>(pillar, TARGET, 1)[0];
182 targets.push_back(target); 182 targets.push_back(target);
183 } 183 }
184 targets[5] = pillars[5] + 1; 184 targets[5] = pillars[5] + 1;
@@ -189,27 +189,27 @@ void Randomizer::RandomizeMountain() {
189 _core.RandomizeRange(randomOrder, SWAP_NONE, 5, 9); // Right Pillars 1-4 189 _core.RandomizeRange(randomOrder, SWAP_NONE, 5, 9); // Right Pillars 1-4
190 _core.ReassignTargets(pillars, randomOrder, targets); 190 _core.ReassignTargets(pillars, randomOrder, targets);
191 // Turn off original starting panels 191 // Turn off original starting panels
192 _core.WritePanelData<float>(pillars[0], POWER, {0.0f, 0.0f}); 192 _core._memory.WritePanelData<float>(pillars[0], POWER, {0.0f, 0.0f});
193 _core.WritePanelData<float>(pillars[5], POWER, {0.0f, 0.0f}); 193 _core._memory.WritePanelData<float>(pillars[5], POWER, {0.0f, 0.0f});
194 // Turn on new starting panels 194 // Turn on new starting panels
195 _core.WritePanelData<float>(pillars[randomOrder[0]], POWER, {1.0f, 1.0f}); 195 _core._memory.WritePanelData<float>(pillars[randomOrder[0]], POWER, {1.0f, 1.0f});
196 _core.WritePanelData<float>(pillars[randomOrder[5]], POWER, {1.0f, 1.0f}); 196 _core._memory.WritePanelData<float>(pillars[randomOrder[5]], POWER, {1.0f, 1.0f});
197 197
198 // Read the target of keep front laser, and write it to keep back laser. 198 // Read the target of keep front laser, and write it to keep back laser.
199 std::vector<int> keepFrontLaserTarget = _core.ReadPanelData<int>(0x0360E, TARGET, 1); 199 std::vector<int> keepFrontLaserTarget = _core._memory.ReadPanelData<int>(0x0360E, TARGET, 1);
200 _core.WritePanelData<int>(0x03317, TARGET, keepFrontLaserTarget); 200 _core._memory.WritePanelData<int>(0x03317, TARGET, keepFrontLaserTarget);
201} 201}
202 202
203void Randomizer::RandomizeChallenge() { 203void Randomizer::RandomizeChallenge() {
204 std::vector<int> randomOrder(challengePanels.size(), 0); 204 std::vector<int> randomOrder(challengePanels.size(), 0);
205 std::iota(randomOrder.begin(), randomOrder.end(), 0); 205 std::iota(randomOrder.begin(), randomOrder.end(), 0);
206 _core.RandomizeRange(randomOrder, SWAP_NONE, 1, 9); // Easy maze - Triple 2 206 _core.RandomizeRange(randomOrder, SWAP_NONE, 1, 9); // Easy maze - Triple 2
207 std::vector<int> triple1Target = _core.ReadPanelData<int>(0x00C80, TARGET, 1); 207 std::vector<int> triple1Target = _core._memory.ReadPanelData<int>(0x00C80, TARGET, 1);
208 _core.WritePanelData<int>(0x00CA1, TARGET, triple1Target); 208 _core._memory.WritePanelData<int>(0x00CA1, TARGET, triple1Target);
209 _core.WritePanelData<int>(0x00CB9, TARGET, triple1Target); 209 _core._memory.WritePanelData<int>(0x00CB9, TARGET, triple1Target);
210 std::vector<int> triple2Target = _core.ReadPanelData<int>(0x00C22, TARGET, 1); 210 std::vector<int> triple2Target = _core._memory.ReadPanelData<int>(0x00C22, TARGET, 1);
211 _core.WritePanelData<int>(0x00C59, TARGET, triple2Target); 211 _core._memory.WritePanelData<int>(0x00C59, TARGET, triple2Target);
212 _core.WritePanelData<int>(0x00C68, TARGET, triple2Target); 212 _core._memory.WritePanelData<int>(0x00C68, TARGET, triple2Target);
213 _core.ReassignTargets(challengePanels, randomOrder); 213 _core.ReassignTargets(challengePanels, randomOrder);
214} 214}
215 215