2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
15 * $Source: /cvs/cvsroot/d2x/main/network.h,v $
18 * $Date: 2002-07-16 08:14:35 $
20 * FIXME: put description here
22 * $Log: not supported by cvs2svn $
23 * Revision 1.6 2002/02/14 09:24:19 bradleyb
26 * Revision 1.5 2002/02/13 10:39:22 bradleyb
27 * Lotsa networking stuff from d1x
29 * Revision 1.4 2001/10/25 02:15:57 bradleyb
30 * conditionalize including multi.h and network.h, fix backslashes
42 #define NETSTAT_MENU 0
43 #define NETSTAT_PLAYING 1
44 #define NETSTAT_BROWSING 2
45 #define NETSTAT_WAITING 3
46 #define NETSTAT_STARTING 4
47 #define NETSTAT_ENDLEVEL 5
49 #define CONNECT_DISCONNECTED 0
50 #define CONNECT_PLAYING 1
51 #define CONNECT_WAITING 2
52 #define CONNECT_DIED_IN_MINE 3
53 #define CONNECT_FOUND_SECRET 4
54 #define CONNECT_ESCAPE_TUNNEL 5
55 #define CONNECT_END_MENU 6
60 // defines and other things for appletalk/ipx games on mac
63 #define APPLETALK_GAME 2
65 extern int Network_game_type;
67 #define Network_game_type IPX_GAME
70 typedef struct sequence_packet {
74 netplayer_info player;
75 } __pack__ sequence_packet;
77 #define NET_XDATA_SIZE 454
80 // frame info is aligned -- 01/18/96 -- MWA
81 // if you change this structure -- be sure to keep
83 // bytes on byte boundries
84 // shorts on even byte boundries
85 // ints on even byte boundries
87 typedef struct frame_info {
88 ubyte type; // What type of packet
89 ubyte pad[3]; // Pad out length of frame_info packet
92 vms_matrix obj_orient;
93 vms_vector phys_velocity;
94 vms_vector phys_rotvel;
96 ushort data_size; // Size of data appended to the net packet
98 ubyte obj_render_type;
100 ubyte data[NET_XDATA_SIZE]; // extra data to be tacked on the end
101 } __pack__ frame_info;
103 // short_frame_info is not aligned -- 01/18/96 -- MWA
104 // won't align because of shortpos. Shortpos needs
105 // to stay in current form.
107 typedef struct short_frame_info {
108 ubyte type; // What type of packet
109 ubyte pad[3]; // Pad out length of frame_info packet
112 ushort data_size; // Size of data appended to the net packet
114 ubyte obj_render_type;
116 ubyte data[NET_XDATA_SIZE]; // extra data to be tacked on the end
117 } __pack__ short_frame_info;
119 void network_start_game();
120 void network_join_game();
121 void network_rejoin_game();
122 void network_leave_game();
123 int network_endlevel(int *secret);
124 void network_endlevel_poll2( int nitems, struct newmenu_item * menus, int * key, int citem );
126 int network_level_sync();
127 void network_send_endlevel_packet();
129 int network_delete_extra_objects();
130 int network_find_max_net_players();
131 int network_objnum_is_past(int objnum);
132 char * network_get_player_name( int objnum );
133 void network_send_endlevel_sub(int player_num);
135 void network_disconnect_player(int playernum);
137 extern int NetGameType;
138 extern int Network_send_objects;
139 extern int Network_send_objnum;
140 extern int PacketUrgent;
141 extern int Network_rejoined;
143 extern int Network_new_game;
144 extern int Network_status;
146 extern fix LastPacketTime[MAX_PLAYERS];
148 extern ushort my_segments_checksum;
150 extern int Network_initial_pps;
151 extern int Network_initial_shortpackets;
153 // By putting an up-to-20-char-message into Network_message and
154 // setting Network_message_reciever to the player num you want to
155 // send it to (100 for broadcast) the next frame the player will
158 // Call once at the beginning of a frame
159 void network_do_frame(int force, int listen);
161 // Tacks data of length 'len' onto the end of the next
162 // packet that we're transmitting.
163 void network_send_data( ubyte * ptr, int len, int urgent );
165 void network_send_objects(void);
166 void network_dump_player(ubyte * server, ubyte *node, int why);
167 void network_send_game_info(sequence_packet *their);
169 int GetMyNetRanking();
172 #define PID_LITE_INFO 43
173 #define PID_SEND_ALL_GAMEINFO 44
174 #define PID_PLAYERSINFO 45
175 #define PID_REQUEST 46
178 #define PID_ADDPLAYER 49
180 #define PID_ENDLEVEL 52
181 #define PID_QUIT_JOINING 54
182 #define PID_OBJECT_DATA 55
183 #define PID_GAME_LIST 56
184 #define PID_GAME_INFO 57
185 #define PID_PING_SEND 58
186 #define PID_PING_RETURN 59
187 #define PID_GAME_UPDATE 60
188 #define PID_ENDLEVEL_SHORT 61
189 #define PID_NAKED_PDATA 62
190 #define PID_GAME_PLAYERS 63
191 #define PID_NAMES_RETURN 64
193 #define PID_SHORTPDATA 42
194 #define PID_D2X_GAME_INFO_REQ 65
195 #define PID_D2X_GAME_LITE 68
196 #define PID_PDATA_SHORT2 70
198 #define NETGAME_ANARCHY 0
199 #define NETGAME_TEAM_ANARCHY 1
200 #define NETGAME_ROBOT_ANARCHY 2
201 #define NETGAME_COOPERATIVE 3
202 #define NETGAME_CAPTURE_FLAG 4
203 #define NETGAME_HOARD 5
204 #define NETGAME_TEAM_HOARD 6
206 typedef struct endlevel_info {
211 short kill_matrix[MAX_PLAYERS][MAX_PLAYERS];
214 } __pack__ endlevel_info;