-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminimal_state_info.h
86 lines (65 loc) · 1.71 KB
/
minimal_state_info.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
#ifndef MINIMAL_PLAYER_INFO_H
#define MINIMAL_PLAYER_INFO_H
#include <stdint.h>
#include <stdbool.h>
#ifndef WASM
#include <assert.h>
#endif
#define PLAYER_SIZE 26
#include "weapon.h"
#include "player_ability.h"
typedef struct __attribute__((__packed__)) MinimalPlayerInfo {
uint64_t id;
uint64_t team_id;
uint16_t health;
bool cloaking;
uint8_t ammo;
uint16_t using_ability;
uint16_t throwing_grenade;
uint32_t num_kills;
Weapon weapon;
Ability ability;
float pos_x;
float pos_y;
float direction;
} MinimalPlayerInfo;
typedef struct __attribute__((__packed__)) MinimalTeamInfo {
uint64_t id;
uint64_t score;
MinimalPlayerInfo players[255];
uint32_t color;
uint8_t num_players;
} MinimalTeamInfo;
typedef struct __attribute__((__packed__)) MinimalMapObject {
float pos_x;
float pos_y;
float width;
float height;
} MinimalMapObject;
typedef struct __attribute__((__packed__)) MinimalMapInfo {
float width;
float height;
uint64_t num_spawn_points;
MinimalMapObject spawn_points[256];
} MinimalMapInfo;
#ifndef WASM
static_assert((sizeof(MinimalPlayerInfo) % 8 == 0), "MinimalPlayerInfo is the wrong size, add padding");
static_assert((sizeof(MinimalMapInfo) % 8 == 0), "MinimalMapInfo is the wrong size, add padding");
static_assert((sizeof(MinimalMapObject) % 8 == 0), "MinimalMapObject is the wrong size, add padding");
#endif
typedef struct MinimalProjectileInfo {
float pos_x;
float pos_y;
float angle;
float speed;
uint16_t damage;
uint16_t size;
} MinimalProjectileInfo;
#ifndef WASM
static_assert((sizeof(MinimalProjectileInfo) == 20), "MinimalProjectileInfo is the wrong size, add padding");
#endif
typedef struct PlayerMovementInfo {
bool moving;
float angle;
} PlayerMovementInfo;
#endif