1 /* $Id: network.h,v 1.10 2002-09-14 00:23:06 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.
22 #define NETSTAT_MENU 0
23 #define NETSTAT_PLAYING 1
24 #define NETSTAT_BROWSING 2
25 #define NETSTAT_WAITING 3
26 #define NETSTAT_STARTING 4
27 #define NETSTAT_ENDLEVEL 5
29 #define CONNECT_DISCONNECTED 0
30 #define CONNECT_PLAYING 1
31 #define CONNECT_WAITING 2
32 #define CONNECT_DIED_IN_MINE 3
33 #define CONNECT_FOUND_SECRET 4
34 #define CONNECT_ESCAPE_TUNNEL 5
35 #define CONNECT_END_MENU 6
40 // defines and other things for appletalk/ipx games on mac
43 #define APPLETALK_GAME 2
45 extern int Network_game_type;
47 #define Network_game_type IPX_GAME
50 typedef struct sequence_packet {
54 netplayer_info player;
55 } __pack__ sequence_packet;
57 #define NET_XDATA_SIZE 454
60 // frame info is aligned -- 01/18/96 -- MWA
61 // if you change this structure -- be sure to keep
63 // bytes on byte boundries
64 // shorts on even byte boundries
65 // ints on even byte boundries
67 typedef struct frame_info {
68 ubyte type; // What type of packet
69 ubyte pad[3]; // Pad out length of frame_info packet
72 vms_matrix obj_orient;
73 vms_vector phys_velocity;
74 vms_vector phys_rotvel;
76 ushort data_size; // Size of data appended to the net packet
78 ubyte obj_render_type;
80 ubyte data[NET_XDATA_SIZE]; // extra data to be tacked on the end
81 } __pack__ frame_info;
83 // short_frame_info is not aligned -- 01/18/96 -- MWA
84 // won't align because of shortpos. Shortpos needs
85 // to stay in current form.
87 typedef struct short_frame_info {
88 ubyte type; // What type of packet
89 ubyte pad[3]; // Pad out length of frame_info packet
92 ushort data_size; // Size of data appended to the net packet
94 ubyte obj_render_type;
96 ubyte data[NET_XDATA_SIZE]; // extra data to be tacked on the end
97 } __pack__ short_frame_info;
99 void network_start_game();
100 void network_join_game();
101 void network_rejoin_game();
102 void network_leave_game();
103 int network_endlevel(int *secret);
104 void network_endlevel_poll2( int nitems, struct newmenu_item * menus, int * key, int citem );
107 int network_level_sync();
108 void network_send_endlevel_packet();
110 int network_delete_extra_objects();
111 int network_find_max_net_players();
112 int network_objnum_is_past(int objnum);
113 char * network_get_player_name( int objnum );
114 void network_send_endlevel_sub(int player_num);
115 void network_disconnect_player(int playernum);
117 extern void network_dump_player(ubyte * server, ubyte *node, int why);
118 extern void network_send_netgame_update();
120 extern int GetMyNetRanking();
122 extern int NetGameType;
123 extern int Network_send_objects;
124 extern int Network_send_objnum;
125 extern int PacketUrgent;
126 extern int Network_rejoined;
128 extern int Network_new_game;
129 extern int Network_status;
131 extern fix LastPacketTime[MAX_PLAYERS];
133 extern ushort my_segments_checksum;
134 // By putting an up-to-20-char-message into Network_message and
135 // setting Network_message_reciever to the player num you want to
136 // send it to (100 for broadcast) the next frame the player will
139 // Call once at the beginning of a frame
140 void network_do_frame(int force, int listen);
142 // Tacks data of length 'len' onto the end of the next
143 // packet that we're transmitting.
144 void network_send_data( ubyte * ptr, int len, int urgent );