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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
|
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
#ifndef ENGINE_IF_CLIENT_H
#define ENGINE_IF_CLIENT_H
/*
Title: Client Interface
*/
/*
Section: Constants
*/
enum
{
/* Constants: Client States
CLIENTSTATE_OFFLINE - The client is offline.
CLIENTSTATE_CONNECTING - The client is trying to connect to a server.
CLIENTSTATE_LOADING - The client has connected to a server and is loading resources.
CLIENTSTATE_ONLINE - The client is connected to a server and running the game.
CLIENTSTATE_QUITING - The client is quiting.
*/
CLIENTSTATE_OFFLINE=0,
CLIENTSTATE_CONNECTING,
CLIENTSTATE_LOADING,
CLIENTSTATE_ONLINE,
CLIENTSTATE_QUITING,
/* Constants: Image Formats
IMG_AUTO - Lets the engine choose the format.
IMG_RGB - 8-Bit uncompressed RGB
IMG_RGBA - 8-Bit uncompressed RGBA
IMG_ALPHA - 8-Bit uncompressed alpha
*/
IMG_AUTO=-1,
IMG_RGB=0,
IMG_RGBA=1,
IMG_ALPHA=2,
/* Constants: Texture Loading Flags
TEXLOAD_NORESAMPLE - Prevents the texture from any resampling
*/
TEXLOAD_NORESAMPLE=1,
/* Constants: Server Browser Sorting
BROWSESORT_NAME - Sort by name.
BROWSESORT_PING - Sort by ping.
BROWSESORT_MAP - Sort by map
BROWSESORT_GAMETYPE - Sort by game type. DM, TDM etc.
BROWSESORT_PROGRESSION - Sort by progression.
BROWSESORT_NUMPLAYERS - Sort after how many players there are on the server.
*/
BROWSESORT_NAME = 0,
BROWSESORT_PING,
BROWSESORT_MAP,
BROWSESORT_GAMETYPE,
BROWSESORT_PROGRESSION,
BROWSESORT_NUMPLAYERS,
BROWSEQUICK_SERVERNAME=1,
BROWSEQUICK_PLAYERNAME=2,
BROWSEQUICK_MAPNAME=4,
BROWSETYPE_INTERNET = 0,
BROWSETYPE_LAN = 1,
BROWSETYPE_FAVORITES = 2
};
/*
Section: Structures
*/
/*
Structure: SERVER_INFO_PLAYER
*/
typedef struct
{
char name[48];
int score;
} SERVER_INFO_PLAYER;
/*
Structure: SERVER_INFO
*/
typedef struct
{
int sorted_index;
int server_index;
NETADDR netaddr;
int quicksearch_hit;
int progression;
int max_players;
int num_players;
int flags;
int favorite;
int latency; /* in ms */
char gametype[16];
char name[64];
char map[32];
char version[32];
char address[24];
SERVER_INFO_PLAYER players[16];
} SERVER_INFO;
/*
Section: Functions
*/
/**********************************************************************************
Group: Time
**********************************************************************************/
/*
Function: client_tick
Returns the tick of the current snapshot.
*/
int client_tick();
/*
Function: client_prevtick
Returns the tick of the previous snapshot.
*/
int client_prevtick();
/*
Function: client_intratick
Returns the current intratick.
Remarks:
The intratick is how far gone the time is from the previous snapshot to the current.
0.0 means that it on the previous snapshot. 0.5 means that it's halfway to the current,
and 1.0 means that it is on the current snapshot. It can go beyond 1.0 which means that
the client has started to extrapolate due to lack of data from the server.
See Also:
<client_tick>
*/
float client_intratick();
/*
Function: client_predtick
Returns the current predicted tick.
*/
int client_predtick();
/*
Function: client_predintratick
Returns the current preticted intra tick.
Remarks:
This is the same as <client_intratick> but for the current predicted tick and
previous predicted tick.
See Also:
<client_intratick>
*/
float client_predintratick();
/*
Function: client_ticktime
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
float client_ticktime();
/*
Function: client_tickspeed
Returns how many ticks per second the client is doing.
Remarks:
This will be the same as the server tick speed.
*/
int client_tickspeed();
/*
Function: client_frametime
Returns how long time the last frame took to process.
*/
float client_frametime();
/*
Function: client_localtime
Returns the clients local time.
Remarks:
The local time is set to 0 when the client starts and when
it connects to a server. Can be used for client side effects.
*/
float client_localtime();
/**********************************************************************************
Group: Server Browser
**********************************************************************************/
/*
Function: client_serverbrowse_refresh
Issues a refresh of the server browser.
Arguments:
type - What type of servers to browse, internet, lan or favorites.
Remarks:
This will cause a broadcast on the local network if the lan argument is set.
Otherwise it call ask all the master servers for their servers lists.
*/
void client_serverbrowse_refresh(int type);
/*
Function: client_serverbrowse_sorted_get
Returns server info from the sorted list.
Arguments:
index - Zero based index into the sorted list.
See Also:
<client_serverbrowse_sorted_num>
*/
SERVER_INFO *client_serverbrowse_sorted_get(int index);
/*
Function: client_serverbrowse_sorted_num
Returns how many servers there are in the sorted list.
See Also:
<client_serverbrowse_sorted_get>
*/
int client_serverbrowse_sorted_num();
/*
Function: client_serverbrowse_get
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
SERVER_INFO *client_serverbrowse_get(int index);
/*
Function: client_serverbrowse_num
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
int client_serverbrowse_num();
/*
Function: client_serverbrowse_num_requests
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
int client_serverbrowse_num_requests();
/*
Function: client_serverbrowse_update
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
void client_serverbrowse_update();
/*
Function: client_serverbrowse_lan
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
int client_serverbrowse_lan();
/*
Function: client_serverbrowse_addfavorite
Adds a server to the favorite list
Arguments:
addr - Address of the favorite server.
*/
void client_serverbrowse_addfavorite(NETADDR addr);
/*
Function: client_serverbrowse_removefavorite
Removes a server to the favorite list
Arguments:
addr - Address of the favorite server.
*/
void client_serverbrowse_removefavorite(NETADDR addr);
/**********************************************************************************
Group: Actions
**********************************************************************************/
/*
Function: client_connect
Connects to a server at the specified address.
Arguments:
address - Address of the server to connect to.
See Also:
<client_disconnect>
*/
void client_connect(const char *address);
/*
Function: client_disconnect
Disconnects from the current server.
Remarks:
Does nothing if not connected to a server.
See Also:
<client_connect, client_quit>
*/
void client_disconnect();
/*
Function: client_quit
Tells to client to shutdown.
See Also:
<client_disconnect>
*/
void client_quit();
void client_entergame();
/*
Function: client_rcon
Sends a command to the server to execute on it's console.
Arguments:
cmd - The command to send.
Remarks:
The client must have the correct rcon password to connect.
See Also:
<client_rcon_auth, client_rcon_authed>
*/
void client_rcon(const char *cmd);
/*
Function: client_rcon_auth
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<client_rcon, client_rcon_authed>
*/
void client_rcon_auth(const char *name, const char *password);
/*
Function: client_rcon_authed
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<client_rcon, client_rcon_auth>
*/
int client_rcon_authed();
/**********************************************************************************
Group: Other
**********************************************************************************/
/*
Function: client_latestversion
Returns 0 if there's no version difference
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
const char *client_latestversion();
/*
Function: client_get_input
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
int *client_get_input(int tick);
/*
Function: client_direct_input
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
void client_direct_input(int *input, int size);
/*
Function: client_error_string
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
const char *client_error_string();
/*
Function: client_connection_problems
Returns 1 if the client is connection problems.
Remarks:
Connections problems usually means that the client havn't recvived any data
from the server in a while.
*/
int client_connection_problems();
/*
Function: client_state
Returns the state of the client.
See Also:
<Client States>
*/
int client_state();
/*
Function: client_mapdownload_amount
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
int client_mapdownload_amount();
/*
Function: client_mapdownload_totalsize
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
int client_mapdownload_totalsize();
/*
Function: client_save_line
TODO
Arguments:
arg1 - desc
Returns:
See Also:
<other_func>
*/
void client_save_line(const char *line);
enum
{
BROWSESET_MASTER_ADD=1,
BROWSESET_FAV_ADD,
BROWSESET_TOKEN,
BROWSESET_OLD_INTERNET,
BROWSESET_OLD_LAN
};
void client_serverbrowse_set(NETADDR *addr, int type, int token, SERVER_INFO *info);
int client_serverbrowse_refreshingmasters();
#endif
|