[Add] -S/--sound option to force sound. Disabled sound by default.

This commit is contained in:
Allanis 2013-03-21 19:55:35 +00:00
parent 6a7c051851
commit 32bd075c9a

View File

@ -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;
@ -205,8 +208,9 @@ void conf_parseCLI(int argc, char** argv) {
{ "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' },
{ "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 }
@ -214,7 +218,7 @@ void conf_parseCLI(int argc, char** argv) {
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;