From f73fd0cea8ac4e9836ea9a4c12c89be0acef03ba Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 5 Feb 2015 01:10:53 +0100 Subject: [PATCH] added configurability of editor control buttons (toolbox buttons) --- ChangeLog | 3 + src/conf_gfx.c | 273 ++++++++++++++++++++++++++++ src/conf_gfx.h | 182 +++++++++++-------- src/conf_var.c | 216 +++++++++++++++++++++++ src/editor.c | 470 ++++++++++++++++++++++++------------------------- src/game.c | 4 +- src/game.h | 16 +- src/main.h | 31 ++++ src/tape.c | 8 +- src/tape.h | 54 +++--- 10 files changed, 897 insertions(+), 360 deletions(-) diff --git a/ChangeLog b/ChangeLog index 203fafd8..ad14d13c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2015-02-04 + * added configurability of editor control buttons (toolbox buttons) + 2015-02-03 * finished configurability of tape date and time display positions * fixed bug with game buttons in tape area not properly redrawn diff --git a/src/conf_gfx.c b/src/conf_gfx.c index b0f3ed9b..35870aef 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5312,6 +5312,220 @@ struct ConfigInfo image_config[] = { "editor.button.gfx.properties.height", "20" }, { "editor.button.gfx.properties.pressed_yoffset", "-20" }, + { "editor.no_toolbox_button", "RocksDoor.png" }, + { "editor.no_toolbox_button.x", "506" }, + { "editor.no_toolbox_button.y", "286" }, + { "editor.no_toolbox_button.width", "22" }, + { "editor.no_toolbox_button.height", "22" }, + + { "editor.button.gfx.draw_single", "RocksDoor.png" }, + { "editor.button.gfx.draw_single.x", "706" }, + { "editor.button.gfx.draw_single.y", "242" }, + { "editor.button.gfx.draw_single.width", "22" }, + { "editor.button.gfx.draw_single.height", "22" }, + { "editor.button.gfx.draw_single.pressed_xoffset", "-100" }, + { "editor.button.gfx.draw_single.active_yoffset", "-94" }, + + { "editor.button.gfx.draw_connected", "RocksDoor.png" }, + { "editor.button.gfx.draw_connected.x", "728" }, + { "editor.button.gfx.draw_connected.y", "242" }, + { "editor.button.gfx.draw_connected.width", "22" }, + { "editor.button.gfx.draw_connected.height", "22" }, + { "editor.button.gfx.draw_connected.pressed_xoffset", "-100" }, + { "editor.button.gfx.draw_connected.active_yoffset", "-94" }, + + { "editor.button.gfx.draw_line", "RocksDoor.png" }, + { "editor.button.gfx.draw_line.x", "750" }, + { "editor.button.gfx.draw_line.y", "242" }, + { "editor.button.gfx.draw_line.width", "22" }, + { "editor.button.gfx.draw_line.height", "22" }, + { "editor.button.gfx.draw_line.pressed_xoffset", "-100" }, + { "editor.button.gfx.draw_line.active_yoffset", "-94" }, + + { "editor.button.gfx.draw_arc", "RocksDoor.png" }, + { "editor.button.gfx.draw_arc.x", "772" }, + { "editor.button.gfx.draw_arc.y", "242" }, + { "editor.button.gfx.draw_arc.width", "22" }, + { "editor.button.gfx.draw_arc.height", "22" }, + { "editor.button.gfx.draw_arc.pressed_xoffset", "-100" }, + { "editor.button.gfx.draw_arc.active_yoffset", "-94" }, + + { "editor.button.gfx.draw_rectangle", "RocksDoor.png" }, + { "editor.button.gfx.draw_rectangle.x", "706" }, + { "editor.button.gfx.draw_rectangle.y", "264" }, + { "editor.button.gfx.draw_rectangle.width", "22" }, + { "editor.button.gfx.draw_rectangle.height", "22" }, + { "editor.button.gfx.draw_rectangle.pressed_xoffset", "-100" }, + { "editor.button.gfx.draw_rectangle.active_yoffset", "-94" }, + + { "editor.button.gfx.draw_filled_box", "RocksDoor.png" }, + { "editor.button.gfx.draw_filled_box.x", "728" }, + { "editor.button.gfx.draw_filled_box.y", "264" }, + { "editor.button.gfx.draw_filled_box.width", "22" }, + { "editor.button.gfx.draw_filled_box.height", "22" }, + { "editor.button.gfx.draw_filled_box.pressed_xoffset", "-100" }, + { "editor.button.gfx.draw_filled_box.active_yoffset", "-94" }, + + { "editor.button.gfx.rotate_up", "RocksDoor.png" }, + { "editor.button.gfx.rotate_up.x", "750" }, + { "editor.button.gfx.rotate_up.y", "264" }, + { "editor.button.gfx.rotate_up.width", "22" }, + { "editor.button.gfx.rotate_up.height", "22" }, + { "editor.button.gfx.rotate_up.pressed_xoffset", "-100" }, + { "editor.button.gfx.rotate_up.active_yoffset", "-94" }, + + { "editor.button.gfx.draw_text", "RocksDoor.png" }, + { "editor.button.gfx.draw_text.x", "772" }, + { "editor.button.gfx.draw_text.y", "264" }, + { "editor.button.gfx.draw_text.width", "22" }, + { "editor.button.gfx.draw_text.height", "22" }, + { "editor.button.gfx.draw_text.pressed_xoffset", "-100" }, + { "editor.button.gfx.draw_text.active_yoffset", "-94" }, + + { "editor.button.gfx.flood_fill", "RocksDoor.png" }, + { "editor.button.gfx.flood_fill.x", "706" }, + { "editor.button.gfx.flood_fill.y", "286" }, + { "editor.button.gfx.flood_fill.width", "22" }, + { "editor.button.gfx.flood_fill.height", "22" }, + { "editor.button.gfx.flood_fill.pressed_xoffset", "-100" }, + { "editor.button.gfx.flood_fill.active_yoffset", "-94" }, + + { "editor.button.gfx.rotate_left", "RocksDoor.png" }, + { "editor.button.gfx.rotate_left.x", "728" }, + { "editor.button.gfx.rotate_left.y", "286" }, + { "editor.button.gfx.rotate_left.width", "22" }, + { "editor.button.gfx.rotate_left.height", "22" }, + { "editor.button.gfx.rotate_left.pressed_xoffset", "-100" }, + { "editor.button.gfx.rotate_left.active_yoffset", "-94" }, + + { "editor.button.gfx.zoom_level", "RocksDoor.png" }, + { "editor.button.gfx.zoom_level.x", "750" }, + { "editor.button.gfx.zoom_level.y", "286" }, + { "editor.button.gfx.zoom_level.width", "22" }, + { "editor.button.gfx.zoom_level.height", "22" }, + { "editor.button.gfx.zoom_level.pressed_xoffset", "-100" }, + { "editor.button.gfx.zoom_level.active_yoffset", "-94" }, + + { "editor.button.gfx.rotate_right", "RocksDoor.png" }, + { "editor.button.gfx.rotate_right.x", "772" }, + { "editor.button.gfx.rotate_right.y", "286" }, + { "editor.button.gfx.rotate_right.width", "22" }, + { "editor.button.gfx.rotate_right.height", "22" }, + { "editor.button.gfx.rotate_right.pressed_xoffset", "-100" }, + { "editor.button.gfx.rotate_right.active_yoffset", "-94" }, + + { "editor.button.gfx.draw_random", "RocksDoor.png" }, + { "editor.button.gfx.draw_random.x", "706" }, + { "editor.button.gfx.draw_random.y", "308" }, + { "editor.button.gfx.draw_random.width", "22" }, + { "editor.button.gfx.draw_random.height", "22" }, + { "editor.button.gfx.draw_random.pressed_xoffset", "-100" }, + { "editor.button.gfx.draw_random.active_yoffset", "-94" }, + + { "editor.button.gfx.grab_brush", "RocksDoor.png" }, + { "editor.button.gfx.grab_brush.x", "728" }, + { "editor.button.gfx.grab_brush.y", "308" }, + { "editor.button.gfx.grab_brush.width", "22" }, + { "editor.button.gfx.grab_brush.height", "22" }, + { "editor.button.gfx.grab_brush.pressed_xoffset", "-100" }, + { "editor.button.gfx.grab_brush.active_yoffset", "-94" }, + + { "editor.button.gfx.rotate_down", "RocksDoor.png" }, + { "editor.button.gfx.rotate_down.x", "750" }, + { "editor.button.gfx.rotate_down.y", "308" }, + { "editor.button.gfx.rotate_down.width", "22" }, + { "editor.button.gfx.rotate_down.height", "22" }, + { "editor.button.gfx.rotate_down.pressed_xoffset", "-100" }, + { "editor.button.gfx.rotate_down.active_yoffset", "-94" }, + + { "editor.button.gfx.pick_element", "RocksDoor.png" }, + { "editor.button.gfx.pick_element.x", "772" }, + { "editor.button.gfx.pick_element.y", "308" }, + { "editor.button.gfx.pick_element.width", "22" }, + { "editor.button.gfx.pick_element.height", "22" }, + { "editor.button.gfx.pick_element.pressed_xoffset", "-100" }, + { "editor.button.gfx.pick_element.active_yoffset", "-94" }, + + { "editor.button.gfx.ce_copy_from", "RocksDoor.png" }, + { "editor.button.gfx.ce_copy_from.x", "528" }, + { "editor.button.gfx.ce_copy_from.y", "330" }, + { "editor.button.gfx.ce_copy_from.width", "22" }, + { "editor.button.gfx.ce_copy_from.height", "22" }, + { "editor.button.gfx.ce_copy_from.pressed_xoffset", "-100" }, + { "editor.button.gfx.ce_copy_from.active_yoffset", "-22" }, + + { "editor.button.gfx.ce_copy_to", "RocksDoor.png" }, + { "editor.button.gfx.ce_copy_to.x", "550" }, + { "editor.button.gfx.ce_copy_to.y", "330" }, + { "editor.button.gfx.ce_copy_to.width", "22" }, + { "editor.button.gfx.ce_copy_to.height", "22" }, + { "editor.button.gfx.ce_copy_to.pressed_xoffset", "-100" }, + { "editor.button.gfx.ce_copy_to.active_yoffset", "-22" }, + + { "editor.button.gfx.ce_swap", "RocksDoor.png" }, + { "editor.button.gfx.ce_swap.x", "572" }, + { "editor.button.gfx.ce_swap.y", "330" }, + { "editor.button.gfx.ce_swap.width", "22" }, + { "editor.button.gfx.ce_swap.height", "22" }, + { "editor.button.gfx.ce_swap.pressed_xoffset", "-100" }, + { "editor.button.gfx.ce_swap.active_yoffset", "-22" }, + + { "editor.button.gfx.ce_copy", "RocksDoor.png" }, + { "editor.button.gfx.ce_copy.x", "550" }, + { "editor.button.gfx.ce_copy.y", "286" }, + { "editor.button.gfx.ce_copy.width", "22" }, + { "editor.button.gfx.ce_copy.height", "22" }, + { "editor.button.gfx.ce_copy.pressed_xoffset", "-100" }, + + { "editor.button.gfx.ce_paste", "RocksDoor.png" }, + { "editor.button.gfx.ce_paste.x", "572" }, + { "editor.button.gfx.ce_paste.y", "286" }, + { "editor.button.gfx.ce_paste.width", "22" }, + { "editor.button.gfx.ce_paste.height", "22" }, + { "editor.button.gfx.ce_paste.pressed_xoffset", "-100" }, + + { "editor.button.gfx.undo", "RocksDoor.png" }, + { "editor.button.gfx.undo.x", "705" }, + { "editor.button.gfx.undo.y", "335" }, + { "editor.button.gfx.undo.width", "30" }, + { "editor.button.gfx.undo.height", "20" }, + { "editor.button.gfx.undo.pressed_xoffset", "-100" }, + + { "editor.button.gfx.conf", "RocksDoor.png" }, + { "editor.button.gfx.conf.x", "735" }, + { "editor.button.gfx.conf.y", "335" }, + { "editor.button.gfx.conf.width", "30" }, + { "editor.button.gfx.conf.height", "20" }, + { "editor.button.gfx.conf.pressed_xoffset", "-100" }, + + { "editor.button.gfx.save", "RocksDoor.png" }, + { "editor.button.gfx.save.x", "765" }, + { "editor.button.gfx.save.y", "335" }, + { "editor.button.gfx.save.width", "30" }, + { "editor.button.gfx.save.height", "20" }, + { "editor.button.gfx.save.pressed_xoffset", "-100" }, + + { "editor.button.gfx.clear", "RocksDoor.png" }, + { "editor.button.gfx.clear.x", "705" }, + { "editor.button.gfx.clear.y", "355" }, + { "editor.button.gfx.clear.width", "30" }, + { "editor.button.gfx.clear.height", "20" }, + { "editor.button.gfx.clear.pressed_xoffset", "-100" }, + + { "editor.button.gfx.test", "RocksDoor.png" }, + { "editor.button.gfx.test.x", "735" }, + { "editor.button.gfx.test.y", "355" }, + { "editor.button.gfx.test.width", "30" }, + { "editor.button.gfx.test.height", "20" }, + { "editor.button.gfx.test.pressed_xoffset", "-100" }, + + { "editor.button.gfx.exit", "RocksDoor.png" }, + { "editor.button.gfx.exit.x", "765" }, + { "editor.button.gfx.exit.y", "355" }, + { "editor.button.gfx.exit.width", "30" }, + { "editor.button.gfx.exit.height", "20" }, + { "editor.button.gfx.exit.pressed_xoffset", "-100" }, + { "editor.input.gfx.level_number", "RocksDoor.png" }, { "editor.input.gfx.level_number.x", "529" }, { "editor.input.gfx.level_number.y", "5" }, @@ -7183,8 +7397,67 @@ struct ConfigInfo image_config[] = { "editor.button.prev_level.y", "5" }, { "editor.button.next_level.x", "79" }, { "editor.button.next_level.y", "5" }, + { "editor.button.properties.x", "5" }, { "editor.button.properties.y", "230" }, + + { "editor.button.draw_single.x", "6" }, + { "editor.button.draw_single.y", "6" }, + { "editor.button.draw_connected.x", "28" }, + { "editor.button.draw_connected.y", "6" }, + { "editor.button.draw_line.x", "50" }, + { "editor.button.draw_line.y", "6" }, + { "editor.button.draw_arc.x", "72" }, + { "editor.button.draw_arc.y", "6" }, + { "editor.button.draw_rectangle.x", "6" }, + { "editor.button.draw_rectangle.y", "28" }, + { "editor.button.draw_filled_box.x", "28" }, + { "editor.button.draw_filled_box.y", "28" }, + { "editor.button.rotate_up.x", "50" }, + { "editor.button.rotate_up.y", "28" }, + { "editor.button.draw_text.x", "72" }, + { "editor.button.draw_text.y", "28" }, + { "editor.button.flood_fill.x", "6" }, + { "editor.button.flood_fill.y", "50" }, + { "editor.button.rotate_left.x", "28" }, + { "editor.button.rotate_left.y", "50" }, + { "editor.button.zoom_level.x", "50" }, + { "editor.button.zoom_level.y", "50" }, + { "editor.button.rotate_right.x", "72" }, + { "editor.button.rotate_right.y", "50" }, + { "editor.button.draw_random.x", "6" }, + { "editor.button.draw_random.y", "72" }, + { "editor.button.grab_brush.x", "28" }, + { "editor.button.grab_brush.y", "72" }, + { "editor.button.rotate_down.x", "50" }, + { "editor.button.rotate_down.y", "72" }, + { "editor.button.pick_element.x", "72" }, + { "editor.button.pick_element.y", "72" }, + + { "editor.button.ce_copy_from.x", "28" }, + { "editor.button.ce_copy_from.y", "6" }, + { "editor.button.ce_copy_to.x", "50" }, + { "editor.button.ce_copy_to.y", "6" }, + { "editor.button.ce_swap.x", "72" }, + { "editor.button.ce_swap.y", "6" }, + { "editor.button.ce_copy.x", "6" }, + { "editor.button.ce_copy.y", "72" }, + { "editor.button.ce_paste.x", "28" }, + { "editor.button.ce_paste.y", "72" }, + + { "editor.button.undo.x", "5" }, + { "editor.button.undo.y", "99" }, + { "editor.button.conf.x", "35" }, + { "editor.button.conf.y", "99" }, + { "editor.button.save.x", "65" }, + { "editor.button.save.y", "99" }, + { "editor.button.clear.x", "5" }, + { "editor.button.clear.y", "119" }, + { "editor.button.test.x", "35" }, + { "editor.button.test.y", "119" }, + { "editor.button.exit.x", "65" }, + { "editor.button.exit.y", "119" }, + { "editor.input.level_number.x", "29" }, { "editor.input.level_number.y", "5" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 352fa87d..1316eee0 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1825,83 +1825,111 @@ #define IMG_EDITOR_BUTTON_GFX_PREV_LEVEL 1806 #define IMG_EDITOR_BUTTON_GFX_NEXT_LEVEL 1807 #define IMG_EDITOR_BUTTON_GFX_PROPERTIES 1808 -#define IMG_EDITOR_INPUT_GFX_LEVEL_NUMBER 1809 -#define IMG_BACKGROUND 1810 -#define IMG_BACKGROUND_TITLE_INITIAL 1811 -#define IMG_BACKGROUND_TITLE 1812 -#define IMG_BACKGROUND_MAIN 1813 -#define IMG_BACKGROUND_LEVELS 1814 -#define IMG_BACKGROUND_LEVELNR 1815 -#define IMG_BACKGROUND_SCORES 1816 -#define IMG_BACKGROUND_EDITOR 1817 -#define IMG_BACKGROUND_INFO 1818 -#define IMG_BACKGROUND_INFO_ELEMENTS 1819 -#define IMG_BACKGROUND_INFO_MUSIC 1820 -#define IMG_BACKGROUND_INFO_CREDITS 1821 -#define IMG_BACKGROUND_INFO_PROGRAM 1822 -#define IMG_BACKGROUND_INFO_VERSION 1823 -#define IMG_BACKGROUND_INFO_LEVELSET 1824 -#define IMG_BACKGROUND_SETUP 1825 -#define IMG_BACKGROUND_PLAYING 1826 -#define IMG_BACKGROUND_DOOR 1827 -#define IMG_BACKGROUND_TAPE 1828 -#define IMG_BACKGROUND_PANEL 1829 -#define IMG_BACKGROUND_PALETTE 1830 -#define IMG_BACKGROUND_TOOLBOX 1831 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1 1832 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2 1833 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3 1834 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_4 1835 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_5 1836 -#define IMG_BACKGROUND_TITLESCREEN_1 1837 -#define IMG_BACKGROUND_TITLESCREEN_2 1838 -#define IMG_BACKGROUND_TITLESCREEN_3 1839 -#define IMG_BACKGROUND_TITLESCREEN_4 1840 -#define IMG_BACKGROUND_TITLESCREEN_5 1841 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_1 1842 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_2 1843 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_3 1844 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_4 1845 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_5 1846 -#define IMG_BACKGROUND_TITLEMESSAGE_1 1847 -#define IMG_BACKGROUND_TITLEMESSAGE_2 1848 -#define IMG_BACKGROUND_TITLEMESSAGE_3 1849 -#define IMG_BACKGROUND_TITLEMESSAGE_4 1850 -#define IMG_BACKGROUND_TITLEMESSAGE_5 1851 -#define IMG_BACKGROUND_ENVELOPE_1 1852 -#define IMG_BACKGROUND_ENVELOPE_2 1853 -#define IMG_BACKGROUND_ENVELOPE_3 1854 -#define IMG_BACKGROUND_ENVELOPE_4 1855 -#define IMG_BACKGROUND_REQUEST 1856 -#define IMG_TITLESCREEN_INITIAL_1 1857 -#define IMG_TITLESCREEN_INITIAL_2 1858 -#define IMG_TITLESCREEN_INITIAL_3 1859 -#define IMG_TITLESCREEN_INITIAL_4 1860 -#define IMG_TITLESCREEN_INITIAL_5 1861 -#define IMG_TITLESCREEN_1 1862 -#define IMG_TITLESCREEN_2 1863 -#define IMG_TITLESCREEN_3 1864 -#define IMG_TITLESCREEN_4 1865 -#define IMG_TITLESCREEN_5 1866 -#define IMG_DOOR_1_GFX_PART_1 1867 -#define IMG_DOOR_1_GFX_PART_2 1868 -#define IMG_DOOR_1_GFX_PART_3 1869 -#define IMG_DOOR_1_GFX_PART_4 1870 -#define IMG_DOOR_1_GFX_PART_5 1871 -#define IMG_DOOR_1_GFX_PART_6 1872 -#define IMG_DOOR_1_GFX_PART_7 1873 -#define IMG_DOOR_1_GFX_PART_8 1874 -#define IMG_DOOR_2_GFX_PART_1 1875 -#define IMG_DOOR_2_GFX_PART_2 1876 -#define IMG_DOOR_2_GFX_PART_3 1877 -#define IMG_DOOR_2_GFX_PART_4 1878 -#define IMG_DOOR_2_GFX_PART_5 1879 -#define IMG_DOOR_2_GFX_PART_6 1880 -#define IMG_DOOR_2_GFX_PART_7 1881 -#define IMG_DOOR_2_GFX_PART_8 1882 -#define IMG_DOOR_2_TOP_BORDER_CORRECTION 1883 -#define IMG_LAST_IMAGE_ENTRY_BUG 1884 +#define IMG_EDITOR_NO_TOOLBOX_BUTTON 1809 +#define IMG_EDITOR_BUTTON_GFX_DRAW_SINGLE 1810 +#define IMG_EDITOR_BUTTON_GFX_DRAW_CONNECTED 1811 +#define IMG_EDITOR_BUTTON_GFX_DRAW_LINE 1812 +#define IMG_EDITOR_BUTTON_GFX_DRAW_ARC 1813 +#define IMG_EDITOR_BUTTON_GFX_DRAW_RECTANGLE 1814 +#define IMG_EDITOR_BUTTON_GFX_DRAW_FILLED_BOX 1815 +#define IMG_EDITOR_BUTTON_GFX_ROTATE_UP 1816 +#define IMG_EDITOR_BUTTON_GFX_DRAW_TEXT 1817 +#define IMG_EDITOR_BUTTON_GFX_FLOOD_FILL 1818 +#define IMG_EDITOR_BUTTON_GFX_ROTATE_LEFT 1819 +#define IMG_EDITOR_BUTTON_GFX_ZOOM_LEVEL 1820 +#define IMG_EDITOR_BUTTON_GFX_ROTATE_RIGHT 1821 +#define IMG_EDITOR_BUTTON_GFX_DRAW_RANDOM 1822 +#define IMG_EDITOR_BUTTON_GFX_GRAB_BRUSH 1823 +#define IMG_EDITOR_BUTTON_GFX_ROTATE_DOWN 1824 +#define IMG_EDITOR_BUTTON_GFX_PICK_ELEMENT 1825 +#define IMG_EDITOR_BUTTON_GFX_CE_COPY_FROM 1826 +#define IMG_EDITOR_BUTTON_GFX_CE_COPY_TO 1827 +#define IMG_EDITOR_BUTTON_GFX_CE_SWAP 1828 +#define IMG_EDITOR_BUTTON_GFX_CE_COPY 1829 +#define IMG_EDITOR_BUTTON_GFX_CE_PASTE 1830 +#define IMG_EDITOR_BUTTON_GFX_UNDO 1831 +#define IMG_EDITOR_BUTTON_GFX_CONF 1832 +#define IMG_EDITOR_BUTTON_GFX_SAVE 1833 +#define IMG_EDITOR_BUTTON_GFX_CLEAR 1834 +#define IMG_EDITOR_BUTTON_GFX_TEST 1835 +#define IMG_EDITOR_BUTTON_GFX_EXIT 1836 +#define IMG_EDITOR_INPUT_GFX_LEVEL_NUMBER 1837 +#define IMG_BACKGROUND 1838 +#define IMG_BACKGROUND_TITLE_INITIAL 1839 +#define IMG_BACKGROUND_TITLE 1840 +#define IMG_BACKGROUND_MAIN 1841 +#define IMG_BACKGROUND_LEVELS 1842 +#define IMG_BACKGROUND_LEVELNR 1843 +#define IMG_BACKGROUND_SCORES 1844 +#define IMG_BACKGROUND_EDITOR 1845 +#define IMG_BACKGROUND_INFO 1846 +#define IMG_BACKGROUND_INFO_ELEMENTS 1847 +#define IMG_BACKGROUND_INFO_MUSIC 1848 +#define IMG_BACKGROUND_INFO_CREDITS 1849 +#define IMG_BACKGROUND_INFO_PROGRAM 1850 +#define IMG_BACKGROUND_INFO_VERSION 1851 +#define IMG_BACKGROUND_INFO_LEVELSET 1852 +#define IMG_BACKGROUND_SETUP 1853 +#define IMG_BACKGROUND_PLAYING 1854 +#define IMG_BACKGROUND_DOOR 1855 +#define IMG_BACKGROUND_TAPE 1856 +#define IMG_BACKGROUND_PANEL 1857 +#define IMG_BACKGROUND_PALETTE 1858 +#define IMG_BACKGROUND_TOOLBOX 1859 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1 1860 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2 1861 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3 1862 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_4 1863 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_5 1864 +#define IMG_BACKGROUND_TITLESCREEN_1 1865 +#define IMG_BACKGROUND_TITLESCREEN_2 1866 +#define IMG_BACKGROUND_TITLESCREEN_3 1867 +#define IMG_BACKGROUND_TITLESCREEN_4 1868 +#define IMG_BACKGROUND_TITLESCREEN_5 1869 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_1 1870 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_2 1871 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_3 1872 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_4 1873 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_5 1874 +#define IMG_BACKGROUND_TITLEMESSAGE_1 1875 +#define IMG_BACKGROUND_TITLEMESSAGE_2 1876 +#define IMG_BACKGROUND_TITLEMESSAGE_3 1877 +#define IMG_BACKGROUND_TITLEMESSAGE_4 1878 +#define IMG_BACKGROUND_TITLEMESSAGE_5 1879 +#define IMG_BACKGROUND_ENVELOPE_1 1880 +#define IMG_BACKGROUND_ENVELOPE_2 1881 +#define IMG_BACKGROUND_ENVELOPE_3 1882 +#define IMG_BACKGROUND_ENVELOPE_4 1883 +#define IMG_BACKGROUND_REQUEST 1884 +#define IMG_TITLESCREEN_INITIAL_1 1885 +#define IMG_TITLESCREEN_INITIAL_2 1886 +#define IMG_TITLESCREEN_INITIAL_3 1887 +#define IMG_TITLESCREEN_INITIAL_4 1888 +#define IMG_TITLESCREEN_INITIAL_5 1889 +#define IMG_TITLESCREEN_1 1890 +#define IMG_TITLESCREEN_2 1891 +#define IMG_TITLESCREEN_3 1892 +#define IMG_TITLESCREEN_4 1893 +#define IMG_TITLESCREEN_5 1894 +#define IMG_DOOR_1_GFX_PART_1 1895 +#define IMG_DOOR_1_GFX_PART_2 1896 +#define IMG_DOOR_1_GFX_PART_3 1897 +#define IMG_DOOR_1_GFX_PART_4 1898 +#define IMG_DOOR_1_GFX_PART_5 1899 +#define IMG_DOOR_1_GFX_PART_6 1900 +#define IMG_DOOR_1_GFX_PART_7 1901 +#define IMG_DOOR_1_GFX_PART_8 1902 +#define IMG_DOOR_2_GFX_PART_1 1903 +#define IMG_DOOR_2_GFX_PART_2 1904 +#define IMG_DOOR_2_GFX_PART_3 1905 +#define IMG_DOOR_2_GFX_PART_4 1906 +#define IMG_DOOR_2_GFX_PART_5 1907 +#define IMG_DOOR_2_GFX_PART_6 1908 +#define IMG_DOOR_2_GFX_PART_7 1909 +#define IMG_DOOR_2_GFX_PART_8 1910 +#define IMG_DOOR_2_TOP_BORDER_CORRECTION 1911 +#define IMG_LAST_IMAGE_ENTRY_BUG 1912 -#define NUM_IMAGE_FILES 1885 +#define NUM_IMAGE_FILES 1913 #endif /* CONF_GFX_H */ diff --git a/src/conf_var.c b/src/conf_var.c index f372c980..283d59f3 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -6390,6 +6390,222 @@ struct TokenIntPtrInfo image_config_vars[] = "editor.button.properties.y", &editor.button.properties.y }, + { + "editor.button.draw_single.x", + &editor.button.draw_single.x + }, + { + "editor.button.draw_single.y", + &editor.button.draw_single.y + }, + { + "editor.button.draw_connected.x", + &editor.button.draw_connected.x + }, + { + "editor.button.draw_connected.y", + &editor.button.draw_connected.y + }, + { + "editor.button.draw_line.x", + &editor.button.draw_line.x + }, + { + "editor.button.draw_line.y", + &editor.button.draw_line.y + }, + { + "editor.button.draw_arc.x", + &editor.button.draw_arc.x + }, + { + "editor.button.draw_arc.y", + &editor.button.draw_arc.y + }, + { + "editor.button.draw_rectangle.x", + &editor.button.draw_rectangle.x + }, + { + "editor.button.draw_rectangle.y", + &editor.button.draw_rectangle.y + }, + { + "editor.button.draw_filled_box.x", + &editor.button.draw_filled_box.x + }, + { + "editor.button.draw_filled_box.y", + &editor.button.draw_filled_box.y + }, + { + "editor.button.rotate_up.x", + &editor.button.rotate_up.x + }, + { + "editor.button.rotate_up.y", + &editor.button.rotate_up.y + }, + { + "editor.button.draw_text.x", + &editor.button.draw_text.x + }, + { + "editor.button.draw_text.y", + &editor.button.draw_text.y + }, + { + "editor.button.flood_fill.x", + &editor.button.flood_fill.x + }, + { + "editor.button.flood_fill.y", + &editor.button.flood_fill.y + }, + { + "editor.button.rotate_left.x", + &editor.button.rotate_left.x + }, + { + "editor.button.rotate_left.y", + &editor.button.rotate_left.y + }, + { + "editor.button.zoom_level.x", + &editor.button.zoom_level.x + }, + { + "editor.button.zoom_level.y", + &editor.button.zoom_level.y + }, + { + "editor.button.rotate_right.x", + &editor.button.rotate_right.x + }, + { + "editor.button.rotate_right.y", + &editor.button.rotate_right.y + }, + { + "editor.button.draw_random.x", + &editor.button.draw_random.x + }, + { + "editor.button.draw_random.y", + &editor.button.draw_random.y + }, + { + "editor.button.grab_brush.x", + &editor.button.grab_brush.x + }, + { + "editor.button.grab_brush.y", + &editor.button.grab_brush.y + }, + { + "editor.button.rotate_down.x", + &editor.button.rotate_down.x + }, + { + "editor.button.rotate_down.y", + &editor.button.rotate_down.y + }, + { + "editor.button.pick_element.x", + &editor.button.pick_element.x + }, + { + "editor.button.pick_element.y", + &editor.button.pick_element.y + }, + { + "editor.button.ce_copy_from.x", + &editor.button.ce_copy_from.x + }, + { + "editor.button.ce_copy_from.y", + &editor.button.ce_copy_from.y + }, + { + "editor.button.ce_copy_to.x", + &editor.button.ce_copy_to.x + }, + { + "editor.button.ce_copy_to.y", + &editor.button.ce_copy_to.y + }, + { + "editor.button.ce_swap.x", + &editor.button.ce_swap.x + }, + { + "editor.button.ce_swap.y", + &editor.button.ce_swap.y + }, + { + "editor.button.ce_copy.x", + &editor.button.ce_copy.x + }, + { + "editor.button.ce_copy.y", + &editor.button.ce_copy.y + }, + { + "editor.button.ce_paste.x", + &editor.button.ce_paste.x + }, + { + "editor.button.ce_paste.y", + &editor.button.ce_paste.y + }, + { + "editor.button.undo.x", + &editor.button.undo.x + }, + { + "editor.button.undo.y", + &editor.button.undo.y + }, + { + "editor.button.conf.x", + &editor.button.conf.x + }, + { + "editor.button.conf.y", + &editor.button.conf.y + }, + { + "editor.button.save.x", + &editor.button.save.x + }, + { + "editor.button.save.y", + &editor.button.save.y + }, + { + "editor.button.clear.x", + &editor.button.clear.x + }, + { + "editor.button.clear.y", + &editor.button.clear.y + }, + { + "editor.button.test.x", + &editor.button.test.x + }, + { + "editor.button.test.y", + &editor.button.test.y + }, + { + "editor.button.exit.x", + &editor.button.exit.x + }, + { + "editor.button.exit.y", + &editor.button.exit.y + }, { "editor.input.level_number.x", &editor.input.level_number.x diff --git a/src/editor.c b/src/editor.c index d993af34..6a95010a 100644 --- a/src/editor.c +++ b/src/editor.c @@ -32,39 +32,6 @@ */ /* values for the control window */ -#define ED_CTRL_NO_BUTTONS_GFX_XPOS 6 -#define ED_CTRL_NO_BUTTONS_GFX_YPOS 286 -#define ED_CTRL1_BUTTONS_GFX_YPOS 236 -#define ED_CTRL2_BUTTONS_GFX_YPOS 236 -#define ED_CTRL3_BUTTONS_GFX_YPOS 324 -#define ED_CTRL4_BUTTONS_GFX_XPOS 44 -#define ED_CTRL4_BUTTONS_GFX_YPOS 214 -#define ED_CTRL1_BUTTONS_ALT_GFX_YPOS 142 -#define ED_CTRL3_BUTTONS_ALT_GFX_YPOS 302 -#define ED_CTRL5_BUTTONS_GFX_XPOS 5 -#define ED_CTRL5_BUTTONS_GFX_YPOS 110 - -#define ED_CTRL1_BUTTON_XSIZE 22 -#define ED_CTRL1_BUTTON_YSIZE 22 -#define ED_CTRL1_BUTTONS_XPOS 6 -#define ED_CTRL1_BUTTONS_YPOS 6 -#define ED_CTRL2_BUTTON_XSIZE 30 -#define ED_CTRL2_BUTTON_YSIZE 20 -#define ED_CTRL2_BUTTONS_XPOS 5 -#define ED_CTRL2_BUTTONS_YPOS 99 -#define ED_CTRL3_BUTTON_XSIZE 22 -#define ED_CTRL3_BUTTON_YSIZE 22 -#define ED_CTRL3_BUTTONS_XPOS 6 -#define ED_CTRL3_BUTTONS_YPOS 6 -#define ED_CTRL4_BUTTON_XSIZE 22 -#define ED_CTRL4_BUTTON_YSIZE 22 -#define ED_CTRL4_BUTTONS_XPOS 6 -#define ED_CTRL4_BUTTONS_YPOS 6 -#define ED_CTRL5_BUTTON_XSIZE 90 -#define ED_CTRL5_BUTTON_YSIZE 20 -#define ED_CTRL5_BUTTONS_XPOS 5 -#define ED_CTRL5_BUTTONS_YPOS 230 - #define ED_CTRL1_BUTTONS_HORIZ 4 #define ED_CTRL1_BUTTONS_VERT 4 #define ED_CTRL2_BUTTONS_HORIZ 3 @@ -980,45 +947,168 @@ static struct { + int graphic; + int gadget_id; + struct XY *pos; + int gadget_type; + char *infotext; char shortcut; - char *text; -} control_info[ED_NUM_CTRL_BUTTONS] = +} controlbutton_info[ED_NUM_CTRL_BUTTONS] = { /* note: some additional characters are already reserved for "cheat mode" shortcuts (":XYZ" style) -- for details, see "events.c" */ - { 's', "draw single items" }, - { 'd', "draw connected items" }, - { 'l', "draw lines" }, - { 'a', "draw arcs" }, - { 'r', "draw outline rectangles" }, - { 'R', "draw filled rectangles" }, - { '\0', "wrap (rotate) level up" }, - { 't', "enter text elements" }, - { 'f', "flood fill" }, - { '\0', "wrap (rotate) level left" }, - { 'z', "zoom level tile size" }, - { '\0', "wrap (rotate) level right" }, - { '\0', "random element placement" }, - { 'b', "grab brush" }, - { '\0', "wrap (rotate) level down" }, - { ',', "pick drawing element" }, - - { 'U', "undo last operation" }, - { 'I', "properties of level" }, - { 'S', "save level" }, - { 'C', "clear level" }, - { 'T', "test level" }, - { 'E', "exit level editor" }, - - { '\0', "copy settings from other element" }, - { '\0', "copy settings to other element" }, - { '\0', "exchange element with other element" }, - - { '\0', "copy settings from this element" }, - { '\0', "paste settings to this element" }, - - { 'p', "properties of drawing element" }, + /* ---------- toolbox control buttons ------------------------------------ */ + + { + IMG_EDITOR_BUTTON_GFX_DRAW_SINGLE, GADGET_ID_SINGLE_ITEMS, + &editor.button.draw_single, GD_TYPE_RADIO_BUTTON, + "draw single items", 's' + }, + { + IMG_EDITOR_BUTTON_GFX_DRAW_CONNECTED, GADGET_ID_CONNECTED_ITEMS, + &editor.button.draw_connected, GD_TYPE_RADIO_BUTTON, + "draw connected items", 'd' + }, + { + IMG_EDITOR_BUTTON_GFX_DRAW_LINE, GADGET_ID_LINE, + &editor.button.draw_line, GD_TYPE_RADIO_BUTTON, + "draw lines", 'l' + }, + { + IMG_EDITOR_BUTTON_GFX_DRAW_ARC, GADGET_ID_ARC, + &editor.button.draw_arc, GD_TYPE_RADIO_BUTTON, + "draw arcs", 'a' + }, + { + IMG_EDITOR_BUTTON_GFX_DRAW_RECTANGLE, GADGET_ID_RECTANGLE, + &editor.button.draw_rectangle, GD_TYPE_RADIO_BUTTON, + "draw outline rectangles", 'r' + }, + { + IMG_EDITOR_BUTTON_GFX_DRAW_FILLED_BOX, GADGET_ID_FILLED_BOX, + &editor.button.draw_filled_box, GD_TYPE_RADIO_BUTTON, + "draw filled rectangles", 'R' + }, + { + IMG_EDITOR_BUTTON_GFX_ROTATE_UP, GADGET_ID_WRAP_UP, + &editor.button.rotate_up, GD_TYPE_NORMAL_BUTTON, + "wrap (rotate) level up", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_DRAW_TEXT, GADGET_ID_TEXT, + &editor.button.draw_text, GD_TYPE_RADIO_BUTTON, + "enter text elements", 't' + }, + { + IMG_EDITOR_BUTTON_GFX_FLOOD_FILL, GADGET_ID_FLOOD_FILL, + &editor.button.flood_fill, GD_TYPE_RADIO_BUTTON, + "flood fill", 'f' + }, + { + IMG_EDITOR_BUTTON_GFX_ROTATE_LEFT, GADGET_ID_WRAP_LEFT, + &editor.button.rotate_left, GD_TYPE_NORMAL_BUTTON, + "wrap (rotate) level left", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_ZOOM_LEVEL, GADGET_ID_ZOOM, + &editor.button.zoom_level, GD_TYPE_NORMAL_BUTTON, + "zoom level tile size", 'z' + }, + { + IMG_EDITOR_BUTTON_GFX_ROTATE_RIGHT, GADGET_ID_WRAP_RIGHT, + &editor.button.rotate_right, GD_TYPE_NORMAL_BUTTON, + "wrap (rotate) level right", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_DRAW_RANDOM, GADGET_ID_RANDOM_PLACEMENT, + &editor.button.draw_random, GD_TYPE_NORMAL_BUTTON, + "random element placement", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_GRAB_BRUSH, GADGET_ID_GRAB_BRUSH, + &editor.button.grab_brush, GD_TYPE_RADIO_BUTTON, + "grab brush", 'b' + }, + { + IMG_EDITOR_BUTTON_GFX_ROTATE_DOWN, GADGET_ID_WRAP_DOWN, + &editor.button.rotate_down, GD_TYPE_NORMAL_BUTTON, + "wrap (rotate) level down", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_PICK_ELEMENT, GADGET_ID_PICK_ELEMENT, + &editor.button.pick_element, GD_TYPE_RADIO_BUTTON, + "pick drawing element", ',' + }, + + /* ---------- level control buttons -------------------------------------- */ + + { + IMG_EDITOR_BUTTON_GFX_UNDO, GADGET_ID_UNDO, + &editor.button.undo, GD_TYPE_NORMAL_BUTTON, + "undo last operation", 'U' + }, + { + IMG_EDITOR_BUTTON_GFX_CONF, GADGET_ID_INFO, + &editor.button.conf, GD_TYPE_NORMAL_BUTTON, + "properties of level", 'I' + }, + { + IMG_EDITOR_BUTTON_GFX_SAVE, GADGET_ID_SAVE, + &editor.button.save, GD_TYPE_NORMAL_BUTTON, + "save level", 'S' + }, + { + IMG_EDITOR_BUTTON_GFX_CLEAR, GADGET_ID_CLEAR, + &editor.button.clear, GD_TYPE_NORMAL_BUTTON, + "clear level", 'C' + }, + { + IMG_EDITOR_BUTTON_GFX_TEST, GADGET_ID_TEST, + &editor.button.test, GD_TYPE_NORMAL_BUTTON, + "test level", 'T' + }, + { + IMG_EDITOR_BUTTON_GFX_EXIT, GADGET_ID_EXIT, + &editor.button.exit, GD_TYPE_NORMAL_BUTTON, + "exit level editor", 'E' + }, + + /* ---------- CE and GE control buttons ---------------------------------- */ + + { + IMG_EDITOR_BUTTON_GFX_CE_COPY_FROM, GADGET_ID_CUSTOM_COPY_FROM, + &editor.button.ce_copy_from, GD_TYPE_RADIO_BUTTON, + "copy settings from other element", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_CE_COPY_TO, GADGET_ID_CUSTOM_COPY_TO, + &editor.button.ce_copy_to, GD_TYPE_RADIO_BUTTON, + "copy settings to other element", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_CE_SWAP, GADGET_ID_CUSTOM_EXCHANGE, + &editor.button.ce_swap, GD_TYPE_RADIO_BUTTON, + "exchange element with other element", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_CE_COPY, GADGET_ID_CUSTOM_COPY, + &editor.button.ce_copy, GD_TYPE_NORMAL_BUTTON, + "copy settings from this element", 0 + }, + { + IMG_EDITOR_BUTTON_GFX_CE_PASTE, GADGET_ID_CUSTOM_PASTE, + &editor.button.ce_paste, GD_TYPE_NORMAL_BUTTON, + "paste settings to this element", 0 + }, + + /* ---------- palette control buttons ------------------------------------ */ + + { + IMG_EDITOR_BUTTON_GFX_PROPERTIES, GADGET_ID_PROPERTIES, + &editor.button.properties, GD_TYPE_NORMAL_BUTTON, + "properties of drawing element", 'p' + } }; static int random_placement_value = 10; @@ -5211,48 +5301,44 @@ void getElementListGraphicSource(int element, Bitmap **bitmap, int *x, int *y) static void CreateControlButtons() { - Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned int event_mask; int i; /* create toolbox buttons */ for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++) { - int id = i; - int width, height; - int gd_xoffset, gd_yoffset; - int gd_x1, gd_x2, gd_y1, gd_y2; - int gd_x1a, gd_x2a, gd_y1a, gd_y2a; - int button_type; - int radio_button_nr; - boolean checked; - - if (id == GADGET_ID_SINGLE_ITEMS || - id == GADGET_ID_CONNECTED_ITEMS || - id == GADGET_ID_LINE || - id == GADGET_ID_ARC || - id == GADGET_ID_TEXT || - id == GADGET_ID_RECTANGLE || - id == GADGET_ID_FILLED_BOX || - id == GADGET_ID_FLOOD_FILL || - id == GADGET_ID_GRAB_BRUSH || - id == GADGET_ID_PICK_ELEMENT || - id == GADGET_ID_CUSTOM_COPY_FROM || - id == GADGET_ID_CUSTOM_COPY_TO || - id == GADGET_ID_CUSTOM_EXCHANGE) + int id = controlbutton_info[i].gadget_id; + int type = controlbutton_info[i].gadget_type; + int graphic = controlbutton_info[i].graphic; + struct XY *pos = controlbutton_info[i].pos; + struct GraphicInfo *gd = &graphic_info[graphic]; + Bitmap *gd_bitmap = gd->bitmap; + int gd_x1 = gd->src_x; + int gd_y1 = gd->src_y; + int gd_x2 = gd->src_x + gd->pressed_xoffset; + int gd_y2 = gd->src_y + gd->pressed_yoffset; + int gd_x1a = gd->src_x + gd->active_xoffset; + int gd_y1a = gd->src_y + gd->active_yoffset; + int gd_x2a = gd->src_x + gd->active_xoffset + gd->pressed_xoffset; + int gd_y2a = gd->src_y + gd->active_yoffset + gd->pressed_yoffset; + int width = gd->width; + int height = gd->height; + int x = pos->x; + int y = pos->y; + unsigned int event_mask; + int radio_button_nr = RADIO_NR_NONE; + boolean checked = FALSE; + + if (type == GD_TYPE_RADIO_BUTTON) { - button_type = GD_TYPE_RADIO_BUTTON; - radio_button_nr = RADIO_NR_DRAWING_TOOLBOX; - checked = (id == drawing_function ? TRUE : FALSE); event_mask = GD_EVENT_PRESSED; + radio_button_nr = RADIO_NR_DRAWING_TOOLBOX; + + if (id == drawing_function) + checked = TRUE; } else { - button_type = GD_TYPE_NORMAL_BUTTON; - radio_button_nr = RADIO_NR_NONE; - checked = FALSE; - if (id == GADGET_ID_WRAP_LEFT || id == GADGET_ID_WRAP_RIGHT || id == GADGET_ID_WRAP_UP || @@ -5262,115 +5348,25 @@ static void CreateControlButtons() event_mask = GD_EVENT_RELEASED; } - if (id < ED_NUM_CTRL1_BUTTONS) - { - int x = i % ED_CTRL1_BUTTONS_HORIZ; - int y = i / ED_CTRL1_BUTTONS_HORIZ; - - gd_xoffset = ED_CTRL1_BUTTONS_XPOS + x * ED_CTRL1_BUTTON_XSIZE; - gd_yoffset = ED_CTRL1_BUTTONS_YPOS + y * ED_CTRL1_BUTTON_YSIZE; - width = ED_CTRL1_BUTTON_XSIZE; - height = ED_CTRL1_BUTTON_YSIZE; - - gd_x1 = DOOR_GFX_PAGEX8 + gd_xoffset; - gd_x2 = DOOR_GFX_PAGEX7 + gd_xoffset; - gd_y1 = DOOR_GFX_PAGEY1 + ED_CTRL1_BUTTONS_GFX_YPOS + gd_yoffset; - gd_y2 = DOOR_GFX_PAGEY1 + ED_CTRL1_BUTTONS_ALT_GFX_YPOS + gd_yoffset; - } - else if (id < ED_NUM_CTRL1_2_BUTTONS) - { - int x = (i - ED_NUM_CTRL1_BUTTONS) % ED_CTRL2_BUTTONS_HORIZ; - int y = (i - ED_NUM_CTRL1_BUTTONS) / ED_CTRL2_BUTTONS_HORIZ; - - gd_xoffset = ED_CTRL2_BUTTONS_XPOS + x * ED_CTRL2_BUTTON_XSIZE; - gd_yoffset = ED_CTRL2_BUTTONS_YPOS + y * ED_CTRL2_BUTTON_YSIZE; - width = ED_CTRL2_BUTTON_XSIZE; - height = ED_CTRL2_BUTTON_YSIZE; - - gd_x1 = DOOR_GFX_PAGEX8 + gd_xoffset; - gd_x2 = DOOR_GFX_PAGEX7 + gd_xoffset; - gd_y1 = DOOR_GFX_PAGEY1 + ED_CTRL2_BUTTONS_GFX_YPOS + gd_yoffset; - gd_y2 = 0; /* no alternative graphic for these buttons */ - } - else if (id < ED_NUM_CTRL1_3_BUTTONS) - { - int x = (i - ED_NUM_CTRL1_2_BUTTONS) % ED_CTRL3_BUTTONS_HORIZ + 1; - int y = (i - ED_NUM_CTRL1_2_BUTTONS) / ED_CTRL3_BUTTONS_HORIZ; - - gd_xoffset = ED_CTRL3_BUTTONS_XPOS + x * ED_CTRL3_BUTTON_XSIZE; - gd_yoffset = ED_CTRL3_BUTTONS_YPOS + y * ED_CTRL3_BUTTON_YSIZE; - width = ED_CTRL3_BUTTON_XSIZE; - height = ED_CTRL3_BUTTON_YSIZE; - - gd_x1 = DOOR_GFX_PAGEX6 + gd_xoffset; - gd_x2 = DOOR_GFX_PAGEX5 + gd_xoffset; - gd_y1 = DOOR_GFX_PAGEY1 + ED_CTRL3_BUTTONS_GFX_YPOS + gd_yoffset; - gd_y2 = DOOR_GFX_PAGEY1 + ED_CTRL3_BUTTONS_ALT_GFX_YPOS + gd_yoffset; - } - else if (id < ED_NUM_CTRL1_4_BUTTONS) + if (id == GADGET_ID_PROPERTIES) { - int x = (i - ED_NUM_CTRL1_3_BUTTONS) % ED_CTRL4_BUTTONS_HORIZ; - int y = (i - ED_NUM_CTRL1_3_BUTTONS) / ED_CTRL4_BUTTONS_HORIZ + 3; - - gd_xoffset = ED_CTRL4_BUTTONS_XPOS + x * ED_CTRL4_BUTTON_XSIZE; - gd_yoffset = ED_CTRL4_BUTTONS_YPOS + y * ED_CTRL4_BUTTON_YSIZE; - width = ED_CTRL4_BUTTON_XSIZE; - height = ED_CTRL4_BUTTON_YSIZE; - - gd_x1 = DOOR_GFX_PAGEX6 + ED_CTRL4_BUTTONS_GFX_XPOS + gd_xoffset; - gd_x2 = DOOR_GFX_PAGEX5 + ED_CTRL4_BUTTONS_GFX_XPOS + gd_xoffset; - gd_y1 = DOOR_GFX_PAGEY1 + ED_CTRL4_BUTTONS_GFX_YPOS + gd_yoffset; - gd_y2 = 0; /* no alternative graphic for these buttons */ - } - else - { - int graphic = IMG_EDITOR_BUTTON_GFX_PROPERTIES; - struct GraphicInfo *gd = &graphic_info[graphic]; - struct XY ebi = editor.button.properties; - - gd_bitmap = gd->bitmap; - gd_xoffset = DX - EX + ebi.x; - gd_yoffset = DY - EY + ebi.y; - width = gd->width; - height = gd->height; - - gd_x1 = gd->src_x; - gd_x2 = 0; /* no alternative graphic for these buttons */ - gd_y1 = gd->src_y; - gd_y2 = gd->src_y + gd->pressed_yoffset; - } - - if (id < ED_NUM_CTRL1_4_BUTTONS) - { - gd_x1a = gd_x1; - gd_y1a = gd_y2; - gd_x2a = gd_x2; - gd_y2a = gd_y2; - gd_x1 = gd_x1; - gd_y1 = gd_y1; - gd_x2 = gd_x2; - gd_y2 = gd_y1; + x += DX; + y += DY; } else { - gd_x1a = 0; - gd_y1a = 0; - gd_x2a = 0; - gd_y2a = 0; - gd_x1 = gd_x1; - gd_y1 = gd_y1; - gd_x2 = gd_x1; - gd_y2 = gd_y2; + x += EX; + y += EY; } gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, - GDI_INFO_TEXT, control_info[i].text, - GDI_X, EX + gd_xoffset, - GDI_Y, EY + gd_yoffset, + GDI_INFO_TEXT, controlbutton_info[i].infotext, + GDI_X, x, + GDI_Y, y, GDI_WIDTH, width, GDI_HEIGHT, height, - GDI_TYPE, button_type, + GDI_TYPE, type, GDI_STATE, GD_BUTTON_UNPRESSED, GDI_RADIO_NR, radio_button_nr, GDI_CHECKED, checked, @@ -5409,36 +5405,27 @@ static void CreateControlButtons() int id = scrollbutton_info[i].gadget_id; int graphic = scrollbutton_info[i].graphic; struct GraphicInfo *gd = &graphic_info[graphic]; - int x, y, width, height; - int gd_x1, gd_x2, gd_y1, gd_y2; - - x = scrollbutton_pos[i].x; - y = scrollbutton_pos[i].y; - - event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED; + Bitmap *gd_bitmap = gd->bitmap; + int gd_x1 = gd->src_x; + int gd_y1 = gd->src_y; + int gd_x2 = gd->src_x + gd->pressed_xoffset; + int gd_y2 = gd->src_y + gd->pressed_yoffset; + int width = gd->width; + int height = gd->height; + int x = scrollbutton_pos[i].x; + int y = scrollbutton_pos[i].y; + unsigned int event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED; if (id == GADGET_ID_SCROLL_LIST_UP || id == GADGET_ID_SCROLL_LIST_DOWN) { x += DX; y += DY; - width = gd->width; - height = gd->height; - gd_x1 = gd->src_x; - gd_y1 = gd->src_y; - gd_x2 = gd->src_x + gd->pressed_xoffset; - gd_y2 = gd->src_y + gd->pressed_yoffset; } else { x += SX; y += SY; - width = gd->width; - height = gd->height; - gd_x1 = gd->src_x; - gd_y1 = gd->src_y; - gd_x2 = gd->src_x + gd->pressed_xoffset; - gd_y2 = gd->src_y + gd->pressed_yoffset; } gi = CreateGadget(GDI_CUSTOM_ID, id, @@ -5466,27 +5453,24 @@ static void CreateControlButtons() /* create buttons for element list */ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++) { - struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_PALETTE_BUTTON]; + int id = GADGET_ID_ELEMENTLIST_FIRST + i; + int graphic = IMG_EDITOR_PALETTE_BUTTON; + struct GraphicInfo *gd = &graphic_info[graphic]; + Bitmap *gd_bitmap = gd->bitmap; Bitmap *deco_bitmap; int deco_x, deco_y, deco_xpos, deco_ypos; - int gd_xoffset, gd_yoffset; - int gd_x1, gd_y1, gd_x2, gd_y2; - int x = i % ED_ELEMENTLIST_BUTTONS_HORIZ; - int y = i / ED_ELEMENTLIST_BUTTONS_HORIZ; - int id = GADGET_ID_ELEMENTLIST_FIRST + i; + int gd_x1 = gd->src_x; + int gd_y1 = gd->src_y; + int gd_x2 = gd->src_x + gd->pressed_xoffset; + int gd_y2 = gd->src_y + gd->pressed_yoffset; + int xx = i % ED_ELEMENTLIST_BUTTONS_HORIZ; + int yy = i / ED_ELEMENTLIST_BUTTONS_HORIZ; + int x = DX + ED_ELEMENTLIST_XPOS + xx * gd->width; + int y = DY + ED_ELEMENTLIST_YPOS + yy * gd->height; int element = editor_elements[i]; int tile_size = (editor.palette.tile_size >= TILESIZE ? TILESIZE : MINI_TILESIZE); - - event_mask = GD_EVENT_RELEASED; - - gd_xoffset = ED_ELEMENTLIST_XPOS + x * gd->width; - gd_yoffset = ED_ELEMENTLIST_YPOS + y * gd->height; - - gd_x1 = gd->src_x; - gd_y1 = gd->src_y; - gd_x2 = gd->src_x + gd->pressed_xoffset; - gd_y2 = gd->src_y + gd->pressed_yoffset; + unsigned int event_mask = GD_EVENT_RELEASED; getElementListGraphicSource(element, &deco_bitmap, &deco_x, &deco_y); deco_xpos = (gd->width - tile_size) / 2; @@ -5495,14 +5479,14 @@ static void CreateControlButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, GDI_INFO_TEXT, getElementInfoText(element), - GDI_X, DX + gd_xoffset, - GDI_Y, DY + gd_yoffset, + GDI_X, x, + GDI_Y, y, GDI_WIDTH, gd->width, GDI_HEIGHT, gd->height, GDI_TYPE, GD_TYPE_NORMAL_BUTTON, GDI_STATE, GD_BUTTON_UNPRESSED, - GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1, - GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2, + GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1, + 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, tile_size, tile_size, @@ -6686,7 +6670,6 @@ static void UnmapLevelEditorToolboxCustomGadgets() static void MapOrUnmapLevelEditorToolboxDrawingGadgets(boolean map) { - Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int i; for (i = 0; i < ED_NUM_CTRL1_BUTTONS; i++) @@ -6697,14 +6680,17 @@ static void MapOrUnmapLevelEditorToolboxDrawingGadgets(boolean map) struct GadgetInfo *gi = level_editor_gadget[i]; if (map) + { MapGadget(gi); + } else { + int graphic = IMG_EDITOR_NO_TOOLBOX_BUTTON; + struct GraphicInfo *gd = &graphic_info[graphic]; + UnmapGadget(gi); - BlitBitmap(gd_bitmap, drawto, - DOOR_GFX_PAGEX6 + ED_CTRL_NO_BUTTONS_GFX_XPOS, - DOOR_GFX_PAGEY1 + ED_CTRL_NO_BUTTONS_GFX_YPOS, + BlitBitmap(gd->bitmap, drawto, gd->src_x, gd->src_y, gi->width, gi->height, gi->x, gi->y); redraw_mask |= REDRAW_DOOR_3; @@ -11718,7 +11704,7 @@ void HandleLevelEditorKeyInput(Key key) ClickOnGadget(level_editor_gadget[GADGET_ID_TEST], button); else for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++) - if (letter && letter == control_info[i].shortcut) + if (letter && letter == controlbutton_info[i].shortcut) if (!anyTextGadgetActive()) ClickOnGadget(level_editor_gadget[i], button); } @@ -11773,7 +11759,7 @@ void PrintEditorGadgetInfoText(struct GadgetInfo *gi) if (gi->custom_id < ED_NUM_CTRL_BUTTONS) { - int key = control_info[gi->custom_id].shortcut; + int key = controlbutton_info[gi->custom_id].shortcut; if (key) { diff --git a/src/game.c b/src/game.c index 59a77329..cacf857b 100644 --- a/src/game.c +++ b/src/game.c @@ -14700,7 +14700,7 @@ boolean CheckEngineSnapshot() static struct { int graphic; - struct Rect *pos; + struct XY *pos; int gadget_id; char *infotext; } gamebutton_info[NUM_GAME_BUTTONS] = @@ -14746,7 +14746,7 @@ void CreateGameButtons() for (i = 0; i < NUM_GAME_BUTTONS; i++) { struct GraphicInfo *gfx = &graphic_info[gamebutton_info[i].graphic]; - struct Rect *pos = gamebutton_info[i].pos; + struct XY *pos = gamebutton_info[i].pos; struct GadgetInfo *gi; int button_type; boolean checked; diff --git a/src/game.h b/src/game.h index 22ea2e7e..86c26eeb 100644 --- a/src/game.h +++ b/src/game.h @@ -86,16 +86,16 @@ struct GamePanelInfo struct GameButtonInfo { - struct Rect stop; - struct Rect pause; - struct Rect play; + struct XY stop; + struct XY pause; + struct XY play; - struct Rect sound_music; - struct Rect sound_loops; - struct Rect sound_simple; + struct XY sound_music; + struct XY sound_loops; + struct XY sound_simple; - struct Rect save; - struct Rect load; + struct XY save; + struct XY load; }; struct GameInfo diff --git a/src/main.h b/src/main.h index 523b9793..6eddb538 100644 --- a/src/main.h +++ b/src/main.h @@ -2243,7 +2243,38 @@ struct EditorButtonInfo { struct XY prev_level; struct XY next_level; + struct XY properties; + + struct XY draw_single; + struct XY draw_connected; + struct XY draw_line; + struct XY draw_arc; + struct XY draw_rectangle; + struct XY draw_filled_box; + struct XY rotate_up; + struct XY draw_text; + struct XY flood_fill; + struct XY rotate_left; + struct XY zoom_level; + struct XY rotate_right; + struct XY draw_random; + struct XY grab_brush; + struct XY rotate_down; + struct XY pick_element; + + struct XY ce_copy_from; + struct XY ce_copy_to; + struct XY ce_swap; + struct XY ce_copy; + struct XY ce_paste; + + struct XY undo; + struct XY conf; + struct XY save; + struct XY clear; + struct XY test; + struct XY exit; }; struct EditorInputInfo diff --git a/src/tape.c b/src/tape.c index 342f346d..f6f75061 100644 --- a/src/tape.c +++ b/src/tape.c @@ -195,7 +195,7 @@ static void DrawVideoDisplay_Graphics(unsigned int state, unsigned int value) static struct { int graphic; - struct Rect *pos; + struct XY *pos; } video_pos[NUM_TAPE_FUNCTIONS][NUM_TAPE_FUNCTION_PARTS] = { @@ -253,7 +253,7 @@ static void DrawVideoDisplay_Graphics(unsigned int state, unsigned int value) for (j = 0; j < NUM_TAPE_FUNCTION_PARTS; j++) /* label or symbol */ { int graphic = video_pos[i][j].graphic; - struct Rect *pos = video_pos[i][j].pos; + struct XY *pos = video_pos[i][j].pos; if (graphic == -1 || pos->x == -1 || @@ -1217,7 +1217,7 @@ void AutoPlayTape() static struct { int graphic; - struct Rect *pos; + struct XY *pos; int gadget_id; char *infotext; } tapebutton_info[NUM_TAPE_BUTTONS] = @@ -1256,7 +1256,7 @@ void CreateTapeButtons() for (i = 0; i < NUM_TAPE_BUTTONS; i++) { struct GraphicInfo *gfx = &graphic_info[tapebutton_info[i].graphic]; - struct Rect *pos = tapebutton_info[i].pos; + struct XY *pos = tapebutton_info[i].pos; struct GadgetInfo *gi; int gd_x = gfx->src_x; int gd_y = gfx->src_y; diff --git a/src/tape.h b/src/tape.h index 934239f2..e77cd86c 100644 --- a/src/tape.h +++ b/src/tape.h @@ -96,41 +96,41 @@ struct TapeButtonInfo { - struct Rect eject; - struct Rect stop; - struct Rect pause; - struct Rect record; - struct Rect play; + struct XY eject; + struct XY stop; + struct XY pause; + struct XY record; + struct XY play; }; struct TapeSymbolInfo { - struct Rect eject; - struct Rect stop; - struct Rect pause; - struct Rect record; - struct Rect play; - struct Rect fast_forward; - struct Rect warp_forward; - struct Rect warp_forward_blind; - struct Rect pause_before_end; - struct Rect single_step; + struct XY eject; + struct XY stop; + struct XY pause; + struct XY record; + struct XY play; + struct XY fast_forward; + struct XY warp_forward; + struct XY warp_forward_blind; + struct XY pause_before_end; + struct XY single_step; }; struct TapeLabelInfo { - struct Rect eject; - struct Rect stop; - struct Rect pause; - struct Rect record; - struct Rect play; - struct Rect fast_forward; - struct Rect warp_forward; - struct Rect warp_forward_blind; - struct Rect pause_before_end; - struct Rect single_step; - struct Rect date; - struct Rect time; + struct XY eject; + struct XY stop; + struct XY pause; + struct XY record; + struct XY play; + struct XY fast_forward; + struct XY warp_forward; + struct XY warp_forward_blind; + struct XY pause_before_end; + struct XY single_step; + struct XY date; + struct XY time; }; struct TapeTextInfo -- 2.34.1