[Add] -S/--sound option to force sound. Disabled sound by default.
This commit is contained in:
parent
6a7c051851
commit
32bd075c9a
48
src/conf.c
48
src/conf.c
@ -60,15 +60,16 @@ static void print_usage(char** argv);
|
||||
static void print_usage(char** argv) {
|
||||
LOG("USAGE: %s [OPTION]", argv[0]);
|
||||
LOG("Options are:");
|
||||
LOG("\t-f, --fullscreen - Fullscreen");
|
||||
LOG("\t-F, --fps - Limit frames per second");
|
||||
LOG("\t-d s, --data s - Set the data file to be s");
|
||||
LOG("\t-j n, --joystick n - Use joystick (n)");
|
||||
LOG("\t-J s, --joystick s - Use joystick whose name contains (s)");
|
||||
LOG("\t-m f, --music f - Set the music volume to f");
|
||||
LOG("\t-s f, --sound f - Set the sound volume to f");
|
||||
LOG("\t-h --help - Display this message and exit.");
|
||||
LOG("\t-v - Print the version and exit");
|
||||
LOG(" -f, --fullscreen - Fullscreen");
|
||||
LOG(" -F, --fps - Limit frames per second");
|
||||
LOG(" -d s, --data s - Set the data file to be s");
|
||||
LOG(" -j n, --joystick n - Use joystick (n)");
|
||||
LOG(" -J s, --joystick s - Use joystick whose name contains (s)");
|
||||
LOG(" -S, --Sound - Forces sound.");
|
||||
LOG(" -m f --mvol f - Set the music volume to f");
|
||||
LOG(" -s f --svol f - Set the sound volume to f");
|
||||
LOG(" -h --help - Display this message and exit.");
|
||||
LOG(" -v - Print the version and exit");
|
||||
}
|
||||
|
||||
// Set the default configuration.
|
||||
@ -79,6 +80,8 @@ void conf_setDefaults(void) {
|
||||
gl_screen.w = 800;
|
||||
gl_screen.h = 640;
|
||||
gl_screen.flags = 0;
|
||||
// Openal.
|
||||
nosound = 1; // TODO: make sound default when it's sane again.
|
||||
// Joystick.
|
||||
indjoystick = -1;
|
||||
namjoystick = NULL;
|
||||
@ -200,21 +203,22 @@ int conf_loadConfig(const char* file) {
|
||||
// Parse some CLI options.
|
||||
void conf_parseCLI(int argc, char** argv) {
|
||||
static struct option long_options[] = {
|
||||
{ "fullscreen", no_argument, 0, 'f' },
|
||||
{ "fps", required_argument, 0, 'F' },
|
||||
{ "data", required_argument, 0, 'd' },
|
||||
{ "joystick", required_argument, 0, 'j' },
|
||||
{ "Joystick", required_argument, 0, 'J' },
|
||||
{ "music", required_argument, 0, 'm' },
|
||||
{ "sound", required_argument, 0, 's' },
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "version", no_argument, 0, 'v' },
|
||||
{ "fullscreen", no_argument, 0, 'f' },
|
||||
{ "fps", required_argument, 0, 'F' },
|
||||
{ "data", required_argument, 0, 'd' },
|
||||
{ "joystick", required_argument, 0, 'j' },
|
||||
{ "Joystick", required_argument, 0, 'J' },
|
||||
{ "sound", no_argument, 0, 'S' },
|
||||
{ "mvol", required_argument, 0, 'm' },
|
||||
{ "svol", required_argument, 0, 's' },
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "version", no_argument, 0, 'v' },
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
int option_index = 0;
|
||||
int c = 0;
|
||||
|
||||
while((c = getopt_long(argc, argv, "fF:d:J:j:s:m:V:hv",
|
||||
while((c = getopt_long(argc, argv, "fF:d:J:MSm:s:hv",
|
||||
long_options, &option_index)) != -1) {
|
||||
switch(c) {
|
||||
case 'f':
|
||||
@ -232,6 +236,12 @@ void conf_parseCLI(int argc, char** argv) {
|
||||
case 'J':
|
||||
namjoystick = strdup(optarg);
|
||||
break;
|
||||
case 'M':
|
||||
nosound = 1;
|
||||
break;
|
||||
case 'S':
|
||||
nosound = 0;
|
||||
break;
|
||||
case 'm':
|
||||
music_volume(atof(optarg));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user