1 /* $Id: network.h,v 1.12 2003-10-10 09:36:35 btb Exp $ */
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
17 * Prototypes for network management functions.
20 * Revision 1.7 1995/10/31 10:20:04 allender
23 * Revision 1.6 1995/09/21 14:31:18 allender
24 * new appltalk type packet which contains shortpos
26 * Revision 1.5 1995/09/18 08:07:08 allender
27 * added function prototype to remove netgame NBP
29 * Revision 1.4 1995/08/31 15:51:55 allender
30 * new prototypes for join and start games
32 * Revision 1.3 1995/07/26 17:02:29 allender
33 * implemented and working on mac
35 * Revision 1.2 1995/06/02 07:42:34 allender
36 * fixed prototype for network_endlevel_poll2
38 * Revision 1.1 1995/05/16 16:00:15 allender
41 * Revision 2.2 1995/03/21 14:58:09 john
42 * *** empty log message ***
44 * Revision 2.1 1995/03/21 14:39:43 john
45 * Ifdef'd out the NETWORK code.
47 * Revision 2.0 1995/02/27 11:29:48 john
48 * New version 2.0, which has no anonymous unions, builds with
49 * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
51 * Revision 1.72 1995/02/11 14:24:39 rob
52 * Added suppor for invul. cntrlcen.
54 * Revision 1.71 1995/02/08 19:18:43 rob
55 * Added extern for segments checksum.
57 * Revision 1.70 1995/02/08 11:01:16 rob
60 * Revision 1.69 1995/02/07 21:16:49 rob
61 * Added flag for automap.
63 * Revision 1.68 1995/02/06 18:18:33 rob
64 * Extern'ed Packet Urgent.
66 * Revision 1.67 1995/02/05 14:36:29 rob
67 * Moved defines to network.h.
69 * Revision 1.66 1995/02/01 16:34:09 john
72 * Revision 1.65 1995/01/30 21:14:35 rob
73 * Fixed a bug in join menu.
74 * Simplified mission load support.
76 * Revision 1.64 1995/01/30 18:19:40 rob
77 * Added mission title to gameinfo packet.
79 * Revision 1.63 1995/01/28 17:02:39 rob
80 * Fixed monitor syncing bug (minor 19).
82 * Revision 1.62 1995/01/27 11:15:25 rob
83 * removed extern of variable no longer in network.c
85 * Revision 1.61 1995/01/26 12:17:34 rob
86 * Added new param to network_do_frame.
88 * Revision 1.60 1995/01/22 17:32:11 rob
89 * Added mission support for network games.
91 * Revision 1.59 1995/01/17 17:10:33 rob
92 * Added some flags to netgame struct.
94 * Revision 1.58 1995/01/12 18:57:15 rob
95 * Added score resync stuff.
97 * Revision 1.57 1995/01/12 16:42:18 rob
98 * Added new prototypes.
100 * Revision 1.56 1995/01/05 12:12:10 rob
101 * Fixed a problem with packet size.
103 * Revision 1.55 1995/01/05 11:12:36 rob
104 * Reduced packet size by 1 byte just to be safe.
106 * Revision 1.54 1995/01/04 21:39:32 rob
107 * New framedata packet for registered.
109 * Revision 1.53 1995/01/04 08:47:04 rob
110 * JOHN CHECKED IN FOR ROB !!!
112 * Revision 1.52 1994/12/30 20:09:07 rob
113 * ADded a toggle for showing player names on HUD.
115 * Revision 1.51 1994/12/29 15:59:52 rob
116 * Centralized network disconnects.
118 * Revision 1.50 1994/12/09 21:21:57 rob
119 * rolled back changes.
121 * Revision 1.48 1994/12/05 22:59:27 rob
122 * added prototype for send_endlevel_packet.
124 * Revision 1.47 1994/12/05 21:47:34 rob
125 * Added a new field to netgame struct.
127 * Revision 1.46 1994/12/05 14:39:16 rob
128 * Added new variable to indicate new net game starting.
130 * Revision 1.45 1994/12/04 15:37:18 rob
133 * Revision 1.44 1994/12/04 15:30:42 rob
134 * Added new fields to netgame struct.
136 * Revision 1.43 1994/12/03 18:03:19 rob
137 * ADded team kill syncing.
139 * Revision 1.42 1994/12/01 21:21:27 rob
140 * Added new system for object sync on rejoin.
142 * Revision 1.41 1994/11/29 13:07:33 rob
143 * Changed structure defs to .h files.
145 * Revision 1.40 1994/11/22 17:10:48 rob
146 * Fix for secret levels in network play mode.
148 * Revision 1.39 1994/11/18 16:36:31 rob
149 * Added variable network_rejoined to enable random placement
150 * of rejoining palyers.
152 * Revision 1.38 1994/11/12 19:51:13 rob
153 * Changed prototype for network_send_data to pass
156 * Revision 1.37 1994/11/10 21:48:26 rob
157 * Changed net_endlevel to return an int.
159 * Revision 1.36 1994/11/10 20:32:49 rob
160 * Added extern for LastPacketTime.
162 * Revision 1.35 1994/11/09 11:36:34 rob
163 * ADded return value to network_level_sync for success/fail.
165 * Revision 1.34 1994/11/08 21:22:31 rob
166 * Added proto for network_endlevel_snyc
168 * Revision 1.33 1994/11/08 15:20:00 rob
169 * added proto for change_playernum_to
171 * Revision 1.32 1994/11/07 17:45:40 rob
172 * Added prototype for network_endlevel (called from multi.c)
174 * Revision 1.31 1994/11/04 19:52:37 rob
175 * Removed a function from network.h (network_show_player_list)
177 * Revision 1.30 1994/11/01 19:39:26 rob
178 * Removed a couple of variables that should be externed from multi.c
179 * (remnants of the changover)
181 * Revision 1.29 1994/10/31 19:18:24 rob
182 * Changed prototype for network_do_frame to add a parameter if you wish
183 * to force the frame to be sent. Important if this is a leave_game frame.
185 * Revision 1.28 1994/10/08 19:59:20 rob
186 * Removed network message variables.
188 * Revision 1.27 1994/10/08 11:08:38 john
189 * Moved network_delete_unused objects into multi.c,
190 * took out network callsign stuff and used Matt's net
191 * players[.].callsign stuff.
193 * Revision 1.26 1994/10/07 11:26:20 rob
194 * Changed network_start_frame to network_do_frame,.
197 * Revision 1.25 1994/10/05 13:58:10 rob
198 * Added a new function net_endlevel that is called after each level is
199 * completed. Currently it only does anything if SERIAL game is in effect.
201 * Revision 1.24 1994/10/04 19:34:57 rob
202 * export network_find_max_net_players.
204 * Revision 1.23 1994/10/04 17:31:10 rob
205 * Exported MaxNumNetPlayers.
207 * Revision 1.22 1994/10/03 22:57:30 matt
208 * Took out redundant definition of callsign_len
210 * Revision 1.21 1994/10/03 15:12:48 rob
211 * Boosted MAX_CREATE_OBJECTS to 15.
213 * Revision 1.20 1994/09/30 18:19:51 rob
214 * Added two new variables for tracking object creation.
216 * Revision 1.19 1994/09/27 15:03:18 rob
217 * Added prototype for network_delete_extra_objects used by modem.c
219 * Revision 1.18 1994/09/27 14:36:45 rob
220 * Added two new varaibles for network/serial weapon firing.
222 * Revision 1.17 1994/09/07 17:10:57 john
223 * Started adding code to sync powerups.
225 * Revision 1.16 1994/09/06 19:29:05 john
226 * Added trial version of rejoin function.
228 * Revision 1.15 1994/08/26 13:01:54 john
229 * Put high score system in.
231 * Revision 1.14 1994/08/25 18:12:04 matt
232 * Made player's weapons and flares fire from the positions on the 3d model.
233 * Also added support for quad lasers.
235 * Revision 1.13 1994/08/17 16:50:00 john
236 * Added damaging fireballs, missiles.
238 * Revision 1.12 1994/08/16 12:25:22 john
239 * Added hooks for sending messages.
241 * Revision 1.11 1994/08/13 12:20:18 john
242 * Made the networking uise the Players array.
244 * Revision 1.10 1994/08/12 22:41:27 john
245 * Took away Player_stats; add Players array.
247 * Revision 1.9 1994/08/12 03:10:22 john
248 * Made network be default off; Moved network options into
249 * main menu. Made starting net game check that mines are the
252 * Revision 1.8 1994/08/11 21:57:08 john
253 * Moved network options to main menu.
255 * Revision 1.7 1994/08/10 11:29:20 john
256 * *** empty log message ***
258 * Revision 1.6 1994/08/10 10:44:12 john
259 * Made net players fire..
261 * Revision 1.5 1994/08/09 19:31:46 john
262 * Networking changes.
264 * Revision 1.4 1994/08/05 16:30:26 john
265 * Added capability to turn off network.
267 * Revision 1.3 1994/08/05 16:11:43 john
268 * Psuedo working version of networking.
270 * Revision 1.2 1994/07/25 12:33:34 john
271 * Network "pinging" in.
273 * Revision 1.1 1994/07/20 16:09:05 john
287 #define NETSTAT_MENU 0
288 #define NETSTAT_PLAYING 1
289 #define NETSTAT_BROWSING 2
290 #define NETSTAT_WAITING 3
291 #define NETSTAT_STARTING 4
292 #define NETSTAT_ENDLEVEL 5
294 #define CONNECT_DISCONNECTED 0
295 #define CONNECT_PLAYING 1
296 #define CONNECT_WAITING 2
297 #define CONNECT_DIED_IN_MINE 3
298 #define CONNECT_FOUND_SECRET 4
299 #define CONNECT_ESCAPE_TUNNEL 5
300 #define CONNECT_END_MENU 6
305 // defines and other things for appletalk/ipx games on mac
308 #define APPLETALK_GAME 2
310 extern int Network_game_type;
312 #define Network_game_type IPX_GAME
315 typedef struct sequence_packet {
319 netplayer_info player;
320 } __pack__ sequence_packet;
322 #define NET_XDATA_SIZE 454
325 // frame info is aligned -- 01/18/96 -- MWA
326 // if you change this structure -- be sure to keep
328 // bytes on byte boundries
329 // shorts on even byte boundries
330 // ints on even byte boundries
332 typedef struct frame_info {
333 ubyte type; // What type of packet
334 ubyte pad[3]; // Pad out length of frame_info packet
337 vms_matrix obj_orient;
338 vms_vector phys_velocity;
339 vms_vector phys_rotvel;
341 ushort data_size; // Size of data appended to the net packet
343 ubyte obj_render_type;
345 ubyte data[NET_XDATA_SIZE]; // extra data to be tacked on the end
346 } __pack__ frame_info;
348 // short_frame_info is not aligned -- 01/18/96 -- MWA
349 // won't align because of shortpos. Shortpos needs
350 // to stay in current form.
352 typedef struct short_frame_info {
353 ubyte type; // What type of packet
354 ubyte pad[3]; // Pad out length of frame_info packet
357 ushort data_size; // Size of data appended to the net packet
359 ubyte obj_render_type;
361 ubyte data[NET_XDATA_SIZE]; // extra data to be tacked on the end
362 } __pack__ short_frame_info;
364 void network_start_game();
365 void network_join_game();
366 void network_rejoin_game();
367 void network_leave_game();
368 int network_endlevel(int *secret);
369 void network_endlevel_poll2(int nitems, struct newmenu_item * menus, int * key, int citem);
372 int network_level_sync();
373 void network_send_endlevel_packet();
375 int network_delete_extra_objects();
376 int network_find_max_net_players();
377 int network_objnum_is_past(int objnum);
378 char * network_get_player_name(int objnum);
379 void network_send_endlevel_sub(int player_num);
380 void network_disconnect_player(int playernum);
382 extern void network_dump_player(ubyte * server, ubyte *node, int why);
383 extern void network_send_netgame_update();
385 extern int GetMyNetRanking();
387 extern int NetGameType;
388 extern int Network_send_objects;
389 extern int Network_send_objnum;
390 extern int PacketUrgent;
391 extern int Network_rejoined;
393 extern int Network_new_game;
394 extern int Network_status;
396 extern fix LastPacketTime[MAX_PLAYERS];
398 extern ushort my_segments_checksum;
399 // By putting an up-to-20-char-message into Network_message and
400 // setting Network_message_reciever to the player num you want to
401 // send it to (100 for broadcast) the next frame the player will
404 // Call once at the beginning of a frame
405 void network_do_frame(int force, int listen);
407 // Tacks data of length 'len' onto the end of the next
408 // packet that we're transmitting.
409 void network_send_data(ubyte * ptr, int len, int urgent);
411 // returns 1 if hoard.ham available
412 extern int HoardEquipped();
414 #endif /* _NETWORK_H */