summary refs log tree commit diff stats
path: root/Source/Randomizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Randomizer.cpp')
-rw-r--r--Source/Randomizer.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/Source/Randomizer.cpp b/Source/Randomizer.cpp index 1f2c0cc..2f3e72a 100644 --- a/Source/Randomizer.cpp +++ b/Source/Randomizer.cpp
@@ -13,7 +13,6 @@
13 * Swap sounds in jungle (along with panels) -- maybe impossible 13 * Swap sounds in jungle (along with panels) -- maybe impossible
14 * Make orange 7 (all of oranges?) hard. Like big = hard. (See: HARD_MODE) 14 * Make orange 7 (all of oranges?) hard. Like big = hard. (See: HARD_MODE)
15 * Add a setting for "disable wonkavator and hotel", so that 100% runs are possible 15 * Add a setting for "disable wonkavator and hotel", so that 100% runs are possible
16 * Try to stabilize challenge/doors RNG
17 * I probably can randomize targets in bunker UV 16 * I probably can randomize targets in bunker UV
18 * Random *rotation* of desert laser redirect? 17 * Random *rotation* of desert laser redirect?
19 * Add setting to disable laser randomization 18 * Add setting to disable laser randomization
@@ -23,6 +22,7 @@
23*/ 22*/
24#include "Memory.h" 23#include "Memory.h"
25#include "Randomizer.h" 24#include "Randomizer.h"
25#include "ChallengeRandomizer.h"
26#include "Panels.h" 26#include "Panels.h"
27#include "Random.h" 27#include "Random.h"
28#include <string> 28#include <string>
@@ -54,6 +54,9 @@ void Randomizer::Randomize()
54 if (GameIsRandomized()) return; // Nice sanity check, but should be unnecessary (since Main checks anyways) 54 if (GameIsRandomized()) return; // Nice sanity check, but should be unnecessary (since Main checks anyways)
55 _lastRandomizedFrame = _memory->GetCurrentFrame(); 55 _lastRandomizedFrame = _memory->GetCurrentFrame();
56 56
57 // Seed challenge first for future-proofing (?)
58 RandomizeChallenge();
59
57 // Content swaps -- must happen before squarePanels 60 // Content swaps -- must happen before squarePanels
58 Randomize(upDownPanels, SWAP::LINES); 61 Randomize(upDownPanels, SWAP::LINES);
59 Randomize(leftForwardRightPanels, SWAP::LINES); 62 Randomize(leftForwardRightPanels, SWAP::LINES);
@@ -74,7 +77,6 @@ void Randomizer::Randomize()
74 RandomizeJungle(); 77 RandomizeJungle();
75 RandomizeSwamp(); 78 RandomizeSwamp();
76 RandomizeMountain(); 79 RandomizeMountain();
77 // RandomizeChallenge();
78 // RandomizeAudioLogs(); 80 // RandomizeAudioLogs();
79} 81}
80 82
@@ -215,16 +217,7 @@ void Randomizer::RandomizeMountain() {
215} 217}
216 218
217void Randomizer::RandomizeChallenge() { 219void Randomizer::RandomizeChallenge() {
218 std::vector<int> randomOrder(challengePanels.size(), 0); 220 ChallengeRandomizer cr(_memory, Random::RandInt(1, 0x1000));
219 std::iota(randomOrder.begin(), randomOrder.end(), 0);
220 RandomizeRange(randomOrder, SWAP::NONE, 1, 9); // Easy maze - Triple 2
221 std::vector<int> triple1Target = _memory->ReadPanelData<int>(0x00C80, TARGET, 1);
222 _memory->WritePanelData<int>(0x00CA1, TARGET, triple1Target);
223 _memory->WritePanelData<int>(0x00CB9, TARGET, triple1Target);
224 std::vector<int> triple2Target = _memory->ReadPanelData<int>(0x00C22, TARGET, 1);
225 _memory->WritePanelData<int>(0x00C59, TARGET, triple2Target);
226 _memory->WritePanelData<int>(0x00C68, TARGET, triple2Target);
227 ReassignTargets(challengePanels, randomOrder);
228} 221}
229 222
230void Randomizer::RandomizeAudioLogs() { 223void Randomizer::RandomizeAudioLogs() {