-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathcg_api.h
More file actions
111 lines (87 loc) · 3.23 KB
/
cg_api.h
File metadata and controls
111 lines (87 loc) · 3.23 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
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
===========================================================================
Daemon GPL Source Code
Copyright (C) 2011 Dusan Jocic <dusanjocic@msn.com>
Daemon is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Daemon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
===========================================================================
*/
// Definitions used in engine/cgame communication
#ifndef CGAPI_H
#define CGAPI_H
#include "engine/qcommon/q_shared.h"
#define MAX_FEATLABEL_CHARS 32
#define CMD_BACKUP 64
#define CMD_MASK ( CMD_BACKUP - 1 )
// allow a lot of command backups for very fast systems
// multiple commands may be combined into a single packet, so this
// needs to be larger than PACKET_BACKUP
// snapshots are a view of the server at a given time
// Snapshots are generated at regular time intervals by the server,
// but they may not be sent if a client's rate level is exceeded, or
// they may be dropped by the network.
// This particular struct is missing player state, which is added by other
// snapshot structs building on it.
struct snapshotBase_t
{
int snapFlags; // SNAPFLAG_RATE_DELAYED, etc
int ping;
int serverTime; // server time the message is valid for (in msec)
byte areamask[ MAX_MAP_AREA_BYTES ]; // portalarea visibility bits
// all of the entities that need to be presented at the time of this snapshot
std::vector<entityState_t> entities;
// text based server commands to execute when this snapshot becomes current
std::vector<std::string> serverCommands;
};
// used for IPC
struct ipcSnapshot_t
{
snapshotBase_t b;
OpaquePlayerState ps;
};
struct cgClientState_t
{
connstate_t connState;
int connectPacketCount;
int clientNum;
std::string servername;
std::string updateInfoString;
std::string messageString;
};
enum class MouseMode
{
Deltas, // The input is sent as movement deltas, the cursor is hidden
CustomCursor, // The input is sent as positions, the cursor should be rendered by the game
SystemCursor, // The input is sent as positions, the cursor should be rendered by the system
};
enum class serverResponseProtocol_t : uint8_t
{
UNKNOWN,
IP4,
IP6,
};
// "Trusted" as in we know it is correct and present, as opposed to the server's info string
// which is self-reported data whose fields may be missing, false or not of the right format
struct trustedServerInfo_t
{
serverResponseProtocol_t responseProto;
char addr[ MAX_ADDR_CHARS ];
char featuredLabel[ MAX_FEATLABEL_CHARS ];
};
using markMsgInput_t = std::pair<
std::vector<std::array<float, 3>>, // points
std::array<float, 3> // projection
>;
using markMsgOutput_t = std::pair<
std::vector<std::array<float, 3>>, // points
std::vector<markFragment_t>
>;
#endif