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