]> icculus.org git repositories - taylor/freespace2.git/blob - include/multi_options.h
proper padding of PXO stats struct for FS2 demo
[taylor/freespace2.git] / include / multi_options.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_options.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * $Log$
16  * Revision 1.3  2002/06/09 04:41:14  relnev
17  * added copyright header
18  *
19  * Revision 1.2  2002/05/26 20:22:48  theoddone33
20  * Most of network/ works
21  *
22  * Revision 1.1.1.1  2002/05/03 03:28:12  root
23  * Initial import.
24  * 
25  * 
26  * 6     4/20/99 6:39p Dave
27  * Almost done with artillery targeting. Added support for downloading
28  * images on the PXO screen.
29  * 
30  * 5     2/19/99 2:55p Dave
31  * Temporary checking to report the winner of a squad war match.
32  * 
33  * 4     2/12/99 6:16p Dave
34  * Pre-mission Squad War code is 95% done.
35  * 
36  * 3     11/19/98 4:19p Dave
37  * Put IPX sockets back in psnet. Consolidated all multiplayer config
38  * files into one.
39  * 
40  * 2     10/07/98 10:53a Dave
41  * Initial checkin.
42  * 
43  * 1     10/07/98 10:50a Dave
44  * 
45  * 12    7/07/98 2:49p Dave
46  * UI bug fixes.
47  * 
48  * 11    5/03/98 7:04p Dave
49  * Make team vs. team work mores smoothly with standalone. Change how host
50  * interacts with standalone for picking missions. Put in a time limit for
51  * ingame join ship select. Fix ingame join ship select screen for Vasudan
52  * ship icons.
53  * 
54  * 10    5/03/98 2:52p Dave
55  * Removed multiplayer furball mode.
56  * 
57  * 9     4/30/98 12:57a Dave
58  * Put in new mode for ship/weapon selection. Rearranged how game querying
59  * is done a bit.
60  * 
61  * 8     4/22/98 5:53p Dave
62  * Large reworking of endgame sequencing. Updated multi host options
63  * screen for new artwork. Put in checks for host or team captains leaving
64  * midgame.
65  * 
66  * 7     4/16/98 11:39p Dave
67  * Put in first run of new multiplayer options screen. Still need to
68  * complete final tab.
69  * 
70  * 6     4/09/98 11:01p Dave
71  * Put in new multi host options screen. Tweaked multiplayer options a
72  * bit.
73  * 
74  * 5     4/09/98 5:43p Dave
75  * Remove all command line processing from the demo. Began work fixing up
76  * the new multi host options screen.
77  * 
78  * 4     4/06/98 10:24p Dave
79  * Fixed up Netgame.respawn for the standalone case.
80  * 
81  * 3     4/06/98 6:37p Dave
82  * Put in max_observers netgame server option. Make sure host is always
83  * defaulted to alpha 1 or zeta 1. Changed create game so that MAX_PLAYERS
84  * can always join but need to be kicked before commit can happen. Put in
85  * support for server ending a game and notifying clients of a special
86  * condition.
87  * 
88  * 2     3/31/98 4:51p Dave
89  * Removed medals screen and multiplayer buttons from demo version. Put in
90  * new pilot popup screen. Make ships in mp team vs. team have proper team
91  * ids. Make mp respawns a permanent option saved in the player file.
92  * 
93  * 1     3/30/98 6:24p Dave
94  *  
95  * 
96  * $NoKeywords: $
97  */
98
99 #ifndef _MULTI_NETGAME_OPTIONS_HEADER_FILE
100 #define _MULTI_NETGAME_OPTIONS_HEADER_FILE
101
102 #include "pstypes.h"
103
104 // ----------------------------------------------------------------------------------
105 // MULTI OPTIONS DEFINES/VARS
106 //
107
108 struct header;
109 struct netgame_info;
110 struct net_player;
111
112 // global options
113 #define STD_PASSWD_LEN                  16
114 #define STD_NAME_LEN                            32
115 #define MULTI_OPTIONS_STRING_LEN                        256
116 typedef struct multi_global_options {
117         // common options
118         int             protocol;                                                                                                       // selected network protocol    
119         ushort  port;                                                                                                                   // port we're running on - for allowing multiple servers on one machine
120         int             log;                                                                                                                    // use a logfile        
121         int             datarate_cap;                                                                                           // datarate cap for OBJ_UPDATE_HIGH
122         int             pxo;                                                                                                            // PXO enabled
123         char            user_tracker_ip[MULTI_OPTIONS_STRING_LEN];              // ip address of user tracker
124         char            game_tracker_ip[MULTI_OPTIONS_STRING_LEN];              // ip address of game tracker   
125         char            pxo_ip[MULTI_OPTIONS_STRING_LEN];                                       // ip address of pxo chat server
126         char            pxo_rank_url[MULTI_OPTIONS_STRING_LEN];                 // URL of pxo rankings page
127         char            pxo_create_url[MULTI_OPTIONS_STRING_LEN];                       // URL of pxo create account page
128         char            pxo_verify_url[MULTI_OPTIONS_STRING_LEN];                       // URL of pxo account validation page
129         char            pxo_banner_url[MULTI_OPTIONS_STRING_LEN];                       // URL of pxo banner files
130
131         // standalone only options
132         int             std_max_players;                                                                                        // max players allowed on the standalone
133         int             std_datarate;                                                                                           // some OBJ_UPDATE_* value
134         int             std_voice;                                                                                                      // should standalone allow voice
135         char            std_passwd[STD_PASSWD_LEN];                                                     // standalone host password
136         char            std_pname[STD_NAME_LEN];                                                                // permanent name for the standalone - if any
137         int             std_framecap;                                                                                           // standalone frame cap
138 } multi_global_options;
139
140 extern multi_global_options Multi_options_g;
141
142 // local (netplayer - nonserver) options - maintained on individual clients and on the server (no need for other clients to know this guy's settings)
143 #define MAX_OBJ_UPDATE_LEVELS                                           4                                       // the # of object update levels there are
144 #define OBJ_UPDATE_LOW                                                          0                                       // low object updates
145 #define OBJ_UPDATE_MEDIUM                                                       1                                       // medium object updates
146 #define OBJ_UPDATE_HIGH                                                         2                                       // high object updates
147 #define OBJ_UPDATE_LAN                                                          3                                       // ultra-high updates - no capping at all
148
149 #define MLO_FLAG_ACCEPT_PIX                                             (1<<0)                  // accept pix from server (pilot pics, squadron logos, etc)
150 #define MLO_FLAG_NO_VOICE                                                       (1<<1)                  // turn off voice altogether
151 #define MLO_FLAG_LOCAL_BROADCAST                                        (1<<2)                  // broadcast on the local subnet when looking for games
152 #define MLO_FLAG_FLUSH_CACHE                                            (1<<3)                  // flush the multidata cache before every game
153 #define MLO_FLAG_XFER_MULTIDATA                                 (1<<4)                  // xfer mission files to the multidata cache directory
154 #define MLO_FLAG_TEMP_CLOSED                                            (1<<5)                  // send to standalone to tell him to toggle the temp closed status
155
156 // BE AWARE : any changes made to this structure will mess with the player file. it will have to be upped!!!!
157 typedef struct multi_local_options {
158         int flags;                                                                                                                                      // misc player options  
159         int obj_update_level;                                                                                                   // one off the flags above indicating how often to refresh objects
160 } multi_local_options;  
161
162 // server options - maintained on the server _and_ clients
163 #define MSO_SQUAD_RANK                                                          0                                               // only highest ranking players can message
164 #define MSO_SQUAD_LEADER                                                        1                                               // only wingleaders can message
165 #define MSO_SQUAD_ANY                                                           2                                               // anyone can message
166 #define MSO_SQUAD_HOST                                                          3                                               // only the host can message
167
168 #define MSO_END_RANK                                                                    0                                               // only the highest ranking players and the host can end the mission
169 #define MSO_END_LEADER                                                          1                                               // only team/wing leaders and the host can end the mission
170 #define MSO_END_ANY                                                                     2                                               // any player can end the mission
171 #define MSO_END_HOST                                                                    3                                               // only the host can end the mission
172
173 #define MSO_FLAG_INGAME_XFER                                            (1<<0)                          // netgame allows file xfers to ingame joiners
174 #define MSO_FLAG_ACCEPT_PIX                                             (1<<1)                          // netgame allows pilot pix, squad logos
175 #define MSO_FLAG_NO_VOICE                                                       (1<<2)                          // netgame is disallowing voice altogether
176 #define MSO_FLAG_SS_LEADERS                                             (1<<3)                          // in ship/weapon select, only host or team captains can modify ships
177
178 // BE AWARE : any changes made to this structure will mess with the player file. it will have to be upped!!!!
179 typedef struct multi_server_options {
180         // misc settings and flags
181         ubyte squad_set;                                                                                                                        // see MSO_SQUAD_*
182         ubyte endgame_set;                                                                                                              // see MSO_END_*
183         int flags;                                                                                                                                      // see MSO_FLAG_*
184
185         // default respawn count
186         uint respawn;
187
188         // default max # of observers
189         ubyte max_observers;
190
191         // default skill level
192         ubyte skill_level;
193         
194         // voice settings
195         ubyte voice_qos;                                                                                                                        // voice quality of sound
196         int voice_token_wait;                                                                                                   // min time between token gets for a given player
197         int voice_record_time;                                                                                                  // max duration for voice recording (in ms)
198
199         // time limit
200         fix mission_time_limit;                                                                                                 // mission time limit (set to -1 for no limit)
201
202         // kill limit
203         int kill_limit;                                                                                                                 // kill limit for a furball mission
204 } multi_server_options;
205
206
207 // ----------------------------------------------------------------------------------
208 // MULTI OPTIONS FUNCTIONS
209 //
210
211 // load in the config file
212 void multi_options_read_config();
213
214 // set netgame defaults 
215 // NOTE : should be used when creating a newpilot
216 void multi_options_set_netgame_defaults(multi_server_options *options);
217
218 // set local netplayer defaults
219 // NOTE : should be used when creating a newpilot
220 void multi_options_set_local_defaults(multi_local_options *options);
221
222 // fill in the passed netgame options struct with the data from my player file data (only host/server should do this)
223 void multi_options_netgame_load(multi_server_options *options);
224
225 // fill in the passed local options struct with the data from my player file data (all machines except standalone should do this)
226 void multi_options_local_load(multi_local_options *options, net_player *pxo_pl);
227
228 // update everyone on the current netgame options
229 void multi_options_update_netgame();
230
231 // update everyone with my local settings
232 void multi_options_update_local();
233
234 // update the standalone with the settings I have picked at the "start game" screen
235 void multi_options_update_start_game(netgame_info *ng);
236
237 // update the standalone with the mission settings I have picked (mission filename, etc)
238 void multi_options_update_mission(netgame_info *ng, int campaign_mode);
239
240
241 // ----------------------------------------------------------------------------------
242 // MULTI OPTIONS FUNCTIONS
243 //
244
245 // process an incoming multi options packet
246 void multi_options_process_packet(unsigned char *data, header *hinfo);
247
248
249 #endif
250