#include <ctype.h>
#include "cfgopt.h"
+#ifdef NDEBUG
+/* release build default options */
+struct options opt = {
+ 0, /* start_scr */
+ 1, /* music */
+ 0, /* mouse */
+ 0, /* sball */
+ 0, /* vsync */
+ 0 /* dbginfo */
+};
+#else
+/* debug build default options */
struct options opt = {
0, /* start_scr */
0, /* music */
+ 1, /* mouse */
0, /* sball */
- 1 /* vsync */
+ 0, /* vsync */
+ 1 /* dbginfo */
};
+#endif
int parse_args(int argc, char **argv)
{
opt.music = 0;
} else if(strcmp(argv[i], "-scr") == 0 || strcmp(argv[i], "-screen") == 0) {
scrname = argv[++i];
+ } else if(strcmp(argv[i], "-mouse") == 0) {
+ opt.mouse = 1;
+ } else if(strcmp(argv[i], "-nomouse") == 0) {
+ opt.mouse = 0;
} else if(strcmp(argv[i], "-sball") == 0) {
opt.sball = !opt.sball;
} else if(strcmp(argv[i], "-vsync") == 0) {
opt.vsync = 1;
} else if(strcmp(argv[i], "-novsync") == 0) {
opt.vsync = 0;
+ } else if(strcmp(argv[i], "-dbg") == 0) {
+ opt.dbginfo = 1;
+ } else if(strcmp(argv[i], "-nodbg") == 0) {
+ opt.dbginfo = 0;
+#ifndef MSDOS
+ } else if(strcmp(argv[i], "-fs") == 0) {
+ opt.fullscreen = 1;
+ } else if(strcmp(argv[i], "-win") == 0) {
+ opt.fullscreen = 0;
+ } else if(strcmp(argv[i], "-scaler-nearest") == 0) {
+ opt.scaler = SCALER_NEAREST;
+ } else if(strcmp(argv[i], "-scaler-linear") == 0) {
+ opt.scaler = SCALER_LINEAR;
+#endif
} else {
fprintf(stderr, "invalid option: %s\n", argv[i]);
return -1;
opt.music = bool_value(value);
} else if(strcmp(line, "screen") == 0) {
opt.start_scr = strdup(value);
+ } else if(strcmp(line, "mouse") == 0) {
+ opt.mouse = bool_value(value);
} else if(strcmp(line, "sball") == 0) {
opt.sball = bool_value(value);
} else if(strcmp(line, "vsync") == 0) {
opt.vsync = bool_value(value);
+ } else if(strcmp(line, "debug") == 0) {
+ opt.dbginfo = bool_value(value);
+#ifndef MSDOS
+ } else if(strcmp(line, "fullscreen") == 0) {
+ opt.fullscreen = bool_value(value);
+ } else if(strcmp(line, "scaler") == 0) {
+ if(strcmp(value, "linear") == 0) {
+ opt.scaler = SCALER_LINEAR;
+ } else {
+ opt.scaler = SCALER_NEAREST;
+ }
+#endif
} else {
fprintf(stderr, "%s:%d invalid option: %s\n", fname, nline, line);
return -1;