summary refs log tree commit diff stats
path: root/Source/Randomizer.h
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-10-27 23:28:42 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-10-27 23:28:42 -0700
commit2c9afc07fe5cc53fefb90540d5db2ca424c71a51 (patch)
tree55ba19ae0e3f52f732d9382b6deccf6d879035c7 /Source/Randomizer.h
parentecc14a3463c0c1c52b5de17d2aeb719ce2942a4a (diff)
downloadwitness-tutorializer-2c9afc07fe5cc53fefb90540d5db2ca424c71a51.tar.gz
witness-tutorializer-2c9afc07fe5cc53fefb90540d5db2ca424c71a51.tar.bz2
witness-tutorializer-2c9afc07fe5cc53fefb90540d5db2ca424c71a51.zip
Major restructuring -- also set up for UI work tomorrow
Diffstat (limited to 'Source/Randomizer.h')
-rw-r--r--Source/Randomizer.h157
1 files changed, 157 insertions, 0 deletions
diff --git a/Source/Randomizer.h b/Source/Randomizer.h new file mode 100644 index 0000000..b644a1d --- /dev/null +++ b/Source/Randomizer.h
@@ -0,0 +1,157 @@
1#pragma once
2#include "Memory.h"
3
4// #define GLOBALS 0x5B28C0
5#define GLOBALS 0x62A080
6
7__declspec(selectany) int SWAP_NONE = 0x0;
8__declspec(selectany) int SWAP_TARGETS = 0x1;
9__declspec(selectany) int SWAP_LINES = 0x2;
10__declspec(selectany) int SWAP_STYLE = 0x4;
11
12class Randomizer {
13public:
14 Randomizer();
15
16 void Randomize(std::vector<int>& panels, int flags);
17 void RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex);
18 void SwapPanels(int panel1, int panel2, int flags);
19 void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order);
20
21 template <class T>
22 std::vector<T> ReadPanelData(int panel, int offset, size_t size) {
23 return _memory.ReadData<T>({GLOBALS, 0x18, panel*8, offset}, size);
24 }
25
26 template <class T>
27 void WritePanelData(int panel, int offset, const std::vector<T>& data) {
28 _memory.WriteData<T>({GLOBALS, 0x18, panel*8, offset}, data);
29 }
30
31private:
32 Memory _memory = Memory("witness64_d3d11.exe");
33};
34
35#if GLOBALS == 0x5B28C0
36#define PATH_COLOR 0xC8
37#define REFLECTION_PATH_COLOR 0xD8
38#define DOT_COLOR 0xF8
39#define ACTIVE_COLOR 0x108
40#define BACKGROUND_REGION_COLOR 0x118
41#define SUCCESS_COLOR_A 0x128
42#define SUCCESS_COLOR_B 0x138
43#define STROBE_COLOR_A 0x148
44#define STROBE_COLOR_B 0x158
45#define ERROR_COLOR 0x168
46#define PATTERN_POINT_COLOR 0x188
47#define PATTERN_POINT_COLOR_A 0x198
48#define PATTERN_POINT_COLOR_B 0x1A8
49#define SYMBOL_A 0x1B8
50#define SYMBOL_B 0x1C8
51#define SYMBOL_C 0x1D8
52#define SYMBOL_D 0x1E8
53#define SYMBOL_E 0x1F8
54#define PUSH_SYMBOL_COLORS 0x208
55#define OUTER_BACKGROUND 0x20C
56#define OUTER_BACKGROUND_MODE 0x21C
57#define TRACED_EDGES 0x230
58#define AUDIO_PREFIX 0x278
59#define POWER 0x2A8
60#define TARGET 0x2BC
61#define IS_CYLINDER 0x2FC
62#define CYLINDER_Z0 0x300
63#define CYLINDER_Z1 0x304
64#define CYLINDER_RADIUS 0x308
65#define CURSOR_SPEED_SCALE 0x358
66#define SPECULAR_ADD 0x398
67#define SPECULAR_POWER 0x39C
68#define PATH_WIDTH_SCALE 0x3A4
69#define STARTPOINT_SCALE 0x3A8
70#define NUM_DOTS 0x3B8
71#define NUM_CONNECTIONS 0x3BC
72#define MAX_BROADCAST_DISTANCE 0x3C0
73#define DOT_POSITIONS 0x3C8
74#define DOT_FLAGS 0x3D0
75#define DOT_CONNECTION_A 0x3D8
76#define DOT_CONNECTION_B 0x3E0
77#define DECORATIONS 0x420
78#define DECORATION_FLAGS 0x428
79#define DECORATION_COLORS 0x430
80#define NUM_DECORATIONS 0x438
81#define REFLECTION_DATA 0x440
82#define GRID_SIZE_X 0x448
83#define GRID_SIZE_Y 0x44C
84#define STYLE_FLAGS 0x450
85#define SEQUENCE_LEN 0x45C
86#define SEQUENCE 0x460
87#define DOT_SEQUENCE_LEN 0x468
88#define DOT_SEQUENCE 0x470
89#define DOT_SEQUENCE_LEN_REFLECTION 0x478
90#define DOT_SEQUENCE_REFLECTION 0x480
91#define NUM_COLORED_REGIONS 0x4A0
92#define COLORED_REGIONS 0x4A8
93#define PANEL_TARGET 0x4B0
94#define SPECULAR_TEXTURE 0x4D8
95#define CABLE_TARGET_2 0xD8
96#elif GLOBALS == 0x62A080
97#define PATH_COLOR 0xC0
98#define REFLECTION_PATH_COLOR 0xD0
99#define DOT_COLOR 0xF0
100#define ACTIVE_COLOR 0x100
101#define BACKGROUND_REGION_COLOR 0x110
102#define SUCCESS_COLOR_A 0x120
103#define SUCCESS_COLOR_B 0x130
104#define STROBE_COLOR_A 0x140
105#define STROBE_COLOR_B 0x150
106#define ERROR_COLOR 0x160
107#define PATTERN_POINT_COLOR 0x180
108#define PATTERN_POINT_COLOR_A 0x190
109#define PATTERN_POINT_COLOR_B 0x1A0
110#define SYMBOL_A 0x1B0
111#define SYMBOL_B 0x1C0
112#define SYMBOL_C 0x1D0
113#define SYMBOL_D 0x1E0
114#define SYMBOL_E 0x1F0
115#define PUSH_SYMBOL_COLORS 0x200
116#define OUTER_BACKGROUND 0x204
117#define OUTER_BACKGROUND_MODE 0x214
118#define TRACED_EDGES 0x228
119#define AUDIO_PREFIX 0x270
120#define POWER 0x2A0
121#define TARGET 0x2B4
122#define IS_CYLINDER 0x2F4
123#define CYLINDER_Z0 0x2F8
124#define CYLINDER_Z1 0x2FC
125#define CYLINDER_RADIUS 0x300
126#define CURSOR_SPEED_SCALE 0x350
127#define SPECULAR_ADD 0x38C
128#define SPECULAR_POWER 0x390
129#define PATH_WIDTH_SCALE 0x39C
130#define STARTPOINT_SCALE 0x3A0
131#define NUM_DOTS 0x3B4
132#define NUM_CONNECTIONS 0x3B8
133#define MAX_BROADCAST_DISTANCE 0x3BC
134#define DOT_POSITIONS 0x3C0
135#define DOT_FLAGS 0x3C8
136#define DOT_CONNECTION_A 0x3D0
137#define DOT_CONNECTION_B 0x3D8
138#define DECORATIONS 0x418
139#define DECORATION_FLAGS 0x420
140#define DECORATION_COLORS 0x428
141#define NUM_DECORATIONS 0x430
142#define REFLECTION_DATA 0x438
143#define GRID_SIZE_X 0x440
144#define GRID_SIZE_Y 0x444
145#define STYLE_FLAGS 0x448
146#define SEQUENCE_LEN 0x454
147#define SEQUENCE 0x458
148#define DOT_SEQUENCE_LEN 0x460
149#define DOT_SEQUENCE 0x468
150#define DOT_SEQUENCE_LEN_REFLECTION 0x470
151#define DOT_SEQUENCE_REFLECTION 0x478
152#define NUM_COLORED_REGIONS 0x498
153#define COLORED_REGIONS 0x4A0
154#define PANEL_TARGET 0x4A8
155#define SPECULAR_TEXTURE 0x4D0
156#define CABLE_TARGET_2 0xD0
157#endif \ No newline at end of file