diff options
Diffstat (limited to 'Source/Randomizer.cpp')
| -rw-r--r-- | Source/Randomizer.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
| diff --git a/Source/Randomizer.cpp b/Source/Randomizer.cpp index ce784be..a21b928 100644 --- a/Source/Randomizer.cpp +++ b/Source/Randomizer.cpp | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | * FEATURES: | 5 | * FEATURES: |
| 6 | * Start the game if it isn't running? | 6 | * Start the game if it isn't running? |
| 7 | * Stop swapping colors in desert | 7 | * Stop swapping colors in desert |
| 8 | * Look into valid panel swaps for keep walk-ons. | ||
| 9 | * Randomize audio logs -- Hard, seem to be unloaded some times? | 8 | * Randomize audio logs -- Hard, seem to be unloaded some times? |
| 10 | * Swap sounds in jungle (along with panels) -- maybe impossible | 9 | * Swap sounds in jungle (along with panels) -- maybe impossible |
| 11 | * Make orange 7 (all of oranges?) hard. Like big = hard. (See: HARD_MODE) | 10 | * Make orange 7 (all of oranges?) hard. Like big = hard. (See: HARD_MODE) |
| @@ -24,11 +23,11 @@ int find(const std::vector<T> &data, T search, size_t startIndex = 0) { | |||
| 24 | if (data[i] == search) return static_cast<int>(i); | 23 | if (data[i] == search) return static_cast<int>(i); |
| 25 | } | 24 | } |
| 26 | std::cout << "Couldn't find " << search << " in data!" << std::endl; | 25 | std::cout << "Couldn't find " << search << " in data!" << std::endl; |
| 27 | exit(-1); | 26 | throw std::exception("Couldn't find value in data!"); |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | bool Randomizer::GameIsRandomized() { | 29 | bool Randomizer::GameIsRandomized() { |
| 31 | int currentFrame = GetCurrentFrame(); | 30 | int currentFrame = _memory->GetCurrentFrame(); |
| 32 | if (currentFrame >= _lastRandomizedFrame) { | 31 | if (currentFrame >= _lastRandomizedFrame) { |
| 33 | // Time went forwards, presumably we're still on the same save | 32 | // Time went forwards, presumably we're still on the same save |
| 34 | _lastRandomizedFrame = currentFrame; | 33 | _lastRandomizedFrame = currentFrame; |
| @@ -41,7 +40,7 @@ bool Randomizer::GameIsRandomized() { | |||
| 41 | void Randomizer::Randomize() | 40 | void Randomizer::Randomize() |
| 42 | { | 41 | { |
| 43 | if (GameIsRandomized()) return; // Nice sanity check, but should be unnecessary (since Main checks anyways) | 42 | if (GameIsRandomized()) return; // Nice sanity check, but should be unnecessary (since Main checks anyways) |
| 44 | _lastRandomizedFrame = GetCurrentFrame(); | 43 | _lastRandomizedFrame = _memory->GetCurrentFrame(); |
| 45 | 44 | ||
| 46 | // Content swaps -- must happen before squarePanels | 45 | // Content swaps -- must happen before squarePanels |
| 47 | Randomize(upDownPanels, SWAP::LINES); | 46 | Randomize(upDownPanels, SWAP::LINES); |
| @@ -345,15 +344,3 @@ void Randomizer::ReassignNames(const std::vector<int>& panels, const std::vector | |||
| 345 | _memory->WritePanelData<int64_t>(panels[i], AUDIO_LOG_NAME, {names[order[i]]}); | 344 | _memory->WritePanelData<int64_t>(panels[i], AUDIO_LOG_NAME, {names[order[i]]}); |
| 346 | } | 345 | } |
| 347 | } | 346 | } |
| 348 | |||
| 349 | short Randomizer::ReadMetadata() { | ||
| 350 | return _memory->ReadData<short>({GLOBALS + METADATA}, 1)[0]; | ||
| 351 | } | ||
| 352 | |||
| 353 | void Randomizer::WriteMetadata(short metadata) { | ||
| 354 | return _memory->WriteData<short>({GLOBALS + METADATA}, {metadata}); | ||
| 355 | } | ||
| 356 | |||
| 357 | int Randomizer::GetCurrentFrame() { | ||
| 358 | return _memory->ReadData<int>({SCRIPT_FRAMES}, 1)[0]; | ||
| 359 | } | ||
