+ // ---------- perform action set by handling events ----------
+
+ if (action == ACTION_ESCAPE)
+ {
+ // abort and restore the old key bindings
+
+ for (x = 0; x < MAX_GRID_XSIZE; x++)
+ for (y = 0; y < MAX_GRID_YSIZE; y++)
+ overlay.grid_button[x][y] = grid_button_old[x][y];
+
+ FadeSkipNextFadeIn();
+
+ finished = TRUE;
+ }
+ else if (action == ACTION_BACK)
+ {
+ // keep the configured key bindings and go to previous page
+
+ step_nr--;
+
+ if (step_nr < 0)
+ {
+ FadeSkipNextFadeIn();
+
+ finished = TRUE;
+ }
+ }
+ else if (action == ACTION_NEXT)
+ {
+ // keep the configured key bindings and go to next page
+
+ step_nr++;
+
+ // all virtual buttons configured
+ if (step_nr == 6)
+ {
+ finished = TRUE;
+ success = TRUE;
+ }
+ }
+
+ if (action != ACTION_NONE && !finished)
+ {
+ for (x = 0; x < MAX_GRID_XSIZE; x++)
+ for (y = 0; y < MAX_GRID_YSIZE; y++)
+ grid_button_tmp[x][y] = overlay.grid_button[x][y];
+
+ overlay.grid_button_highlight = grid_button[step_nr];
+
+ // configure next virtual button
+
+ ClearField();
+
+ DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, "Virtual Buttons");
+ DrawTextSCentered(ypos1, font_nr, "Select tiles to");
+ DrawTextSCentered(ypos2, font_nr, customize_step_text[step_nr]);
+ }
+