forked from xoposhiy/cg-overlays
-
Notifications
You must be signed in to change notification settings - Fork 0
/
knownGames.js
145 lines (131 loc) · 3.71 KB
/
knownGames.js
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Feel free to send PR with other games settings.
const knownGames = {
// Seabed security
FC2023: {
viewport: createViewport(
(width = 10000),
(height = 10000),
(leftMargin = 4600),
(rightMargin = 4600),
(topMargin = 300),
(bottomMargin = 500)
),
},
"Search Race": {
viewport: createViewport((width = 16000), (height = 9000)),
},
CodersStrikeBack: {
viewport: createViewport((width = 16000), (height = 9000)),
},
// Code Royal ¯\_(ツ)_/¯
CodinGame: {
viewport: createViewport((width = 1920), (height = 1080)),
},
CodeBusters: {
viewport: createViewport(
(width = 16000),
(height = 9000),
(leftMargin = 350),
(rightMargin = 350),
(topMargin = 220),
(bottomMargin = 100)
),
},
OceanOfCode: {
viewport: createViewport(
(width = 900),
(height = 900),
(leftMargin = 510),
(rightMargin = 510),
(topMargin = 90),
(bottomMargin = 90)
),
},
TheGreatEscape: {
viewport: createViewportFromScreenshot(
(fieldLogicalWidth = 900),
(screenshotWidth = 1920),
(fieldLeft = 522),
(fieldTop = 166),
(fieldRight = 1400)
),
playerStepEveryFrame: true,
},
GameOfDrones: {
viewport: createViewport(
(width = 4000),
(height = 1800),
(leftMargin = 300),
(rightMargin = 300),
(topMargin = 180),
(bottomMargin = 180)
),
playerStepEveryFrame: true,
},
// Crystal Rush
UTG2019: {
viewport: createViewportFromScreenshot(
(fieldLogicalWidth = 3000),
(screenshotWidth = 16000),
(fieldLeft = 610),
(fieldTop = 1240),
(fieldRight = 15820)
),
},
SpaceShooter: {
viewport: createViewportFromScreenshot(
(fieldLogicalWidth = 1700),
(screenshotWidth = 1920),
(fieldLeft = 0),
(fieldTop = 0),
(fieldRight = 1700)
),
}
};
function createViewport(
width,
height,
leftMargin = 0,
rightMargin = 0,
topMargin = 0,
bottomMargin = 0
) {
return {
left: -leftMargin,
top: -topMargin,
right: width + rightMargin,
bottom: height + bottomMargin,
fieldWidth: width,
fieldHeight: height,
};
}
// 1. Take screenshot of the full screen visualizer.
// 2. Open it in some image editor.
// 3. Find the game field corners coordinates in the screenshot.
// 4. Decide the desired logical field width.
// 5. Put all these data into this function.
// Or use hold-CTRL key feature in visualizer (and use 16000 for screenshotWidth)
function createViewportFromScreenshot(
fieldLogicalWidth,
screenshotWidth,
fieldLeft,
fieldTop,
fieldRight
) {
let fieldXFraction = (fieldRight - fieldLeft) / screenshotWidth;
let screenLogicalWidth = fieldLogicalWidth / fieldXFraction;
let screenLogicalHeight = (screenLogicalWidth * 9) / 16;
let scale = screenLogicalWidth / screenshotWidth;
let logicalLeft = fieldLeft * scale;
let logicalTop = fieldTop * scale;
let logicalRight = screenLogicalWidth - logicalLeft;
let logicalBottom = screenLogicalHeight - logicalTop;
return {
left: -logicalLeft,
top: -logicalTop,
right: logicalRight,
bottom: logicalBottom,
fieldWidth: fieldLogicalWidth,
fieldHeight: (fieldLogicalWidth * 9) / 16,
};
}