summary refs log tree commit diff stats
path: root/Source/Panel.h
blob: fa3f75052e1cfd0fe0e3de68cce9656307feca29 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#pragma once
#include "json.hpp"
#include "RandomizerCore.h"

class Decoration
{
public:
	enum Shape {
		Stone = 100,
		Star = 200,
		Poly = 400,
		Eraser = 500,
		Triangle = 600,
	};

	Decoration() = default;
	explicit Decoration(int shape);

	int GetValue();

//private:
	int _shape;
};

class Intersection
{
public:
	enum Flags {
		IS_ENDPOINT = 0x1,
		IS_STARTPOINT = 0x2,
		IS_GAP = 0x10000,
		HAS_DOT = 0x8,
		DOT_IS_BLUE = 0x100,
		DOT_IS_ORANGE = 0x200,
		DOT_IS_INVISIBLE = 0x1000,
	};

	Intersection() = default;
	explicit Intersection(float x, float y, int flags);

	int GetValue();

// private:
	float _x, _y;
	int _flags;
};

class Panel
{
public:
	explicit Panel(int id);
	void Write(int id);

	void Random();

	enum Style {
		SYMMETRICAL = 0x2,
		IS_2COLOR = 0x10,
		HAS_DOTS = 0x4,
		HAS_STARS = 0x40,
		HAS_STONES = 0x100,
		HAS_ERASERS = 0x1000,
		HAS_SHAPERS = 0x2000,
	};

private:
	void ReadIntersections(int id);
	void WriteIntersections(int id);
	void ReadDecorations(int id);
	void WriteDecorations(int id);

	// TODO: Reflection data
	// TODO: Decoration colors


	Memory _memory = Memory("witness64_d3d11.exe");

	int _width, _height;

	std::vector<std::vector<Decoration>> _decorations;
	std::vector<std::vector<Intersection>> _intersections;
	std::vector<Intersection> _endpoints;
	std::vector<Intersection> _gaps;
	int _style;
};