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.
16 * Defines and exported variables for multi.c
23 #define MAX_MESSAGE_LEN 35
29 // What version of the multiplayer protocol is this?
32 #define MULTI_PROTO_VERSION 3
34 #define MULTI_PROTO_VERSION 4
38 // 1 Descent Shareware
39 // 2 Descent Registered/Commercial
40 // 3 Descent II Shareware
41 // 4 Descent II Commercial
43 // Save multiplayer games?
47 // How many simultaneous network players do we support?
49 #define MAX_NUM_NET_PLAYERS 8
51 #define MULTI_POSITION 0
52 #define MULTI_REAPPEAR 1
55 #define MULTI_REMOVE_OBJECT 4
56 #define MULTI_PLAYER_EXPLODE 5
57 #define MULTI_MESSAGE 6
59 #define MULTI_PLAY_SOUND 8
60 #define MULTI_BEGIN_SYNC 9
61 #define MULTI_CONTROLCEN 10
62 #define MULTI_ROBOT_CLAIM 11
63 #define MULTI_END_SYNC 12
64 #define MULTI_CLOAK 13
65 #define MULTI_ENDLEVEL_START 14
66 #define MULTI_DOOR_OPEN 15
67 #define MULTI_CREATE_EXPLOSION 16
68 #define MULTI_CONTROLCEN_FIRE 17
69 #define MULTI_PLAYER_DROP 18
70 #define MULTI_CREATE_POWERUP 19
71 #define MULTI_CONSISTENCY 20
72 #define MULTI_DECLOAK 21
73 #define MULTI_MENU_CHOICE 22
74 #define MULTI_ROBOT_POSITION 23
75 #define MULTI_ROBOT_EXPLODE 24
76 #define MULTI_ROBOT_RELEASE 25
77 #define MULTI_ROBOT_FIRE 26
78 #define MULTI_SCORE 27
79 #define MULTI_CREATE_ROBOT 28
80 #define MULTI_TRIGGER 29
81 #define MULTI_BOSS_ACTIONS 30
82 #define MULTI_CREATE_ROBOT_POWERUPS 31
83 #define MULTI_HOSTAGE_DOOR 32
85 #define MULTI_SAVE_GAME 33
86 #define MULTI_RESTORE_GAME 34
88 #define MULTI_REQ_PLAYER 35 // Someone requests my player structure
89 #define MULTI_SEND_PLAYER 36 // Sending someone my player structure
90 #define MULTI_MARKER 37
91 #define MULTI_DROP_WEAPON 38
92 #define MULTI_GUIDED 39
93 #define MULTI_STOLEN_ITEMS 40
94 #define MULTI_WALL_STATUS 41 // send to new players
95 #define MULTI_HEARTBEAT 42
96 #define MULTI_KILLGOALS 43
97 #define MULTI_SEISMIC 44
98 #define MULTI_LIGHT 45
99 #define MULTI_START_TRIGGER 46
100 #define MULTI_FLAGS 47
101 #define MULTI_DROP_BLOB 48
102 #define MULTI_POWERUP_UPDATE 49
103 #define MULTI_ACTIVE_DOOR 50
104 #define MULTI_SOUND_FUNCTION 51
105 #define MULTI_CAPTURE_BONUS 52
106 #define MULTI_GOT_FLAG 53
107 #define MULTI_DROP_FLAG 54
108 #define MULTI_ROBOT_CONTROLS 55
109 #define MULTI_FINISH_GAME 56
110 #define MULTI_RANK 57
111 #define MULTI_MODEM_PING 58
112 #define MULTI_MODEM_PING_RETURN 59
113 #define MULTI_ORB_BONUS 60
114 #define MULTI_GOT_ORB 61
115 #define MULTI_DROP_ORB 62
116 #define MULTI_PLAY_BY_PLAY 63
118 #define MULTI_MAX_TYPE 63
120 #define MAX_NET_CREATE_OBJECTS 40
122 #define MAX_MULTI_MESSAGE_LEN 120
124 // Exported functions
126 int objnum_remote_to_local(int remote_obj, int owner);
127 int objnum_local_to_remote(int local_obj, sbyte *owner);
128 void map_objnum_local_to_remote(int local, int remote, int owner);
129 void map_objnum_local_to_local(int objnum);
130 void reset_network_objects(void);
132 void multi_init_objects(void);
133 void multi_show_player_list(void);
134 void multi_do_frame(void);
137 void multi_send_flags(char);
138 void multi_send_fire(void);
139 void multi_send_destroy_controlcen(int objnum, int player);
140 void multi_send_endlevel_start(int);
141 void multi_send_player_explode(char type);
142 void multi_send_message(void);
143 void multi_send_position(int objnum);
144 void multi_send_reappear(void);
145 void multi_send_kill(int objnum);
146 void multi_send_remobj(int objnum);
147 void multi_send_quit(int why);
148 void multi_send_door_open(int segnum, int side,ubyte flag);
149 void multi_send_create_explosion(int player_num);
150 void multi_send_controlcen_fire(vms_vector *to_target, int gun_num, int objnum);
151 void multi_send_cloak(void);
152 void multi_send_decloak(void);
153 void multi_send_create_powerup(int powerup_type, int segnum, int objnum, vms_vector *pos);
154 void multi_send_play_sound(int sound_num, fix volume);
155 void multi_send_audio_taunt(int taunt_num);
156 void multi_send_score(void);
157 void multi_send_trigger(int trigger);
158 void multi_send_hostage_door_status(int wallnum);
159 void multi_send_netplayer_stats_request(ubyte player_num);
160 void multi_send_drop_weapon (int objnum,int seed);
161 void multi_send_drop_marker (int player,vms_vector position,char messagenum,char text[]);
162 void multi_send_guided_info (object *miss,char);
165 void multi_endlevel_score(void);
166 void multi_prep_level(void);
167 int multi_endlevel(int *secret);
168 int multi_menu_poll(void);
169 void multi_leave_game(void);
170 void multi_process_data(char *dat, int len);
171 void multi_process_bigdata(char *buf, int len);
172 void multi_do_death(int objnum);
173 void multi_send_message_dialog(void);
174 int multi_delete_extra_objects(void);
175 void multi_make_ghost_player(int objnum);
176 void multi_make_player_ghost(int objnum);
177 void multi_define_macro(int key);
178 void multi_send_macro(int key);
179 int multi_get_kill_list(int *plist);
180 void multi_new_game(void);
181 void multi_sort_kill_list(void);
182 void multi_reset_stuff(void);
184 void multi_send_data(char *buf, int len, int repeat);
186 int get_team(int pnum);
188 // Exported variables
191 extern int Network_active;
192 extern int Network_laser_gun;
193 extern int Network_laser_fired;
194 extern int Network_laser_level;
195 extern int Network_laser_flags;
196 extern int Netlife_kills,Netlife_killed;
198 extern char multibuf[MAX_MULTI_MESSAGE_LEN+4];
199 extern short Network_laser_track;
201 extern int who_killed_controlcen;
203 extern int Net_create_objnums[MAX_NET_CREATE_OBJECTS];
204 extern int Net_create_loc;
206 extern short kill_matrix[MAX_NUM_NET_PLAYERS][MAX_NUM_NET_PLAYERS];
207 extern short team_kills[2];
209 extern int multi_goto_secret;
211 //do we draw the kill list on the HUD?
212 extern int Show_kill_list;
213 extern int Show_reticle_name;
214 extern fix Show_kill_list_timer;
216 // Used to send network messages
218 extern char Network_message[MAX_MESSAGE_LEN];
219 extern cvar_t Network_message_macro[4];
220 extern int Network_message_reciever;
222 // Which player 'owns' each local object for network purposes
223 extern sbyte object_owner[MAX_OBJECTS];
225 extern int multi_in_menu; // Flag to tell if we're executing GameLoop from within a newmenu.
226 extern int multi_leave_menu;
227 extern int multi_quit_game;
229 extern int multi_sending_message;
230 extern int multi_defining_message;
231 extern void multi_message_input_sub( int key );
232 extern void multi_send_message_start(void);
233 extern void multi_send_message_end(void);
235 extern int multi_powerup_is_4pack(int );
236 extern void multi_send_orb_bonus( char pnum );
237 extern void multi_send_got_orb( char pnum );
238 extern void multi_add_lifetime_kills(void);
240 extern int control_invul_time;
242 #define N_PLAYER_SHIP_TEXTURES 6
244 extern bitmap_index multi_player_textures[MAX_NUM_NET_PLAYERS][N_PLAYER_SHIP_TEXTURES];
246 #define NETGAME_FLAG_CLOSED 1
247 #define NETGAME_FLAG_SHOW_ID 2
248 #define NETGAME_FLAG_SHOW_MAP 4
249 #define NETGAME_FLAG_HOARD 8
250 #define NETGAME_FLAG_TEAM_HOARD 16
251 #define NETGAME_FLAG_REALLY_ENDLEVEL 32
252 #define NETGAME_FLAG_REALLY_FORMING 64
254 #define NETGAME_NAME_LEN 15
255 #define NETGAME_AUX_SIZE 20 // Amount of extra data for the network protocol to store in the netgame packet
257 enum comp_type {DOS,WIN_32,WIN_95,MAC} __pack__ ;
259 // sigh...the socket structure member was moved away from it's friends.
260 // I'll have to create a union for appletalk network info with just
261 // the server and node members since I cannot change the order ot these
264 typedef struct netplayer_info {
265 char callsign[CALLSIGN_LEN+1];
280 enum comp_type computer_type;
287 } __pack__ netplayer_info;
289 typedef struct AllNetPlayers_info
293 struct netplayer_info players[MAX_PLAYERS+4];
294 } __pack__ AllNetPlayers_info;
296 typedef struct netgame_info {
299 char game_name[NETGAME_NAME_LEN+1];
300 char mission_title[MISSION_NAME_LEN+1];
301 char mission_name[9];
308 ubyte max_numplayers;
311 ubyte protocol_version;
316 // change the order of the bit fields for the mac compiler.
317 // doing so will mean I don't have to do screwy things to
318 // send this as network information
320 #ifndef WORDS_BIGENDIAN
326 short DoAfterburner:1;
327 short DoInvulnerability:1;
333 short DoSuperLaser:1;
339 short DoEarthShaker:1;
341 short Allow_marker_view:1;
342 short AlwaysLighting:1;
347 short DoLaserUpgrade:1;
348 short DoQuadLasers:1;
349 short ShowAllNames:1;
350 short BrightPlayers:1;
352 short bitfield_not_used2:1;
357 short DoSuperLaser:1;
363 short DoInvulnerability:1;
364 short DoAfterburner:1;
371 short bitfield_not_used2:1;
373 short BrightPlayers:1;
374 short ShowAllNames:1;
375 short DoQuadLasers:1;
376 short DoLaserUpgrade:1;
381 short AlwaysLighting:1;
382 short Allow_marker_view:1;
384 short DoEarthShaker:1;
389 char team_name[2][CALLSIGN_LEN+1];
390 int locations[MAX_PLAYERS];
391 short kills[MAX_PLAYERS][MAX_PLAYERS];
392 ushort segments_checksum;
394 short killed[MAX_PLAYERS];
395 short player_kills[MAX_PLAYERS];
399 int control_invul_time;
401 int player_score[MAX_PLAYERS];
402 ubyte player_flags[MAX_PLAYERS];
405 ubyte AuxData[NETGAME_AUX_SIZE]; // Storage for protocol-specific data (e.g., multicast session and port)
407 } __pack__ netgame_info;
409 extern struct netgame_info Netgame;
410 extern struct AllNetPlayers_info NetPlayers;
412 int network_i_am_master(void);
413 void change_playernum_to(int new_pnum);
415 //how to encode missiles & flares in weapon packets
416 #define MISSILE_ADJUST 100
417 #define FLARE_ADJUST 127
420 void save_hoard_data(void);
423 #endif /* _MULTI_H */