1 /* $Id: network.h,v 1.13 2004-08-28 23:17:45 schaffner 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.
29 #define NETSTAT_MENU 0
30 #define NETSTAT_PLAYING 1
31 #define NETSTAT_BROWSING 2
32 #define NETSTAT_WAITING 3
33 #define NETSTAT_STARTING 4
34 #define NETSTAT_ENDLEVEL 5
36 #define CONNECT_DISCONNECTED 0
37 #define CONNECT_PLAYING 1
38 #define CONNECT_WAITING 2
39 #define CONNECT_DIED_IN_MINE 3
40 #define CONNECT_FOUND_SECRET 4
41 #define CONNECT_ESCAPE_TUNNEL 5
42 #define CONNECT_END_MENU 6
47 // defines and other things for appletalk/ipx games on mac
50 #define APPLETALK_GAME 2
52 extern int Network_game_type;
54 #define Network_game_type IPX_GAME
57 typedef struct sequence_packet {
61 netplayer_info player;
62 } __pack__ sequence_packet;
64 #define NET_XDATA_SIZE 454
67 // frame info is aligned -- 01/18/96 -- MWA
68 // if you change this structure -- be sure to keep
70 // bytes on byte boundries
71 // shorts on even byte boundries
72 // ints on even byte boundries
74 typedef struct frame_info {
75 ubyte type; // What type of packet
76 ubyte pad[3]; // Pad out length of frame_info packet
79 vms_matrix obj_orient;
80 vms_vector phys_velocity;
81 vms_vector phys_rotvel;
83 ushort data_size; // Size of data appended to the net packet
85 ubyte obj_render_type;
87 ubyte data[NET_XDATA_SIZE]; // extra data to be tacked on the end
88 } __pack__ frame_info;
90 // short_frame_info is not aligned -- 01/18/96 -- MWA
91 // won't align because of shortpos. Shortpos needs
92 // to stay in current form.
94 typedef struct short_frame_info {
95 ubyte type; // What type of packet
96 ubyte pad[3]; // Pad out length of frame_info packet
99 ushort data_size; // Size of data appended to the net packet
101 ubyte obj_render_type;
103 ubyte data[NET_XDATA_SIZE]; // extra data to be tacked on the end
104 } __pack__ short_frame_info;
106 void network_start_game();
107 void network_join_game();
108 void network_rejoin_game();
109 void network_leave_game();
110 int network_endlevel(int *secret);
111 void network_endlevel_poll2(int nitems, struct newmenu_item * menus, int * key, int citem);
114 int network_level_sync();
115 void network_send_endlevel_packet();
117 int network_delete_extra_objects();
118 int network_find_max_net_players();
119 int network_objnum_is_past(int objnum);
120 char * network_get_player_name(int objnum);
121 void network_send_endlevel_sub(int player_num);
122 void network_disconnect_player(int playernum);
124 extern void network_dump_player(ubyte * server, ubyte *node, int why);
125 extern void network_send_netgame_update();
127 extern int GetMyNetRanking();
129 extern int NetGameType;
130 extern int Network_send_objects;
131 extern int Network_send_objnum;
132 extern int PacketUrgent;
133 extern int Network_rejoined;
135 extern int Network_new_game;
136 extern int Network_status;
138 extern fix LastPacketTime[MAX_PLAYERS];
140 extern ushort my_segments_checksum;
141 // By putting an up-to-20-char-message into Network_message and
142 // setting Network_message_reciever to the player num you want to
143 // send it to (100 for broadcast) the next frame the player will
146 // Call once at the beginning of a frame
147 void network_do_frame(int force, int listen);
149 // Tacks data of length 'len' onto the end of the next
150 // packet that we're transmitting.
151 void network_send_data(ubyte * ptr, int len, int urgent);
153 // returns 1 if hoard.ham available
154 extern int HoardEquipped();
156 #endif /* _NETWORK_H */