12 error_t parse_opt(int, char*, struct argp_state *);
14 const char *argp_program_version = "Variations on Rockdodger " VERSION;
15 const char *argp_program_bug_address = "<josh@qualdan.com>";
16 static char doc[] = "Dodge the rocks until you die.";
17 static struct argp_option opts[] = {
18 {0, 0, 0, 0, "Gameplay Variations:"},
19 {"bounciness", 'b', "N%", 0, "keep N% of speed when hitting edges (default 50%)"},
20 {"game-speed", 'g', "N%", 0, "50-100% (default 100%)"},
21 {"bad-physics", 'p', 0, 0, "bad physics (i.e. friction)"},
22 {0, 0, 0, 0, "Look and Feel:"},
23 {"engine", 'e', 0, 0, "Display large tail plume"},
24 {"full-screen", 'f', 0, 0, ""},
25 {"music", 'm', 0, 0, "Enable music"},
26 {"silent", 's', 0, 0, "Turn off explosion sounds"},
27 {0, 0, 0, 0, "Informational:", -1},
31 struct argp argp = { opts, &parse_opt, 0, doc };
39 opt_bounciness = 0.50; // lose 50% when you hit the screen edge.
40 opt_gamespeed = 1.00; // Run game at full speed.
41 // These switch back to the old gameplay and are off by default.
47 parse_opt(int key, char *arg, struct argp_state *state)
52 case 'f': opt_fullscreen = 1; break;
53 case 'm': opt_music = 1; break;
54 case 's': opt_sound = 0; opt_music = 0; break;
55 case 'b': i = 0; sscanf(arg, "%d%%", &i);
56 if(i < 50) i = 50; else if(i > 100) i = 100;
57 opt_bounciness = (float)i / 100;
59 case 'g': i = 0; sscanf(arg, "%d%%", &i);
60 if(i < 0) i = 0; else if(i > 100) i = 100;
61 opt_gamespeed = (float)i / 100;
63 case 'e': opt_tail_engine = 1; break;
64 case 'p': opt_friction = 1; break;