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