diff options
author | jbzdarkid <jbzdarkid@gmail.com> | 2018-10-24 20:20:12 -0700 |
---|---|---|
committer | jbzdarkid <jbzdarkid@gmail.com> | 2018-10-24 20:20:12 -0700 |
commit | 69a8f903ef70845894ff07e0805d9cc60597cc7c (patch) | |
tree | b3a91870eea300b95732ce22c6ac8c1e94307bc9 /WitnessRandomizer/WitnessRandomizer.cpp | |
parent | 4f9229dfe609632a193ce515f8fa83b494948e48 (diff) | |
download | witness-tutorializer-69a8f903ef70845894ff07e0805d9cc60597cc7c.tar.gz witness-tutorializer-69a8f903ef70845894ff07e0805d9cc60597cc7c.tar.bz2 witness-tutorializer-69a8f903ef70845894ff07e0805d9cc60597cc7c.zip |
progress of various sorts
Diffstat (limited to 'WitnessRandomizer/WitnessRandomizer.cpp')
-rw-r--r-- | WitnessRandomizer/WitnessRandomizer.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp index 8a966d4..79fb721 100644 --- a/WitnessRandomizer/WitnessRandomizer.cpp +++ b/WitnessRandomizer/WitnessRandomizer.cpp | |||
@@ -2,11 +2,9 @@ | |||
2 | * BUGS: | 2 | * BUGS: |
3 | * Bunker has physical panel objects which I can't move :( | 3 | * Bunker has physical panel objects which I can't move :( |
4 | * Shipwreck vault does not copy well | 4 | * Shipwreck vault does not copy well |
5 | * Pillars can be swapped but they don't zoom you out enough. Maybe SWAP_DISTANCE? | ||
6 | * FEATURES: | 5 | * FEATURES: |
7 | * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) | 6 | * SWAP_TARGETS should still require the full panel sequence (and have ways to prevent softlocks?) |
8 | * Randomize audio logs | 7 | * Randomize audio logs |
9 | * Separate panels out by "square", which can probably be anywhere | ||
10 | * List of panels which can be valid "Burn" (aka desert) substitutes: Prevent (or limit) panel counting | 8 | * List of panels which can be valid "Burn" (aka desert) substitutes: Prevent (or limit) panel counting |
11 | * List of panels which split left/right (for left/right controls) | 9 | * List of panels which split left/right (for left/right controls) |
12 | * List of panels which split up/down (for up/down controls) | 10 | * List of panels which split up/down (for up/down controls) |
@@ -62,17 +60,39 @@ int main(int argc, char** argv) | |||
62 | int PILLAR_L_1 = 0x383D; | 60 | int PILLAR_L_1 = 0x383D; |
63 | int PILLAR_L_4 = 0x339BB; | 61 | int PILLAR_L_4 = 0x339BB; |
64 | int PILLAR_C = 0x9DD5; | 62 | int PILLAR_C = 0x9DD5; |
63 | int PILLAR_C_L = 0x1C31A; | ||
64 | int DESERT_1 = 0x00698; | ||
65 | int DESERT_L_2 = 0x006E3; | ||
66 | int TOWN_S_1 = 0x28AC7; | ||
65 | 67 | ||
66 | randomizer.SwapPanels(PILLAR_L_1, PILLAR_C, SWAP_LINES | SWAP_STYLE | SWAP_BACK_DISTANCE); | 68 | std::vector<int> squarePanels; |
69 | for (auto panelSet : {outsideTutorialPanels, symmetryPanels, quarryPanels, keepPanels, townPanels, bunkerPanels, swampPanels, mountainPanels, utmPanels, treehousePanels}) { | ||
70 | squarePanels.insert(squarePanels.end(), panelSet.begin(), panelSet.end()); | ||
71 | } | ||
72 | for (int panel : squarePanels) { | ||
73 | randomizer.SwapPanels(DESERT_L_2, panel, SWAP_LINES | SWAP_STYLE); | ||
74 | } | ||
75 | |||
76 | |||
77 | //randomizer.SwapPanels(PILLAR_L_1, PILLAR_C_L, SWAP_LINES | SWAP_STYLE | SWAP_BACK_DISTANCE); | ||
78 | //randomizer.SwapPanelData(PILLAR_L_1, PILLAR_C_L, 0x200, 0x50); | ||
79 | // Turn on the panel | ||
80 | //randomizer._memory.WriteData<float>({0x5B28C0, 0x18, PILLAR_L_1*8, 0x2A8}, {1.0f, 1.0f}); | ||
81 | |||
82 | // randomizer.SwapPanels(PILLAR_L_1, PILLAR_C_L, SWAP_LINES | SWAP_STYLE | SWAP_BACK_DISTANCE); | ||
67 | //*/ | 83 | //*/ |
68 | } | 84 | } |
69 | 85 | ||
70 | WitnessRandomizer::WitnessRandomizer() : _memory(Memory("witness64_d3d11.exe")) | 86 | WitnessRandomizer::WitnessRandomizer() : _memory("witness64_d3d11.exe") |
71 | { | 87 | { |
72 | // Turn off desert flood final | 88 | // Turn off desert flood final |
73 | _memory.WriteData<float>({0x5B28C0, 0x18, 0x18076*8, 0x2A8}, {0.0f, 0.0f}); | 89 | _memory.WriteData<float>({0x5B28C0, 0x18, 0x18076*8, 0x2A8}, {0.0f, 0.0f}); |
74 | // Change desert floating target to desert flood final | 90 | // Change desert floating target to desert flood final |
75 | _memory.WriteData<int>({0x5B28C0, 0x18, 0x17ECA*8, 0x2BC}, {0x18077}); | 91 | _memory.WriteData<int>({0x5B28C0, 0x18, 0x17ECA*8, 0x2BC}, {0x18077}); |
92 | // Explicitly set back-off distance for the challenge entry & final 2 pillars | ||
93 | _memory.WriteData<float>({0x5B28C0, 0x18, 0x9DD5*8, 0x22C}, {2.5f}); | ||
94 | _memory.WriteData<float>({0x5B28C0, 0x18, 0x1C31A*8, 0x22C}, {3.0f}); | ||
95 | _memory.WriteData<float>({0x5B28C0, 0x18, 0x1C319*8, 0x22C}, {3.0f}); | ||
76 | } | 96 | } |
77 | 97 | ||
78 | void WitnessRandomizer::Randomize(std::vector<int> panels, int flags) { | 98 | void WitnessRandomizer::Randomize(std::vector<int> panels, int flags) { |
@@ -95,7 +115,7 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { | |||
95 | } | 115 | } |
96 | if (flags & SWAP_LINES) { | 116 | if (flags & SWAP_LINES) { |
97 | offsets[0x230] = 16; // traced_edges | 117 | offsets[0x230] = 16; // traced_edges |
98 | // offsets[0x220] = sizeof(void*); // *pattern_name | 118 | offsets[0x220] = sizeof(void*); // *pattern_name |
99 | // offsets[0x240] = sizeof(void*); // *mesh_name | 119 | // offsets[0x240] = sizeof(void*); // *mesh_name |
100 | offsets[0x2FC] = sizeof(int); // is_cylinder | 120 | offsets[0x2FC] = sizeof(int); // is_cylinder |
101 | offsets[0x300] = sizeof(float); // cylinder_z0 | 121 | offsets[0x300] = sizeof(float); // cylinder_z0 |
@@ -104,6 +124,8 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { | |||
104 | // offsets[0x35C] = sizeof(int); // solvable_from_behind | 124 | // offsets[0x35C] = sizeof(int); // solvable_from_behind |
105 | 125 | ||
106 | // offsets[0x30C] = sizeof(float); // uv_to_world_scale | 126 | // offsets[0x30C] = sizeof(float); // uv_to_world_scale |
127 | offsets[0x398] = sizeof(float); // specular_add | ||
128 | offsets[0x39C] = sizeof(int); // specular_power | ||
107 | offsets[0x3A4] = sizeof(float); // path_width_scale | 129 | offsets[0x3A4] = sizeof(float); // path_width_scale |
108 | offsets[0x3A8] = sizeof(float); // startpoint_scale | 130 | offsets[0x3A8] = sizeof(float); // startpoint_scale |
109 | offsets[0x3B8] = sizeof(int); // num_dots | 131 | offsets[0x3B8] = sizeof(int); // num_dots |
@@ -112,6 +134,7 @@ void WitnessRandomizer::SwapPanels(int panel1, int panel2, int flags) { | |||
112 | offsets[0x3D0] = sizeof(void*); // *dot_flags | 134 | offsets[0x3D0] = sizeof(void*); // *dot_flags |
113 | offsets[0x3D8] = sizeof(void*); // *dot_connection_a | 135 | offsets[0x3D8] = sizeof(void*); // *dot_connection_a |
114 | offsets[0x3E0] = sizeof(void*); // *dot_connection_b | 136 | offsets[0x3E0] = sizeof(void*); // *dot_connection_b |
137 | // offsets[0x3E8] = sizeof(int); // randomize_on_power_on | ||
115 | offsets[0x420] = sizeof(void*); // *decorations | 138 | offsets[0x420] = sizeof(void*); // *decorations |
116 | offsets[0x428] = sizeof(void*); // *decoration_flags | 139 | offsets[0x428] = sizeof(void*); // *decoration_flags |
117 | offsets[0x438] = sizeof(int); // num_decorations | 140 | offsets[0x438] = sizeof(int); // num_decorations |
@@ -173,8 +196,8 @@ void WitnessRandomizer::SwapPanelData(int panel1, int panel2, int finalOffset, i | |||
173 | std::vector<int> panel2Offset = {0x5B28C0, 0x18, panel2*8, finalOffset}; | 196 | std::vector<int> panel2Offset = {0x5B28C0, 0x18, panel2*8, finalOffset}; |
174 | 197 | ||
175 | std::vector<byte> panel1Data = _memory.ReadData<byte>(panel1Offset, dataSize); | 198 | std::vector<byte> panel1Data = _memory.ReadData<byte>(panel1Offset, dataSize); |
176 | std::vector<byte> panel2Data = _memory.ReadData<byte>(panel2Offset, dataSize); | 199 | //std::vector<byte> panel2Data = _memory.ReadData<byte>(panel2Offset, dataSize); |
177 | 200 | ||
178 | _memory.WriteData<byte>(panel2Offset, panel1Data); | 201 | _memory.WriteData<byte>(panel2Offset, panel1Data); |
179 | _memory.WriteData<byte>(panel1Offset, panel2Data); | 202 | //_memory.WriteData<byte>(panel1Offset, panel2Data); |
180 | } | 203 | } |