-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotocol.h
More file actions
98 lines (84 loc) · 1.46 KB
/
Copy pathprotocol.h
File metadata and controls
98 lines (84 loc) · 1.46 KB
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
/* copyright (c) 2026 mykyta polishyk, see LICENSE file for more info */
#ifndef PROTOCOL_H
#define PROTOCOL_H
#define MAX_PLAYERS 8
#include "types.h"
#include "network.h"
/* Network input struct */
struct NInput{
int left;
int right;
int angle;
int jump;
int fire;
int hook;
int active_weapon;
};
/* Network player entity */
struct NPlayer{
int id;
char name[32];
int x;
int y;
int angle;
int active_weapon;
int current_state;
NetAddr addr;
};
/* Vertex of vertex map system, also this is like float, but 1 is 32/32 */
struct MapVertex{
int x,y;
bool last; // TODO: Transform bool into int
};
/* Map object like pickup and etc */
struct MapObject{
int x,y;
int type;
};
/* Map structure */
struct Map{
// Count of objects
int vertices_n;
int objects_n;
MapVertex vertices[1024];
MapObject objects[64];
};
/* Network packet object */
struct NPacket{
NPlayer players[MAX_PLAYERS];
Map current_map; // TODO: Move map into map packet
};
/* Server info struct */
struct ServerInfo{
// Also, here is fixed count of max players (8)
int players_count;
char name[19]="\0";
int have_password=0;
NetAddr addr;
};
/* Master server packet object */
struct NMSPacket{
int servers_count=0;
ServerInfo servers[1024];
};
enum{ // Weapons
GUN=0,
SHOTGUN,
RIFLE,
GRENADE
};
enum{ // Game objects
ITEM_NULL = 0,
SPAWN,
WEAPON_GUN,
WEAPON_SHOTGUN,
WEAPON_RIFLE,
WEAPON_GRENADE,
ARMOR_1,
ARMOR_5,
ARMOR_10,
HEALTH_1,
HEALTH_5,
HEALTH_10
};
#endif