From ba21783815980c695128225ff4a7145e7ed2b192 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Fri, 26 Oct 2018 19:16:51 -0700 Subject: Features are done, as much as I care to right now --- WitnessRandomizer/Panels.h | 15 ++++++++------- WitnessRandomizer/WitnessRandomizer.cpp | 26 ++++++++++++++------------ WitnessRandomizer/WitnessRandomizer.h | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/WitnessRandomizer/Panels.h b/WitnessRandomizer/Panels.h index 3120357..9589ace 100644 --- a/WitnessRandomizer/Panels.h +++ b/WitnessRandomizer/Panels.h @@ -9,6 +9,8 @@ std::vector lasers = { 0x17CA4, // Monastery 0x032F5, // Town 0x03613, // Treehouse + 0x0360E, // Keep Front Laser +// 0x03317, // Keep Back Laser // 0x03608, // Desert 0x03612, // Quarry 0x03616, // Jungle @@ -34,7 +36,6 @@ std::vector burnablePanels = { 0x28ACB, // Town Blue 4 0x28ACC, // Town Blue 5 0x17CF0, // Mill Discard - 0x17C31, // Desert Final Transparent 0x00698, // Desert Surface 1 0x0048F, // Desert Surface 2 @@ -100,10 +101,10 @@ std::vector upDownPanels = { // Note: Some of these (non-controls) are duplicated elsewhere std::vector leftForwardRightPanels = { -// 0x00075, // Symmetry Island Colored Dots 3 -// 0x288EA, // UTM Perspective 1 -// 0x288FC, // UTM Perspective 2 -// 0x289E7, // UTM Perspective 3 + 0x00075, // Symmetry Island Colored Dots 3 + 0x288EA, // UTM Perspective 1 + 0x288FC, // UTM Perspective 2 + 0x289E7, // UTM Perspective 3 0x17DD1, // Treehouse Left Orange 9 0x17CE3, // Treehouse Right Orange 4 @@ -198,7 +199,6 @@ std::vector squarePanels = { 0x00A68, // Symmetry Island Laser Blue 3 0x17CE7, // Desert Discard 0x0CC7B, // Desert Vault - 0x17C31, // Desert Final Transparent 0x01E5A, // Mill Entry Door Left 0x01E59, // Mill Entry Door Right 0x00E0C, // Mill Lower Row 1 @@ -306,7 +306,6 @@ std::vector squarePanels = { 0x17D27, // Keep Discard 0x17D28, // Shipwreck Discard 0x00AFB, // Shipwreck Vault - 0x19650, // Shadows Laser 0x2899C, // Town 25 Dots 1 0x28A33, // Town 25 Dots 2 0x28ABF, // Town 25 Dots 3 @@ -673,4 +672,6 @@ std::vector nothingPanels = { // 0x15ADD, // Jungle Vault // 0x17CAA, // Jungle Courtyard Gate 0x0005C, // Glass Factory Vertical Symmetry 5 + 0x17C31, // Desert Final Transparent + 0x19650, // Shadows Laser }; diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp index 70e4fb2..47f9daa 100644 --- a/WitnessRandomizer/WitnessRandomizer.cpp +++ b/WitnessRandomizer/WitnessRandomizer.cpp @@ -1,8 +1,4 @@ /* - * BUGS: - * 3-way in treehouse not working :( - * Mountain orange is copying movement data :( - * Treehouse panels are not copying color? * FEATURES: * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) ** Think about: Jungle @@ -11,8 +7,6 @@ * Randomize audio logs * Swap sounds in jungle (along with panels) -- maybe impossible * Make orange 7 (all of oranges?) hard. Like big = hard. - * Kill panel slowdown in tutorial - * Fix desert elevator (laser rando) / Add keep? */ #include "Memory.h" #include "WitnessRandomizer.h" @@ -44,16 +38,17 @@ int main(int argc, char** argv) // Content swaps -- must happen before squarePanels randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE); - randomizer.Randomize(leftForwardRightPanels, SWAP_LINES | SWAP_STYLE); + randomizer.Randomize(leftForwardRightPanels, SWAP_LINES); randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE); // Frame swaps -- must happen after squarePanels randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE); - // Target swaps, can happen whenever randomizer.Randomize(lasers, SWAP_TARGETS); + // Read the target of keep front laser, and write it to keep back laser. + randomizer.Overwrite(0x0360E, 0x03317, 0x2BC, sizeof(int)); std::vector randomOrder = std::vector(junglePanels.size(), 0); std::iota(randomOrder.begin(), randomOrder.end(), 0); @@ -138,7 +133,7 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { } if (flags & SWAP_LINES) { offsets[0x230] = 16; // traced_edges - offsets[0x220] = sizeof(void*); // *pattern_name +// offsets[0x220] = sizeof(void*); // *pattern_name // offsets[0x240] = sizeof(void*); // *mesh_name offsets[0x2FC] = sizeof(int); // is_cylinder offsets[0x300] = sizeof(float); // cylinder_z0 @@ -164,7 +159,6 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { offsets[0x440] = sizeof(void*); // *reflection_data offsets[0x448] = sizeof(int); // grid_size_x offsets[0x44C] = sizeof(int); // grid_size_y - offsets[0x450] = sizeof(int); // style_flags // This is required to not ignore dots offsets[0x45C] = sizeof(int); // sequence_len offsets[0x460] = sizeof(void*); // *sequence offsets[0x468] = sizeof(int); // dot_sequence_len @@ -173,8 +167,6 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { offsets[0x480] = sizeof(void*); // *dot_sequence_reflection offsets[0x4B0] = sizeof(void*); // *panel_target offsets[0x4D8] = sizeof(void*); // *specular_texture - } - if (flags & SWAP_STYLE) { offsets[0xC8] = 16; // path_color offsets[0xD8] = 16; // reflection_path_color // offsets[0xE8] = 16; // deprecated_finished_path_color @@ -204,9 +196,14 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { offsets[0x4A8] = sizeof(void*); // *colored_regions // offsets[0x4B8] = sizeof(void*); // *backing_texture } + if (flags & SWAP_STYLE) { + offsets[0x450] = sizeof(int); // style_flags + } + /* if (flags & SWAP_BACK_DISTANCE) { offsets[0x22C] = sizeof(float); // extra_back_distance } + */ for (auto const& [offset, size] : offsets) { SwapPanelData(panel1, panel2, offset, size); @@ -262,3 +259,8 @@ void WitnessRandomizer::TurnOn(int panel) { void WitnessRandomizer::TurnOff(int panel) { _memory.WriteData({0x5B28C0, 0x18, panel*8, 0x2A8}, {0.0f, 0.0f}); } + +void WitnessRandomizer::Overwrite(int panel1, int panel2, int offset, int size) { + std::vector data = _memory.ReadData({0x5B28C0, 0x18, panel1*8, offset}, size); + _memory.WriteData({0x5B28C0, 0x18, panel2*8, offset}, data); +} \ No newline at end of file diff --git a/WitnessRandomizer/WitnessRandomizer.h b/WitnessRandomizer/WitnessRandomizer.h index f9a66c4..527fe13 100644 --- a/WitnessRandomizer/WitnessRandomizer.h +++ b/WitnessRandomizer/WitnessRandomizer.h @@ -15,7 +15,7 @@ public: void RandomizeRange(std::vector &panels, int flags, size_t startIndex, size_t endIndex); void SwapPanels(int panel1, int panel2, int flags); void ReassignTargets(const std::vector& panels, const std::vector& order); - + void Overwrite(int panel1, int panel2, int offset, int size); //private: void TurnOn(int panel); -- cgit 1.4.1