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/multi.h,v $
18 * $Date: 2002-07-16 08:14:35 $
20 * FIXME: put description here
22 * $Log: not supported by cvs2svn $
23 * Revision 1.4 2002/02/14 09:24:19 bradleyb
26 * Revision 1.3 2002/02/13 10:39:21 bradleyb
27 * Lotsa networking stuff from d1x
29 * Revision 1.2 2001/10/25 02:15:56 bradleyb
30 * conditionalize including multi.h and network.h, fix backslashes
38 #define MAX_MESSAGE_LEN 35
44 // What version of the multiplayer protocol is this?
47 #define MULTI_PROTO_VERSION 3
49 #define MULTI_PROTO_VERSION 4
53 // 1 Descent Shareware
54 // 2 Descent Registered/Commercial
55 // 3 Descent II Shareware
56 // 4 Descent II Commercial
58 // Save multiplayer games?
62 // How many simultaneous network players do we support?
64 #define MAX_NUM_NET_PLAYERS 8
66 #define MULTI_POSITION 0
67 #define MULTI_REAPPEAR 1
70 #define MULTI_REMOVE_OBJECT 4
71 #define MULTI_PLAYER_EXPLODE 5
72 #define MULTI_MESSAGE 6
74 #define MULTI_PLAY_SOUND 8
75 #define MULTI_BEGIN_SYNC 9
76 #define MULTI_CONTROLCEN 10
77 #define MULTI_ROBOT_CLAIM 11
78 #define MULTI_END_SYNC 12
79 #define MULTI_CLOAK 13
80 #define MULTI_ENDLEVEL_START 14
81 #define MULTI_DOOR_OPEN 15
82 #define MULTI_CREATE_EXPLOSION 16
83 #define MULTI_CONTROLCEN_FIRE 17
84 #define MULTI_PLAYER_DROP 18
85 #define MULTI_CREATE_POWERUP 19
86 #define MULTI_CONSISTENCY 20
87 #define MULTI_DECLOAK 21
88 #define MULTI_MENU_CHOICE 22
89 #define MULTI_ROBOT_POSITION 23
90 #define MULTI_ROBOT_EXPLODE 24
91 #define MULTI_ROBOT_RELEASE 25
92 #define MULTI_ROBOT_FIRE 26
93 #define MULTI_SCORE 27
94 #define MULTI_CREATE_ROBOT 28
95 #define MULTI_TRIGGER 29
96 #define MULTI_BOSS_ACTIONS 30
97 #define MULTI_CREATE_ROBOT_POWERUPS 31
98 #define MULTI_HOSTAGE_DOOR 32
100 #define MULTI_SAVE_GAME 33
101 #define MULTI_RESTORE_GAME 34
103 #define MULTI_REQ_PLAYER 35 // Someone requests my player structure
104 #define MULTI_SEND_PLAYER 36 // Sending someone my player structure
105 #define MULTI_MARKER 37
106 #define MULTI_DROP_WEAPON 38
107 #define MULTI_GUIDED 39
108 #define MULTI_STOLEN_ITEMS 40
109 #define MULTI_WALL_STATUS 41 // send to new players
110 #define MULTI_HEARTBEAT 42
111 #define MULTI_KILLGOALS 43
112 #define MULTI_SEISMIC 44
113 #define MULTI_LIGHT 45
114 #define MULTI_START_TRIGGER 46
115 #define MULTI_FLAGS 47
116 #define MULTI_DROP_BLOB 48
117 #define MULTI_POWERUP_UPDATE 49
118 #define MULTI_ACTIVE_DOOR 50
119 #define MULTI_SOUND_FUNCTION 51
120 #define MULTI_CAPTURE_BONUS 52
121 #define MULTI_GOT_FLAG 53
122 #define MULTI_DROP_FLAG 54
123 #define MULTI_ROBOT_CONTROLS 55
124 #define MULTI_FINISH_GAME 56
125 #define MULTI_RANK 57
126 #define MULTI_MODEM_PING 58
127 #define MULTI_MODEM_PING_RETURN 59
128 #define MULTI_ORB_BONUS 60
129 #define MULTI_GOT_ORB 61
130 #define MULTI_DROP_ORB 62
131 #define MULTI_PLAY_BY_PLAY 63
133 #define MULTI_MAX_TYPE 63
135 #define MAX_NET_CREATE_OBJECTS 40
137 #define MAX_MULTI_MESSAGE_LEN 120
139 // Exported functions
141 int objnum_remote_to_local(int remote_obj, int owner);
142 int objnum_local_to_remote(int local_obj, byte *owner);
143 void map_objnum_local_to_remote(int local, int remote, int owner);
144 void map_objnum_local_to_local(int objnum);
146 void multi_init_objects(void);
147 void multi_show_player_list(void);
148 void multi_do_frame(void);
151 void multi_send_flags(char);
152 void multi_send_fire(void);
153 void multi_send_destroy_controlcen(int objnum, int player);
154 void multi_send_endlevel_start(int);
155 void multi_send_player_explode(char type);
156 void multi_send_message(void);
157 void multi_send_position(int objnum);
158 void multi_send_reappear();
159 void multi_send_kill(int objnum);
160 void multi_send_remobj(int objnum);
161 void multi_send_quit(int why);
162 void multi_send_door_open(int segnum, int side,ubyte flag);
163 void multi_send_create_explosion(int player_num);
164 void multi_send_controlcen_fire(vms_vector *to_target, int gun_num, int objnum);
165 void multi_send_cloak(void);
166 void multi_send_decloak(void);
167 void multi_send_create_powerup(int powerup_type, int segnum, int objnum, vms_vector *pos);
168 void multi_send_play_sound(int sound_num, fix volume);
169 void multi_send_audio_taunt(int taunt_num);
170 void multi_send_score(void);
171 void multi_send_trigger(int trigger);
172 void multi_send_hostage_door_status(int wallnum);
173 void multi_send_netplayer_stats_request(ubyte player_num);
174 void multi_send_drop_weapon (int objnum,int seed);
175 void multi_send_drop_marker (int player,vms_vector position,char messagenum,char text[]);
176 void multi_send_guided_info (object *miss,char);
179 void multi_endlevel_score(void);
180 void multi_prep_level(void);
181 int multi_endlevel(int *secret);
182 int multi_menu_poll(void);
183 void multi_leave_game(void);
184 void multi_process_data(char *dat, int len);
185 void multi_process_bigdata(char *buf, int len);
186 void multi_do_death(int objnum);
187 void multi_send_message_dialog(void);
188 int multi_delete_extra_objects(void);
189 void multi_make_ghost_player(int objnum);
190 void multi_make_player_ghost(int objnum);
191 void multi_define_macro(int key);
192 void multi_send_macro(int key);
193 int multi_get_kill_list(int *plist);
194 void multi_new_game(void);
195 void multi_sort_kill_list(void);
196 int multi_choose_mission(int *anarchy_only);
197 void multi_reset_stuff(void);
199 void multi_send_data(char *buf, int len, int repeat);
201 int get_team(int pnum);
203 // Exported variables
206 extern int Network_active;
207 extern int Network_laser_gun;
208 extern int Network_laser_fired;
209 extern int Network_laser_level;
210 extern int Network_laser_flags;
211 extern int Netlife_kills,Netlife_killed;
213 extern int message_length[MULTI_MAX_TYPE+1];
214 extern char multibuf[MAX_MULTI_MESSAGE_LEN+4];
215 extern short Network_laser_track;
217 extern int who_killed_controlcen;
219 extern int Net_create_objnums[MAX_NET_CREATE_OBJECTS];
220 extern int Net_create_loc;
222 extern short kill_matrix[MAX_NUM_NET_PLAYERS][MAX_NUM_NET_PLAYERS];
223 extern short team_kills[2];
225 extern int multi_goto_secret;
227 //do we draw the kill list on the HUD?
228 extern int Show_kill_list;
229 extern int Show_reticle_name;
230 extern fix Show_kill_list_timer;
232 // Used to send network messages
234 extern char Network_message[MAX_MESSAGE_LEN];
235 extern char Network_message_macro[4][MAX_MESSAGE_LEN];
236 extern int Network_message_reciever;
238 // Used to map network to local object numbers
240 extern short remote_to_local[MAX_NUM_NET_PLAYERS][MAX_OBJECTS]; // Network object num for each
241 extern short local_to_remote[MAX_OBJECTS]; // Local object num for each network objnum
242 extern byte object_owner[MAX_OBJECTS]; // Who 'owns' each local object for network purposes
244 extern int multi_in_menu; // Flag to tell if we're executing GameLoop from within a newmenu.
245 extern int multi_leave_menu;
246 extern int multi_quit_game;
248 extern int multi_sending_message;
249 extern int multi_defining_message;
250 extern void multi_message_input_sub( int key );
251 extern void multi_send_message_start();
253 extern int multi_powerup_is_4pack(int );
254 extern void multi_send_orb_bonus( char pnum );
255 extern void multi_send_got_orb( char pnum );
256 extern void multi_add_lifetime_kills(void);
258 extern int control_invul_time;
260 #define N_PLAYER_SHIP_TEXTURES 6
262 extern bitmap_index multi_player_textures[MAX_NUM_NET_PLAYERS][N_PLAYER_SHIP_TEXTURES];
264 #define NETGAME_FLAG_CLOSED 1
265 #define NETGAME_FLAG_SHOW_ID 2
266 #define NETGAME_FLAG_SHOW_MAP 4
267 #define NETGAME_FLAG_HOARD 8
268 #define NETGAME_FLAG_TEAM_HOARD 16
269 #define NETGAME_FLAG_REALLY_ENDLEVEL 32
270 #define NETGAME_FLAG_REALLY_FORMING 64
272 #define NETGAME_NAME_LEN 15
274 enum comp_type {DOS,WIN_32,WIN_95,MAC};
276 // sigh...the socket structure member was moved away from it's friends.
277 // I'll have to create a union for appletalk network info with just
278 // the server and node members since I cannot change the order ot these
281 typedef struct netplayer_info {
282 char callsign[CALLSIGN_LEN+1];
297 enum comp_type computer_type;
306 typedef struct AllNetPlayers_info
310 struct netplayer_info players[MAX_PLAYERS+4];
311 } AllNetPlayers_info;
313 typedef struct netgame_info {
316 char game_name[NETGAME_NAME_LEN+1];
317 char mission_title[MISSION_NAME_LEN+1];
318 char mission_name[9];
325 ubyte max_numplayers;
328 ubyte protocol_version;
333 // change the order of the bit fields for the mac compiler.
334 // doing so will mean I don't have to do screwy things to
335 // send this as network information
343 short DoAfterburner:1;
344 short DoInvulnerability:1;
350 short DoSuperLaser:1;
356 short DoEarthShaker:1;
358 short Allow_marker_view:1;
359 short AlwaysLighting:1;
364 short DoLaserUpgrade:1;
365 short DoQuadLasers:1;
366 short ShowAllNames:1;
367 short BrightPlayers:1;
373 short DoSuperLaser:1;
379 short DoInvulnerability:1;
380 short DoAfterburner:1;
387 short bitfield_not_used2:1;
389 short BrightPlayers:1;
390 short ShowAllNames:1;
391 short DoQuadLasers:1;
392 short DoLaserUpgrade:1;
397 short AlwaysLighting:1;
398 short Allow_marker_view:1;
400 short DoEarthShaker:1;
405 char team_name[2][CALLSIGN_LEN+1];
406 int locations[MAX_PLAYERS];
407 short kills[MAX_PLAYERS][MAX_PLAYERS];
408 ushort segments_checksum;
410 short killed[MAX_PLAYERS];
411 short player_kills[MAX_PLAYERS];
415 int control_invul_time;
417 int player_score[MAX_PLAYERS];
418 ubyte player_flags[MAX_PLAYERS];
422 } __pack__ netgame_info;
424 extern struct netgame_info Netgame;
425 extern struct AllNetPlayers_info NetPlayers;
427 int network_i_am_master(void);
428 void change_playernum_to(int new_pnum);
430 //how to encode missiles & flares in weapon packets
431 #define MISSILE_ADJUST 100
432 #define FLARE_ADJUST 127