about summary refs log tree commit diff stats
path: root/WitnessRandomizer/WitnessRandomizer.h
blob: a824fba2b2f8dd8a6db9fc24368d99a2218eba72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

int SWAP_NONE = 0x0;
int SWAP_TARGETS = 0x1;
int SWAP_LINES = 0x2;
int SWAP_STYLE = 0x4;

class WitnessRandomizer {
public:
	WitnessRandomizer();

	void Randomize(std::vector<int> &panels, int flags);
	void RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex);
	void SwapPanels(int panel1, int panel2, int flags);
	void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order);

	template <class T>
	std::vector<T> ReadPanelData(int panel, int offset, int size) {
		return _memory.ReadData<T>({_globals, 0x18, panel*8, offset}, size);
	}

	template <class T>
	void WritePanelData(int panel, int offset, const std::vector<T>& data) {
		_memory.WriteData<T>({_globals, 0x18, panel*8, offset}, data);
	}

private:
	Memory _memory;
	int _globals = 0x5B28C0;
};