|
|
1.1 root 1: /*
2: Copyright (C) 1996-1997 Id Software, Inc.
3:
4: This program is free software; you can redistribute it and/or
5: modify it under the terms of the GNU General Public License
6: as published by the Free Software Foundation; either version 2
7: of the License, or (at your option) any later version.
8:
9: This program is distributed in the hope that it will be useful,
10: but WITHOUT ANY WARRANTY; without even the implied warranty of
11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12:
13: See the GNU General Public License for more details.
14:
15: You should have received a copy of the GNU General Public License
16: along with this program; if not, write to the Free Software
17: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18:
19: */
20: // protocol.h -- communications protocols
21:
22: #define PROTOCOL_VERSION 28
23:
24: #define QW_CHECK_HASH 0x5157
25:
26: //=========================================
27:
28: #define PORT_CLIENT 27001
29: #define PORT_MASTER 27000
30: #define PORT_SERVER 27500
31:
32: //=========================================
33:
34: // out of band message id bytes
35:
36: // M = master, S = server, C = client, A = any
37: // the second character will allways be \n if the message isn't a single
38: // byte long (?? not true anymore?)
39:
40: #define S2C_CHALLENGE 'c'
41: #define S2C_CONNECTION 'j'
42: #define A2A_PING 'k' // respond with an A2A_ACK
43: #define A2A_ACK 'l' // general acknowledgement without info
44: #define A2A_NACK 'm' // [+ comment] general failure
45: #define A2A_ECHO 'e' // for echoing
46: #define A2C_PRINT 'n' // print a message on client
47:
48: #define S2M_HEARTBEAT 'a' // + serverinfo + userlist + fraglist
49: #define A2C_CLIENT_COMMAND 'B' // + command line
50: #define S2M_SHUTDOWN 'C'
51:
52:
53: //==================
54: // note that there are some defs.qc that mirror to these numbers
55: // also related to svc_strings[] in cl_parse
56: //==================
57:
58: //
59: // server to client
60: //
61: #define svc_bad 0
62: #define svc_nop 1
63: #define svc_disconnect 2
64: #define svc_updatestat 3 // [byte] [byte]
65: //define svc_version 4 // [long] server version
66: #define svc_setview 5 // [short] entity number
67: #define svc_sound 6 // <see code>
68: //define svc_time 7 // [float] server time
69: #define svc_print 8 // [byte] id [string] null terminated string
70: #define svc_stufftext 9 // [string] stuffed into client's console buffer
71: // the string should be \n terminated
72: #define svc_setangle 10 // [angle3] set the view angle to this absolute value
73:
74: #define svc_serverdata 11 // [long] protocol ...
75: #define svc_lightstyle 12 // [byte] [string]
76: //define svc_updatename 13 // [byte] [string]
77: #define svc_updatefrags 14 // [byte] [short]
78: //define svc_clientdata 15 // <shortbits + data>
79: #define svc_stopsound 16 // <see code>
80: //define svc_updatecolors 17 // [byte] [byte] [byte]
81: //define svc_particle 18 // [vec3] <variable>
82: #define svc_damage 19
83:
84: #define svc_spawnstatic 20
85: // svc_spawnbinary 21
86: #define svc_spawnbaseline 22
87:
88: #define svc_temp_entity 23 // variable
89: #define svc_setpause 24 // [byte] on / off
90: // svc_signonnum 25 // [byte] used for the signon sequence
91:
92: #define svc_centerprint 26 // [string] to put in center of the screen
93:
94: #define svc_killedmonster 27
95: #define svc_foundsecret 28
96:
97: #define svc_spawnstaticsound 29 // [coord3] [byte] samp [byte] vol [byte] aten
98:
99: #define svc_intermission 30 // [vec3_t] origin [vec3_t] angle
100: #define svc_finale 31 // [string] text
101:
102: #define svc_cdtrack 32 // [byte] track
103: #define svc_sellscreen 33
104:
105: #define svc_smallkick 34 // set client punchangle to 2
106: #define svc_bigkick 35 // set client punchangle to 4
107:
108: #define svc_updateping 36 // [byte] [short]
109: #define svc_updateentertime 37 // [byte] [float]
110:
111: #define svc_updatestatlong 38 // [byte] [long]
112:
113: #define svc_muzzleflash 39 // [short] entity
114:
115: #define svc_updateuserinfo 40 // [byte] slot [long] uid
116: // [string] userinfo
117:
118: #define svc_download 41 // [short] size [size bytes]
119: #define svc_playerinfo 42 // variable
120: #define svc_nails 43 // [byte] num [48 bits] xyzpy 12 12 12 4 8
121: #define svc_chokecount 44 // [byte] packets choked
122: #define svc_modellist 45 // [strings]
123: #define svc_soundlist 46 // [strings]
124: #define svc_packetentities 47 // [...]
125: #define svc_deltapacketentities 48 // [...]
126: #define svc_maxspeed 49 // maxspeed change, for prediction
127: #define svc_entgravity 50 // gravity change, for prediction
128: #define svc_setinfo 51 // setinfo on a client
129: #define svc_serverinfo 52 // serverinfo
130: #define svc_updatepl 53 // [byte] [byte]
131:
132:
133: //==============================================
134:
135: //
136: // client to server
137: //
138: #define clc_bad 0
139: #define clc_nop 1
140: //define clc_doublemove 2
141: #define clc_move 3 // [[usercmd_t]
142: #define clc_stringcmd 4 // [string] message
143: #define clc_delta 5 // [byte] sequence number, requests delta compression of message
144: #define clc_tmove 6 // teleport request, spectator only
145: #define clc_upload 7 // teleport request, spectator only
146:
147:
148: //==============================================
149:
150: // playerinfo flags from server
151: // playerinfo allways sends: playernum, flags, origin[] and framenumber
152:
153: #define PF_MSEC (1<<0)
154: #define PF_COMMAND (1<<1)
155: #define PF_VELOCITY1 (1<<2)
156: #define PF_VELOCITY2 (1<<3)
157: #define PF_VELOCITY3 (1<<4)
158: #define PF_MODEL (1<<5)
159: #define PF_SKINNUM (1<<6)
160: #define PF_EFFECTS (1<<7)
161: #define PF_WEAPONFRAME (1<<8) // only sent for view player
162: #define PF_DEAD (1<<9) // don't block movement any more
163: #define PF_GIB (1<<10) // offset the view height differently
164: #define PF_NOGRAV (1<<11) // don't apply gravity for prediction
165:
166: //==============================================
167:
168: // if the high bit of the client to server byte is set, the low bits are
169: // client move cmd bits
170: // ms and angle2 are allways sent, the others are optional
171: #define CM_ANGLE1 (1<<0)
172: #define CM_ANGLE3 (1<<1)
173: #define CM_FORWARD (1<<2)
174: #define CM_SIDE (1<<3)
175: #define CM_UP (1<<4)
176: #define CM_BUTTONS (1<<5)
177: #define CM_IMPULSE (1<<6)
178: #define CM_ANGLE2 (1<<7)
179:
180: //==============================================
181:
182: // the first 16 bits of a packetentities update holds 9 bits
183: // of entity number and 7 bits of flags
184: #define U_ORIGIN1 (1<<9)
185: #define U_ORIGIN2 (1<<10)
186: #define U_ORIGIN3 (1<<11)
187: #define U_ANGLE2 (1<<12)
188: #define U_FRAME (1<<13)
189: #define U_REMOVE (1<<14) // REMOVE this entity, don't add it
190: #define U_MOREBITS (1<<15)
191:
192: // if MOREBITS is set, these additional flags are read in next
193: #define U_ANGLE1 (1<<0)
194: #define U_ANGLE3 (1<<1)
195: #define U_MODEL (1<<2)
196: #define U_COLORMAP (1<<3)
197: #define U_SKIN (1<<4)
198: #define U_EFFECTS (1<<5)
199: #define U_SOLID (1<<6) // the entity should be solid for prediction
200:
201: //==============================================
202:
203: // a sound with no channel is a local only sound
204: // the sound field has bits 0-2: channel, 3-12: entity
205: #define SND_VOLUME (1<<15) // a byte
206: #define SND_ATTENUATION (1<<14) // a byte
207:
208: #define DEFAULT_SOUND_PACKET_VOLUME 255
209: #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
210:
211: // svc_print messages have an id, so messages can be filtered
212: #define PRINT_LOW 0
213: #define PRINT_MEDIUM 1
214: #define PRINT_HIGH 2
215: #define PRINT_CHAT 3 // also go to chat buffer
216:
217: //
218: // temp entity events
219: //
220: #define TE_SPIKE 0
221: #define TE_SUPERSPIKE 1
222: #define TE_GUNSHOT 2
223: #define TE_EXPLOSION 3
224: #define TE_TAREXPLOSION 4
225: #define TE_LIGHTNING1 5
226: #define TE_LIGHTNING2 6
227: #define TE_WIZSPIKE 7
228: #define TE_KNIGHTSPIKE 8
229: #define TE_LIGHTNING3 9
230: #define TE_LAVASPLASH 10
231: #define TE_TELEPORT 11
232: #define TE_BLOOD 12
233: #define TE_LIGHTNINGBLOOD 13
234:
235:
236: /*
237: ==========================================================
238:
239: ELEMENTS COMMUNICATED ACROSS THE NET
240:
241: ==========================================================
242: */
243:
244: #define MAX_CLIENTS 32
245:
246: #define UPDATE_BACKUP 64 // copies of entity_state_t to keep buffered
247: // must be power of two
248: #define UPDATE_MASK (UPDATE_BACKUP-1)
249:
250: // entity_state_t is the information conveyed from the server
251: // in an update message
252: typedef struct
253: {
254: int number; // edict index
255:
256: int flags; // nolerp, etc
257: vec3_t origin;
258: vec3_t angles;
259: int modelindex;
260: int frame;
261: int colormap;
262: int skinnum;
263: int effects;
264: } entity_state_t;
265:
266:
267: #define MAX_PACKET_ENTITIES 64 // doesn't count nails
268: typedef struct
269: {
270: int num_entities;
271: entity_state_t entities[MAX_PACKET_ENTITIES];
272: } packet_entities_t;
273:
274: typedef struct usercmd_s
275: {
276: byte msec;
277: vec3_t angles;
278: short forwardmove, sidemove, upmove;
279: byte buttons;
280: byte impulse;
281: } usercmd_t;
282:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.