1 /*
2  * See Licensing and Copyright notice in naev.h
3  */
4 
5 
6 
7 #ifndef CONF_H
8 #  define CONF_H
9 
10 /**
11  * CONFIGURATION DEFAULTS
12  */
13 /* Gameplay options */
14 #define AFTERBURNER_SENSITIVITY_DEFAULT      250   /**< Default afterburner sensitivity. */
15 #define TIME_COMPRESSION_DEFAULT_MAX         5000. /**< Maximum default level of time compression (target speed to match). */
16 #define TIME_COMPRESSION_DEFAULT_MULT        200   /**< Default level of time compression multiplier. */
17 #define REDIRECT_FILE_DEFAULT                1     /**< Whether output should be redirected to a file. */
18 #define SAVE_COMPRESSION_DEFAULT             1     /**< Whether or not saved games should be compressed. */
19 #define MOUSE_THRUST_DEFAULT                 1     /**< Whether or not to use mouse thrust controls. */
20 #define MOUSE_DOUBLECLICK_TIME               0.5   /**< How long to consider double-clicks for. */
21 #define AUTONAV_RESET_SPEED_DEFAULT          1.    /**< Shield level (0-1) to reset autonav speed at. 1 means at enemy presence, 0 means at armour damage. */
22 #define MANUAL_ZOOM_DEFAULT                  0     /**< Whether or not to enable manual zoom controls. */
23 #define INPUT_MESSAGES_DEFAULT               5     /**< Amount of messages to display. */
24 /* Video options */
25 #define RESOLUTION_W_DEFAULT                 1024  /**< Default screen width. */
26 #define RESOLUTION_H_DEFAULT                 768   /**< Default screen height. */
27 #define FULLSCREEN_DEFAULT                   0     /**< Whether to run in fullscreen mode. */
28 #define FULLSCREEN_MODESETTING               0     /**< Whether fullscreen uses video modesetting. */
29 #define FSAA_DEFAULT                         1     /**< Whether to use Full Screen Anti-Aliasing. */
30 #define VSYNC_DEFAULT                        0     /**< Whether to wait for vertical sync. */
31 #define VBO_DEFAULT                          0     /**< Whether to use Vertex Buffer Objects. */
32 #define MIPMAP_DEFAULT                       0     /**< Whether to use Mip Mapping. */
33 #define TEXTURE_COMPRESSION_DEFAULT          0     /**< Whether to use texture compression. */
34 #define INTERPOLATION_DEFAULT                1     /**< Whether to use interpolation. */
35 #define NPOT_TEXTURES_DEFAULT                0     /**< Whether to allow non-power-of-two textures. */
36 #define SCALE_FACTOR_DEFAULT                 1.    /**< Default scale factor. */
37 #define SHOW_FPS_DEFAULT                     0     /**< Whether to display FPS on screen. */
38 #define FPS_MAX_DEFAULT                      60    /**< Maximum FPS. */
39 #define SHOW_PAUSE_DEFAULT                   1     /**< Whether to display pause status. */
40 #define ENGINE_GLOWS_DEFAULT                 1     /**< Whether to display engine glows. */
41 #define MINIMIZE_DEFAULT                     1     /**< Whether to minimize on focus loss. */
42 /* Audio options */
43 #define VOICES_DEFAULT                       128   /**< Amount of voices to use. */
44 #define PILOT_RELATIVE_DEFAULT               1     /**< Whether the sound is relative to the pilot (as opposed to the camera). */
45 #define USE_EFX_DEFAULT                      1     /**< Whether or not to use EFX (if using OpenAL). */
46 #define BUFFER_SIZE_DEFAULT                  128   /**< Default buffer size (if using OpenAL). */
47 #define MUTE_SOUND_DEFAULT                   0     /**< Whether sound should be disabled. */
48 #define SOUND_VOLUME_DEFAULT                 0.6   /**< Default sound volume. */
49 #define MUSIC_VOLUME_DEFAULT                 0.8   /**< Default music volume. */
50 #if USE_OPENAL
51 #define BACKEND_DEFAULT                      "openal"
52 #else /* USE_OPENAL */
53 #define BACKEND_DEFAULT                      "sdlmix"
54 #endif /* USE_OPENAL */
55 /* Editor Options */
56 #define DEV_SAVE_SYSTEM_DEFAULT           "dat/ssys/"
57 #define DEV_SAVE_ASSET_DEFAULT            "dat/assets/"
58 #define DEV_SAVE_MAP_DEFAULT              "dat/outfits/maps/"
59 
60 
61 /**
62  * @brief Struct containing player options.
63  *
64  * @note Input is not handled here.
65  */
66 typedef struct PlayerConf_s {
67 
68    /* ndata. */
69    char *ndata; /**< Ndata path to use. */
70    char *datapath; /**< Path for user data (saves, screenshots, etc.). */
71 
72    /* OpenGL properties. */
73    int fsaa; /**< Full Scene Anti-Aliasing to use. */
74    int vsync; /**< Whether or not to use vsync. */
75    int vbo; /**< Use vbo. */
76    int mipmaps; /**< Use mipmaps. */
77    int compress; /**< Use texture compression. */
78    int interpolate; /**< Use texture interpolation. */
79    int npot; /**< Use NPOT textures if available. */
80 
81    /* Memory usage. */
82    int engineglow; /**< Sets engine glow. */
83 
84    /* Window dimensions. */
85    int width; /**< Width of the window to use. */
86    int height; /**< Height of the window to use. */
87    int explicit_dim; /**< Dimension is explicit. */
88    double scalefactor; /**< Amount to reduce resolution by. */
89    int fullscreen; /**< Whether or not game is fullscreen. */
90    int modesetting; /**< Whether to use modesetting for fullscreen. */
91    int minimize; /**< Whether to minimize on focus loss. */
92 
93    /* Sound. */
94    char *sound_backend; /**< Sound backend to use. */
95    int snd_voices; /**< Number of sound voices to use. */
96    int snd_pilotrel; /**< Sound is relative to pilot when following. */
97    int al_efx; /**< Should EFX extension be used? (only applicable for OpenAL) */
98    int al_bufsize; /**< Size of the buffer (in kilobytes) to use for music. */
99    int nosound; /**< Whether or not sound is on. */
100    double sound; /**< Sound level for sound effects. */
101    double music; /**< Sound level for music. */
102 
103    /* FPS. */
104    int fps_show; /**< Whether or not FPS should be shown */
105    int fps_max; /**< Maximum FPS to limit to. */
106 
107    /* Pause. */
108    int pause_show; /**< Whether pause status should be shown. */
109 
110    /* Joystick. */
111    int joystick_ind; /**< Index of joystick to use. */
112    char *joystick_nam; /**< Name of joystick to use. */
113 
114    /* GUI. */
115    int mesg_visible; /**< Amount of visible messages. */
116 
117    /* Keyrepeat. */
118    unsigned int repeat_delay; /**< Time in ms before start repeating. */
119    unsigned int repeat_freq; /**< Time in ms between each repeat once started repeating. */
120 
121    /* Zoom. */
122    int zoom_manual; /**< Zoom is under manual control. */
123    double zoom_far; /**< Maximum ingame zoom to use should be less then zoom_near. */
124    double zoom_near; /**< Minimum ingame zoom to use. */
125    double zoom_speed; /**< Maximum zoom speed change. */
126    double zoom_stars; /**< How much stars can zoom (modulates zoom_[mix|max]). */
127 
128    /* Font sizes. */
129    int font_size_console; /**< Console monospaced font size. */
130    int font_size_intro;   /**< Intro text font size. */
131    int font_size_def;     /**< Default large font size. */
132    int font_size_small;   /**< Default small font size. */
133 
134    /* Misc. */
135    double compression_velocity; /**< Velocity to compress to. */
136    double compression_mult; /**< Maximum time multiplier. */
137    int redirect_file; /**< Redirect output to files. */
138    int save_compress; /**< Compress savegame. */
139    unsigned int afterburn_sens; /**< Afterburn sensibility. */
140    int mouse_thrust; /**< Whether mouse flying controls thrust. */
141    double mouse_doubleclick; /**< How long to consider double-clicks for. */
142    double autonav_reset_speed; /**< Condition for resetting autonav speed. */
143    int nosave; /**< Disables conf saving. */
144    int devmode; /**< Developer mode. */
145    int devautosave; /**< Developer mode autosave. */
146    int devcsv; /**< Output CSV data. */
147 
148    /* Debugging. */
149    int fpu_except; /**< Enable FPU exceptions? */
150 
151    /* Editor. */
152    char *dev_save_sys; /**< Path to save systems to. */
153    char *dev_save_map; /**< Path to save maps to. */
154    char *dev_save_asset; /**< Path to save assets to. */
155 
156 } PlayerConf_t;
157 extern PlayerConf_t conf; /**< Player configuration. */
158 
159 
160 /*
161  * loading
162  */
163 void conf_setDefaults (void);
164 void conf_setGameplayDefaults (void);
165 void conf_setAudioDefaults (void);
166 void conf_setVideoDefaults (void);
167 void conf_loadConfigPath( void );
168 int conf_loadConfig( const char* file );
169 void conf_parseCLIPath( int argc, char** argv );
170 void conf_parseCLI( int argc, char** argv );
171 void conf_cleanup (void);
172 
173 /*
174  * saving
175  */
176 int conf_saveConfig( const char* file );
177 
178 
179 #endif /* CONF_H */
180