added some more graphics customization options for the level editor
authorHolger Schemel <info@artsoft.org>
Tue, 9 Dec 2014 20:40:01 +0000 (21:40 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 9 Dec 2014 20:40:01 +0000 (21:40 +0100)
ChangeLog
src/conf_gfx.c
src/conf_gfx.h
src/conf_var.c
src/editor.c
src/main.h

index d0d59fcc4b480adf406f8e8d35be631f0362b154..ca0742a8e7cef9573b5c62227f1d7d6f99507eca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-12-03
+       * added some more graphics customization options for the level editor:
+         - editor.button.prev_level (position)
+         - editor.button.next_level (position)
+         - editor.input.level_number (position)
+         - editor.palette.tile_size (tile size for palette elements)
+         - editor.palette.element_left.tile_size (draw element tile size)
+         - editor.palette.element_middle.tile_size (draw element tile size)
+         - editor.palette.element_right.tile_size (draw element tile size)
+         - editor.input.gfx.level_number (current level number input field)
+
 2014-11-22
        * fixed menu display bugs caused by drawing outside menu area (again)
 
index 58bb898c42219ac0a048447c53d247372e482349..c7e9d7895e1fbbb3a97ca4fe4e225ca239d3d5fd 100644 (file)
@@ -5305,6 +5305,13 @@ struct ConfigInfo image_config[] =
   { "editor.button.gfx.next_level.height",     "16"                    },
   { "editor.button.gfx.next_level.pressed_xoffset", "-16"              },
 
+  { "editor.input.gfx.level_number",           "RocksDoor.png"         },
+  { "editor.input.gfx.level_number.x",         "529"                   },
+  { "editor.input.gfx.level_number.y",         "5"                     },
+  { "editor.input.gfx.level_number.width",     "42"                    },
+  { "editor.input.gfx.level_number.height",    "16"                    },
+  { "editor.input.gfx.level_number.border_size","1"                    },
+
   { "background",                              UNDEFINED_FILENAME      },
   { "background.TITLE_INITIAL",                        UNDEFINED_FILENAME      },
   { "background.TITLE",                                UNDEFINED_FILENAME      },
@@ -7094,17 +7101,28 @@ struct ConfigInfo image_config[] =
 
   { "tape.show_game_buttons",                  "false"                 },
 
+  { "editor.button.prev_level.x",              "5"                     },
+  { "editor.button.prev_level.y",              "5"                     },
+  { "editor.button.next_level.x",              "79"                    },
+  { "editor.button.next_level.y",              "5"                     },
+  { "editor.input.level_number.x",             "29"                    },
+  { "editor.input.level_number.y",             "5"                     },
+
   { "editor.palette.x",                                "5"                     },
   { "editor.palette.y",                                "30"                    },
   { "editor.palette.cols",                     "4"                     },
   { "editor.palette.rows",                     "11"                    },
+  { "editor.palette.tile_size",                        "16"                    },
 
   { "editor.palette.element_left.x",           "6"                     },
   { "editor.palette.element_left.y",           "258"                   },
+  { "editor.palette.element_left.tile_size",   "16"                    },
   { "editor.palette.element_middle.x",         "42"                    },
   { "editor.palette.element_middle.y",         "258"                   },
+  { "editor.palette.element_middle.tile_size", "16"                    },
   { "editor.palette.element_right.x",          "78"                    },
   { "editor.palette.element_right.y",          "258"                   },
+  { "editor.palette.element_right.tile_size",  "16"                    },
 
   { "request.button.yes.x",                    "2"                     },
   { "request.button.yes.y",                    "250"                   },
index 1d427115212f0e37a1879d8dff067c87df16011e..6e1914fde80f28b198a8ed6d1505d861065156b1 100644 (file)
 #define IMG_EDITOR_PLAYFIELD_SCROLLBAR                 1805
 #define IMG_EDITOR_BUTTON_GFX_PREV_LEVEL               1806
 #define IMG_EDITOR_BUTTON_GFX_NEXT_LEVEL               1807
-#define IMG_BACKGROUND                                 1808
-#define IMG_BACKGROUND_TITLE_INITIAL                   1809
-#define IMG_BACKGROUND_TITLE                           1810
-#define IMG_BACKGROUND_MAIN                            1811
-#define IMG_BACKGROUND_LEVELS                          1812
-#define IMG_BACKGROUND_LEVELNR                         1813
-#define IMG_BACKGROUND_SCORES                          1814
-#define IMG_BACKGROUND_EDITOR                          1815
-#define IMG_BACKGROUND_INFO                            1816
-#define IMG_BACKGROUND_INFO_ELEMENTS                   1817
-#define IMG_BACKGROUND_INFO_MUSIC                      1818
-#define IMG_BACKGROUND_INFO_CREDITS                    1819
-#define IMG_BACKGROUND_INFO_PROGRAM                    1820
-#define IMG_BACKGROUND_INFO_VERSION                    1821
-#define IMG_BACKGROUND_INFO_LEVELSET                   1822
-#define IMG_BACKGROUND_SETUP                           1823
-#define IMG_BACKGROUND_PLAYING                         1824
-#define IMG_BACKGROUND_DOOR                            1825
-#define IMG_BACKGROUND_TAPE                            1826
-#define IMG_BACKGROUND_PANEL                           1827
-#define IMG_BACKGROUND_PALETTE                         1828
-#define IMG_BACKGROUND_TOOLBOX                         1829
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1           1830
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2           1831
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3           1832
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_4           1833
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_5           1834
-#define IMG_BACKGROUND_TITLESCREEN_1                   1835
-#define IMG_BACKGROUND_TITLESCREEN_2                   1836
-#define IMG_BACKGROUND_TITLESCREEN_3                   1837
-#define IMG_BACKGROUND_TITLESCREEN_4                   1838
-#define IMG_BACKGROUND_TITLESCREEN_5                   1839
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_1          1840
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_2          1841
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_3          1842
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_4          1843
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_5          1844
-#define IMG_BACKGROUND_TITLEMESSAGE_1                  1845
-#define IMG_BACKGROUND_TITLEMESSAGE_2                  1846
-#define IMG_BACKGROUND_TITLEMESSAGE_3                  1847
-#define IMG_BACKGROUND_TITLEMESSAGE_4                  1848
-#define IMG_BACKGROUND_TITLEMESSAGE_5                  1849
-#define IMG_BACKGROUND_ENVELOPE_1                      1850
-#define IMG_BACKGROUND_ENVELOPE_2                      1851
-#define IMG_BACKGROUND_ENVELOPE_3                      1852
-#define IMG_BACKGROUND_ENVELOPE_4                      1853
-#define IMG_BACKGROUND_REQUEST                         1854
-#define IMG_TITLESCREEN_INITIAL_1                      1855
-#define IMG_TITLESCREEN_INITIAL_2                      1856
-#define IMG_TITLESCREEN_INITIAL_3                      1857
-#define IMG_TITLESCREEN_INITIAL_4                      1858
-#define IMG_TITLESCREEN_INITIAL_5                      1859
-#define IMG_TITLESCREEN_1                              1860
-#define IMG_TITLESCREEN_2                              1861
-#define IMG_TITLESCREEN_3                              1862
-#define IMG_TITLESCREEN_4                              1863
-#define IMG_TITLESCREEN_5                              1864
-#define IMG_DOOR_1_GFX_PART_1                          1865
-#define IMG_DOOR_1_GFX_PART_2                          1866
-#define IMG_DOOR_1_GFX_PART_3                          1867
-#define IMG_DOOR_1_GFX_PART_4                          1868
-#define IMG_DOOR_1_GFX_PART_5                          1869
-#define IMG_DOOR_1_GFX_PART_6                          1870
-#define IMG_DOOR_1_GFX_PART_7                          1871
-#define IMG_DOOR_1_GFX_PART_8                          1872
-#define IMG_DOOR_2_GFX_PART_1                          1873
-#define IMG_DOOR_2_GFX_PART_2                          1874
-#define IMG_DOOR_2_GFX_PART_3                          1875
-#define IMG_DOOR_2_GFX_PART_4                          1876
-#define IMG_DOOR_2_GFX_PART_5                          1877
-#define IMG_DOOR_2_GFX_PART_6                          1878
-#define IMG_DOOR_2_GFX_PART_7                          1879
-#define IMG_DOOR_2_GFX_PART_8                          1880
-#define IMG_DOOR_2_TOP_BORDER_CORRECTION               1881
-#define IMG_LAST_IMAGE_ENTRY_BUG                       1882
+#define IMG_EDITOR_INPUT_GFX_LEVEL_NUMBER              1808
+#define IMG_BACKGROUND                                 1809
+#define IMG_BACKGROUND_TITLE_INITIAL                   1810
+#define IMG_BACKGROUND_TITLE                           1811
+#define IMG_BACKGROUND_MAIN                            1812
+#define IMG_BACKGROUND_LEVELS                          1813
+#define IMG_BACKGROUND_LEVELNR                         1814
+#define IMG_BACKGROUND_SCORES                          1815
+#define IMG_BACKGROUND_EDITOR                          1816
+#define IMG_BACKGROUND_INFO                            1817
+#define IMG_BACKGROUND_INFO_ELEMENTS                   1818
+#define IMG_BACKGROUND_INFO_MUSIC                      1819
+#define IMG_BACKGROUND_INFO_CREDITS                    1820
+#define IMG_BACKGROUND_INFO_PROGRAM                    1821
+#define IMG_BACKGROUND_INFO_VERSION                    1822
+#define IMG_BACKGROUND_INFO_LEVELSET                   1823
+#define IMG_BACKGROUND_SETUP                           1824
+#define IMG_BACKGROUND_PLAYING                         1825
+#define IMG_BACKGROUND_DOOR                            1826
+#define IMG_BACKGROUND_TAPE                            1827
+#define IMG_BACKGROUND_PANEL                           1828
+#define IMG_BACKGROUND_PALETTE                         1829
+#define IMG_BACKGROUND_TOOLBOX                         1830
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1           1831
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2           1832
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3           1833
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_4           1834
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_5           1835
+#define IMG_BACKGROUND_TITLESCREEN_1                   1836
+#define IMG_BACKGROUND_TITLESCREEN_2                   1837
+#define IMG_BACKGROUND_TITLESCREEN_3                   1838
+#define IMG_BACKGROUND_TITLESCREEN_4                   1839
+#define IMG_BACKGROUND_TITLESCREEN_5                   1840
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_1          1841
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_2          1842
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_3          1843
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_4          1844
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_5          1845
+#define IMG_BACKGROUND_TITLEMESSAGE_1                  1846
+#define IMG_BACKGROUND_TITLEMESSAGE_2                  1847
+#define IMG_BACKGROUND_TITLEMESSAGE_3                  1848
+#define IMG_BACKGROUND_TITLEMESSAGE_4                  1849
+#define IMG_BACKGROUND_TITLEMESSAGE_5                  1850
+#define IMG_BACKGROUND_ENVELOPE_1                      1851
+#define IMG_BACKGROUND_ENVELOPE_2                      1852
+#define IMG_BACKGROUND_ENVELOPE_3                      1853
+#define IMG_BACKGROUND_ENVELOPE_4                      1854
+#define IMG_BACKGROUND_REQUEST                         1855
+#define IMG_TITLESCREEN_INITIAL_1                      1856
+#define IMG_TITLESCREEN_INITIAL_2                      1857
+#define IMG_TITLESCREEN_INITIAL_3                      1858
+#define IMG_TITLESCREEN_INITIAL_4                      1859
+#define IMG_TITLESCREEN_INITIAL_5                      1860
+#define IMG_TITLESCREEN_1                              1861
+#define IMG_TITLESCREEN_2                              1862
+#define IMG_TITLESCREEN_3                              1863
+#define IMG_TITLESCREEN_4                              1864
+#define IMG_TITLESCREEN_5                              1865
+#define IMG_DOOR_1_GFX_PART_1                          1866
+#define IMG_DOOR_1_GFX_PART_2                          1867
+#define IMG_DOOR_1_GFX_PART_3                          1868
+#define IMG_DOOR_1_GFX_PART_4                          1869
+#define IMG_DOOR_1_GFX_PART_5                          1870
+#define IMG_DOOR_1_GFX_PART_6                          1871
+#define IMG_DOOR_1_GFX_PART_7                          1872
+#define IMG_DOOR_1_GFX_PART_8                          1873
+#define IMG_DOOR_2_GFX_PART_1                          1874
+#define IMG_DOOR_2_GFX_PART_2                          1875
+#define IMG_DOOR_2_GFX_PART_3                          1876
+#define IMG_DOOR_2_GFX_PART_4                          1877
+#define IMG_DOOR_2_GFX_PART_5                          1878
+#define IMG_DOOR_2_GFX_PART_6                          1879
+#define IMG_DOOR_2_GFX_PART_7                          1880
+#define IMG_DOOR_2_GFX_PART_8                          1881
+#define IMG_DOOR_2_TOP_BORDER_CORRECTION               1882
+#define IMG_LAST_IMAGE_ENTRY_BUG                       1883
 
-#define NUM_IMAGE_FILES                                        1883
+#define NUM_IMAGE_FILES                                        1884
 
 #endif /* CONF_GFX_H */
index d594cf48063b96727ea7f95da887dc166ebdf2e2..6618b74bd4de5eff29cd6e65daa35dcaef3c1196 100644 (file)
@@ -6094,6 +6094,30 @@ struct TokenIntPtrInfo image_config_vars[] =
     "tape.show_game_buttons",
     &tape.show_game_buttons
   },
+  {
+    "editor.button.prev_level.x",
+    &editor.button.prev_level.x
+  },
+  {
+    "editor.button.prev_level.y",
+    &editor.button.prev_level.y
+  },
+  {
+    "editor.button.next_level.x",
+    &editor.button.next_level.x
+  },
+  {
+    "editor.button.next_level.y",
+    &editor.button.next_level.y
+  },
+  {
+    "editor.input.level_number.x",
+    &editor.input.level_number.x
+  },
+  {
+    "editor.input.level_number.y",
+    &editor.input.level_number.y
+  },
   {
     "editor.palette.x",
     &editor.palette.x
@@ -6110,6 +6134,10 @@ struct TokenIntPtrInfo image_config_vars[] =
     "editor.palette.rows",
     &editor.palette.rows
   },
+  {
+    "editor.palette.tile_size",
+    &editor.palette.tile_size
+  },
   {
     "editor.palette.element_left.x",
     &editor.palette.element_left.x
@@ -6118,6 +6146,10 @@ struct TokenIntPtrInfo image_config_vars[] =
     "editor.palette.element_left.y",
     &editor.palette.element_left.y
   },
+  {
+    "editor.palette.element_left.tile_size",
+    &editor.palette.element_left.tile_size
+  },
   {
     "editor.palette.element_middle.x",
     &editor.palette.element_middle.x
@@ -6126,6 +6158,10 @@ struct TokenIntPtrInfo image_config_vars[] =
     "editor.palette.element_middle.y",
     &editor.palette.element_middle.y
   },
+  {
+    "editor.palette.element_middle.tile_size",
+    &editor.palette.element_middle.tile_size
+  },
   {
     "editor.palette.element_right.x",
     &editor.palette.element_right.x
@@ -6134,6 +6170,10 @@ struct TokenIntPtrInfo image_config_vars[] =
     "editor.palette.element_right.y",
     &editor.palette.element_right.y
   },
+  {
+    "editor.palette.element_right.tile_size",
+    &editor.palette.element_right.tile_size
+  },
   {
     "request.button.yes.x",
     &request.button.yes.x
index 728ff1d71319fa680751f165b45d7545fa7daed6..6962624ba0721019e38af98a00b99c2cd24bf258 100644 (file)
   -----------------------------------------------------------------------------
 */
 
-/* positions in the level editor */
-#define ED_WIN_MB_LEFT_XPOS            (editor.palette.element_left.x)
-#define ED_WIN_MB_LEFT_YPOS            (editor.palette.element_left.y)
-#define ED_WIN_MB_MIDDLE_XPOS          (editor.palette.element_middle.x)
-#define ED_WIN_MB_MIDDLE_YPOS          (editor.palette.element_middle.y)
-#define ED_WIN_MB_RIGHT_XPOS           (editor.palette.element_right.x)
-#define ED_WIN_MB_RIGHT_YPOS           (editor.palette.element_right.y)
-
 /* values for the control window */
 #define ED_CTRL_NO_BUTTONS_GFX_XPOS    6
 #define ED_CTRL_NO_BUTTONS_GFX_YPOS    286
@@ -90,8 +82,8 @@
 /* values for the element list */
 #define ED_ELEMENTLIST_XPOS            (editor.palette.x)
 #define ED_ELEMENTLIST_YPOS            (editor.palette.y)
-#define ED_ELEMENTLIST_XSIZE           20
-#define ED_ELEMENTLIST_YSIZE           20
+#define ED_ELEMENTLIST_XSIZE           (graphic_info[IMG_EDITOR_PALETTE_BUTTON].width)
+#define ED_ELEMENTLIST_YSIZE           (graphic_info[IMG_EDITOR_PALETTE_BUTTON].height)
 #define ED_ELEMENTLIST_BUTTONS_HORIZ   (editor.palette.cols)
 #define ED_ELEMENTLIST_BUTTONS_VERT    (editor.palette.rows)
 #define ED_NUM_ELEMENTLIST_BUTTONS     (ED_ELEMENTLIST_BUTTONS_HORIZ * \
 #define ED_SCROLLBAR2_XPOS             50
 #define ED_SCROLLBAR2_YPOS             20
 
-#define ED_SCROLLBUTTON2_XSIZE         10
-#define ED_SCROLLBUTTON2_YSIZE         10
+#define ED_SCROLLBUTTON2_XSIZE         (graphic_info[IMG_EDITOR_PALETTE_SCROLL_UP].width)
+#define ED_SCROLLBUTTON2_YSIZE         (graphic_info[IMG_EDITOR_PALETTE_SCROLL_UP].height)
 
 #define ED_SCROLL2_UP_XPOS             (ED_ELEMENTLIST_XPOS +          \
                                         ED_ELEMENTLIST_BUTTONS_HORIZ * \
 #define ED_WIN_COUNT_YPOS              ED_BUTTON_COUNT_YPOS
 #define ED_WIN_COUNT_XSIZE             52
 #define ED_WIN_COUNT_YSIZE             ED_BUTTON_COUNT_YSIZE
-#define ED_WIN_COUNT2_XPOS             27
-#define ED_WIN_COUNT2_YPOS             3
-#define ED_WIN_COUNT2_XSIZE            46
-#define ED_WIN_COUNT2_YSIZE            ED_BUTTON_COUNT_YSIZE
 
 #define ED_BUTTON_MINUS_XPOS           2
 #define ED_BUTTON_MINUS_YPOS           ED_BUTTON_COUNT_YPOS
@@ -5155,6 +5143,15 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll)
   BackToFront();
 }
 
+void getElementListGraphicSource(int element, Bitmap **bitmap, int *x, int *y)
+{
+  int graphic = el2edimg(element);
+  int tile_size = (editor.palette.tile_size >= TILESIZE ? TILESIZE :
+                  MINI_TILESIZE);
+
+  getSizedGraphicSource(graphic, 0, tile_size, bitmap, x, y);
+}
+
 static void CreateControlButtons()
 {
   Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
@@ -5380,6 +5377,8 @@ static void CreateControlButtons()
     int y = i / ED_ELEMENTLIST_BUTTONS_HORIZ;
     int id = GADGET_ID_ELEMENTLIST_FIRST + i;
     int element = editor_elements[i];
+    int tile_size = (editor.palette.tile_size >= TILESIZE ? TILESIZE :
+                    MINI_TILESIZE);
 
     event_mask = GD_EVENT_RELEASED;
 
@@ -5391,9 +5390,9 @@ static void CreateControlButtons()
     gd_x2 = gd->src_x + gd->pressed_xoffset;
     gd_y2 = gd->src_y + gd->pressed_yoffset;
 
-    getMiniGraphicSource(el2edimg(element), &deco_bitmap, &deco_x, &deco_y);
-    deco_xpos = (gd->width  - MINI_TILEX) / 2;
-    deco_ypos = (gd->height - MINI_TILEY) / 2;
+    getElementListGraphicSource(element, &deco_bitmap, &deco_x, &deco_y);
+    deco_xpos = (gd->width  - tile_size) / 2;
+    deco_ypos = (gd->height - tile_size) / 2;
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
@@ -5408,7 +5407,7 @@ static void CreateControlButtons()
                      GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
                      GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
                      GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
-                     GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
+                     GDI_DECORATION_SIZE, tile_size, tile_size,
                      GDI_DECORATION_SHIFTING, 1, 1,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
@@ -5427,10 +5426,6 @@ static void CreateCounterButtons()
   int max_infotext_len = getMaxInfoTextLength();
   int i;
 
-  /* these values are not constant, but can change at runtime */
-  counterbutton_info[ED_COUNTER_ID_SELECT_LEVEL].x = DX + 5 - SX;
-  counterbutton_info[ED_COUNTER_ID_SELECT_LEVEL].y = DY + 3 - SY;
-
   for (i = 0; i < ED_NUM_COUNTERBUTTONS; i++)
   {
     int j;
@@ -5472,9 +5467,16 @@ static void CreateCounterButtons()
 
        event_mask |= GD_EVENT_RELEASED;
 
-       if (j == 1)
-         x += 2 * ED_GADGET_DISTANCE;
-       y += ED_GADGET_DISTANCE;
+       if (j == 0)
+       {
+         x = DX + editor.button.prev_level.x;
+         y = DY + editor.button.prev_level.y;
+       }
+       else
+       {
+         x = DX + editor.button.next_level.x;
+         y = DY + editor.button.next_level.y;
+       }
 
        gd_x1 = gd->src_x;
        gd_y1 = gd->src_y;
@@ -5527,20 +5529,28 @@ static void CreateCounterButtons()
        int font_type = FONT_INPUT_1;
        int font_type_active = FONT_INPUT_1_ACTIVE;
        int gd_width = ED_WIN_COUNT_XSIZE;
+       int border_size = ED_BORDER_SIZE;
 
        id = counterbutton_info[i].gadget_id_text;
        event_mask = GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
 
        if (i == ED_COUNTER_ID_SELECT_LEVEL)
        {
+         int graphic = IMG_EDITOR_INPUT_GFX_LEVEL_NUMBER;
+         struct GraphicInfo *gd = &graphic_info[graphic];
+
+         gd_bitmap = gd->bitmap;
+
+         x = DX + editor.input.level_number.x;
+         y = DY + editor.input.level_number.y;
+
+         gd_x = gd->src_x;
+         gd_y = gd->src_y;
+         gd_width = gd->width;
+         border_size = gd->border_size;
+
          font_type = FONT_LEVEL_NUMBER;
          font_type_active = FONT_LEVEL_NUMBER_ACTIVE;
-         x += 2 * ED_GADGET_DISTANCE;
-         y -= ED_GADGET_DISTANCE;
-
-         gd_x = DOOR_GFX_PAGEX6 + ED_WIN_COUNT2_XPOS;
-         gd_y = DOOR_GFX_PAGEY1 + ED_WIN_COUNT2_YPOS;
-         gd_width = ED_WIN_COUNT2_XSIZE;
        }
        else
        {
@@ -5562,7 +5572,7 @@ static void CreateCounterButtons()
                          GDI_TEXT_FONT_ACTIVE, font_type_active,
                          GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
                          GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
-                         GDI_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
+                         GDI_BORDER_SIZE, border_size, border_size,
                          GDI_DESIGN_WIDTH, gd_width,
                          GDI_EVENT_MASK, event_mask,
                          GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
@@ -7641,39 +7651,41 @@ static void ModifyEditorElementList()
 
     UnmapGadget(gi);
 
-    getMiniGraphicSource(el2edimg(element), &gd->bitmap, &gd->x, &gd->y);
+    getElementListGraphicSource(element, &gd->bitmap, &gd->x, &gd->y);
+
     ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END);
 
     MapGadget(gi);
   }
 }
 
+static void DrawDrawingElement(int element, struct EditorPaletteElementInfo *e)
+{
+  int graphic = el2edimg(element);
+  int tile_size = (e->tile_size >= TILESIZE ? TILESIZE : MINI_TILESIZE);
+
+  DrawSizedGraphicExt(drawto, DX + e->x, DY + e->y, graphic, 0, tile_size);
+}
+
 static void PickDrawingElement(int button, int element)
 {
+  struct
+  {
+    int *new_element;
+    struct EditorPaletteElementInfo *e;
+  } de, drawing_elements[] =
+  {
+    { &new_element1,   &editor.palette.element_left    },
+    { &new_element2,   &editor.palette.element_middle  },
+    { &new_element3,   &editor.palette.element_right   },
+  };
+
   if (button < 1 || button > 3)
     return;
 
-  if (button == 1)
-  {
-    new_element1 = element;
-    DrawMiniGraphicExt(drawto,
-                      DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
-                      el2edimg(new_element1));
-  }
-  else if (button == 2)
-  {
-    new_element2 = element;
-    DrawMiniGraphicExt(drawto,
-                      DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
-                      el2edimg(new_element2));
-  }
-  else
-  {
-    new_element3 = element;
-    DrawMiniGraphicExt(drawto,
-                      DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
-                      el2edimg(new_element3));
-  }
+  de = drawing_elements[button - 1];
+
+  DrawDrawingElement((*de.new_element = element), de.e);
 
   redraw_mask |= REDRAW_DOOR_1;
 }
index 4937e55c0cdd83433719aee52211e59e4a3908ed..8e1546fe86b29214ed20241d1966854ed1aa577f 100644 (file)
@@ -2239,18 +2239,38 @@ struct PreviewInfo
   int anim_mode;
 };
 
+struct EditorButtonInfo
+{
+  struct XY prev_level;
+  struct XY next_level;
+};
+
+struct EditorInputInfo
+{
+  struct XY level_number;
+};
+
+struct EditorPaletteElementInfo
+{
+  int x, y;
+  int tile_size;
+};
+
 struct EditorPaletteInfo
 {
   int x, y;
   int cols, rows;
+  int tile_size;
 
-  struct XY element_left;
-  struct XY element_middle;
-  struct XY element_right;
+  struct EditorPaletteElementInfo element_left;
+  struct EditorPaletteElementInfo element_middle;
+  struct EditorPaletteElementInfo element_right;
 };
 
 struct EditorInfo
 {
+  struct EditorButtonInfo button;
+  struct EditorInputInfo input;
   struct EditorPaletteInfo palette;
 };