+
+/* ========================================================================= */
+/* setup file functions */
+/* ========================================================================= */
+
+#define TOKEN_STR_PLAYER_PREFIX "player_"
+
+/* global setup */
+#define SETUP_TOKEN_PLAYER_NAME 0
+#define SETUP_TOKEN_SOUND 1
+#define SETUP_TOKEN_SOUND_LOOPS 2
+#define SETUP_TOKEN_SOUND_MUSIC 3
+#define SETUP_TOKEN_SOUND_SIMPLE 4
+#define SETUP_TOKEN_TOONS 5
+#define SETUP_TOKEN_SCROLL_DELAY 6
+#define SETUP_TOKEN_SOFT_SCROLLING 7
+#define SETUP_TOKEN_FADING 8
+#define SETUP_TOKEN_AUTORECORD 9
+#define SETUP_TOKEN_QUICK_DOORS 10
+#define SETUP_TOKEN_TEAM_MODE 11
+#define SETUP_TOKEN_HANDICAP 12
+#define SETUP_TOKEN_TIME_LIMIT 13
+#define SETUP_TOKEN_FULLSCREEN 14
+#define SETUP_TOKEN_ASK_ON_ESCAPE 15
+#define SETUP_TOKEN_GRAPHICS_DIR 16
+#define SETUP_TOKEN_SOUNDS_DIR 17
+#define SETUP_TOKEN_MUSIC_DIR 18
+
+#define NUM_GLOBAL_SETUP_TOKENS 19
+
+/* shortcut setup */
+#define SETUP_TOKEN_SAVE_GAME 0
+#define SETUP_TOKEN_LOAD_GAME 1
+
+#define NUM_SHORTCUT_SETUP_TOKENS 2
+
+/* player setup */
+#define SETUP_TOKEN_USE_JOYSTICK 0
+#define SETUP_TOKEN_JOY_DEVICE_NAME 1
+#define SETUP_TOKEN_JOY_XLEFT 2
+#define SETUP_TOKEN_JOY_XMIDDLE 3
+#define SETUP_TOKEN_JOY_XRIGHT 4
+#define SETUP_TOKEN_JOY_YUPPER 5
+#define SETUP_TOKEN_JOY_YMIDDLE 6
+#define SETUP_TOKEN_JOY_YLOWER 7
+#define SETUP_TOKEN_JOY_SNAP 8
+#define SETUP_TOKEN_JOY_BOMB 9
+#define SETUP_TOKEN_KEY_LEFT 10
+#define SETUP_TOKEN_KEY_RIGHT 11
+#define SETUP_TOKEN_KEY_UP 12
+#define SETUP_TOKEN_KEY_DOWN 13
+#define SETUP_TOKEN_KEY_SNAP 14
+#define SETUP_TOKEN_KEY_BOMB 15
+
+#define NUM_PLAYER_SETUP_TOKENS 16
+
+static struct SetupInfo si;
+static struct SetupShortcutInfo ssi;
+static struct SetupInputInfo sii;
+
+static struct TokenInfo global_setup_tokens[] =
+{
+ /* global setup */
+ { TYPE_STRING, &si.player_name, "player_name" },
+ { TYPE_SWITCH, &si.sound, "sound" },
+ { TYPE_SWITCH, &si.sound_loops, "repeating_sound_loops" },
+ { TYPE_SWITCH, &si.sound_music, "background_music" },
+ { TYPE_SWITCH, &si.sound_simple, "simple_sound_effects" },
+ { TYPE_SWITCH, &si.toons, "toons" },
+ { TYPE_SWITCH, &si.scroll_delay, "scroll_delay" },
+ { TYPE_SWITCH, &si.soft_scrolling, "soft_scrolling" },
+ { TYPE_SWITCH, &si.fading, "screen_fading" },
+ { TYPE_SWITCH, &si.autorecord, "automatic_tape_recording" },
+ { TYPE_SWITCH, &si.quick_doors, "quick_doors" },
+ { TYPE_SWITCH, &si.team_mode, "team_mode" },
+ { TYPE_SWITCH, &si.handicap, "handicap" },
+ { TYPE_SWITCH, &si.time_limit, "time_limit" },
+ { TYPE_SWITCH, &si.fullscreen, "fullscreen" },
+ { TYPE_SWITCH, &si.ask_on_escape, "ask_on_escape" },
+ { TYPE_STRING, &si.graphics_dir, "graphics_dir" },
+ { TYPE_STRING, &si.sounds_dir, "sounds_dir" },
+ { TYPE_STRING, &si.music_dir, "music_dir" },
+};
+
+static struct TokenInfo shortcut_setup_tokens[] =
+{
+ /* shortcut setup */
+ { TYPE_KEY_X11, &ssi.save_game, "shortcut.save_game" },
+ { TYPE_KEY_X11, &ssi.load_game, "shortcut.load_game" }
+};
+
+static struct TokenInfo player_setup_tokens[] =
+{
+ /* player setup */
+ { TYPE_BOOLEAN, &sii.use_joystick, ".use_joystick" },
+ { TYPE_STRING, &sii.joy.device_name, ".joy.device_name" },
+ { TYPE_INTEGER, &sii.joy.xleft, ".joy.xleft" },
+ { TYPE_INTEGER, &sii.joy.xmiddle, ".joy.xmiddle" },
+ { TYPE_INTEGER, &sii.joy.xright, ".joy.xright" },
+ { TYPE_INTEGER, &sii.joy.yupper, ".joy.yupper" },
+ { TYPE_INTEGER, &sii.joy.ymiddle, ".joy.ymiddle" },
+ { TYPE_INTEGER, &sii.joy.ylower, ".joy.ylower" },
+ { TYPE_INTEGER, &sii.joy.snap, ".joy.snap_field" },
+ { TYPE_INTEGER, &sii.joy.bomb, ".joy.place_bomb" },
+ { TYPE_KEY_X11, &sii.key.left, ".key.move_left" },
+ { TYPE_KEY_X11, &sii.key.right, ".key.move_right" },
+ { TYPE_KEY_X11, &sii.key.up, ".key.move_up" },
+ { TYPE_KEY_X11, &sii.key.down, ".key.move_down" },
+ { TYPE_KEY_X11, &sii.key.snap, ".key.snap_field" },
+ { TYPE_KEY_X11, &sii.key.bomb, ".key.place_bomb" }
+};
+
+static void setSetupInfoToDefaults(struct SetupInfo *si)