X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=args.c;h=a9ff69aecd3c93b52d65fd5f38e4c0d9e2d49eb9;hp=3a40acd69c71fe9ff14af04ae075bdb7bb061172;hb=2b5dd5bc0eb1739dd744de6f565d0f3a7ae02c95;hpb=30498ebe775df3854f28946b1373da948bd190a3 diff --git a/args.c b/args.c index 3a40acd..a9ff69a 100644 --- a/args.c +++ b/args.c @@ -6,13 +6,11 @@ float opt_bounciness; float opt_gamespeed; float opt_max_lead; -int opt_friction; // Look and Feel int opt_fullscreen; int opt_music; int opt_sound; -int opt_tail_engine; error_t parse_opt(int, char*, struct argp_state *); @@ -23,10 +21,9 @@ static struct argp_option opts[] = { {0, 0, 0, 0, "Gameplay Variations:"}, {"bounciness", 'b', "N%", 0, "Keep N% of speed when hitting edges (default 50%)"}, {"game-speed", 'g', "N%", 0, "50-100% (default 100%)"}, - {"max-lead", 'l', "#SCREENS", 0, "Max dist. ahead you can get (default 1 screen)\n(negative value means no limit)"}, - {"bad-physics", 'p', 0, 0, "Bad physics (i.e. friction)"}, + {"max-lead", 'l', "#SCREENS", OPTION_HIDDEN, + "Max distance ahead you can get\n (default 1 screen; < 0 means no limit)"}, {0, 0, 0, 0, "Look and Feel:"}, - {"engine", 'e', 0, 0, "Display large tail plume"}, {"full-screen", 'f', 0, 0, ""}, {"music", 'm', 0, 0, "Enable music"}, {"silent", 's', 0, 0, "No explosion sounds or music"}, @@ -43,13 +40,11 @@ init_opts(void) opt_bounciness = 0.50; // lose 50% when you hit the screen edge. opt_gamespeed = 1.00; // Run game at full speed. opt_max_lead = 1.00*XSIZE; // you can get 1 screen ahead. - opt_friction = 0; // Look and Feel opt_fullscreen = 0; opt_sound = 1; opt_music = 0; - opt_tail_engine = 0; } error_t @@ -59,31 +54,32 @@ parse_opt(int key, char *arg, struct argp_state *state) switch(key) { case 'b': if(!sscanf(arg, "%d%%", &i)) { - argp_error(state, "bad --bounciness (-b) value (should be 0-100%%)"); + fprintf(stderr, "bad --bounciness (-b) value (should be 0-100%%)\n"); + argp_state_help(state, stderr, ARGP_HELP_STD_HELP); return EINVAL; } if(i < 50) i = 50; else if(i > 100) i = 100; opt_bounciness = (float)i / 100; break; - case 'e': opt_tail_engine = 1; break; case 'f': opt_fullscreen = 1; break; case 'g': if(!sscanf(arg, "%d%%", &i)) { - argp_error(state, "bad --gamespeed (-g) value (should be 50-100%%)"); + fprintf(stderr, "bad --gamespeed (-g) value (should be 50-100%%)\n"); + argp_state_help(state, stderr, ARGP_HELP_STD_HELP); return EINVAL; } - if(i < 0) i = 0; else if(i > 100) i = 100; + if(i < 0) i = 0; else if(i > 200) i = 100; opt_gamespeed = (float)i / 100; break; case 'l': if(!sscanf(arg, "%f", &opt_max_lead)) { - argp_error(state, "bad --max-limit (-l) value (must be a number)"); + fprintf(stderr, "bad --max-lead (-l) value (must be a number)\n"); + argp_state_help(state, stderr, ARGP_HELP_STD_HELP); return EINVAL; } opt_max_lead *= XSIZE; break; case 'm': opt_music = 1; break; - case 'p': opt_friction = 1; break; case 's': opt_sound = 0; opt_music = 0; break; - default: break; + default: return ARGP_ERR_UNKNOWN; } return 0; }