]> icculus.org git repositories - taylor/freespace2.git/blob - include/multimsgs.h
rendering functions mostly done; more complete shader setup
[taylor/freespace2.git] / include / multimsgs.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Network/multimsgs.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Header file for the building and sending of multiplayer packets
16  *
17  * $Log$
18  * Revision 1.7  2005/10/02 09:30:10  taylor
19  * sync up rest of big-endian network changes.  it should at least be as good as what's in FS2_Open now, only better :)
20  *
21  * Revision 1.6  2004/06/10 23:58:45  tigital
22  * byte-swapping changes for bigendian systems
23  *
24  * Revision 1.5  2003/01/30 19:46:18  relnev
25  * use psnet.h instead of psnet2.h to go inline with everything else (Taylor Richards)
26  *
27  * Revision 1.4  2002/06/09 04:41:14  relnev
28  * added copyright header
29  *
30  * Revision 1.3  2002/05/27 00:40:47  theoddone33
31  * Fix net_addr vs net_addr_t
32  *
33  * Revision 1.2  2002/05/26 20:49:54  theoddone33
34  * More progress
35  *
36  * Revision 1.1.1.1  2002/05/03 03:28:12  root
37  * Initial import.
38  *
39  * 
40  * 31    8/26/99 8:51p Dave
41  * Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
42  * 
43  * 30    8/25/99 4:38p Dave
44  * Updated PXO stuff. Make squad war report stuff much more nicely.
45  * 
46  * 29    8/22/99 5:53p Dave
47  * Scoring fixes. Added self destruct key. Put callsigns in the logfile
48  * instead of ship designations for multiplayer players.
49  * 
50  * 28    8/22/99 1:19p Dave
51  * Fixed up http proxy code. Cleaned up scoring code. Reverse the order in
52  * which d3d cards are detected.
53  * 
54  * 27    8/19/99 10:59a Dave
55  * Packet loss detection.
56  * 
57  * 26    8/16/99 4:05p Dave
58  * Big honking checkin.
59  * 
60  * 25    7/30/99 7:01p Dave
61  * Dogfight escort gauge. Fixed up laser rendering in Glide.
62  * 
63  * 24    7/22/99 7:17p Dave
64  * Fixed excessive whacks in multiplayer.
65  * 
66  * 23    7/08/99 10:53a Dave
67  * New multiplayer interpolation scheme. Not 100% done yet, but still
68  * better than the old way.
69  * 
70  * 22    7/03/99 5:50p Dave
71  * Make rotated bitmaps draw properly in padlock views.
72  * 
73  * 21    6/21/99 7:24p Dave
74  * netplayer pain packet. Added type E unmoving beams.
75  * 
76  * 20    5/14/99 1:59p Andsager
77  * Multiplayer message for subsystem cargo revealed.
78  * 
79  * 19    4/29/99 2:29p Dave
80  * Made flak work much better in multiplayer.
81  * 
82  * 18    4/28/99 11:13p Dave
83  * Temporary checkin of artillery code.
84  * 
85  * 17    4/09/99 2:21p Dave
86  * Multiplayer beta stuff. CD checking.
87  * 
88  * 16    4/02/99 9:55a Dave
89  * Added a few more options in the weapons.tbl for beam weapons. Attempt
90  * at putting "pain" packets into multiplayer.
91  * 
92  * 15    3/10/99 6:50p Dave
93  * Changed the way we buffer packets for all clients. Optimized turret
94  * fired packets. Did some weapon firing optimizations.
95  * 
96  * 14    3/09/99 6:24p Dave
97  * More work on object update revamping. Identified several sources of
98  * unnecessary bandwidth.
99  * 
100  * 13    3/08/99 7:03p Dave
101  * First run of new object update system. Looks very promising.
102  * 
103  * 12    2/23/99 2:29p Dave
104  * First run of oldschool dogfight mode. 
105  * 
106  * 11    2/21/99 6:02p Dave
107  * Fixed standalone WSS packets. 
108  * 
109  * 10    2/17/99 2:11p Dave
110  * First full run of squad war. All freespace and tracker side stuff
111  * works.
112  * 
113  * 9     1/14/99 12:48a Dave
114  * Todo list bug fixes. Made a pass at putting briefing icons back into
115  * FRED. Sort of works :(
116  * 
117  * 8     1/12/99 5:45p Dave
118  * Moved weapon pipeline in multiplayer to almost exclusively client side.
119  * Very good results. Bandwidth goes down, playability goes up for crappy
120  * connections. Fixed object update problem for ship subsystems.
121  * 
122  * 7     11/19/98 8:04a Dave
123  * Full support for D3-style reliable sockets. Revamped packet lag/loss
124  * system, made it receiver side and at the lowest possible level.
125  * 
126  * 6     11/17/98 11:12a Dave
127  * Removed player identification by address. Now assign explicit id #'s.
128  * 
129  * 5     11/12/98 12:13a Dave
130  * Tidied code up for multiplayer test. Put in network support for flak
131  * guns.
132  * 
133  * 4     11/05/98 5:55p Dave
134  * Big pass at reducing #includes
135  * 
136  * 3     10/20/98 1:39p Andsager
137  * Make so sparks follow animated ship submodels.  Modify
138  * ship_weapon_do_hit_stuff() and ship_apply_local_damage() to add
139  * submodel_num.  Add submodel_num to multiplayer hit packet.
140  * 
141  * 2     10/07/98 10:53a Dave
142  * Initial checkin.
143  * 
144  * 1     10/07/98 10:50a Dave
145  * 
146  * 169   9/20/98 7:20p Dave
147  * Added CHANGE_IFF packet. 
148  * 
149  * 168   9/11/98 4:14p Dave
150  * Fixed file checksumming of < file_size. Put in more verbose kicking and
151  * PXO stats store reporting.
152  * 
153  * 167   9/11/98 2:05p Allender
154  * make reinforcements work correctly in multiplayer games.  There still
155  * may be a team vs team issue that I haven't thought of yet :-(
156  * 
157  * 166   8/28/98 3:29p Dave
158  * EMP effect done. AI effects may need some tweaking as required.
159  * 
160  * 165   8/25/98 1:48p Dave
161  * First rev of EMP effect. Player side stuff basically done. Next comes
162  * AI code.
163  * 
164  * 164   6/22/98 8:36a Allender
165  * revamping of homing weapon system.  don't send as object updates
166  * anymore
167  * 
168  * 163   6/10/98 2:56p Dave
169  * Substantial changes to reduce bandwidth and latency problems.
170  * 
171  * 162   5/25/98 10:58a Allender
172  * more object update stuff -- fix duplicate repair ship messages
173  * 
174  * 161   5/20/98 2:24a Dave
175  * Fixed server side voice muting. Tweaked multi debrief/endgame
176  * sequencing a bit. Much friendlier for stats tossing/accepting now.
177  * 
178  * 160   5/18/98 12:41a Allender
179  * fixed subsystem problems on clients (i.e. not reporting properly on
180  * damage indicator).  Fixed ingame join problem with respawns.  minor
181  * comm menu stuff
182  * 
183  * 159   5/13/98 6:54p Dave
184  * More sophistication to PXO interface. Changed respawn checking so
185  * there's no window for desynchronization between the server and the
186  * clients.
187  * 
188  * 158   5/11/98 11:40p Dave
189  * Stuff.
190  * 
191  * 157   5/08/98 11:22a Allender
192  * fix ingame join trouble.  Small messaging fix.  Enable collisions for
193  * friendlies again
194  * 
195  * 156   5/04/98 1:46p Allender
196  * new join procedure which should allow > 10 players accurately.  Fixed a
197  * minor UI problem on join screen
198  * 
199  * 155   4/30/98 12:49a Allender
200  * deal with asteroid problems in multiplayer
201  * 
202  * 154   4/25/98 7:40p Allender
203  * fixd some small hotkey stuff.  Worked on turret orientation being
204  * correct for multiplayer.  new sexpression called end-campaign will will
205  * end the main campaign
206  * 
207  * 153   4/22/98 5:53p Dave
208  * Large reworking of endgame sequencing. Updated multi host options
209  * screen for new artwork. Put in checks for host or team captains leaving
210  * midgame.
211  * 
212  * 152   4/22/98 5:00p Allender
213  * new multiplayer dead popup.  big changes to the comm menu system for  *
214  * team vs. team.  Start of debriefing stuff for team vs. team  Make form
215  * on my wing work with individual ships who have high priority 
216  * orders
217  * 
218  * 151   4/21/98 4:44p Dave
219  * Implement Vasudan ships in multiplayer. Added a debug function to bash
220  * player rank. Fixed a few rtvoice buffer overrun problems. Fixed ui
221  * problem in options screen. 
222  * 
223  * 150   4/20/98 12:40a Allender
224  * fixed nasty problem where network read code was not reentrant.  minor
225  * UI tweaks.  ingame joiners now get netgame info correctly.
226  *
227  * $NoKeywords: $
228  */
229
230
231
232 #ifndef MULTI_MSGS_H
233 #define MULTI_MSGS_H
234
235 #include "pstypes.h"
236 #include "psnet.h"
237
238 struct net_player;
239 struct object;
240 struct ship;
241 struct wing;
242 struct join_request;
243 struct button_info;
244 struct header;
245 struct beam_info;
246 struct ship_subsys;
247
248 // macros for building up packets -- to save on time and typing.  Important to note that local variables
249 // must be named correctly
250 // there are two flavors of sending orientation matrices, 16 bit and 32 bit. Just #define ORIENT_16 to use
251 // 16 bits, otherwise 32 bits is the default
252
253 #define BUILD_HEADER(t) do { data[0]=t; packet_size = HEADER_LENGTH; } while(0)
254 #define ADD_DATA(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); memcpy(data+packet_size, &d, sizeof(d) ); packet_size += sizeof(d); } while (0)
255 #define ADD_SHORT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); short swap = INTEL_SHORT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
256 #define ADD_USHORT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); ushort swap = INTEL_SHORT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
257 #define ADD_INT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); int swap = INTEL_INT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
258 #define ADD_UINT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); uint swap = INTEL_INT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
259 #define ADD_FLOAT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); float swap = INTEL_FLOAT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
260 #define ADD_STRING(s) do { SDL_assert((packet_size + strlen(s) + 4) < MAX_PACKET_SIZE);int len = strlen(s); int len_tmp = INTEL_INT(len); ADD_DATA(len_tmp); memcpy(data+packet_size, s, len ); packet_size += len; } while(0)
261 #define ADD_ORIENT(d) { SDL_assert((packet_size + 17) < MAX_PACKET_SIZE); ubyte dt[17]; multi_pack_orient_matrix(dt,&d); memcpy(data+packet_size,dt,17); packet_size += 17; }
262
263 #define GET_DATA(d) do { memcpy(&d, data+offset, sizeof(d) ); offset += sizeof(d); } while(0)
264 #define GET_SHORT(d) do { short swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_SHORT(swap); offset += sizeof(d); } while(0)
265 #define GET_USHORT(d) do { ushort swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_SHORT(swap); offset += sizeof(d); } while(0)
266 #define GET_INT(d) do { int swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_INT(swap); offset += sizeof(d); } while(0)
267 #define GET_UINT(d) do { uint swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_INT(swap); offset += sizeof(d); } while(0)
268 #define GET_FLOAT(d) do { float swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_FLOAT(swap); offset += sizeof(d); } while(0)
269 #define GET_STRING(s) do { int len;  memcpy(&len, data+offset, sizeof(len)); len = INTEL_INT(len); offset += sizeof(len); memcpy(s, data+offset, len); offset += len; s[len] = '\0'; } while(0)
270 #define GET_ORIENT(d) { ubyte dt[17]; memcpy(dt,data+offset,17); offset+=17; multi_unpack_orient_matrix(dt,&d); }
271
272 #define PACKET_SET_SIZE() do { hinfo->bytes_processed = offset; } while(0)
273
274 // defines for weapon status changes.
275 #define MULTI_PRIMARY_CHANGED           1
276 #define MULTI_SECONDARY_CHANGED 2
277
278 // data sending wrappers
279
280 // send the specified data packet to all players
281 void multi_io_send(net_player *pl, ubyte *data, int length);
282 void multi_io_send_to_all(ubyte *data, int length, net_player *ignore = NULL);
283 void multi_io_send_force(net_player *pl);
284
285 // send the data packet to all players via their reliable sockets
286 void multi_io_send_reliable(net_player *pl, ubyte *data, int length);
287 void multi_io_send_to_all_reliable(ubyte* data, int length, net_player *ignore = NULL);
288 void multi_io_send_reliable_force(net_player *pl);
289
290 // send all buffered packets
291 void multi_io_send_buffered_packets();
292
293
294 // packet handlers -------------------------------------------------------------------------------
295
296 // process an incoming join request packet
297 void process_join_packet( ubyte* data, header* hinfo );
298
299 // process an accept packet from the server
300 void process_accept_packet( ubyte* data, header* hinfo );
301
302 // process a notification for a new player who has joined the game
303 void process_new_player_packet(ubyte* data, header* hinfo);
304
305 // process an incoming hud message packet
306 void process_hud_message(ubyte* data, header* hinfo);
307
308 // process a notification the a player has left the game
309 void process_leave_game_packet(ubyte* data, header* hinfo);
310
311 // process information about an active game
312 void process_game_active_packet(ubyte* data, header* hinfo);
313
314 // process a query from a client looking for active freespace games
315 void process_game_query(ubyte* data, header* hinfo);
316
317 // process a general game chat packet, if we're the standalone we should rebroadcast
318 void process_game_chat_packet( ubyte *data, header *hinfo );
319
320 // process a game information update
321 void process_game_info_packet( ubyte *data, header *hinfo );
322
323 void process_team_update_packet(ubyte *data, header *hinfo);
324
325 // process a packet indicating a secondary weapon was fired
326 void process_secondary_fired_packet(ubyte* data, header* hinfo, int flag);
327
328 // process a packet indicating a countermeasure was fired
329 void process_countermeasure_fired_packet( ubyte *data, header *hinfo );
330
331 // process information about the netgame sent from the server/host
332 void process_netgame_update_packet( ubyte *data, header *hinfo );
333
334 // process an incoming netgame description packet
335 void process_netgame_descript_packet( ubyte *data, header *hinfo );
336
337 // process an incoming netplayer state update. if we're the server, we should rebroadcast
338 void process_netplayer_update_packet( ubyte *data, header *hinfo );
339
340 void process_ship_status_packet(ubyte *data, header *hinfo);
341 void process_player_order_packet(ubyte *data, header *hinfo);
342
343 // process an object update packet.  See send_object_update for information on how
344 // this packet data should be interpreted.  We send different information depending on
345 // on several variables (no change in orienation, etc).
346 void process_object_update_packet( ubyte *data, header *hinfo );
347
348 // process a packet indicating that a ship has been killed
349 void process_ship_kill_packet( ubyte *data, header *hinfo );
350
351 // process a packet saying that a wing should be created
352 void process_wing_create_packet( ubyte *data, header *hinfo );
353
354 // process a packet indicating a ship should be created
355 void process_ship_create_packet( ubyte *data, header *hinfo );
356
357 // process a packet indicating a ship is departing
358 void process_ship_depart_packet( ubyte *data, header *hinfo );
359
360 // process a mission log item packet
361 void process_mission_log_packet( ubyte *data, header *hinfo );
362
363 // process a mission message packet
364 void process_mission_message_packet( ubyte *data, header *hinfo );
365
366 // just send them a pong back as fast as possible
367 void process_ping_packet(ubyte *data, header *hinfo);
368
369 // right now it just routes the pong through to the standalone gui, which is the only
370 // system which uses ping and pong right now.
371 void process_pong_packet(ubyte *data, header *hinfo);
372
373 // process a request for a list of missions
374 void process_mission_request_packet(ubyte *data, header *hinfo);
375
376 // process an individual mission file item
377 void process_mission_item_packet(ubyte *data, header *hinfo);
378
379 // process a pause update packet (pause, unpause, etc)
380 void process_multi_pause_packet(ubyte *data, header *hinfo);
381
382 // process an ingame nak packet
383 void process_ingame_nak(ubyte *data, header *hinfo);
384
385 void process_ingame_ships_packet(ubyte *data, header *hinfo);
386 void process_ingame_wings_packet(ubyte *data, header *hinfo);
387
388 // process a packet indicating we should end the current mission
389 void process_endgame_packet(ubyte *data, header *hinfo);
390
391 // process a position/orientation update from an observer
392 void process_observer_update_packet(ubyte *data, header *hinfo);
393
394 void process_netplayer_slot_packet(ubyte *data, header *hinfo);
395 void process_netplayer_class_packet(ubyte *data, header *hinfo);
396
397 void process_subsys_update_packet(ubyte *data, header *hinfo);
398
399 void process_ingame_ship_update_packet(ubyte *data, header *hinfo);
400
401 void process_file_sig_packet(ubyte *data, header *hinfo);
402 void process_file_sig_request(ubyte *data, header *hinfo);
403
404 void process_ingame_respawn_points_packet(ubyte *data, header *hinfo);
405
406 void process_subsystem_destroyed_packet( ubyte *data, header *hinfo );
407
408 void process_netplayer_load_packet(ubyte *data, header *hinfo);
409
410 void process_jump_into_mission_packet(ubyte *data, header *hinfo);
411
412 void process_repair_info_packet(ubyte *data, header *hinfo);
413
414 void process_mission_sync_packet(ubyte *data, header *hinfo);
415
416 void process_store_stats_packet(ubyte *data, header *hinfo);
417
418 void process_debris_update_packet(ubyte *data, header *hinfo);
419
420 void process_ship_weapon_state_packet(ubyte *data, header *hinfo );
421 void process_ship_weapon_change( ubyte *data, header *hinfo );
422
423 void process_firing_info_packet( ubyte *data, header *hinfo );
424
425 // process a cargo revealed packet
426 void process_cargo_revealed_packet( ubyte *data, header *hinfo );
427
428 void process_subsystem_cargo_revealed_packet( ubyte *data, header *hinfo );
429
430 void process_mission_goal_info_packet( ubyte *data, header *hinfo );
431
432 void process_player_kick_packet(ubyte *data, header *hinfo);
433
434 void process_player_settings_packet(ubyte *data, header *hinfo);
435
436 void process_deny_packet(ubyte *data, header *hinfo);
437
438 void process_post_sync_data_packet(ubyte *data, header *hinfo);
439
440 void process_wss_slots_data_packet(ubyte *data, header *hinfo);
441
442 void process_shield_explosion_packet( ubyte *data, header *hinfo );
443
444 void process_player_stats_block_packet(ubyte *data, header *hinfo);
445
446 void process_host_restr_packet(ubyte *data, header *hinfo);
447
448 void process_netgame_end_error_packet(ubyte *data, header *hinfo);
449
450 void process_client_update_packet(ubyte *data, header *hinfo);
451
452 void process_countdown_packet(ubyte *data, header *hinfo);
453
454 // send a join packet request to the specified address (should be a server)
455 void send_join_packet(net_addr_t* addr,join_request *jr);
456
457 // send an accept packet to a client in response to a request to join the game
458 void send_accept_packet(int new_player_num, int code, int ingame_join_team = -1);
459
460 // send a general game chat packet (if msg_mode == MULTI_MSG_TARGET, need to pass in "to", if == MULTI_MSG_EXPR, need to pass in expr)
461 void send_game_chat_packet(net_player *from, const char *msg, int msg_mode, net_player *to = NULL, const char *expr = NULL,int server_msg = 0);
462
463 // send a game information update
464 void send_game_info_packet( void );
465
466 // send a notice that the player at net_addr is leaving (if target is NULL, the broadcast the packet)
467 void send_leave_game_packet(short player_id = -1,int kicked_reason = -1,net_player *target = NULL);
468
469 // send a packet indicating a secondary weapon was fired
470 void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting_count, int num_fired, int allow_swarm );
471
472 // send a packet indicating a countermeasure was fired
473 void send_countermeasure_fired_packet( object *objp, int cmeasure_count, int rand_val );
474
475
476
477 // send_game_update_packet sends an updated Netgame structure to all players currently connected.  The update
478 // is used to change the current mission, current state, etc.
479 void send_netgame_update_packet(net_player *pl = NULL);
480
481 // sends information about netplayers in the game. if called on the server, broadcasts information about _all_ players
482 void send_netplayer_update_packet( net_player *pl = NULL );
483
484 void send_ship_status_packet(net_player *pl, button_info *bi, int id);
485 void send_player_order_packet(int type, int index, int command);
486
487 // send a request or a reply for mission description, if code == 0, request, if code == 1, reply
488 void send_netgame_descript_packet(net_addr_t *addr, int code);
489
490 // send object update packet sends object updates for all objects in the game.  This function will be smart
491 // about sending only certain objects to certain players based on the players distance from an object, whether
492 // the object is behind the player, etc.
493 void send_object_update_packet(int force_all = 0);
494
495 // send a packet indicating a ship has been killed
496 void send_ship_kill_packet( object *ship_obj, object *other_objp, float percent_killed, int self_destruct );
497
498 // send a packet indicating a wing of ships should be created
499 void send_wing_create_packet( wing *wingp, int num_to_create, int pre_create_count );
500
501 // send a packet indicating a ship should be created
502 void send_ship_create_packet( object *objp, int is_support = 0 );
503
504 // packet indicating a ship is departing
505 void send_ship_depart_packet( object *objp );
506
507 // send a mission log item packet
508 void send_mission_log_packet( int entry );
509
510 // send a mission message packet
511 void send_mission_message_packet(int id, const char *who_from, int priority, int timing, int source, int builtin_type, int multi_target, int multi_team_filter);
512
513 // broadcast a query for active games. IPX will use net broadcast and TCP will either request from the MT or from the specified list
514 void broadcast_game_query();
515
516 // send an individual query to an address to see if there is an active game
517 void send_server_query(net_addr_t *addr);
518
519 // broadcast a hud message to all players
520 void send_hud_msg_to_all( char* msg );
521 void send_heartbeat();
522
523 // send a ping packet
524 void send_ping(net_addr_t *addr);
525
526 // send a pong packet
527 void send_pong(net_addr_t *addr);
528
529 // sent from host to master. give me the list of missions you have.
530 // this will be used only in a standalone mode
531 void send_mission_list_request( int what );
532
533 // send an individual mission file item
534 void send_mission_item(net_player *pl,char *file_name,char *mission_name);
535
536 // send a request to the server to pause or unpause the game
537 void send_multi_pause_packet(int pause);
538
539 // send an ack packet
540 void send_ingame_ack(int state,net_player *p);
541
542 // send an ingame nak packet
543 void send_ingame_nak(int state,net_player *p);
544
545 void send_ingame_ships_packet(net_player *pl);
546 void send_ingame_wings_packet(net_player *pl);
547
548 // send a notification that a new player has joined the game (if target != NULL, broadcast the packet)
549 void send_new_player_packet(int new_player_num,net_player *target);
550
551 // send a packet telling players to end the mission
552 void send_endgame_packet(net_player *pl = NULL);
553
554 // send a position/orientation update for myself (if I'm an observer)
555 void send_observer_update_packet();
556
557 void send_netplayer_slot_packet();
558
559 void send_subsys_update_packet(net_player *p);
560
561 void send_ingame_ship_update_packet(net_player *p,ship *sp);
562
563 void send_ingame_final_packet(int net_sig);
564
565 void send_file_sig_packet(ushort sum_sig,int length_sig);
566 void send_file_sig_request(char *file_name);
567
568 void send_subsystem_destroyed_packet( ship *shipp, int index, vector worldpos );
569
570 void send_netplayer_load_packet(net_player *pl);
571
572 void send_jump_into_mission_packet(net_player *pl = NULL);
573
574 void send_repair_info_packet(object *repaired_objp, object *repair_objp, int code );
575
576 void send_mission_sync_packet(int mode,int start_campaign = 0);
577
578 void send_store_stats_packet(int accept);
579
580 void send_debris_create_packet(object *objp, ushort net_signature, int model_num, vector exp_center );
581 void send_debris_update_packet(object *objp,int code);
582
583 void send_ship_weapon_change( ship *shipp, int what, int new_bank, int link_status );
584
585 // ALAN BEGIN
586
587 // send a request from the client to the host of the game (which is not necessarily the server in the case of the standalone) 
588 // mode == WSS_WEAPON_SELECT  or  WSS_SHIP_SELECT
589 void send_wss_request_packet(short player_id, int from_slot,int from_index, int to_slot, int to_index, int wl_ship_slot, int ship_class, int mode,net_player *p = NULL);
590 void process_wss_request_packet(ubyte *data, header *hinfo);
591
592 // send the update from the host to the clients
593 // wss_data is the pointer to a block of data returned by store_wss_stuff(...)
594 // 
595 // I would reccomend :
596 // int store_wss_data(ubyte *block);            // which returns bytes processed
597 // 
598 // so you would say :
599 // 
600 // ubyte block[MAX_PACKET_SIZE - 10 or so];
601 // int processed = store_wss_data(block);
602 // send_wss_update_packet(block,processed);
603 // 
604 // also :
605 // I would reccomend :
606 // int restore_wss_data(ubyte *block);          // which returns bytes processed
607 // 
608 // so I would say in the process_wss_update_packet() :
609 //
610 // int processed = restore_wss_data(block);
611 //      do_other_lowlevel_packet_related_stuff_here();
612 //
613 void send_wss_update_packet(int team_num,ubyte *wss_data,int size);
614 void process_wss_update_packet(ubyte *data, header *hinfo);
615 // ALAN END
616
617 void send_firing_info_packet(void);
618
619 void send_sh_transfer_complete_packet(int code);
620
621 // packet to tell clients cargo of a ship was revealed to all
622 void send_cargo_revealed_packet(ship *shipp);
623
624 void send_subsystem_cargo_revealed_packet(ship *shipp, int index);
625
626 void send_mission_goal_info_packet(int goal_num, int new_status, int valid);
627
628 void send_player_settings_packet(net_player *p = NULL);
629
630 void send_deny_packet(net_addr_t *addr, int code);
631
632 void send_post_sync_data_packet(net_player *p = NULL, int std_request = 1);
633
634 void send_wss_slots_data_packet(int team_num, int final, net_player *p = NULL, int std_request = 1);
635
636 void send_shield_explosion_packet(int objnum, int tri_num, vector hit_pos);
637
638 void send_player_stats_block_packet(net_player *pl, int stats_type, net_player *target = NULL);
639
640 void send_host_restr_packet(const char *callsign, int code, int mode);
641
642 void send_netgame_end_error_packet(int notify_code, int err_code);
643
644 void send_client_update_packet(net_player *pl);
645
646 // send information about this currently active game to the specified address
647 void send_game_active_packet(net_addr_t* addr);
648
649 void send_ai_info_update_packet(object *objp, char what);
650 void process_ai_info_update_packet(ubyte *data, header *hinfo);
651
652 void send_asteroid_create(object *new_objp, object *parent_objp, int asteroid_type, vector *relvec);
653 void send_asteroid_throw(object *objp);
654 void send_asteroid_hit(object *objp, object *other_objp, vector *hitpos, float damage);
655 void process_asteroid_info(ubyte *data, header *hinfo);
656
657 void send_countermeasure_success_packet(int objnum);
658 void process_countermeasure_success_packet(ubyte *data, header *hinfo);
659
660 // host sends a -1 to the server to begin the countdown. server sends an int "seconds until start"
661 void send_countdown_packet(int time);
662
663 void send_debrief_info(int stage_count[], int *stage_active[]);
664 void process_debrief_info(ubyte *data, header *hinfo);
665
666 void send_accept_player_data(net_player *npp, int is_ingame);
667 void process_accept_player_data(ubyte *data, header *hinfo);
668
669 void send_homing_weapon_info(int num);
670 void process_homing_weapon_info(ubyte *data, header *hinfo);
671
672 // emp effect stuff
673 void send_emp_effect(ushort net_sig, float intensity, float time);
674 void process_emp_effect(ubyte *data, header *hinfo);
675
676 // for reinforcements
677 void send_reinforcement_avail( int rnum );
678 void process_reinforcement_avail( ubyte *data, header *hinfo );
679
680 // change iff stuff
681 void send_change_iff_packet(ushort net_signature, int new_team);
682 void process_change_iff_packet( ubyte *data, header *hinfo);
683
684 // new primary fired info
685 void send_NEW_primary_fired_packet(ship *shipp, int banks_fired);
686 void process_NEW_primary_fired_packet(ubyte *data, header *hinfo);
687
688 // new countermeasure fired info
689 void send_NEW_countermeasure_fired_packet(object *objp, int cmeasure_count, int rand_val);
690 void process_NEW_countermeasure_fired_packet(ubyte *data, header *hinfo);
691
692 // beam weapon packet
693 void send_beam_fired_packet(object *shooter, ship_subsys *turret, object *target, int beam_info_index, beam_info *override);
694 void process_beam_fired_packet(ubyte *data, header *hinfo);
695
696 // sw std query packet
697 void send_sw_query_packet(ubyte code, char *txt);
698 void process_sw_query_packet(ubyte *data, header *hinfo);
699
700 // event update packet
701 void send_event_update_packet(int event);
702 void process_event_update_packet(ubyte *data, header *hinfo);
703
704 // weapon detonate packet
705 void send_weapon_detonate_packet(object *objp);
706 void process_weapon_detonate_packet(ubyte *data, header *hinfo);
707
708 // turret fired packet
709 void send_turret_fired_packet( int objnum, int subsys_index, int weapon_objnum );
710 void process_turret_fired_packet( ubyte *data, header *hinfo );
711
712 // flak fired packet
713 void send_flak_fired_packet(int ship_objnum, int subsys_index, int weapon_objnum, float flak_range);
714 void process_flak_fired_packet(ubyte *data, header *hinfo);
715
716 // player pain packet
717 void send_player_pain_packet(net_player *pl, int weapon_info_index, float damage, vector *force, vector *hitpos);
718 void process_player_pain_packet(ubyte *data, header *hinfo);
719
720 // lightning packet
721 void send_lightning_packet(int bolt_type, vector *start, vector *strike);
722 void process_lightning_packet(ubyte *data, header *hinfo);
723
724 // bytes sent
725 void send_bytes_recvd_packet(net_player *pl);
726 void process_bytes_recvd_packet(ubyte *data, header *hinfo);
727
728 // host transfer
729 void send_host_captain_change_packet(short player_id, int captain_change);
730 void process_host_captain_change_packet(ubyte *data, header *hinfo);
731
732 // self destruct
733 void send_self_destruct_packet();
734 void process_self_destruct_packet(ubyte *data, header *hinfo);
735
736 #endif
737