about summary refs log tree commit diff stats
path: root/Source/Randomizer.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-10-29 19:57:02 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-10-29 19:57:02 -0700
commit0d728e66b7bde350a6e5d9f0a467bba7a3433f16 (patch)
tree39856a87d48466aab7652f228f5729b43196abf7 /Source/Randomizer.cpp
parenta5d9a2eb991e387909281949c2b1f3395a7740ff (diff)
downloadwitness-tutorializer-0d728e66b7bde350a6e5d9f0a467bba7a3433f16.tar.gz
witness-tutorializer-0d728e66b7bde350a6e5d9f0a467bba7a3433f16.tar.bz2
witness-tutorializer-0d728e66b7bde350a6e5d9f0a467bba7a3433f16.zip
should be working
Diffstat (limited to 'Source/Randomizer.cpp')
-rw-r--r--Source/Randomizer.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/Randomizer.cpp b/Source/Randomizer.cpp index 4541512..406468c 100644 --- a/Source/Randomizer.cpp +++ b/Source/Randomizer.cpp
@@ -5,9 +5,8 @@
5 * Tutorial sounds don't always play 5 * Tutorial sounds don't always play
6 * FEATURES: 6 * FEATURES:
7 * Speed up some of the slow things (like swamp) 7 * Speed up some of the slow things (like swamp)
8 * Determine if the user has entered the seed, and re-randomize it if not
9 * Prevent re-randomization (?) 8 * Prevent re-randomization (?)
10 * Clear "Randomized" state on NG (?) 9 * Clear "Randomized" state on NG (?) -- Or on a short delay
11 * Randomize audio logs -- Hard, seem to be unloaded some times? 10 * Randomize audio logs -- Hard, seem to be unloaded some times?
12 * Swap sounds in jungle (along with panels) -- maybe impossible 11 * Swap sounds in jungle (along with panels) -- maybe impossible
13 * Make orange 7 (all of oranges?) hard. Like big = hard. 12 * Make orange 7 (all of oranges?) hard. Like big = hard.
@@ -60,6 +59,10 @@ void Randomizer::Randomize()
60 // RandomizeAudioLogs(); 59 // RandomizeAudioLogs();
61} 60}
62 61
62void Randomizer::AdjustSpeed() {
63
64}
65
63void Randomizer::RandomizeTutorial() { 66void Randomizer::RandomizeTutorial() {
64 // Disable tutorial cursor speed modifications (not working?) 67 // Disable tutorial cursor speed modifications (not working?)
65 _core.WritePanelData<float>(0x00295, CURSOR_SPEED_SCALE, {1.0}); 68 _core.WritePanelData<float>(0x00295, CURSOR_SPEED_SCALE, {1.0});
@@ -158,10 +161,30 @@ void Randomizer::RandomizeSwamp() {
158} 161}
159 162
160void Randomizer::RandomizeMountain() { 163void Randomizer::RandomizeMountain() {
164 // Randomize lasers & some of mountain
161 _core.Randomize(lasers, SWAP_TARGETS); 165 _core.Randomize(lasers, SWAP_TARGETS);
162 _core.Randomize(pillars, SWAP_LINES | SWAP_BACK_DISTANCE);
163 _core.Randomize(mountainMultipanel, SWAP_LINES); 166 _core.Randomize(mountainMultipanel, SWAP_LINES);
164 167
168 // Randomize final pillars order
169 std::vector<int> targets = {pillars[0] + 1};
170 for (const int pillar : pillars) {
171 int target = _core.ReadPanelData<int>(pillar, TARGET, 1)[0];
172 targets.push_back(target);
173 }
174 targets[5] = pillars[5] + 1;
175
176 std::vector<int> randomOrder(pillars.size(), 0);
177 std::iota(randomOrder.begin(), randomOrder.end(), 0);
178 _core.RandomizeRange(randomOrder, SWAP_NONE, 0, 4); // Left Pillars 1-4
179 _core.RandomizeRange(randomOrder, SWAP_NONE, 5, 9); // Right Pillars 1-4
180 _core.ReassignTargets(pillars, randomOrder, targets);
181 // Turn off original starting panels
182 _core.WritePanelData<float>(pillars[0], POWER, {0.0f, 0.0f});
183 _core.WritePanelData<float>(pillars[5], POWER, {0.0f, 0.0f});
184 // Turn on new starting panels
185 _core.WritePanelData<float>(pillars[randomOrder[0]], POWER, {1.0f, 1.0f});
186 _core.WritePanelData<float>(pillars[randomOrder[5]], POWER, {1.0f, 1.0f});
187
165 // Read the target of keep front laser, and write it to keep back laser. 188 // Read the target of keep front laser, and write it to keep back laser.
166 std::vector<int> keepFrontLaserTarget = _core.ReadPanelData<int>(0x0360E, TARGET, 1); 189 std::vector<int> keepFrontLaserTarget = _core.ReadPanelData<int>(0x0360E, TARGET, 1);
167 _core.WritePanelData<int>(0x03317, TARGET, keepFrontLaserTarget); 190 _core.WritePanelData<int>(0x03317, TARGET, keepFrontLaserTarget);