#define SETUP_TOKEN_TOUCH_CONTROL_TYPE 41
#define SETUP_TOKEN_TOUCH_MOVE_DISTANCE 42
#define SETUP_TOKEN_TOUCH_DROP_DISTANCE 43
-#define SETUP_TOKEN_TOUCH_GRID_XSIZE_0 44
-#define SETUP_TOKEN_TOUCH_GRID_YSIZE_0 45
-#define SETUP_TOKEN_TOUCH_GRID_XSIZE_1 46
-#define SETUP_TOKEN_TOUCH_GRID_YSIZE_1 47
+#define SETUP_TOKEN_TOUCH_TRANSPARENCY 44
+#define SETUP_TOKEN_TOUCH_GRID_XSIZE_0 45
+#define SETUP_TOKEN_TOUCH_GRID_YSIZE_0 46
+#define SETUP_TOKEN_TOUCH_GRID_XSIZE_1 47
+#define SETUP_TOKEN_TOUCH_GRID_YSIZE_1 48
-#define NUM_GLOBAL_SETUP_TOKENS 48
+#define NUM_GLOBAL_SETUP_TOKENS 49
/* auto setup */
#define SETUP_TOKEN_AUTO_EDITOR_ZOOM_TILESIZE 0
{ TYPE_STRING, &si.touch.control_type, "touch.control_type" },
{ TYPE_INTEGER,&si.touch.move_distance, "touch.move_distance" },
{ TYPE_INTEGER,&si.touch.drop_distance, "touch.drop_distance" },
+ { TYPE_INTEGER,&si.touch.transparency, "touch.transparency" },
{ TYPE_INTEGER,&si.touch.grid_xsize[0], "touch.virtual_buttons.0.xsize" },
{ TYPE_INTEGER,&si.touch.grid_ysize[0], "touch.virtual_buttons.0.ysize" },
{ TYPE_INTEGER,&si.touch.grid_xsize[1], "touch.virtual_buttons.1.xsize" },
si->touch.control_type = getStringCopy(TOUCH_CONTROL_DEFAULT);
si->touch.move_distance = TOUCH_MOVE_DISTANCE_DEFAULT; /* percent */
si->touch.drop_distance = TOUCH_DROP_DISTANCE_DEFAULT; /* percent */
+ si->touch.transparency = TOUCH_TRANSPARENCY_DEFAULT; /* percent */
for (i = 0; i < 2; i++)
{
#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 28
#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 29
#define SETUP_MODE_CHOOSE_DROP_DISTANCE 30
+#define SETUP_MODE_CHOOSE_TRANSPARENCY 31
-#define MAX_SETUP_MODES 31
+#define MAX_SETUP_MODES 32
#define MAX_MENU_MODES MAX(MAX_INFO_MODES, MAX_SETUP_MODES)
#define STR_SETUP_CHOOSE_TOUCH_CONTROL "Control Type"
#define STR_SETUP_CHOOSE_MOVE_DISTANCE "Move Distance"
#define STR_SETUP_CHOOSE_DROP_DISTANCE "Drop Distance"
+#define STR_SETUP_CHOOSE_TRANSPARENCY "Transparency"
/* for input setup functions */
#define SETUPINPUT_SCREEN_POS_START 0
static TreeInfo *drop_distances = NULL;
static TreeInfo *drop_distance_current = NULL;
+static TreeInfo *transparencies = NULL;
+static TreeInfo *transparency_current = NULL;
+
static TreeInfo *level_number = NULL;
static TreeInfo *level_number_current = NULL;
{ -1, NULL },
};
+static struct
+{
+ int value;
+ char *text;
+} transparencies_list[] =
+{
+ { 0, "0 % (Opaque)" },
+ { 10, "10 %" },
+ { 20, "20 %" },
+ { 30, "30 %" },
+ { 40, "40 %" },
+ { 50, "50 %" },
+ { 60, "60 %" },
+ { 70, "70 %" },
+ { 80, "80 %" },
+ { 90, "90 %" },
+ { 100, "100 % (Invisible)" },
+
+ { -1, NULL },
+};
+
#define DRAW_MODE(s) ((s) >= GAME_MODE_MAIN && \
(s) <= GAME_MODE_SETUP ? (s) : \
(s) == GAME_MODE_PSEUDO_TYPENAME ? \
execSetupSound();
else if (setup_mode == SETUP_MODE_CHOOSE_TOUCH_CONTROL ||
setup_mode == SETUP_MODE_CHOOSE_MOVE_DISTANCE ||
- setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE)
+ setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE ||
+ setup_mode == SETUP_MODE_CHOOSE_TRANSPARENCY)
execSetupTouch();
else
execSetupArtwork();
execSetupSound();
else if (setup_mode == SETUP_MODE_CHOOSE_TOUCH_CONTROL ||
setup_mode == SETUP_MODE_CHOOSE_MOVE_DISTANCE ||
- setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE)
+ setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE ||
+ setup_mode == SETUP_MODE_CHOOSE_TRANSPARENCY)
execSetupTouch();
else
execSetupArtwork();
execSetupSound();
else if (setup_mode == SETUP_MODE_CHOOSE_TOUCH_CONTROL ||
setup_mode == SETUP_MODE_CHOOSE_MOVE_DISTANCE ||
- setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE)
+ setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE ||
+ setup_mode == SETUP_MODE_CHOOSE_TRANSPARENCY)
execSetupTouch();
else
execSetupArtwork();
static char *touch_controls_text;
static char *move_distance_text;
static char *drop_distance_text;
+static char *transparency_text;
static void execSetupMain()
{
DrawSetupScreen();
}
+static void execSetupChooseTransparency()
+{
+ setup_mode = SETUP_MODE_CHOOSE_TRANSPARENCY;
+
+ DrawSetupScreen();
+}
+
static void execSetupConfigureVirtualButtons()
{
ConfigureVirtualButtons();
drop_distance_current = drop_distances;
}
+ if (transparencies == NULL)
+ {
+ int i;
+
+ for (i = 0; transparencies_list[i].value != -1; i++)
+ {
+ TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+ char identifier[32], name[32];
+ int value = transparencies_list[i].value;
+ char *text = transparencies_list[i].text;
+
+ ti->node_top = &transparencies;
+ ti->sort_priority = value;
+
+ sprintf(identifier, "%d", value);
+ sprintf(name, "%s", text);
+
+ setString(&ti->identifier, identifier);
+ setString(&ti->name, name);
+ setString(&ti->name_sorting, name);
+ setString(&ti->infotext, STR_SETUP_CHOOSE_TRANSPARENCY);
+
+ pushTreeInfo(&transparencies, ti);
+ }
+
+ /* sort transparency values to start with lowest transparency value */
+ sortTreeInfo(&transparencies);
+
+ /* set current transparency value to configured transparency value */
+ transparency_current =
+ getTreeInfoFromIdentifier(transparencies,
+ i_to_a(setup.touch.transparency));
+
+ /* if that fails, set current transparency to reliable default value */
+ if (transparency_current == NULL)
+ transparency_current =
+ getTreeInfoFromIdentifier(transparencies,
+ i_to_a(TOUCH_TRANSPARENCY_DEFAULT));
+
+ /* if that also fails, set current transparency to first available value */
+ if (transparency_current == NULL)
+ transparency_current = transparencies;
+ }
+
setup.touch.control_type = touch_control_current->identifier;
setup.touch.move_distance = atoi(move_distance_current->identifier);
setup.touch.drop_distance = atoi(drop_distance_current->identifier);
+ setup.touch.transparency = atoi(transparency_current->identifier);
/* needed for displaying volume text instead of identifier */
touch_controls_text = touch_control_current->name;
move_distance_text = move_distance_current->name;
drop_distance_text = drop_distance_current->name;
+ transparency_text = transparency_current->name;
setup_mode = SETUP_MODE_TOUCH;
{ &setup.touch.drop_distance, execSetupChooseDropDistance },
{ &setup.touch.drop_distance, &drop_distance_text },
+ { &setup.touch.transparency, execSetupChooseTransparency },
+ { &setup.touch.transparency, &transparency_text },
+
{ NULL, NULL }
};
{ TYPE_ENTER_LIST, execSetupChooseTouchControls, "Touch Control Type:" },
{ TYPE_STRING, &touch_controls_text, "" },
{ TYPE_EMPTY, NULL, "" },
+ { TYPE_ENTER_LIST, execSetupChooseTransparency, "Transparency:" },
+ { TYPE_STRING, &transparency_text, "" },
+ { TYPE_EMPTY, NULL, "" },
{ TYPE_ENTER_LIST, execSetupConfigureVirtualButtons, "Configure Virtual Buttons" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupMain, "Back" },
DrawChooseTree(&move_distance_current);
else if (setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE)
DrawChooseTree(&drop_distance_current);
+ else if (setup_mode == SETUP_MODE_CHOOSE_TRANSPARENCY)
+ DrawChooseTree(&transparency_current);
else
DrawSetupScreen_Generic();
HandleChooseTree(mx, my, dx, dy, button, &move_distance_current);
else if (setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE)
HandleChooseTree(mx, my, dx, dy, button, &drop_distance_current);
+ else if (setup_mode == SETUP_MODE_CHOOSE_TRANSPARENCY)
+ HandleChooseTree(mx, my, dx, dy, button, &transparency_current);
else
HandleSetupScreen_Generic(mx, my, dx, dy, button);
}