FS2_Open
Open source remastering of the Freespace 2 engine
multi_options.h
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 #ifndef _MULTI_NETGAME_OPTIONS_HEADER_FILE
10 #define _MULTI_NETGAME_OPTIONS_HEADER_FILE
11 
12 #include "globalincs/pstypes.h"
13 #include "psnet2.h"
14 
15 // local (netplayer - nonserver) options - maintained on individual clients and on the server (no need for other clients to know this guy's settings)
16 #define MAX_OBJ_UPDATE_LEVELS 4 // the # of object update levels there are
17 #define OBJ_UPDATE_LOW 0 // low object updates
18 #define OBJ_UPDATE_MEDIUM 1 // medium object updates
19 #define OBJ_UPDATE_HIGH 2 // high object updates
20 #define OBJ_UPDATE_LAN 3 // ultra-high updates - no capping at all
21 
22 struct header;
23 struct netgame_info;
24 struct net_player;
25 
26 // global options
27 #define STD_PASSWD_LEN 16
28 #define STD_NAME_LEN 32
29 #define MULTI_OPTIONS_STRING_LEN 256
30 typedef struct multi_global_options {
31  // common options
32  int protocol; // selected network protocol
33  ushort port; // port we're running on - for allowing multiple servers on one machine
34  int log; // use a logfile
35  int datarate_cap; // datarate cap for OBJ_UPDATE_HIGH
36 
37  char user_tracker_ip[MULTI_OPTIONS_STRING_LEN]; // ip address of user tracker
38  char game_tracker_ip[MULTI_OPTIONS_STRING_LEN]; // ip address of game tracker
39  char tracker_port[STD_NAME_LEN]; // ip address to use for user/game tracker (used for FS2NetD only)
40  int pxo;
41  char pxo_ip[MULTI_OPTIONS_STRING_LEN]; // ip address of pxo chat server
42  char pxo_rank_url[MULTI_OPTIONS_STRING_LEN]; // URL of pxo rankings page
43  char pxo_create_url[MULTI_OPTIONS_STRING_LEN]; // URL of pxo create account page
44  char pxo_verify_url[MULTI_OPTIONS_STRING_LEN]; // URL of pxo account validation page
45  char pxo_banner_url[MULTI_OPTIONS_STRING_LEN]; // URL of pxo banner files
46 
47  // standalone only options
48  int std_max_players; // max players allowed on the standalone
49  int std_datarate; // some OBJ_UPDATE_* value
50  int std_voice; // should standalone allow voice
51  char std_passwd[STD_PASSWD_LEN+1]; // standalone host password
52  char std_pname[STD_NAME_LEN+1]; // permanent name for the standalone - if any
53  char std_pxo_login[MULTI_OPTIONS_STRING_LEN]; // pxo login to use
54  char std_pxo_password[MULTI_OPTIONS_STRING_LEN]; // pxo password to use
55  int std_framecap; // standalone frame cap
56 
61 
62  void reset() {
63  protocol = 1;//NET_TCP
64 
65  port = DEFAULT_GAME_PORT;
66 
67  log = 0;
68  datarate_cap = 11000;//OO_HIGH_RATE_DEFAULT;
69  strcpy_s(user_tracker_ip, "");
70  strcpy_s(game_tracker_ip, "");
71  strcpy_s(tracker_port, "");
72  strcpy_s(pxo_ip, "");
73  strcpy_s(pxo_rank_url, "");
74  strcpy_s(pxo_create_url, "");
75  strcpy_s(pxo_verify_url, "");
76  strcpy_s(pxo_banner_url, "");
77 
78  // standalone values
79  std_max_players = -1;
80  std_datarate = OBJ_UPDATE_HIGH;
81  std_voice = 1;
82  memset(std_passwd, 0, STD_PASSWD_LEN+1);
83  memset(std_pname, 0, STD_NAME_LEN+1);
84  std_framecap = 30;
85 
86  webapiPort = 8080;
87  webapiUsername = "admin";
88  webapiPassword = "admin";
89 
90  webuiRootDirectory = "";
91  }
92 
94 
96 
97 
98 
99 #define MLO_FLAG_ACCEPT_PIX (1<<0) // accept pix from server (pilot pics, squadron logos, etc)
100 #define MLO_FLAG_NO_VOICE (1<<1) // turn off voice altogether
101 #define MLO_FLAG_LOCAL_BROADCAST (1<<2) // broadcast on the local subnet when looking for games
102 #define MLO_FLAG_FLUSH_CACHE (1<<3) // flush the multidata cache before every game
103 #define MLO_FLAG_XFER_MULTIDATA (1<<4) // xfer mission files to the multidata cache directory
104 #define MLO_FLAG_TEMP_CLOSED (1<<5) // send to standalone to tell him to toggle the temp closed status
105 
106 // BE AWARE : any changes made to this structure will mess with the player file. it will have to be upped!!!!
107 typedef struct multi_local_options {
108  int flags; // misc player options
109  int obj_update_level; // one off the flags above indicating how often to refresh objects
111 
112 // server options - maintained on the server _and_ clients
113 #define MSO_SQUAD_RANK 0 // only highest ranking players can message
114 #define MSO_SQUAD_LEADER 1 // only wingleaders can message
115 #define MSO_SQUAD_ANY 2 // anyone can message
116 #define MSO_SQUAD_HOST 3 // only the host can message
117 
118 #define MSO_END_RANK 0 // only the highest ranking players and the host can end the mission
119 #define MSO_END_LEADER 1 // only team/wing leaders and the host can end the mission
120 #define MSO_END_ANY 2 // any player can end the mission
121 #define MSO_END_HOST 3 // only the host can end the mission
122 
123 #define MSO_FLAG_INGAME_XFER (1<<0) // netgame allows file xfers to ingame joiners
124 #define MSO_FLAG_ACCEPT_PIX (1<<1) // netgame allows pilot pix, squad logos
125 #define MSO_FLAG_NO_VOICE (1<<2) // netgame is disallowing voice altogether
126 #define MSO_FLAG_SS_LEADERS (1<<3) // in ship/weapon select, only host or team captains can modify ships
127 
128 // BE AWARE : any changes made to this structure will mess with the player file. it will have to be upped!!!!
129 typedef struct multi_server_options {
130  // misc settings and flags
131  ubyte squad_set; // see MSO_SQUAD_*
132  ubyte endgame_set; // see MSO_END_*
133  int flags; // see MSO_FLAG_*
134 
135  // default respawn count
137 
138  // default max # of observers
140 
141  // default skill level
143 
144  // voice settings
145  ubyte voice_qos; // voice quality of sound
146  int voice_token_wait; // min time between token gets for a given player
147  int voice_record_time; // max duration for voice recording (in ms)
148 
149  // time limit
150  fix mission_time_limit; // mission time limit (set to -1 for no limit)
151 
152  // kill limit
153  int kill_limit; // kill limit for a furball mission
155 
156 
157 // ----------------------------------------------------------------------------------
158 // MULTI OPTIONS FUNCTIONS
159 //
160 
161 // load in the config file
163 
164 // set netgame defaults
165 // NOTE : should be used when creating a newpilot
167 
168 // set local netplayer defaults
169 // NOTE : should be used when creating a newpilot
171 
172 // fill in the passed netgame options struct with the data from my player file data (only host/server should do this)
174 
175 // fill in the passed local options struct with the data from my player file data (all machines except standalone should do this)
177 
178 // update everyone on the current netgame options
180 
181 // update everyone with my local settings
183 
184 // update the standalone with the settings I have picked at the "start game" screen
186 
187 // update the standalone with the mission settings I have picked (mission filename, etc)
188 void multi_options_update_mission(netgame_info *ng, int campaign_mode);
189 
190 
191 // ----------------------------------------------------------------------------------
192 // MULTI OPTIONS FUNCTIONS
193 //
194 
195 // process an incoming multi options packet
196 void multi_options_process_packet(unsigned char *data, header *hinfo);
197 
198 
199 #endif
char pxo_banner_url[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:45
char tracker_port[STD_NAME_LEN]
Definition: multi_options.h:39
void multi_options_update_local()
void multi_options_update_start_game(netgame_info *ng)
char pxo_verify_url[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:44
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
char std_pxo_password[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:54
multi_global_options Multi_options_g
struct multi_local_options multi_local_options
unsigned int uint
Definition: pstypes.h:64
SCP_string webapiPassword
Definition: multi_options.h:59
#define DEFAULT_GAME_PORT
Definition: psnet2.h:36
char game_tracker_ip[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:38
SCP_string webapiUsername
Definition: multi_options.h:58
void multi_options_process_packet(unsigned char *data, header *hinfo)
#define MULTI_OPTIONS_STRING_LEN
Definition: multi_options.h:29
long fix
Definition: pstypes.h:54
unsigned char ubyte
Definition: pstypes.h:62
void multi_options_update_netgame()
void multi_options_netgame_load(multi_server_options *options)
#define STD_NAME_LEN
Definition: multi_options.h:28
char pxo_create_url[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:43
#define STD_PASSWD_LEN
Definition: multi_options.h:27
struct multi_global_options multi_global_options
void multi_options_set_netgame_defaults(multi_server_options *options)
Definition: multi.h:385
unsigned short ushort
Definition: pstypes.h:63
char user_tracker_ip[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:37
void multi_options_read_config()
void multi_options_set_local_defaults(multi_local_options *options)
#define OBJ_UPDATE_HIGH
Definition: multi_options.h:19
char std_pname[STD_NAME_LEN+1]
Definition: multi_options.h:52
GLenum GLsizei GLenum GLenum const GLvoid * data
Definition: Gl.h:1509
char pxo_rank_url[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:42
char pxo_ip[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:41
void multi_options_local_load(multi_local_options *options, net_player *pxo_pl)
struct multi_server_options multi_server_options
char std_pxo_login[MULTI_OPTIONS_STRING_LEN]
Definition: multi_options.h:53
void multi_options_update_mission(netgame_info *ng, int campaign_mode)
SCP_string webuiRootDirectory
Definition: multi_options.h:60
#define strcpy_s(...)
Definition: safe_strings.h:67
char std_passwd[STD_PASSWD_LEN+1]
Definition: multi_options.h:51