improved debug output for level/tape file, game and engine versions
[rocksndiamonds.git] / src / screens.c
index b4f2e5fc8d46003189d0d2abf4c0435be3226116..17513d2c834a326dca593d8901b601484ec8b8ac 100644 (file)
 #define SCREEN_CTRL_ID_NEXT_PLAYER     6
 #define SCREEN_CTRL_ID_INSERT_SOLUTION 7
 #define SCREEN_CTRL_ID_PLAY_SOLUTION   8
-#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE 9
-#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE 10
-#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE2        11
-#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE2        12
-#define SCREEN_CTRL_ID_SCROLL_UP       13
-#define SCREEN_CTRL_ID_SCROLL_DOWN     14
-#define SCREEN_CTRL_ID_SCROLL_VERTICAL 15
-#define SCREEN_CTRL_ID_NETWORK_SERVER  16
-
-#define NUM_SCREEN_GADGETS             17
-
-#define NUM_SCREEN_MENUBUTTONS         13
+#define SCREEN_CTRL_ID_SWITCH_ECS_AGA  9
+#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE 10
+#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE 11
+#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE2        12
+#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE2        13
+#define SCREEN_CTRL_ID_SCROLL_UP       14
+#define SCREEN_CTRL_ID_SCROLL_DOWN     15
+#define SCREEN_CTRL_ID_SCROLL_VERTICAL 16
+#define SCREEN_CTRL_ID_NETWORK_SERVER  17
+
+#define NUM_SCREEN_GADGETS             18
+
+#define NUM_SCREEN_MENUBUTTONS         14
 #define NUM_SCREEN_SCROLLBUTTONS       2
 #define NUM_SCREEN_SCROLLBARS          1
 #define NUM_SCREEN_TEXTINPUT           1
@@ -6255,6 +6256,7 @@ static struct TokenInfo setup_info_game[] =
   { TYPE_ENTER_LIST,   execSetupChooseScrollDelay, "Scroll Delay:"     },
   { TYPE_STRING,       &scroll_delay_text,     ""                      },
 #endif
+  { TYPE_SWITCH,       &setup.forced_scroll_delay,"Scroll Delay in EM engine:" },
   { TYPE_ENTER_LIST, execSetupChooseSnapshotMode,"Game Engine Snapshot Mode:" },
   { TYPE_STRING,       &snapshot_mode_text,    ""                      },
   { TYPE_SWITCH,       &setup.show_snapshot_buttons,"Show Snapshot Buttons:" },
@@ -8379,6 +8381,7 @@ static struct
 {
   int gfx_unpressed, gfx_pressed;
   struct MenuPosInfo *pos;
+  boolean *check_value;
   int gadget_id;
   int screen_mask;
   unsigned int event_mask;
@@ -8388,7 +8391,7 @@ static struct
 {
   {
     IMG_MENU_BUTTON_PREV_LEVEL, IMG_MENU_BUTTON_PREV_LEVEL_ACTIVE,
-    &menu.main.button.prev_level,
+    &menu.main.button.prev_level, NULL,
     SCREEN_CTRL_ID_PREV_LEVEL,
     SCREEN_MASK_MAIN,
     GD_EVENT_PRESSED | GD_EVENT_REPEATED,
@@ -8396,7 +8399,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_NEXT_LEVEL, IMG_MENU_BUTTON_NEXT_LEVEL_ACTIVE,
-    &menu.main.button.next_level,
+    &menu.main.button.next_level, NULL,
     SCREEN_CTRL_ID_NEXT_LEVEL,
     SCREEN_MASK_MAIN,
     GD_EVENT_PRESSED | GD_EVENT_REPEATED,
@@ -8404,7 +8407,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_FIRST_LEVEL, IMG_MENU_BUTTON_FIRST_LEVEL_ACTIVE,
-    &menu.main.button.first_level,
+    &menu.main.button.first_level, NULL,
     SCREEN_CTRL_ID_FIRST_LEVEL,
     SCREEN_MASK_MAIN,
     GD_EVENT_RELEASED,
@@ -8412,7 +8415,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_LAST_LEVEL, IMG_MENU_BUTTON_LAST_LEVEL_ACTIVE,
-    &menu.main.button.last_level,
+    &menu.main.button.last_level, NULL,
     SCREEN_CTRL_ID_LAST_LEVEL,
     SCREEN_MASK_MAIN,
     GD_EVENT_RELEASED,
@@ -8420,7 +8423,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_LEVEL_NUMBER, IMG_MENU_BUTTON_LEVEL_NUMBER_ACTIVE,
-    &menu.main.button.level_number,
+    &menu.main.button.level_number, NULL,
     SCREEN_CTRL_ID_LEVEL_NUMBER,
     SCREEN_MASK_MAIN,
     GD_EVENT_RELEASED,
@@ -8428,7 +8431,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_LEFT, IMG_MENU_BUTTON_LEFT_ACTIVE,
-    &menu.setup.button.prev_player,
+    &menu.setup.button.prev_player, NULL,
     SCREEN_CTRL_ID_PREV_PLAYER,
     SCREEN_MASK_INPUT,
     GD_EVENT_PRESSED | GD_EVENT_REPEATED,
@@ -8436,7 +8439,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_RIGHT, IMG_MENU_BUTTON_RIGHT_ACTIVE,
-    &menu.setup.button.next_player,
+    &menu.setup.button.next_player, NULL,
     SCREEN_CTRL_ID_NEXT_PLAYER,
     SCREEN_MASK_INPUT,
     GD_EVENT_PRESSED | GD_EVENT_REPEATED,
@@ -8444,7 +8447,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_INSERT_SOLUTION, IMG_MENU_BUTTON_INSERT_SOLUTION_ACTIVE,
-    &menu.main.button.insert_solution,
+    &menu.main.button.insert_solution, NULL,
     SCREEN_CTRL_ID_INSERT_SOLUTION,
     SCREEN_MASK_MAIN_HAS_SOLUTION,
     GD_EVENT_RELEASED,
@@ -8452,15 +8455,23 @@ static struct
   },
   {
     IMG_MENU_BUTTON_PLAY_SOLUTION, IMG_MENU_BUTTON_PLAY_SOLUTION_ACTIVE,
-    &menu.main.button.play_solution,
+    &menu.main.button.play_solution, NULL,
     SCREEN_CTRL_ID_PLAY_SOLUTION,
     SCREEN_MASK_MAIN_HAS_SOLUTION,
     GD_EVENT_RELEASED,
     FALSE, "play solution tape"
   },
+  {
+    IMG_MENU_BUTTON_SWITCH_ECS_AGA, IMG_MENU_BUTTON_SWITCH_ECS_AGA_ACTIVE,
+    &menu.main.button.switch_ecs_aga, &setup.prefer_aga_graphics,
+    SCREEN_CTRL_ID_SWITCH_ECS_AGA,
+    SCREEN_MASK_MAIN,
+    GD_EVENT_RELEASED | GD_EVENT_OFF_BORDERS,
+    FALSE, "switch ECS/AGA chipset"
+  },
   {
     IMG_MENU_BUTTON_TOUCH_BACK, IMG_MENU_BUTTON_TOUCH_BACK,
-    &menu.setup.button.touch_back,
+    &menu.setup.button.touch_back, NULL,
     SCREEN_CTRL_ID_TOUCH_PREV_PAGE,
     SCREEN_MASK_TOUCH,
     GD_EVENT_RELEASED,
@@ -8468,7 +8479,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_TOUCH_NEXT, IMG_MENU_BUTTON_TOUCH_NEXT,
-    &menu.setup.button.touch_next,
+    &menu.setup.button.touch_next, NULL,
     SCREEN_CTRL_ID_TOUCH_NEXT_PAGE,
     SCREEN_MASK_TOUCH,
     GD_EVENT_RELEASED,
@@ -8476,7 +8487,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_TOUCH_BACK2, IMG_MENU_BUTTON_TOUCH_BACK2,
-    &menu.setup.button.touch_back2,
+    &menu.setup.button.touch_back2, NULL,
     SCREEN_CTRL_ID_TOUCH_PREV_PAGE2,
     SCREEN_MASK_TOUCH2,
     GD_EVENT_RELEASED,
@@ -8484,7 +8495,7 @@ static struct
   },
   {
     IMG_MENU_BUTTON_TOUCH_NEXT2, IMG_MENU_BUTTON_TOUCH_NEXT2,
-    &menu.setup.button.touch_next2,
+    &menu.setup.button.touch_next2, NULL,
     SCREEN_CTRL_ID_TOUCH_NEXT_PAGE2,
     SCREEN_MASK_TOUCH2,
     GD_EVENT_RELEASED,
@@ -8564,11 +8575,15 @@ static void CreateScreenMenubuttons(void)
   {
     struct MenuPosInfo *pos = menubutton_info[i].pos;
     boolean is_touch_button = menubutton_info[i].is_touch_button;
+    boolean is_check_button = menubutton_info[i].check_value != NULL;
     Bitmap *gd_bitmap_unpressed, *gd_bitmap_pressed;
     int gfx_unpressed, gfx_pressed;
     int x, y, width, height;
     int gd_x1, gd_x2, gd_y1, gd_y2;
+    int gd_x1a, gd_x2a, gd_y1a, gd_y2a;
     int id = menubutton_info[i].gadget_id;
+    int type = GD_TYPE_NORMAL_BUTTON;
+    boolean checked = FALSE;
 
     event_mask = menubutton_info[i].event_mask;
 
@@ -8586,6 +8601,10 @@ static void CreateScreenMenubuttons(void)
     gd_y1 = graphic_info[gfx_unpressed].src_y;
     gd_x2 = graphic_info[gfx_pressed].src_x;
     gd_y2 = graphic_info[gfx_pressed].src_y;
+    gd_x1a = gd_x1;
+    gd_y1a = gd_y1;
+    gd_x2a = gd_x2;
+    gd_y2a = gd_y2;
 
     if (is_touch_button)
     {
@@ -8593,6 +8612,17 @@ static void CreateScreenMenubuttons(void)
       gd_y2 += graphic_info[gfx_pressed].pressed_yoffset;
     }
 
+    if (is_check_button)
+    {
+      gd_x1a += graphic_info[gfx_unpressed].active_xoffset;
+      gd_y1a += graphic_info[gfx_unpressed].active_yoffset;
+      gd_x2a += graphic_info[gfx_pressed].active_xoffset;
+      gd_y2a += graphic_info[gfx_pressed].active_yoffset;
+
+      type = GD_TYPE_CHECK_BUTTON;
+      checked = *menubutton_info[i].check_value;
+    }
+
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
                      GDI_IMAGE_ID, gfx_unpressed,
@@ -8601,10 +8631,13 @@ static void CreateScreenMenubuttons(void)
                      GDI_Y, y,
                      GDI_WIDTH, width,
                      GDI_HEIGHT, height,
-                     GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
+                     GDI_TYPE, type,
                      GDI_STATE, GD_BUTTON_UNPRESSED,
+                     GDI_CHECKED, checked,
                      GDI_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1, gd_y1,
                      GDI_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2, gd_y2,
+                      GDI_ALT_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1a, gd_y1a,
+                      GDI_ALT_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2a, gd_y2a,
                      GDI_DIRECT_DRAW, FALSE,
                      GDI_OVERLAY_TOUCH_BUTTON, is_touch_button,
                      GDI_EVENT_MASK, event_mask,
@@ -8934,6 +8967,11 @@ static void HandleScreenGadgets(struct GadgetInfo *gi)
       PlaySolutionTape();
       break;
 
+    case SCREEN_CTRL_ID_SWITCH_ECS_AGA:
+      setup.prefer_aga_graphics = !setup.prefer_aga_graphics;
+      DrawMainMenu();
+      break;
+
     case SCREEN_CTRL_ID_TOUCH_PREV_PAGE:
     case SCREEN_CTRL_ID_TOUCH_NEXT_PAGE:
     case SCREEN_CTRL_ID_TOUCH_PREV_PAGE2: