{ "menu.button_level_number", UNDEFINED_FILENAME },
{ "menu.button_level_number.active", UNDEFINED_FILENAME },
+ { "menu.button_insert_solution", UNDEFINED_FILENAME },
+ { "menu.button_insert_solution.active", UNDEFINED_FILENAME },
+ { "menu.button_play_solution", UNDEFINED_FILENAME },
+ { "menu.button_play_solution.active", UNDEFINED_FILENAME },
+
{ "menu.scrollbar", "RocksDC.png" },
{ "menu.scrollbar.xpos", "8" },
{ "menu.scrollbar.ypos", "10" },
{ "main.button.next_level.x", "448" },
{ "main.button.next_level.y", "96" },
+ { "main.button.insert_solution.x", "-1" },
+ { "main.button.insert_solution.y", "-1" },
+ { "main.button.play_solution.x", "-1" },
+ { "main.button.play_solution.y", "-1" },
+
{ "main.text.name.x", "-1" },
{ "main.text.name.y", "-1" },
{ "main.text.name.width", "-1" },
#define SCREEN_CTRL_ID_NEXT_LEVEL 1
#define SCREEN_CTRL_ID_PREV_PLAYER 2
#define SCREEN_CTRL_ID_NEXT_PLAYER 3
-#define SCREEN_CTRL_ID_SCROLL_UP 4
-#define SCREEN_CTRL_ID_SCROLL_DOWN 5
-#define SCREEN_CTRL_ID_SCROLL_VERTICAL 6
+#define SCREEN_CTRL_ID_INSERT_SOLUTION 4
+#define SCREEN_CTRL_ID_PLAY_SOLUTION 5
+#define SCREEN_CTRL_ID_SCROLL_UP 6
+#define SCREEN_CTRL_ID_SCROLL_DOWN 7
+#define SCREEN_CTRL_ID_SCROLL_VERTICAL 8
-#define NUM_SCREEN_GADGETS 7
+#define NUM_SCREEN_GADGETS 9
-#define NUM_SCREEN_MENUBUTTONS 4
+#define NUM_SCREEN_MENUBUTTONS 6
#define NUM_SCREEN_SCROLLBUTTONS 2
#define NUM_SCREEN_SCROLLBARS 1
#define SCREEN_MASK_MAIN (1 << 0)
-#define SCREEN_MASK_INPUT (1 << 1)
+#define SCREEN_MASK_MAIN_HAS_SOLUTION (1 << 1)
+#define SCREEN_MASK_INPUT (1 << 2)
/* graphic position and size values for buttons and scrollbars */
#define SC_MENUBUTTON_XSIZE TILEX
static void MapScreenGadgets(int);
static void MapScreenTreeGadgets(TreeInfo *);
+static void UpdateScreenMenuGadgets(int, boolean);
+
static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
static int info_mode = INFO_MODE_MAIN;
/* map gadgets for main menu screen */
MapTapeButtons();
MapScreenMenuGadgets(SCREEN_MASK_MAIN);
+ UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape());
/* copy actual game door content to door double buffer for OpenDoor() */
BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
SaveLevelSetup_SeriesInfo();
+ UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape());
+
/* needed because DrawPreviewLevelInitial() takes some time */
BackToFront();
/* SyncDisplay(); */
*y = mSY + TILEY * MENU_SCREEN_START_YPOS;
break;
+ case SCREEN_CTRL_ID_INSERT_SOLUTION:
+ *x = mSX + GDI_ACTIVE_POS(menu.main.button.insert_solution.x);
+ *y = mSY + GDI_ACTIVE_POS(menu.main.button.insert_solution.y);
+ break;
+
+ case SCREEN_CTRL_ID_PLAY_SOLUTION:
+ *x = mSX + GDI_ACTIVE_POS(menu.main.button.play_solution.x);
+ *y = mSY + GDI_ACTIVE_POS(menu.main.button.play_solution.y);
+ break;
+
default:
Error(ERR_EXIT, "unknown gadget ID %d", gadget_id);
}
SCREEN_MASK_INPUT,
"next player"
},
+ {
+ IMG_MENU_BUTTON_INSERT_SOLUTION, IMG_MENU_BUTTON_INSERT_SOLUTION_ACTIVE,
+ getScreenMenuButtonPos,
+ SCREEN_CTRL_ID_INSERT_SOLUTION,
+ SCREEN_MASK_MAIN_HAS_SOLUTION,
+ "insert solution tape"
+ },
+ {
+ IMG_MENU_BUTTON_PLAY_SOLUTION, IMG_MENU_BUTTON_PLAY_SOLUTION_ACTIVE,
+ getScreenMenuButtonPos,
+ SCREEN_CTRL_ID_PLAY_SOLUTION,
+ SCREEN_MASK_MAIN_HAS_SOLUTION,
+ "play solution tape"
+ },
};
static struct
int gd_x1, gd_x2, gd_y1, gd_y2;
int id = menubutton_info[i].gadget_id;
- event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
+ if (menubutton_info[i].screen_mask == SCREEN_MASK_MAIN_HAS_SOLUTION)
+ event_mask = GD_EVENT_RELEASED;
+ else
+ event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
menubutton_info[i].get_gadget_position(&x, &y, id);
- width = SC_MENUBUTTON_XSIZE;
- height = SC_MENUBUTTON_YSIZE;
+ if (menubutton_info[i].screen_mask == SCREEN_MASK_MAIN_HAS_SOLUTION)
+ {
+ width = graphic_info[menubutton_info[i].gfx_pressed].width;
+ height = graphic_info[menubutton_info[i].gfx_pressed].height;
+ }
+ else
+ {
+ width = SC_MENUBUTTON_XSIZE;
+ height = SC_MENUBUTTON_YSIZE;
+ }
gfx_unpressed = menubutton_info[i].gfx_unpressed;
gfx_pressed = menubutton_info[i].gfx_pressed;
MapGadget(screen_gadget[menubutton_info[i].gadget_id]);
}
+void UnmapScreenMenuGadgets(int screen_mask)
+{
+ int i;
+
+ for (i = 0; i < NUM_SCREEN_MENUBUTTONS; i++)
+ {
+ if (screen_mask & menubutton_info[i].screen_mask)
+ {
+ UnmapGadget(screen_gadget[menubutton_info[i].gadget_id]);
+
+ if (screen_mask & SCREEN_MASK_MAIN_HAS_SOLUTION)
+ DrawBackground(screen_gadget[menubutton_info[i].gadget_id]->x,
+ screen_gadget[menubutton_info[i].gadget_id]->y,
+ screen_gadget[menubutton_info[i].gadget_id]->width,
+ screen_gadget[menubutton_info[i].gadget_id]->height);
+ }
+ }
+}
+
+void UpdateScreenMenuGadgets(int screen_mask, boolean map_gadgets)
+{
+ if (map_gadgets)
+ MapScreenMenuGadgets(screen_mask);
+ else
+ UnmapScreenMenuGadgets(screen_mask);
+}
+
void MapScreenGadgets(int num_entries)
{
int i;
HandleSetupScreen_Input_Player(step, +1);
break;
+ case SCREEN_CTRL_ID_INSERT_SOLUTION:
+ InsertSolutionTape();
+ break;
+
+ case SCREEN_CTRL_ID_PLAY_SOLUTION:
+ PlaySolutionTape();
+ break;
+
case SCREEN_CTRL_ID_SCROLL_UP:
if (game_status == GAME_MODE_LEVELS)
HandleChooseLevelSet(0,0, 0, -1 * SCROLL_LINE, MB_MENU_MARK);