#include "files.h"
#include "init.h"
+#include "screens.h"
#include "tools.h"
#include "tape.h"
#include "config.h"
si->touch.move_distance = TOUCH_MOVE_DISTANCE_DEFAULT; /* percent */
si->touch.drop_distance = TOUCH_DROP_DISTANCE_DEFAULT; /* percent */
+ for (i = 0; i < 2; i++)
+ {
+ char *default_grid_button[6][2] =
+ {
+ { " ", " ^^ " },
+ { " ", " ^^ " },
+ { " ", "<< >>" },
+ { " ", "<< >>" },
+ { "111222", " vv " },
+ { "111222", " vv " }
+ };
+ int grid_xsize = DEFAULT_GRID_XSIZE(i);
+ int grid_ysize = DEFAULT_GRID_YSIZE(i);
+ int min_xsize = MIN(6, grid_xsize);
+ int min_ysize = MIN(6, grid_ysize);
+ int startx = grid_xsize - min_xsize;
+ int starty = grid_ysize - min_ysize;
+ int x, y;
+
+ // virtual buttons grid can only be set to defaults if video is initialized
+ // (this will be repeated if virtual buttons are not loaded from setup file)
+ if (video.initialized)
+ {
+ si->touch.grid_xsize[i] = grid_xsize;
+ si->touch.grid_ysize[i] = grid_ysize;
+ }
+ else
+ {
+ si->touch.grid_xsize[i] = -1;
+ si->touch.grid_ysize[i] = -1;
+ }
+
+ for (x = 0; x < MAX_GRID_XSIZE; x++)
+ for (y = 0; y < MAX_GRID_YSIZE; y++)
+ si->touch.grid_button[i][x][y] = CHAR_GRID_BUTTON_NONE;
+
+ for (x = 0; x < min_xsize; x++)
+ for (y = 0; y < min_ysize; y++)
+ si->touch.grid_button[i][x][starty + y] =
+ default_grid_button[y][0][x];
+
+ for (x = 0; x < min_xsize; x++)
+ for (y = 0; y < min_ysize; y++)
+ si->touch.grid_button[i][startx + x][starty + y] =
+ default_grid_button[y][1][x];
+ }
+
+ si->touch.grid_initialized = video.initialized;
+
si->editor.el_boulderdash = TRUE;
si->editor.el_emerald_mine = TRUE;
si->editor.el_emerald_mine_club = TRUE;
return hide_setup_token;
}
-static void setHideSetupEntry(void *setup_value_raw)
+void setHideSetupEntry(void *setup_value)
{
- /* !!! DIRTY WORKAROUND; TO BE FIXED AFTER THE MM ENGINE RELEASE !!! */
- void *setup_value = setup_value_raw - (void *)&si + (void *)&setup;
-
char *hide_setup_token = getHideSetupToken(setup_value);
if (setup_value != NULL)
setHashEntry(hide_setup_hash, hide_setup_token, "");
}
+static void setHideSetupEntryRaw(char *token_text, void *setup_value_raw)
+{
+ /* !!! DIRTY WORKAROUND; TO BE FIXED AFTER THE MM ENGINE RELEASE !!! */
+ void *setup_value = setup_value_raw - (void *)&si + (void *)&setup;
+
+ setHideSetupEntry(setup_value);
+}
+
boolean hideSetupEntry(void *setup_value)
{
char *hide_setup_token = getHideSetupToken(setup_value);
/* check if this setup option should be hidden in the setup menu */
if (token_hide_value != NULL && get_boolean_from_string(token_hide_value))
- setHideSetupEntry(token_info[token_nr].value);
+ setHideSetupEntryRaw(token_text, token_info[token_nr].value);
}
static void setSetupInfoFromTokenInfo(SetupFileHash *setup_file_hash,
for (i = 0; i < NUM_OPTIONS_SETUP_TOKENS; i++)
setSetupInfoFromTokenInfo(setup_file_hash, options_setup_tokens, i);
setup.options = soi;
+
+ setHideRelatedSetupEntries();
}
static void decodeSetupFileHash_AutoSetup(SetupFileHash *setup_file_hash)
/* (eg, init "menu.line_spacing.INFO[XXX]" from "menu.line_spacing.INFO") */
for (i = 0; i < NUM_SPECIAL_GFX_INFO_ARGS; i++)
{
- char *value_1 = getHashEntry(setup_file_hash,"menu.paragraph_spacing.INFO");
- char *value_2 = getHashEntry(setup_file_hash,"menu.headline1_spacing.INFO");
- char *value_3 = getHashEntry(setup_file_hash,"menu.headline2_spacing.INFO");
- char *value_4 = getHashEntry(setup_file_hash,"menu.line_spacing.INFO");
- char *value_5 = getHashEntry(setup_file_hash,"menu.extra_spacing.INFO");
+ char *value_1 = getHashEntry(setup_file_hash,"menu.left_spacing.INFO");
+ char *value_2 = getHashEntry(setup_file_hash,"menu.right_spacing.INFO");
+ char *value_3 = getHashEntry(setup_file_hash,"menu.top_spacing.INFO");
+ char *value_4 = getHashEntry(setup_file_hash,"menu.bottom_spacing.INFO");
+ char *value_5 = getHashEntry(setup_file_hash,"menu.paragraph_spacing.INFO");
+ char *value_6 = getHashEntry(setup_file_hash,"menu.headline1_spacing.INFO");
+ char *value_7 = getHashEntry(setup_file_hash,"menu.headline2_spacing.INFO");
+ char *value_8 = getHashEntry(setup_file_hash,"menu.line_spacing.INFO");
+ char *value_9 = getHashEntry(setup_file_hash,"menu.extra_spacing.INFO");
if (value_1 != NULL)
- menu.paragraph_spacing_info[i] = get_integer_from_string(value_1);
+ menu.left_spacing_info[i] = get_integer_from_string(value_1);
if (value_2 != NULL)
- menu.headline1_spacing_info[i] = get_integer_from_string(value_2);
+ menu.right_spacing_info[i] = get_integer_from_string(value_2);
if (value_3 != NULL)
- menu.headline2_spacing_info[i] = get_integer_from_string(value_3);
+ menu.top_spacing_info[i] = get_integer_from_string(value_3);
if (value_4 != NULL)
- menu.line_spacing_info[i] = get_integer_from_string(value_4);
+ menu.bottom_spacing_info[i] = get_integer_from_string(value_4);
if (value_5 != NULL)
- menu.extra_spacing_info[i] = get_integer_from_string(value_5);
+ menu.paragraph_spacing_info[i] = get_integer_from_string(value_5);
+ if (value_6 != NULL)
+ menu.headline1_spacing_info[i] = get_integer_from_string(value_6);
+ if (value_7 != NULL)
+ menu.headline2_spacing_info[i] = get_integer_from_string(value_7);
+ if (value_8 != NULL)
+ menu.line_spacing_info[i] = get_integer_from_string(value_8);
+ if (value_9 != NULL)
+ menu.extra_spacing_info[i] = get_integer_from_string(value_9);
}
/* special case: initialize with default values that may be overwritten */