1 | |
---|
2 | |
---|
3 | enum { WAIT_INPUT, // driver is waiting on input from client |
---|
4 | WAIT_SEND, // driver waiting on all input collected before sending |
---|
5 | WAIT_PROCESS // driver waiting for engine to change this to WAIT_INPUT |
---|
6 | }; |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | struct base_memory_struct |
---|
11 | { |
---|
12 | client_list *active_clients |
---|
13 | join_struct *join_list; |
---|
14 | |
---|
15 | } ; |
---|
16 | |
---|
17 | struct client_list |
---|
18 | { |
---|
19 | short client_id; // used by engine to refer to specific client |
---|
20 | // the driver is responsible for allocating/deallocating client id's |
---|
21 | |
---|
22 | char input_state; // one of the above wait states |
---|
23 | |
---|
24 | char command_buffer[1024]; // engine will process this data |
---|
25 | |
---|
26 | client_list *next; |
---|
27 | |
---|
28 | // net driver may have private information here |
---|
29 | |
---|
30 | } ; |
---|
31 | |
---|
32 | |
---|
33 | |
---|
34 | |
---|
35 | struct join_struct |
---|
36 | { |
---|
37 | int client_id; |
---|
38 | |
---|
39 | join_struct *next; |
---|
40 | |
---|
41 | // net driver may have private information here |
---|
42 | } ; |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | /* |
---|
50 | |
---|
51 | Net driver to engine API |
---|
52 | |
---|
53 | |
---|
54 | File API |
---|
55 | ----------------------------------------------------- |
---|
56 | int open_file(char *filename, char *mode); |
---|
57 | Note : filename may contain a references to another server. |
---|
58 | If the player starts with -net all files locations default to |
---|
59 | those on the specified server. But if a filename has a |
---|
60 | "//" leading it's filename, the location of the file prefixes |
---|
61 | the filename. example "//abuser.location.edu/~joe/file1.lsp" |
---|
62 | specifies a file on the server abuser.location.edu in joe's |
---|
63 | home directory called file1.lsp. |
---|
64 | |
---|
65 | The net driver should contact that address using the abuse file |
---|
66 | protocol. If no server is running there the server reports the |
---|
67 | file does not exsist, -1 should be return. |
---|
68 | |
---|
69 | |
---|
70 | int close_file(int fd); |
---|
71 | int read(int fd, void *buffer, int size); // returns bytes read |
---|
72 | long seek(int fd, int offset); |
---|
73 | long tell(int fd); |
---|
74 | long file_size(int fd); |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | Game API |
---|
81 | ------------------------------------------------------- |
---|
82 | client_side : |
---|
83 | join_game(char *hostname); |
---|
84 | |
---|
85 | server side : |
---|
86 | kill_client(int client id); |
---|
87 | |
---|
88 | |
---|
89 | */ |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | |
---|