]> icculus.org git repositories - taylor/freespace2.git/blob - include/multi_ingame.h
rendering functions mostly done; more complete shader setup
[taylor/freespace2.git] / include / multi_ingame.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/multi_ingame.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * $Log$
16  * Revision 1.2  2002/06/09 04:41:14  relnev
17  * added copyright header
18  *
19  * Revision 1.1.1.1  2002/05/03 03:28:12  root
20  * Initial import.
21  *
22  * 
23  * 2     10/07/98 10:53a Dave
24  * Initial checkin.
25  * 
26  * 1     10/07/98 10:50a Dave
27  * 
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
31  * 
32  * 11    3/24/98 5:12p Allender
33  * ingame join packet sequencing
34  * 
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
38  * lag/loss system.
39  * 
40  * 9     3/13/98 2:51p Dave
41  * Put in support for observers to join ingame.
42  * 
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
46  * 
47  * 7     3/06/98 9:33a Allender
48  * more ingame join stuff.  Wing packets are done.
49  * 
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
53  * 
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.
57  * 
58  * 4     1/29/98 5:24p Dave
59  * Made ingame join handle bad packets gracefully
60  * 
61  * 3     1/22/98 5:26p Dave
62  * Modified some pregame sequencing packets. Starting to repair broken
63  * standalone stuff.
64  * 
65  * 2     1/21/98 5:58p Dave
66  * Finished ingame join. Coded in multiplayer interface artwork changes.
67  * 
68  * 1     1/20/98 5:41p Dave
69  * Seperated ingame join functionality into its own module.
70  *
71  * $NoKeywords: $
72  */
73
74 #ifndef _MULTI_INGAME_JOIN_HEADER_FILE
75 #define _MULTI_INGAME_JOIN_HEADER_FILE
76
77 // --------------------------------------------------------------------------------------------------
78 // DAVE's BIGASS INGAME JOIN WARNING/DISCLAIMER
79 //
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
83 //
84 // --------------------------------------------------------------------------------------------------
85
86 // --------------------------------------------------------------------------------------------------
87 // INGAME JOIN DESCRIPTION
88 //
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 // --------------------------------------------------------------------------------------------------
114
115 // --------------------------------------------------------------------------------------------------
116 // INGAME JOIN DEFINES
117 //
118
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
131
132 #define INGAME_SHIP_UPDATE_TIME                         1500            // update time information for all ships the ingame joiner can see
133
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
138
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
142
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
147
148
149 // --------------------------------------------------------------------------------------------------
150 // INGAME JOIN SERVER FUNCTIONS
151 //
152
153 // called on the server to process ingame joiners and move them through the motions of ingame joining
154 void multi_handle_ingame_joiners();  
155
156 // pack the ship into the data string and return bytes processed
157 int multi_deconstruct_ship(ubyte *data, ship *s);
158
159 // pack the wing into the data string and return bytes processed
160 int multi_deconstruct_wing(ubyte *data, wing *w);
161
162 // --------------------------------------------------------------------------------------------------
163 // INGAME JOIN CLIENT FUNCTIONS
164 //
165
166 // unpack a ship from the data string and return bytes processed
167 int multi_reconstruct_ship(ubyte *data);
168
169 // unpack a wing from the data string and return bytes processed
170 int multi_reconstruct_wing(ubyte *data);   
171
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();
174
175
176 // --------------------------------------------------------------------------------------------------
177 // INGAME DATA SYNC SCREEN 
178 //
179
180 // mission sync screen init function for ingame joining
181 void multi_ingame_sync_init();
182
183 // mission sync screen do function for ingame joining
184 void multi_ingame_sync_do();
185
186 // mission sync screen do function for ingame joining
187 void multi_ingame_sync_close();
188
189
190 // --------------------------------------------------------------------------------------------------
191 // INGAME SHIP SELECT SCREEN
192 //
193
194 // ingame join ship selection screen init
195 void multi_ingame_select_init();
196
197 // ingame join ship selection screen do
198 void multi_ingame_select_do();
199
200 // ingame join ship selection screen close
201 void multi_ingame_select_close();
202
203
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
207 //
208
209 // send ship information for the mission to the ingame joiner
210 void send_ingame_ships_packet(net_player *pl);
211
212 // process ship information for the mission
213 void process_ingame_ships_packet(ubyte *data, header *hinfo);
214
215 // send wing information for the mission to the ingame joiner
216 void send_ingame_wings_packet(net_player *pl);
217
218 // process wing information for the mission
219 void process_ingame_wings_packet(ubyte *data, header *hinfo);
220
221 // send respawn points information to the ingame joiner
222 void send_ingame_respawn_points_packet(net_player *pl = NULL);
223
224 // process respawn points information for the mission
225 void process_ingame_respawn_points_packet(ubyte *data, header *hinfo);
226
227 // send Wss_slots data to an ingame joiner
228 void send_ingame_slots_packet(net_player *p);
229
230 // process Wss_slots data for the mission
231 void process_ingame_slots_packet(ubyte *data, header *hinfo);
232
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);
235
236 // process an ingame ship request packet
237 void process_ingame_ship_request_packet(ubyte *data, header *hinfo);
238
239 // for extra mission information
240 void multi_ingame_process_mission_stuff( ubyte *data, header *hinfo );
241
242 #endif
243