2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
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
10 * $Logfile: /Freespace2/code/Network/multi_ingame.h $
16 * Revision 1.2 2002/06/09 04:41:14 relnev
17 * added copyright header
19 * Revision 1.1.1.1 2002/05/03 03:28:12 root
23 * 2 10/07/98 10:53a Dave
26 * 1 10/07/98 10:50a Dave
28 * 12 5/20/98 3:25p Allender
29 * ingame join changes (which probably won't make the final version).
30 * Added RAS code into psnet
32 * 11 3/24/98 5:12p Allender
33 * ingame join packet sequencing
35 * 10 3/14/98 2:48p Dave
36 * Cleaned up observer joining code. Put in support for file xfers to
37 * ingame joiners (observers or not). Revamped and reinstalled pseudo
40 * 9 3/13/98 2:51p Dave
41 * Put in support for observers to join ingame.
43 * 8 3/11/98 11:42p Allender
44 * more ingame join stuff. Fix to networking code to possibly
45 * reinitialize reliable socket when entering join screen
47 * 7 3/06/98 9:33a Allender
48 * more ingame join stuff. Wing packets are done.
50 * 6 3/03/98 8:23p Allender
51 * first pass of getting ingame join to a better state. Started rewriting
52 * the ship/wing list code
54 * 5 2/05/98 11:10a Dave
55 * Fixed an ingame join bug. Fixed a read-only file problem with
56 * multiplayer file xfer.
58 * 4 1/29/98 5:24p Dave
59 * Made ingame join handle bad packets gracefully
61 * 3 1/22/98 5:26p Dave
62 * Modified some pregame sequencing packets. Starting to repair broken
65 * 2 1/21/98 5:58p Dave
66 * Finished ingame join. Coded in multiplayer interface artwork changes.
68 * 1 1/20/98 5:41p Dave
69 * Seperated ingame join functionality into its own module.
74 #ifndef _MULTI_INGAME_JOIN_HEADER_FILE
75 #define _MULTI_INGAME_JOIN_HEADER_FILE
77 // --------------------------------------------------------------------------------------------------
78 // DAVE's BIGASS INGAME JOIN WARNING/DISCLAIMER
80 // Ingame joining is another delicate system. Although not as delicate as server transfer, it will
81 // help to take as many precautions as possible when handling ingame joins. Please be sure to follow
82 // all the same rules as explained in multi_strans.h
84 // --------------------------------------------------------------------------------------------------
86 // --------------------------------------------------------------------------------------------------
87 // INGAME JOIN DESCRIPTION
89 // 1.) Joiner sends a JOIN packet to the server
90 // 2.) If the server accepts him, he receives an ACCEPT packet in return
91 // 3.) The client then moves into the INGAME_SYNC state to begin receiving data from the server
92 // 4.) The first thing he does on this screen is send his filesig packet to the server. At which
93 // point the server will either let him in or deny him. There are no file transfers ingame.
94 // 5.) The server calls multi_handle_ingame_joiners() once per frame, through multi_do_frame()
95 // 6.) After verifiying or kicking the player because of his file signature, the server tells the
96 // player to load the mission
97 // 7.) When the mission is loaded, the server, sends a netgame update to the client
98 // 8.) Without waiting, the server then begins sending data ship packets to the player
99 // 9.) Upon confirmation of receiving these packets, the server sends wing data packets
100 // 10.) Upon completion of this, the server sends respawn point packets
101 // 11.) Upon completion of this, the server sends a post briefing data block packet containing ship class and
102 // weapon information
103 // 12.) After this, the server sends a player settings packet (to all players for good measure)
104 // 13.) At this point, the server sends a jump into mission packet
105 // 14.) Upon receipt of this packet, the client moves into the ingame ship select state
106 // 15.) The first thing the client does in this state is load the mission data (textures, etc)
107 // 16.) The player is presented with a list of ships he can choose from. He selects one and sends
108 // an INGAME_SHIP_REQUEST to the server.
109 // 17.) The server checks to see if this request is acceptable and sends an INGAME_SHIP_REQUEST back
110 // with the appropriate data.
111 // 18.) If the client received an affirmative, he selects the ship and jumps into the mission, otherwise
112 // he removes it from the list and tries for another ship
113 // --------------------------------------------------------------------------------------------------
115 // --------------------------------------------------------------------------------------------------
116 // INGAME JOIN DEFINES
119 // ingame join defines - NOTE : it is important to keep these flags so that they appear
120 // numerically in the order in which the events they represent are done
121 #define INGAME_JOIN_FLAG_SENDING_SETS (1<<0) // sending player settings to him - it is important that this is done _first_
122 #define INGAME_JOIN_FLAG_CAMPAIGN_INFO (1<<1) // sending player settings to him - it is important that this is done _first_
123 #define INGAME_JOIN_FLAG_LOADING_MISSION (1<<2) // player has finished loading the mission
124 #define INGAME_JOIN_FLAG_SENDING_SHIPS (1<<3) // sending ships to an ingame joiner
125 #define INGAME_JOIN_FLAG_SENDING_WINGS (1<<4) // sending wings to an ingame joiner
126 #define INGAME_JOIN_FLAG_SENDING_RPTS (1<<5) // sending respawn points to a player
127 #define INGAME_JOIN_FLAG_SENDING_POST (1<<6) // sending standard post briefing data block
128 #define INGAME_JOIN_FLAG_SENDING_WSS (1<<7) // sending wss slots info
129 #define INGAME_JOIN_FLAG_PICK_SHIP (1<<8) // player is in the "pick" ship screen
130 #define INGAME_JOIN_FLAG_FILE_XFER (1<<9) // player is in the process of downloading the mission file
132 #define INGAME_SHIP_UPDATE_TIME 1500 // update time information for all ships the ingame joiner can see
134 #define INGAME_SHIP_NEXT 0 // another ship to follow
135 #define INGAME_SHIP_WARP_SUPPORT 1 // support ship warping in
136 #define INGAME_SHIP_LIST_EOP 2 // end of packet
137 #define INGAME_SHIP_LIST_EOL 3 // end of list
139 #define INGAME_WING_NEXT 0 // another wing to follow
140 #define INGAME_WING_LIST_EOP 1 // end of packet
141 #define INGAME_WING_LIST_EOL 2 // end of list
143 // defines used for the ingame wings packet
144 #define INGAME_WING_NOT_ARRIVED 1 // wing not yet present
145 #define INGAME_WING_DEPARTED 2 // wing is gone -- never to be seen again
146 #define INGAME_WING_PRESENT 3 // wing is in mission
149 // --------------------------------------------------------------------------------------------------
150 // INGAME JOIN SERVER FUNCTIONS
153 // called on the server to process ingame joiners and move them through the motions of ingame joining
154 void multi_handle_ingame_joiners();
156 // pack the ship into the data string and return bytes processed
157 int multi_deconstruct_ship(ubyte *data, ship *s);
159 // pack the wing into the data string and return bytes processed
160 int multi_deconstruct_wing(ubyte *data, wing *w);
162 // --------------------------------------------------------------------------------------------------
163 // INGAME JOIN CLIENT FUNCTIONS
166 // unpack a ship from the data string and return bytes processed
167 int multi_reconstruct_ship(ubyte *data);
169 // unpack a wing from the data string and return bytes processed
170 int multi_reconstruct_wing(ubyte *data);
172 // the final step for an ingame joining observer - create my observer object, unflag myself as joining and jump into mission
173 void multi_ingame_observer_finish();
176 // --------------------------------------------------------------------------------------------------
177 // INGAME DATA SYNC SCREEN
180 // mission sync screen init function for ingame joining
181 void multi_ingame_sync_init();
183 // mission sync screen do function for ingame joining
184 void multi_ingame_sync_do();
186 // mission sync screen do function for ingame joining
187 void multi_ingame_sync_close();
190 // --------------------------------------------------------------------------------------------------
191 // INGAME SHIP SELECT SCREEN
194 // ingame join ship selection screen init
195 void multi_ingame_select_init();
197 // ingame join ship selection screen do
198 void multi_ingame_select_do();
200 // ingame join ship selection screen close
201 void multi_ingame_select_close();
204 // --------------------------------------------------------------------------------------------------
205 // PACKET HANDLER functions
206 // these are also defined in multimsgs.h, but the implementations are in the module for the sake of convenience
209 // send ship information for the mission to the ingame joiner
210 void send_ingame_ships_packet(net_player *pl);
212 // process ship information for the mission
213 void process_ingame_ships_packet(ubyte *data, header *hinfo);
215 // send wing information for the mission to the ingame joiner
216 void send_ingame_wings_packet(net_player *pl);
218 // process wing information for the mission
219 void process_ingame_wings_packet(ubyte *data, header *hinfo);
221 // send respawn points information to the ingame joiner
222 void send_ingame_respawn_points_packet(net_player *pl = NULL);
224 // process respawn points information for the mission
225 void process_ingame_respawn_points_packet(ubyte *data, header *hinfo);
227 // send Wss_slots data to an ingame joiner
228 void send_ingame_slots_packet(net_player *p);
230 // process Wss_slots data for the mission
231 void process_ingame_slots_packet(ubyte *data, header *hinfo);
233 // send a request or a reply regarding ingame join ship choice
234 void send_ingame_ship_request_packet(int code,int rdata,net_player *pl = NULL);
236 // process an ingame ship request packet
237 void process_ingame_ship_request_packet(ubyte *data, header *hinfo);
239 // for extra mission information
240 void multi_ingame_process_mission_stuff( ubyte *data, header *hinfo );