about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--WitnessRandomizer/Panels.h15
-rw-r--r--WitnessRandomizer/WitnessRandomizer.cpp26
-rw-r--r--WitnessRandomizer/WitnessRandomizer.h2
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<int> lasers = {
9 0x17CA4, // Monastery 9 0x17CA4, // Monastery
10 0x032F5, // Town 10 0x032F5, // Town
11 0x03613, // Treehouse 11 0x03613, // Treehouse
12 0x0360E, // Keep Front Laser
13// 0x03317, // Keep Back Laser
12// 0x03608, // Desert 14// 0x03608, // Desert
13 0x03612, // Quarry 15 0x03612, // Quarry
14 0x03616, // Jungle 16 0x03616, // Jungle
@@ -34,7 +36,6 @@ std::vector<int> burnablePanels = {
34 0x28ACB, // Town Blue 4 36 0x28ACB, // Town Blue 4
35 0x28ACC, // Town Blue 5 37 0x28ACC, // Town Blue 5
36 0x17CF0, // Mill Discard 38 0x17CF0, // Mill Discard
37 0x17C31, // Desert Final Transparent
38 39
39 0x00698, // Desert Surface 1 40 0x00698, // Desert Surface 1
40 0x0048F, // Desert Surface 2 41 0x0048F, // Desert Surface 2
@@ -100,10 +101,10 @@ std::vector<int> upDownPanels = {
100 101
101// Note: Some of these (non-controls) are duplicated elsewhere 102// Note: Some of these (non-controls) are duplicated elsewhere
102std::vector<int> leftForwardRightPanels = { 103std::vector<int> leftForwardRightPanels = {
103// 0x00075, // Symmetry Island Colored Dots 3 104 0x00075, // Symmetry Island Colored Dots 3
104// 0x288EA, // UTM Perspective 1 105 0x288EA, // UTM Perspective 1
105// 0x288FC, // UTM Perspective 2 106 0x288FC, // UTM Perspective 2
106// 0x289E7, // UTM Perspective 3 107 0x289E7, // UTM Perspective 3
107 108
108 0x17DD1, // Treehouse Left Orange 9 109 0x17DD1, // Treehouse Left Orange 9
109 0x17CE3, // Treehouse Right Orange 4 110 0x17CE3, // Treehouse Right Orange 4
@@ -198,7 +199,6 @@ std::vector<int> squarePanels = {
198 0x00A68, // Symmetry Island Laser Blue 3 199 0x00A68, // Symmetry Island Laser Blue 3
199 0x17CE7, // Desert Discard 200 0x17CE7, // Desert Discard
200 0x0CC7B, // Desert Vault 201 0x0CC7B, // Desert Vault
201 0x17C31, // Desert Final Transparent
202 0x01E5A, // Mill Entry Door Left 202 0x01E5A, // Mill Entry Door Left
203 0x01E59, // Mill Entry Door Right 203 0x01E59, // Mill Entry Door Right
204 0x00E0C, // Mill Lower Row 1 204 0x00E0C, // Mill Lower Row 1
@@ -306,7 +306,6 @@ std::vector<int> squarePanels = {
306 0x17D27, // Keep Discard 306 0x17D27, // Keep Discard
307 0x17D28, // Shipwreck Discard 307 0x17D28, // Shipwreck Discard
308 0x00AFB, // Shipwreck Vault 308 0x00AFB, // Shipwreck Vault
309 0x19650, // Shadows Laser
310 0x2899C, // Town 25 Dots 1 309 0x2899C, // Town 25 Dots 1
311 0x28A33, // Town 25 Dots 2 310 0x28A33, // Town 25 Dots 2
312 0x28ABF, // Town 25 Dots 3 311 0x28ABF, // Town 25 Dots 3
@@ -673,4 +672,6 @@ std::vector<int> nothingPanels = {
673// 0x15ADD, // Jungle Vault 672// 0x15ADD, // Jungle Vault
674// 0x17CAA, // Jungle Courtyard Gate 673// 0x17CAA, // Jungle Courtyard Gate
675 0x0005C, // Glass Factory Vertical Symmetry 5 674 0x0005C, // Glass Factory Vertical Symmetry 5
675 0x17C31, // Desert Final Transparent
676 0x19650, // Shadows Laser
676}; 677};
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 @@
1/* 1/*
2 * BUGS:
3 * 3-way in treehouse not working :(
4 * Mountain orange is copying movement data :(
5 * Treehouse panels are not copying color?
6 * FEATURES: 2 * FEATURES:
7 * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) 3 * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?)
8 ** Think about: Jungle 4 ** Think about: Jungle
@@ -11,8 +7,6 @@
11 * Randomize audio logs 7 * Randomize audio logs
12 * Swap sounds in jungle (along with panels) -- maybe impossible 8 * Swap sounds in jungle (along with panels) -- maybe impossible
13 * Make orange 7 (all of oranges?) hard. Like big = hard. 9 * Make orange 7 (all of oranges?) hard. Like big = hard.
14 * Kill panel slowdown in tutorial
15 * Fix desert elevator (laser rando) / Add keep?
16*/ 10*/
17#include "Memory.h" 11#include "Memory.h"
18#include "WitnessRandomizer.h" 12#include "WitnessRandomizer.h"
@@ -44,16 +38,17 @@ int main(int argc, char** argv)
44 38
45 // Content swaps -- must happen before squarePanels 39 // Content swaps -- must happen before squarePanels
46 randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE); 40 randomizer.Randomize(upDownPanels, SWAP_LINES | SWAP_STYLE);
47 randomizer.Randomize(leftForwardRightPanels, SWAP_LINES | SWAP_STYLE); 41 randomizer.Randomize(leftForwardRightPanels, SWAP_LINES);
48 42
49 randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE); 43 randomizer.Randomize(squarePanels, SWAP_LINES | SWAP_STYLE);
50 44
51 // Frame swaps -- must happen after squarePanels 45 // Frame swaps -- must happen after squarePanels
52 randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE); 46 randomizer.Randomize(burnablePanels, SWAP_LINES | SWAP_STYLE);
53 47
54
55 // Target swaps, can happen whenever 48 // Target swaps, can happen whenever
56 randomizer.Randomize(lasers, SWAP_TARGETS); 49 randomizer.Randomize(lasers, SWAP_TARGETS);
50 // Read the target of keep front laser, and write it to keep back laser.
51 randomizer.Overwrite(0x0360E, 0x03317, 0x2BC, sizeof(int));
57 52
58 std::vector<int> randomOrder = std::vector(junglePanels.size(), 0); 53 std::vector<int> randomOrder = std::vector(junglePanels.size(), 0);
59 std::iota(randomOrder.begin(), randomOrder.end(), 0); 54 std::iota(randomOrder.begin(), randomOrder.end(), 0);
@@ -138,7 +133,7 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) {
138 } 133 }
139 if (flags & SWAP_LINES) { 134 if (flags & SWAP_LINES) {
140 offsets[0x230] = 16; // traced_edges 135 offsets[0x230] = 16; // traced_edges
141 offsets[0x220] = sizeof(void*); // *pattern_name 136// offsets[0x220] = sizeof(void*); // *pattern_name
142// offsets[0x240] = sizeof(void*); // *mesh_name 137// offsets[0x240] = sizeof(void*); // *mesh_name
143 offsets[0x2FC] = sizeof(int); // is_cylinder 138 offsets[0x2FC] = sizeof(int); // is_cylinder
144 offsets[0x300] = sizeof(float); // cylinder_z0 139 offsets[0x300] = sizeof(float); // cylinder_z0
@@ -164,7 +159,6 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) {
164 offsets[0x440] = sizeof(void*); // *reflection_data 159 offsets[0x440] = sizeof(void*); // *reflection_data
165 offsets[0x448] = sizeof(int); // grid_size_x 160 offsets[0x448] = sizeof(int); // grid_size_x
166 offsets[0x44C] = sizeof(int); // grid_size_y 161 offsets[0x44C] = sizeof(int); // grid_size_y
167 offsets[0x450] = sizeof(int); // style_flags // This is required to not ignore dots
168 offsets[0x45C] = sizeof(int); // sequence_len 162 offsets[0x45C] = sizeof(int); // sequence_len
169 offsets[0x460] = sizeof(void*); // *sequence 163 offsets[0x460] = sizeof(void*); // *sequence
170 offsets[0x468] = sizeof(int); // dot_sequence_len 164 offsets[0x468] = sizeof(int); // dot_sequence_len
@@ -173,8 +167,6 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) {
173 offsets[0x480] = sizeof(void*); // *dot_sequence_reflection 167 offsets[0x480] = sizeof(void*); // *dot_sequence_reflection
174 offsets[0x4B0] = sizeof(void*); // *panel_target 168 offsets[0x4B0] = sizeof(void*); // *panel_target
175 offsets[0x4D8] = sizeof(void*); // *specular_texture 169 offsets[0x4D8] = sizeof(void*); // *specular_texture
176 }
177 if (flags & SWAP_STYLE) {
178 offsets[0xC8] = 16; // path_color 170 offsets[0xC8] = 16; // path_color
179 offsets[0xD8] = 16; // reflection_path_color 171 offsets[0xD8] = 16; // reflection_path_color
180// offsets[0xE8] = 16; // deprecated_finished_path_color 172// offsets[0xE8] = 16; // deprecated_finished_path_color
@@ -204,9 +196,14 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) {
204 offsets[0x4A8] = sizeof(void*); // *colored_regions 196 offsets[0x4A8] = sizeof(void*); // *colored_regions
205// offsets[0x4B8] = sizeof(void*); // *backing_texture 197// offsets[0x4B8] = sizeof(void*); // *backing_texture
206 } 198 }
199 if (flags & SWAP_STYLE) {
200 offsets[0x450] = sizeof(int); // style_flags
201 }
202 /*
207 if (flags & SWAP_BACK_DISTANCE) { 203 if (flags & SWAP_BACK_DISTANCE) {
208 offsets[0x22C] = sizeof(float); // extra_back_distance 204 offsets[0x22C] = sizeof(float); // extra_back_distance
209 } 205 }
206 */
210 207
211 for (auto const& [offset, size] : offsets) { 208 for (auto const& [offset, size] : offsets) {
212 SwapPanelData(panel1, panel2, offset, size); 209 SwapPanelData(panel1, panel2, offset, size);
@@ -262,3 +259,8 @@ void WitnessRandomizer::TurnOn(int panel) {
262void WitnessRandomizer::TurnOff(int panel) { 259void WitnessRandomizer::TurnOff(int panel) {
263 _memory.WriteData<float>({0x5B28C0, 0x18, panel*8, 0x2A8}, {0.0f, 0.0f}); 260 _memory.WriteData<float>({0x5B28C0, 0x18, panel*8, 0x2A8}, {0.0f, 0.0f});
264} 261}
262
263void WitnessRandomizer::Overwrite(int panel1, int panel2, int offset, int size) {
264 std::vector<byte> data = _memory.ReadData<int>({0x5B28C0, 0x18, panel1*8, offset}, size);
265 _memory.WriteData<byte>({0x5B28C0, 0x18, panel2*8, offset}, data);
266} \ 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:
15 void RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex); 15 void RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex);
16 void SwapPanels(int panel1, int panel2, int flags); 16 void SwapPanels(int panel1, int panel2, int flags);
17 void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order); 17 void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order);
18 18 void Overwrite(int panel1, int panel2, int offset, int size);
19 19
20//private: 20//private:
21 void TurnOn(int panel); 21 void TurnOn(int panel);