1 #ifndef __PREFERENCES_H 2 #define __PREFERENCES_H 3 4 /* 5 preferences.h 6 7 Copyright (C) 1991-2001 and beyond by Bungie Studios, Inc. 8 and the "Aleph One" developers. 9 10 This program is free software; you can redistribute it and/or modify 11 it under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 3 of the License, or 13 (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 This license is contained in the file "COPYING", 21 which is included with this source code; it is available online at 22 http://www.gnu.org/licenses/gpl.html 23 24 Tuesday, June 13, 1995 10:07:04 AM- rdm created. 25 26 Feb 10, 2000 (Loren Petrich): 27 Added stuff for input modifiers: run/walk and swim/sink 28 29 Feb 25, 2000 (Loren Petrich): 30 Set up persistent stuff for the chase cam and crosshairs 31 32 Mar 2, 2000 (Loren Petrich): 33 Added chase-cam and crosshairs interfaces 34 35 Mar 14, 2000 (Loren Petrich): 36 Added OpenGL stuff 37 38 Apr 27, 2000 (Loren Petrich): 39 Added Josh Elsasser's "don't switch weapons" patch 40 41 Oct 22, 2001 (Woody Zenfell): 42 Changed the player name in player_preferences_data back to a Pstring (was Cstring in SDL version) 43 44 May 16, 2002 (Woody Zenfell): 45 New control option "don't auto-recenter view" 46 47 Apr 10, 2003 (Woody Zenfell): 48 Join hinting and autogathering have Preferences entries now 49 50 May 22, 2003 (Woody Zenfell): 51 Support for preferences for multiple network game protocols; configurable local game port. 52 */ 53 54 #include "interface.h" 55 #include "ChaseCam.h" 56 #include "Crosshairs.h" 57 #include "OGL_Setup.h" 58 #include "shell.h" 59 #include "SoundManager.h" 60 61 #include <map> 62 #include <set> 63 64 65 /* New preferences junk */ 66 const float DEFAULT_MONITOR_REFRESH_FREQUENCY = 60; // 60 Hz 67 68 enum { 69 _sw_alpha_off, 70 _sw_alpha_fast, 71 _sw_alpha_nice, 72 }; 73 enum { 74 _sw_driver_default, 75 _sw_driver_none, 76 _sw_driver_direct3d, 77 _sw_driver_opengl, 78 }; 79 80 struct graphics_preferences_data 81 { 82 struct screen_mode_data screen_mode; 83 // LP change: added OpenGL support 84 OGL_ConfigureData OGL_Configure; 85 86 bool double_corpse_limit; 87 88 int16 software_alpha_blending; 89 int16 software_sdl_driver; 90 91 bool hog_the_cpu; 92 93 int16 movie_export_video_quality; 94 int16 movie_export_audio_quality; 95 }; 96 97 enum { 98 _network_game_protocol_ring, 99 _network_game_protocol_star, 100 NUMBER_OF_NETWORK_GAME_PROTOCOLS, 101 102 _network_game_protocol_default = _network_game_protocol_star 103 }; 104 105 struct network_preferences_data 106 { 107 bool allow_microphone; 108 bool game_is_untimed; 109 int16 type; // look in network_dialogs.c for _ethernet, etc... 110 int16 game_type; 111 int16 difficulty_level; 112 uint16 game_options; // Penalize suicide, etc... see map.h for constants 113 int32 time_limit; 114 int16 kill_limit; 115 int16 entry_point; 116 bool autogather; 117 bool join_by_address; 118 char join_address[256]; 119 uint16 game_port; // TCP and UDP port number used for game traffic (not player-location traffic) 120 uint16 game_protocol; // _network_game_protocol_star, etc. 121 bool use_speex_encoder; 122 bool use_netscript; 123 char netscript_file[256]; 124 uint16 cheat_flags; 125 bool advertise_on_metaserver; 126 bool attempt_upnp; 127 bool check_for_updates; 128 bool verify_https; 129 130 enum { 131 kMetaserverLoginLength = 16 132 }; 133 134 char metaserver_login[kMetaserverLoginLength]; 135 char metaserver_password[kMetaserverLoginLength]; 136 bool use_custom_metaserver_colors; 137 rgb_color metaserver_colors[2]; 138 bool mute_metaserver_guests; 139 bool join_metaserver_by_default; 140 bool allow_stats; 141 }; 142 143 struct player_preferences_data 144 { 145 char name[PREFERENCES_NAME_LENGTH+1]; 146 int16 color; 147 int16 team; 148 uint32 last_time_ran; 149 int16 difficulty_level; 150 bool background_music_on; 151 bool crosshairs_active; 152 struct ChaseCamData ChaseCam; 153 struct CrosshairData Crosshairs; 154 }; 155 156 // LP addition: input-modifier flags 157 // run/walk and swim/sink 158 // LP addition: Josh Elsasser's dont-switch-weapons patch 159 enum { 160 _inputmod_interchange_run_walk = 0x0001, 161 _inputmod_interchange_swim_sink = 0x0002, 162 _inputmod_dont_switch_to_new_weapon = 0x0004, 163 _inputmod_invert_mouse = 0x0008, 164 _inputmod_use_button_sounds = 0x0010, 165 _inputmod_dont_auto_recenter = 0x0020 // ZZZ addition 166 }; 167 168 // shell keys 169 enum { 170 _key_inventory_left, 171 _key_inventory_right, 172 _key_switch_view, 173 _key_volume_up, 174 _key_volume_down, 175 _key_zoom_in, 176 _key_zoom_out, 177 _key_toggle_fps, 178 _key_activate_console, 179 _key_show_scores, 180 NUMBER_OF_SHELL_KEYS 181 }; 182 183 enum { 184 _mouse_accel_none, 185 _mouse_accel_classic, 186 _mouse_accel_symmetric, 187 NUMBER_OF_MOUSE_ACCEL_TYPES 188 }; 189 190 191 typedef std::map<int, std::set<SDL_Scancode> > key_binding_map; 192 193 struct input_preferences_data 194 { 195 int16 input_device; 196 // LP addition: input modifiers 197 uint16 modifiers; 198 // Mouse-sensitivity parameters (LP: originally ZZZ) 199 _fixed sens_horizontal; 200 _fixed sens_vertical; 201 int16 mouse_accel_type; 202 float mouse_accel_scale; 203 bool raw_mouse_input; 204 bool extra_mouse_precision; 205 bool classic_vertical_aim; 206 207 // Limit absolute-mode {yaw, pitch} deltas per tick to +/- {32, 8} instead of {63, 15} 208 bool classic_aim_speed_limits; 209 210 bool controller_analog; 211 _fixed controller_sensitivity; 212 213 // if an axis reading is taken below this number in absolute 214 // value, then we clip it to 0. this lets people use 215 // inaccurate zero points. 216 int16 controller_deadzone; 217 218 key_binding_map key_bindings; 219 key_binding_map shell_key_bindings; 220 }; 221 222 #define MAXIMUM_PATCHES_PER_ENVIRONMENT (32) 223 224 struct environment_preferences_data 225 { 226 char map_file[256]; 227 char physics_file[256]; 228 char shapes_file[256]; 229 char sounds_file[256]; 230 231 uint32 map_checksum; 232 uint32 physics_checksum; 233 TimeType shapes_mod_date; 234 TimeType sounds_mod_date; 235 uint32 patches[MAXIMUM_PATCHES_PER_ENVIRONMENT]; 236 237 // ZZZ: these aren't really environment preferences, but 238 // preferences that affect the environment preferences dialog 239 bool group_by_directory; // if not, display popup as one giant flat list 240 bool reduce_singletons; // make groups of a single element part of a larger parent group 241 242 // ghs: are themes part of the environment? they are now 243 bool smooth_text; 244 245 char solo_lua_file[256]; 246 bool use_solo_lua; 247 bool use_replay_net_lua; 248 bool hide_extensions; 249 250 FilmProfileType film_profile; 251 252 // Marathon 1 resources from the application itself 253 char resources_file[256]; 254 255 // how many auto-named save files to keep around (0 is unlimited) 256 uint32 maximum_quick_saves; 257 }; 258 259 /* New preferences.. (this sorta defeats the purpose of this system, but not really) */ 260 extern struct graphics_preferences_data *graphics_preferences; 261 extern struct network_preferences_data *network_preferences; 262 extern struct player_preferences_data *player_preferences; 263 extern struct input_preferences_data *input_preferences; 264 //extern struct sound_manager_parameters *sound_preferences; 265 extern SoundManager::Parameters *sound_preferences; 266 extern struct environment_preferences_data *environment_preferences; 267 268 /* --------- functions */ 269 void initialize_preferences(void); 270 void read_preferences(); 271 void handle_preferences(void); 272 void write_preferences(void); 273 274 void transition_preferences(const DirectorySpecifier& legacy_prefs_dir); 275 276 #endif 277