-
-
Notifications
You must be signed in to change notification settings - Fork 396
/
ViZDoomTypes.h
367 lines (314 loc) · 9.55 KB
/
ViZDoomTypes.h
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
/*
Copyright (C) 2016 by Wojciech Jaśkowski, Michał Kempka, Grzegorz Runc, Jakub Toczek, Marek Wydmuch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef __VIZDOOM_TYPES_H__
#define __VIZDOOM_TYPES_H__
#include "ViZDoomConsts.h"
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
namespace vizdoom{
typedef std::vector<uint8_t> Buffer;
typedef std::shared_ptr<Buffer> BufferPtr;
struct Label{
// Label properties
uint8_t value;
unsigned int x;
unsigned int y;
unsigned int width;
unsigned int height;
//bool isObjectHostile;
//bool isObjectPickable;
//bool isObjectUsable;
// Actor properties
unsigned int objectId;
double objectPositionX;
double objectPositionY;
double objectPositionZ;
double objectAngle;
double objectPitch;
double objectRoll;
double objectVelocityX;
double objectVelocityY;
double objectVelocityZ;
std::string objectName;
};
struct GameState {
unsigned int number;
unsigned int tic;
std::vector<double> gameVariables;
BufferPtr screenBuffer;
BufferPtr depthBuffer;
BufferPtr labelsBuffer;
BufferPtr automapBuffer;
std::vector<Label> labels;
};
typedef std::shared_ptr<GameState> GameStatePtr;
struct ServerState {
unsigned int tic;
unsigned int playerCount;
bool playersInGame[MAX_PLAYERS];
int playersFrags[MAX_PLAYERS];
std::string playersNames[MAX_PLAYERS];
bool playersAfk[MAX_PLAYERS];
unsigned int playersLastActionTic[MAX_PLAYERS];
unsigned int playersLastKillTic[MAX_PLAYERS];
};
typedef std::shared_ptr<ServerState> ServerStatePtr;
enum Mode {
PLAYER, // synchronous player mode
SPECTATOR, // synchronous spectator mode
ASYNC_PLAYER, // asynchronous player mode
ASYNC_SPECTATOR, // asynchronous spectator mode
};
enum ScreenFormat {
CRCGCB = 0, // 3 channels of 8-bit values in RGB order
RGB24 = 1, // channel of RGB values stored in 24 bits, where R value is stored in the oldest 8 bits
RGBA32 = 2, // channel of RGBA values stored in 32 bits, where R value is stored in the oldest 8 bits
ARGB32 = 3, // channel of ARGB values stored in 32 bits, where A value is stored in the oldest 8 bits
CBCGCR = 4, // 3 channels of 8-bit values in BGR order
BGR24 = 5, // channel of BGR values stored in 24 bits, where B value is stored in the oldest 8 bits
BGRA32 = 6, // channel of BGRA values stored in 32 bits, where B value is stored in the oldest 8 bits
ABGR32 = 7, // channel of ABGR values stored in 32 bits, where A value is stored in the oldest 8 bits
GRAY8 = 8, // 8-bit gray channel
DOOM_256_COLORS8 = 9, // 8-bit channel with Doom palette values
};
enum ScreenResolution {
RES_160X120, // 4:3
RES_200X125, // 16:10
RES_200X150, // 4:3
RES_256X144, // 16:9
RES_256X160, // 16:10
RES_256X192, // 4:3
RES_320X180, // 16:9
RES_320X200, // 16:10
RES_320X240, // 4:3
RES_320X256, // 5:4
RES_400X225, // 16:9
RES_400X250, // 16:10
RES_400X300, // 4:3
RES_512X288, // 16:9
RES_512X320, // 16:10
RES_512X384, // 4:3
RES_640X360, // 16:9
RES_640X400, // 16:10
RES_640X480, // 4:3
RES_800X450, // 16:9
RES_800X500, // 16:10
RES_800X600, // 4:3
RES_1024X576, // 16:9
RES_1024X640, // 16:10
RES_1024X768, // 4:3
RES_1280X720, // 16:9
RES_1280X800, // 16:10
RES_1280X960, // 4:3
RES_1280X1024, // 5:4
RES_1400X787, // 16:9
RES_1400X875, // 16:10
RES_1400X1050, // 4:3
RES_1600X900, // 16:9
RES_1600X1000, // 16:10
RES_1600X1200, // 4:3
RES_1920X1080, // 16:9
};
enum AutomapMode {
NORMAL, // Only level architecture the player has seen is shown.
WHOLE, // All architecture is shown, regardless of whether or not the player has seen it.
OBJECTS, // In addition to the previous, shows all things in the map as arrows pointing in
// the direction they are facing.
OBJECTS_WITH_SIZE, // In addition to the previous, all things are wrapped in a box showing their size.
};
enum GameVariable {
/* Defined variables */
KILLCOUNT,
ITEMCOUNT,
SECRETCOUNT,
FRAGCOUNT,
DEATHCOUNT,
HITCOUNT,
HITS_TAKEN,
DAMAGECOUNT,
DAMAGE_TAKEN,
HEALTH,
ARMOR,
DEAD,
ON_GROUND,
ATTACK_READY,
ALTATTACK_READY,
SELECTED_WEAPON,
SELECTED_WEAPON_AMMO,
AMMO0,
AMMO1,
AMMO2,
AMMO3,
AMMO4,
AMMO5,
AMMO6,
AMMO7,
AMMO8,
AMMO9,
WEAPON0,
WEAPON1,
WEAPON2,
WEAPON3,
WEAPON4,
WEAPON5,
WEAPON6,
WEAPON7,
WEAPON8,
WEAPON9,
POSITION_X,
POSITION_Y,
POSITION_Z,
ANGLE,
PITCH,
ROLL,
VELOCITY_X,
VELOCITY_Y,
VELOCITY_Z,
PLAYER_NUMBER,
PLAYER_COUNT,
PLAYER1_FRAGCOUNT,
PLAYER2_FRAGCOUNT,
PLAYER3_FRAGCOUNT,
PLAYER4_FRAGCOUNT,
PLAYER5_FRAGCOUNT,
PLAYER6_FRAGCOUNT,
PLAYER7_FRAGCOUNT,
PLAYER8_FRAGCOUNT,
PLAYER9_FRAGCOUNT,
PLAYER10_FRAGCOUNT,
PLAYER11_FRAGCOUNT,
PLAYER12_FRAGCOUNT,
PLAYER13_FRAGCOUNT,
PLAYER14_FRAGCOUNT,
PLAYER15_FRAGCOUNT,
PLAYER16_FRAGCOUNT,
/* User (ACS) variables */
// USER0 is reserved for reward
USER1,
USER2,
USER3,
USER4,
USER5,
USER6,
USER7,
USER8,
USER9,
USER10,
USER11,
USER12,
USER13,
USER14,
USER15,
USER16,
USER17,
USER18,
USER19,
USER20,
USER21,
USER22,
USER23,
USER24,
USER25,
USER26,
USER27,
USER28,
USER29,
USER30,
USER31,
USER32,
USER33,
USER34,
USER35,
USER36,
USER37,
USER38,
USER39,
USER40,
USER41,
USER42,
USER43,
USER44,
USER45,
USER46,
USER47,
USER48,
USER49,
USER50,
USER51,
USER52,
USER53,
USER54,
USER55,
USER56,
USER57,
USER58,
USER59,
USER60,
};
enum Button {
/* Binary buttons */
ATTACK = 0,
USE = 1,
JUMP = 2,
CROUCH = 3,
TURN180 = 4,
ALTATTACK = 5,
RELOAD = 6,
ZOOM = 7,
SPEED = 8,
STRAFE = 9,
MOVE_RIGHT = 10,
MOVE_LEFT = 11,
MOVE_BACKWARD = 12,
MOVE_FORWARD = 13,
TURN_RIGHT = 14,
TURN_LEFT = 15,
LOOK_UP = 16,
LOOK_DOWN = 17,
MOVE_UP = 18,
MOVE_DOWN = 19,
LAND = 20,
SELECT_WEAPON1 = 21,
SELECT_WEAPON2 = 22,
SELECT_WEAPON3 = 23,
SELECT_WEAPON4 = 24,
SELECT_WEAPON5 = 25,
SELECT_WEAPON6 = 26,
SELECT_WEAPON7 = 27,
SELECT_WEAPON8 = 28,
SELECT_WEAPON9 = 29,
SELECT_WEAPON0 = 30,
SELECT_NEXT_WEAPON = 31,
SELECT_PREV_WEAPON = 32,
DROP_SELECTED_WEAPON = 33,
ACTIVATE_SELECTED_ITEM = 34,
SELECT_NEXT_ITEM = 35,
SELECT_PREV_ITEM = 36,
DROP_SELECTED_ITEM = 37,
/* Delta buttons */
LOOK_UP_DOWN_DELTA = 38,
TURN_LEFT_RIGHT_DELTA = 39,
MOVE_FORWARD_BACKWARD_DELTA = 40,
MOVE_LEFT_RIGHT_DELTA = 41,
MOVE_UP_DOWN_DELTA = 42,
};
}
#endif